diff options
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 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 | ||
31 | void ProgressLoggerGui::addItem(const QString &text) | 31 | void ProgressLoggerGui::addItem(const QString &text) |
@@ -87,22 +87,39 @@ void ProgressLoggerGui::setProgressVisible(bool b) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | void 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 | */ | ||
93 | void 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 | */ | ||
111 | void 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 | ||
100 | void 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 | ||
107 | void ProgressLoggerGui::close() | 124 | void ProgressLoggerGui::close() |
108 | { | 125 | { |