@@ -83,12 +83,23 @@ HistoryDialog::HistoryDialog(QWidget *parent) :
83
83
ui->clearButton ->setEnabled (false );
84
84
}
85
85
86
- ui->uploadProgressBar ->setValue (Uploader::instance ()->progress ());
86
+ if (Uploader::instance ()->progress () > 0 ) {
87
+ ui->uploadProgressBar ->setValue (Uploader::instance ()->progress ());
88
+ }
89
+ else {
90
+ ui->uploadProgressWidget ->setVisible (false );
91
+ }
92
+
93
+ ui->cancelUploadButton ->setIcon (os::icon (" no" ));
87
94
88
95
connect (Uploader::instance (), SIGNAL (progress (int )), this , SLOT (uploadProgress (int )));
89
96
connect (Uploader::instance (), SIGNAL (done (QString,QString,QString)), this , SLOT (refresh ()));
90
- connect (ui->uploadButton , SIGNAL (clicked ()), this , SLOT (upload ()));
91
- connect (ui->clearButton , SIGNAL (clicked ()), this , SLOT (clear ()));
97
+
98
+ connect (ui->uploadButton , SIGNAL (clicked ()), this , SLOT (upload ()));
99
+ connect (ui->cancelUploadButton , SIGNAL (clicked ()), Uploader::instance () , SLOT (cancel ()));
100
+ connect (ui->cancelUploadButton , SIGNAL (clicked ()), ui->uploadProgressWidget , SLOT (hide ()));
101
+
102
+ connect (ui->clearButton , SIGNAL (clicked ()), this , SLOT (clear ()));
92
103
}
93
104
94
105
HistoryDialog::~HistoryDialog ()
@@ -132,7 +143,6 @@ void HistoryDialog::contextMenu(QPoint point)
132
143
133
144
if (mContextIndex .column () == 0 ) {
134
145
connect (&locationAction, SIGNAL (triggered ()), this , SLOT (location ()));
135
-
136
146
contextMenu.addAction (&locationAction);
137
147
}
138
148
else {
@@ -216,12 +226,12 @@ void HistoryDialog::selectionChanged(QItemSelection selected, QItemSelection des
216
226
void HistoryDialog::upload ()
217
227
{
218
228
Uploader::instance ()->upload (mSelectedScreenshot );
219
- ui->uploadButton -> setEnabled ( false );
229
+ ui->uploadProgressWidget -> setVisible ( true );
220
230
}
221
231
222
232
void HistoryDialog::uploadProgress (int progress)
223
233
{
224
- ui->uploadProgressBar -> setEnabled (true );
234
+ ui->uploadProgressWidget -> setVisible (true );
225
235
ui->uploadProgressBar ->setValue (progress);
226
236
}
227
237
@@ -272,6 +282,5 @@ bool HistoryDialog::event(QEvent *event)
272
282
ScreenshotManager::instance ()->settings ()->setValue (" geometry/historyDialog" , saveGeometry ());
273
283
}
274
284
275
-
276
285
return QDialog::event (event);
277
286
}
0 commit comments