ukui-search/libsearch/appdata/application-info.h

107 lines
3.9 KiB
C
Raw Normal View History

#ifndef APPLICATIONINFO_H
#define APPLICATIONINFO_H
#include <QObject>
#include "application-property.h"
namespace UkuiSearch {
class ApplicationInfoPrivate;
class ApplicationInfo : public QObject
{
Q_OBJECT
public:
explicit ApplicationInfo(QObject *parent = nullptr);
~ApplicationInfo();
/**
* @brief getInfo
* @param desktopFile
* @param property
* @return
*/
QVariant getInfo(const QString &desktopFile, ApplicationProperty::Property property);
/**
* @brief getInfo
* @param desktopFile
* @param properties
* @return
*/
ApplicationPropertyMap getInfo(const QString &desktopFile, ApplicationProperties properties);
/**
* @brief getInfo
* @param property
* @return
*/
ApplicationInfoMap getInfo(ApplicationProperties properties);
/**
* @brief ApplicationInfo::getInfo
* get the application info that meets the restrictions
* @param restrictions: The restrictions that the search results should meet(e.g. u want get the app infos whose top state is 0)
* @param properties: Each application's information should contain these properties
* @return ApplicationInfoMap: the search result
*/
ApplicationInfoMap getInfo(ApplicationProperties properties, ApplicationPropertyMap restrictions);
/**
* @brief ApplicationInfo::searchApp
* @param keyWord: the keyword of this search for applications
* @param installAppInfoRes: the search results of applications
* @return ApplicationInfoMap: the search result
*/
ApplicationInfoMap searchApp(ApplicationProperties properties, const QString &keyword, ApplicationPropertyMap restrictions);
ApplicationInfoMap searchApp(ApplicationProperties properties, const QStringList &keywords, ApplicationPropertyMap restrictions);
/**
* @brief AppInfoTable::setAppToFavorites
* set the app to favorites apps(default is at 1)
* @param desktopfp: the desktop file path of app
*/
void setAppToFavorites(const QString &desktopFilePath);
/**
* @brief AppInfoTable::setFavoritesTo
* set the favorites state of the app to num, you can also use to change the position of the app which is one of the Favorites Apps
* @param desktopfp: the desktop file path of app
* @param num: the favorites app's position(from 1). If num is 0, it will remove the app from the favorites apps
*/
void setFavoritesOfApp(const QString &desktopFilePath, size_t num);
/**
* @brief AppInfoTable::setAppToTop
* set the app to top apps(default is at 1)
* @param desktopfp: desktop file path of app
*/
void setAppToTop(const QString &desktopFilePath);
/**
* @brief AppInfoTable::setAppTopTo
* set the top state of the app to num, you can also use to change the position of the app which is one of the Top Apps
* @param desktopfp: the desktop file path of app
* @param num: the top app's position(from 1). If num is 0, it will remove the app from the top apps
*/
void setTopOfApp(const QString &desktopFilePath, size_t num);
/**
* @brief ApplicationInfo::tranPid2DesktopFp
* find the desktop file path of the process which corresponds to the pid
* @param pid: the pid of the process which need to get its desktop file path
* @param desktopFilePath: the desktop file path of the process corresponding to pid
* @return bool:true if success,else false
*/
bool tranPidToDesktopFp(int pid, QString &desktopFilePath);
Q_SIGNALS:
void DBOpenFailed();
void appDBItems2BUpdate(ApplicationInfoMap);
void appDBItems2BUpdateAll(QStringList);
void appDBItems2BAdd(QStringList);
void appDBItems2BDelete(QStringList);
private:
ApplicationInfoPrivate *d = nullptr;
};
}
#endif // APPLICATIONINFO_H