aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2017-10-15 15:53:25 +0200
committerEugene Sandulenko2017-10-15 15:53:57 +0200
commitc71633de779440a5d7ad145efbeceaa221e4fc23 (patch)
tree4e4cc2245c785dbe3db6a2c217e7b26c16995f45 /gui
parent8e0833e6deead5243d76d819ba3a97b07a7fd48f (diff)
downloadscummvm-rg350-c71633de779440a5d7ad145efbeceaa221e4fc23.tar.gz
scummvm-rg350-c71633de779440a5d7ad145efbeceaa221e4fc23.tar.bz2
scummvm-rg350-c71633de779440a5d7ad145efbeceaa221e4fc23.zip
GUI: UPDATES: Redesign updates dialog as suggested by criezy in PR#1040
Diffstat (limited to 'gui')
-rw-r--r--gui/updates-dialog.cpp69
-rw-r--r--gui/updates-dialog.h4
2 files changed, 31 insertions, 42 deletions
diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp
index b82ecc0402..be7202326b 100644
--- a/gui/updates-dialog.cpp
+++ b/gui/updates-dialog.cpp
@@ -33,9 +33,7 @@
namespace GUI {
enum {
- kYesCmd = 'YES ',
- kNoCmd = 'NO ',
- kCheckBoxCmd = 'CHK '
+ kProceedCmd = 'PROC'
};
@@ -49,18 +47,18 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) {
const char *message = _(
"ScummVM now supports automatic check for updates\n"
- "which requires access to the Internet.\n"
- "\n"
- "Would you like to enable this feature?");
- const char *message2 = _("(You can always enable it in the options dialog on the Misc tab)");
+ "which requires access to the Internet. Would you\n"
+ "like to enable this feature?");
+ const char *message2 = _("You can change this setting later in the Misc tab\n"
+ "in the Options dialog.");
// First, determine the size the dialog needs. For this we have to break
// down the string into lines, and taking the maximum of their widths.
// Using this, and accounting for the space the button(s) need, we can set
// the real size of the dialog
- Common::Array<Common::String> lines, lines2;
+ Common::Array<Common::String> lines, lines2, lines3;
int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines);
- int maxlineWidth2 = g_gui.getFont(ThemeEngine::kFontStyleTooltip).wordWrapText(message2, screenW - 2 * 20, lines2);
+ int maxlineWidth2 = g_gui.getFont().wordWrapText(message2, screenW - 2 * 20, lines2);
_w = MAX(MAX(maxlineWidth, maxlineWidth2), (2 * buttonWidth) + 10) + 20;
@@ -79,21 +77,21 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) {
uint y = 10;
for (uint i = 0; i < lines.size(); i++) {
new StaticTextWidget(this, 10, y, maxlineWidth, kLineHeight,
- lines[i], Graphics::kTextAlignCenter);
- y += kLineHeight;
- }
- for (uint i = 0; i < lines2.size(); i++) {
- new StaticTextWidget(this, 10, y, maxlineWidth2, kLineHeight,
- lines2[i], Graphics::kTextAlignCenter, 0, ThemeEngine::kFontStyleTooltip);
+ lines[i], Graphics::kTextAlignLeft);
y += kLineHeight;
}
y += kLineHeight;
- _updatesCheckbox = new CheckboxWidget(this, 10, y, _w, kLineHeight, _("Check for updates automatically"), 0, kCheckBoxCmd);
- y += kLineHeight + 3;
- _updatesPopUp = new PopUpWidget(this, 10, y, _w - 20, g_gui.xmlEval()->getVar("Globals.PopUp.Height", kLineHeight));
+ const char *updMessage = _("Update check:");
+
+ int updatelineWidth = g_gui.getFont().wordWrapText(updMessage, screenW - 2 * 20, lines3) + 5;
+
+ new StaticTextWidget(this, 10, y, maxlineWidth, kLineHeight,
+ lines3[0], Graphics::kTextAlignLeft);
+
+ _updatesPopUp = new PopUpWidget(this, 10 + updatelineWidth, y, _w - 20 - updatelineWidth, g_gui.xmlEval()->getVar("Globals.PopUp.Height", kLineHeight));
const int *vals = Common::UpdateManager::getUpdateIntervals();
@@ -104,25 +102,28 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) {
_updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalOneWeek);
- int yesButtonPos = (_w - (buttonWidth * 2)) / 2;
- int noButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10;
+ y += kLineHeight * 2;
+
+ for (uint i = 0; i < lines2.size(); i++) {
+ new StaticTextWidget(this, 10, y, maxlineWidth2, kLineHeight,
+ lines2[i], Graphics::kTextAlignLeft);
+ y += kLineHeight;
+ }
- _yesButton = new ButtonWidget(this, yesButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight,
- _("Proceed"), 0, kYesCmd, Common::ASCII_RETURN);
- _noButton = new ButtonWidget(this, noButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight,
- _("Cancel"), 0, kNoCmd, Common::ASCII_ESCAPE);
+ y += kLineHeight + 3;
- _updatesPopUp->setEnabled(false);
- _yesButton->setEnabled(false);
+ int buttonPos = _w - buttonWidth - 10;
+
+ _proceedButton = new ButtonWidget(this, buttonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight,
+ _("Proceed"), 0, kProceedCmd, Common::ASCII_RETURN);
}
void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
- if (cmd == kYesCmd) {
+ if (cmd == kProceedCmd) {
ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag());
if (g_system->getUpdateManager()) {
- if (_updatesCheckbox->getState() == false ||
- _updatesPopUp->getSelectedTag() == Common::UpdateManager::kUpdateIntervalNotSupported) {
+ if (_updatesPopUp->getSelectedTag() == Common::UpdateManager::kUpdateIntervalNotSupported) {
g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateDisabled);
} else {
g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateEnabled);
@@ -130,16 +131,6 @@ void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
}
}
close();
- } else if (cmd == kNoCmd) {
- ConfMan.setInt("updates_check", Common::UpdateManager::kUpdateIntervalNotSupported);
- g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateDisabled);
-
- close();
- } else if (cmd == kCheckBoxCmd) {
- _updatesPopUp->setEnabled(_updatesCheckbox->getState());
- _yesButton->setEnabled(_updatesCheckbox->getState());
-
- draw();
} else {
Dialog::handleCommand(sender, cmd, data);
}
diff --git a/gui/updates-dialog.h b/gui/updates-dialog.h
index 9c429c960c..428a82cfe6 100644
--- a/gui/updates-dialog.h
+++ b/gui/updates-dialog.h
@@ -44,9 +44,7 @@ public:
private:
PopUpWidget *_updatesPopUp;
- ButtonWidget *_yesButton;
- ButtonWidget *_noButton;
- CheckboxWidget *_updatesCheckbox;
+ ButtonWidget *_proceedButton;
};
} // End of namespace GUI