summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/progressloggergui.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-05-02 18:40:04 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-05-02 18:40:04 +0000
commit7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d (patch)
tree9814a23e24cd9be26f0009835a463b5a9c097f7f /rbutil/rbutilqt/progressloggergui.cpp
parentb10ba5e8b34eaac0c4b72bcf3be3db180c43126a (diff)
downloadrockbox-7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d.tar.gz
rockbox-7cfdd4758767e6c5a6fceb0cb5d12ef3b1c99b5d.zip
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.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp
index a96778bc11..0358d75096 100644
--- a/rbutil/rbutilqt/progressloggergui.cpp
+++ b/rbutil/rbutilqt/progressloggergui.cpp
@@ -25,7 +25,7 @@ ProgressLoggerGui::ProgressLoggerGui(QWidget* parent): ProgressloggerInterface(p
25 downloadProgress->setModal(true); 25 downloadProgress->setModal(true);
26 dp.setupUi(downloadProgress); 26 dp.setupUi(downloadProgress);
27 dp.listProgress->setAlternatingRowColors(true); 27 dp.listProgress->setAlternatingRowColors(true);
28 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort())); 28 setRunning();
29} 29}
30 30
31void ProgressLoggerGui::addItem(const QString &text) 31void ProgressLoggerGui::addItem(const QString &text)
@@ -87,22 +87,39 @@ void ProgressLoggerGui::setProgressVisible(bool b)
87} 87}
88 88
89 89
90void ProgressLoggerGui::abort() 90/** Set logger into "running" state -- the reporting process is still running.
91 * Display "Abort" and emit the aborted() signal on button press.
92 */
93void ProgressLoggerGui::setRunning()
94{
95 dp.buttonAbort->setText(tr("&Abort"));
96 dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/process-stop.png")));
97
98 // make sure to not close the window on button press.
99 disconnect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
100 // emit aborted() once button is pressed but not closed().
101 disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed()));
102 connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(aborted()));
103
104}
105
106
107/** Set logger into "finished" state -- the reporting process is finished.
108 * Display "Ok". Don't emit aborted() as there is nothing running left.
109 * Close logger on button press and emit closed().
110 */
111void ProgressLoggerGui::setFinished()
91{ 112{
92 dp.buttonAbort->setText(tr("&Ok")); 113 dp.buttonAbort->setText(tr("&Ok"));
93 dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/go-next.png"))); 114 dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/go-next.png")));
94 disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort())); 115
116 // close the window on button press.
95 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); 117 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
118 // emit closed() once button is pressed but not aborted().
119 disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(aborted()));
96 connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed())); 120 connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed()));
97 emit aborted();
98} 121}
99 122
100void ProgressLoggerGui::undoAbort()
101{
102 dp.buttonAbort->setText(tr("&Abort"));
103 dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/process-stop.png")));
104 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
105}
106 123
107void ProgressLoggerGui::close() 124void ProgressLoggerGui::close()
108{ 125{