Unity 8
unitymenumodelpaths.h
1 /*
2  * Copyright (C) 2013 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Author: Nick Dedekind <nick.dedekind@canonical.com>
17  */
18 
19 #ifndef UNITY_MENU_MODEL_PATHS_H
20 #define UNITY_MENU_MODEL_PATHS_H
21 
22 #include <QVariant>
23 
24 class UnityMenuModelPaths : public QObject
25 {
26  Q_OBJECT
27 
28  Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged)
29  Q_PROPERTY(QByteArray busName READ busName NOTIFY busNameChanged)
30  Q_PROPERTY(QVariantMap actions READ actions NOTIFY actionsChanged)
31  Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath NOTIFY menuObjectPathChanged)
32 
33  Q_PROPERTY(QByteArray busNameHint READ busNameHint WRITE setBusNameHint NOTIFY busNameHintChanged)
34  Q_PROPERTY(QByteArray actionsHint READ actionsHint WRITE setActionsHint NOTIFY actionsHintChanged)
35  Q_PROPERTY(QByteArray menuObjectPathHint READ menuObjectPathHint WRITE setMenuObjectPathHint NOTIFY menuObjectPathHintChanged)
36 
37 public:
38  explicit UnityMenuModelPaths(QObject *parent = 0);
39 
40  QVariant source() const;
41  void setSource(const QVariant& data);
42 
43  QByteArray busName() const;
44  QVariantMap actions() const;
45  QByteArray menuObjectPath() const;
46 
47  QByteArray busNameHint() const;
48  QByteArray actionsHint() const;
49  QByteArray menuObjectPathHint() const;
50 
51 Q_SIGNALS:
52  void sourceChanged();
53  void busNameChanged();
54  void actionsChanged();
55  void menuObjectPathChanged();
56 
57  void busNameHintChanged();
58  void actionsHintChanged();
59  void menuObjectPathHintChanged();
60 
61 private:
62  void setBusName(const QByteArray &name);
63  void setActions(const QVariantMap& actions);
64  void setMenuObjectPath(const QByteArray &path);
65 
66  void setBusNameHint(const QByteArray& nameHint);
67  void setActionsHint(const QByteArray &actionsHint);
68  void setMenuObjectPathHint(const QByteArray &pathHint);
69 
70  void updateData();
71 
72  QVariant m_sourceData;
73  QByteArray m_busName;
74  QVariantMap m_actions;
75  QByteArray m_menuObjectPath;
76 
77  QByteArray m_busNameHint;
78  QByteArray m_actionsHint;
79  QByteArray m_menuObjectPathHint;
80 };
81 
82 #endif // UNITY_MENU_MODEL_PATHS_H