ukui-notification/libukui-notification/notification-settings/settings-manager-private.h

72 lines
1.7 KiB
C++

//
//
//
#ifndef NotificationSettingsPrivate_H
#define NotificationSettingsPrivate_H
#include "settings-manager.h"
#include <application-info.h>
#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信息。
*/
QStringList getAppInfo();
void initSettingsData(QJsonObject &data);
public Q_SLOTS:
void desktopFileAdd(const QStringList &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::ApplicationInfo * m_applicationInfo = nullptr;
QJsonObject m_applicationDefaultSettings;
};
}
#endif // NotificationSettingsPrivate_H