Changeset 7636 in orxonox.OLD for branches/qt_gui/src
- Timestamp:
- May 17, 2006, 10:50:16 AM (19 years ago)
- Location:
- branches/qt_gui/src
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/qt_gui/src/defs/globals.h
r7624 r7636 33 33 //! Name of Section Misc in the config-File 34 34 #define CONFIG_SECTION_MISC "misc" 35 #define CONFIG_SECTION_MISC_KEYS "miscKeys" 36 #define CONFIG_SECTION_PLAYER "player" 35 #define CONFIG_SECTION_CONTROL "control" 37 36 #define CONFIG_SECTION_VIDEO "video" 38 37 #define CONFIG_SECTION_VIDEO_ADVANCED "video_advanced" -
branches/qt_gui/src/lib/event/key_mapper.cc
r7635 r7636 138 138 void KeyMapper::loadKeyBindings(IniParser* iniParser) 139 139 { 140 if( !iniParser->getSection (CONFIG_SECTION_ PLAYER "1"))141 { 142 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_ PLAYER"1\n");140 if( !iniParser->getSection (CONFIG_SECTION_CONTROL)) 141 { 142 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n"); 143 143 return; 144 144 } … … 158 158 159 159 // PARSE MISC SECTION 160 if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS)) 161 { 162 PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n"); 160 // if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS)) 161 // { 162 // PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n"); 163 // return; 164 // } 165 // 166 // iniParser->firstVar(); 167 // while( iniParser->getCurrentName() != "" ) 168 // { 169 // PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue()); 170 // index = nameToIndex (iniParser->getCurrentValue()); 171 // this->mapKeys(iniParser->getCurrentName(), index); 172 // iniParser->nextVar(); 173 // } 174 } 175 176 void KeyMapper::loadKeyBindings() 177 { 178 if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_CONTROL)) 179 { 180 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n"); 163 181 return; 164 182 } 165 166 iniParser->firstVar();167 while( iniParser->getCurrentName() != "" )168 {169 PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());170 index = nameToIndex (iniParser->getCurrentValue());171 this->mapKeys(iniParser->getCurrentName(), index);172 iniParser->nextVar();173 }174 }175 176 void KeyMapper::loadKeyBindings()177 {178 if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_PLAYER "1"))179 {180 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");181 return;182 }183 183 int* index; 184 184 185 std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_ PLAYER "1");185 std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_CONTROL); 186 186 for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ ) 187 187 { 188 PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_ PLAYER "1", *it, "").c_str());188 PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, "").c_str()); 189 189 // map the name to an sdl index 190 index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_ PLAYER "1", *it, ""));190 index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, "")); 191 191 // map the index to a internal name 192 this->mapKeys(*it, index);193 }194 195 196 // PARSE MISC SECTION197 if( !Preferences::getInstance()->sectionExists (CONFIG_SECTION_MISC_KEYS))198 {199 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_MISC_KEYS "\n");200 return;201 }202 203 keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_MISC_KEYS);204 for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )205 {206 PRINTF(3)("MISC: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, "").c_str());207 index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, ""));208 192 this->mapKeys(*it, index); 209 193 } -
branches/qt_gui/src/lib/gui/Makefile.am
r7608 r7636 23 23 SUBDIRS = \ 24 24 . \ 25 gtk_gui \26 25 gl_gui \ 27 26 qt_gui 27 28 # gtk_gui -
branches/qt_gui/src/lib/gui/qt_gui/Makefile.am
r7608 r7636 25 25 gui_audio.cc \ 26 26 gui_general.cc \ 27 gui_general_moc.cc 27 gui_general_moc.cc \ 28 gui_control.cc \ 29 gui_control_moc.cc 28 30 29 31 … … 35 37 gui_video.h \ 36 38 gui_audio.h \ 37 gui_general.cc 39 gui_general.h \ 40 gui_control.h 38 41 39 42 -
branches/qt_gui/src/lib/gui/qt_gui/gui_audio.cc
r7634 r7636 45 45 46 46 { 47 QtGuiCheckBox* fullscreen = new QtGuiCheckBox(CONFIG_NAME_DISABLE_AUDIO, this, true);48 layout->addWidget( fullscreen, 0, 0);47 QtGuiCheckBox* disableAudio = new QtGuiCheckBox(CONFIG_NAME_DISABLE_AUDIO, this, false); 48 layout->addWidget(disableAudio, 0, 0); 49 49 50 50 -
branches/qt_gui/src/lib/gui/qt_gui/gui_control.cc
r7633 r7636 25 25 26 26 27 #include "gui_ video.h"27 #include "gui_control.h" 28 28 29 29 #include <QtGui/QLayout> 30 30 #include "globals.h" 31 31 #include "debug.h" 32 #include "qt_gui_elements.h" 32 33 33 #include "qt_gui_elements.h" 34 #include "lib/event/key_mapper.h" 35 #include "lib/event/key_names.h" 34 36 35 37 namespace OrxGui 36 38 { 37 39 /** 38 * Creates the Video-Option-Frame40 * Creates the Control-Option-Frame 39 41 */ 40 Gui Video::GuiVideo(OrxGui::Gui* gui)41 : Element(CONFIG_SECTION_VIDEO, gui), QGroupBox()42 GuiControl::GuiControl(OrxGui::Gui* gui) 43 : Element(CONFIG_SECTION_CONTROL, gui), QGroupBox() 42 44 { 43 45 QGridLayout* layout = new QGridLayout(this); 44 46 45 47 { 46 QtGuiCheckBox* fullscreen = new QtGuiCheckBox(CONFIG_NAME_FULLSCREEN, this, false); 47 //fullscreen->setName(); 48 layout->addWidget(fullscreen, 0, 0); 49 50 QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this, false); 51 layout->addWidget(wireframe, 1, 0); 52 53 { 54 QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this, "640x480"); 55 layout->addWidget(resolution, 2, 0); 56 std::vector<QString> resolutions; 57 this->getResolutions(resolutions); 58 for (unsigned int i = 0; i < resolutions.size(); ++i) 59 resolution->addItem(resolutions[i]); 60 } 48 QLabel* keyLabel = new QLabel; 61 49 62 50 63 QGroupBox* advanced = new GuiAdvancedVideo(gui);64 51 65 52 66 layout->addWidget(advanced, 0, 2, 4, 1);53 } 67 54 68 } 55 69 56 } 70 57 71 58 /** 72 * Destructs the Video-stuff59 * Destructs the Control-stuff 73 60 */ 74 Gui Video::~GuiVideo()61 GuiControl::~GuiControl() 75 62 { 76 63 // nothing to do here. 77 64 } 78 65 79 /**80 * sets all resolutions to the menu81 * @param menu the Menu to set The resolutions to.82 */83 void GuiVideo::getResolutions(std::vector<QString>& resolutionList)84 {85 SDL_Init(SDL_INIT_VIDEO);86 SDL_Rect **modes;87 int i;88 int x = 0,y =0; // check for difference89 char tmpChar[100];90 91 /* Get available fullscreen/hardware modes */92 modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);93 94 /* Check is there are any modes available */95 if(modes == (SDL_Rect **)0)96 {97 PRINTF(2)("No video-modes available!\n");98 exit(-1);99 }100 101 /* Check if our resolution is restricted */102 if(modes == (SDL_Rect **)-1)103 {104 PRINTF(2)("All resolutions available.\n");105 }106 else107 {108 /* Print valid modes */109 PRINT(5)("Available Modes\n");110 for(i = 0; modes[i] ;++i)111 {112 if (x != modes[i]->w || y != modes[i]->h)113 {114 PRINTF(5)(" %d x %d\n", modes[i]->w, modes[i]->h);115 sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h);116 resolutionList.push_back(QString(tmpChar));117 x = modes[i]->w; y = modes[i]->h;118 }119 }120 }121 SDL_QuitSubSystem(SDL_INIT_VIDEO);122 SDL_Quit();123 }124 125 126 127 GuiAdvancedVideo::GuiAdvancedVideo(OrxGui::Gui* gui)128 : Element(CONFIG_SECTION_VIDEO_ADVANCED ,gui)129 {130 {131 QGridLayout* advLayout = new QGridLayout(this); //!< Advanced Layout132 {133 QtGuiCheckBox* shadows = new QtGuiCheckBox(CONFIG_NAME_SHADOWS, this, true); //!< CheckBox for shadows134 advLayout->addWidget(shadows, 0,0);135 QtGuiCheckBox* fog = new QtGuiCheckBox(CONFIG_NAME_FOG, this, true); //!< CheckBox for fog.136 advLayout->addWidget(fog, 1,0);137 QtGuiCheckBox* reflections = new QtGuiCheckBox(CONFIG_NAME_REFLECTIONS, this, true); //!< CheckBox for reflections138 advLayout->addWidget(reflections, 2, 0);139 QtGuiCheckBox* textures = new QtGuiCheckBox(CONFIG_NAME_TEXTURES, this, true); //!< CheckBox for textures140 advLayout->addWidget(textures, 3, 0);141 /*142 Menu* textureDetail; //!< Menu for the Texture-Detail.143 Label* modelDetailLabel; //!< Label for model-detail.144 Menu* modelDetail; //!< model-detail.145 CheckBox* particles; //!< If the Particles should be enabled146 Label* antiAliasingLabel; //!< Label for the anti-aliasing mode.147 Menu* antiAliasing; //!< Menu for the Antialiasing-mode.148 Label* filterMethodLabel; //!< Label for filtering-Method.149 Menu* filterMethod; //!< Menu for filtering Method.150 Button* closeButton; //!< A Button to close the Advanced-settingsWindow.151 */152 }153 }154 }155 156 GuiAdvancedVideo::~GuiAdvancedVideo()157 {158 }159 160 66 } -
branches/qt_gui/src/lib/gui/qt_gui/gui_control.h
r7633 r7636 1 1 /*! 2 \file gui_ video.h3 \brief File that holds the class that creates the Video-Options.2 \file gui_control.h 3 \brief File that holds the class that creates the Control-Options. 4 4 */ 5 #ifndef _GUI_ VIDEO_H6 #define _GUI_ VIDEO_H5 #ifndef _GUI_CONTROL_H 6 #define _GUI_CONTROL_H 7 7 8 8 #include "../gui_element.h" … … 10 10 #include <string> 11 11 #include <QtGui/QGroupBox> 12 #include "../gui_saveable.h" 12 13 13 14 namespace OrxGui 14 15 { 15 //! Class that creates the Video-Options.16 class Gui Video: public OrxGui::Element, public QGroupBox16 //! Class that creates the Control-Options. 17 class GuiControl : public OrxGui::Element, public QGroupBox 17 18 { 18 19 public: 19 Gui Video(OrxGui::Gui* gui);20 virtual ~Gui Video();20 GuiControl(OrxGui::Gui* gui); 21 virtual ~GuiControl(); 21 22 22 23 private: 23 void getResolutions(std::vector<QString>& resolutionList);24 24 }; 25 25 26 class Gui AdvancedVideo : public OrxGui::Element, public QGroupBox26 class GuiControlInput : public QGroupBox, public OrxGui::Saveable 27 27 { 28 public: 29 GuiAdvancedVideo(OrxGui::Gui* gui); 30 virtual ~GuiAdvancedVideo(); 28 Q_OBJECT 29 GuiControlInput(const std::string& name, SaveableGroup* group, const std::string& defaultValue); 30 31 public slots: 32 33 signals: 34 void optionChanged(); 31 35 }; 36 32 37 } 33 38 34 #endif /* _GUI_ VIDEO_H */39 #endif /* _GUI_CONTROL_H */ -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc
r7632 r7636 23 23 24 24 #include "qt_gui_elements.h" 25 #include "q_image_widget.h" 26 25 27 #include "gui_video.h" 26 28 #include "gui_audio.h" 29 #include "gui_control.h" 27 30 #include "gui_general.h" 31 28 32 #include "banner.xpm" 29 #include <QtGui/QPainter>30 #include "q_image_widget.h"31 33 32 34 namespace OrxGui … … 54 56 toolBox->addItem(new GuiVideo(this), "Video"); 55 57 toolBox->addItem(new GuiAudio(this), "Audio"); 58 toolBox->addItem(new GuiControl(this), "Control"); 56 59 toolBox->addItem(new GuiGeneral(this), "General"); 57 60 }
Note: See TracChangeset
for help on using the changeset viewer.