gui::ProgressBar Class Reference

#include <progressbar.h>

Inheritance diagram for gui::ProgressBar:
pdfobjects::utils::IProgressBar

List of all members.

Public Member Functions

 ProgressBar (QProgressBar *pB)
QProgressBar * getProgressBar ()
void start ()
void finish ()
void setMaxStep (int maxStep)
void update (int step)

Private Attributes

QProgressBar * progressBar

Detailed Description

Progress observer adapter. Implementation of IProgressBar which delegates all operations to wrapped Qt progress bar. This has to be created and destroyed by user (this is because Qt memmory management).
Instance can be used in ProgressObserver IObserver implementation.

 Example:
 // Creates QProgressBar instance
 QProgressBar * qtProgressBar=new QProgressBar();
 // Creates adapter
 ProgressBar * progressBar=new ProgressBar(qtProgressBar);
 // Creates and registers observer to process which progress we
 // want to display
 shared_ptr<ProgressObserver> progressObserver(new ProgressObserver(progressBar));
 process->registerObserver(progressObserver);
 

In single thread application we can reuse progressObserver on more processes and have one progress bar vizualizator for all of them. In multithread applications where such processes runs in different threads this may be problem because this class doesn't use any kind of synchronization.


Constructor & Destructor Documentation

gui::ProgressBar::ProgressBar ( QProgressBar *  pB  )  [inline]

Initialization constructor.

Parameters:
pB Qt progress bar instance.

Member Function Documentation

void gui::ProgressBar::finish (  )  [virtual]

Progress terminator. Hides qt progress bar.

Implements pdfobjects::utils::IProgressBar.

References progressBar.

QProgressBar* gui::ProgressBar::getProgressBar (  )  [inline]

Returns qt progress bar visualizator.

Returns:
progressBar pointer.

References progressBar.

void gui::ProgressBar::setMaxStep ( int  maxStep  )  [virtual]

Sets maximum step count.

Parameters:
maxStep Number of steps of the process.

Implements pdfobjects::utils::IProgressBar.

References progressBar.

void gui::ProgressBar::start (  )  [virtual]

Progress initiator. Shows qt progress bar and sets its state to 0.

Implements pdfobjects::utils::IProgressBar.

References progressBar, and update().

void gui::ProgressBar::update ( int  step  )  [virtual]

Updates progress state.

Parameters:
step Number of current steps from process start.

Implements pdfobjects::utils::IProgressBar.

References progressBar.

Referenced by start().


Member Data Documentation

QProgressBar* gui::ProgressBar::progressBar [private]

Displayer of progress. This instance is allocated and deallocated by instance user.

Referenced by finish(), getProgressBar(), setMaxStep(), start(), and update().


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