GUI: Remove unnecessary DownloadDialog's flag

This commit is contained in:
Alexander Tkachev 2016-07-11 14:24:30 +06:00
parent 9975307caf
commit f01402f4d8
2 changed files with 8 additions and 12 deletions

View file

@ -40,7 +40,7 @@ enum {
}; };
DownloadDialog::DownloadDialog(uint32 storageId): DownloadDialog::DownloadDialog(uint32 storageId):
Dialog("GlobalOptions_Cloud_DownloadDialog"), _close(false), _redraw(false) { Dialog("GlobalOptions_Cloud_DownloadDialog"), _close(false) {
_backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain;
_browser = new BrowserDialog(_("Select directory where to download game data"), true); _browser = new BrowserDialog(_("Select directory where to download game data"), true);
@ -72,6 +72,7 @@ DownloadDialog::~DownloadDialog() {
void DownloadDialog::open() { void DownloadDialog::open() {
Dialog::open(); Dialog::open();
CloudMan.setDownloadTarget(this);
if (!CloudMan.isDownloading()) if (!CloudMan.isDownloading())
if (!selectDirectories()) if (!selectDirectories())
close(); close();
@ -93,9 +94,10 @@ void DownloadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
break; break;
} }
case kDownloadProgressCmd: case kDownloadProgressCmd:
_percentLabel->setLabel(Common::String::format("%u %%", data)); if (!_close) {
_progressBar->setValue(data); refreshWidgets();
_redraw = true; draw();
}
break; break;
case kDownloadEndedCmd: case kDownloadEndedCmd:
_close = true; _close = true;
@ -169,12 +171,6 @@ void DownloadDialog::handleTickle() {
return; return;
} }
if (_redraw) {
refreshWidgets();
draw();
_redraw = false;
}
Dialog::handleTickle(); Dialog::handleTickle();
} }

View file

@ -54,7 +54,7 @@ class DownloadDialog : public Dialog {
ButtonWidget *_closeButton; ButtonWidget *_closeButton;
Common::String _localDirectory; Common::String _localDirectory;
bool _close, _redraw; bool _close;
void refreshWidgets(); void refreshWidgets();
bool selectDirectories(); bool selectDirectories();