Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7598 in orxonox.OLD for branches/qt_gui/src/lib/gui


Ignore:
Timestamp:
May 11, 2006, 5:37:13 PM (19 years ago)
Author:
bensch
Message:

qt_gui: loading works so far for the CheckBox

Location:
branches/qt_gui/src/lib/gui
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/lib/gui/gui.cc

    r7555 r7598  
    1717
    1818#include "gui.h"
     19#include "gui_saveable.h"
     20
    1921
    2022namespace OrxGui
     
    4042  }
    4143
     44
     45  void Gui::loadAll()
     46  {
     47    std::vector<SaveableGroup*>::iterator loadElem;
     48    for (loadElem = this->groups.begin(); loadElem != this->groups.end(); ++loadElem)
     49    {
     50      (*loadElem)->load();
     51    }
     52
     53  }
     54
     55  void Gui::saveAll()
     56  {
     57
     58  }
    4259
    4360  /**
  • branches/qt_gui/src/lib/gui/gui.h

    r7555 r7598  
    4242
    4343    unsigned int getState() const { return this->state; };
    44 
     44    void loadAll();
     45    void saveAll();
    4546
    4647    void addSaveableGroup(SaveableGroup* saveableGroup);
  • branches/qt_gui/src/lib/gui/gui_saveable.cc

    r7595 r7598  
    5555
    5656
    57   void Saveable::load(const MultiType& value)
     57  void Saveable::load()
    5858  {
    59     Preferences::getInstance()->setMultiType(this->group->getName(), this->getName(), value);
     59    this->value() = Preferences::getInstance()->getMultiType(this->group->getName(), this->getName(), this->_value);
     60    PRINTF(4)("Loaded to '%s' of group '%s' value ", this->getName(), this->group->getName());
     61    this->value().debug();
     62
    6063  }
    6164
    62   const MultiType& Saveable::save()
     65  void Saveable::save()
    6366  {
    64     Preferences::getInstance()->getMultiType(this->group->getName(), this->getName(), 0);
     67    Preferences::getInstance()->setMultiType(this->group->getName(), this->getName(), this->value());
    6568  }
    6669
     
    112115   * @param value the Value to load.
    113116   */
    114   void SaveableGroup::load(const MultiType& value)
     117  void SaveableGroup::load()
    115118  {
     119    std::vector<Saveable*>::iterator elem;
     120    for (elem = this->saveables.begin(); elem != this->saveables.end(); ++elem)
     121      (*elem)->load();
    116122  }
    117123
     
    120126   * @returns nothing.
    121127   */
    122   const MultiType& SaveableGroup::save()
     128  void SaveableGroup::save()
    123129  {}
    124130
  • branches/qt_gui/src/lib/gui/gui_saveable.h

    r7595 r7598  
    2525    void makeSaveable();
    2626
    27     virtual void load(const MultiType& value);
    28     virtual const MultiType& save();
     27    virtual void load();
     28    virtual void save();
    2929
    3030    MultiType&       value() { return this->_value; };
     
    5252    void removeSaveable(Saveable* saveable);
    5353
    54     virtual void load(const MultiType& value);
    55     virtual const MultiType& save();
     54    virtual void load();
     55    virtual void save();
    5656
    5757  protected:
  • branches/qt_gui/src/lib/gui/qt_gui/gui_video.cc

    r7555 r7598  
    2828
    2929#include <QtGui/QLayout>
    30 #include "sdlincl.h"
     30#include "globals.h"
    3131#include "debug.h"
    3232
     
    3939  */
    4040  GuiVideo::GuiVideo(OrxGui::Gui* gui)
    41       : Element("Video", gui), QGroupBox()
     41  : Element(CONFIG_SECTION_VIDEO, gui), QGroupBox()
    4242  {
    4343    QGridLayout* layout = new QGridLayout(this);
    4444
    4545    {
    46       QtGuiCheckBox* fullscreen = new QtGuiCheckBox("FullScreen", this);
     46      QtGuiCheckBox* fullscreen = new QtGuiCheckBox(CONFIG_NAME_FULLSCREEN, this);
    4747      //fullscreen->setName();
    4848      layout->addWidget(fullscreen, 0, 0);
    4949
    50       QtGuiCheckBox* wireframe = new QtGuiCheckBox("Wireframe mode", this);
     50      QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this);
    5151      layout->addWidget(wireframe, 1, 0);
    5252
     
    6161
    6262
    63       QGroupBox* advanced = new QGroupBox("advanced");
    64       {
    65         QGridLayout* advLayout = new QGridLayout(advanced);              //!< Advanced Layout
    66         {
    67           QtGuiCheckBox* shadows = new QtGuiCheckBox("Shadows", this);         //!< CheckBox for shadows
    68           advLayout->addWidget(shadows, 0,0);
    69           QtGuiCheckBox* fog = new QtGuiCheckBox("Fog", this);                 //!< CheckBox for fog.
    70           advLayout->addWidget(fog, 1,0);
    71           QtGuiCheckBox* reflections = new QtGuiCheckBox("reflections", this);  //!< CheckBox for reflections
    72           advLayout->addWidget(reflections, 2, 0);
    73           QtGuiCheckBox* textures = new QtGuiCheckBox("textures", this);       //!< CheckBox for textures
    74           advLayout->addWidget(textures, 3, 0);
    75           /*
    76           Menu* textureDetail;      //!< Menu for the Texture-Detail.
    77           Label* modelDetailLabel;  //!< Label for model-detail.
    78           Menu* modelDetail;        //!< model-detail.
    79           CheckBox* particles;   //!< If the Particles should be enabled
    80           Label* antiAliasingLabel; //!< Label for the anti-aliasing mode.
    81           Menu* antiAliasing;       //!< Menu for the Antialiasing-mode.
    82           Label* filterMethodLabel; //!< Label for filtering-Method.
    83           Menu* filterMethod;       //!< Menu for filtering Method.
    84           Button* closeButton;      //!< A Button to close the Advanced-settingsWindow.
    85           */
    86         }
    87       }
     63      QGroupBox* advanced = new GuiAdvancedVideo(gui);
     64
    8865
    8966      layout->addWidget(advanced, 0, 2, 4, 1);
     
    146123  }
    147124
     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);         //!< CheckBox for shadows
     134        advLayout->addWidget(shadows, 0,0);
     135        QtGuiCheckBox* fog = new QtGuiCheckBox(CONFIG_NAME_FOG, this);                 //!< CheckBox for fog.
     136        advLayout->addWidget(fog, 1,0);
     137        QtGuiCheckBox* reflections = new QtGuiCheckBox(CONFIG_NAME_REFLECTIONS, this);  //!< CheckBox for reflections
     138        advLayout->addWidget(reflections, 2, 0);
     139        QtGuiCheckBox* textures = new QtGuiCheckBox(CONFIG_NAME_TEXTURES, this);       //!< 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
    148160}
  • branches/qt_gui/src/lib/gui/qt_gui/gui_video.h

    r7549 r7598  
    2323    void getResolutions(std::vector<QString>& resolutionList);
    2424  };
     25
     26  class GuiAdvancedVideo : public OrxGui::Element, public QGroupBox
     27  {
     28    public:
     29      GuiAdvancedVideo(OrxGui::Gui* gui);
     30      virtual ~GuiAdvancedVideo();
     31  };
    2532}
    2633
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc

    r7594 r7598  
    7373    this->mainWindow->show();
    7474
     75    this->loadAll();
    7576    this->exec();
     77
    7678  }
    7779
     
    8284
    8385  void QtGui::startGui()
    84   {}
     86  {
     87  }
    8588
    8689  void QtGui::stopGui()
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.cc

    r7585 r7598  
    1818#include "qt_gui_elements.h"
    1919
    20 
    2120namespace OrxGui
    2221{
     
    3029  }
    3130
    32   void QtGuiCheckBox::load(const MultiType& value)
     31  void QtGuiCheckBox::load()
    3332  {
    34     this->setTristate(value.getBool());
    35     this->value() = value;
     33    Saveable::load();
     34    if (this->value().getBool())
     35      this->setCheckState(Qt::Checked);
     36    else
     37      this->setCheckState(Qt::Unchecked);
    3638  }
    3739
    3840
    3941
    40   const MultiType& QtGuiCheckBox::save()
     42  void QtGuiCheckBox::save()
    4143  {
    42     return this->value();
    4344  }
    4445
     
    6970  }
    7071
    71   void QtGuiComboBox::load(const MultiType& value)
     72  void QtGuiComboBox::load()
    7273  {
    73     this->value() = value;
    7474    //TODO
    7575  }
    7676
    77   const MultiType& QtGuiComboBox::save()
     77  void QtGuiComboBox::save()
    7878  {
    79     return this->value();
    8079  }
    8180
     
    8988
    9089
    91   void QtGuiInputLine::load(const MultiType& value)
     90  void QtGuiInputLine::load()
    9291  {
    93     this->setText(value.getString().c_str());
    94     this->value() = value;
     92    this->setText(this->value().getString().c_str());
    9593  }
    9694
    9795
    9896
    99   const MultiType& QtGuiInputLine::save()
     97  void QtGuiInputLine::save()
    10098  {
    101     return this->value();
    10299  }
    103100
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.h

    r7585 r7598  
    3333    virtual ~QtGuiCheckBox() {};
    3434
    35     virtual void load(const MultiType& value);
    36     virtual const MultiType& save();
     35    virtual void load();
     36    virtual void save();
    3737
    3838  public slots:
     
    6666    QtGuiComboBox(const std::string& name, SaveableGroup* group);
    6767
    68     virtual void load(const MultiType& value);
    69     virtual const MultiType& save();
     68    virtual void load();
     69    virtual void save();
    7070  };
    7171
     
    7777    QtGuiInputLine(const std::string& name, SaveableGroup* group);
    7878
    79     virtual void load(const MultiType& value);
    80     virtual const MultiType& save();
     79    virtual void load();
     80    virtual void save();
    8181  };
    8282
Note: See TracChangeset for help on using the changeset viewer.