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. More...
virtual void | readyForDataChangeSlot ()=0
| Synchronous version of readyForDataChange. More...

## Signals

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

## Public Member Functions

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

## Static Public Member Functions

static UserMetrics * | getInstance ()
| Get a new instance of UserMetrics. More...

## Protected Member Functions

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

## Properties

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

## 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

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

virtual

Destructor.

UserMetricsOutput::UserMetrics::UserMetrics | ( | QObject * | parent = `0` | ) |

explicit protected

Unusable constructor - this class is pure-virtual.

Parameters

  parent |

## Member Function Documentation

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

pure virtual

The current day of the calendar month.

Zero-indexed.

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

signal

The current day of the month has changed.

Parameters

  currentDay | Note: Zero-indexed.

void UserMetricsOutput::UserMetrics::dataAboutToAppear | ( |  | ) |

signal

Data is about to appear.

To continue, fire the readyForDataChange signal.

void UserMetricsOutput::UserMetrics::dataAboutToChange | ( |  | ) |

signal

Data is about to change from one set to another.

To continue, fire the readyForDataChange signal.

void UserMetricsOutput::UserMetrics::dataAboutToDisappear | ( |  | ) |

signal

About to change to a user with no data.

To continue, fire the readyForDataChange signal.

void UserMetricsOutput::UserMetrics::dataAppeared | ( |  | ) |

signal

Data has finished loading.

void UserMetricsOutput::UserMetrics::dataChanged | ( |  | ) |

signal

Insert documentation here.

void UserMetricsOutput::UserMetrics::dataDisappeared | ( |  | ) |

signal

The empty data has now been loaded.

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

pure virtual

The ColorTheme for the first month.

void UserMetricsOutput::UserMetrics::firstColorChanged | ( | ColorTheme * | color | ) |

signal

The first month's ColorTheme has changed.

Parameters

  color |

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

pure virtual

The data for the first month.

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.

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

static

Get a new instance of UserMetrics.

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

pure virtual

Represents a textual version of the current metric.

e.g. "3 messages received today"

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

signal

The label has changed.

Parameters

  label |

void UserMetricsOutput::UserMetrics::nextDataSource | ( |  | ) |

signal

Request the current user's next data source.

virtual void UserMetricsOutput::UserMetrics::nextDataSourceSlot | ( |  | ) |

pure virtual slot

Synchronous version of nextDataSource.

void UserMetricsOutput::UserMetrics::readyForDataChange | ( |  | ) |

signal

Inform the UserMetrics that you are ready for data change.

virtual void UserMetricsOutput::UserMetrics::readyForDataChangeSlot | ( |  | ) |

pure virtual slot

Synchronous version of readyForDataChange.

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

pure virtual

The ColorTheme for the second month.

void UserMetricsOutput::UserMetrics::secondColorChanged | ( | ColorTheme * | color | ) |

signal

The second month's ColorTheme has changed.

Parameters

  color |

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

pure virtual

The data for the second month.

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.

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.

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

pure virtual

The current username selected.

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

signal

The username has changed.

Parameters

  username |

## Property Documentation

int UserMetricsOutput::UserMetrics::currentDay

read

The current day of the calendar month.

Zero-indexed.

UserMetricsOutput::ColorTheme UserMetricsOutput::UserMetrics::firstColor

read

The ColorTheme for the first month.

QAbstractItemModel UserMetricsOutput::UserMetrics::firstMonth

read

The data for the first month.

QString UserMetricsOutput::UserMetrics::label

read

Represents a textual version of the current metric.

e.g. "3 messages received today"

UserMetricsOutput::ColorTheme UserMetricsOutput::UserMetrics::secondColor

read

The ColorTheme for the second month.

QAbstractItemModel UserMetricsOutput::UserMetrics::secondMonth

read

The data for the second month.

QString UserMetricsOutput::UserMetrics::username

read write

The current username selected.

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

- include/libusermetricsoutput/UserMetrics.h