/usr/include/libusermetrics-1/libusermetricsoutput/UserMetrics.h is in libusermetricsoutput1-dev 1.1.1+14.04.20140305-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Pete Woods <pete.woods@canonical.com>
*/
#ifndef USERMETRICSOUTPUT_USERMETRICS_H_
#define USERMETRICSOUTPUT_USERMETRICS_H_
#include <QtCore/QString>
#include <QtGui/QColor>
#include <QtCore/QAbstractItemModel>
#include <libusermetricsoutput/ColorTheme.h>
/**
* @{
**/
/**
* @brief The user metrics output library namespace
**/
namespace UserMetricsOutput {
/**
* @brief Presentation API for user metrics.
*
* This class breaks down the various user metric sources
* registered against different users into a presentable
* format.
*
* The data is split into two "months" - "first" and "second".
* The months always have a length equal to the size of
* the month they represent - unset values are padded with
* null data.
*
* The property currentDay indicates the current day's value
* in the "first month" data.
*
* Given a username, the class then provides an API to
* cycle through that user's data. The signal #nextDataSource
* should be used for this.
**/
class Q_DECL_EXPORT UserMetrics: public QObject {
Q_OBJECT
/**
* @brief Represents a textual version of the current metric.
*
* e.g. "3 messages received today"
*/
Q_PROPERTY(QString label READ label NOTIFY labelChanged FINAL)
/**
* @brief The current username selected.
*/
Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged FINAL)
/**
* @brief The ColorTheme for the first month.
*/
Q_PROPERTY(UserMetricsOutput::ColorTheme* firstColor READ firstColor NOTIFY firstColorChanged FINAL)
/**
* @brief The ColorTheme for the second month.
*/
Q_PROPERTY(UserMetricsOutput::ColorTheme* secondColor READ secondColor NOTIFY secondColorChanged FINAL)
/**
* @brief The data for the first month.
*/
Q_PROPERTY(QAbstractItemModel *firstMonth READ firstMonth NOTIFY firstMonthChanged FINAL)
/**
* @brief The data for the second month.
*/
Q_PROPERTY(QAbstractItemModel *secondMonth READ secondMonth NOTIFY secondMonthChanged FINAL)
/**
* @brief The current day of the calendar month.
*
* Zero-indexed.
*/
Q_PROPERTY(int currentDay READ currentDay NOTIFY currentDayChanged FINAL)
public:
/**
* @brief Get a new instance of UserMetrics.
*/
static UserMetrics *getInstance();
/**
* @brief Destructor.
*/
virtual ~UserMetrics();
/**
* @brief Represents a textual version of the current metric.
*
* e.g. "3 messages received today"
*/
virtual QString label() const = 0;
/**
* @brief The current username selected.
*/
virtual QString username() const = 0;
/**
* @brief Change the current username.
*
* @param username
*
* The data source will change to the first one available
* for the given username.
*/
virtual void setUsername(const QString &username) = 0;
/**
* @brief The ColorTheme for the first month.
*/
virtual ColorTheme * firstColor() const = 0;
/**
* @brief The data for the first month.
*/
virtual QAbstractItemModel *firstMonth() const = 0;
/**
* @brief The current day of the calendar month.
*
* Zero-indexed.
*/
virtual int currentDay() const = 0;
/**
* @brief The ColorTheme for the second month.
*/
virtual ColorTheme * secondColor() const = 0;
/**
* @brief The data for the second month.
*/
virtual QAbstractItemModel *secondMonth() const = 0;
Q_SIGNALS:
/**
* @brief The label has changed
*
* @param label
*/
void labelChanged(const QString &label);
/**
* @brief The username has changed
*
* @param username
*/
void usernameChanged(const QString &username);
/**
* @brief The first month's ColorTheme has changed
*
* @param color
*/
void firstColorChanged(ColorTheme *color);
/**
* @brief The first month's data has changed.
*
* @param firstMonth
*
* More fine-grained changed notification also occurs
* using the QAbstractItemModel signals.
*/
void firstMonthChanged(QAbstractItemModel *firstMonth);
/**
* @brief The current day of the month has changed.
*
* @param currentDay
*
* Note: Zero-indexed.
*/
void currentDayChanged(int currentDay);
/**
* @brief The second month's ColorTheme has changed
*
* @param color
*/
void secondColorChanged(ColorTheme *color);
/**
* @brief The second month's data has changed.
*
* @param secondMonth
*
* More fine-grained changed notification also occurs
* using the QAbstractItemModel signals.
*/
void secondMonthChanged(QAbstractItemModel *secondMonth);
/**
* @brief Request the current user's next data source.
*/
void nextDataSource();
/**
* @brief Inform the UserMetrics that you are ready for data change.
*/
void readyForDataChange();
/**
* @brief Data is about to appear.
*
* To continue, fire the #readyForDataChange signal.
*/
void dataAboutToAppear();
/**
* @brief Data has finished loading.
*/
void dataAppeared();
/**
* @brief Data is about to change from one set to another.
*
* To continue, fire the #readyForDataChange signal.
*/
void dataAboutToChange();
/**
* @brief Insert documentation here.
*/
void dataChanged();
/**
* @brief About to change to a user with no data.
*
* To continue, fire the #readyForDataChange signal.
*/
void dataAboutToDisappear();
/**
* @brief The empty data has now been loaded.
*/
void dataDisappeared();
public Q_SLOTS:
/**
* @brief Synchronous version of #nextDataSource
*/
virtual void nextDataSourceSlot() = 0;
/**
* @brief Synchronous version of #readyForDataChange
*/
virtual void readyForDataChangeSlot() = 0;
protected:
/**
* @brief Unusable constructor - this class is pure-virtual.
*
* @param parent
*/
explicit UserMetrics(QObject *parent = 0);
Q_DISABLE_COPY(UserMetrics)
};
}
/*@}*/
#endif // USERMETRICSOUTPUT_USERMETRICS_H_
|