aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2010-06-15 10:57:28 +0000
committerEugene Sandulenko2010-06-15 10:57:28 +0000
commit01bc5dda944f121187a4499f03d3a3814741f093 (patch)
tree1d08ad7b5f2e6c7c9209c5d6b3f2e80307969d35 /gui
parent8dcc49251f08492968ddfcbb825bfe0a17d0747b (diff)
downloadscummvm-rg350-01bc5dda944f121187a4499f03d3a3814741f093.tar.gz
scummvm-rg350-01bc5dda944f121187a4499f03d3a3814741f093.tar.bz2
scummvm-rg350-01bc5dda944f121187a4499f03d3a3814741f093.zip
GUI: Implemented Languages as GUI options.
SCUMM and AdvancedDetector support this feature. svn-id: r49786
Diffstat (limited to 'gui')
-rw-r--r--gui/PopUpWidget.h1
-rw-r--r--gui/launcher.cpp20
-rw-r--r--gui/options.cpp12
-rw-r--r--gui/options.h1
4 files changed, 20 insertions, 14 deletions
diff --git a/gui/PopUpWidget.h b/gui/PopUpWidget.h
index d1c89e45ae..f2c1728b52 100644
--- a/gui/PopUpWidget.h
+++ b/gui/PopUpWidget.h
@@ -66,6 +66,7 @@ public:
void appendEntry(const String &entry, uint32 tag = (uint32)-1);
void clearEntries();
+ int numEntries() { return _entries.size(); }
/** Select the entry at the given index. */
void setSelected(int item);
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 176fb45214..1daf9ffd50 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -180,11 +180,12 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
// Language popup
_langPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.LangPopupDesc", _("Language:"), _("Language of the game. This will not turn your Spanish game version into English"));
_langPopUp = new PopUpWidget(tab, "GameOptions_Game.LangPopup", _("Language of the game. This will not turn your Spanish game version into English"));
- _langPopUp->appendEntry(_("<default>"));
- _langPopUp->appendEntry("");
+ _langPopUp->appendEntry(_("<default>"), 0);
+ _langPopUp->appendEntry("", 0);
const Common::LanguageDescription *l = Common::g_languages;
for (; l->code; ++l) {
- _langPopUp->appendEntry(l->description, l->id);
+ if (checkGameGUIOptionLanguage(l->id, _guioptionsString))
+ _langPopUp->appendEntry(l->description, l->id);
}
// Platform popup
@@ -311,17 +312,16 @@ void EditGameDialog::open() {
// TODO: game path
- const Common::LanguageDescription *l = Common::g_languages;
const Common::Language lang = Common::parseLanguage(ConfMan.get("language", _domain));
- sel = 0;
if (ConfMan.hasKey("language", _domain)) {
- for (i = 0; l->code; ++l, ++i) {
- if (lang == l->id)
- sel = i + 2;
- }
+ _langPopUp->setSelectedTag(lang);
+ }
+
+ if (_langPopUp->numEntries() <= 3) { // If only one language is avaliable
+ _langPopUpDesc->setEnabled(false);
+ _langPopUp->setEnabled(false);
}
- _langPopUp->setSelected(sel);
const Common::PlatformDescription *p = Common::g_platforms;
diff --git a/gui/options.cpp b/gui/options.cpp
index b00886b40e..bee06a4dce 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -126,8 +126,10 @@ void OptionsDialog::init() {
// Retrieve game GUI options
_guioptions = 0;
- if (ConfMan.hasKey("guioptions", _domain))
- _guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain));
+ if (ConfMan.hasKey("guioptions", _domain)) {
+ _guioptionsString = ConfMan.get("guioptions", _domain);
+ _guioptions = parseGameGUIOptions(_guioptionsString);
+ }
}
void OptionsDialog::open() {
@@ -138,8 +140,10 @@ void OptionsDialog::open() {
// Retrieve game GUI options
_guioptions = 0;
- if (ConfMan.hasKey("guioptions", _domain))
- _guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain));
+ if (ConfMan.hasKey("guioptions", _domain)) {
+ _guioptionsString = ConfMan.get("guioptions", _domain);
+ _guioptions = parseGameGUIOptions(_guioptionsString);
+ }
// Graphic options
if (_fullscreenCheckbox) {
diff --git a/gui/options.h b/gui/options.h
index 48282a7fd7..fab25ebaed 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -156,6 +156,7 @@ protected:
// Game GUI options
//
uint32 _guioptions;
+ Common::String _guioptionsString;
};