Changeset 7555 in orxonox.OLD for branches/qt_gui
- Timestamp:
- May 7, 2006, 2:25:16 PM (19 years ago)
- Location:
- branches/qt_gui/src/lib/gui
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/qt_gui/src/lib/gui/gui.cc
r7548 r7555 40 40 } 41 41 42 43 /** 44 * @brief adds a SaveableGroup 45 * @param saveableGroup the SaveableGroup to add to the SaveList. 46 */ 47 void Gui::addSaveableGroup(SaveableGroup* saveableGroup) 48 { 49 if (std::find (this->groups.begin(), this->groups.end(), saveableGroup) == this->groups.end()) 50 this->groups.push_back(saveableGroup); 51 } 52 53 /** 54 * @brief removes a SaveableGroup 55 * @param saveableGroup the SaveableGroup to remove from the SaveList. 56 */ 57 void Gui::removeSaveableGroup(SaveableGroup* saveableGroup) 58 { 59 std::vector<SaveableGroup*>::iterator delElem = std::find (this->groups.begin(), this->groups.end(), saveableGroup); 60 if (delElem != this->groups.end()) 61 this->groups.erase(delElem); 62 } 63 42 64 void Gui::quitEvent() 43 65 { -
branches/qt_gui/src/lib/gui/gui.h
r7549 r7555 45 45 46 46 void addSaveableGroup(SaveableGroup* saveableGroup); 47 void removeSaveableGroup(SaveableGroup* saveableGroup); 47 48 48 49 protected: -
branches/qt_gui/src/lib/gui/gui_element.cc
r7549 r7555 18 18 #include "gui_element.h" 19 19 20 #include "gui_gtk.h"21 22 20 namespace OrxGui 23 21 { … … 30 28 : SaveableGroup(name, gui) 31 29 { 32 //this->mainWidget = NULL;33 30 } 34 31 -
branches/qt_gui/src/lib/gui/gui_saveable.cc
r7549 r7555 17 17 18 18 #include "gui_saveable.h" 19 #include "gui.h" 19 20 20 21 namespace OrxGui … … 24 25 * standard constructor 25 26 */ 26 Saveable::Saveable (const std::string& optionName )27 Saveable::Saveable (const std::string& optionName, SaveableGroup* group) 27 28 : BaseObject(optionName) 28 29 { 29 30 this->bSaveable = false; 31 32 this->group = group; 33 this->group->addSaveable(this); 30 34 31 35 } … … 37 41 Saveable::~Saveable () 38 42 { 43 this->group->removeSaveable(this); 39 44 // delete what has to be deleted here 40 45 } … … 49 54 50 55 SaveableGroup::SaveableGroup(const std::string& groupName, OrxGui::Gui* gui) 51 : Saveable(groupName)56 : BaseObject(groupName) 52 57 { 58 assert (gui != NULL); 59 this->gui = gui; 53 60 61 this->gui->addSaveableGroup(this); 62 //this->mainWidget = NULL; 54 63 } 55 56 64 57 65 … … 59 67 SaveableGroup::~SaveableGroup() 60 68 { 61 std::vector<SaveableGroup*>::iterator delGroup = std::find(saveableGroups.begin(), saveableGroups.end(), this); 62 63 if (delGroup != saveableGroups.end() ) 64 saveableGroups.erase(delGroup); 69 this->gui->removeSaveableGroup(this); 65 70 } 66 71 72 73 /** 74 * @brief Adds a Saveable to the List. 75 * @param saveable the saveable to add. 76 */ 77 void SaveableGroup::addSaveable(Saveable* saveable) 78 { 79 if (std::find(this->saveables.begin(), this->saveables.end(), saveable) == this->saveables.end()) 80 this->saveables.push_back(saveable); 81 } 82 83 /** 84 * @brief Removes a Saveable from the List. 85 * @param saveable the saveable to remove. 86 */ 87 void SaveableGroup::removeSaveable(Saveable* saveable) 88 { 89 std::vector<Saveable*>::iterator delSav = std::find(this->saveables.begin(), this->saveables.end(), saveable); 90 if (delSav != this->saveables.end()) 91 this->saveables.erase(delSav); 92 } 93 94 95 /** 96 * @brief load the value onto the Group. 97 * @param value the Value to load. 98 */ 67 99 void SaveableGroup::load(const MultiType& value) 68 100 {} 69 101 102 /** 103 * @brief save the value from the Group 104 * @returns nothing. 105 */ 70 106 const MultiType& SaveableGroup::save() 71 107 {} … … 73 109 74 110 75 std::vector<SaveableGroup*> SaveableGroup::saveableGroups;76 77 void SaveableGroup::makingElementSaveable()78 {79 SaveableGroup::saveableGroups.push_back(this);80 }81 82 83 111 84 112 } -
branches/qt_gui/src/lib/gui/gui_saveable.h
r7549 r7555 15 15 { 16 16 class Gui; 17 class SaveableGroup; 17 18 18 //! A class for ...19 //! A class for Elements in the Gui that are Saveable. 19 20 class Saveable : public BaseObject 20 21 { … … 32 33 33 34 protected: 34 Saveable(const std::string& optionName );35 Saveable(const std::string& optionName, SaveableGroup* group); 35 36 virtual void makingElementSaveable() {}; 36 37 37 38 private: 39 SaveableGroup* group; 38 40 MultiType _value; 39 41 bool bSaveable; … … 42 44 43 45 44 class SaveableGroup : public Saveable46 class SaveableGroup : public BaseObject 45 47 { 46 48 public: … … 55 57 protected: 56 58 SaveableGroup(const std::string& name, OrxGui::Gui* gui); 57 virtual void makingElementSaveable();58 59 59 60 private: 61 OrxGui::Gui* gui; 60 62 std::vector<Saveable*> saveables; 61 static std::vector<SaveableGroup*> saveableGroups;62 63 }; 63 64 -
branches/qt_gui/src/lib/gui/qt_gui/gui_audio.cc
r7551 r7555 43 43 44 44 { 45 QtGuiCheckBox* fullscreen = new QtGuiCheckBox("Enabled", t rue);45 QtGuiCheckBox* fullscreen = new QtGuiCheckBox("Enabled", this, true); 46 46 layout->addWidget(fullscreen, 0, 1); 47 47 … … 49 49 QLabel* soundCardLabel = new QLabel("Soundcard"); 50 50 layout->addWidget(soundCardLabel, 1,1); 51 QtGuiComboBox* soundCard = new QtGuiComboBox("SoundCard" );51 QtGuiComboBox* soundCard = new QtGuiComboBox("SoundCard", this); 52 52 layout->addWidget(soundCard, 2, 1); 53 53 54 QtGuiSlider* channels = new QtGuiSlider("Channels", Qt::Vertical);54 QtGuiSlider* channels = new QtGuiSlider("Channels", this, Qt::Vertical); 55 55 layout->addWidget(channels, 0, 0, 3, 1); 56 56 QLabel* channelsLabel = new QLabel("Channels"); … … 60 60 QLabel* musicLabel = new QLabel("Music Volume"); 61 61 layout->addWidget(musicLabel, 0, 2); 62 QtGuiSlider* musicVolume = new QtGuiSlider("Music-Volume" );62 QtGuiSlider* musicVolume = new QtGuiSlider("Music-Volume", this); 63 63 layout->addWidget(musicVolume, 1, 2); 64 64 … … 66 66 QLabel* effectsLabel = new QLabel("Effects Volume"); 67 67 layout->addWidget(effectsLabel, 2,2); 68 QtGuiSlider* effectVolume = new QtGuiSlider("Effects-Volume" );68 QtGuiSlider* effectVolume = new QtGuiSlider("Effects-Volume", this); 69 69 layout->addWidget(effectVolume, 3, 2); 70 70 } -
branches/qt_gui/src/lib/gui/qt_gui/gui_video.cc
r7549 r7555 65 65 QGridLayout* advLayout = new QGridLayout(advanced); //!< Advanced Layout 66 66 { 67 QtGuiCheckBox* shadows = new QtGuiCheckBox("Shadows" ); //!< CheckBox for shadows67 QtGuiCheckBox* shadows = new QtGuiCheckBox("Shadows", this); //!< CheckBox for shadows 68 68 advLayout->addWidget(shadows, 0,0); 69 QtGuiCheckBox* fog = new QtGuiCheckBox("Fog" ); //!< CheckBox for fog.69 QtGuiCheckBox* fog = new QtGuiCheckBox("Fog", this); //!< CheckBox for fog. 70 70 advLayout->addWidget(fog, 1,0); 71 QtGuiCheckBox* reflections = new QtGuiCheckBox("reflections" ); //!< CheckBox for reflections71 QtGuiCheckBox* reflections = new QtGuiCheckBox("reflections", this); //!< CheckBox for reflections 72 72 advLayout->addWidget(reflections, 2, 0); 73 QtGuiCheckBox* textures = new QtGuiCheckBox("textures" ); //!< CheckBox for textures73 QtGuiCheckBox* textures = new QtGuiCheckBox("textures", this); //!< CheckBox for textures 74 74 advLayout->addWidget(textures, 3, 0); 75 75 /* -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc
r7549 r7555 57 57 } 58 58 59 connect(this->mainWindow, SIGNAL(destroyed()), this, SLOT(quitApp())); 59 60 this->mainWindow->setCentralWidget(groupBox); 60 61 this->mainWindow->show(); -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.cc
r7551 r7555 24 24 25 25 26 QtGuiCheckBox::QtGuiCheckBox(const std::string& name, bool defaultValue)27 : QCheckBox(QString().fromStdString(name)), Saveable(name )26 QtGuiCheckBox::QtGuiCheckBox(const std::string& name, SaveableGroup* group, bool defaultValue) 27 : QCheckBox(QString().fromStdString(name)), Saveable(name, group) 28 28 { 29 29 //this->load(this->value()); … … 47 47 48 48 49 QtGuiSlider::QtGuiSlider(const std::string& name, Qt::Orientation orientation)50 : QSlider(orientation), Saveable(name )49 QtGuiSlider::QtGuiSlider(const std::string& name, SaveableGroup* group, Qt::Orientation orientation) 50 : QSlider(orientation), Saveable(name, group) 51 51 { 52 52 … … 62 62 63 63 64 QtGuiComboBox::QtGuiComboBox(const std::string& name )65 : QComboBox(), Saveable(name )64 QtGuiComboBox::QtGuiComboBox(const std::string& name, SaveableGroup* group) 65 : QComboBox(), Saveable(name, group) 66 66 { 67 67 -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.h
r7551 r7555 30 30 Q_OBJECT 31 31 public: 32 QtGuiCheckBox(const std::string& name, bool defaultValue = false);32 QtGuiCheckBox(const std::string& name, SaveableGroup* group, bool defaultValue = false); 33 33 virtual ~QtGuiCheckBox() {}; 34 34 … … 37 37 38 38 public slots: 39 // void setCheckValue(int);39 // void setCheckValue(int); 40 40 41 41 signals: 42 // void checkValueChanged();42 // void checkValueChanged(); 43 43 }; 44 44 … … 48 48 49 49 public: 50 QtGuiSlider(const std::string& name, Qt::Orientation orientation = Qt::Horizontal);50 QtGuiSlider(const std::string& name, SaveableGroup* group, Qt::Orientation orientation = Qt::Horizontal); 51 51 virtual ~QtGuiSlider(); 52 52 53 53 public slots: 54 // void setSliderValue(float);54 // void setSliderValue(float); 55 55 56 56 signals: 57 // void sliderValueChanged(float);57 // void sliderValueChanged(float); 58 58 }; 59 59 … … 63 63 Q_OBJECT 64 64 65 66 QtGuiComboBox(const std::string& name );65 public: 66 QtGuiComboBox(const std::string& name, SaveableGroup* group); 67 67 68 68 virtual void load(const MultiType& value);
Note: See TracChangeset
for help on using the changeset viewer.