[Scummvm-git-logs] scummvm master -> c71633de779440a5d7ad145efbeceaa221e4fc23

sev- sev at scummvm.org
Sun Oct 15 15:54:53 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c71633de77 GUI: UPDATES: Redesign updates dialog as suggested by criezy in PR#1040


Commit: c71633de779440a5d7ad145efbeceaa221e4fc23
    https://github.com/scummvm/scummvm/commit/c71633de779440a5d7ad145efbeceaa221e4fc23
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-10-15T15:53:57+02:00

Commit Message:
GUI: UPDATES: Redesign updates dialog as suggested by criezy in PR#1040

Changed paths:
    gui/updates-dialog.cpp
    gui/updates-dialog.h


diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp
index b82ecc0..be72023 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 9c429c9..428a82c 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





More information about the Scummvm-git-logs mailing list