2 * Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
19#ifndef MENUCONTENTACTIVATOR_H
20#define MENUCONTENTACTIVATOR_H
22#include "unityindicatorsglobal.h"
26#include <QQmlListProperty>
29namespace UnityIndicators {
30/* Defines an interface for a Timer. */
31class UNITYINDICATORS_EXPORT AbstractTimer : public QObject {
34 AbstractTimer(QObject *parent) : QObject(parent), m_isRunning(false) {}
35 virtual int interval() const = 0;
36 virtual void setInterval(int msecs) = 0;
37 virtual void start() { m_isRunning = true; };
38 virtual void stop() { m_isRunning = false; }
39 bool isRunning() const { return m_isRunning; }
47/* Defines a object to express the active state of a menu. */
48class UNITYINDICATORS_EXPORT MenuContentState : public QObject
51 Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
53 MenuContentState(bool active);
55 bool isActive() const;
56 void setActive(bool active);
64class MenuContentActivatorPrivate;
66class UNITYINDICATORS_EXPORT MenuContentActivator : public QObject
69 Q_PROPERTY(int baseIndex READ baseIndex WRITE setBaseIndex NOTIFY baseIndexChanged)
70 Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
71 Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged)
72 Q_PROPERTY(QQmlListProperty<MenuContentState> content READ content NOTIFY contentChanged DESIGNABLE false)
74 MenuContentActivator(QObject* parent = NULL);
75 ~MenuContentActivator();
77 Q_INVOKABLE void restart();
78 Q_INVOKABLE void stop();
79 Q_INVOKABLE void clear();
80 Q_INVOKABLE bool isMenuContentActive(int index) const;
82 void setRunning(bool running);
83 bool isRunning() const;
85 void setBaseIndex(int index);
86 int baseIndex() const;
88 void setCount(int index);
91 void setDelta(int index);
94 QQmlListProperty<MenuContentState> content();
96 // Replaces the existing Timer with the given one.
98 // Useful for providing a fake timer when testing.
99 void setContentTimer(UnityIndicators::AbstractTimer *timer);
100 void setMenuContentState(int index, bool active);
103 void baseIndexChanged(int baseIndex);
104 void deltaChanged(int delta);
105 void runningChanged(bool running);
106 void countChanged(int count);
107 void contentChanged();
113 MenuContentActivatorPrivate* d;
114 friend class MenuContentActivatorPrivate;
117#endif // MENUCONTENTACTIVATOR_H
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list