on ffbe66d help sign in
unity8/plugins/Unity/Indicators/rootstateparser.h
73 lines 2.3 kB history raw
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 */
17#ifndef ROOTSTATEPARSER_H
18#define ROOTSTATEPARSER_H
20#include "unityindicatorsglobal.h"
22#include <actionstateparser.h>
24class UNITYINDICATORS_EXPORT RootStateParser : public ActionStateParser
26public:
27 RootStateParser(QObject* parent = nullptr);
28 virtual QVariant toQVariant(GVariant* state) const override;
29};
31class UNITYINDICATORS_EXPORT RootStateObject : public QObject
33 Q_OBJECT
35 Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
36 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
37 Q_PROPERTY(QString leftLabel READ leftLabel NOTIFY leftLabelChanged)
38 Q_PROPERTY(QString rightLabel READ rightLabel NOTIFY rightLabelChanged)
39 Q_PROPERTY(QStringList icons READ icons NOTIFY iconsChanged)
40 Q_PROPERTY(QString accessibleName READ accessibleName NOTIFY accessibleNameChanged)
41 Q_PROPERTY(bool indicatorVisible READ indicatorVisible NOTIFY indicatorVisibleChanged)
42public:
43 RootStateObject(QObject* parent = 0);
45 virtual bool valid() const = 0;
47 QString title() const;
48 QString leftLabel() const;
49 QString rightLabel() const;
50 QStringList icons() const;
51 QString accessibleName() const;
52 bool indicatorVisible() const;
54 QVariantMap currentState() const { return m_currentState; }
55 void setCurrentState(const QVariantMap& currentState);
57Q_SIGNALS:
58 void updated();
60 void validChanged();
61 void titleChanged();
62 void leftLabelChanged();
63 void rightLabelChanged();
64 void iconsChanged();
65 void accessibleNameChanged();
66 void indicatorVisibleChanged();
68protected:
69 RootStateParser m_parser;
70 QVariantMap m_currentState;
71};
73#endif // ROOTSTATEPARSER_H