[Scummvm-git-logs] scummvm master -> 7b53202a9edf345548b42807b6abf8acf816672d
sev-
noreply at scummvm.org
Sun May 29 11:56:29 UTC 2022
This automated email contains information about 14 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c0acb85605 ALL: add support for --savepath command
fa031ca1a3 ALL: add support for --themepath and --extrapath
a7ed28e8a7 ALL: add support for --gui-theme and update themes
b7f6964fb4 ALL: add support for gfx, stretch and render mode
5fc5353ecc ALL: add support for -m -s -r commands
819f52a14d ALL: add support for --fullscreen command
8fccaf89ff ALL: add support for enable-gs and fix bugs
f71e98ddf5 ALL: add support for --filtering and --multi-midi
7dd0c1ddf8 ALL: add support for --midi-gain and --soundfont
e934e7d279 ALL: add support for native-mt32 and fix enable-gs
358bec9967 ALL: add support for --scaler and --scale-factor
7f1eafcb2f ALL: add support for --opl-driver and --talkspeed
d6dbf721b6 ALL: add support for --subtitles
7b53202a9e ALL: add support for --config and refactor code
Commit: c0acb8560501081d874ac20b11aa550a1344afbd
https://github.com/scummvm/scummvm/commit/c0acb8560501081d874ac20b11aa550a1344afbd
Author: grisenti (emanuele at grisenti.dev)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --savepath command
Changed paths:
base/commandLine.cpp
common/config-manager.cpp
common/config-manager.h
gui/ThemeEngine.cpp
gui/ThemeEngine.h
gui/ThemeParser.cpp
gui/options.cpp
gui/themes/default.inc
gui/themes/residualvm/remastered_gfx.stx
gui/themes/scummclassic/classic_gfx.stx
gui/themes/scummmodern/scummmodern_gfx.stx
gui/themes/scummremastered/remastered_gfx.stx
gui/widget.cpp
gui/widget.h
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 12c7c8563f7..07f0b165072 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1829,6 +1829,10 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
}
}
+ // store all session related settings
+ if (settings.contains("savepath")) {
+ ConfMan.set("savepath", settings["savepath"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index a58a91494d0..2955950c307 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -39,6 +39,7 @@ DECLARE_SINGLETON(ConfigManager);
char const *const ConfigManager::kApplicationDomain = "scummvm";
char const *const ConfigManager::kTransientDomain = "__TRANSIENT";
+char const *const ConfigManager::kSessionDomain = "__SESSION";
char const *const ConfigManager::kKeymapperDomain = "keymapper";
@@ -66,6 +67,7 @@ void ConfigManager::copyFrom(ConfigManager &source) {
_appDomain = source._appDomain;
_defaultsDomain = source._defaultsDomain;
_keymapperDomain = source._keymapperDomain;
+ _sessionDomain = source._sessionDomain;
#ifdef USE_CLOUD
_cloudDomain = source._cloudDomain;
#endif
@@ -160,6 +162,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) {
_miscDomains.clear();
_transientDomain.clear();
_domainSaveOrder.clear();
+ _sessionDomain.clear();
_keymapperDomain.clear();
#ifdef USE_CLOUD
@@ -225,7 +228,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) {
// Split string at '=' into 'key' and 'value'. First, find the "=" delimeter.
const char *p = strchr(t, '=');
if (!p)
- error("Config file buggy: Junk found in line line %d: '%s'", lineno, t);
+ error("Config file buggy: Junk found in line %d: '%s'", lineno, t);
// Extract the key/value pair
String key(t, p);
@@ -364,6 +367,8 @@ const ConfigManager::Domain *ConfigManager::getDomain(const String &domName) con
return &_appDomain;
if (domName == kKeymapperDomain)
return &_keymapperDomain;
+ if (domName == kSessionDomain)
+ return &_sessionDomain;
#ifdef USE_CLOUD
if (domName == kCloudDomain)
return &_cloudDomain;
@@ -386,6 +391,8 @@ ConfigManager::Domain *ConfigManager::getDomain(const String &domName) {
return &_appDomain;
if (domName == kKeymapperDomain)
return &_keymapperDomain;
+ if (domName == kSessionDomain)
+ return &_sessionDomain;
#ifdef USE_CLOUD
if (domName == kCloudDomain)
return &_cloudDomain;
@@ -405,13 +412,17 @@ ConfigManager::Domain *ConfigManager::getDomain(const String &domName) {
bool ConfigManager::hasKey(const String &key) const {
// Search the domains in the following order:
// 1) the transient domain,
- // 2) the active game domain (if any),
- // 3) the application domain.
+ // 2) the session domain,
+ // 3) the active game domain (if any),
+ // 4) the application domain.
// The defaults domain is explicitly *not* checked.
if (_transientDomain.contains(key))
return true;
+ if (_sessionDomain.contains(key))
+ return true;
+
if (_activeDomain && _activeDomain->contains(key))
return true;
@@ -428,6 +439,9 @@ bool ConfigManager::hasKey(const String &key, const String &domName) const {
if (domName.empty())
return hasKey(key);
+ if (_sessionDomain.contains(key))
+ return true;
+
const Domain *domain = getDomain(domName);
if (!domain)
@@ -443,6 +457,7 @@ void ConfigManager::removeKey(const String &key, const String &domName) {
key.c_str(), domName.c_str());
domain->erase(key);
+ _sessionDomain.erase(key);
}
@@ -452,6 +467,8 @@ void ConfigManager::removeKey(const String &key, const String &domName) {
const String &ConfigManager::get(const String &key) const {
if (_transientDomain.contains(key))
return _transientDomain[key];
+ else if (_sessionDomain.contains(key))
+ return _sessionDomain[key];
else if (_activeDomain && _activeDomain->contains(key))
return (*_activeDomain)[key];
else if (_appDomain.contains(key))
@@ -467,6 +484,9 @@ const String &ConfigManager::get(const String &key, const String &domName) const
if (domName.empty())
return get(key);
+ if (_sessionDomain.contains(key))
+ return _sessionDomain.getVal(key);
+
const Domain *domain = getDomain(domName);
if (!domain)
@@ -515,8 +535,9 @@ bool ConfigManager::getBool(const String &key, const String &domName) const {
void ConfigManager::set(const String &key, const String &value) {
- // Remove the transient domain value, if any.
+ // Remove the transient and session domain value, if any.
_transientDomain.erase(key);
+ _sessionDomain.erase(key);
// Write the new key/value pair into the active domain, resp. into
// the application domain if no game domain is active.
@@ -708,6 +729,10 @@ bool ConfigManager::hasMiscDomain(const String &domName) const {
return isValidDomainName(domName) && _miscDomains.contains(domName);
}
+bool ConfigManager::isKeyTemporary(const String &key) const {
+ return _transientDomain.contains(key) || _sessionDomain.contains(key);
+}
+
#pragma mark -
void ConfigManager::Domain::setDomainComment(const String &comment) {
diff --git a/common/config-manager.h b/common/config-manager.h
index 973fc57de79..854b0ec2b92 100644
--- a/common/config-manager.h
+++ b/common/config-manager.h
@@ -115,6 +115,11 @@ public:
/** The name of keymapper domain used to store the key maps. */
static char const *const kKeymapperDomain;
+ /** The name of the session domain where configs are put
+ * for the entire session or until they are overwritten or removed.
+ * These settings don't get saved to disk. */
+ static char const *const kSessionDomain;
+
#ifdef USE_CLOUD
/** The name of cloud domain used to store the user's tokens. */
static char const *const kCloudDomain;
@@ -202,6 +207,8 @@ public:
bool hasGameDomain(const String &domName) const; /*!< Check if a specific game domain exists in the DomainMap. */
bool hasMiscDomain(const String &domName) const; /*!< Check if a specific miscellaneous domain exists in the DomainMap. */
+ bool isKeyTemporary(const String &key) const; /*!< Check if a specific key exists in either transient or session domain. */
+
const DomainMap &getGameDomains() const { return _gameDomains; } /*!< Return all game domains in the DomainMap. */
DomainMap::iterator beginGameDomains() { return _gameDomains.begin(); } /*!< Return the beginning position of game domains. */
DomainMap::iterator endGameDomains() { return _gameDomains.end(); } /*!< Return the ending position of game domains. */
@@ -228,6 +235,8 @@ private:
Domain _keymapperDomain;
+ Domain _sessionDomain;
+
#ifdef USE_CLOUD
Domain _cloudDomain;
#endif
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 089e3b5edcc..8c95466fbb5 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1400,6 +1400,29 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::U32String &str,
}
break;
+ case kFontColorOverride:
+ if (inverted) {
+ colorId = kTextColorOverrideInverted;
+ } else {
+ switch (state) {
+ case kStateDisabled:
+ colorId = kTextColorAlternativeDisabled;
+ break;
+
+ case kStateHighlight:
+ colorId = kTextColorOverrideHover;
+ break;
+
+ default:
+ // fallthrough intended
+ case kStateEnabled:
+ case kStatePressed:
+ colorId = kTextColorOverride;
+ break;
+ }
+ }
+ break;
+
default:
return;
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index e2728a4f881..ef0d0bed42f 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -165,6 +165,10 @@ enum TextColor {
kTextColorAlternativeInverted,
kTextColorAlternativeHover,
kTextColorAlternativeDisabled,
+ kTextColorOverride,
+ kTextColorOverrideInverted,
+ kTextColorOverrideHover,
+ kTextColorOverrideDisabled,
kTextColorButton,
kTextColorButtonHover,
kTextColorButtonDisabled,
@@ -282,6 +286,7 @@ public:
kFontColorFormatting = -1, ///< Use color from formatting
kFontColorNormal = 0, ///< The default color of the theme
kFontColorAlternate = 1, ///< Alternative font color
+ kFontColorOverride = 2, ///< Color of overwritten text
kFontColorMax
};
@@ -579,7 +584,9 @@ public:
* Interface for the ThemeParser class: adds a text color value.
*
* @param colorId Identifier for the color type.
- * @param r, g, b Color of the font.
+ * @param r Red color component
+ * @param g Green color component
+ * @param b Blue color component
*/
bool addTextColor(TextColor colorId, int r, int g, int b);
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 0b1b8b63538..bb087340b9e 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -69,6 +69,10 @@ static const TextColorDataInfo kTextColorDefaults[] = {
{ kTextColorAlternativeInverted, "color_alternative_inverted" },
{ kTextColorAlternativeHover, "color_alternative_hover" },
{ kTextColorAlternativeDisabled, "color_alternative_disabled" },
+ { kTextColorOverride, "color_override" },
+ { kTextColorOverrideInverted, "color_override_inverted" },
+ { kTextColorOverrideHover, "color_override_hover" },
+ { kTextColorOverrideDisabled, "color_override_disabled" },
{ kTextColorButton, "color_button" },
{ kTextColorButtonHover, "color_button_hover" },
{ kTextColorButtonDisabled, "color_button_disabled" }
diff --git a/gui/options.cpp b/gui/options.cpp
index 7e398af3b4e..023130a7b52 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2118,6 +2118,9 @@ void GlobalOptionsDialog::build() {
Common::String iconPath(ConfMan.get("iconspath", _domain));
Common::String extraPath(ConfMan.get("extrapath", _domain));
+ if (ConfMan.isKeyTemporary("savepath")) {
+ _savePath->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
+ }
if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
_savePath->setLabel(_("Default"));
} else {
@@ -2211,7 +2214,7 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
new ButtonWidget(boss, prefix + "SaveButton", _("Save Path:"), _("Specifies where your saved games are put"), kChooseSaveDirCmd);
else
new ButtonWidget(boss, prefix + "SaveButton", _c("Save Path:", "lowres"), _("Specifies where your saved games are put"), kChooseSaveDirCmd);
- _savePath = new StaticTextWidget(boss, prefix + "SavePath", Common::U32String("/foo/bar"), _("Specifies where your saved games are put"));
+ _savePath = new StaticTextWidget(boss, prefix + "SavePath", Common::U32String("/foo/bar"), _("Specifies where your saved games are put. A red coloring indicates the value is temporary and will not get saved"));
_savePathClearButton = addClearButton(boss, prefix + "SavePathClearButton", kSavePathClearCmd);
@@ -2615,10 +2618,13 @@ void GlobalOptionsDialog::apply() {
bool isRebuildNeeded = false;
Common::U32String savePath(_savePath->getLabel());
- if (!savePath.empty() && (savePath != _("Default")))
- ConfMan.set("savepath", savePath.encode(), _domain);
- else
- ConfMan.removeKey("savepath", _domain);
+ if (savePath != ConfMan.get("savepath")) {
+ _savePath->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ if (savePath.empty() || (savePath == _("Default")))
+ ConfMan.removeKey("savepath", _domain);
+ else
+ ConfMan.set("savepath", savePath.encode(), _domain);
+ }
Common::U32String themePath(_themePath->getLabel());
if (!themePath.empty() && (themePath != _c("None", "path")))
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 01a6705349e..b45c596ff47 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -74,6 +74,18 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<text_color id='color_alternative_disabled' "
"color='darkgrey' "
"/>"
+"<text_color id='color_override' "
+"color='255,0,0' "
+"/>"
+"<text_color id='color_override_inverted' "
+"color='0,255,255' "
+"/>"
+"<text_color id='color_override_hover' "
+"color='255,50,50' "
+"/>"
+"<text_color id='color_override_disabled' "
+"color='255,200,200' "
+"/>"
"<text_color id='color_button' "
"color='green' "
"/>"
diff --git a/gui/themes/residualvm/remastered_gfx.stx b/gui/themes/residualvm/remastered_gfx.stx
index 254fcf774bc..034d19dc31d 100644
--- a/gui/themes/residualvm/remastered_gfx.stx
+++ b/gui/themes/residualvm/remastered_gfx.stx
@@ -256,6 +256,22 @@
color = 'darkgray2'
/>
+ <text_color id = 'color_override'
+ color = '255, 0, 0'
+ />
+
+ <text_color id = 'color_override_inverted'
+ color = '0, 255, 255'
+ />
+
+ <text_color id = 'color_override_hover'
+ color = '255, 50, 50'
+ />
+
+ <text_color id = 'color_override_disabled'
+ color = '255, 200, 200'
+ />
+
<text_color id = 'color_button'
color = 'white'
/>
diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx
index fd10950a574..4da1f21a18c 100644
--- a/gui/themes/scummclassic/classic_gfx.stx
+++ b/gui/themes/scummclassic/classic_gfx.stx
@@ -103,6 +103,22 @@
color = 'darkgrey'
/>
+ <text_color id = 'color_override'
+ color = '255, 0, 0'
+ />
+
+ <text_color id = 'color_override_inverted'
+ color = '0, 255, 255'
+ />
+
+ <text_color id = 'color_override_hover'
+ color = '255, 50, 50'
+ />
+
+ <text_color id = 'color_override_disabled'
+ color = '255, 200, 200'
+ />
+
<text_color id = 'color_button'
color = 'green'
/>
diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx
index c824979a150..26a46a114ea 100644
--- a/gui/themes/scummmodern/scummmodern_gfx.stx
+++ b/gui/themes/scummmodern/scummmodern_gfx.stx
@@ -254,6 +254,22 @@
color = 'darkgray2'
/>
+ <text_color id = 'color_override'
+ color = '255, 0, 0'
+ />
+
+ <text_color id = 'color_override_inverted'
+ color = '0, 255, 255'
+ />
+
+ <text_color id = 'color_override_hover'
+ color = '255, 50, 50'
+ />
+
+ <text_color id = 'color_override_disabled'
+ color = '255, 200, 200'
+ />
+
<text_color id = 'color_button'
color = 'white'
/>
diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index ec7337171b9..395ef0d2802 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -256,6 +256,22 @@
color = 'darkgray2'
/>
+ <text_color id = 'color_override'
+ color = '255, 0, 0'
+ />
+
+ <text_color id = 'color_override_inverted'
+ color = '0, 255, 255'
+ />
+
+ <text_color id = 'color_override_hover'
+ color = '255, 50, 50'
+ />
+
+ <text_color id = 'color_override_disabled'
+ color = '255, 200, 200'
+ />
+
<text_color id = 'color_button'
color = 'white'
/>
diff --git a/gui/widget.cpp b/gui/widget.cpp
index bd7d4ac24eb..c6f72fdf31e 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -292,6 +292,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
_label = text;
_align = Graphics::convertTextAlignH(align, g_gui.useRTL() && _useRTL);
setFont(font, lang);
+ _fontColor = ThemeEngine::FontColor::kFontColorNormal;
_useEllipsis = useEllipsis;
}
@@ -302,6 +303,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name,
_label = text;
_align = Graphics::convertTextAlignH(g_gui.xmlEval()->getWidgetTextHAlign(name), g_gui.useRTL() && _useRTL);
setFont(font, lang);
+ _fontColor = ThemeEngine::FontColor::kFontColorNormal;
_useEllipsis = useEllipsis;
}
@@ -326,11 +328,15 @@ void StaticTextWidget::setAlign(Graphics::TextAlign align) {
}
}
+void StaticTextWidget::setFontColor(const ThemeEngine::FontColor color)
+{
+ _fontColor = color;
+}
void StaticTextWidget::drawWidget() {
g_gui.theme()->drawText(
Common::Rect(_x, _y, _x + _w, _y + _h),
- _label, _state, _align, ThemeEngine::kTextInversionNone, 0, _useEllipsis, _font
+ _label, _state, _align, ThemeEngine::kTextInversionNone, 0, _useEllipsis, _font, _fontColor
);
}
diff --git a/gui/widget.h b/gui/widget.h
index c00cca3efb2..e77f3455c52 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -201,6 +201,7 @@ protected:
Common::U32String _label;
Graphics::TextAlign _align;
ThemeEngine::FontStyle _font;
+ ThemeEngine::FontColor _fontColor;
bool _useEllipsis;
public:
@@ -213,6 +214,7 @@ public:
void setAlign(Graphics::TextAlign align);
Graphics::TextAlign getAlign() const { return _align; }
void readLabel() { read(_label); }
+ void setFontColor(ThemeEngine::FontColor color);
protected:
void drawWidget() override;
Commit: fa031ca1a37c3b205b7034be1914327f78eac1c1
https://github.com/scummvm/scummvm/commit/fa031ca1a37c3b205b7034be1914327f78eac1c1
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --themepath and --extrapath
Changed paths:
base/commandLine.cpp
gui/options.cpp
gui/widget.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 07f0b165072..40cdf9e9dd9 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1833,6 +1833,12 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("savepath")) {
ConfMan.set("savepath", settings["savepath"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("themepath")) {
+ ConfMan.set("themepath", settings["themepath"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("extrapath")) {
+ ConfMan.set("extrapath", settings["extrapath"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/gui/options.cpp b/gui/options.cpp
index 023130a7b52..ef4a910b6a2 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2112,38 +2112,24 @@ void GlobalOptionsDialog::build() {
OptionsDialog::build();
#if !defined(__DC__)
- // Set _savePath to the current save path
- Common::String savePath(ConfMan.get("savepath", _domain));
- Common::String themePath(ConfMan.get("themepath", _domain));
- Common::String iconPath(ConfMan.get("iconspath", _domain));
- Common::String extraPath(ConfMan.get("extrapath", _domain));
-
- if (ConfMan.isKeyTemporary("savepath")) {
- _savePath->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
- }
- if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
- _savePath->setLabel(_("Default"));
- } else {
- _savePath->setLabel(savePath);
- }
-
- if (themePath.empty() || !ConfMan.hasKey("themepath", _domain)) {
- _themePath->setLabel(_c("None", "path"));
- } else {
- _themePath->setLabel(themePath);
- }
+ const auto setPath =
+ [&](GUI::StaticTextWidget *const widget, const Common::String& pathType, const Common::U32String &defaultLabel) {
+ Common::String path(ConfMan.get(pathType));
+ if (ConfMan.isKeyTemporary(pathType)) {
+ widget->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
+ }
+ if (path.empty() || !ConfMan.hasKey(pathType, _domain)) {
+ widget->setLabel(defaultLabel);
+ } else {
+ widget->setLabel(path);
+ }
- if (iconPath.empty() || !ConfMan.hasKey("iconspath", _domain)) {
- _iconPath->setLabel(_c("None", "path"));
- } else {
- _iconPath->setLabel(iconPath);
- }
+ };
- if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
- _extraPath->setLabel(_c("None", "path"));
- } else {
- _extraPath->setLabel(extraPath);
- }
+ setPath(_savePath, "savepath", _("Default"));
+ setPath(_themePath, "themepath", _c("None", "path"));
+ setPath(_iconPath, "iconpath", _c("None", "path"));
+ setPath(_extraPath, "extrapath", _c("None", "path"));
#ifdef DYNAMIC_MODULES
Common::String pluginsPath(ConfMan.get("pluginspath", _domain));
@@ -2617,32 +2603,22 @@ void GlobalOptionsDialog::apply() {
bool isRebuildNeeded = false;
- Common::U32String savePath(_savePath->getLabel());
- if (savePath != ConfMan.get("savepath")) {
- _savePath->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
- if (savePath.empty() || (savePath == _("Default")))
- ConfMan.removeKey("savepath", _domain);
- else
- ConfMan.set("savepath", savePath.encode(), _domain);
- }
-
- Common::U32String themePath(_themePath->getLabel());
- if (!themePath.empty() && (themePath != _c("None", "path")))
- ConfMan.set("themepath", themePath.encode(), _domain);
- else
- ConfMan.removeKey("themepath", _domain);
-
- Common::U32String iconPath(_iconPath->getLabel());
- if (!iconPath.empty() && (iconPath != _c("None", "path")))
- ConfMan.set("iconspath", iconPath.encode(), _domain);
- else
- ConfMan.removeKey("iconspath", _domain);
-
- Common::U32String extraPath(_extraPath->getLabel());
- if (!extraPath.empty() && (extraPath != _c("None", "path")))
- ConfMan.set("extrapath", extraPath.encode(), _domain);
- else
- ConfMan.removeKey("extrapath", _domain);
+ const auto changePath =
+ [&](GUI::StaticTextWidget *const widget, const Common::String& pathType, const Common::U32String &defaultLabel){
+ Common::U32String label(widget->getLabel());
+ if (label != ConfMan.get(pathType)) {
+ widget->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ if (label.empty() || (label == defaultLabel))
+ ConfMan.removeKey(pathType, _domain);
+ else
+ ConfMan.set(pathType, label.encode(), _domain);
+ }
+ };
+
+ changePath(_savePath, "savepath", _("Default"));
+ changePath(_themePath, "themepath", _c("None", "path"));
+ changePath(_iconPath, "iconpath", _c("None", "path"));
+ changePath(_extraPath, "extrapath", _c("None", "path"));
#ifdef DYNAMIC_MODULES
Common::U32String pluginsPath(_pluginsPath->getLabel());
diff --git a/gui/widget.cpp b/gui/widget.cpp
index c6f72fdf31e..daffd18fe7b 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -328,8 +328,7 @@ void StaticTextWidget::setAlign(Graphics::TextAlign align) {
}
}
-void StaticTextWidget::setFontColor(const ThemeEngine::FontColor color)
-{
+void StaticTextWidget::setFontColor(const ThemeEngine::FontColor color) {
_fontColor = color;
}
Commit: a7ed28e8a7a9fc40c48a2594c4d066818b795ae2
https://github.com/scummvm/scummvm/commit/a7ed28e8a7a9fc40c48a2594c4d066818b795ae2
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --gui-theme and update themes
Changed paths:
base/commandLine.cpp
base/main.cpp
gui/options.cpp
gui/themes/residualvm.zip
gui/themes/scummclassic.zip
gui/themes/scummmodern.zip
gui/themes/scummremastered.zip
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 40cdf9e9dd9..dc888500397 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1839,6 +1839,10 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("extrapath")) {
ConfMan.set("extrapath", settings["extrapath"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("gui-theme")) {
+ ConfMan.set("gui_theme", settings["gui-theme"], Common::ConfigManager::kSessionDomain);
+ }
+
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/base/main.cpp b/base/main.cpp
index a3ee5c6f28d..3c05edf9afe 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -366,12 +366,6 @@ static void setupGraphics(OSystem &system) {
system.applyBackendSettings();
- // When starting up launcher for the first time, the user might have specified
- // a --gui-theme option, to allow that option to be working, we need to initialize
- // GUI here.
- // FIXME: Find a nicer way to allow --gui-theme to be working
- GUI::GuiManager::instance();
-
// Set initial window caption
system.setWindowCaption(Common::U32String(gScummVMFullVersion));
diff --git a/gui/options.cpp b/gui/options.cpp
index ef4a910b6a2..0dbcab135b3 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2256,7 +2256,8 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
void GlobalOptionsDialog::addMiscControls(GuiObject *boss, const Common::String &prefix, bool lowres) {
new ButtonWidget(boss, prefix + "ThemeButton", _("Theme:"), Common::U32String(), kChooseThemeCmd);
_curTheme = new StaticTextWidget(boss, prefix + "CurTheme", g_gui.theme()->getThemeName());
-
+ if (ConfMan.isKeyTemporary("gui_theme"))
+ _curTheme->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_guiBasePopUpDesc = new StaticTextWidget(boss, prefix + "GUIBasePopupDesc", _("GUI scale:"));
_guiBasePopUp = new PopUpWidget(boss, prefix + "GUIBasePopup");
@@ -2963,6 +2964,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
// User made his choice...
_newTheme = browser.getSelected();
_curTheme->setLabel(browser.getSelectedName());
+ _curTheme->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
}
break;
}
diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip
index c713f6777a2..cda53b21013 100644
Binary files a/gui/themes/residualvm.zip and b/gui/themes/residualvm.zip differ
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index d46672bd1d0..cc440dfd7c6 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index b5dee0a6ddd..37dfae9883d 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index e4e09ab9ae3..b31165e72d8 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ
Commit: b7f6964fb4ea9fceac17e3bf3be3a7fa84ba3e65
https://github.com/scummvm/scummvm/commit/b7f6964fb4ea9fceac17e3bf3be3a7fa84ba3e65
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for gfx, stretch and render mode
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index dc888500397..70ddce5e047 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1842,6 +1842,15 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("gui-theme")) {
ConfMan.set("gui_theme", settings["gui-theme"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("gfx-mode")) {
+ ConfMan.set("gfx_mode", settings["gfx-mode"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("stretch-mode")) {
+ ConfMan.set("stretch_mode", settings["stretch-mode"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("render-mode")) {
+ ConfMan.set("render_mode", settings["render-mode"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
diff --git a/gui/options.cpp b/gui/options.cpp
index 0dbcab135b3..a9946309b8d 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -572,6 +572,7 @@ void OptionsDialog::apply() {
bool isSet = false;
if ((int32)_gfxPopUp->getSelectedTag() >= 0) {
+ _gfxPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
while (gm->name) {
@@ -591,12 +592,16 @@ void OptionsDialog::apply() {
graphicsModeChanged = true;
}
- if ((int32)_renderModePopUp->getSelectedTag() >= 0)
+ if ((int32)_renderModePopUp->getSelectedTag() >= 0) {
+ _renderModePopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
ConfMan.set("render_mode", Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag()), _domain);
+ }
isSet = false;
if ((int32)_stretchPopUp->getSelectedTag() >= 0) {
+ _stretchPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
+
while (sm->name) {
if (sm->id == (int)_stretchPopUp->getSelectedTag()) {
if (ConfMan.get("stretch_mode", _domain) != sm->name)
@@ -1383,6 +1388,8 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
// The GFX mode popup
_gfxPopUpDesc = new StaticTextWidget(boss, prefix + "grModePopupDesc", _("Graphics mode:"));
+ if (ConfMan.isKeyTemporary("gfx_mode"))
+ _gfxPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_gfxPopUp = new PopUpWidget(boss, prefix + "grModePopup");
_gfxPopUp->appendEntry(_("<default>"));
@@ -1397,6 +1404,8 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
bool renderingTypeDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != nullptr);
_renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"), _("Special dithering modes supported by some games"));
+ if (ConfMan.isKeyTemporary("render_mode"))
+ _renderModePopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup", _("Special dithering modes supported by some games"));
_renderModePopUp->appendEntry(_("<default>"), Common::kRenderDefault);
_renderModePopUp->appendEntry(Common::U32String());
@@ -1410,6 +1419,8 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
// The Stretch mode popup
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
_stretchPopUpDesc = new StaticTextWidget(boss, prefix + "grStretchModePopupDesc", _("Stretch mode:"));
+ if (ConfMan.isKeyTemporary("stretch_mode"))
+ _stretchPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_stretchPopUp = new PopUpWidget(boss, prefix + "grStretchModePopup");
_stretchPopUp->appendEntry(_("<default>"));
Commit: 5fc5353eccb656133e41d598af8a5dc71e746ff3
https://github.com/scummvm/scummvm/commit/5fc5353eccb656133e41d598af8a5dc71e746ff3
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for -m -s -r commands
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 70ddce5e047..efa61d2ed79 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1851,6 +1851,15 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("render-mode")) {
ConfMan.set("render_mode", settings["render-mode"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("music-volume")) {
+ ConfMan.set("music_volume", settings["music-volume"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("sfx-volume")) {
+ ConfMan.set("sfx_volume", settings["sfx-volume"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("speech-volume")) {
+ ConfMan.set("speech_volume", settings["speech-volume"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
diff --git a/gui/options.cpp b/gui/options.cpp
index a9946309b8d..238629d6149 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -958,7 +958,7 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
updateSpeechVolume(newValue);
}
}
-
+ _musicVolumeDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
break;
}
case kSfxVolumeChanged: {
@@ -973,7 +973,7 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
if (_guioptions.contains(GUIO_LINKSPEECHTOSFX)) {
updateSpeechVolume(newValue);
}
-
+ _sfxVolumeDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
break;
}
case kSpeechVolumeChanged: {
@@ -988,7 +988,7 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
updateMusicVolume(newValue);
}
}
-
+ _speechVolumeDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
break;
}
case kMuteAllChanged:
@@ -1676,6 +1676,8 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre
_musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", _("Music volume:"));
else
_musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", _c("Music volume:", "lowres"));
+ if (ConfMan.isKeyTemporary("music_volume"))
+ _musicVolumeDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", Common::U32String(), kMusicVolumeChanged);
_musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", Common::U32String("100%"), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false);
_musicVolumeSlider->setMinValue(0);
@@ -1688,6 +1690,8 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre
_sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", _("SFX volume:"), _("Special sound effects volume"));
else
_sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", _c("SFX volume:", "lowres"), _("Special sound effects volume"));
+ if (ConfMan.isKeyTemporary("sfx_volume"))
+ _sfxVolumeDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", _("Special sound effects volume"), kSfxVolumeChanged);
_sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", Common::U32String("100%"), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false);
_sfxVolumeSlider->setMinValue(0);
@@ -1698,6 +1702,8 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre
_speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , _("Speech volume:"));
else
_speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , _c("Speech volume:", "lowres"));
+ if (ConfMan.isKeyTemporary("speech_volume"))
+ _speechVolumeDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", Common::U32String(), kSpeechVolumeChanged);
_speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", Common::U32String("100%"), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false);
_speechVolumeSlider->setMinValue(0);
Commit: 819f52a14d9a2d59b21b61a5238b4acb2fd237a0
https://github.com/scummvm/scummvm/commit/819f52a14d9a2d59b21b61a5238b4acb2fd237a0
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --fullscreen command
Changed paths:
base/commandLine.cpp
gui/ThemeEngine.cpp
gui/ThemeEngine.h
gui/options.cpp
gui/widget.cpp
gui/widget.h
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index efa61d2ed79..28a596c997b 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1860,7 +1860,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("speech-volume")) {
ConfMan.set("speech_volume", settings["speech-volume"], Common::ConfigManager::kSessionDomain);
}
-
+ if (settings.contains("fullscreen")) {
+ ConfMan.set("fullscreen", settings["fullscreen"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 8c95466fbb5..0de5f662af6 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1057,7 +1057,8 @@ void ThemeEngine::drawLineSeparator(const Common::Rect &r) {
drawDD(kDDSeparator, r);
}
-void ThemeEngine::drawCheckbox(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked, WidgetStateInfo state, bool rtl) {
+void ThemeEngine::drawCheckbox(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked,
+ WidgetStateInfo state, bool override, bool rtl) {
if (!ready())
return;
@@ -1087,7 +1088,8 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, int spacing, const Common:
}
if (r2.right > r2.left) {
- drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
+ TextColor color = override ? GUI::TextColor::kTextColorOverride : getTextColor(dd);
+ drawDDText(getTextData(dd), color, r2, str, true, false, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
_widgets[dd]->_textAlignV);
}
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index ef0d0bed42f..94ece3ed009 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -471,7 +471,7 @@ public:
void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled, bool rtl = false);
void drawCheckbox(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked,
- WidgetStateInfo state = kStateEnabled, bool rtl = false);
+ WidgetStateInfo state = kStateEnabled, bool override = false, bool rtl = false);
void drawRadiobutton(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked,
WidgetStateInfo state = kStateEnabled, bool rtl = false);
diff --git a/gui/options.cpp b/gui/options.cpp
index 238629d6149..93f3c045b3e 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -378,6 +378,8 @@ void OptionsDialog::build() {
// Fullscreen setting
if (g_system->hasFeature(OSystem::kFeatureFullscreenMode)) {
_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
+ if (ConfMan.isKeyTemporary("fullscreen"))
+ _fullscreenCheckbox->setOverride(true);
} else {
_fullscreenCheckbox->setState(true);
_fullscreenCheckbox->setEnabled(false);
@@ -557,8 +559,10 @@ void OptionsDialog::apply() {
if (_enableGraphicSettings) {
if (ConfMan.getBool("filtering", _domain) != _filteringCheckbox->getState())
graphicsModeChanged = true;
- if (ConfMan.getBool("fullscreen", _domain) != _fullscreenCheckbox->getState())
+ if (ConfMan.getBool("fullscreen", _domain) != _fullscreenCheckbox->getState()) {
graphicsModeChanged = true;
+ _fullscreenCheckbox->setOverride(false);
+ }
if (ConfMan.getBool("aspect_ratio", _domain) != _aspectCheckbox->getState())
graphicsModeChanged = true;
if (ConfMan.getBool("vsync", _domain) != _vsyncCheckbox->getState())
diff --git a/gui/widget.cpp b/gui/widget.cpp
index daffd18fe7b..73ef4df3a26 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -707,14 +707,14 @@ void PicButtonWidget::drawWidget() {
#pragma mark -
CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
- : ButtonWidget(boss, x, y, w, h, label, tooltip, cmd, hotkey), _state(false) {
+ : ButtonWidget(boss, x, y, w, h, label, tooltip, cmd, hotkey), _state(false), _override(false) {
setFlags(WIDGET_ENABLED);
_type = kCheckboxWidget;
_spacing = g_gui.xmlEval()->getVar("Globals.Checkbox.Spacing", 15);
}
CheckboxWidget::CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
- : ButtonWidget(boss, name, label, tooltip, cmd, hotkey), _state(false) {
+ : ButtonWidget(boss, name, label, tooltip, cmd, hotkey), _state(false), _override(false) {
setFlags(WIDGET_ENABLED);
_type = kCheckboxWidget;
_spacing = g_gui.xmlEval()->getVar("Globals.Checkbox.Spacing", 15);
@@ -736,9 +736,13 @@ void CheckboxWidget::setState(bool state) {
}
sendCommand(_cmd, _state);
}
+
+void CheckboxWidget::setOverride(bool override) {
+ _override = override;
+}
void CheckboxWidget::drawWidget() {
- g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _spacing, getLabel(), _state, Widget::_state, (g_gui.useRTL() && _useRTL));
+ g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _spacing, getLabel(), _state, Widget::_state, _override, (g_gui.useRTL() && _useRTL));
}
#pragma mark -
diff --git a/gui/widget.h b/gui/widget.h
index e77f3455c52..1147bfc7420 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -321,6 +321,7 @@ protected:
class CheckboxWidget : public ButtonWidget {
protected:
bool _state;
+ bool _override;
int _spacing;
public:
CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
@@ -334,6 +335,8 @@ public:
void toggleState() { setState(!_state); }
bool getState() const { return _state; }
+ void setOverride(bool override);
+
protected:
void drawWidget() override;
};
Commit: 8fccaf89ff25804f47abf1342ac65d7d57fd8844
https://github.com/scummvm/scummvm/commit/8fccaf89ff25804f47abf1342ac65d7d57fd8844
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for enable-gs and fix bugs
Changed paths:
base/commandLine.cpp
common/config-manager.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 28a596c997b..ea63b4e9d41 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1863,6 +1863,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("fullscreen")) {
ConfMan.set("fullscreen", settings["fullscreen"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("enable-gs")) {
+ ConfMan.set("enable_gs", settings["enable-gs"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index 2955950c307..9c637c856e4 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -575,9 +575,12 @@ void ConfigManager::set(const String &key, const String &value, const String &do
error("ConfigManager::set(%s,%s,%s) called on non-existent domain",
key.c_str(), value.c_str(), domName.c_str());
+ if (domName != kSessionDomain && domName != kTransientDomain)
+ _sessionDomain.erase(key);
+
(*domain).setVal(key, value);
- // TODO/FIXME: We used to erase the given key from the transient domain
+ // TODO/FIXME: We used to erase the given key from the transient domain
// here. Do we still want to do that?
// It was probably there to simplify the options dialogs code:
// Imagine you are editing the current options (via the SCUMM ConfigDialog,
diff --git a/gui/options.cpp b/gui/options.cpp
index 93f3c045b3e..6861a89d56a 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -378,7 +378,7 @@ void OptionsDialog::build() {
// Fullscreen setting
if (g_system->hasFeature(OSystem::kFeatureFullscreenMode)) {
_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
- if (ConfMan.isKeyTemporary("fullscreen"))
+ if (ConfMan.isKeyTemporary("fullscreen"))
_fullscreenCheckbox->setOverride(true);
} else {
_fullscreenCheckbox->setState(true);
@@ -477,6 +477,8 @@ void OptionsDialog::build() {
// GS extensions setting
_enableGSCheckbox->setState(ConfMan.getBool("enable_gs", _domain));
+ if (ConfMan.isKeyTemporary("enable_gs"))
+ _enableGSCheckbox->setOverride(true);
}
// Volume options
@@ -561,6 +563,7 @@ void OptionsDialog::apply() {
graphicsModeChanged = true;
if (ConfMan.getBool("fullscreen", _domain) != _fullscreenCheckbox->getState()) {
graphicsModeChanged = true;
+ ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
_fullscreenCheckbox->setOverride(false);
}
if (ConfMan.getBool("aspect_ratio", _domain) != _aspectCheckbox->getState())
@@ -569,21 +572,21 @@ void OptionsDialog::apply() {
graphicsModeChanged = true;
ConfMan.setBool("filtering", _filteringCheckbox->getState(), _domain);
- ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
ConfMan.setBool("vsync", _vsyncCheckbox->getState(), _domain);
bool isSet = false;
if ((int32)_gfxPopUp->getSelectedTag() >= 0) {
- _gfxPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
while (gm->name) {
if (gm->id == (int)_gfxPopUp->getSelectedTag()) {
- if (ConfMan.get("gfx_mode", _domain) != gm->name)
+ if (ConfMan.get("gfx_mode", _domain) != gm->name) {
+ _gfxPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
graphicsModeChanged = true;
- ConfMan.set("gfx_mode", gm->name, _domain);
+ ConfMan.set("gfx_mode", gm->name, _domain);
+ }
isSet = true;
break;
}
@@ -591,26 +594,31 @@ void OptionsDialog::apply() {
}
}
if (!isSet) {
+ _gfxPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
ConfMan.removeKey("gfx_mode", _domain);
if (g_system->getGraphicsMode() != g_system->getDefaultGraphicsMode())
graphicsModeChanged = true;
}
if ((int32)_renderModePopUp->getSelectedTag() >= 0) {
- _renderModePopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
- ConfMan.set("render_mode", Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag()), _domain);
+ Common::String renderModeCode = Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag());
+ if (_renderModePopUp->getSelectedTag() == 0 || ConfMan.get("render_mode", _domain) != renderModeCode) {
+ ConfMan.set("render_mode", renderModeCode, _domain);
+ _renderModePopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ }
}
isSet = false;
if ((int32)_stretchPopUp->getSelectedTag() >= 0) {
- _stretchPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
const OSystem::GraphicsMode *sm = g_system->getSupportedStretchModes();
while (sm->name) {
if (sm->id == (int)_stretchPopUp->getSelectedTag()) {
- if (ConfMan.get("stretch_mode", _domain) != sm->name)
+ if (ConfMan.get("stretch_mode", _domain) != sm->name) {
graphicsModeChanged = true;
- ConfMan.set("stretch_mode", sm->name, _domain);
+ ConfMan.set("stretch_mode", sm->name, _domain);
+ _stretchPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ }
isSet = true;
break;
}
@@ -618,6 +626,7 @@ void OptionsDialog::apply() {
}
}
if (!isSet) {
+ _stretchPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
ConfMan.removeKey("stretch_mode", _domain);
if (g_system->getStretchMode() != g_system->getDefaultStretchMode())
graphicsModeChanged = true;
@@ -892,6 +901,7 @@ void OptionsDialog::apply() {
ConfMan.removeKey("native_mt32", _domain);
ConfMan.removeKey("enable_gs", _domain);
}
+ _enableGSCheckbox->setOverride(false);
}
// Subtitle options
Commit: f71e98ddf58798ecf773c3380d2d7ce9d385c4a0
https://github.com/scummvm/scummvm/commit/f71e98ddf58798ecf773c3380d2d7ce9d385c4a0
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --filtering and --multi-midi
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index ea63b4e9d41..008050d4f0e 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1866,6 +1866,12 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("enable-gs")) {
ConfMan.set("enable_gs", settings["enable-gs"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("filtering")) {
+ ConfMan.set("filtering", settings["filtering"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("multi-midi")) {
+ ConfMan.set("multi_midi", settings["multi-midi"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/gui/options.cpp b/gui/options.cpp
index 6861a89d56a..6476b5219fa 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -388,6 +388,8 @@ void OptionsDialog::build() {
// Filtering setting
if (g_system->hasFeature(OSystem::kFeatureFilteringMode)) {
_filteringCheckbox->setState(ConfMan.getBool("filtering", _domain));
+ if (ConfMan.isKeyTemporary("filtering"))
+ _filteringCheckbox->setOverride(true);
} else {
_filteringCheckbox->setState(false);
_filteringCheckbox->setEnabled(false);
@@ -452,6 +454,8 @@ void OptionsDialog::build() {
// Multi midi setting
_multiMidiCheckbox->setState(ConfMan.getBool("multi_midi", _domain));
+ if (ConfMan.isKeyTemporary("multi_midi"))
+ _multiMidiCheckbox->setOverride(true);
Common::String soundFont(ConfMan.get("soundfont", _domain));
if (soundFont.empty() || !ConfMan.hasKey("soundfont", _domain)) {
@@ -559,8 +563,11 @@ void OptionsDialog::apply() {
// Graphic options
if (_fullscreenCheckbox) {
if (_enableGraphicSettings) {
- if (ConfMan.getBool("filtering", _domain) != _filteringCheckbox->getState())
+ if (ConfMan.getBool("filtering", _domain) != _filteringCheckbox->getState()) {
graphicsModeChanged = true;
+ ConfMan.setBool("filtering", _filteringCheckbox->getState(), _domain);
+ _filteringCheckbox->setOverride(false);
+ }
if (ConfMan.getBool("fullscreen", _domain) != _fullscreenCheckbox->getState()) {
graphicsModeChanged = true;
ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
@@ -571,7 +578,6 @@ void OptionsDialog::apply() {
if (ConfMan.getBool("vsync", _domain) != _vsyncCheckbox->getState())
graphicsModeChanged = true;
- ConfMan.setBool("filtering", _filteringCheckbox->getState(), _domain);
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
ConfMan.setBool("vsync", _vsyncCheckbox->getState(), _domain);
@@ -874,7 +880,10 @@ void OptionsDialog::apply() {
if (_enableMIDISettings) {
saveMusicDeviceSetting(_gmDevicePopUp, "gm_device");
- ConfMan.setBool("multi_midi", _multiMidiCheckbox->getState(), _domain);
+ if (_multiMidiCheckbox->getState() != ConfMan.getBool("multi_midi", _domain)) {
+ ConfMan.setBool("multi_midi", _multiMidiCheckbox->getState(), _domain);
+ _multiMidiCheckbox->setOverride(false);
+ }
ConfMan.setInt("midi_gain", _midiGainSlider->getValue(), _domain);
Common::U32String soundFont(_soundFont->getLabel());
Commit: 7dd0c1ddf87deb01628445e2457211db10616021
https://github.com/scummvm/scummvm/commit/7dd0c1ddf87deb01628445e2457211db10616021
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --midi-gain and --soundfont
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 008050d4f0e..23a972d08c1 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1872,7 +1872,12 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("multi-midi")) {
ConfMan.set("multi_midi", settings["multi-midi"], Common::ConfigManager::kSessionDomain);
}
-
+ if (settings.contains("midi-gain")) {
+ ConfMan.set("midi_gain", settings["midi-gain"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("soundfont")) {
+ ConfMan.set("soundfont", settings["soundfont"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
Common::String key(x->_key);
diff --git a/gui/options.cpp b/gui/options.cpp
index 6476b5219fa..37fc9d43888 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -458,6 +458,9 @@ void OptionsDialog::build() {
_multiMidiCheckbox->setOverride(true);
Common::String soundFont(ConfMan.get("soundfont", _domain));
+ if (ConfMan.isKeyTemporary("soundfont")) {
+ _soundFont->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
+ }
if (soundFont.empty() || !ConfMan.hasKey("soundfont", _domain)) {
_soundFont->setLabel(_c("None", "soundfont"));
_soundFontClearButton->setEnabled(false);
@@ -469,6 +472,8 @@ void OptionsDialog::build() {
// MIDI gain setting
_midiGainSlider->setValue(ConfMan.getInt("midi_gain", _domain));
_midiGainLabel->setLabel(Common::String::format("%.2f", (double)_midiGainSlider->getValue() / 100.0));
+ if (ConfMan.isKeyTemporary("midi_gain"))
+ _midiGainDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
}
// MT-32 options
@@ -884,18 +889,27 @@ void OptionsDialog::apply() {
ConfMan.setBool("multi_midi", _multiMidiCheckbox->getState(), _domain);
_multiMidiCheckbox->setOverride(false);
}
- ConfMan.setInt("midi_gain", _midiGainSlider->getValue(), _domain);
+ if (_midiGainSlider->getValue() != ConfMan.getInt("midi_gain", _domain)) {
+ ConfMan.setInt("midi_gain", _midiGainSlider->getValue(), _domain);
+ _midiGainDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ }
Common::U32String soundFont(_soundFont->getLabel());
- if (!soundFont.empty() && (soundFont != _c("None", "soundfont")))
- ConfMan.set("soundfont", soundFont.encode(), _domain);
- else
- ConfMan.removeKey("soundfont", _domain);
+ if (soundFont != ConfMan.get("soundfont", _domain)) {
+ _soundFont->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ if (soundFont.empty() || (soundFont != _c("None", "soundfont")))
+ ConfMan.removeKey("soundpath", _domain);
+ else
+ ConfMan.set("soundfont", soundFont.encode(), _domain);
+ }
} else {
ConfMan.removeKey("gm_device", _domain);
ConfMan.removeKey("multi_midi", _domain);
+ _multiMidiCheckbox->setOverride(false);
ConfMan.removeKey("midi_gain", _domain);
+ _midiGainDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
ConfMan.removeKey("soundfont", _domain);
+ _soundFont->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
}
}
@@ -2163,7 +2177,6 @@ void GlobalOptionsDialog::build() {
} else {
widget->setLabel(path);
}
-
};
setPath(_savePath, "savepath", _("Default"));
Commit: e934e7d2793de1e2ad53a775ed5ba57c1f4af691
https://github.com/scummvm/scummvm/commit/e934e7d2793de1e2ad53a775ed5ba57c1f4af691
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for native-mt32 and fix enable-gs
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 23a972d08c1..3c27fa50a67 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1866,6 +1866,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("enable-gs")) {
ConfMan.set("enable_gs", settings["enable-gs"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("native-mt32")) {
+ ConfMan.set("native_mt32", settings["native-mt32"], Common::ConfigManager::kSessionDomain);
+ }
if (settings.contains("filtering")) {
ConfMan.set("filtering", settings["filtering"], Common::ConfigManager::kSessionDomain);
}
diff --git a/gui/options.cpp b/gui/options.cpp
index 37fc9d43888..2519a36af60 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -483,6 +483,8 @@ void OptionsDialog::build() {
// Native mt32 setting
_mt32Checkbox->setState(ConfMan.getBool("native_mt32", _domain));
+ if (ConfMan.isKeyTemporary("native_mt32"))
+ _mt32Checkbox->setOverride(true);
// GS extensions setting
_enableGSCheckbox->setState(ConfMan.getBool("enable_gs", _domain));
@@ -918,13 +920,21 @@ void OptionsDialog::apply() {
if (_enableMT32Settings) {
saveMusicDeviceSetting(_mt32DevicePopUp, "mt32_device");
ConfMan.setBool("native_mt32", _mt32Checkbox->getState(), _domain);
- ConfMan.setBool("enable_gs", _enableGSCheckbox->getState(), _domain);
+ if (ConfMan.getBool("native_mt32", _domain) != _mt32Checkbox->getState()) {
+ ConfMan.setBool("native_mt32", _mt32Checkbox->getState(), _domain);
+ _mt32Checkbox->setOverride(false);
+ }
+ if (ConfMan.getBool("enable_gs", _domain) != _enableGSCheckbox->getState()) {
+ ConfMan.setBool("enable_gs", _enableGSCheckbox->getState(), _domain);
+ _enableGSCheckbox->setOverride(false);
+ }
} else {
ConfMan.removeKey("mt32_device", _domain);
ConfMan.removeKey("native_mt32", _domain);
+ _mt32Checkbox->setOverride(false);
ConfMan.removeKey("enable_gs", _domain);
+ _enableGSCheckbox->setOverride(false);
}
- _enableGSCheckbox->setOverride(false);
}
// Subtitle options
Commit: 358bec996700fd53afee0be87e9000b614eedcc7
https://github.com/scummvm/scummvm/commit/358bec996700fd53afee0be87e9000b614eedcc7
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --scaler and --scale-factor
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 3c27fa50a67..f4d89cf023b 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1881,6 +1881,12 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("soundfont")) {
ConfMan.set("soundfont", settings["soundfont"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("scaler")) {
+ ConfMan.set("scaler", settings["scaler"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("scale-factor")) {
+ ConfMan.set("scale_factor", settings["scale-factor"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
Common::String key(x->_key);
diff --git a/gui/options.cpp b/gui/options.cpp
index 2519a36af60..62577a6366d 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -649,19 +649,24 @@ void OptionsDialog::apply() {
const PluginList &scalerPlugins = ScalerMan.getPlugins();
if ((int32)_scalerPopUp->getSelectedTag() >= 0) {
const char *name = scalerPlugins[_scalerPopUp->getSelectedTag()]->get<ScalerPluginObject>().getName();
- if (ConfMan.get("scaler", _domain) != name)
+ if (ConfMan.get("scaler", _domain) != name) {
graphicsModeChanged = true;
- ConfMan.set("scaler", name, _domain);
+ ConfMan.set("scaler", name, _domain);
+ _scalerPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ }
int factor = _scaleFactorPopUp->getSelectedTag();
- if (ConfMan.getInt("scale_factor", _domain) != factor)
+ if (ConfMan.getInt("scale_factor", _domain) != factor) {
+ ConfMan.setInt("scale_factor", factor, _domain);
graphicsModeChanged = true;
- ConfMan.setInt("scale_factor", factor, _domain);
+ _scalerPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ }
isSet = true;
}
if (!isSet) {
ConfMan.removeKey("scaler", _domain);
ConfMan.removeKey("scale_factor", _domain);
+ _scalerPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
uint defaultScaler = g_system->getDefaultScaler();
uint defaultScaleFactor = g_system->getDefaultScaleFactor();
@@ -1875,6 +1880,8 @@ void OptionsDialog::setupGraphicsTab() {
if (g_system->hasFeature(OSystem::kFeatureScalers)) {
_scalerPopUpDesc->setVisible(true);
+ if (ConfMan.isKeyTemporary("scaler") || ConfMan.isKeyTemporary("scale_factor"))
+ _scalerPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_scalerPopUp->setVisible(true);
_scaleFactorPopUp->setVisible(true);
} else {
Commit: 7f1eafcb2fc99c7a0b7ab76f33c035d8d09ace95
https://github.com/scummvm/scummvm/commit/7f1eafcb2fc99c7a0b7ab76f33c035d8d09ace95
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --opl-driver and --talkspeed
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index f4d89cf023b..bdace0022da 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1887,6 +1887,13 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("scale-factor")) {
ConfMan.set("scale_factor", settings["scale-factor"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("opl-driver")) {
+ ConfMan.set("opl_driver", settings["opl-driver"], Common::ConfigManager::kSessionDomain);
+ }
+ if (settings.contains("talkspeed")) {
+ ConfMan.set("talkspeed", settings["talkspeed"], Common::ConfigManager::kSessionDomain);
+ }
+
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
Common::String key(x->_key);
diff --git a/gui/options.cpp b/gui/options.cpp
index 62577a6366d..515e44b08a6 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -878,12 +878,16 @@ void OptionsDialog::apply() {
if (_enableAudioSettings) {
const OPL::Config::EmulatorDescription *ed = OPL::Config::findDriver(_oplPopUp->getSelectedTag());
- if (ed)
- ConfMan.set("opl_driver", ed->name, _domain);
- else
- ConfMan.removeKey("opl_driver", _domain);
+ if ((ed && ConfMan.get("opl_driver", _domain) != ed->name) || !ed) {
+ _oplPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ if (ed)
+ ConfMan.set("opl_driver", ed->name, _domain);
+ else
+ ConfMan.removeKey("opl_driver", _domain);
+ }
} else {
ConfMan.removeKey("opl_driver", _domain);
+ _oplPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
}
}
@@ -972,11 +976,14 @@ void OptionsDialog::apply() {
// Scale the config value accordingly (see addSubtitleControls)
int sliderMaxValue = _subSpeedSlider->getMaxValue();
int talkspeed = (_subSpeedSlider->getValue() * 255 + sliderMaxValue / 2) / sliderMaxValue;
- ConfMan.setInt("talkspeed", talkspeed, _domain);
-
+ if (talkspeed != ConfMan.getInt("talkspeed", _domain)) {
+ ConfMan.setInt("talkspeed", talkspeed, _domain);
+ _subSpeedDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ }
} else {
ConfMan.removeKey("subtitles", _domain);
ConfMan.removeKey("talkspeed", _domain);
+ _subSpeedDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
ConfMan.removeKey("speech_mute", _domain);
}
}
@@ -1576,6 +1583,8 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
// The OPL emulator popup & a label
_oplPopUpDesc = new StaticTextWidget(boss, prefix + "auOPLPopupDesc", _("AdLib emulator:"), _("AdLib is used for music in many games"));
+ if (ConfMan.isKeyTemporary("opl_driver"))
+ _oplPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
_oplPopUp = new PopUpWidget(boss, prefix + "auOPLPopup", _("AdLib is used for music in many games"));
// Populate it
@@ -1710,6 +1719,9 @@ void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &p
_subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", _c("Subtitle speed:", "lowres"));
}
+
+ if (ConfMan.isKeyTemporary("talkspeed"))
+ _subSpeedDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
// Subtitle speed
_subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", Common::U32String(), kSubtitleSpeedChanged);
Commit: d6dbf721b62e773f529276f5b1c0c3ce59df6f47
https://github.com/scummvm/scummvm/commit/d6dbf721b62e773f529276f5b1c0c3ce59df6f47
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --subtitles
Changed paths:
base/commandLine.cpp
gui/options.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index bdace0022da..94b63b8dfa1 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1893,6 +1893,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (settings.contains("talkspeed")) {
ConfMan.set("talkspeed", settings["talkspeed"], Common::ConfigManager::kSessionDomain);
}
+ if (settings.contains("subtitles")) {
+ ConfMan.set("subtitles", settings["subtitles"], Common::ConfigManager::kSessionDomain);
+ }
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/gui/options.cpp b/gui/options.cpp
index 515e44b08a6..95d5b19a4d6 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -886,8 +886,8 @@ void OptionsDialog::apply() {
ConfMan.removeKey("opl_driver", _domain);
}
} else {
- ConfMan.removeKey("opl_driver", _domain);
_oplPopUpDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ ConfMan.removeKey("opl_driver", _domain);
}
}
@@ -965,10 +965,14 @@ void OptionsDialog::apply() {
break;
}
- ConfMan.setBool("subtitles", subtitles, _domain);
+ if (subtitles != ConfMan.getBool("subtitles")) {
+ ConfMan.setBool("subtitles", subtitles, _domain);
+ _subToggleDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
+ }
ConfMan.setBool("speech_mute", speech_mute, _domain);
} else if (!_domain.empty()) {
ConfMan.removeKey("subtitles", _domain);
+ _subToggleDesc->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
ConfMan.removeKey("speech_mute", _domain);
}
@@ -1722,6 +1726,8 @@ void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &p
if (ConfMan.isKeyTemporary("talkspeed"))
_subSpeedDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
+ if (ConfMan.isKeyTemporary("subtitles"))
+ _subToggleDesc->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
// Subtitle speed
_subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", Common::U32String(), kSubtitleSpeedChanged);
Commit: 7b53202a9edf345548b42807b6abf8acf816672d
https://github.com/scummvm/scummvm/commit/7b53202a9edf345548b42807b6abf8acf816672d
Author: grisenti (emanuele at grisenti.net)
Date: 2022-05-29T13:56:21+02:00
Commit Message:
ALL: add support for --config and refactor code
Changed paths:
base/commandLine.cpp
base/main.cpp
gui/ThemeEngine.cpp
gui/options.cpp
gui/widget.cpp
gui/widget.h
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 94b63b8dfa1..53ff2398291 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1668,6 +1668,10 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
#endif // DISABLE_COMMAND_LINE
+void storeSessionSetting(const Common::String &command, const Common::String &settingName, const Common::StringMap &settings) {
+ if (settings.contains(command))
+ ConfMan.set(settingName, settings[command], Common::ConfigManager::kSessionDomain);
+}
bool processSettings(Common::String &command, Common::StringMap &settings, Common::Error &err) {
err = Common::kNoError;
@@ -1830,72 +1834,29 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
}
// store all session related settings
- if (settings.contains("savepath")) {
- ConfMan.set("savepath", settings["savepath"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("themepath")) {
- ConfMan.set("themepath", settings["themepath"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("extrapath")) {
- ConfMan.set("extrapath", settings["extrapath"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("gui-theme")) {
- ConfMan.set("gui_theme", settings["gui-theme"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("gfx-mode")) {
- ConfMan.set("gfx_mode", settings["gfx-mode"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("stretch-mode")) {
- ConfMan.set("stretch_mode", settings["stretch-mode"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("render-mode")) {
- ConfMan.set("render_mode", settings["render-mode"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("music-volume")) {
- ConfMan.set("music_volume", settings["music-volume"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("sfx-volume")) {
- ConfMan.set("sfx_volume", settings["sfx-volume"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("speech-volume")) {
- ConfMan.set("speech_volume", settings["speech-volume"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("fullscreen")) {
- ConfMan.set("fullscreen", settings["fullscreen"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("enable-gs")) {
- ConfMan.set("enable_gs", settings["enable-gs"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("native-mt32")) {
- ConfMan.set("native_mt32", settings["native-mt32"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("filtering")) {
- ConfMan.set("filtering", settings["filtering"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("multi-midi")) {
- ConfMan.set("multi_midi", settings["multi-midi"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("midi-gain")) {
- ConfMan.set("midi_gain", settings["midi-gain"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("soundfont")) {
- ConfMan.set("soundfont", settings["soundfont"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("scaler")) {
- ConfMan.set("scaler", settings["scaler"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("scale-factor")) {
- ConfMan.set("scale_factor", settings["scale-factor"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("opl-driver")) {
- ConfMan.set("opl_driver", settings["opl-driver"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("talkspeed")) {
- ConfMan.set("talkspeed", settings["talkspeed"], Common::ConfigManager::kSessionDomain);
- }
- if (settings.contains("subtitles")) {
- ConfMan.set("subtitles", settings["subtitles"], Common::ConfigManager::kSessionDomain);
- }
+ storeSessionSetting("config", "config", settings);
+ storeSessionSetting("fullscreen", "fullscreen", settings);
+ storeSessionSetting("gfx-mode", "gfx_mode", settings);
+ storeSessionSetting("stretch-mode", "stretch_mode", settings);
+ storeSessionSetting("scaler", "scaler", settings);
+ storeSessionSetting("scale-factor", "scale_factor", settings);
+ storeSessionSetting("filtering", "filtering", settings);
+ storeSessionSetting("gui-theme", "gui_theme", settings);
+ storeSessionSetting("themepath", "themepath", settings);
+ storeSessionSetting("music-volume", "music_volume", settings);
+ storeSessionSetting("sfx-volume", "sfx_volume", settings);
+ storeSessionSetting("speech-volume", "speech_volume", settings);
+ storeSessionSetting("midi-gain", "midi_gain", settings);
+ storeSessionSetting("subtitles", "subtitles", settings);
+ storeSessionSetting("savepath", "savepath", settings);
+ storeSessionSetting("extrapath", "extrapath", settings);
+ storeSessionSetting("soundfont", "soundfont", settings);
+ storeSessionSetting("multi-midi", "multi_midi", settings);
+ storeSessionSetting("native-mt32", "native-mt32", settings);
+ storeSessionSetting("enable-gs", "enable_gs", settings);
+ storeSessionSetting("opl-driver", "opl_driver", settings);
+ storeSessionSetting("talkspeed", "talkspeed", settings);
+ storeSessionSetting("render-mode", "render_mode", settings);
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
diff --git a/base/main.cpp b/base/main.cpp
index 3c05edf9afe..c9e464f4c7b 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -416,7 +416,6 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
// Load the config file (possibly overridden via command line):
if (settings.contains("config")) {
ConfMan.loadConfigFile(settings["config"]);
- settings.erase("config");
} else {
ConfMan.loadDefaultConfigFile();
}
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 0de5f662af6..9eda4286ff3 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1058,7 +1058,7 @@ void ThemeEngine::drawLineSeparator(const Common::Rect &r) {
}
void ThemeEngine::drawCheckbox(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked,
- WidgetStateInfo state, bool override, bool rtl) {
+ WidgetStateInfo state, bool overrideText, bool rtl) {
if (!ready())
return;
@@ -1088,7 +1088,7 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, int spacing, const Common:
}
if (r2.right > r2.left) {
- TextColor color = override ? GUI::TextColor::kTextColorOverride : getTextColor(dd);
+ TextColor color = overrideText ? GUI::TextColor::kTextColorOverride : getTextColor(dd);
drawDDText(getTextData(dd), color, r2, str, true, false, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
_widgets[dd]->_textAlignV);
}
@@ -1359,69 +1359,72 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::U32String &str,
case kFontColorNormal:
if (inverted) {
colorId = kTextColorNormalInverted;
- } else {
- switch (state) {
- case kStateDisabled:
- colorId = kTextColorNormalDisabled;
- break;
+ break;
+ }
- case kStateHighlight:
- colorId = kTextColorNormalHover;
- break;
+ switch (state) {
+ case kStateDisabled:
+ colorId = kTextColorNormalDisabled;
+ break;
- default:
- // fallthrough intended
- case kStateEnabled:
- case kStatePressed:
- colorId = kTextColorNormal;
- break;
- }
+ case kStateHighlight:
+ colorId = kTextColorNormalHover;
+ break;
+
+ default:
+ // fallthrough intended
+ case kStateEnabled:
+ case kStatePressed:
+ colorId = kTextColorNormal;
+ break;
}
break;
case kFontColorAlternate:
if (inverted) {
colorId = kTextColorAlternativeInverted;
- } else {
- switch (state) {
- case kStateDisabled:
- colorId = kTextColorAlternativeDisabled;
- break;
+ break;
+ }
- case kStateHighlight:
- colorId = kTextColorAlternativeHover;
- break;
+ switch (state) {
+ case kStateDisabled:
+ colorId = kTextColorAlternativeDisabled;
+ break;
- default:
- // fallthrough intended
- case kStateEnabled:
- case kStatePressed:
- colorId = kTextColorAlternative;
- break;
- }
+ case kStateHighlight:
+ colorId = kTextColorAlternativeHover;
+ break;
+
+ default:
+ // fallthrough intended
+ case kStateEnabled:
+ case kStatePressed:
+ colorId = kTextColorAlternative;
+ break;
}
break;
case kFontColorOverride:
if (inverted) {
colorId = kTextColorOverrideInverted;
- } else {
- switch (state) {
- case kStateDisabled:
- colorId = kTextColorAlternativeDisabled;
- break;
+ break;
+ }
+
+ switch (state) {
+ case kStateDisabled:
+ colorId = kTextColorAlternativeDisabled;
+ break;
- case kStateHighlight:
- colorId = kTextColorOverrideHover;
- break;
+ case kStateHighlight:
+ colorId = kTextColorOverrideHover;
+ break;
- default:
- // fallthrough intended
- case kStateEnabled:
- case kStatePressed:
- colorId = kTextColorOverride;
- break;
- }
+ default:
+ // fallthrough intended
+ case kStateEnabled:
+ case kStatePressed:
+ colorId = kTextColorOverride;
+ break;
}
break;
diff --git a/gui/options.cpp b/gui/options.cpp
index 95d5b19a4d6..efda91c2681 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2202,7 +2202,7 @@ void GlobalOptionsDialog::build() {
#if !defined(__DC__)
const auto setPath =
- [&](GUI::StaticTextWidget *const widget, const Common::String& pathType, const Common::U32String &defaultLabel) {
+ [&](GUI::StaticTextWidget *const widget, const Common::String &pathType, const Common::U32String &defaultLabel) {
Common::String path(ConfMan.get(pathType));
if (ConfMan.isKeyTemporary(pathType)) {
widget->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
@@ -2330,7 +2330,10 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
Common::U32String confPath = ConfMan.getCustomConfigFileName();
if (confPath.empty())
confPath = g_system->getDefaultConfigFileName();
- new StaticTextWidget(boss, prefix + "ConfigPath", _("ScummVM config path: ") + confPath, confPath);
+ StaticTextWidget* configPathWidget = new StaticTextWidget(boss, prefix + "ConfigPath", _("ScummVM config path: ") + confPath, confPath);
+ if (ConfMan.isKeyTemporary("config"))
+ configPathWidget->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
+
Common::U32String browserPath = _("<default>");
if (ConfMan.hasKey("browser_lastpath"))
@@ -2693,7 +2696,7 @@ void GlobalOptionsDialog::apply() {
bool isRebuildNeeded = false;
const auto changePath =
- [&](GUI::StaticTextWidget *const widget, const Common::String& pathType, const Common::U32String &defaultLabel){
+ [&](GUI::StaticTextWidget *const widget, const Common::String &pathType, const Common::U32String &defaultLabel) {
Common::U32String label(widget->getLabel());
if (label != ConfMan.get(pathType)) {
widget->setFontColor(ThemeEngine::FontColor::kFontColorNormal);
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 73ef4df3a26..d7ac4fdacb3 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -707,14 +707,14 @@ void PicButtonWidget::drawWidget() {
#pragma mark -
CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
- : ButtonWidget(boss, x, y, w, h, label, tooltip, cmd, hotkey), _state(false), _override(false) {
+ : ButtonWidget(boss, x, y, w, h, label, tooltip, cmd, hotkey), _state(false), _overrideText(false) {
setFlags(WIDGET_ENABLED);
_type = kCheckboxWidget;
_spacing = g_gui.xmlEval()->getVar("Globals.Checkbox.Spacing", 15);
}
CheckboxWidget::CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
- : ButtonWidget(boss, name, label, tooltip, cmd, hotkey), _state(false), _override(false) {
+ : ButtonWidget(boss, name, label, tooltip, cmd, hotkey), _state(false), _overrideText(false) {
setFlags(WIDGET_ENABLED);
_type = kCheckboxWidget;
_spacing = g_gui.xmlEval()->getVar("Globals.Checkbox.Spacing", 15);
@@ -737,12 +737,12 @@ void CheckboxWidget::setState(bool state) {
sendCommand(_cmd, _state);
}
-void CheckboxWidget::setOverride(bool override) {
- _override = override;
+void CheckboxWidget::setOverride(bool enable) {
+ _overrideText = enable;
}
void CheckboxWidget::drawWidget() {
- g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _spacing, getLabel(), _state, Widget::_state, _override, (g_gui.useRTL() && _useRTL));
+ g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _spacing, getLabel(), _state, Widget::_state, _overrideText, (g_gui.useRTL() && _useRTL));
}
#pragma mark -
diff --git a/gui/widget.h b/gui/widget.h
index 1147bfc7420..c6f2ccd4d94 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -321,7 +321,7 @@ protected:
class CheckboxWidget : public ButtonWidget {
protected:
bool _state;
- bool _override;
+ bool _overrideText;
int _spacing;
public:
CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
@@ -335,7 +335,7 @@ public:
void toggleState() { setState(!_state); }
bool getState() const { return _state; }
- void setOverride(bool override);
+ void setOverride(bool enable);
protected:
void drawWidget() override;
More information about the Scummvm-git-logs
mailing list