Debian Codegraph @

qml/Lomiri/Action/qml-manager.h

raw
1 /* This file is part of lomiri-action-api
2 * Copyright 2013 Canonical Ltd.
3 *
4 * lomiri-action-api is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * lomiri-action-api is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #ifndef LOMIRI_ACTION_QML_ACTION_MANAGER
18 #define LOMIRI_ACTION_QML_ACTION_MANAGER
19
20 #include <QQmlListProperty>
21 #include <lomiri/action/ActionManager>
22 #include <lomiri/action/Action>
23 #include <lomiri/action/ActionContext>
24
25 namespace lomiri {
26 namespace action {
27 namespace qml {
28 class ActionManager;
29 }
30 }
31 }
32
33 # if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
34 #define QQMLISTPROPERTY_INT qsizetype
35 # else
36 #define QQMLISTPROPERTY_INT int
37 # endif
38
39 class lomiri::action::qml::ActionManager : public lomiri::action::ActionManager
40 {
41 Q_OBJECT
42 Q_DISABLE_COPY(ActionManager)
43
44 Q_PROPERTY(QQmlListProperty<lomiri::action::ActionContext> localContexts
45 READ localContexts_list)
46 Q_PROPERTY(QQmlListProperty<lomiri::action::Action> actions
47 READ actions_list)
48
49 Q_CLASSINFO("DefaultProperty", "actions")
50
51 public:
52
53 ActionManager(QObject *parent = 0);
54 virtual ~ActionManager();
55
56 QQmlListProperty<lomiri::action::ActionContext> localContexts_list();
57 QQmlListProperty<lomiri::action::Action> actions_list();
58
59 private:
60 static void contextAppend(QQmlListProperty<ActionContext> *list, ActionContext *context);
61 static void contextClear(QQmlListProperty<ActionContext> *list);
62 static QQMLISTPROPERTY_INT contextCount(QQmlListProperty<ActionContext> *list);
63
64 static void actionAppend(QQmlListProperty<Action> *list, Action *action);
65 static void actionClear(QQmlListProperty<Action> *list);
66 static QQMLISTPROPERTY_INT actionCount(QQmlListProperty<Action> *list);
67 };
68 #endif