20 #include <qapplication.h>
26 #define TR(id) OLocalizator::getString("TYProgressManager", (id))
29 TYProgressDialog* TYProgressManager::_pProgressDialog = NULL;
30 int TYProgressManager::_stepSize = 1;
34 QString strBtnCancel =
TR(
"id_cancel_btn");
35 if (strBtnCancel.length() == 0)
37 strBtnCancel =
"Cancel";
39 _pProgressDialog =
new TYProgressDialog(
name, strBtnCancel, 100, pParent,
name,
true);
40 _pProgressDialog->setAutoClose(
true);
41 _pProgressDialog->setAutoReset(
true);
42 _pProgressDialog->setMinimumDuration(0);
44 _pProgressDialog->setCursor(Qt::ArrowCursor);
45 QString strCaption =
TR(
"id_caption");
46 if (strCaption.length() == 0)
50 _pProgressDialog->setWindowTitle(strCaption);
51 _pProgressDialog->setValue(_pProgressDialog->maximum());
56 if (!_pProgressDialog)
61 _pProgressDialog->reset();
73 _pProgressDialog->setMaximum(totalSteps);
74 _pProgressDialog->show();
85 if (!_pProgressDialog)
91 wasCancelled = _pProgressDialog->wasCanceled();
94 _pProgressDialog->setValue(_pProgressDialog->value() + _stepSize);
97 qApp->processEvents();
99 int TYProgressManager::getProgress()
101 if (!_pProgressDialog)
107 return _pProgressDialog->value();
110 void TYProgressManager::setProgress(
int progress)
112 if (!_pProgressDialog)
118 _pProgressDialog->setValue(progress);
121 qApp->processEvents();
126 if (!_pProgressDialog)
132 _pProgressDialog->setValue(_pProgressDialog->maximum());
135 qApp->processEvents();
138 void TYProgressManager::setWindowTitle(
const char* caption)
140 if (!_pProgressDialog)
146 _pProgressDialog->setWindowTitle(caption);
149 qApp->processEvents();
151 void TYProgressManager::setMessage(
const char* message)
153 if (!_pProgressDialog)
159 _pProgressDialog->setLabelText(message);
162 qApp->processEvents();
static void set(int totalSteps, int stepSize=1)
static void create(QWidget *pParent, const char *name=0)