libusermetrics
UserMetricsOutput::UserMetrics Class Referenceabstract

Presentation API for user metrics. More...

#include <libusermetricsoutput/UserMetrics.h>

+ Inheritance diagram for UserMetricsOutput::UserMetrics:

Public Slots

virtual void nextDataSourceSlot ()=0
 Synchronous version of nextDataSource.
 
virtual void readyForDataChangeSlot ()=0
 Synchronous version of readyForDataChange.
 

Signals

void labelChanged (const QString &label)
 The label has changed.
 
void usernameChanged (const QString &username)
 The username has changed.
 
void firstColorChanged (ColorTheme *color)
 The first month's ColorTheme has changed.
 
void firstMonthChanged (QAbstractItemModel *firstMonth)
 The first month's data has changed.
 
void currentDayChanged (int currentDay)
 The current day of the month has changed.
 
void secondColorChanged (ColorTheme *color)
 The second month's ColorTheme has changed.
 
void secondMonthChanged (QAbstractItemModel *secondMonth)
 The second month's data has changed.
 
void nextDataSource ()
 Request the current user's next data source.
 
void readyForDataChange ()
 Inform the UserMetrics that you are ready for data change.
 
void dataAboutToAppear ()
 Data is about to appear.
 
void dataAppeared ()
 Data has finished loading.
 
void dataAboutToChange ()
 Data is about to change from one set to another.
 
void dataChanged ()
 Insert documentation here.
 
void dataAboutToDisappear ()
 About to change to a user with no data.
 
void dataDisappeared ()
 The empty data has now been loaded.
 

Public Member Functions

virtual ~UserMetrics ()
 Destructor.
 
virtual QString label () const =0
 Represents a textual version of the current metric.
 
virtual QString username () const =0
 The current username selected.
 
virtual void setUsername (const QString &username)=0
 Change the current username.
 
virtual ColorThemefirstColor () const =0
 The ColorTheme for the first month.
 
virtual QAbstractItemModel * firstMonth () const =0
 The data for the first month.
 
virtual int currentDay () const =0
 The current day of the calendar month.
 
virtual ColorThemesecondColor () const =0
 The ColorTheme for the second month.
 
virtual QAbstractItemModel * secondMonth () const =0
 The data for the second month.
 

Static Public Member Functions

static UserMetricsgetInstance ()
 Get a new instance of UserMetrics.
 

Protected Member Functions

 UserMetrics (QObject *parent=0)
 Unusable constructor - this class is pure-virtual.
 

Properties

QString label
 Represents a textual version of the current metric.
 
QString username
 The current username selected.
 
UserMetricsOutput::ColorThemefirstColor
 The ColorTheme for the first month.
 
UserMetricsOutput::ColorThemesecondColor
 The ColorTheme for the second month.
 
QAbstractItemModel * firstMonth
 The data for the first month.
 
QAbstractItemModel * secondMonth
 The data for the second month.
 
int currentDay
 The current day of the calendar month.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~UserMetrics()

virtual UserMetricsOutput::UserMetrics::~UserMetrics ( )
virtual

Destructor.

◆ UserMetrics()

UserMetricsOutput::UserMetrics::UserMetrics ( QObject *  parent = 0)
explicitprotected

Unusable constructor - this class is pure-virtual.

Parameters
parent

Member Function Documentation

◆ currentDay()

virtual int UserMetricsOutput::UserMetrics::currentDay ( ) const
pure virtual

The current day of the calendar month.

Zero-indexed.

◆ currentDayChanged

void UserMetricsOutput::UserMetrics::currentDayChanged ( int  currentDay)
signal

The current day of the month has changed.

Parameters
currentDay

Note: Zero-indexed.

◆ dataAboutToAppear

void UserMetricsOutput::UserMetrics::dataAboutToAppear ( )
signal

Data is about to appear.

To continue, fire the readyForDataChange signal.

◆ dataAboutToChange

void UserMetricsOutput::UserMetrics::dataAboutToChange ( )
signal

Data is about to change from one set to another.

To continue, fire the readyForDataChange signal.

◆ dataAboutToDisappear

void UserMetricsOutput::UserMetrics::dataAboutToDisappear ( )
signal

About to change to a user with no data.

To continue, fire the readyForDataChange signal.

◆ dataAppeared

void UserMetricsOutput::UserMetrics::dataAppeared ( )
signal

Data has finished loading.

◆ dataChanged

void UserMetricsOutput::UserMetrics::dataChanged ( )
signal

Insert documentation here.

◆ dataDisappeared

void UserMetricsOutput::UserMetrics::dataDisappeared ( )
signal

The empty data has now been loaded.

◆ firstColor()

virtual ColorTheme * UserMetricsOutput::UserMetrics::firstColor ( ) const
pure virtual

The ColorTheme for the first month.

◆ firstColorChanged

void UserMetricsOutput::UserMetrics::firstColorChanged ( ColorTheme color)
signal

The first month's ColorTheme has changed.

Parameters
color

◆ firstMonth()

virtual QAbstractItemModel * UserMetricsOutput::UserMetrics::firstMonth ( ) const
pure virtual

The data for the first month.

◆ firstMonthChanged

void UserMetricsOutput::UserMetrics::firstMonthChanged ( QAbstractItemModel *  firstMonth)
signal

The first month's data has changed.

Parameters
firstMonth

More fine-grained changed notification also occurs using the QAbstractItemModel signals.

◆ getInstance()

static UserMetrics * UserMetricsOutput::UserMetrics::getInstance ( )
static

Get a new instance of UserMetrics.

◆ label()

virtual QString UserMetricsOutput::UserMetrics::label ( ) const
pure virtual

Represents a textual version of the current metric.

e.g. "3 messages received today"

◆ labelChanged

void UserMetricsOutput::UserMetrics::labelChanged ( const QString &  label)
signal

The label has changed.

Parameters
label

◆ nextDataSource

void UserMetricsOutput::UserMetrics::nextDataSource ( )
signal

Request the current user's next data source.

◆ nextDataSourceSlot

virtual void UserMetricsOutput::UserMetrics::nextDataSourceSlot ( )
pure virtualslot

Synchronous version of nextDataSource.

◆ readyForDataChange

void UserMetricsOutput::UserMetrics::readyForDataChange ( )
signal

Inform the UserMetrics that you are ready for data change.

◆ readyForDataChangeSlot

virtual void UserMetricsOutput::UserMetrics::readyForDataChangeSlot ( )
pure virtualslot

Synchronous version of readyForDataChange.

◆ secondColor()

virtual ColorTheme * UserMetricsOutput::UserMetrics::secondColor ( ) const
pure virtual

The ColorTheme for the second month.

◆ secondColorChanged

void UserMetricsOutput::UserMetrics::secondColorChanged ( ColorTheme color)
signal

The second month's ColorTheme has changed.

Parameters
color

◆ secondMonth()

virtual QAbstractItemModel * UserMetricsOutput::UserMetrics::secondMonth ( ) const
pure virtual

The data for the second month.

◆ secondMonthChanged

void UserMetricsOutput::UserMetrics::secondMonthChanged ( QAbstractItemModel *  secondMonth)
signal

The second month's data has changed.

Parameters
secondMonth

More fine-grained changed notification also occurs using the QAbstractItemModel signals.

◆ setUsername()

virtual void UserMetricsOutput::UserMetrics::setUsername ( const QString &  username)
pure virtual

Change the current username.

Parameters
username

The data source will change to the first one available for the given username.

◆ username()

virtual QString UserMetricsOutput::UserMetrics::username ( ) const
pure virtual

The current username selected.

◆ usernameChanged

void UserMetricsOutput::UserMetrics::usernameChanged ( const QString &  username)
signal

The username has changed.

Parameters
username

Property Documentation

◆ currentDay

int UserMetricsOutput::UserMetrics::currentDay
read

The current day of the calendar month.

Zero-indexed.

◆ firstColor

UserMetricsOutput::ColorTheme* UserMetricsOutput::UserMetrics::firstColor
read

The ColorTheme for the first month.

◆ firstMonth

QAbstractItemModel * UserMetricsOutput::UserMetrics::firstMonth
read

The data for the first month.

◆ label

QString UserMetricsOutput::UserMetrics::label
read

Represents a textual version of the current metric.

e.g. "3 messages received today"

◆ secondColor

UserMetricsOutput::ColorTheme* UserMetricsOutput::UserMetrics::secondColor
read

The ColorTheme for the second month.

◆ secondMonth

QAbstractItemModel * UserMetricsOutput::UserMetrics::secondMonth
read

The data for the second month.

◆ username

QString UserMetricsOutput::UserMetrics::username
readwrite

The current username selected.


The documentation for this class was generated from the following file: