From: <sv...@ww...> - 2007-04-25 11:18:39
|
Author: nsmoooose Date: 2007-04-25 04:18:30 -0700 (Wed, 25 Apr 2007) New Revision: 2086 Modified: branches/python_bindings_for_ui/csp/bin/sim.ini branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp branches/python_bindings_for_ui/csp/cspsim/CSPSim.h branches/python_bindings_for_ui/csp/data/ui/startup.py Log: Configuration is stored and configurationChanged signal is sent. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2086 Modified: branches/python_bindings_for_ui/csp/bin/sim.ini =================================================================== --- branches/python_bindings_for_ui/csp/bin/sim.ini 2007-04-23 19:35:07 UTC (rev 2085) +++ branches/python_bindings_for_ui/csp/bin/sim.ini 2007-04-25 11:18:30 UTC (rev 2086) @@ -64,5 +64,5 @@ [UI] -ThemeName = default -Language = english +ThemeName = experimental +Language = swedish Modified: branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp 2007-04-23 19:35:07 UTC (rev 2085) +++ branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp 2007-04-25 11:18:30 UTC (rev 2086) @@ -59,6 +59,7 @@ #include <csp/cspsim/stores/StoresDatabase.h> +#include <csp/cspsim/wf/SignalData.h> #include <csp/cspsim/windows/MenuScreen.h> #include <csp/csplib/data/GeoPos.h> @@ -107,6 +108,7 @@ CSPSim *CSPSim::theSim = 0; CSPSim::CSPSim(): + m_ConfigurationChanged(new wf::Signal), m_DataManager(new DataManager), m_Atmosphere(new Atmosphere), //--m_RenderSurface(new Producer::RenderSurface), @@ -154,14 +156,31 @@ void CSPSim::setConfiguration(config::Configuration* config) { - // TODO Check if the new configuration can be set correctly. + // TODO Check if the new configuration can be set correctly. Things to check: + // * Can the new screen resolution be set according my graphics driver? - // TODO Apply the configuration - - // Set the new configuration. + // Apply the configuration. First we start with assigning the configuration object. m_Configuration = config; + + // Set all display settings. + Ref<config::Display> display = config->getDisplay(); + ScreenSettings screenSettings = getScreenSettings(); + screenSettings.width = display->getWidth(); + screenSettings.height = display->getHeight(); + screenSettings.fullScreen = display->getFullscreen(); + setScreenSettings(screenSettings); + + // Set all UI settings. + Ref<config::UserInterface> userInterface = config->getUserInterface(); + setUITheme(userInterface->getTheme()); + setUILanguage(userInterface->getLanguage()); + + // Save the new configuration to persistent storage. + // Configuration changes is stored on successfull quit of the application. - // TODO Save the new configuration to persistent storage. + // Trigger the configuration changed signal to inform any listener about the change. + Ref<wf::SignalData> data = new wf::SignalData; + m_ConfigurationChanged->emit(data.get()); } void CSPSim::setActiveObject(Ref<DynamicObject> object) { Modified: branches/python_bindings_for_ui/csp/cspsim/CSPSim.h =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/CSPSim.h 2007-04-23 19:35:07 UTC (rev 2085) +++ branches/python_bindings_for_ui/csp/cspsim/CSPSim.h 2007-04-25 11:18:30 UTC (rev 2086) @@ -59,6 +59,7 @@ #include <csp/csplib/util/Ref.h> #include <csp/csplib/util/ScopedPointer.h> #include <csp/csplib/data/Date.h> +#include <csp/cspsim/wf/Signal.h> #include <osg/ref_ptr> @@ -143,6 +144,7 @@ void doStartupScript(); private: + Ref<wf::Signal> m_ConfigurationChanged; SDL_Surface *m_SDLScreen; SDL_Joystick* m_SDLJoystick; Modified: branches/python_bindings_for_ui/csp/data/ui/startup.py =================================================================== --- branches/python_bindings_for_ui/csp/data/ui/startup.py 2007-04-23 19:35:07 UTC (rev 2085) +++ branches/python_bindings_for_ui/csp/data/ui/startup.py 2007-04-25 11:18:30 UTC (rev 2086) @@ -44,6 +44,11 @@ self.windowManager.show(self.mainMenuWindow) def run(self): + # We want to connect to the configuration changed event. + #from csp.data.ui.utils import SlotProxy + #self.configurationChangedSlot = SlotProxy(self.configuration_Changed) + #self.cspsim.getConfigurationChangedSignal().connect(self.configurationChangedSlot) + self.cspsim.displayMenuScreen() self.menuScreen = self.cspsim.getCurrentScreen() self.windowManager = self.menuScreen.getWindowManager() @@ -51,3 +56,6 @@ self.displayDesktop() self.displayMainMenu() self.cspsim.run() + + def configuration_Changed(self): + print 'configuration changed' \ No newline at end of file |