2023-03-01 18:53:07 +08:00
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
#ifndef NotificationSettingsPrivate_H
|
|
|
|
|
#define NotificationSettingsPrivate_H
|
|
|
|
|
|
|
|
|
|
#include "settings-manager.h"
|
2023-03-17 15:01:29 +08:00
|
|
|
|
#include <application-info.h>
|
2023-03-01 18:53:07 +08:00
|
|
|
|
#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信息。
|
|
|
|
|
*/
|
2023-03-17 15:01:29 +08:00
|
|
|
|
QStringList getAppInfo();
|
2023-03-01 18:53:07 +08:00
|
|
|
|
|
|
|
|
|
void initSettingsData(QJsonObject &data);
|
|
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
2023-03-17 15:01:29 +08:00
|
|
|
|
void desktopFileAdd(const QStringList &data);
|
2023-03-01 18:53:07 +08:00
|
|
|
|
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;
|
2023-03-17 15:01:29 +08:00
|
|
|
|
UkuiSearch::ApplicationInfo * m_applicationInfo = nullptr;
|
2023-03-01 18:53:07 +08:00
|
|
|
|
QJsonObject m_applicationDefaultSettings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif // NotificationSettingsPrivate_H
|