Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7636 in orxonox.OLD for branches/qt_gui/src


Ignore:
Timestamp:
May 17, 2006, 10:50:16 AM (19 years ago)
Author:
bensch
Message:

orxonox/qt_gui: more gui-elements

Location:
branches/qt_gui/src
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/defs/globals.h

    r7624 r7636  
    3333//! Name of Section Misc in the config-File
    3434#define   CONFIG_SECTION_MISC              "misc"
    35 #define   CONFIG_SECTION_MISC_KEYS         "miscKeys"
    36 #define   CONFIG_SECTION_PLAYER            "player"
     35#define   CONFIG_SECTION_CONTROL           "control"
    3736#define   CONFIG_SECTION_VIDEO             "video"
    3837#define   CONFIG_SECTION_VIDEO_ADVANCED    "video_advanced"
  • branches/qt_gui/src/lib/event/key_mapper.cc

    r7635 r7636  
    138138void KeyMapper::loadKeyBindings(IniParser* iniParser)
    139139{
    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");
    143143    return;
    144144  }
     
    158158
    159159  // 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
     176void KeyMapper::loadKeyBindings()
     177{
     178  if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_CONTROL))
     179  {
     180    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n");
    163181    return;
    164182  }
    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   }
    183183  int* index;
    184184
    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);
    186186  for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
    187187  {
    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());
    189189    // 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, ""));
    191191    // map the index to a internal name
    192     this->mapKeys(*it, index);
    193   }
    194 
    195 
    196   // PARSE MISC SECTION
    197   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, ""));
    208192    this->mapKeys(*it, index);
    209193  }
  • branches/qt_gui/src/lib/gui/Makefile.am

    r7608 r7636  
    2323SUBDIRS = \
    2424        . \
    25         gtk_gui \
    2625        gl_gui \
    2726        qt_gui
     27
     28#       gtk_gui
  • branches/qt_gui/src/lib/gui/qt_gui/Makefile.am

    r7608 r7636  
    2525                gui_audio.cc \
    2626                gui_general.cc \
    27                 gui_general_moc.cc
     27                gui_general_moc.cc \
     28                gui_control.cc \
     29                gui_control_moc.cc
    2830
    2931
     
    3537                gui_video.h \
    3638                gui_audio.h \
    37                 gui_general.cc
     39                gui_general.h \
     40                gui_control.h
    3841
    3942
  • branches/qt_gui/src/lib/gui/qt_gui/gui_audio.cc

    r7634 r7636  
    4545
    4646    {
    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);
    4949
    5050
  • branches/qt_gui/src/lib/gui/qt_gui/gui_control.cc

    r7633 r7636  
    2525
    2626
    27 #include "gui_video.h"
     27#include "gui_control.h"
    2828
    2929#include <QtGui/QLayout>
    3030#include "globals.h"
    3131#include "debug.h"
     32#include "qt_gui_elements.h"
    3233
    33 #include "qt_gui_elements.h"
     34#include "lib/event/key_mapper.h"
     35#include "lib/event/key_names.h"
    3436
    3537namespace OrxGui
    3638{
    3739  /**
    38    *  Creates the Video-Option-Frame
     40   *  Creates the Control-Option-Frame
    3941  */
    40   GuiVideo::GuiVideo(OrxGui::Gui* gui)
    41   : Element(CONFIG_SECTION_VIDEO, gui), QGroupBox()
     42  GuiControl::GuiControl(OrxGui::Gui* gui)
     43      : Element(CONFIG_SECTION_CONTROL, gui), QGroupBox()
    4244  {
    4345    QGridLayout* layout = new QGridLayout(this);
    4446
    4547    {
    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;
    6149
    6250
    63       QGroupBox* advanced = new GuiAdvancedVideo(gui);
    6451
    6552
    66       layout->addWidget(advanced, 0, 2, 4, 1);
     53    }
    6754
    68     }
     55
    6956  }
    7057
    7158  /**
    72    *  Destructs the Video-stuff
     59   *  Destructs the Control-stuff
    7360  */
    74   GuiVideo::~GuiVideo()
     61  GuiControl::~GuiControl()
    7562  {
    7663    // nothing to do here.
    7764  }
    7865
    79   /**
    80    *  sets all resolutions to the menu
    81    * @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 difference
    89     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     else
    107     {
    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 Layout
    132       {
    133         QtGuiCheckBox* shadows = new QtGuiCheckBox(CONFIG_NAME_SHADOWS, this, true);         //!< CheckBox for shadows
    134         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 reflections
    138         advLayout->addWidget(reflections, 2, 0);
    139         QtGuiCheckBox* textures = new QtGuiCheckBox(CONFIG_NAME_TEXTURES, this, true);       //!< CheckBox for textures
    140         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 enabled
    146         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 
    16066}
  • branches/qt_gui/src/lib/gui/qt_gui/gui_control.h

    r7633 r7636  
    11/*!
    2   \file gui_video.h
    3   \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.
    44*/
    5 #ifndef _GUI_VIDEO_H
    6 #define _GUI_VIDEO_H
     5#ifndef _GUI_CONTROL_H
     6#define _GUI_CONTROL_H
    77
    88#include "../gui_element.h"
     
    1010#include <string>
    1111#include <QtGui/QGroupBox>
     12#include "../gui_saveable.h"
    1213
    1314namespace OrxGui
    1415{
    15   //! Class that creates the Video-Options.
    16   class GuiVideo : public OrxGui::Element, public QGroupBox
     16  //! Class that creates the Control-Options.
     17  class GuiControl : public OrxGui::Element, public QGroupBox
    1718  {
    1819  public:
    19     GuiVideo(OrxGui::Gui* gui);
    20     virtual ~GuiVideo();
     20    GuiControl(OrxGui::Gui* gui);
     21    virtual ~GuiControl();
    2122
    2223  private:
    23     void getResolutions(std::vector<QString>& resolutionList);
    2424  };
    2525
    26   class GuiAdvancedVideo : public OrxGui::Element, public QGroupBox
     26  class GuiControlInput : public QGroupBox, public OrxGui::Saveable
    2727  {
    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();
    3135  };
     36
    3237}
    3338
    34 #endif /* _GUI_VIDEO_H */
     39#endif /* _GUI_CONTROL_H */
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc

    r7632 r7636  
    2323
    2424#include "qt_gui_elements.h"
     25#include "q_image_widget.h"
     26
    2527#include "gui_video.h"
    2628#include "gui_audio.h"
     29#include "gui_control.h"
    2730#include "gui_general.h"
     31
    2832#include "banner.xpm"
    29 #include <QtGui/QPainter>
    30 #include "q_image_widget.h"
    3133
    3234namespace OrxGui
     
    5456        toolBox->addItem(new GuiVideo(this), "Video");
    5557        toolBox->addItem(new GuiAudio(this), "Audio");
     58        toolBox->addItem(new GuiControl(this), "Control");
    5659        toolBox->addItem(new GuiGeneral(this), "General");
    5760      }
Note: See TracChangeset for help on using the changeset viewer.