~ci-train-bot/unity8/ubuntu-rtm-14.09-proposed

« back to all changes in this revision

Viewing changes to plugins/Unity/Indicators/rootstateparser.h

  • Committer: CI Train Bot
  • Author(s): Nick Dedekind
  • Date: 2015-01-20 11:18:06 UTC
  • mfrom: (1410.2.8 rtm-20150113)
  • Revision ID: ci-train-bot@canonical.com-20150120111806-98c0xuq7cncqfiw7
Unhook Lights interface from indicator widgets
Approved by: Albert Astals Cid Fixes: #1385331

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 *
13
13
 * You should have received a copy of the GNU Lesser General Public License
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Authors:
17
 
 *      Nick Dedekind <nick.dedekind@canonical.com>
18
15
 */
19
16
 
20
 
#ifndef ROOTACTIONSTATE_H
21
 
#define ROOTACTIONSTATE_H
 
17
#ifndef ROOTSTATEPARSER_H
 
18
#define ROOTSTATEPARSER_H
22
19
 
23
20
#include "unityindicatorsglobal.h"
24
21
 
25
22
#include <actionstateparser.h>
26
23
 
27
 
class UnityMenuModel;
 
24
class UNITYINDICATORS_EXPORT RootStateParser : public ActionStateParser
 
25
{
 
26
public:
 
27
    RootStateParser(QObject* parent = nullptr);
 
28
    virtual QVariant toQVariant(GVariant* state) const override;
 
29
};
28
30
 
29
 
class UNITYINDICATORS_EXPORT RootActionState : public ActionStateParser
 
31
class UNITYINDICATORS_EXPORT RootStateObject : public QObject
30
32
{
31
33
    Q_OBJECT
32
 
    Q_PROPERTY(UnityMenuModel* menu READ menu WRITE setMenu NOTIFY menuChanged)
33
34
 
34
 
    Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
 
35
    Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
35
36
    Q_PROPERTY(QString title READ title NOTIFY titleChanged)
36
37
    Q_PROPERTY(QString leftLabel READ leftLabel NOTIFY leftLabelChanged)
37
38
    Q_PROPERTY(QString rightLabel READ rightLabel NOTIFY rightLabelChanged)
39
40
    Q_PROPERTY(QString accessibleName READ accessibleName NOTIFY accessibleNameChanged)
40
41
    Q_PROPERTY(bool indicatorVisible READ indicatorVisible NOTIFY indicatorVisibleChanged)
41
42
public:
42
 
    RootActionState(QObject *parent = 0);
43
 
    virtual ~RootActionState();
44
 
 
45
 
    UnityMenuModel* menu() const;
46
 
    void setMenu(UnityMenuModel* menu);
47
 
 
48
 
    int index() const;
49
 
    void setIndex(int index);
50
 
 
51
 
    bool isValid() const;
 
43
    RootStateObject(QObject* parent = 0);
 
44
 
 
45
    virtual bool valid() const = 0;
 
46
 
52
47
    QString title() const;
53
48
    QString leftLabel() const;
54
49
    QString rightLabel() const;
56
51
    QString accessibleName() const;
57
52
    bool indicatorVisible() const;
58
53
 
59
 
    // from ActionStateParser
60
 
    virtual QVariant toQVariant(GVariant* state) const override;
 
54
    QVariantMap currentState() const { return m_currentState; }
 
55
    void setCurrentState(const QVariantMap& currentState);
61
56
 
62
57
Q_SIGNALS:
63
58
    void updated();
64
59
 
65
 
    void menuChanged();
66
 
    void indexChanged();
67
 
 
68
60
    void validChanged();
69
61
    void titleChanged();
70
62
    void leftLabelChanged();
73
65
    void accessibleNameChanged();
74
66
    void indicatorVisibleChanged();
75
67
 
76
 
private Q_SLOTS:
77
 
    void onModelRowsAdded(const QModelIndex& parent, int start, int end);
78
 
    void onModelRowsRemoved(const QModelIndex& parent, int start, int end);
79
 
    void onModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>&);
80
 
    void reset();
81
 
 
82
 
private:
83
 
    void updateActionState();
84
 
 
85
 
    UnityMenuModel* m_menu;
86
 
    QVariantMap m_cachedState;
 
68
protected:
 
69
    RootStateParser m_parser;
 
70
    QVariantMap m_currentState;
87
71
};
88
72
 
89
 
#endif // ROOTACTIONSTATE_H
 
73
#endif // ROOTSTATEPARSER_H