diff options
| author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-05-02 18:40:04 +0000 |
|---|---|---|
| committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-05-02 18:40:04 +0000 |
| commit | 7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d (patch) | |
| tree | 9814a23e24cd9be26f0009835a463b5a9c097f7f /rbutil/rbutilqt/progressloggergui.cpp | |
| parent | b10ba5e8b34eaac0c4b72bcf3be3db180c43126a (diff) | |
| download | rockbox-7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d.zip rockbox-7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d.tar.gz rockbox-7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d.tar.bz2 rockbox-7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d.tar.xz | |
Clean up ProgressLogger state handling:
- use better names for member functions
- don't emit aborted() when exiting a successful log
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20844 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/progressloggergui.cpp')
| -rw-r--r-- | rbutil/rbutilqt/progressloggergui.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp index a96778b..0358d75 100644 --- a/rbutil/rbutilqt/progressloggergui.cpp +++ b/rbutil/rbutilqt/progressloggergui.cpp @@ -25,7 +25,7 @@ ProgressLoggerGui::ProgressLoggerGui(QWidget* parent): ProgressloggerInterface(p downloadProgress->setModal(true); dp.setupUi(downloadProgress); dp.listProgress->setAlternatingRowColors(true); - connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort())); + setRunning(); } void ProgressLoggerGui::addItem(const QString &text) @@ -87,22 +87,39 @@ void ProgressLoggerGui::setProgressVisible(bool b) } -void ProgressLoggerGui::abort() +/** Set logger into "running" state -- the reporting process is still running. + * Display "Abort" and emit the aborted() signal on button press. + */ +void ProgressLoggerGui::setRunning() +{ + dp.buttonAbort->setText(tr("&Abort")); + dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/process-stop.png"))); + + // make sure to not close the window on button press. + disconnect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); + // emit aborted() once button is pressed but not closed(). + disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed())); + connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(aborted())); + +} + + +/** Set logger into "finished" state -- the reporting process is finished. + * Display "Ok". Don't emit aborted() as there is nothing running left. + * Close logger on button press and emit closed(). + */ +void ProgressLoggerGui::setFinished() { dp.buttonAbort->setText(tr("&Ok")); dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/go-next.png"))); - disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort())); + + // close the window on button press. connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); + // emit closed() once button is pressed but not aborted(). + disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(aborted())); connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed())); - emit aborted(); } -void ProgressLoggerGui::undoAbort() -{ - dp.buttonAbort->setText(tr("&Abort")); - dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/process-stop.png"))); - connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort())); -} void ProgressLoggerGui::close() { |