GluonPlayer::CommentsModel Class Reference

Model which contains a list of comments. More...

#include <commentsmodel.h>

List of all members.

Public Types

enum  Column {
  AuthorColumn, TitleColumn, BodyColumn, DateTimeColumn,
  RatingColumn
}

Signals

void addCommentFailed ()

Public Member Functions

 CommentsModel (QString gameId, QObject *parent=0)
virtual ~CommentsModel ()
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
virtual QModelIndex parent (const QModelIndex &child) const
virtual QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
virtual Qt::ItemFlags flags (const QModelIndex &index) const
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
virtual bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex())
QString columnName (const Column col) const
bool isOnline ()
void uploadComment (const QModelIndex &parentIndex, const QString &subject, const QString &message)

Detailed Description

Model which contains a list of comments.

This model can be used to obtain comments on a particular game. The model looks for local data, and if available loads it at startup. After this, the model tries to fetch comments from the online server, and if successful, uses those comments. Upon exit, the model saves the fetched comments (if any) to a local file.

Definition at line 55 of file commentsmodel.h.


Member Enumeration Documentation

Enumerator:
AuthorColumn 
TitleColumn 
BodyColumn 
DateTimeColumn 
RatingColumn 

Definition at line 60 of file commentsmodel.h.


Constructor & Destructor Documentation

CommentsModel::CommentsModel ( QString  gameId,
QObject parent = 0 
)
Parameters:
gameId The game ID which will be used to perform lookup in the online service

Definition at line 38 of file commentsmodel.cpp.

CommentsModel::~CommentsModel (  )  [virtual]

Definition at line 201 of file commentsmodel.cpp.


Member Function Documentation

void GluonPlayer::CommentsModel::addCommentFailed (  )  [signal]

signal which is emitted when the comment failed to be added

int CommentsModel::columnCount ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

Definition at line 219 of file commentsmodel.cpp.

QString CommentsModel::columnName ( const Column  col  )  const

returns the column name of a specific column as a string

Parameters:
col the required column
Returns:
the column name as string

Definition at line 331 of file commentsmodel.cpp.

QVariant CommentsModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const [virtual]

Definition at line 207 of file commentsmodel.cpp.

Qt::ItemFlags CommentsModel::flags ( const QModelIndex &  index  )  const [virtual]

Definition at line 284 of file commentsmodel.cpp.

QVariant CommentsModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const [virtual]

Definition at line 276 of file commentsmodel.cpp.

QModelIndex CommentsModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const [virtual]

Definition at line 257 of file commentsmodel.cpp.

bool CommentsModel::insertRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
) [virtual]

Definition at line 307 of file commentsmodel.cpp.

bool CommentsModel::isOnline (  ) 

check if we are connected to the online service

Returns:
true if connected, false otherwise

Definition at line 336 of file commentsmodel.cpp.

QModelIndex CommentsModel::parent ( const QModelIndex &  child  )  const [virtual]

Definition at line 239 of file commentsmodel.cpp.

int CommentsModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

Definition at line 225 of file commentsmodel.cpp.

bool CommentsModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
) [virtual]

Definition at line 292 of file commentsmodel.cpp.

void CommentsModel::uploadComment ( const QModelIndex &  parentIndex,
const QString &  subject,
const QString &  message 
)

used to add and upload a new comment to the server. If successful, the model reloads the comments and hence shows the new one If unsuccessful, the model emits addCommentFailed()

Parameters:
parentIndex the index of the parent comment
Parameters:
subject the subject (title) of the comment
Parameters:
message the message (body) of the comment

Definition at line 341 of file commentsmodel.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:44 2010 for Gluon by  doxygen 1.6.3