libusermetrics
UserMetrics.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Canonical, Ltd.
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of version 3 of the GNU Lesser General Public License as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * 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  * Author: Pete Woods <pete.woods@canonical.com>
17  */
18 
19 #ifndef USERMETRICSOUTPUT_USERMETRICS_H_
20 #define USERMETRICSOUTPUT_USERMETRICS_H_
21 
22 #include <QtCore/QString>
23 #include <QtGui/QColor>
24 #include <QtCore/QAbstractItemModel>
25 
27 
35 namespace UserMetricsOutput {
36 
56 class Q_DECL_EXPORT UserMetrics: public QObject {
57 Q_OBJECT
58 
64 Q_PROPERTY(QString label READ label NOTIFY labelChanged FINAL)
65 
66 
69 Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged FINAL)
70 
74 Q_PROPERTY(UserMetricsOutput::ColorTheme* firstColor READ firstColor NOTIFY firstColorChanged FINAL)
75 
79 Q_PROPERTY(UserMetricsOutput::ColorTheme* secondColor READ secondColor NOTIFY secondColorChanged FINAL)
80 
84 Q_PROPERTY(QAbstractItemModel *firstMonth READ firstMonth NOTIFY firstMonthChanged FINAL)
85 
89 Q_PROPERTY(QAbstractItemModel *secondMonth READ secondMonth NOTIFY secondMonthChanged FINAL)
90 
96 Q_PROPERTY(int currentDay READ currentDay NOTIFY currentDayChanged FINAL)
97 
98 public:
102  static UserMetrics *getInstance();
103 
107  virtual ~UserMetrics();
108 
114  virtual QString label() const = 0;
115 
119  virtual QString username() const = 0;
120 
129  virtual void setUsername(const QString &username) = 0;
130 
134  virtual ColorTheme * firstColor() const = 0;
135 
139  virtual QAbstractItemModel *firstMonth() const = 0;
140 
146  virtual int currentDay() const = 0;
147 
151  virtual ColorTheme * secondColor() const = 0;
152 
156  virtual QAbstractItemModel *secondMonth() const = 0;
157 
158 Q_SIGNALS:
164  void labelChanged(const QString &label);
165 
171  void usernameChanged(const QString &username);
172 
178  void firstColorChanged(ColorTheme *color);
179 
188  void firstMonthChanged(QAbstractItemModel *firstMonth);
189 
197  void currentDayChanged(int currentDay);
198 
204  void secondColorChanged(ColorTheme *color);
205 
214  void secondMonthChanged(QAbstractItemModel *secondMonth);
215 
219  void nextDataSource();
220 
224  void readyForDataChange();
225 
231  void dataAboutToAppear();
232 
236  void dataAppeared();
237 
243  void dataAboutToChange();
244 
248  void dataChanged();
249 
255  void dataAboutToDisappear();
256 
260  void dataDisappeared();
261 
262 public Q_SLOTS:
266  virtual void nextDataSourceSlot() = 0;
267 
271  virtual void readyForDataChangeSlot() = 0;
272 
273 protected:
279  explicit UserMetrics(QObject *parent = 0);
280 
281  Q_DISABLE_COPY(UserMetrics)
282 
283 };
284 
285 }
286 
289 #endif // USERMETRICSOUTPUT_USERMETRICS_H_
Presentation API for user metrics.
Definition: UserMetrics.h:56
The user metrics output library namespace.
Definition: ColorTheme.h:28
ColorTheme for a particular user metric.
Definition: ColorTheme.h:36