Lomiri
rootstateparser.h
1 /*
2  * Copyright 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 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 #ifndef ROOTSTATEPARSER_H
18 #define ROOTSTATEPARSER_H
19 
20 #include "lomiriindicatorsglobal.h"
21 
22 #include <actionstateparser.h>
23 
24 class LOMIRIINDICATORS_EXPORT RootStateParser : public ActionStateParser
25 {
26 Q_OBJECT
27 public:
28  RootStateParser(QObject* parent = nullptr);
29  virtual QVariant toQVariant(GVariant* state) const override;
30 };
31 
32 class LOMIRIINDICATORS_EXPORT RootStateObject : public QObject
33 {
34  Q_OBJECT
35 
36  Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
37  Q_PROPERTY(QString title READ title NOTIFY titleChanged)
38  Q_PROPERTY(QString leftLabel READ leftLabel NOTIFY leftLabelChanged)
39  Q_PROPERTY(QString rightLabel READ rightLabel NOTIFY rightLabelChanged)
40  Q_PROPERTY(QStringList icons READ icons NOTIFY iconsChanged)
41  Q_PROPERTY(QString accessibleName READ accessibleName NOTIFY accessibleNameChanged)
42  Q_PROPERTY(bool indicatorVisible READ indicatorVisible NOTIFY indicatorVisibleChanged)
43 public:
44  RootStateObject(QObject* parent = 0);
45 
46  virtual bool valid() const = 0;
47 
48  QString title() const;
49  QString leftLabel() const;
50  QString rightLabel() const;
51  QStringList icons() const;
52  QString accessibleName() const;
53  bool indicatorVisible() const;
54 
55  QVariantMap currentState() const { return m_currentState; }
56  void setCurrentState(const QVariantMap& currentState);
57 
58 Q_SIGNALS:
59  void updated();
60 
61  void validChanged();
62  void titleChanged();
63  void leftLabelChanged();
64  void rightLabelChanged();
65  void iconsChanged();
66  void accessibleNameChanged();
67  void indicatorVisibleChanged();
68 
69 protected:
70  RootStateParser m_parser;
71  QVariantMap m_currentState;
72 };
73 
74 #endif // ROOTSTATEPARSER_H