2023-03-01 18:53:07 +08:00
|
|
|
//
|
|
|
|
// Created by zpf on 2023/2/22.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H
|
|
|
|
#define UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H
|
|
|
|
#include <QObject>
|
2023-03-15 14:42:54 +08:00
|
|
|
#include "settings-properties.h"
|
2023-03-01 18:53:07 +08:00
|
|
|
#include <QJsonObject>
|
|
|
|
namespace UkuiNotification {
|
|
|
|
class SingleApplicationSettingsPrivate;
|
|
|
|
/**
|
|
|
|
* 一个应用的设置項
|
|
|
|
*/
|
|
|
|
class SingleApplicationSettings : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(bool allowNotify READ allowNotify WRITE setAllowNotify NOTIFY allowNotifyChanged)
|
|
|
|
Q_PROPERTY(bool allowSound READ allowSound WRITE setAllowSound NOTIFY allowSoundChanged)
|
|
|
|
Q_PROPERTY(bool showContentOnLockScreen READ showContentOnLockScreen WRITE setShowContentOnLockScreen NOTIFY showContentOnLockScreenChanged)
|
|
|
|
Q_PROPERTY(bool showNotificationOnLockScreen READ showNotificationOnLockScreen WRITE setShowNotificationOnLockScreen NOTIFY showNotificationOnLockScreenChanged)
|
|
|
|
Q_PROPERTY(SettingsProperty::Property PopupStyle READ popupStyle WRITE setPopupStyle NOTIFY popupStyleChanged)
|
|
|
|
public:
|
|
|
|
explicit SingleApplicationSettings(const QString &desktopEntry = QString(), QObject *parent = nullptr);
|
|
|
|
SingleApplicationSettings(const SingleApplicationSettings &other);
|
|
|
|
SingleApplicationSettings &operator=(const SingleApplicationSettings &other);
|
|
|
|
SingleApplicationSettings &operator=(SingleApplicationSettings &&other) Q_DECL_NOEXCEPT;
|
|
|
|
~SingleApplicationSettings();
|
|
|
|
|
2023-03-15 14:42:54 +08:00
|
|
|
bool allowNotify() const;
|
2023-03-01 18:53:07 +08:00
|
|
|
void setAllowNotify(bool enable);
|
|
|
|
|
2023-03-15 14:42:54 +08:00
|
|
|
bool allowSound() const ;
|
2023-03-01 18:53:07 +08:00
|
|
|
void setAllowSound(bool enable);
|
|
|
|
|
2023-03-15 14:42:54 +08:00
|
|
|
bool showContentOnLockScreen() const ;
|
2023-03-01 18:53:07 +08:00
|
|
|
void setShowContentOnLockScreen(bool enable);
|
|
|
|
|
2023-03-15 14:42:54 +08:00
|
|
|
bool showNotificationOnLockScreen() const;
|
2023-03-01 18:53:07 +08:00
|
|
|
void setShowNotificationOnLockScreen(bool enable);
|
|
|
|
|
2023-03-15 14:42:54 +08:00
|
|
|
SettingsProperty::Property popupStyle() const;
|
2023-03-01 18:53:07 +08:00
|
|
|
void setPopupStyle(SettingsProperty::Property style);
|
|
|
|
|
2023-03-17 15:01:29 +08:00
|
|
|
QString desktopEntry() const;
|
|
|
|
|
2023-03-01 18:53:07 +08:00
|
|
|
Q_SIGNALS:
|
|
|
|
void allowNotifyChanged(bool);
|
|
|
|
void allowSoundChanged(bool);
|
|
|
|
void showContentOnLockScreenChanged(bool);
|
|
|
|
void showNotificationOnLockScreenChanged(bool);
|
|
|
|
void popupStyleChanged(SettingsProperty::Property);
|
|
|
|
void uninstalled();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
2023-03-17 15:01:29 +08:00
|
|
|
void init();
|
2023-03-01 18:53:07 +08:00
|
|
|
void settingsDataChanged();
|
|
|
|
void appUninstalled(const QString &desktopEntry);
|
|
|
|
|
|
|
|
private:
|
|
|
|
SingleApplicationSettingsPrivate *d = nullptr;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H
|