Provides progress information over Software Management operation. More...

Inheritance diagram for Hemera::SoftwareManagement::ProgressReporter:

Public Types

enum  OperationType {
  OperationType::None, OperationType::RefreshRepositories, OperationType::UpdateApplications, OperationType::UpdateSystem,
  OperationType::InstallApplications, OperationType::RemoveApplications
}
 
enum  OperationStep { OperationStep::NoStep, OperationStep::Download, OperationStep::Process, OperationStep::Cleanup }
 

Signals

void operationTypeChanged (Hemera::SoftwareManagement::ProgressReporter::OperationType type)
 Emitted when the operation type changes. More...
 
void currentStepChanged (Hemera::SoftwareManagement::ProgressReporter::OperationStep step)
 Emitted when the current step changes. More...
 
void descriptionChanged (const QString &description)
 Emitted when the description changes. More...
 
void progressChanged ()
 Emitted when the progress (percent, rate or both) changes. More...
 
- Signals inherited from Hemera::AsyncInitObject
void ready ()
 

Public Member Functions

QByteArray operationId () const
 The operation ID of the current operation. More...
 
QDateTime startDateTime () const
 The start date and time of the current operation. More...
 
OperationType operationType () const
 The operation type of the current operation. More...
 
OperationSteps availableSteps () const
 Available steps of the current operation. More...
 
OperationStep currentStep () const
 The current step of the current operation. More...
 
QString description () const
 The description of the current action of the current operation. More...
 
int percent () const
 The completion percentage of the current step of the current operation. More...
 
int rate () const
 The progress rate, in B/s, of the current operation. More...
 

Protected Member Functions

virtual void initImpl () Q_DECL_OVERRIDE Q_DECL_FINAL
 
- Protected Member Functions inherited from Hemera::AsyncInitObject
void setParts (uint parts)
 

Additional Inherited Members

- Public Slots inherited from Hemera::AsyncInitObject
Hemera::Operationinit ()
 
- Protected Slots inherited from Hemera::AsyncInitObject
void setReady ()
 
void setInitError (const QString &errorName, const QString &message=QString())
 
void setOnePartIsReady ()
 

Detailed Description

Provides progress information over Software Management operation.

ProgressReporter is a read-only class which allows to monitor any Software Management operation happening in the system. This means that such a class monitors every operation, not only those originating from SoftwareManagers in its same application.

Due to the nature of the software manager, only one operation at a time can be performed.

Usually, only one single ProgressReporter object should be instantiated for each application for performance reasons.

See also
SoftwareManager

Member Enumeration Documentation

Defines the type of the operation currently in progress.

Enumerator
None 

No operation is being performed.

RefreshRepositories 

Repositories are being refreshed.

UpdateApplications 

Applications are being updated.

UpdateSystem 

System is being updated.

InstallApplications 

New Applications are being installed.

RemoveApplications 

Applications are being removed.

Defines a step in an operation. Operations can have more than one step, depending on their nature.

Enumerator
NoStep 

Invalid step.

Download 

Download payloads from a remote source.

Process 

Act on the filesystem.

Cleanup 

Cleanup temporary files or actions.

Member Function Documentation

QByteArray Hemera::SoftwareManagement::ProgressReporter::operationId ( ) const

The operation ID of the current operation.

Returns
The operation ID of the current operation, or an empty byte array if no operation is in progress.
QDateTime Hemera::SoftwareManagement::ProgressReporter::startDateTime ( ) const

The start date and time of the current operation.

Returns
The start date and time of the current operation, or an invalid datetime object if no operation is in progress.
OperationType Hemera::SoftwareManagement::ProgressReporter::operationType ( ) const

The operation type of the current operation.

Returns
The operation type of the current operation, or None if no operation is in progress.
OperationSteps Hemera::SoftwareManagement::ProgressReporter::availableSteps ( ) const

Available steps of the current operation.

Returns
Available steps of the current operation, or NoStep if no operation is in progress.
OperationStep Hemera::SoftwareManagement::ProgressReporter::currentStep ( ) const

The current step of the current operation.

Returns
The current step of the current operation, or NoStep if no operation is in progress.
QString Hemera::SoftwareManagement::ProgressReporter::description ( ) const

The description of the current action of the current operation.

Returns
The description of the current action of the current operation, or an empty string if no operation is in progress.
int Hemera::SoftwareManagement::ProgressReporter::percent ( ) const

The completion percentage of the current step of the current operation.

Returns
The completion percentage of the current step of the current operation, or NoStep if no operation is in progress.
int Hemera::SoftwareManagement::ProgressReporter::rate ( ) const

The progress rate, in B/s, of the current operation.

Returns
The progress rate, in B/s, of the current operation.
Note
If no operation is in progress, this function will return an invalid value.
This function will return 0 if the current step does not support rate report. Usually, only Download supports this feature.
void Hemera::SoftwareManagement::ProgressReporter::initImpl ( )
protectedvirtual

Implements the object intialization

When implementing an AsyncInitObject, this method should hold your initialization logic. It is called by AsyncInitObject when needed, and the developer should just reimplement it without invoking it.

Once the initialization procedure is completed, either setReady, setOnePartIsReady or setInitError must be called.

Implements Hemera::AsyncInitObject.

void Hemera::SoftwareManagement::ProgressReporter::operationTypeChanged ( Hemera::SoftwareManagement::ProgressReporter::OperationType  type)
signal

Emitted when the operation type changes.

void Hemera::SoftwareManagement::ProgressReporter::currentStepChanged ( Hemera::SoftwareManagement::ProgressReporter::OperationStep  step)
signal

Emitted when the current step changes.

void Hemera::SoftwareManagement::ProgressReporter::descriptionChanged ( const QString &  description)
signal

Emitted when the description changes.

void Hemera::SoftwareManagement::ProgressReporter::progressChanged ( )
signal

Emitted when the progress (percent, rate or both) changes.