diff --git a/modules/client/client.lua b/modules/client/client.lua index eb7a81af..b3632c3f 100644 --- a/modules/client/client.lua +++ b/modules/client/client.lua @@ -65,20 +65,20 @@ function init() else -- window size local size = { width = 800, height = 600 } - size = g_settings.getSize('window-size', size) + size = g_settings:getSize('window-size', size) g_window.resize(size) -- window position, default is the screen center local displaySize = g_window.getDisplaySize() local defaultPos = { x = (displaySize.width - size.width)/2, y = (displaySize.height - size.height)/2 } - local pos = g_settings.getPoint('window-pos', defaultPos) + local pos = g_settings:getPoint('window-pos', defaultPos) pos.x = math.max(pos.x, 0) pos.y = math.max(pos.y, 0) g_window.move(pos) -- window maximized? - local maximized = g_settings.getBoolean('window-maximized', false) + local maximized = g_settings:getBoolean('window-maximized', false) if maximized then g_window.maximize() end end @@ -91,9 +91,9 @@ function init() g_keyboard.bindKeyDown('Ctrl+Shift+R', reloadScripts) -- generate machine uuid, this is a security measure for storing passwords - if not g_crypt.setMachineUUID(g_settings.get('uuid')) then - g_settings.set('uuid', g_crypt.getMachineUUID()) - g_settings.save() + if not g_crypt.setMachineUUID(g_settings:get('uuid')) then + g_settings:set('uuid', g_crypt.getMachineUUID()) + g_settings:save() end end @@ -101,9 +101,9 @@ function terminate() disconnect(g_app, { onRun = startup, onExit = exit }) -- save window configs - g_settings.set('window-size', g_window.getUnmaximizedSize()) - g_settings.set('window-pos', g_window.getUnmaximizedPos()) - g_settings.set('window-maximized', g_window.isMaximized()) + g_settings:set('window-size', g_window.getUnmaximizedSize()) + g_settings:set('window-pos', g_window.getUnmaximizedPos()) + g_settings:set('window-maximized', g_window.isMaximized()) end function exit() diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index 79648077..a72e7dc7 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -37,8 +37,8 @@ local function tryLogin(charInfo, tries) end }) -- save last used character - g_settings.set('last-used-character', charInfo.characterName) - g_settings.set('last-used-world', charInfo.worldName) + g_settings:set('last-used-character', charInfo.characterName) + g_settings:set('last-used-world', charInfo.worldName) end local function updateWait(timeStart, timeEnd) @@ -225,7 +225,7 @@ function CharacterList.create(characters, account, otui) connect(widget, { onDoubleClick = function () CharacterList.doLogin() return true end } ) - if i == 1 or (g_settings.get('last-used-character') == widget.characterName and g_settings.get('last-used-world') == widget.worldName) then + if i == 1 or (g_settings:get('last-used-character') == widget.characterName and g_settings:get('last-used-world') == widget.worldName) then focusLabel = widget end end diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index 9015f198..b83e9224 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -41,13 +41,13 @@ local function onCharacterList(protocol, characters, account, otui) local account = g_crypt.encrypt(G.account) local password = g_crypt.encrypt(G.password) - g_settings.set('account', account) - g_settings.set('password', password) + g_settings:set('account', account) + g_settings:set('password', password) ServerList.setServerAccount(G.host, account) ServerList.setServerPassword(G.host, password) - g_settings.set('autologin', enterGame:getChildById('autoLoginBox'):isChecked()) + g_settings:set('autologin', enterGame:getChildById('autoLoginBox'):isChecked()) else -- reset server list account/password ServerList.setServerAccount(G.host, '') @@ -63,9 +63,9 @@ local function onCharacterList(protocol, characters, account, otui) CharacterList.show() if motdEnabled then - local lastMotdNumber = g_settings.getNumber("motd") + local lastMotdNumber = g_settings:getNumber("motd") if G.motdNumber and G.motdNumber ~= lastMotdNumber then - g_settings.set("motd", motdNumber) + g_settings:set("motd", motdNumber) motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) connect(motdWindow, { onOk = function() CharacterList.show() motdWindow = nil end }) CharacterList.hide() @@ -99,12 +99,12 @@ function EnterGame.init() motdButton:show() end - local account = g_settings.get('account') - local password = g_settings.get('password') - local host = g_settings.get('host') - local port = g_settings.get('port') - local autologin = g_settings.getBoolean('autologin') - local clientVersion = g_settings.getInteger('client-version') + local account = g_settings:get('account') + local password = g_settings:get('password') + local host = g_settings:get('host') + local port = g_settings:get('port') + local autologin = g_settings:getBoolean('autologin') + local clientVersion = g_settings:getInteger('client-version') if clientVersion == 0 then clientVersion = 860 end if port == nil or port == 0 then port = 7171 end @@ -132,13 +132,13 @@ end function EnterGame.firstShow() EnterGame.show() - local account = g_crypt.decrypt(g_settings.get('account')) - local password = g_crypt.decrypt(g_settings.get('password')) - local host = g_settings.get('host') - local autologin = g_settings.getBoolean('autologin') + local account = g_crypt.decrypt(g_settings:get('account')) + local password = g_crypt.decrypt(g_settings:get('password')) + local host = g_settings:get('host') + local autologin = g_settings:getBoolean('autologin') if #host > 0 and #password > 0 and #account > 0 and autologin then addEvent(function() - if not g_settings.getBoolean('autologin') then return end + if not g_settings:getBoolean('autologin') then return end EnterGame.doLogin() end) end @@ -205,8 +205,8 @@ function EnterGame.clearAccountFields() enterGame:getChildById('accountNameTextEdit'):clearText() enterGame:getChildById('accountPasswordTextEdit'):clearText() enterGame:getChildById('accountNameTextEdit'):focus() - g_settings.remove('account') - g_settings.remove('password') + g_settings:remove('account') + g_settings:remove('password') end function EnterGame.doLogin() @@ -223,9 +223,9 @@ function EnterGame.doLogin() return end - g_settings.set('host', G.host) - g_settings.set('port', G.port) - g_settings.set('client-version', clientVersion) + g_settings:set('host', G.host) + g_settings:set('port', G.port) + g_settings:set('client-version', clientVersion) protocolLogin = ProtocolLogin.create() protocolLogin.onLoginError = onError diff --git a/modules/client_locales/locales.lua b/modules/client_locales/locales.lua index ecf69966..f3623e80 100644 --- a/modules/client_locales/locales.lua +++ b/modules/client_locales/locales.lua @@ -64,7 +64,7 @@ function init() installLocales('/locales') - local userLocaleName = g_settings.get('locale', 'false') + local userLocaleName = g_settings:get('locale', 'false') if userLocaleName ~= 'false' and setLocale(userLocaleName) then pdebug('Using configured locale: ' .. userLocaleName) else @@ -150,7 +150,7 @@ function setLocale(name) sendLocale(locale.name) end currentLocale = locale - g_settings.set('locale', name) + g_settings:set('locale', name) if onLocaleChanged then onLocaleChanged(name) end return true end diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index 9ca73fa2..4ad1a1ad 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -84,7 +84,7 @@ end function init() for k,v in pairs(defaultOptions) do - g_settings.setDefault(k, v) + g_settings:setDefault(k, v) options[k] = v end @@ -129,9 +129,9 @@ function setup() -- load options for k,v in pairs(defaultOptions) do if type(v) == 'boolean' then - setOption(k, g_settings.getBoolean(k), true) + setOption(k, g_settings:getBoolean(k), true) elseif type(v) == 'number' then - setOption(k, g_settings.getNumber(k), true) + setOption(k, g_settings:getNumber(k), true) end end end @@ -243,7 +243,7 @@ function setOption(key, value, force) end end - g_settings.set(key, value) + g_settings:set(key, value) options[key] = value end diff --git a/modules/client_serverlist/serverlist.lua b/modules/client_serverlist/serverlist.lua index 2f084548..7d98ea69 100644 --- a/modules/client_serverlist/serverlist.lua +++ b/modules/client_serverlist/serverlist.lua @@ -11,14 +11,14 @@ function ServerList.init() serverListWindow = g_ui.displayUI('serverlist') serverTextList = serverListWindow:getChildById('serverList') - servers = g_settings.getNode('ServerList') or {} + servers = g_settings:getNode('ServerList') or {} ServerList.load() end function ServerList.terminate() ServerList.destroy() - g_settings.setNode('ServerList', servers) + g_settings:setNode('ServerList', servers) ServerList = nil end diff --git a/modules/client_stats/stats.lua b/modules/client_stats/stats.lua index 285ef5aa..5f781a83 100644 --- a/modules/client_stats/stats.lua +++ b/modules/client_stats/stats.lua @@ -8,10 +8,10 @@ sendReportEvent = nil firstReportEvent = nil function initUUID() - UUID = g_settings.getString('report-uuid') + UUID = g_settings:getString('report-uuid') if not UUID or #UUID ~= 36 then UUID = g_crypt.genUUID() - g_settings.set('report-uuid', UUID) + g_settings:set('report-uuid', UUID) end end diff --git a/modules/client_terminal/terminal.lua b/modules/client_terminal/terminal.lua index 6022fd6c..8c80a726 100644 --- a/modules/client_terminal/terminal.lua +++ b/modules/client_terminal/terminal.lua @@ -126,7 +126,7 @@ function init() terminalButton = modules.client_topmenu.addLeftButton('terminalButton', tr('Terminal') .. ' (Ctrl + T)', '/images/topbuttons/terminal', toggle) g_keyboard.bindKeyDown('Ctrl+T', toggle) - commandHistory = g_settings.getList('terminal-history') + commandHistory = g_settings:getList('terminal-history') commandTextEdit = terminalWindow:getChildById('commandTextEdit') g_keyboard.bindKeyPress('Up', function() navigateCommand(1) end, commandTextEdit) @@ -159,7 +159,7 @@ function init() end function terminate() - g_settings.setList('terminal-history', commandHistory) + g_settings:setList('terminal-history', commandHistory) removeEvent(flushEvent) @@ -172,7 +172,7 @@ function terminate() pos = oldPos, poped = poped } - g_settings.setNode('terminal-window', settings) + g_settings:setNode('terminal-window', settings) g_keyboard.unbindKeyDown('Ctrl+T') g_logger.setOnLog(nil) @@ -222,7 +222,7 @@ function toggle() hide() else if not firstShown then - local settings = g_settings.getNode('terminal-window') + local settings = g_settings:getNode('terminal-window') if settings then if settings.size then oldSize = size end if settings.pos then oldPos = settings.pos end diff --git a/modules/corelib/config.lua b/modules/corelib/config.lua new file mode 100644 index 00000000..6497aa34 --- /dev/null +++ b/modules/corelib/config.lua @@ -0,0 +1,76 @@ +-- @docclass + +local function convertSettingValue(value) + if type(value) == 'table' then + if value.x and value.width then + return recttostring(value) + elseif value.x then + return pointtostring(value) + elseif value.width then + return sizetostring(value) + elseif value.r then + return colortostring(value) + else + return value + end + elseif value == nil then + return '' + else + return tostring(value) + end +end + +function Config:set(key, value) + self:setValue(key, convertSettingValue(value)) +end + +function Config:setDefault(key, value) + if self:exists(key) then return false end + self:set(key, value) + return true +end + +function Config:get(key, default) + if not self:exists(key) and default ~= nil then + self:set(key, default) + end + return self:getValue(key) +end + +function Config:getString(key, default) + return self:get(key, default) +end + +function Config:getInteger(key, default) + local v = tonumber(self:get(key, default)) or 0 + return v +end + +function Config:getNumber(key, default) + local v = tonumber(self:get(key, default)) or 0 + return v +end + +function Config:getBoolean(key, default) + return toboolean(self:get(key, default)) +end + +function Config:getPoint(key, default) + return topoint(self:get(key, default)) +end + +function Config:getRect(key, default) + return torect(self:get(key, default)) +end + +function Config:getSize(key, default) + return tosize(self:get(key, default)) +end + +function Config:getColor(key, default) + return tocolor(self:get(key, default)) +end + +function Config:getColor(key, default) + return tocolor(self:get(key, default)) +end diff --git a/modules/corelib/corelib.otmod b/modules/corelib/corelib.otmod index 56798e1b..842a206f 100644 --- a/modules/corelib/corelib.otmod +++ b/modules/corelib/corelib.otmod @@ -14,6 +14,7 @@ Module dofile 'const' dofile 'util' dofile 'globals' + dofile 'config' dofile 'settings' dofile 'keyboard' dofile 'mouse' diff --git a/modules/corelib/settings.lua b/modules/corelib/settings.lua index 34fa74bf..7df26c85 100644 --- a/modules/corelib/settings.lua +++ b/modules/corelib/settings.lua @@ -1,78 +1,4 @@ -- @docclass g_settings = g_configs.getSettings() -local function convertSettingValue(value) - if type(value) == 'table' then - if value.x and value.width then - return recttostring(value) - elseif value.x then - return pointtostring(value) - elseif value.width then - return sizetostring(value) - elseif value.r then - return colortostring(value) - else - return value - end - elseif value == nil then - return '' - else - return tostring(value) - end -end - -function g_settings.set(key, value) - g_settings.set(key, convertSettingValue(value)) -end - -function g_settings.setDefault(key, value) - if g_settings.exists(key) then return false end - g_settings.set(key, value) - return true -end - -function g_settings.get(key, default) - print(g_settings.exists) - if not g_settings.exists(key) and default ~= nil then - g_settings.set(key, default) - end - return g_settings.get(key) -end - -function g_settings.getString(key, default) - return g_settings.get(key, default) -end - -function g_settings.getInteger(key, default) - local v = tonumber(g_settings.get(key, default)) or 0 - return v -end - -function g_settings.getNumber(key, default) - local v = tonumber(g_settings.get(key, default)) or 0 - return v -end - -function g_settings.getBoolean(key, default) - return toboolean(g_settings.get(key, default)) -end - -function g_settings.getPoint(key, default) - return topoint(g_settings.get(key, default)) -end - -function g_settings.getRect(key, default) - return torect(g_settings.get(key, default)) -end - -function g_settings.getSize(key, default) - return tosize(g_settings.get(key, default)) -end - -function g_settings.getColor(key, default) - return tocolor(g_settings.get(key, default)) -end - -function g_settings.getColor(key, default) - return tocolor(g_settings.get(key, default)) -end +-- Reserved for settings specific functionality \ No newline at end of file diff --git a/modules/corelib/ui/uiminiwindow.lua b/modules/corelib/ui/uiminiwindow.lua index c46511d9..429fab60 100644 --- a/modules/corelib/ui/uiminiwindow.lua +++ b/modules/corelib/ui/uiminiwindow.lua @@ -93,7 +93,7 @@ function UIMiniWindow:setup() local oldParent = self:getParent() - local settings = g_settings.getNode('MiniWindows') + local settings = g_settings:getNode('MiniWindows') if settings then local selfSettings = settings[self:getId()] if selfSettings then @@ -245,7 +245,7 @@ end function UIMiniWindow:getSettings(name) if not self.save then return nil end - local settings = g_settings.getNode('MiniWindows') + local settings = g_settings:getNode('MiniWindows') if settings then local selfSettings = settings[self:getId()] if selfSettings then @@ -258,7 +258,7 @@ end function UIMiniWindow:setSettings(data) if not self.save then return end - local settings = g_settings.getNode('MiniWindows') + local settings = g_settings:getNode('MiniWindows') if not settings then settings = {} end @@ -272,13 +272,13 @@ function UIMiniWindow:setSettings(data) settings[id][key] = value end - g_settings.setNode('MiniWindows', settings) + g_settings:setNode('MiniWindows', settings) end function UIMiniWindow:eraseSettings(data) if not self.save then return end - local settings = g_settings.getNode('MiniWindows') + local settings = g_settings:getNode('MiniWindows') if not settings then settings = {} end @@ -292,7 +292,7 @@ function UIMiniWindow:eraseSettings(data) settings[id][key] = nil end - g_settings.setNode('MiniWindows', settings) + g_settings:setNode('MiniWindows', settings) end function UIMiniWindow:saveParent(parent) diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index 6ea6ef7d..bf91bc66 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -131,7 +131,7 @@ function onMiniWindowClose() end function getSortType() - local settings = g_settings.getNode('BattleList') + local settings = g_settings:getNode('BattleList') if not settings then return 'name' end @@ -141,13 +141,13 @@ end function setSortType(state) settings = {} settings['sortType'] = state - g_settings.mergeNode('BattleList', settings) + g_settings:mergeNode('BattleList', settings) checkCreatures() end function getSortOrder() - local settings = g_settings.getNode('BattleList') + local settings = g_settings:getNode('BattleList') if not settings then return 'asc' end @@ -157,7 +157,7 @@ end function setSortOrder(state) settings = {} settings['sortOrder'] = state - g_settings.mergeNode('BattleList', settings) + g_settings:mergeNode('BattleList', settings) checkCreatures() end @@ -171,7 +171,7 @@ function isSortDesc() end function isHidingFilters() - local settings = g_settings.getNode('BattleList') + local settings = g_settings:getNode('BattleList') if not settings then return false end @@ -181,7 +181,7 @@ end function setHidingFilters(state) settings = {} settings['hidingFilters'] = state - g_settings.mergeNode('BattleList', settings) + g_settings:mergeNode('BattleList', settings) end function hideFilterPanel() diff --git a/modules/game_combatcontrols/combatcontrols.lua b/modules/game_combatcontrols/combatcontrols.lua index 85b4d02f..7a95fb2f 100644 --- a/modules/game_combatcontrols/combatcontrols.lua +++ b/modules/game_combatcontrols/combatcontrols.lua @@ -134,7 +134,7 @@ function online() if player then local char = g_game.getCharacterName() - local lastCombatControls = g_settings.getNode('LastCombatControls') + local lastCombatControls = g_settings:getNode('LastCombatControls') if not table.empty(lastCombatControls) then if lastCombatControls[char] then @@ -167,7 +167,7 @@ function online() end function offline() - local lastCombatControls = g_settings.getNode('LastCombatControls') + local lastCombatControls = g_settings:getNode('LastCombatControls') if not lastCombatControls then lastCombatControls = {} end @@ -186,7 +186,7 @@ function offline() end -- save last combat control settings - g_settings.setNode('LastCombatControls', lastCombatControls) + g_settings:setNode('LastCombatControls', lastCombatControls) end end diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 924c4bf5..2362d0bd 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -242,11 +242,11 @@ end function save() local settings = {} settings.messageHistory = messageHistory - g_settings.setNode('game_console', settings) + g_settings:setNode('game_console', settings) end function load() - local settings = g_settings.getNode('game_console') + local settings = g_settings:getNode('game_console') if settings then messageHistory = settings.messageHistory or {} end @@ -263,7 +263,7 @@ end function clear() -- save last open channels - local lastChannelsOpen = g_settings.getNode('lastChannelsOpen') or {} + local lastChannelsOpen = g_settings:getNode('lastChannelsOpen') or {} local char = g_game.getCharacterName() local savedChannels = {} local set = false @@ -278,7 +278,7 @@ function clear() else lastChannelsOpen[char] = nil end - g_settings.setNode('lastChannelsOpen', lastChannelsOpen) + g_settings:setNode('lastChannelsOpen', lastChannelsOpen) -- close channels for _, channelName in pairs(channels) do @@ -1018,25 +1018,25 @@ function loadCommunicationSettings() communicationSettings.whitelistedPlayers = {} communicationSettings.ignoredPlayers = {} - local ignoreNode = g_settings.getNode('IgnorePlayers') + local ignoreNode = g_settings:getNode('IgnorePlayers') if ignoreNode then for i = 1, #ignoreNode do table.insert(communicationSettings.ignoredPlayers, ignoreNode[i]) end end - local whitelistNode = g_settings.getNode('WhitelistedPlayers') + local whitelistNode = g_settings:getNode('WhitelistedPlayers') if whitelistNode then for i = 1, #whitelistNode do table.insert(communicationSettings.whitelistedPlayers, whitelistNode[i]) end end - communicationSettings.useIgnoreList = g_settings.getBoolean('UseIgnoreList') - communicationSettings.useWhiteList = g_settings.getBoolean('UseWhiteList') - communicationSettings.privateMessages = g_settings.getBoolean('IgnorePrivateMessages') - communicationSettings.yelling = g_settings.getBoolean('IgnoreYelling') - communicationSettings.allowVIPs = g_settings.getBoolean('AllowVIPs') + communicationSettings.useIgnoreList = g_settings:getBoolean('UseIgnoreList') + communicationSettings.useWhiteList = g_settings:getBoolean('UseWhiteList') + communicationSettings.privateMessages = g_settings:getBoolean('IgnorePrivateMessages') + communicationSettings.yelling = g_settings:getBoolean('IgnoreYelling') + communicationSettings.allowVIPs = g_settings:getBoolean('AllowVIPs') end function saveCommunicationSettings() @@ -1052,12 +1052,12 @@ function saveCommunicationSettings() table.insert(tmpWhiteList, whitelistedPlayers[i]) end - g_settings.set('UseIgnoreList', communicationSettings.useIgnoreList) - g_settings.set('UseWhiteList', communicationSettings.useWhiteList) - g_settings.set('IgnorePrivateMessages', communicationSettings.privateMessages) - g_settings.set('IgnoreYelling', communicationSettings.yelling) - g_settings.setNode('IgnorePlayers', tmpIgnoreList) - g_settings.setNode('WhitelistedPlayers', tmpWhiteList) + g_settings:set('UseIgnoreList', communicationSettings.useIgnoreList) + g_settings:set('UseWhiteList', communicationSettings.useWhiteList) + g_settings:set('IgnorePrivateMessages', communicationSettings.privateMessages) + g_settings:set('IgnoreYelling', communicationSettings.yelling) + g_settings:setNode('IgnorePlayers', tmpIgnoreList) + g_settings:setNode('WhitelistedPlayers', tmpWhiteList) end function getIgnoredPlayers() @@ -1240,7 +1240,7 @@ function online() g_keyboard.bindKeyDown('Ctrl+R', openPlayerReportRuleViolationWindow) end -- open last channels - local lastChannelsOpen = g_settings.getNode('lastChannelsOpen') + local lastChannelsOpen = g_settings:getNode('lastChannelsOpen') if lastChannelsOpen then local savedChannels = lastChannelsOpen[g_game.getCharacterName()] if savedChannels then diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index d76c59c8..945bfb34 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -145,7 +145,7 @@ end function load(forceDefaults) hotkeysManagerLoaded = false - local hotkeySettings = g_settings.getNode('game_hotkeys') + local hotkeySettings = g_settings:getNode('game_hotkeys') local hotkeys = {} if not table.empty(hotkeySettings) then hotkeys = hotkeySettings end @@ -192,7 +192,7 @@ function reload() end function save() - local hotkeySettings = g_settings.getNode('game_hotkeys') or {} + local hotkeySettings = g_settings:getNode('game_hotkeys') or {} local hotkeys = hotkeySettings if perServer then @@ -223,8 +223,8 @@ function save() end hotkeyList = hotkeys - g_settings.setNode('game_hotkeys', hotkeySettings) - g_settings.save() + g_settings:setNode('game_hotkeys', hotkeySettings) + g_settings:save() end function loadDefautComboKeys() diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 9c45a65b..51291248 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -178,11 +178,11 @@ end function save() local settings = {} settings.splitterMarginBottom = bottomSplitter:getMarginBottom() - g_settings.setNode('game_interface', settings) + g_settings:setNode('game_interface', settings) end function load() - local settings = g_settings.getNode('game_interface') + local settings = g_settings:getNode('game_interface') if settings then if settings.splitterMarginBottom then bottomSplitter:setMarginBottom(settings.splitterMarginBottom) diff --git a/modules/game_viplist/viplist.lua b/modules/game_viplist/viplist.lua index 213318fb..72daeeda 100644 --- a/modules/game_viplist/viplist.lua +++ b/modules/game_viplist/viplist.lua @@ -48,7 +48,7 @@ function terminate() end function loadVipInfo() - local settings = g_settings.getNode('VipList') + local settings = g_settings:getNode('VipList') if not settings then vipInfo = {} return @@ -59,7 +59,7 @@ end function saveVipInfo() settings = {} settings['VipInfo'] = vipInfo - g_settings.mergeNode('VipList', settings) + g_settings:mergeNode('VipList', settings) end @@ -212,13 +212,13 @@ end function hideOffline(state) settings = {} settings['hideOffline'] = state - g_settings.mergeNode('VipList', settings) + g_settings:mergeNode('VipList', settings) refresh() end function isHiddingOffline() - local settings = g_settings.getNode('VipList') + local settings = g_settings:getNode('VipList') if not settings then return false end @@ -226,7 +226,7 @@ function isHiddingOffline() end function getSortedBy() - local settings = g_settings.getNode('VipList') + local settings = g_settings:getNode('VipList') if not settings or not settings['sortedBy'] then return 'status' end @@ -236,7 +236,7 @@ end function sortBy(state) settings = {} settings['sortedBy'] = state - g_settings.mergeNode('VipList', settings) + g_settings:mergeNode('VipList', settings) refresh() end diff --git a/modules/gamelib/ui/uiminimap.lua b/modules/gamelib/ui/uiminimap.lua index 1a3a4f2b..1cbfa4d8 100644 --- a/modules/gamelib/ui/uiminimap.lua +++ b/modules/gamelib/ui/uiminimap.lua @@ -55,7 +55,7 @@ function UIMinimap:disableAutoWalk() end function UIMinimap:load() - local settings = g_settings.getNode('Minimap') + local settings = g_settings:getNode('Minimap') if settings then if settings.flags then for _,flag in pairs(settings.flags) do @@ -76,7 +76,7 @@ function UIMinimap:save() }) end settings.zoom = self:getZoom() - g_settings.setNode('Minimap', settings) + g_settings:setNode('Minimap', settings) end local function onFlagMouseRelease(widget, pos, button) diff --git a/src/framework/core/config.cpp b/src/framework/core/config.cpp index 511995ff..5dadf37b 100644 --- a/src/framework/core/config.cpp +++ b/src/framework/core/config.cpp @@ -70,7 +70,7 @@ void Config::clear() m_confsDoc->clear(); } -void Config::set(const std::string& key, const std::string& value) +void Config::setValue(const std::string& key, const std::string& value) { if(key == "") { remove(key); @@ -94,12 +94,12 @@ void Config::setList(const std::string& key, const std::vector& lis m_confsDoc->addChild(child); } -bool Config::exists(const std::string key) +bool Config::exists(const std::string& key) { return m_confsDoc->hasChildAt(key); } -std::string Config::get(const std::string& key) +std::string Config::getValue(const std::string& key) { OTMLNodePtr child = m_confsDoc->get(key); if(child) diff --git a/src/framework/core/config.h b/src/framework/core/config.h index f16120e0..823cc2e7 100644 --- a/src/framework/core/config.h +++ b/src/framework/core/config.h @@ -39,16 +39,16 @@ public: bool save(); void clear(); - void set(const std::string& key, const std::string& value); + void setValue(const std::string& key, const std::string& value); void setList(const std::string& key, const std::vector& list); - std::string get(const std::string& key); + std::string getValue(const std::string& key); std::vector getList(const std::string& key); void setNode(const std::string& key, const OTMLNodePtr& node); void mergeNode(const std::string& key, const OTMLNodePtr& node); OTMLNodePtr getNode(const std::string& key); - bool exists(const std::string key); + bool exists(const std::string& key); void remove(const std::string& key); std::string getFileName(); diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index 2ac5fd2a..70ddf9c6 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -193,9 +193,9 @@ void Application::registerLuaFunctions() // Config g_lua.registerClass(); g_lua.bindClassMemberFunction("save", &Config::save); - g_lua.bindClassMemberFunction("set", &Config::set); + g_lua.bindClassMemberFunction("setValue", &Config::setValue); g_lua.bindClassMemberFunction("setList", &Config::setList); - g_lua.bindClassMemberFunction("get", &Config::get); + g_lua.bindClassMemberFunction("getValue", &Config::getValue); g_lua.bindClassMemberFunction("getList", &Config::getList); g_lua.bindClassMemberFunction("exists", &Config::exists); g_lua.bindClassMemberFunction("remove", &Config::remove);