aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/credits.h1
-rw-r--r--gui/gui-manager.cpp6
-rw-r--r--gui/module.mk5
-rw-r--r--gui/options.cpp65
-rw-r--r--gui/options.h9
-rw-r--r--gui/recorderdialog.cpp1
-rw-r--r--gui/saveload.cpp1
-rw-r--r--gui/saveload.h2
-rw-r--r--gui/themes/default.inc24
-rw-r--r--gui/themes/scummclassic.zipbin111410 -> 112109 bytes
-rw-r--r--gui/themes/scummclassic/classic_layout.stx11
-rw-r--r--gui/themes/scummclassic/classic_layout_lowres.stx13
-rw-r--r--gui/themes/scummmodern.zipbin1487187 -> 1487883 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx11
-rw-r--r--gui/themes/scummmodern/scummmodern_layout_lowres.stx13
-rw-r--r--gui/themes/translations.datbin563037 -> 567688 bytes
-rw-r--r--gui/updates-dialog.cpp148
-rw-r--r--gui/updates-dialog.h54
-rw-r--r--gui/widget.cpp9
-rw-r--r--gui/widget.h5
-rw-r--r--gui/widgets/popup.cpp8
-rw-r--r--gui/widgets/popup.h1
22 files changed, 360 insertions, 27 deletions
diff --git a/gui/credits.h b/gui/credits.h
index cb9a10fec4..d1d3bb2147 100644
--- a/gui/credits.h
+++ b/gui/credits.h
@@ -535,6 +535,7 @@ static const char *credits[] = {
"C0""Max Horn",
"C2""(retired)",
"C0""Oystein Eftevaag",
+"C0""Thierry Crozat",
"",
"C1""Mandriva",
"C0""Dominik Scherer",
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 20c6d3fa13..4ddf62b2fe 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -286,7 +286,7 @@ void GuiManager::runLoop() {
Common::EventManager *eventMan = _system->getEventManager();
uint32 lastRedraw = 0;
- const uint32 waitTime = 1000 / 45;
+ const uint32 waitTime = 1000 / 60;
bool tooltipCheck = false;
@@ -304,9 +304,9 @@ void GuiManager::runLoop() {
// _system->updateScreen();
if (lastRedraw + waitTime < _system->getMillis(true)) {
+ lastRedraw = _system->getMillis(true);
_theme->updateScreen();
_system->updateScreen();
- lastRedraw = _system->getMillis(true);
}
Common::Event event;
@@ -342,9 +342,9 @@ void GuiManager::runLoop() {
if (lastRedraw + waitTime < _system->getMillis(true)) {
+ lastRedraw = _system->getMillis(true);
_theme->updateScreen();
_system->updateScreen();
- lastRedraw = _system->getMillis(true);
}
}
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/options.cpp b/gui/options.cpp
index ba247e5f15..2bb17509eb 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"
@@ -61,7 +62,8 @@ enum {
kChooseExtraDirCmd = 'chex',
kExtraPathClearCmd = 'clex',
kChoosePluginsDirCmd = 'chpl',
- kChooseThemeCmd = 'chtf'
+ kChooseThemeCmd = 'chtf',
+ kUpdatesCheckCmd = 'updc'
};
enum {
@@ -70,7 +72,7 @@ enum {
kSubtitlesBoth
};
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ENABLE_KEYSDIALOG
enum {
kChooseKeyMappingCmd = 'chma'
};
@@ -204,12 +206,12 @@ void OptionsDialog::open() {
_renderModePopUp->setSelectedTag(sel);
}
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ONLY_FULLSCREEN
_fullscreenCheckbox->setState(true);
_fullscreenCheckbox->setEnabled(false);
_aspectCheckbox->setState(false);
_aspectCheckbox->setEnabled(false);
-#else // !SMALL_SCREEN_DEVICE
+#else // !GUI_ONLY_FULLSCREEN
// Fullscreen setting
_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
@@ -221,7 +223,7 @@ void OptionsDialog::open() {
_aspectCheckbox->setEnabled(true);
_aspectCheckbox->setState(ConfMan.getBool("aspect_ratio", _domain));
}
-#endif // SMALL_SCREEN_DEVICE
+#endif // GUI_ONLY_FULLSCREEN
}
@@ -604,7 +606,7 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
_gfxPopUp->setEnabled(enabled);
_renderModePopUpDesc->setEnabled(enabled);
_renderModePopUp->setEnabled(enabled);
-#ifndef SMALL_SCREEN_DEVICE
+#ifndef GUI_ENABLE_KEYSDIALOG
_fullscreenCheckbox->setEnabled(enabled);
if (_guioptions.contains(GUIO_NOASPECT))
_aspectCheckbox->setEnabled(false);
@@ -868,10 +870,6 @@ void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefi
_midiGainSlider->setMaxValue(1000);
_midiGainLabel = new StaticTextWidget(boss, prefix + "mcMidiGainLabel", "1.00");
-#ifdef USE_FLUIDSYNTH
- new ButtonWidget(boss, prefix + "mcFluidSynthSettings", _("FluidSynth Settings"), 0, kFluidSynthSettingsCmd);
-#endif
-
_enableMIDISettings = true;
}
@@ -1109,6 +1107,10 @@ GlobalOptionsDialog::GlobalOptionsDialog()
_midiTabId = tab->addTab(_("MIDI"));
addMIDIControls(tab, "GlobalOptions_MIDI.");
+#ifdef USE_FLUIDSYNTH
+ new ButtonWidget(tab, "GlobalOptions_MIDI.mcFluidSynthSettings", _("FluidSynth Settings"), 0, kFluidSynthSettingsCmd);
+#endif
+
//
// 4) The MT-32 tab
//
@@ -1194,7 +1196,7 @@ GlobalOptionsDialog::GlobalOptionsDialog()
_autosavePeriodPopUp->appendEntry(_(savePeriodLabels[i]), savePeriodValues[i]);
}
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ENABLE_KEYSDIALOG
new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", _("Keys"), 0, kChooseKeyMappingCmd);
#endif
@@ -1229,6 +1231,22 @@ 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");
+
+ const int *vals = Common::UpdateManager::getUpdateIntervals();
+
+ while (*vals != -1) {
+ _updatesPopUp->appendEntry(Common::UpdateManager::updateIntervalToString(*vals), *vals);
+ vals++;
+ }
+
+ _updatesPopUp->setSelectedTag(Common::UpdateManager::normalizeInterval(ConfMan.getInt("updates_check")));
+
+ new ButtonWidget(tab, "GlobalOptions_Misc.UpdatesCheckManuallyButton", _("Check now"), 0, kUpdatesCheckCmd);
+#endif
+
// Activate the first tab
tab->setActiveTab(0);
_tabWidget = tab;
@@ -1237,7 +1255,7 @@ GlobalOptionsDialog::GlobalOptionsDialog()
new ButtonWidget(this, "GlobalOptions.Cancel", _("Cancel"), 0, kCloseCmd);
new ButtonWidget(this, "GlobalOptions.Ok", _("OK"), 0, kOKCmd);
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ENABLE_KEYSDIALOG
_keysDialog = new KeysDialog();
#endif
@@ -1247,7 +1265,7 @@ GlobalOptionsDialog::GlobalOptionsDialog()
}
GlobalOptionsDialog::~GlobalOptionsDialog() {
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ENABLE_KEYSDIALOG
delete _keysDialog;
#endif
@@ -1367,6 +1385,19 @@ void GlobalOptionsDialog::close() {
}
#endif // USE_TRANSLATION
+#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
+
}
OptionsDialog::close();
}
@@ -1478,7 +1509,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
break;
}
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ENABLE_KEYSDIALOG
case kChooseKeyMappingCmd:
_keysDialog->runModal();
break;
@@ -1488,6 +1519,12 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
_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/options.h b/gui/options.h
index 1e65bfd134..294b41794b 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -29,7 +29,7 @@
#include "common/str.h"
#include "audio/mididrv.h"
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ENABLE_KEYSDIALOG
#include "gui/KeysDialog.h"
#endif
@@ -210,7 +210,7 @@ public:
virtual void reflowLayout();
protected:
-#ifdef SMALL_SCREEN_DEVICE
+#ifdef GUI_ENABLE_KEYSDIALOG
KeysDialog *_keysDialog;
#endif
#ifdef USE_FLUIDSYNTH
@@ -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/recorderdialog.cpp b/gui/recorderdialog.cpp
index 2d74cebbb6..c08b3e149a 100644
--- a/gui/recorderdialog.cpp
+++ b/gui/recorderdialog.cpp
@@ -33,7 +33,6 @@
#include "gui/editrecorddialog.h"
#include "gui/EventRecorder.h"
#include "gui/message.h"
-#include "gui/saveload.h"
#include "common/system.h"
#include "gui/ThemeEval.h"
#include "gui/gui-manager.h"
diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index c1c1d12ec5..b94d30289b 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -25,7 +25,6 @@
#include "gui/saveload.h"
#include "gui/saveload-dialog.h"
-#include "gui/gui-manager.h"
#include "engines/metaengine.h"
diff --git a/gui/saveload.h b/gui/saveload.h
index 22c26d4c5e..01a78c4924 100644
--- a/gui/saveload.h
+++ b/gui/saveload.h
@@ -23,7 +23,7 @@
#ifndef GUI_SAVELOAD_H
#define GUI_SAVELOAD_H
-#include "gui/dialog.h"
+#include "common/str.h"
#include "engines/metaengine.h"
namespace GUI {
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index e367bcb3c7..a23e2f4c30 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1076,6 +1076,17 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"type='PopUp' "
"/>"
"</layout>"
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>"
+"<widget name='UpdatesPopupDesc' "
+"type='OptionsLabel' "
+"/>"
+"<widget name='UpdatesPopup' "
+"type='PopUp' "
+"/>"
+"<widget name='UpdatesCheckManuallyButton' "
+"type='Button' "
+"/>"
+"</layout>"
"<widget name='KeysButton' "
"type='Button' "
"/>"
@@ -2365,6 +2376,19 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"type='PopUp' "
"/>"
"</layout>"
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>"
+"<widget name='UpdatesPopupDesc' "
+"width='80' "
+"height='Globals.Line.Height' "
+"textalign='right' "
+"/>"
+"<widget name='UpdatesPopup' "
+"type='PopUp' "
+"/>"
+"<widget name='UpdatesCheckManuallyButton' "
+"type='Button' "
+"/>"
+"</layout>"
"<widget name='KeysButton' "
"type='Button' "
"/>"
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 1d8b8dad05..43fcea12fd 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 18c2a1f889..65724d9faf 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -507,6 +507,17 @@
type = 'PopUp'
/>
</layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
+ <widget name = 'UpdatesPopupDesc'
+ type = 'OptionsLabel'
+ />
+ <widget name = 'UpdatesPopup'
+ type = 'PopUp'
+ />
+ <widget name = 'UpdatesCheckManuallyButton'
+ type = 'Button'
+ />
+ </layout>
<widget name='KeysButton'
type='Button'
/>
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 6cc9eed6b3..f73f6e864b 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -510,6 +510,19 @@
type = 'PopUp'
/>
</layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
+ <widget name = 'UpdatesPopupDesc'
+ width = '80'
+ height = 'Globals.Line.Height'
+ textalign = 'right'
+ />
+ <widget name = 'UpdatesPopup'
+ type = 'PopUp'
+ />
+ <widget name = 'UpdatesCheckManuallyButton'
+ type = 'Button'
+ />
+ </layout>
<widget name='KeysButton'
type='Button'
/>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 43826abf5e..70f7672c57 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index fd6a3c5cd2..c73ffa1f08 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -521,6 +521,17 @@
type = 'PopUp'
/>
</layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
+ <widget name = 'UpdatesPopupDesc'
+ type = 'OptionsLabel'
+ />
+ <widget name = 'UpdatesPopup'
+ type = 'PopUp'
+ />
+ <widget name = 'UpdatesCheckManuallyButton'
+ type = 'Button'
+ />
+ </layout>
<widget name='KeysButton'
type='Button'
/>
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 9d8f79795c..43ec0cdee1 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -508,6 +508,19 @@
type = 'PopUp'
/>
</layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'>
+ <widget name = 'UpdatesPopupDesc'
+ width = '80'
+ height = 'Globals.Line.Height'
+ textalign = 'right'
+ />
+ <widget name = 'UpdatesPopup'
+ type = 'PopUp'
+ />
+ <widget name = 'UpdatesCheckManuallyButton'
+ type = 'Button'
+ />
+ </layout>
<widget name='KeysButton'
type='Button'
/>
diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat
index 622b70f818..917acdb13d 100644
--- a/gui/themes/translations.dat
+++ b/gui/themes/translations.dat
Binary files differ
diff --git a/gui/updates-dialog.cpp b/gui/updates-dialog.cpp
new file mode 100644
index 0000000000..960b3f397a
--- /dev/null
+++ b/gui/updates-dialog.cpp
@@ -0,0 +1,148 @@
+/* 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/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"
+#include "gui/widgets/popup.h"
+
+namespace GUI {
+
+enum {
+ kYesCmd = 'YES ',
+ kNoCmd = 'NO ',
+ kCheckBoxCmd = 'CHK '
+};
+
+
+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?");
+ 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<Common::String> lines, lines2;
+ 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;
+
+ int lineCount = lines.size() + 1 + lines2.size();
+
+ _h = 16 + 3 * kLineHeight;
+ _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;
+ }
+ for (int i = 0; i < lines2.size(); i++) {
+ new StaticTextWidget(this, 10, y, maxlineWidth2, kLineHeight,
+ lines2[i], Graphics::kTextAlignCenter, 0, ThemeEngine::kFontStyleTooltip);
+ 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 int *vals = Common::UpdateManager::getUpdateIntervals();
+
+ while (*vals != -1) {
+ _updatesPopUp->appendEntry(Common::UpdateManager::updateIntervalToString(*vals), *vals);
+ vals++;
+ }
+
+ _updatesPopUp->setSelectedTag(Common::UpdateManager::kUpdateIntervalOneWeek);
+
+ int yesButtonPos = (_w - (buttonWidth * 2)) / 2;
+ int noButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10;
+
+ _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);
+
+ _updatesPopUp->setEnabled(false);
+ _yesButton->setEnabled(false);
+}
+
+void UpdatesDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ if (cmd == kYesCmd) {
+ 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();
+ } 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);
+ }
+}
+
+} // End of namespace GUI
diff --git a/gui/updates-dialog.h b/gui/updates-dialog.h
new file mode 100644
index 0000000000..9c429c960c
--- /dev/null
+++ b/gui/updates-dialog.h
@@ -0,0 +1,54 @@
+/* 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 CheckboxWidget;
+class CommandSender;
+class ButtonWidget;
+class PopUpWidget;
+
+/**
+ * Wizard for updates opt-in
+ */
+class UpdatesDialog : public Dialog {
+public:
+ UpdatesDialog();
+ virtual ~UpdatesDialog() {}
+
+ void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+
+private:
+ PopUpWidget *_updatesPopUp;
+ ButtonWidget *_yesButton;
+ ButtonWidget *_noButton;
+ CheckboxWidget *_updatesCheckbox;
+};
+
+} // End of namespace GUI
+
+#endif
diff --git a/gui/widget.cpp b/gui/widget.cpp
index e4afea0c36..4143111e54 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 -
@@ -354,6 +356,7 @@ void ButtonWidget::handleTickle() {
void ButtonWidget::setPressedState() {
wantTickle(true);
setFlags(WIDGET_PRESSED);
+ clearFlags(WIDGET_HILITED);
draw();
}
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; }
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);