dtknotifications
notification development tool kit
dnotificationtypes.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 <QSharedPointer>
8#include <QDebugStateSaver>
9#include <QVariant>
10#include "dtknotification_global.h"
11
12DNOTIFICATIONS_BEGIN_NAMESPACE
14{
15 QString appName;
16 QString id;
17 QString appIcon;
18 QString summary;
19 QString body;
20 QStringList actions;
21 QVariantMap hints;
22 QString ctime;
24 QString timeout;
25 friend bool operator==(const DNotificationData &lhs, const DNotificationData &rhs)
26 {
27 return lhs.appName == rhs.appName
28 && lhs.id == rhs.id
29 && lhs.appIcon == rhs.appIcon
30 && lhs.summary == rhs.summary
31 && lhs.body == rhs.body
32 && lhs.actions == rhs.actions
33 && lhs.hints == rhs.hints
34 && lhs.ctime == rhs.ctime
35 && lhs.replacesId == rhs.replacesId
36 && lhs.timeout == rhs.timeout;
37 }
38
39 friend bool operator==(const QVariantMap& lhs, const QVariantMap& rhs)
40 {
41 if (lhs.size() != rhs.size()) {
42 return false;
43 }
44
45 for (auto it = lhs.constBegin(); it != lhs.constEnd(); ++it) {
46 auto key = it.key();
47 if (!rhs.contains(key) || lhs[key] != rhs[key]) {
48 return false;
49 }
50 }
51
52 return true;
53 }
54
55};
56typedef QSharedPointer<DNotificationData> DNotificationDataPtr;
57
58enum class ClosedReason {
59 Expired = 1,
61 Closed,
63};
64
66 AppName,
67 AppIcon,
68 EnableNotification,
69 EnablePreview,
70 EnableSound,
71 ShowInNotificationCenter,
72 LockScreenShowNofitication
73};
74
76 DNDMode,
77 LockScreenOpenDNDMode,
78 OpenByTimeInterval,
79 StartTime,
80 EndTime,
81 ShowIcon
82};
83
85 QString name;
86 QString vendor;
87 QString version;
88 QString spec_version;
89 friend bool operator==(const ServerInformation &lhs, const ServerInformation &rhs)
90 {
91 return lhs.name == rhs.name
92 && lhs.vendor == rhs.vendor
93 && lhs.version == rhs.version
94 && lhs.spec_version == rhs.spec_version;
95 }
96};
97
98QDebug operator<<(QDebug debug, const DNotificationData &nofitication);
99QDebug operator<<(QDebug debug, const ServerInformation &serverInformation);
100
101DNOTIFICATIONS_END_NAMESPACE
102
103Q_DECLARE_METATYPE(DNOTIFICATIONS_NAMESPACE::ClosedReason)
104Q_DECLARE_METATYPE(DNOTIFICATIONS_NAMESPACE::ServerInformation)
105Q_DECLARE_METATYPE(DNOTIFICATIONS_NAMESPACE::AppNotificationConfigItem)
106Q_DECLARE_METATYPE(DNOTIFICATIONS_NAMESPACE::DNDModeNotificaitonConfigItem)
AppNotificationConfigItem
应用通知配置信息
Definition: dnotificationtypes.h:65
ClosedReason
通知关闭原因
Definition: dnotificationtypes.h:58
DNDModeNotificaitonConfigItem
应用通知配置信息
Definition: dnotificationtypes.h:75
消息记录中的一些信息
Definition: dnotificationtypes.h:14
QString summary
Definition: dnotificationtypes.h:18
QString timeout
Definition: dnotificationtypes.h:24
QString appIcon
Definition: dnotificationtypes.h:17
QVariantMap hints
Definition: dnotificationtypes.h:21
uint replacesId
Definition: dnotificationtypes.h:23
QString appName
Definition: dnotificationtypes.h:15
QStringList actions
Definition: dnotificationtypes.h:20
QString ctime
Definition: dnotificationtypes.h:22
QString body
Definition: dnotificationtypes.h:19
QString id
Definition: dnotificationtypes.h:16
服务端的一些信息
Definition: dnotificationtypes.h:84
QString spec_version
Definition: dnotificationtypes.h:88
QString vendor
Definition: dnotificationtypes.h:86
QString name
Definition: dnotificationtypes.h:85
QString version
Definition: dnotificationtypes.h:87