mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-01 15:55:45 +00:00
GUI: Implemented Languages as GUI options.
SCUMM and AdvancedDetector support this feature. svn-id: r49786
This commit is contained in:
parent
8dcc49251f
commit
01bc5dda94
@ -322,9 +322,26 @@ bool checkGameGUIOption(GameGUIOption option, const String &str) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool checkGameGUIOptionLanguage(Language lang, const String &str) {
|
||||
if (!str.contains("lang_")) // If no languages are specified
|
||||
return true;
|
||||
|
||||
if (str.contains(getGameGUIOptionsDescriptionLanguage(lang)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const String getGameGUIOptionsDescriptionLanguage(Language lang) {
|
||||
if (lang == UNK_LANG)
|
||||
return "";
|
||||
|
||||
return String(String("lang_") + getLanguageDescription(lang));
|
||||
}
|
||||
|
||||
uint32 parseGameGUIOptions(const String &str) {
|
||||
uint32 res = 0;
|
||||
|
||||
|
||||
for (int i = 0; g_gameOptions[i].desc; i++)
|
||||
if (str.contains(g_gameOptions[i].desc))
|
||||
res |= g_gameOptions[i].option;
|
||||
@ -332,7 +349,7 @@ uint32 parseGameGUIOptions(const String &str) {
|
||||
return res;
|
||||
}
|
||||
|
||||
String getGameGUIOptionsDescription(uint32 options) {
|
||||
const String getGameGUIOptionsDescription(uint32 options) {
|
||||
String res = "";
|
||||
|
||||
for (int i = 0; g_gameOptions[i].desc; i++)
|
||||
|
@ -228,8 +228,10 @@ enum GameGUIOption {
|
||||
};
|
||||
|
||||
bool checkGameGUIOption(GameGUIOption option, const String &str);
|
||||
bool checkGameGUIOptionLanguage(Language lang, const String &str);
|
||||
uint32 parseGameGUIOptions(const String &str);
|
||||
String getGameGUIOptionsDescription(uint32 options);
|
||||
const String getGameGUIOptionsDescription(uint32 options);
|
||||
const String getGameGUIOptionsDescriptionLanguage(Language lang);
|
||||
|
||||
/**
|
||||
* Updates the GUI options of the current config manager
|
||||
|
@ -208,6 +208,7 @@ static void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *
|
||||
desc["extra"] = realDesc->extra;
|
||||
|
||||
desc.setGUIOptions(realDesc->guioptions | params.guioptions);
|
||||
desc.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(realDesc->language));
|
||||
}
|
||||
|
||||
GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||
|
@ -73,6 +73,10 @@ void GameDescriptor::setGUIOptions(uint32 guioptions) {
|
||||
erase("guioptions");
|
||||
}
|
||||
|
||||
void GameDescriptor::appendGUIOptions(const Common::String &str) {
|
||||
setVal("guioptions", getVal("guioptions", "") + " " + str);
|
||||
}
|
||||
|
||||
void GameDescriptor::updateDesc(const char *extra) {
|
||||
// TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone.
|
||||
// We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
void updateDesc(const char *extra = 0);
|
||||
|
||||
void setGUIOptions(uint32 options);
|
||||
void appendGUIOptions(const Common::String &str);
|
||||
|
||||
Common::String &gameid() { return getVal("gameid"); }
|
||||
Common::String &description() { return getVal("description"); }
|
||||
|
@ -884,6 +884,7 @@ GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||
}
|
||||
|
||||
dg.setGUIOptions(x->game.guioptions | MidiDriver::midiDriverFlags2GUIO(x->game.midi));
|
||||
dg.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
|
||||
|
||||
detectedGames.push_back(dg);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -156,6 +156,7 @@ protected:
|
||||
// Game GUI options
|
||||
//
|
||||
uint32 _guioptions;
|
||||
Common::String _guioptionsString;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user