libusermetrics: UserMetricsOutput::UserMetrics Class Reference

libusermetrics

Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
UserMetricsOutput::UserMetrics Class Referenceabstract

Presentation API for user metrics. More...

`#include <libusermetricsoutput/UserMetrics.h>`

Inheritance diagram for UserMetricsOutput::UserMetrics:
[legend]
Collaboration diagram for UserMetricsOutput::UserMetrics:
[legend]

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

## ◆ ~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:

- libusermetricsoutput/UserMetrics.h