From db4ced65eb34c10897f715a8eaca6e6738282f9d Mon Sep 17 00:00:00 2001 From: Henrique Date: Wed, 20 Jun 2012 03:31:52 -0300 Subject: [PATCH] Fix skin and locale at first run, adding new locale to combobox, exit function double call, enable sound option --- modules/client_locales/locales.lua | 12 +++++++----- modules/client_options/general.otui | 4 ++++ modules/client_options/options.lua | 8 ++++++-- modules/client_skins/skins.lua | 4 ++-- src/framework/luafunctions.cpp | 1 - 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/client_locales/locales.lua b/modules/client_locales/locales.lua index 1e1982b9..d7370609 100644 --- a/modules/client_locales/locales.lua +++ b/modules/client_locales/locales.lua @@ -45,8 +45,8 @@ function Locales.init() Locales.installLocales('locales') - local userLocaleName = Settings.get('locale') - if userLocaleName and Locales.setLocale(userLocaleName) then + local userLocaleName = Settings.get('locale', 'false') + if userLocaleName ~= 'false' and Locales.setLocale(userLocaleName) then pdebug('Using configured locale: ' .. userLocaleName) else pdebug('Using default locale: ' .. defaultLocaleName) @@ -82,14 +82,16 @@ function Locales.installLocale(locale) local installedLocale = installedLocales[locale.name] if installedLocale then - -- combine translations replacing with new if already exists for word,translation in pairs(locale.translation) do installedLocale.translation[word] = translation end else installedLocales[locale.name] = locale - - -- update combobox + if localeComboBox then + localeComboBox.onOptionChange = nil + localeComboBox:addOption(locale.languageName, locale.name) + localeComboBox.onOptionChange = onLocaleComboBoxOptionChange + end end end diff --git a/modules/client_options/general.otui b/modules/client_options/general.otui index 910c4b1d..e026986b 100644 --- a/modules/client_options/general.otui +++ b/modules/client_options/general.otui @@ -30,3 +30,7 @@ Panel OptionCheckBox id: showPrivateMessagesOnScreen !text: tr('Show private messages on screen') + + OptionCheckBox + id: enableMusic + !text: tr('Enable music') diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index de95e779..47818ece 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -13,7 +13,8 @@ local options = { vsync = false, showTimestampsInConsole = true, showLevelsInConsole = true, showPrivateMessagesInConsole = false, - showPrivateMessagesOnScreen = true } + showPrivateMessagesOnScreen = true, + enableMusic = true } local generalPanel local graphicsPanel @@ -124,6 +125,10 @@ function Options.setOption(key, value) addEvent(function() g_window.setFullscreen(value) end) + elseif key == 'enableMusic' then + addEvent(function() + g_sounds.enableMusic(value) + end) end Settings.set(key, value) options[key] = value @@ -132,4 +137,3 @@ end function Options.getOption(key) return options[key] end - diff --git a/modules/client_skins/skins.lua b/modules/client_skins/skins.lua index 9e37ea8f..07bb6b60 100644 --- a/modules/client_skins/skins.lua +++ b/modules/client_skins/skins.lua @@ -29,8 +29,8 @@ function Skins.init() g_resources.addToSearchPath(getSkinPath(defaultSkinName), 0) end - local userSkinName = Settings.get('skin') - if userSkinName and Skins.setSkin(userSkinName) then + local userSkinName = Settings.get('skin', 'false') + if userSkinName ~= 'false' and Skins.setSkin(userSkinName) then pdebug('Using configured skin: ' .. userSkinName) else pdebug('Using default skin: ' .. defaultSkinName) diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index 847990dc..9633d8c3 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -480,7 +480,6 @@ void Application::registerLuaFunctions() // Application g_lua.registerSingletonClass("g_app"); - g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, &g_app); g_lua.bindSingletonFunction("g_app", "setForegroundPaneMaxFps", &Application::setForegroundPaneMaxFps, &g_app); g_lua.bindSingletonFunction("g_app", "setBackgroundPaneMaxFps", &Application::setBackgroundPaneMaxFps, &g_app); g_lua.bindSingletonFunction("g_app", "setName", &Application::setName, &g_app);