2022-03-01 17:39:53 +08:00
|
|
|
#ifndef APPINFOTABLE_H
|
|
|
|
#define APPINFOTABLE_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
namespace UkuiSearch {
|
|
|
|
class AppInfoTablePrivate;
|
|
|
|
class AppInfoTable : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2022-06-13 13:38:47 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
typedef struct appInfoResult
|
|
|
|
{
|
|
|
|
appInfoResult() {
|
|
|
|
top = 0;
|
|
|
|
favorate = 0;
|
|
|
|
launchTimes = 0;
|
|
|
|
lock = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString desktopPath;
|
|
|
|
QString iconName;
|
|
|
|
QString appLocalName;
|
|
|
|
QString firstLetter;
|
|
|
|
QString category;
|
|
|
|
size_t top;
|
|
|
|
size_t favorate;
|
|
|
|
size_t launchTimes;
|
|
|
|
size_t lock;
|
|
|
|
|
|
|
|
} AppInfoResult;
|
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
public:
|
|
|
|
explicit AppInfoTable(QObject *parent = nullptr);
|
|
|
|
AppInfoTable(AppInfoTable &) = delete;
|
|
|
|
AppInfoTable &operator =(const AppInfoTable &) = delete;
|
|
|
|
|
2022-06-13 13:38:47 +08:00
|
|
|
bool setAppFavoritesState(QString &desktopfp, size_t num);
|
|
|
|
bool setAppTopState(QString &desktopfp, size_t num);
|
|
|
|
|
|
|
|
bool getAllAppDesktopList(QStringList &list);
|
|
|
|
bool getFavoritesAppList(QStringList &list);
|
|
|
|
bool getTopAppList(QStringList &list);
|
|
|
|
bool getLaunchTimesAppList(QStringList &list);
|
|
|
|
bool getAppCategory(QString &desktopfp, QString &category);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief getAppInfoResults
|
|
|
|
* @param appInfoResults
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
bool getAppInfoResults(QVector<AppInfoTable::AppInfoResult> &appInfoResults);
|
|
|
|
|
|
|
|
bool getAppLockState(QString &desktopfp, size_t &num);
|
|
|
|
bool getAppTopState(QString &desktopfp, size_t &num);
|
|
|
|
bool getAppLaunchedState(QString &desktopfp, size_t &num);
|
|
|
|
bool getAppFavoriteState(QString &desktopfp, size_t &num);
|
|
|
|
|
|
|
|
bool addAppShortcut2Desktop(QString &desktopfp);
|
|
|
|
bool addAppShortcut2Panel(QString &desktopfp);
|
|
|
|
|
|
|
|
bool searchInstallApp(QString &keyWord, QStringList &installAppInfoRes);
|
|
|
|
bool searchInstallApp(QStringList &keyWord, QStringList &installAppInfoRes);
|
|
|
|
|
|
|
|
bool uninstallApp(QString &desktopfp);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief lastError
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
QString lastError(void) const;
|
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
private:
|
2022-06-13 13:38:47 +08:00
|
|
|
bool setAppLaunchTimes(QString &desktopfp, size_t num);
|
|
|
|
bool setAppLockState(QString &desktopfp, size_t num);
|
|
|
|
bool updateAppLaunchTimes(QString &desktopfp);
|
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
AppInfoTablePrivate *d;
|
2022-06-23 10:12:02 +08:00
|
|
|
Q_SIGNALS:
|
|
|
|
void DBOpenFailed();
|
2022-03-01 17:39:53 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // APPINFOTABLE_H
|