[Orxonox-commit 3333] r8021 - code/branches/usability/data/gui/scripts

landauf at orxonox.net landauf at orxonox.net
Sat Mar 5 19:10:32 CET 2011


Author: landauf
Date: 2011-03-05 19:10:31 +0100 (Sat, 05 Mar 2011)
New Revision: 8021

Modified:
   code/branches/usability/data/gui/scripts/GraphicsMenu.lua
Log:
if the resolution is changed in the graphics menu, a decision popup prompts for confirmation and resets the settings if not accepted (or automatically after 10 seconds)

Modified: code/branches/usability/data/gui/scripts/GraphicsMenu.lua
===================================================================
--- code/branches/usability/data/gui/scripts/GraphicsMenu.lua	2011-03-05 17:30:06 UTC (rev 8020)
+++ code/branches/usability/data/gui/scripts/GraphicsMenu.lua	2011-03-05 18:10:31 UTC (rev 8021)
@@ -322,11 +322,31 @@
     local widthEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxWidth")
     local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
 
+    -- start revert timer
+    P.oldWidth = orxonox.GraphicsManager:getInstance():getWindowWidth()
+    P.oldHeight = orxonox.GraphicsManager:getInstance():getWindowHeight()
+    P.oldFullscreen = orxonox.GraphicsManager:getInstance():isFullScreen()
+
+    P.revertTimerHandle = orxonox.CommandExecutor:query("delay 10 \"hideGUI DecisionPopup; GraphicsManager setScreenResolution " .. P.oldWidth .. " " .. P.oldHeight .. " " .. tostring(P.oldFullscreen) .. "\"")
+
+    -- change settings
     orxonox.CommandExecutor:execute("GraphicsManager setScreenResolution " .. widthEditbox:getText() .. " " .. heightEditbox:getText() .. " " .. checkedFullscreen)
 
     P.updateApplyButton()
+
+    -- prompt for confirmation
+    openDecisionPopup("Do you want to keep these settings? (Settings will be reverted in 10 seconds if not accepted)", GraphicsMenu.callback_ApplyDecisionPopup)
 end
 
+function P.callback_ApplyDecisionPopup(pressedOK)
+    orxonox.CommandExecutor:execute("killdelay " .. P.revertTimerHandle)
+
+    if not pressedOK then
+        orxonox.CommandExecutor:execute("GraphicsManager setScreenResolution " .. P.oldWidth .. " " .. P.oldHeight .. " " .. tostring(P.oldFullscreen))
+        P:onShow()
+    end
+end
+
 function P.callback_Ok_Clicked(e)
     -- aspect ratio
     local aspectRatioEditbox = winMgr:getWindow("orxonox/Display/Resolution/AspectRatio")




More information about the Orxonox-commit mailing list