GCF LOGO VCL LOGO

This model provides a model representation for a configured list of GCF::AbstractJob. More...

#include <GCF3/Job>

Public Types

enum  Field {
  Kind = Qt::UserRole+1, Title, Description, Icon,
  IconUrl, Progress, Status, IsStarted,
  IsSuspended, IsComplete, IsRunning, HasError,
  Error, Object
}
 

Signals

void jobCountChanged ()
 
void allJobsComplete ()
 
void jobUpdated (GCF::AbstractJob *job)
 
void jobStarted (GCF::AbstractJob *job)
 
void jobSuspended (GCF::AbstractJob *job)
 
void jobResumed (GCF::AbstractJob *job)
 
void jobCompleted (GCF::AbstractJob *job)
 

Public Member Functions

 JobListModel (QObject *parent=0)
 
 ~JobListModel ()
 
virtual bool addJob (AbstractJob *job)
 
void removeJob (AbstractJob *job)
 
AbstractJobjobAt (int index) const
 
Q_INVOKABLE bool containsJob (GCF::AbstractJob *job) const
 
Q_INVOKABLE int indexOfJob (GCF::AbstractJob *job) const
 
Q_INVOKABLE QObject * jobObjectAt (int index) const
 
void setColumns (const QList< int > &columns)
 
QList< int > columns () const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 
QVariant data (const QModelIndex &index, int role) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 
QHash< int, QByteArray > roleNames () const
 
Q_INVOKABLE void cancelAllJobs ()
 
Q_INVOKABLE void clearCompletedJobs ()
 
Q_INVOKABLE bool cancelJobAt (int index)
 
Q_INVOKABLE bool retryJobAt (int index)
 
Q_INVOKABLE bool suspendJobAt (int index)
 
Q_INVOKABLE bool resumeJobAt (int index)
 
- Public Member Functions inherited from GCF::ObjectListEventListener
 ObjectListEventListener ()
 
virtual ~ObjectListEventListener ()
 
virtual QString listenerType () const
 
virtual void objectAdded (int index, QObject *obj)
 
virtual void objectDeleted (int index, QObject *obj)
 

Properties

int jobCount
 

Detailed Description

It emits signals on behalf of the jobs stored in it. For example when a job added to job list model gets completed, job list model will emit the signal GCF::AbstractJob::jobCompleted(AbstractJob *job) with parameter as completed job pointer.

You can add jobs to job list model using GCF::JobListModel::addJob(AbstractJob *job) and remove a job from the model using GCF::JobListModel::removeJob(AbstractJob *job).

JobListModel can be queried for data using the GCF::JobListModel::data(const QModelIndex &index, int role) method by providing an appropriate index and corresponding GCF::JobListModel::Field for the required information.

You can control the columns available in the model, and its order, by making use of the GCF::JobListModel::setColumns(const QList<int> &columns) method.

When the JobListModel is deleted it will cancel and delete all the jobs in it.

Member Enumeration Documentation

The enumeration values of Field represents a specific information about GCF::AbstractJob. This enumeration is mainly used to fetch data about GCF::AbstractJob stored inside the model. Also this is used to construct columns of this model.

Enumerator
Kind 

kind of job. Accessible using role name jobKind.

Title 

title of job. Accessible using role name jobTitle.

Description 

description of job. Accessible using role name jobDescription.

Icon 

icon of job. Accessible using role name jobIcon.

IconUrl 

icon url of job. Accessible using role name jobIconUrl.

Progress 

current progress value of job in percentage. Accessible using role name jobProgress.

Status 

status message of job. Accessible using role name jobStatus.

IsStarted 

job has started or not. Accessible using role name jobIsStarted.

IsSuspended 

job is suspended or not. Accessible using role name jobIsSuspended.

IsComplete 

job is complete or not. Accessible using role name jobIsComplete.

IsRunning 

job is running or not. Accessible using role name jobIsRunning.

HasError 

job has error while executing or not. Accessible using role name jobHasError.

Error 

the error set on job. Accessible using role name jobError.

Object 

represents the job object. Accessible using role name jobObject.

Constructor & Destructor Documentation

GCF::JobListModel::JobListModel ( QObject *  parent = 0)

Constructor.

GCF::JobListModel::~JobListModel ( )

Destructor.

Member Function Documentation

bool GCF::JobListModel::addJob ( AbstractJob job)
virtual

Adds a job to the job list model.

Parameters
jobGCF::AbstractJob that needs to be added.
void GCF::JobListModel::removeJob ( GCF::AbstractJob job)

Removes a job from the job list model.

Parameters
jobGCF::AbstractJob that needs to be removed.
GCF::AbstractJob * GCF::JobListModel::jobAt ( int  index) const
Returns
the job at the index in the model.
bool GCF::JobListModel::containsJob ( GCF::AbstractJob job) const
Returns
true if the model contains the job otherwise false.
int GCF::JobListModel::indexOfJob ( GCF::AbstractJob job) const
Returns
the index of job in the model.
QObject * GCF::JobListModel::jobObjectAt ( int  index) const
Returns
the job at the specified index in the model.
void GCF::JobListModel::setColumns ( const QList< int > &  fields)

Sets the columns of this according to fields.

Parameters
fieldslist of enumeration values of GCF::JobListModel::Field based upon which model columns will be constructed.
QList< int > GCF::JobListModel::columns ( ) const

Returns the columns of job list model.

Returns
QList<int> list of enumeration values of GCF::JobListModel::Field.
int GCF::JobListModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Reimplementation of QAbstractItemModel::rowCount(const QModelIndex &parent) const.

Returns
the number of jobs in the model.
int GCF::JobListModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

Reimplementation of QAbstractItemModel::columnCount(const QModelIndex &parent) const.

QVariant GCF::JobListModel::data ( const QModelIndex &  index,
int  role 
) const

Reimplementation of QAbstractItemModel::data(const QModelIndex &index, int role) const

Returns information about GCF::AbstractJob based on the role provided with the index parameter. Here role is an enumeration value in GCF::JobListModel::Field.

Parameters
indexindex of the job
roleGCF::JobListModel::Field which represents specific data about GCF::AbstractJob.
QVariant GCF::JobListModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Reimplementation of QAbstractItemModel::headerData(const QModelIndex &index, int role) const

QHash< int, QByteArray > GCF::JobListModel::roleNames ( ) const

Reimplementation of QAbstractItemModel::roleNames() const

void GCF::JobListModel::cancelAllJobs ( )

Cancels all jobs stored in the model.

void GCF::JobListModel::clearCompletedJobs ( )

Removes all completed jobs from the model.

bool GCF::JobListModel::cancelJobAt ( int  index)

Cancels job at specified index.

Returns
true if job was cancelled successfully.
bool GCF::JobListModel::retryJobAt ( int  index)

Retries to complete the job at specified index.

Returns
true is retrying job was successful.
bool GCF::JobListModel::suspendJobAt ( int  index)

Suspends the job at specified index.

Returns
true is suspending job was successful.
bool GCF::JobListModel::resumeJobAt ( int  index)

Resumes the job at specified index.

Returns
true is resuming job was successful.
GCF::JobListModel::jobCountChanged ( )
signal

This signal is emitted when a job is added or removed to or from the model.

GCF::JobListModel::allJobsComplete ( )
signal

This signal is emitted when all jobs in the model have completed execution.

GCF::JobListModel::jobUpdated ( GCF::AbstractJob job)
signal

This signal is emitted when a job updates its state.

GCF::JobListModel::jobStarted ( GCF::AbstractJob job)
signal

This signal is emitted when a job in the model has started execution.

GCF::JobListModel::jobSuspended ( GCF::AbstractJob job)
signal

This signal is emitted when a job in the model has been suspended.

GCF::JobListModel::jobResumed ( GCF::AbstractJob job)
signal

This signal is emitted when a job in the model has been resumed.

GCF::JobListModel::jobCompleted ( GCF::AbstractJob job)
signal

This signal is emitted when a job in the model got completed.

Property Documentation

int GCF::JobListModel::jobCount
read
Returns
the count of all jobs in the model.