74 lines
1.9 KiB
C++
74 lines
1.9 KiB
C++
//
|
||
//
|
||
//
|
||
#ifndef NotificationSettingsPrivate_H
|
||
#define NotificationSettingsPrivate_H
|
||
|
||
#include "settings-manager.h"
|
||
#include <UkuiSearchAppInfoTable>
|
||
#include <QJsonObject>
|
||
#include <QFileSystemWatcher>
|
||
#include <QList>
|
||
#include "settings-properties.h"
|
||
|
||
namespace UkuiNotification {
|
||
|
||
|
||
#define NOTIFICATION_SETTINGS_VERSION "1.0"
|
||
|
||
class SettingsManagerPrivate : public QObject
|
||
{
|
||
friend class SettingsManager;
|
||
Q_OBJECT
|
||
public:
|
||
explicit SettingsManagerPrivate(QObject* parent = nullptr);
|
||
~SettingsManagerPrivate();
|
||
void init();
|
||
|
||
private Q_SLOTS:
|
||
/**
|
||
* @brief checkAndLoad
|
||
* 检查通知配置文件,不存在则初始化生成默认配置文件,存在则根据配置文件版本判断是否更新配置文件。
|
||
*/
|
||
void checkAndLoad();
|
||
private:
|
||
/**
|
||
* @brief createSettingsFile
|
||
* 初始化创建通知配置文件。
|
||
*/
|
||
void createSettingsFile();
|
||
|
||
/**
|
||
* @brief updateSettingsFile
|
||
* 更新通知配置文件。
|
||
*/
|
||
void updateSettingsFile();
|
||
|
||
/**
|
||
* @brief getAppInfo
|
||
* 从搜索应用数据库服务中获取desktop信息。
|
||
* @param appInfo
|
||
* appInfo中的key为QString类型的desktop文件路径,value为QStringList类型的数据集,目前依次包括local_name、icon,可扩展
|
||
*/
|
||
void getAppInfo(QMap<QString, QStringList> &appInfoMap);
|
||
|
||
void initSettingsData(QJsonObject &data);
|
||
|
||
public Q_SLOTS:
|
||
void desktopFileAdd(const QVector<UkuiSearch::AppInfoResult> &data);
|
||
void desktopFileDelete(const QStringList &data);
|
||
Q_SIGNALS:
|
||
void settingsUpdateFinished();
|
||
void appUninstalled(const QString &desktopEntry);
|
||
|
||
private:
|
||
void save2SettingsFile(const QJsonObject &jsonDocData);
|
||
QJsonObject m_settingsData;
|
||
QFileSystemWatcher *m_watcher = nullptr;
|
||
UkuiSearch::AppInfoTable * m_appDataServiceClient = nullptr;
|
||
QJsonObject m_applicationDefaultSettings;
|
||
};
|
||
|
||
}
|
||
#endif // NotificationSettingsPrivate_H
|