[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Slots | Signals | Public Member Functions
KLFProgressReporter Class Reference

Object that emits progress information of a (lengthy) operation. More...

#include <klfguiutil.h>

Inheritance diagram for KLFProgressReporter:
Inheritance graph
[legend]
Collaboration diagram for KLFProgressReporter:
Collaboration graph
[legend]

List of all members.

Public Slots

void doReportProgress (int value)

Signals

void progress (int progressValue)
void finished ()

Public Member Functions

 KLFProgressReporter (int min, int max, QObject *parent=NULL)
virtual ~KLFProgressReporter ()
int min () const
int max () const

Detailed Description

Object that emits progress information of a (lengthy) operation.

This object is intented to be used in two ways

To get informed, simple connect to the progress(int) signal, and possibly the finished() signal, to respectively get informed about how much progress is going on, and when the operation is finished. See the doc of those respective functions for more info.

To inform others about progress of an operation you're preforming, create a dedicated instance of KLFProgressReporter for that specific operation, inform others of the existance of such an object (to let them connect to progress()), then call doReportProgress() at regular intervals, making sure to call it the last time with the max() value.

Definition at line 63 of file klfguiutil.h.


Constructor & Destructor Documentation

KLFProgressReporter::KLFProgressReporter ( int  min,
int  max,
QObject parent = NULL 
)

Definition at line 40 of file klfguiutil.cpp.

References max(), and min().

Note:
emits finished() if hasn't done so already.

Definition at line 47 of file klfguiutil.cpp.

References finished(), and progress().


Member Function Documentation

void KLFProgressReporter::doReportProgress ( int  value) [slot]

The operations that perform long operations should regularly call this function. This function emits progress() with the given value.

Additionally, if value is max(), finished() is emitted. Do NOT call doReportProgress() any more after that, it will result in a warning.

Definition at line 55 of file klfguiutil.cpp.

References finished(), KLF_FUNC_NAME, and progress().

void KLFProgressReporter::finished ( ) [signal]

Emitted right after progress() was emitted with the max() value. If doReportProgress() is never called with the max() value, then this signal is emitted in the destructor.

Referenced by doReportProgress(), and ~KLFProgressReporter().

int KLFProgressReporter::max ( ) const [inline]

Definition at line 72 of file klfguiutil.h.

Referenced by KLFProgressReporter(), and KLFProgressDialog::startReportingProgress().

int KLFProgressReporter::min ( ) const [inline]

Definition at line 71 of file klfguiutil.h.

Referenced by KLFProgressReporter(), and KLFProgressDialog::startReportingProgress().

void KLFProgressReporter::progress ( int  progressValue) [signal]

Emitted at regular intervals to inform connected slots about the progress of a given action.

This signal is emitted repeatedly with increasing progressValue values ranging from min() to max().

The last time this signal is emitted for one operation, its progressValue is exactly the max() value. (Progress reporters must enforce this).

Referenced by doReportProgress(), and ~KLFProgressReporter().


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

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net