2022-03-01 17:39:53 +08:00
|
|
|
#ifndef APPINFOTABLEPRIVATE_H
|
|
|
|
#define APPINFOTABLEPRIVATE_H
|
2022-06-28 11:20:36 +08:00
|
|
|
|
|
|
|
#include "app-info-table.h"
|
2022-03-01 17:39:53 +08:00
|
|
|
#include <QObject>
|
2022-06-28 11:20:36 +08:00
|
|
|
#include <QDBusInterface>
|
2022-06-13 13:38:47 +08:00
|
|
|
#include <QSqlDatabase>
|
|
|
|
|
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 : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2023-03-07 17:33:08 +08:00
|
|
|
friend class AppInfoTable;
|
2022-03-01 17:39:53 +08:00
|
|
|
public:
|
|
|
|
explicit AppInfoTablePrivate(AppInfoTable *parent = nullptr);
|
|
|
|
AppInfoTablePrivate(AppInfoTablePrivate &) = delete;
|
|
|
|
AppInfoTablePrivate &operator =(const AppInfoTablePrivate &) = delete;
|
|
|
|
|
2022-07-12 11:26:03 +08:00
|
|
|
//设置应用的置顶和收藏
|
|
|
|
void setAppFavoritesState(QString &desktopfp, int num);
|
|
|
|
void setAppTopState(QString &desktopfp, int num);
|
2022-06-28 11:20:36 +08:00
|
|
|
|
2022-07-12 11:26:03 +08:00
|
|
|
//改变置顶和收藏应用位置
|
|
|
|
bool changeFavoriteAppPos(const QString &desktopfp, int pos);
|
|
|
|
bool changeTopAppPos(const QString &desktopfp, int pos);
|
2022-06-28 11:20:36 +08:00
|
|
|
|
2022-07-12 11:26:03 +08:00
|
|
|
//获取所有应用信息
|
2022-06-28 11:20:36 +08:00
|
|
|
bool getAppInfoResults(QVector<AppInfoResult> &appInfoResults);
|
2022-06-13 13:38:47 +08:00
|
|
|
|
2022-06-28 11:20:36 +08:00
|
|
|
//获取单个应用的某个状态(锁定,置顶,打开状态,收藏)
|
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
|
|
|
|
2022-06-28 11:20:36 +08:00
|
|
|
//添加快捷方式
|
2022-06-13 13:38:47 +08:00
|
|
|
bool addAppShortcut2Desktop(QString &desktopfp);
|
|
|
|
bool addAppShortcut2Panel(QString &desktopfp);
|
|
|
|
|
2022-06-28 11:20:36 +08:00
|
|
|
//搜索接口
|
2022-06-13 13:38:47 +08:00
|
|
|
bool searchInstallApp(QString &keyWord, QStringList &installAppInfoRes);
|
|
|
|
bool searchInstallApp(QStringList &keyWord, QStringList &installAppInfoRes);
|
|
|
|
|
|
|
|
|
2022-06-28 14:00:57 +08:00
|
|
|
//数据库错误信息
|
2022-06-13 13:38:47 +08:00
|
|
|
QString lastError(void) const;
|
|
|
|
|
2023-02-17 15:55:10 +08:00
|
|
|
//通过pid查找desktop文件
|
|
|
|
bool tranPidToDesktopFp(int pid, QString &desktopfp);
|
|
|
|
|
2022-06-28 14:00:57 +08:00
|
|
|
//下面的接口都不外放,暂时没啥用
|
|
|
|
bool setAppLaunchTimes(QString &desktopfp, size_t num);
|
|
|
|
bool updateAppLaunchTimes(QString &desktopfp);
|
|
|
|
bool setAppLockState(QString &desktopfp, size_t num);
|
|
|
|
bool getAllAppDesktopList(QStringList &list);
|
|
|
|
bool getFavoritesAppList(QStringList &list);
|
|
|
|
bool getTopAppList(QStringList &list);
|
|
|
|
bool getLaunchTimesAppList(QStringList &list);
|
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
private:
|
2022-06-13 13:38:47 +08:00
|
|
|
~AppInfoTablePrivate();
|
2022-06-23 10:12:02 +08:00
|
|
|
bool initDateBaseConnection();
|
|
|
|
bool openDataBase();
|
2022-06-13 13:38:47 +08:00
|
|
|
void closeDataBase();
|
|
|
|
|
2022-07-12 11:26:03 +08:00
|
|
|
QDBusInterface *m_signalTransInterface = nullptr;
|
|
|
|
QDBusInterface *m_appDBInterface = nullptr;
|
2022-06-28 11:20:36 +08:00
|
|
|
|
2022-06-13 13:38:47 +08:00
|
|
|
AppInfoTable *q = nullptr;
|
2022-10-19 17:11:05 +08:00
|
|
|
QSqlDatabase *m_database = nullptr;
|
2022-06-13 13:38:47 +08:00
|
|
|
QString m_ConnectionName;
|
2022-03-01 17:39:53 +08:00
|
|
|
|
2022-06-28 11:20:36 +08:00
|
|
|
public Q_SLOTS:
|
|
|
|
void sendAppDBItemsUpdate(QVector<AppInfoResult> results);
|
|
|
|
void sendAppDBItemsAdd(QVector<AppInfoResult> results);
|
|
|
|
void sendAppDBItemsDelete(QStringList desktopfps);
|
|
|
|
|
2022-03-01 17:39:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif // APPINFOTABLEPRIVATE_H
|