Allow to set default server in entergame

master
Eduardo Bart 12 years ago
parent e25bd7fe54
commit 112d584b66

@ -105,7 +105,7 @@ function EnterGame.firstShow()
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(EnterGame.doLogin)
autoLogiEvent = addEvent(EnterGame.doLogin)
end
end
@ -148,6 +148,7 @@ function EnterGame.clearAccountFields()
end
function EnterGame.doLogin()
autoLogiEvent = nil
G.account = enterGame:getChildById('accountNameTextEdit'):getText()
G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
G.host = enterGame:getChildById('serverHostTextEdit'):getText()
@ -192,6 +193,26 @@ function EnterGame.displayMotd()
displayInfoBox(tr('Message of the day'), G.motdMessage)
end
function EnterGame.setDefaultServer(host, port, protocol)
local hostTextEdit = enterGame:getChildById('serverHostTextEdit')
local portTextEdit = enterGame:getChildById('serverPortTextEdit')
local protocolLabel = enterGame:getChildById('protocolLabel')
local accountTextEdit = enterGame:getChildById('accountNameTextEdit')
local passwordTextEdit = enterGame:getChildById('accountPasswordTextEdit')
if hostTextEdit:getText() ~= host then
hostTextEdit:setText(host)
portTextEdit:setText(port)
protocolBox:setCurrentOption(protocol)
accountTextEdit:setText('')
passwordTextEdit:setText('')
if autoLogiEvent then
autoLogiEvent:cancel()
end
end
end
function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeight)
local hostTextEdit = enterGame:getChildById('serverHostTextEdit')
hostTextEdit:setText(host)

@ -70,8 +70,12 @@ end
function Locales.terminate()
installedLocales = nil
currentLocale = nil
localeComboBox:destroy()
localeComboBox = nil
if localeComboBox then
localeComboBox:destroy()
localeComboBox = nil
end
Extended.unregister(ExtendedLocales)
disconnect(g_game, { onGameStart = onGameStart })
end

@ -31,8 +31,11 @@ function UITable:onDestroy()
self.columns = {}
self.headerRow = {}
self.selectedRow = nil
self.dataSpace:destroyChildren()
self.dataSpace = nil
if self.dataSpace then
self.dataSpace:destroyChildren()
self.dataSpace = nil
end
end
function UITable:onStyleApply(styleName, styleNode)

Loading…
Cancel
Save