2022-03-01 17:39:53 +08:00
|
|
|
#ifndef APPINFOTABLE_H
|
|
|
|
#define APPINFOTABLE_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2022-06-28 11:20:36 +08:00
|
|
|
#include "app-db-common.h"
|
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
namespace UkuiSearch {
|
2022-06-28 11:20:36 +08:00
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
class AppInfoTablePrivate;
|
|
|
|
class AppInfoTable : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit AppInfoTable(QObject *parent = nullptr);
|
|
|
|
AppInfoTable(AppInfoTable &) = delete;
|
|
|
|
AppInfoTable &operator =(const AppInfoTable &) = delete;
|
|
|
|
|
2022-06-28 11:20:36 +08:00
|
|
|
/**
|
|
|
|
* @brief AppInfoTable::setAppFavoritesState
|
|
|
|
* set the favorites state of the app
|
|
|
|
* @param desktopfp: the desktop file path of app
|
|
|
|
* @param num: the favorites app's order(from 1)
|
|
|
|
*/
|
2022-07-12 11:26:03 +08:00
|
|
|
void setAppFavoritesState(QString &desktopfp, size_t num);
|
2022-06-28 11:20:36 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief AppInfoTable::setAppTopState
|
|
|
|
* set the top state of the app
|
|
|
|
* @param desktopfp: the desktop file path of app
|
|
|
|
* @param num: the top app's order(from 1)
|
|
|
|
*/
|
2022-07-12 11:26:03 +08:00
|
|
|
void setAppTopState(QString &desktopfp, size_t num);
|
2022-06-13 13:38:47 +08:00
|
|
|
|
|
|
|
/**
|
2022-06-28 11:20:36 +08:00
|
|
|
* @brief AppInfoTable::changeFavoriteAppPos
|
|
|
|
* change the position of the app which is one of the Favorites Apps
|
|
|
|
* @param desktopfp: desktop file path of app
|
|
|
|
* @param pos: the position which the app will be changed into
|
2022-06-13 13:38:47 +08:00
|
|
|
*/
|
2022-06-28 11:20:36 +08:00
|
|
|
bool changeFavoriteAppPos(const QString &desktopfp, size_t pos);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief AppInfoTable::changeTopAppPos
|
|
|
|
* hange the position of the app which is one of the Top Apps
|
|
|
|
* @param desktopfp: desktop file path of app
|
|
|
|
* @param pos: the position which the app will be changed into
|
|
|
|
* @return bool: true if success, else false
|
|
|
|
*/
|
|
|
|
bool changeTopAppPos(const QString &desktopfp, size_t pos);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief AppInfoTable::getAppInfoResults
|
|
|
|
* Get all App infos by passing AppInforesult Vector.
|
|
|
|
* @param AppInfoResults: a struct which includes all infos of each application
|
|
|
|
* @return bool: true if success, else false
|
|
|
|
*/
|
|
|
|
bool getAppInfoResults(QVector<AppInfoResult> &appInfoResults);
|
2022-06-13 13:38:47 +08:00
|
|
|
|
|
|
|
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);
|
2022-06-28 14:00:57 +08:00
|
|
|
bool getAppCategory(QString &desktopfp, QString &category);
|
2022-06-13 13:38:47 +08:00
|
|
|
|
|
|
|
bool addAppShortcut2Desktop(QString &desktopfp);
|
|
|
|
bool addAppShortcut2Panel(QString &desktopfp);
|
|
|
|
|
|
|
|
bool searchInstallApp(QString &keyWord, QStringList &installAppInfoRes);
|
|
|
|
bool searchInstallApp(QStringList &keyWord, QStringList &installAppInfoRes);
|
|
|
|
|
|
|
|
bool uninstallApp(QString &desktopfp);
|
|
|
|
|
|
|
|
/**
|
2022-06-28 11:20:36 +08:00
|
|
|
* @brief AppInfoTable::lastError
|
|
|
|
* the last error of the database
|
|
|
|
* @return QString: the text of the last error
|
2022-06-13 13:38:47 +08:00
|
|
|
*/
|
|
|
|
QString lastError(void) const;
|
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
private:
|
2022-06-28 14:00:57 +08:00
|
|
|
//暂不外放的接口
|
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-06-28 14:00:57 +08:00
|
|
|
bool getAllAppDesktopList(QStringList &list);
|
|
|
|
bool getFavoritesAppList(QStringList &list);
|
|
|
|
bool getTopAppList(QStringList &list);
|
|
|
|
bool getLaunchTimesAppList(QStringList &list);
|
2022-06-13 13:38:47 +08:00
|
|
|
|
2022-06-28 14:00:57 +08:00
|
|
|
private:
|
2022-03-01 17:39:53 +08:00
|
|
|
AppInfoTablePrivate *d;
|
2022-06-28 11:20:36 +08:00
|
|
|
|
2022-06-23 10:12:02 +08:00
|
|
|
Q_SIGNALS:
|
|
|
|
void DBOpenFailed();
|
2022-06-28 11:20:36 +08:00
|
|
|
void appDBItems2BUpdate(QVector<AppInfoResult>);
|
|
|
|
void appDBItems2BAdd(QVector<AppInfoResult>);
|
|
|
|
void appDBItems2BDelete(QStringList);
|
2022-03-01 17:39:53 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // APPINFOTABLE_H
|