ukui-notification/libukui-notification/notification-settings/applications-settings.h

53 lines
1.6 KiB
C++

//
// Created by zpf on 2023/2/27.
//
#ifndef UKUI_NOTIFICATION_APPLICATIONS_SETTINGS_H
#define UKUI_NOTIFICATION_APPLICATIONS_SETTINGS_H
#include <QObject>
#include <QJsonObject>
#include "single-application-settings.h"
#include "popup-notification.h"
namespace UkuiNotification{
typedef QMap<QString, SingleApplicationSettings*> ApplicationsSettingsMap;
class ApplicationsSettingsPrivate;
/**
* SingleApplicationSettings 工厂
*/
class ApplicationsSettings : public QObject
{
Q_OBJECT
public:
static ApplicationsSettings *self();
~ApplicationsSettings();
/**
* 获取某条通知的配置
* @param notification 表示一条通知
* @return 返回的指针不需要使用者回收
*/
SingleApplicationSettings *creatSettings(const PopupNotification &notification);
ApplicationsSettingsMap &getAllApplicationsSettings();
/**
* @brief getAppSettings
* 获取当前用户某个应用通知相关配置信息。
* @param appDesktopName 传"default"获取配置默认值
*/
QJsonObject getAppSettings(const QString &appDesktopName);
bool setAppSetting(const QString &appDesktopName, SettingsProperty::Property key, const QVariant &value);
void clearCache();
Q_SIGNALS:
void applicationUninstalled(const QString &desktopEntry);
void settingsUpdated();
void applicationInstalled(const QString &desktopEntry);
private Q_SLOTS:
private:
ApplicationsSettings(QObject *parent = nullptr);
void settingsDataChanged();
ApplicationsSettingsPrivate *d = nullptr;
};
}
#endif //UKUI_NOTIFICATION_APPLICATIONS_SETTINGS_H