From 12b0313d92cea9105477e644fb4fdcb592c30abb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 29 Mar 2016 10:44:46 +0200 Subject: GUI: Added stub for Update frequency check widgets. --- gui/options.cpp | 11 +++++++++++ gui/options.h | 5 +++++ gui/themes/scummclassic.zip | Bin 111410 -> 111931 bytes gui/themes/scummclassic/classic_layout.stx | 8 ++++++++ gui/themes/scummclassic/classic_layout_lowres.stx | 10 ++++++++++ gui/themes/scummmodern.zip | Bin 1487187 -> 1487717 bytes gui/themes/scummmodern/scummmodern_layout.stx | 8 ++++++++ .../scummmodern/scummmodern_layout_lowres.stx | 10 ++++++++++ 8 files changed, 52 insertions(+) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index ba247e5f15..832f793b9f 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -36,6 +36,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "common/translation.h" +#include "common/updates.h" #include "audio/mididrv.h" #include "audio/musicplugin.h" @@ -1229,6 +1230,16 @@ GlobalOptionsDialog::GlobalOptionsDialog() #endif // USE_TRANSLATION +#ifdef USE_UPDATES + _updatesPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.UpdatesPopupDesc", _("Update check:"), _("How often to check ScummVM updates")); + _updatesPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.UpdatesPopup"); + + _updatesPopUp->appendEntry(_("Never"), Common::UpdateManager::kUpdateIntervalNotSupported); + _updatesPopUp->appendEntry(_("Daily"), Common::UpdateManager::kUpdateIntervalOneDay); + _updatesPopUp->appendEntry(_("Weekly"), Common::UpdateManager::kUpdateIntervalOneWeek); + _updatesPopUp->appendEntry(_("Monthly"), Common::UpdateManager::kUpdateIntervalOneMonth); +#endif + // Activate the first tab tab->setActiveTab(0); _tabWidget = tab; diff --git a/gui/options.h b/gui/options.h index 1e65bfd134..6f4046381d 100644 --- a/gui/options.h +++ b/gui/options.h @@ -236,6 +236,11 @@ protected: PopUpWidget *_autosavePeriodPopUp; StaticTextWidget *_guiLanguagePopUpDesc; PopUpWidget *_guiLanguagePopUp; + +#ifdef USE_UPDATES + StaticTextWidget *_updatesPopUpDesc; + PopUpWidget *_updatesPopUp; +#endif }; } // End of namespace GUI diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index 1d8b8dad05..028e5f23c7 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 18c2a1f889..b8b0d9a85d 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -507,6 +507,14 @@ type = 'PopUp' /> + + + + diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 6cc9eed6b3..7481f9ef54 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -510,6 +510,16 @@ type = 'PopUp' /> + + + + diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip index 43826abf5e..52655a510e 100644 Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index fd6a3c5cd2..8ce9a0007e 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -521,6 +521,14 @@ type = 'PopUp' /> + + + + diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 9d8f79795c..7de2c48c60 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -508,6 +508,16 @@ type = 'PopUp' /> + + + + -- cgit v1.2.3 From 3efae7e799851f7288266e3bd91c783168d16eb3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 29 Mar 2016 10:53:50 +0200 Subject: GUI: Store secelcted update frequency in config --- gui/options.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index 832f793b9f..0dd5d95651 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1238,6 +1238,11 @@ GlobalOptionsDialog::GlobalOptionsDialog() _updatesPopUp->appendEntry(_("Daily"), Common::UpdateManager::kUpdateIntervalOneDay); _updatesPopUp->appendEntry(_("Weekly"), Common::UpdateManager::kUpdateIntervalOneWeek); _updatesPopUp->appendEntry(_("Monthly"), Common::UpdateManager::kUpdateIntervalOneMonth); + + if (ConfMan.hasKey("updates_check")) + _updatesPopUp->setSelectedTag(ConfMan.getInt("updates_check")); + else + _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalNotSupported); #endif // Activate the first tab @@ -1378,6 +1383,10 @@ void GlobalOptionsDialog::close() { } #endif // USE_TRANSLATION +#ifdef USE_UPDATES + ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag()); +#endif + } OptionsDialog::close(); } -- cgit v1.2.3 From 0db4c879f2d5fa1c7aad2d478f0c0af0a7b2b042 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 29 Mar 2016 20:22:45 +0200 Subject: GUI: Added initial implementation for Updates opt-in wizard --- gui/module.mk | 5 +++ gui/updates-dialog.cpp | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ gui/updates-dialog.h | 44 +++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 gui/updates-dialog.cpp create mode 100644 gui/updates-dialog.h (limited to 'gui') diff --git a/gui/module.mk b/gui/module.mk index bbb3def96d..9e821e71a7 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -65,5 +65,10 @@ MODULE_OBJS += \ fluidsynth-dialog.o endif +ifdef USE_UPDATES +MODULE_OBJS += \ + updates-dialog.o +endif + # Include common rules include $(srcdir)/rules.mk diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp new file mode 100644 index 0000000000..23d5db95d6 --- /dev/null +++ b/gui/updates-dialog.cpp @@ -0,0 +1,101 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/str.h" +#include "common/system.h" +#include "common/translation.h" +#include "gui/updates-dialog.h" +#include "gui/gui-manager.h" +#include "gui/ThemeEval.h" +#include "gui/widget.h" + +namespace GUI { + +enum { + kOkCmd = 'OK ', + kCancelCmd = 'CNCL' +}; + + +UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { + + const int screenW = g_system->getOverlayWidth(); + const int screenH = g_system->getOverlayHeight(); + + int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0); + int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0); + + 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?\n" + "(You can always enable it in the options\n" + "dialog on the Misc tab)"); + + // 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 lines; + int lineCount, okButtonPos, cancelButtonPos; + int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); + + _w = MAX(maxlineWidth, (2 * buttonWidth) + 10) + 20; + + lineCount = lines.size(); + + _h = 16; + _h += buttonHeight + 8; + + _h += lineCount * kLineHeight; + + // Center the dialog + _x = (screenW - _w) / 2; + _y = (screenH - _h) / 2; + + // Each line is represented by one static text item. + int y = 10; + for (int i = 0; i < lines.size(); i++) { + new StaticTextWidget(this, 10, y, maxlineWidth, kLineHeight, + lines[i], Graphics::kTextAlignCenter); + y += kLineHeight; + } + + okButtonPos = (_w - (buttonWidth * 2)) / 2; + cancelButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10; + + new ButtonWidget(this, okButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, "OK", 0, kOkCmd, Common::ASCII_RETURN); // Confirm dialog + new ButtonWidget(this, cancelButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, "Cancel", 0, kCancelCmd, Common::ASCII_ESCAPE); // Cancel dialog +} + +void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + if (cmd == kOkCmd) { + close(); + } else if (cmd == kCancelCmd) { + close(); + } else { + Dialog::handleCommand(sender, cmd, data); + } +} + +} // End of namespace GUI diff --git a/gui/updates-dialog.h b/gui/updates-dialog.h new file mode 100644 index 0000000000..fa46057229 --- /dev/null +++ b/gui/updates-dialog.h @@ -0,0 +1,44 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GUI_UPDATES_DIALOG_H +#define GUI_UPDATES_DIALOG_H + +#include "gui/dialog.h" + +namespace GUI { + +class CommandSender; + +/** + * Wizard for updates opt-in + */ +class UpdatesDialog : public Dialog { +public: + UpdatesDialog(); + + void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); +}; + +} // End of namespace GUI + +#endif -- cgit v1.2.3 From 3c4ccfc52c1843529d4570eec358e7183fa903d6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Mar 2016 11:09:32 +0200 Subject: GUI: Enhanced StaticTextWidget with font style --- gui/widget.cpp | 8 +++++--- gui/widget.h | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/widget.cpp b/gui/widget.cpp index e4afea0c36..11b1ed66f0 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -229,20 +229,22 @@ Common::String Widget::cleanupHotkey(const Common::String &label) { #pragma mark - -StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip) +StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip, ThemeEngine::FontStyle font) : Widget(boss, x, y, w, h, tooltip), _align(align) { setFlags(WIDGET_ENABLED); _type = kStaticTextWidget; _label = text; + _font = font; } -StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip) +StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip, ThemeEngine::FontStyle font) : Widget(boss, name, tooltip) { setFlags(WIDGET_ENABLED); _type = kStaticTextWidget; _label = text; _align = g_gui.xmlEval()->getWidgetTextHAlign(name); + _font = font; } void StaticTextWidget::setValue(int value) { @@ -270,7 +272,7 @@ void StaticTextWidget::setAlign(Graphics::TextAlign align) { void StaticTextWidget::drawWidget() { - g_gui.theme()->drawText(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, _align); + g_gui.theme()->drawText(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, _align, ThemeEngine::kTextInversionNone, 0, true, _font); } #pragma mark - diff --git a/gui/widget.h b/gui/widget.h index 7c1437de0a..4f181954b5 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -168,9 +168,10 @@ class StaticTextWidget : public Widget { protected: Common::String _label; Graphics::TextAlign _align; + ThemeEngine::FontStyle _font; public: - StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip = 0); - StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip = 0); + StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip = 0, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold); + StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip = 0, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold); void setValue(int value); void setLabel(const Common::String &label); const Common::String &getLabel() const { return _label; } -- cgit v1.2.3 From cb51af0d6d2fccc72571149a8ff15a416ca6e701 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Mar 2016 11:15:57 +0200 Subject: UPDATES: Improve update dialog message --- gui/updates-dialog.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'gui') diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp index 23d5db95d6..7b98e4f942 100644 --- a/gui/updates-dialog.cpp +++ b/gui/updates-dialog.cpp @@ -31,8 +31,8 @@ namespace GUI { enum { - kOkCmd = 'OK ', - kCancelCmd = 'CNCL' + kYesCmd = 'YES ', + kNoCmd = 'NO ' }; @@ -48,21 +48,21 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { "ScummVM now supports automatic check for updates\n" "which requires access to the Internet.\n" "\n" - "Would you like to enable this feature?\n" - "(You can always enable it in the options\n" - "dialog on the Misc tab)"); + "Would you like to enable this feature?"); + const char *message2 = _("(You can always enable it in the options dialog on the Misc tab)"); // 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 lines; + Common::Array lines, lines2; int lineCount, okButtonPos, cancelButtonPos; int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); + int maxlineWidth2 = g_gui.getFont(ThemeEngine::kFontStyleTooltip).wordWrapText(message2, screenW - 2 * 20, lines2); - _w = MAX(maxlineWidth, (2 * buttonWidth) + 10) + 20; + _w = MAX(MAX(maxlineWidth, maxlineWidth2), (2 * buttonWidth) + 10) + 20; - lineCount = lines.size(); + lineCount = lines.size() + 1 + lines2.size(); _h = 16; _h += buttonHeight + 8; @@ -80,18 +80,23 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { lines[i], Graphics::kTextAlignCenter); y += kLineHeight; } + for (int i = 0; i < lines2.size(); i++) { + new StaticTextWidget(this, 10, y, maxlineWidth2, kLineHeight, + lines2[i], Graphics::kTextAlignCenter, 0, ThemeEngine::kFontStyleTooltip); + y += kLineHeight; + } okButtonPos = (_w - (buttonWidth * 2)) / 2; cancelButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10; - new ButtonWidget(this, okButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, "OK", 0, kOkCmd, Common::ASCII_RETURN); // Confirm dialog - new ButtonWidget(this, cancelButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, "Cancel", 0, kCancelCmd, Common::ASCII_ESCAPE); // Cancel dialog + new ButtonWidget(this, okButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); // Confirm dialog + new ButtonWidget(this, cancelButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); // Cancel dialog } void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { - if (cmd == kOkCmd) { + if (cmd == kYesCmd) { close(); - } else if (cmd == kCancelCmd) { + } else if (cmd == kNoCmd) { close(); } else { Dialog::handleCommand(sender, cmd, data); -- cgit v1.2.3 From f58b43b38a8f13c90df41bf1202f48b551b2edd5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Mar 2016 14:28:25 +0200 Subject: UPDATES: Beginnings of the update frequency control --- gui/updates-dialog.cpp | 23 ++++++++++++++++------- gui/updates-dialog.h | 7 +++++++ 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'gui') diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp index 7b98e4f942..b08f317618 100644 --- a/gui/updates-dialog.cpp +++ b/gui/updates-dialog.cpp @@ -23,10 +23,11 @@ #include "common/str.h" #include "common/system.h" #include "common/translation.h" +#include "common/updates.h" #include "gui/updates-dialog.h" #include "gui/gui-manager.h" #include "gui/ThemeEval.h" -#include "gui/widget.h" +#include "gui/widgets/popup.h" namespace GUI { @@ -56,13 +57,12 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { // Using this, and accounting for the space the button(s) need, we can set // the real size of the dialog Common::Array lines, lines2; - int lineCount, okButtonPos, cancelButtonPos; int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); int maxlineWidth2 = g_gui.getFont(ThemeEngine::kFontStyleTooltip).wordWrapText(message2, screenW - 2 * 20, lines2); _w = MAX(MAX(maxlineWidth, maxlineWidth2), (2 * buttonWidth) + 10) + 20; - lineCount = lines.size() + 1 + lines2.size(); + int lineCount = lines.size() + 1 + lines2.size(); _h = 16; _h += buttonHeight + 8; @@ -86,11 +86,20 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { y += kLineHeight; } - okButtonPos = (_w - (buttonWidth * 2)) / 2; - cancelButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10; + _updatesPopUpDesc = new StaticTextWidget(this, "GlobalOptions_Misc.UpdatesPopupDesc", _("Update check:"), _("How often to check ScummVM updates")); + _updatesPopUp = new PopUpWidget(this, "GlobalOptions_Misc.UpdatesPopup"); - new ButtonWidget(this, okButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); // Confirm dialog - new ButtonWidget(this, cancelButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); // Cancel dialog + _updatesPopUp->appendEntry(_("Never"), Common::UpdateManager::kUpdateIntervalNotSupported); + _updatesPopUp->appendEntry(_("Daily"), Common::UpdateManager::kUpdateIntervalOneDay); + _updatesPopUp->appendEntry(_("Weekly"), Common::UpdateManager::kUpdateIntervalOneWeek); + _updatesPopUp->appendEntry(_("Monthly"), Common::UpdateManager::kUpdateIntervalOneMonth); + + + int yesButtonPos = (_w - (buttonWidth * 2)) / 2; + int noButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10; + + new ButtonWidget(this, yesButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); // Confirm dialog + new ButtonWidget(this, noButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); // Cancel dialog } void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { diff --git a/gui/updates-dialog.h b/gui/updates-dialog.h index fa46057229..8f89a8fcaf 100644 --- a/gui/updates-dialog.h +++ b/gui/updates-dialog.h @@ -28,6 +28,8 @@ namespace GUI { class CommandSender; +class PopUpWidget; +class StaticTextWidget; /** * Wizard for updates opt-in @@ -35,8 +37,13 @@ class CommandSender; class UpdatesDialog : public Dialog { public: UpdatesDialog(); + virtual ~UpdatesDialog() {} void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + +private: + StaticTextWidget *_updatesPopUpDesc; + PopUpWidget *_updatesPopUp; }; } // End of namespace GUI -- cgit v1.2.3 From 35a44edca18cdec6c2dd484715a72d469cd0f1c3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Mar 2016 19:02:02 +0200 Subject: GUI: Implement immediate coordinate mode for PopUp widget --- gui/widgets/popup.cpp | 8 ++++++++ gui/widgets/popup.h | 1 + 2 files changed, 9 insertions(+) (limited to 'gui') diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp index 6186492339..b10b4fb5fe 100644 --- a/gui/widgets/popup.cpp +++ b/gui/widgets/popup.cpp @@ -382,6 +382,14 @@ PopUpWidget::PopUpWidget(GuiObject *boss, const String &name, const char *toolti _selectedItem = -1; } +PopUpWidget::PopUpWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip) + : Widget(boss, x, y, w, h, tooltip), CommandSender(boss) { + setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_IGNORE_DRAG); + _type = kPopUpWidget; + + _selectedItem = -1; +} + void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (isEnabled()) { PopUpDialog popupDialog(this, x + getAbsX(), y + getAbsY()); diff --git a/gui/widgets/popup.h b/gui/widgets/popup.h index 102c7fd258..37ddc276ad 100644 --- a/gui/widgets/popup.h +++ b/gui/widgets/popup.h @@ -58,6 +58,7 @@ protected: public: PopUpWidget(GuiObject *boss, const String &name, const char *tooltip = 0); + PopUpWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip = 0); void handleMouseDown(int x, int y, int button, int clickCount); void handleMouseWheel(int x, int y, int direction); -- cgit v1.2.3 From bd249ee32489140d4556e9107adfaaa695a84f4a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Mar 2016 19:02:23 +0200 Subject: UPDATES: Made dialog functional --- gui/updates-dialog.cpp | 35 +++++++++++++++++++++++++++++------ gui/updates-dialog.h | 5 +++++ 2 files changed, 34 insertions(+), 6 deletions(-) (limited to 'gui') diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp index b08f317618..fe963e8623 100644 --- a/gui/updates-dialog.cpp +++ b/gui/updates-dialog.cpp @@ -24,6 +24,7 @@ #include "common/system.h" #include "common/translation.h" #include "common/updates.h" +#include "common/config-manager.h" #include "gui/updates-dialog.h" #include "gui/gui-manager.h" #include "gui/ThemeEval.h" @@ -64,7 +65,7 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { int lineCount = lines.size() + 1 + lines2.size(); - _h = 16; + _h = 16 + 3 * kLineHeight; _h += buttonHeight + 8; _h += lineCount * kLineHeight; @@ -86,26 +87,48 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { y += kLineHeight; } - _updatesPopUpDesc = new StaticTextWidget(this, "GlobalOptions_Misc.UpdatesPopupDesc", _("Update check:"), _("How often to check ScummVM updates")); - _updatesPopUp = new PopUpWidget(this, "GlobalOptions_Misc.UpdatesPopup"); + y += kLineHeight; + _updatesPopUpDesc = new StaticTextWidget(this, 10, y, _w, kLineHeight, _("How often you would like to check for updates?"), Graphics::kTextAlignCenter); + y += kLineHeight + 3; + + _updatesPopUp = new PopUpWidget(this, 10, y, _w - 20, g_gui.xmlEval()->getVar("Globals.PopUp.Height", kLineHeight)); _updatesPopUp->appendEntry(_("Never"), Common::UpdateManager::kUpdateIntervalNotSupported); _updatesPopUp->appendEntry(_("Daily"), Common::UpdateManager::kUpdateIntervalOneDay); _updatesPopUp->appendEntry(_("Weekly"), Common::UpdateManager::kUpdateIntervalOneWeek); _updatesPopUp->appendEntry(_("Monthly"), Common::UpdateManager::kUpdateIntervalOneMonth); + _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalOneWeek); + + _updatesPopUp->setVisible(false); + _updatesPopUpDesc->setVisible(false); int yesButtonPos = (_w - (buttonWidth * 2)) / 2; int noButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10; - new ButtonWidget(this, yesButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); // Confirm dialog - new ButtonWidget(this, noButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); // Cancel dialog + _yesButton = new ButtonWidget(this, yesButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); + _noButton = new ButtonWidget(this, noButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); + + _state = 0; } void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { if (cmd == kYesCmd) { - close(); + if (_state == 0) { + _yesButton->setLabel(_("Proceed")); + _noButton->setLabel(_("Cancel")); + _updatesPopUp->setVisible(true); + _updatesPopUpDesc->setVisible(true); + + _state = 1; + + draw(); + } else { + ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag()); + close(); + } } else if (cmd == kNoCmd) { + ConfMan.setInt("updates_check", Common::UpdateManager::kUpdateIntervalNotSupported); close(); } else { Dialog::handleCommand(sender, cmd, data); diff --git a/gui/updates-dialog.h b/gui/updates-dialog.h index 8f89a8fcaf..b0626dfd5f 100644 --- a/gui/updates-dialog.h +++ b/gui/updates-dialog.h @@ -28,6 +28,7 @@ namespace GUI { class CommandSender; +class ButtonWidget; class PopUpWidget; class StaticTextWidget; @@ -44,6 +45,10 @@ public: private: StaticTextWidget *_updatesPopUpDesc; PopUpWidget *_updatesPopUp; + ButtonWidget *_yesButton; + ButtonWidget *_noButton; + + int _state; }; } // End of namespace GUI -- cgit v1.2.3 From 47985debe12a77513843f672df912d340cca5c7c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Mar 2016 19:28:24 +0200 Subject: UPDATES: Hook dialogs to UpdateManager --- gui/options.cpp | 9 +++++++++ gui/updates-dialog.cpp | 19 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index 0dd5d95651..96db1d74ce 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1385,6 +1385,15 @@ void GlobalOptionsDialog::close() { #ifdef USE_UPDATES ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag()); + + if (g_system->getUpdateManager()) { + if (_updatesPopUp->getSelectedTag() == Common::UpdateManager::kUpdateIntervalNotSupported) { + g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateDisabled); + } else { + g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateEnabled); + g_system->getUpdateManager()->setUpdateCheckInterval(_updatesPopUp->getSelectedTag()); + } + } #endif } diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp index fe963e8623..56d8085c31 100644 --- a/gui/updates-dialog.cpp +++ b/gui/updates-dialog.cpp @@ -20,11 +20,11 @@ * */ -#include "common/str.h" #include "common/system.h" #include "common/translation.h" #include "common/updates.h" #include "common/config-manager.h" + #include "gui/updates-dialog.h" #include "gui/gui-manager.h" #include "gui/ThemeEval.h" @@ -106,8 +106,10 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { int yesButtonPos = (_w - (buttonWidth * 2)) / 2; int noButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10; - _yesButton = new ButtonWidget(this, yesButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); - _noButton = new ButtonWidget(this, noButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); + _yesButton = new ButtonWidget(this, yesButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, + _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); + _noButton = new ButtonWidget(this, noButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, + _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); _state = 0; } @@ -125,10 +127,21 @@ void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data draw(); } else { ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag()); + + if (g_system->getUpdateManager()) { + if (_updatesPopUp->getSelectedTag() == Common::UpdateManager::kUpdateIntervalNotSupported) { + g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateDisabled); + } else { + g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateEnabled); + g_system->getUpdateManager()->setUpdateCheckInterval(_updatesPopUp->getSelectedTag()); + } + } close(); } } else if (cmd == kNoCmd) { ConfMan.setInt("updates_check", Common::UpdateManager::kUpdateIntervalNotSupported); + g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateDisabled); + close(); } else { Dialog::handleCommand(sender, cmd, data); -- cgit v1.2.3 From 556b7ffa29fc7f98904fce4e2fdeb07a5369558d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 31 Mar 2016 09:09:23 +0200 Subject: UPDATES: Merge two steps into one --- gui/updates-dialog.cpp | 51 +++++++++++++++++++++++--------------------------- gui/updates-dialog.h | 6 ++---- 2 files changed, 25 insertions(+), 32 deletions(-) (limited to 'gui') diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp index 56d8085c31..260bc590d6 100644 --- a/gui/updates-dialog.cpp +++ b/gui/updates-dialog.cpp @@ -34,7 +34,8 @@ namespace GUI { enum { kYesCmd = 'YES ', - kNoCmd = 'NO ' + kNoCmd = 'NO ', + kCheckBoxCmd = 'CHK ' }; @@ -88,7 +89,8 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { } y += kLineHeight; - _updatesPopUpDesc = new StaticTextWidget(this, 10, y, _w, kLineHeight, _("How often you would like to check for updates?"), Graphics::kTextAlignCenter); + _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)); @@ -100,49 +102,42 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalOneWeek); - _updatesPopUp->setVisible(false); - _updatesPopUpDesc->setVisible(false); - int yesButtonPos = (_w - (buttonWidth * 2)) / 2; int noButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10; _yesButton = new ButtonWidget(this, yesButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, - _("Yes"), 0, kYesCmd, Common::ASCII_RETURN); + _("Proceed"), 0, kYesCmd, Common::ASCII_RETURN); _noButton = new ButtonWidget(this, noButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, - _("No"), 0, kNoCmd, Common::ASCII_ESCAPE); + _("Cancel"), 0, kNoCmd, Common::ASCII_ESCAPE); - _state = 0; + _updatesPopUp->setEnabled(false); + _yesButton->setEnabled(false); } void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { if (cmd == kYesCmd) { - if (_state == 0) { - _yesButton->setLabel(_("Proceed")); - _noButton->setLabel(_("Cancel")); - _updatesPopUp->setVisible(true); - _updatesPopUpDesc->setVisible(true); - - _state = 1; - - draw(); - } else { - ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag()); - - if (g_system->getUpdateManager()) { - if (_updatesPopUp->getSelectedTag() == Common::UpdateManager::kUpdateIntervalNotSupported) { - g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateDisabled); - } else { - g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateEnabled); - g_system->getUpdateManager()->setUpdateCheckInterval(_updatesPopUp->getSelectedTag()); - } + ConfMan.setInt("updates_check", _updatesPopUp->getSelectedTag()); + + if (g_system->getUpdateManager()) { + if (_updatesCheckbox->getState() == false || + _updatesPopUp->getSelectedTag() == Common::UpdateManager::kUpdateIntervalNotSupported) { + g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateDisabled); + } else { + g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateEnabled); + g_system->getUpdateManager()->setUpdateCheckInterval(_updatesPopUp->getSelectedTag()); } - close(); } + 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 b0626dfd5f..9c429c960c 100644 --- a/gui/updates-dialog.h +++ b/gui/updates-dialog.h @@ -27,10 +27,10 @@ namespace GUI { +class CheckboxWidget; class CommandSender; class ButtonWidget; class PopUpWidget; -class StaticTextWidget; /** * Wizard for updates opt-in @@ -43,12 +43,10 @@ public: void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); private: - StaticTextWidget *_updatesPopUpDesc; PopUpWidget *_updatesPopUp; ButtonWidget *_yesButton; ButtonWidget *_noButton; - - int _state; + CheckboxWidget *_updatesCheckbox; }; } // End of namespace GUI -- cgit v1.2.3 From 08e7f0ab9179691fe869bab8fee5585364c846c7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 31 Mar 2016 09:31:57 +0200 Subject: UPDATES: Got rid of hardcoded update intervals list --- gui/options.cpp | 10 ++++++---- gui/updates-dialog.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index 96db1d74ce..06f79e94b7 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1234,10 +1234,12 @@ GlobalOptionsDialog::GlobalOptionsDialog() _updatesPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.UpdatesPopupDesc", _("Update check:"), _("How often to check ScummVM updates")); _updatesPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.UpdatesPopup"); - _updatesPopUp->appendEntry(_("Never"), Common::UpdateManager::kUpdateIntervalNotSupported); - _updatesPopUp->appendEntry(_("Daily"), Common::UpdateManager::kUpdateIntervalOneDay); - _updatesPopUp->appendEntry(_("Weekly"), Common::UpdateManager::kUpdateIntervalOneWeek); - _updatesPopUp->appendEntry(_("Monthly"), Common::UpdateManager::kUpdateIntervalOneMonth); + const int *vals = Common::UpdateManager::getUpdateIntervals(); + + while (*vals != -1) { + _updatesPopUp->appendEntry(Common::UpdateManager::updateIntervalToString(*vals), *vals); + vals++; + } if (ConfMan.hasKey("updates_check")) _updatesPopUp->setSelectedTag(ConfMan.getInt("updates_check")); diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp index 260bc590d6..960b3f397a 100644 --- a/gui/updates-dialog.cpp +++ b/gui/updates-dialog.cpp @@ -95,10 +95,12 @@ UpdatesDialog::UpdatesDialog() : Dialog(30, 20, 260, 124) { _updatesPopUp = new PopUpWidget(this, 10, y, _w - 20, g_gui.xmlEval()->getVar("Globals.PopUp.Height", kLineHeight)); - _updatesPopUp->appendEntry(_("Never"), Common::UpdateManager::kUpdateIntervalNotSupported); - _updatesPopUp->appendEntry(_("Daily"), Common::UpdateManager::kUpdateIntervalOneDay); - _updatesPopUp->appendEntry(_("Weekly"), Common::UpdateManager::kUpdateIntervalOneWeek); - _updatesPopUp->appendEntry(_("Monthly"), Common::UpdateManager::kUpdateIntervalOneMonth); + const int *vals = Common::UpdateManager::getUpdateIntervals(); + + while (*vals != -1) { + _updatesPopUp->appendEntry(Common::UpdateManager::updateIntervalToString(*vals), *vals); + vals++; + } _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalOneWeek); -- cgit v1.2.3 From 2cde45fe6d94211d005cd32e7368769f8524bdec Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 31 Mar 2016 13:59:01 +0200 Subject: UPDATES: Implement Check now button in Options --- gui/options.cpp | 11 ++++++++++- gui/themes/scummclassic.zip | Bin 111931 -> 112109 bytes gui/themes/scummclassic/classic_layout.stx | 3 +++ gui/themes/scummclassic/classic_layout_lowres.stx | 3 +++ gui/themes/scummmodern.zip | Bin 1487717 -> 1487883 bytes gui/themes/scummmodern/scummmodern_layout.stx | 3 +++ .../scummmodern/scummmodern_layout_lowres.stx | 3 +++ 7 files changed, 22 insertions(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index 06f79e94b7..c4a82982b2 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -62,7 +62,8 @@ enum { kChooseExtraDirCmd = 'chex', kExtraPathClearCmd = 'clex', kChoosePluginsDirCmd = 'chpl', - kChooseThemeCmd = 'chtf' + kChooseThemeCmd = 'chtf', + kUpdatesCheckCmd = 'updc' }; enum { @@ -1245,6 +1246,8 @@ GlobalOptionsDialog::GlobalOptionsDialog() _updatesPopUp->setSelectedTag(ConfMan.getInt("updates_check")); else _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalNotSupported); + + new ButtonWidget(tab, "GlobalOptions_Misc.UpdatesCheckManuallyButton", _("Check now"), 0, kUpdatesCheckCmd); #endif // Activate the first tab @@ -1518,6 +1521,12 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 case kFluidSynthSettingsCmd: _fluidSynthSettingsDialog->runModal(); break; +#endif +#ifdef USE_UPDATES + case kUpdatesCheckCmd: + if (g_system->getUpdateManager()) + g_system->getUpdateManager()->checkForUpdates(); + break; #endif default: OptionsDialog::handleCommand(sender, cmd, data); diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index 028e5f23c7..43fcea12fd 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index b8b0d9a85d..65724d9faf 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -514,6 +514,9 @@ + + + + " "" +"" +"" +"" +"" +"" "" @@ -2365,6 +2376,19 @@ const char *defaultXML1 = "" "type='PopUp' " "/>" "" +"" +"" +"" +"" +"" "" -- cgit v1.2.3 From a4bf64fecde9ee3ce6d0f1ef785151f6489f7643 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 31 Mar 2016 15:38:00 +0200 Subject: UPDATES: Normalize updates_check value --- gui/options.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index c4a82982b2..9e8036b68f 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1397,6 +1397,8 @@ void GlobalOptionsDialog::close() { } else { g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateEnabled); g_system->getUpdateManager()->setUpdateCheckInterval(_updatesPopUp->getSelectedTag()); + + ConfMan.setInt("updates_check", g_system->getUpdateManager()->getUpdateCheckInterval()); } } #endif -- cgit v1.2.3 From a743ec2e07ccada0286085ecec54f4d87ed49d44 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 1 Apr 2016 21:29:29 +0200 Subject: UPDATES: Implement and use method for normalizing interval value to accepted values --- gui/options.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index 9e8036b68f..c6bbde7abf 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1243,7 +1243,7 @@ GlobalOptionsDialog::GlobalOptionsDialog() } if (ConfMan.hasKey("updates_check")) - _updatesPopUp->setSelectedTag(ConfMan.getInt("updates_check")); + _updatesPopUp->setSelectedTag(Common::UpdateManager::normalizeInterval(ConfMan.getInt("updates_check"))); else _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalNotSupported); @@ -1397,8 +1397,6 @@ void GlobalOptionsDialog::close() { } else { g_system->getUpdateManager()->setAutomaticallyChecksForUpdates(Common::UpdateManager::kUpdateStateEnabled); g_system->getUpdateManager()->setUpdateCheckInterval(_updatesPopUp->getSelectedTag()); - - ConfMan.setInt("updates_check", g_system->getUpdateManager()->getUpdateCheckInterval()); } } #endif -- cgit v1.2.3 From 5baa657f2586ec9596768920861f1645dd5a4856 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 1 Apr 2016 21:32:16 +0200 Subject: UPDATES: Remove an unneeded check --- gui/options.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gui') diff --git a/gui/options.cpp b/gui/options.cpp index c6bbde7abf..ecd1607e1b 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1242,10 +1242,7 @@ GlobalOptionsDialog::GlobalOptionsDialog() vals++; } - if (ConfMan.hasKey("updates_check")) - _updatesPopUp->setSelectedTag(Common::UpdateManager::normalizeInterval(ConfMan.getInt("updates_check"))); - else - _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalNotSupported); + _updatesPopUp->setSelectedTag(Common::UpdateManager::normalizeInterval(ConfMan.getInt("updates_check"))); new ButtonWidget(tab, "GlobalOptions_Misc.UpdatesCheckManuallyButton", _("Check now"), 0, kUpdatesCheckCmd); #endif -- cgit v1.2.3