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 
71 
74 Q_PROPERTY(UserMetricsOutput::ColorTheme* firstColor READ firstColor NOTIFY firstColorChanged FINAL)
75 
76 
79 Q_PROPERTY(UserMetricsOutput::ColorTheme* secondColor READ secondColor NOTIFY secondColorChanged FINAL)
80 
81 
84 Q_PROPERTY(QAbstractItemModel *firstMonth READ firstMonth NOTIFY firstMonthChanged FINAL)
85 
86 
89 Q_PROPERTY(QAbstractItemModel *secondMonth READ secondMonth NOTIFY secondMonthChanged FINAL)
90 
91 
96 Q_PROPERTY(int currentDay READ currentDay NOTIFY currentDayChanged FINAL)
97 
98 public:
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 
179 
188  void firstMonthChanged(QAbstractItemModel *firstMonth);
189 
197  void currentDayChanged(int currentDay);
198 
205 
214  void secondMonthChanged(QAbstractItemModel *secondMonth);
215 
220 
225 
232 
236  void dataAppeared();
237 
244 
248  void dataChanged();
249 
256 
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_
ColorTheme for a particular user metric.
Definition: ColorTheme.h:37
Presentation API for user metrics.
Definition: UserMetrics.h:56
virtual void nextDataSourceSlot()=0
Synchronous version of nextDataSource.
void labelChanged(const QString &label)
The label has changed.
void dataAboutToChange()
Data is about to change from one set to another.
void secondColorChanged(ColorTheme *color)
The second month's ColorTheme has changed.
void dataDisappeared()
The empty data has now been loaded.
void readyForDataChange()
Inform the UserMetrics that you are ready for data change.
virtual ~UserMetrics()
Destructor.
void dataChanged()
Insert documentation here.
static UserMetrics * getInstance()
Get a new instance of UserMetrics.
virtual ColorTheme * secondColor() const =0
The ColorTheme for the second month.
void dataAboutToDisappear()
About to change to a user with no data.
void dataAppeared()
Data has finished loading.
virtual QAbstractItemModel * firstMonth() const =0
The data for the first month.
void firstColorChanged(ColorTheme *color)
The first month's ColorTheme has changed.
void firstMonthChanged(QAbstractItemModel *firstMonth)
The first month's data has changed.
UserMetrics(QObject *parent=0)
Unusable constructor - this class is pure-virtual.
virtual void setUsername(const QString &username)=0
Change the current username.
void dataAboutToAppear()
Data is about to appear.
virtual ColorTheme * firstColor() const =0
The ColorTheme for the first month.
virtual int currentDay() const =0
The current day of the calendar month.
void nextDataSource()
Request the current user's next data source.
virtual QString username() const =0
The current username selected.
void currentDayChanged(int currentDay)
The current day of the month has changed.
void usernameChanged(const QString &username)
The username has changed.
virtual QAbstractItemModel * secondMonth() const =0
The data for the second month.
virtual QString label() const =0
Represents a textual version of the current metric.
void secondMonthChanged(QAbstractItemModel *secondMonth)
The second month's data has changed.
virtual void readyForDataChangeSlot()=0
Synchronous version of readyForDataChange.
The user metrics output library namespace.
Definition: ColorTheme.h:29