Changeset View
Changeset View
Standalone View
Standalone View
gmenu-dbusmenu-proxy/gdbusmenutypes_p.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2018 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This library is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | * Lesser General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public | ||||
15 | * License along with this library; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
17 | * | ||||
18 | */ | ||||
19 | | ||||
20 | #pragma once | ||||
21 | | ||||
22 | #include <QDBusSignature> | ||||
23 | #include <QList> | ||||
24 | #include <QMap> | ||||
25 | #include <QVariant> | ||||
26 | | ||||
27 | class QDBusArgument; | ||||
28 | | ||||
29 | // Various | ||||
30 | using VariantMapList = QList<QVariantMap>; | ||||
31 | Q_DECLARE_METATYPE(VariantMapList); | ||||
32 | | ||||
33 | using StringBoolMap = QMap<QString, bool>; | ||||
34 | Q_DECLARE_METATYPE(StringBoolMap); | ||||
35 | | ||||
36 | // Menu item itself (Start method) | ||||
37 | struct GMenuItem | ||||
38 | { | ||||
39 | uint id; | ||||
40 | uint section; | ||||
41 | VariantMapList items; | ||||
42 | }; | ||||
43 | Q_DECLARE_METATYPE(GMenuItem); | ||||
44 | | ||||
45 | QDBusArgument &operator<<(QDBusArgument &argument, const GMenuItem &item); | ||||
46 | const QDBusArgument &operator>>(const QDBusArgument &argument, GMenuItem &item); | ||||
47 | | ||||
48 | using GMenuItemList = QList<GMenuItem>; | ||||
49 | Q_DECLARE_METATYPE(GMenuItemList); | ||||
50 | | ||||
51 | // Information about what section or submenu to use for a particular entry | ||||
52 | struct GMenuSection | ||||
53 | { | ||||
54 | uint subscription; | ||||
55 | uint menu; | ||||
56 | }; | ||||
57 | Q_DECLARE_METATYPE(GMenuSection); | ||||
58 | | ||||
59 | QDBusArgument &operator<<(QDBusArgument &argument, const GMenuSection &item); | ||||
60 | const QDBusArgument &operator>>(const QDBusArgument &argument, GMenuSection &item); | ||||
61 | | ||||
62 | // Changes of a menu item (Changed signal) | ||||
63 | struct GMenuChange | ||||
64 | { | ||||
65 | uint subscription; | ||||
66 | uint menu; | ||||
67 | | ||||
68 | uint changePosition; | ||||
69 | uint itemsToRemoveCount; | ||||
70 | VariantMapList itemsToInsert; | ||||
71 | }; | ||||
72 | Q_DECLARE_METATYPE(GMenuChange); | ||||
73 | | ||||
74 | QDBusArgument &operator<<(QDBusArgument &argument, const GMenuChange &item); | ||||
75 | const QDBusArgument &operator>>(const QDBusArgument &argument, GMenuChange &item); | ||||
76 | | ||||
77 | using GMenuChangeList = QList<GMenuChange>; | ||||
78 | Q_DECLARE_METATYPE(GMenuChangeList); | ||||
79 | | ||||
80 | // An application action | ||||
81 | struct GMenuAction | ||||
82 | { | ||||
83 | bool enabled; | ||||
84 | QDBusSignature signature; | ||||
85 | QVariantList state; | ||||
86 | }; | ||||
87 | Q_DECLARE_METATYPE(GMenuAction); | ||||
88 | | ||||
89 | QDBusArgument &operator<<(QDBusArgument &argument, const GMenuAction &item); | ||||
90 | const QDBusArgument &operator>>(const QDBusArgument &argument, GMenuAction &item); | ||||
91 | | ||||
92 | using GMenuActionMap = QMap<QString, GMenuAction>; | ||||
93 | Q_DECLARE_METATYPE(GMenuActionMap); | ||||
94 | | ||||
95 | struct GMenuActionsChange | ||||
96 | { | ||||
97 | QStringList removed; | ||||
98 | QMap<QString, bool> enabledChanged; | ||||
99 | QVariantMap stateChanged; | ||||
100 | GMenuActionMap added; | ||||
101 | }; | ||||
102 | Q_DECLARE_METATYPE(GMenuActionsChange); | ||||
103 | | ||||
104 | QDBusArgument &operator<<(QDBusArgument &argument, const GMenuActionsChange &item); | ||||
105 | const QDBusArgument &operator>>(const QDBusArgument &argument, GMenuActionsChange &item); | ||||
106 | | ||||
107 | void GDBusMenuTypes_register(); |