ukui-notification/libukui-notification/notification-settings/single-application-settings.h

66 lines
2.3 KiB
C++

//
// Created by zpf on 2023/2/22.
//
#ifndef UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H
#define UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H
#include <QObject>
#include "settings-properties.h"
#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();
bool allowNotify() const;
void setAllowNotify(bool enable);
bool allowSound() const ;
void setAllowSound(bool enable);
bool showContentOnLockScreen() const ;
void setShowContentOnLockScreen(bool enable);
bool showNotificationOnLockScreen() const;
void setShowNotificationOnLockScreen(bool enable);
SettingsProperty::Property popupStyle() const;
void setPopupStyle(SettingsProperty::Property style);
QString desktopEntry() const;
Q_SIGNALS:
void allowNotifyChanged(bool);
void allowSoundChanged(bool);
void showContentOnLockScreenChanged(bool);
void showNotificationOnLockScreenChanged(bool);
void popupStyleChanged(SettingsProperty::Property);
void uninstalled();
private Q_SLOTS:
void init();
void settingsDataChanged();
void appUninstalled(const QString &desktopEntry);
private:
SingleApplicationSettingsPrivate *d = nullptr;
};
}
#endif //UKUI_NOTIFICATION_SINGLE_APPLICATION_SETTINGS_H