Fixes in options, hotkeys and viplist

master
Eduardo Bart 11 years ago
parent 3ca85cbe87
commit 62921dee9b

@ -1,11 +1,3 @@
VolumeScrollbar < HorizontalScrollBar
step: 1
@onValueChange: modules.client_options.setOption(self:getId(), self:getValue())
@onSetup: |
UIScrollBar.onSetup(self)
local value = modules.client_options.getOption(self:getId())
self:setValue(value)
Panel
OptionCheckBox
id: enableAudio
@ -26,7 +18,7 @@ Panel
local value = modules.client_options.getOption('musicSoundVolume')
self:setText(tr('Music volume: %d', value))
VolumeScrollbar
OptionScrollbar
id: musicSoundVolume
anchors.left: parent.left
anchors.right: parent.right

@ -1,12 +1,3 @@
FrameRateScrollbar < HorizontalScrollBar
step: 1
@onValueChange: modules.client_options.setOption(self:getId(), self:getValue())
@onSetup: |
UIScrollBar.onSetup(self)
local value = modules.client_options.getOption(self:getId())
if value == 0 then value = self:getMaximum() end
self:setValue(value)
Panel
ButtonBox
id: opengl1
@ -65,7 +56,7 @@ Panel
self:setText(tr('Game framerate limit: %s', text))
FrameRateScrollbar
OptionScrollbar
id: backgroundFrameRate
anchors.left: parent.left
anchors.right: parent.right
@ -89,7 +80,7 @@ Panel
self:setText(tr('Interface framerate limit: %s', text))
FrameRateScrollbar
OptionScrollbar
id: foregroundFrameRate
anchors.left: parent.left
anchors.right: parent.right
@ -108,7 +99,7 @@ Panel
local value = modules.client_options.getOption('ambientLight')
self:setText(tr('Ambient light: %s%%', value))
FrameRateScrollbar
OptionScrollbar
id: ambientLight
anchors.left: parent.left
anchors.right: parent.right

@ -175,7 +175,6 @@ function setOption(key, value, force)
if not force and options[key] == value then return end
local gameMapPanel = modules.game_interface.getMapPanel()
local panel = nil
if key == 'vsync' then
g_window.setVerticalSync(value)
elseif key == 'showFps' then
@ -184,7 +183,6 @@ function setOption(key, value, force)
modules.client_topmenu.setPingVisible(value)
elseif key == 'fullscreen' then
g_window.setFullscreen(value)
panel = graphicsPanel
elseif key == 'enableAudio' then
g_sounds.setAudioEnabled(value)
if value then
@ -192,7 +190,6 @@ function setOption(key, value, force)
else
audioButton:setIcon('/images/topbuttons/audio_mute')
end
panel = audioPanel
elseif key == 'enableMusicSound' then
g_sounds.getChannel(SoundChannels.Music):setEnabled(value)
elseif key == 'musicSoundVolume' then
@ -201,15 +198,15 @@ function setOption(key, value, force)
elseif key == 'showLeftPanel' then
modules.game_interface.getLeftPanel():setOn(value)
elseif key == 'backgroundFrameRate' then
local text = value
if value <= 0 or value >= 201 then text = 'max' value = 0 end
local text, v = value, value
if value <= 0 or value >= 201 then text = 'max' v = 0 end
graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text))
g_app.setBackgroundPaneMaxFps(value)
g_app.setBackgroundPaneMaxFps(v)
elseif key == 'foregroundFrameRate' then
local text = value
if value <= 0 or value >= 61 then text = 'max' value = 0 end
local text, v = value, value
if value <= 0 or value >= 61 then text = 'max' v = 0 end
graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text))
g_app.setForegroundPaneMaxFps(value)
g_app.setForegroundPaneMaxFps(v)
elseif key == 'enableLights' then
gameMapPanel:setDrawLights(value and options['ambientLight'] < 100)
graphicsPanel:getChildById('ambientLight'):setEnabled(value)
@ -222,20 +219,22 @@ function setOption(key, value, force)
g_graphics.selectPainterEngine(value)
elseif key == 'displayNames' then
gameMapPanel:setDrawNames(value)
panel = generalPanel
elseif key == 'displayHealth' then
gameMapPanel:setDrawHealthBars(value)
panel = generalPanel
elseif key == 'displayText' then
gameMapPanel:setDrawTexts(value)
panel = generalPanel
end
-- change value for keybind updates
if panel then
for _,panel in pairs(optionsTabBar:getTabsPanel()) do
local widget = panel:recursiveGetChildById(key)
if widget and widget:getStyle().__class == 'UICheckBox' then
widget:setChecked(value)
if widget then
if widget:getStyle().__class == 'UICheckBox' then
widget:setChecked(value)
elseif widget:getStyle().__class == 'UIScrollBar' then
widget:setValue(value)
end
break
end
end

@ -1,6 +1,5 @@
OptionCheckBox < CheckBox
@onCheckChange: modules.client_options.setOption(self:getId(), self:isChecked())
@onSetup: self:setChecked(modules.client_options.getOption(self:getId()))
height: 16
$first:
@ -14,6 +13,10 @@ OptionCheckBox < CheckBox
anchors.top: prev.bottom
margin-top: 2
OptionScrollbar < HorizontalScrollBar
step: 1
@onValueChange: modules.client_options.setOption(self:getId(), self:getValue())
MainWindow
id: optionsWindow
!text: tr('Options')

@ -167,3 +167,17 @@ function table.tostring(t)
end
return str
end
function table.collect(t, func)
local res = {}
for k,v in pairs(t) do
local a,b = func(k,v)
if a and b then
res[a] = b
elseif a ~= nil then
table.insert(res,a)
end
end
return res
end

@ -144,3 +144,11 @@ end
function UITabBar:getCurrentTab()
return self.currentTab
end
function UITabBar:getTabs()
return self.tabs
end
function UITabBar:getTabsPanel()
return table.collect(self.tabs, function(_,tab) return tab.tabPanel end)
end

@ -680,6 +680,10 @@ function sendMessage(message, tab)
elseif tab.npcChat then
speaktypedesc = 'privatePlayerToNpc'
elseif tab == violationReportTab then
if violationReportTab.locked then
modules.game_textmessage.displayFailureMessage('Wait for a gamemaster reply.')
return
end
speaktypedesc = 'rvrContinue'
tabname = tr('Report Rule') .. '...'
elseif tab.violationChatName then

@ -1129,6 +1129,11 @@ void Game::removeVip(int playerId)
{
if(!canPerformGameAction())
return;
auto it = m_vips.find(playerId);
if(it == m_vips.end())
return;
m_vips.erase(it);
m_protocolGame->sendRemoveVip(playerId);
}

@ -349,11 +349,13 @@ void UIManager::importStyleFromOTML(const OTMLNodePtr& styleNode)
OTMLNodePtr oldStyle = m_styles[name];
// Warn about redefined styles
/*
if(!g_app.isRunning() && (oldStyle && !oldStyle->valueAt("__unique", false))) {
auto it = m_styles.find(name);
if(it != m_styles.end())
g_logger.warning(stdext::format("style '%s' is being redefined", name));
}
*/
if(!oldStyle || !oldStyle->valueAt("__unique", false) || unique) {
OTMLNodePtr originalStyle = getStyle(base);

@ -41,7 +41,7 @@ UITextEdit::UITextEdit()
m_maxLength = 0;
m_editable = true;
m_selectable = true;
m_autoScroll = false;
m_autoScroll = true;
m_changeCursorImage = true;
m_selectionReference = 0;
m_selectionStart = 0;

Loading…
Cancel
Save