Unity 8
sharedunitymenumodel.h
1 /*
2  * Copyright 2014 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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 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 
18 #ifndef SHAREDUNITYMENUMODEL_H
19 #define SHAREDUNITYMENUMODEL_H
20 
21 #include "unityindicatorsglobal.h"
22 
23 #include <QObject>
24 #include <QSharedPointer>
25 #include <QVariantMap>
26 
27 class UnityMenuModel;
28 
29 class UNITYINDICATORS_EXPORT SharedUnityMenuModel : public QObject
30 {
31  Q_OBJECT
32  Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged)
33  Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged)
34  Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged)
35  Q_PROPERTY(UnityMenuModel* model READ model NOTIFY modelChanged)
36 
37 public:
38  SharedUnityMenuModel(QObject* parent = nullptr);
39 
40  QByteArray busName() const;
41  void setBusName(const QByteArray&);
42 
43  QByteArray menuObjectPath() const;
44  void setMenuObjectPath(const QByteArray&);
45 
46  QVariantMap actions() const;
47  void setActions(const QVariantMap&);
48 
49  UnityMenuModel* model() const;
50 
51 Q_SIGNALS:
52  void busNameChanged();
53  void menuObjectPathChanged();
54  void actionsChanged();
55  void modelChanged();
56 
57 private:
58  void initialize();
59 
60  QByteArray m_busName;
61  QByteArray m_menuObjectPath;
62  QVariantMap m_actions;
63  QSharedPointer<UnityMenuModel> m_model;
64 };
65 
66 #endif // SHAREDUNITYMENUMODEL_H