Fix skin and locale at first run, adding new locale to combobox, exit function double call, enable sound option

This commit is contained in:
Henrique 2012-06-20 03:31:52 -03:00
parent eb457bf9cd
commit db4ced65eb
5 changed files with 19 additions and 10 deletions

View File

@ -45,8 +45,8 @@ function Locales.init()
Locales.installLocales('locales') Locales.installLocales('locales')
local userLocaleName = Settings.get('locale') local userLocaleName = Settings.get('locale', 'false')
if userLocaleName and Locales.setLocale(userLocaleName) then if userLocaleName ~= 'false' and Locales.setLocale(userLocaleName) then
pdebug('Using configured locale: ' .. userLocaleName) pdebug('Using configured locale: ' .. userLocaleName)
else else
pdebug('Using default locale: ' .. defaultLocaleName) pdebug('Using default locale: ' .. defaultLocaleName)
@ -82,14 +82,16 @@ function Locales.installLocale(locale)
local installedLocale = installedLocales[locale.name] local installedLocale = installedLocales[locale.name]
if installedLocale then if installedLocale then
-- combine translations replacing with new if already exists
for word,translation in pairs(locale.translation) do for word,translation in pairs(locale.translation) do
installedLocale.translation[word] = translation installedLocale.translation[word] = translation
end end
else else
installedLocales[locale.name] = locale installedLocales[locale.name] = locale
if localeComboBox then
-- update combobox localeComboBox.onOptionChange = nil
localeComboBox:addOption(locale.languageName, locale.name)
localeComboBox.onOptionChange = onLocaleComboBoxOptionChange
end
end end
end end

View File

@ -30,3 +30,7 @@ Panel
OptionCheckBox OptionCheckBox
id: showPrivateMessagesOnScreen id: showPrivateMessagesOnScreen
!text: tr('Show private messages on screen') !text: tr('Show private messages on screen')
OptionCheckBox
id: enableMusic
!text: tr('Enable music')

View File

@ -13,7 +13,8 @@ local options = { vsync = false,
showTimestampsInConsole = true, showTimestampsInConsole = true,
showLevelsInConsole = true, showLevelsInConsole = true,
showPrivateMessagesInConsole = false, showPrivateMessagesInConsole = false,
showPrivateMessagesOnScreen = true } showPrivateMessagesOnScreen = true,
enableMusic = true }
local generalPanel local generalPanel
local graphicsPanel local graphicsPanel
@ -124,6 +125,10 @@ function Options.setOption(key, value)
addEvent(function() addEvent(function()
g_window.setFullscreen(value) g_window.setFullscreen(value)
end) end)
elseif key == 'enableMusic' then
addEvent(function()
g_sounds.enableMusic(value)
end)
end end
Settings.set(key, value) Settings.set(key, value)
options[key] = value options[key] = value
@ -132,4 +137,3 @@ end
function Options.getOption(key) function Options.getOption(key)
return options[key] return options[key]
end end

View File

@ -29,8 +29,8 @@ function Skins.init()
g_resources.addToSearchPath(getSkinPath(defaultSkinName), 0) g_resources.addToSearchPath(getSkinPath(defaultSkinName), 0)
end end
local userSkinName = Settings.get('skin') local userSkinName = Settings.get('skin', 'false')
if userSkinName and Skins.setSkin(userSkinName) then if userSkinName ~= 'false' and Skins.setSkin(userSkinName) then
pdebug('Using configured skin: ' .. userSkinName) pdebug('Using configured skin: ' .. userSkinName)
else else
pdebug('Using default skin: ' .. defaultSkinName) pdebug('Using default skin: ' .. defaultSkinName)

View File

@ -480,7 +480,6 @@ void Application::registerLuaFunctions()
// Application // Application
g_lua.registerSingletonClass("g_app"); 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", "setForegroundPaneMaxFps", &Application::setForegroundPaneMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "setBackgroundPaneMaxFps", &Application::setBackgroundPaneMaxFps, &g_app); g_lua.bindSingletonFunction("g_app", "setBackgroundPaneMaxFps", &Application::setBackgroundPaneMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "setName", &Application::setName, &g_app); g_lua.bindSingletonFunction("g_app", "setName", &Application::setName, &g_app);