Fix skin and locale at first run, adding new locale to combobox, exit function double call, enable sound option
This commit is contained in:
parent
eb457bf9cd
commit
db4ced65eb
|
@ -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
|
||||
|
||||
|
|
|
@ -30,3 +30,7 @@ Panel
|
|||
OptionCheckBox
|
||||
id: showPrivateMessagesOnScreen
|
||||
!text: tr('Show private messages on screen')
|
||||
|
||||
OptionCheckBox
|
||||
id: enableMusic
|
||||
!text: tr('Enable music')
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue