dtknotifications
notification development tool kit
dabstractnotificationmodeconfig.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 Uniontech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#pragma once
6
7#include <QObject>
8#include <dexpected.h>
9
10#include "dtknotification_global.h"
11
12DNOTIFICATIONS_BEGIN_NAMESPACE
13DCORE_USE_NAMESPACE
14
15class DAbstractNotificationModeConfigPrivate;
16
17class DAbstractNotificationModeConfig : public QObject
18{
19 Q_OBJECT
20 Q_PROPERTY(QString name READ name)
21 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
22 Q_DECLARE_PRIVATE(DAbstractNotificationModeConfig)
23
24public:
25 explicit DAbstractNotificationModeConfig(const QString &name, QObject *parent = nullptr);
26 virtual ~DAbstractNotificationModeConfig() override;
27
28 QString name() const;
29
30 virtual bool enabled() const = 0;
31 virtual DExpected<void> setEnabled(bool enabled) = 0;
32
33Q_SIGNALS:
34 void enabledChanged(const bool name);
35
36protected:
37 DAbstractNotificationModeConfig(DAbstractNotificationModeConfigPrivate &d, QObject *parent = nullptr);
38 QScopedPointer<DAbstractNotificationModeConfigPrivate> d_ptr;
39};
40typedef QSharedPointer<DAbstractNotificationModeConfig> DAbstractNotificationModeConfigPtr;
41
42DNOTIFICATIONS_END_NAMESPACE
DAbstractModeNotificationConfig类
Definition: dabstractnotificationmodeconfig.h:18
void enabledChanged(const bool name)
该模式使能改变时发出enabledChanged信号
DAbstractNotificationModeConfig(const QString &name, QObject *parent=nullptr)
构造通知系统模式配置对象
virtual DExpected< void > setEnabled(bool enabled)=0
设置当前模式是否启用
QString name() const
获取模式的名称(独一无二的标识)