summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/progressloggergui.cpp
diff options
context:
space:
mode:
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
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()
{