MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / SettingsWindow

Method SettingsWindow

source/modes/SettingsWindow.cpp:37–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35#include <SFML/Audio/Listener.hpp>
36
37SettingsWindow::SettingsWindow(CEGUI::Window* rootWindow):
38 mSettingsWindow(nullptr),
39 mApplyWindow(nullptr),
40 mRootWindow(rootWindow)
41{
42 if (rootWindow == nullptr)
43 {
44 OD_LOG_ERR("Settings Window loaded without any main CEGUI window!!");
45 return;
46 }
47 CEGUI::WindowManager* wmgr = CEGUI::WindowManager::getSingletonPtr();
48
49 mSettingsWindow = wmgr->loadLayoutFromFile("WindowSettings.layout");
50 if (mSettingsWindow == nullptr)
51 {
52 OD_LOG_ERR("Couldn't load the Settings Window layout!!");
53 return;
54 }
55 rootWindow->addChild(mSettingsWindow);
56 mSettingsWindow->hide();
57
58 mApplyWindow = wmgr->loadLayoutFromFile("WindowApplyChanges.layout");
59 if (mApplyWindow == nullptr)
60 {
61 OD_LOG_ERR("Couldn't load the apply changes popup Window layout!!");
62 return;
63 }
64 rootWindow->addChild(mApplyWindow);
65 mApplyWindow->hide();
66
67 // Events connections
68 // Settings window
69 addEventConnection(
70 mSettingsWindow->getChild("CancelButton")->subscribeEvent(
71 CEGUI::PushButton::EventClicked,
72 CEGUI::Event::Subscriber(&SettingsWindow::onCancelSettings, this)
73 )
74 );
75 addEventConnection(
76 mSettingsWindow->subscribeEvent(
77 CEGUI::FrameWindow::EventCloseClicked,
78 CEGUI::Event::Subscriber(&SettingsWindow::onCancelSettings, this)
79 )
80 );
81 addEventConnection(
82 mSettingsWindow->getChild("ApplyButton")->subscribeEvent(
83 CEGUI::PushButton::EventClicked,
84 CEGUI::Event::Subscriber(&SettingsWindow::onApplySettings, this)
85 )
86 );
87
88 // Music volume slider
89 CEGUI::Slider* volumeSlider = static_cast<CEGUI::Slider*>(
90 mSettingsWindow->getChild("MainTabControl/Audio/AudioSP/MusicSlider"));
91 addEventConnection(
92 volumeSlider->subscribeEvent(
93 CEGUI::Slider::EventValueChanged,
94 CEGUI::Event::Subscriber(&SettingsWindow::onMusicVolumeChanged, this)

Callers

nothing calls this directly

Calls 1

hideMethod · 0.80

Tested by

no test coverage detected