Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7539 in orxonox.OLD


Ignore:
Timestamp:
May 5, 2006, 10:44:18 AM (18 years ago)
Author:
bensch
Message:

orxonox/qt_gui: elements defined

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

Legend:

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

    r7484 r7539  
    4242    // delete what has to be deleted here
    4343  }
    44 
    45   /**
    46    *  Every GuiElement should set this, or it could result in a SegFault.
    47   */
    48   void Element::setMainWidget(Widget* widget)
    49   {
    50     this->mainWidget = widget;
    51   }
    5244}
  • branches/qt_gui/src/lib/gui/gui_element.h

    r7484 r7539  
    2121    Element(const std::string& name);
    2222    virtual ~Element();
    23 
    24     /** @returns the main Widget of this GuiElement. */
    25     Widget* getWidget() const { return this->mainWidget; }
    26   protected:
    27     void setMainWidget(Widget* widget);
    28 
    29   private:
    30     Widget* mainWidget;
    3123  };
    3224}
  • branches/qt_gui/src/lib/gui/gui_saveable.h

    r7493 r7539  
    2222    void makeSaveable();
    2323
    24     virtual void load(const MultiType& value) = 0;
    25     virtual const MultiType& save() = 0;
     24    virtual void load(const MultiType& value) {};
     25    virtual const MultiType& save() {};
    2626
    27     MultiType&       getValue() { return this->value; };
    28     const MultiType& getValue() const { return this->value; };
     27    MultiType&       value() { return this->_value; };
     28    const MultiType& value() const { return this->_value; };
    2929    bool             isSaveable() const { return this->bSaveable; };
    3030
     
    3434
    3535  private:
    36     MultiType       value;
     36    MultiType       _value;
    3737    bool            bSaveable;
    3838  };
  • branches/qt_gui/src/lib/gui/qt_gui/Makefile.am

    r7495 r7539  
    1616libORXqtgui_a_SOURCES = \
    1717                qt_gui.cc \
     18                qt_gui_elements.cc \
    1819                \
    1920                gui_video.cc \
     
    2223noinst_HEADERS= \
    2324                qt_gui.h \
     25                qt_gui_elements.h \
    2426                \
    2527                gui_video.h \
  • branches/qt_gui/src/lib/gui/qt_gui/gui_audio.cc

    r7534 r7539  
    2828
    2929#include <QtGui/QLayout>
    30 #include "sdlincl.h"
    3130#include "debug.h"
    3231
    33 #include <QtGui/QPushButton>
    34 #include <QtGui/QCheckBox>
    35 #include <QtGui/QComboBox>
     32#include "qt_gui_elements.h"
    3633
    3734namespace OrxGui
     
    4643
    4744    {
    48       QCheckBox* fullscreen = new QCheckBox(QString("Enabled"));
     45      QtGuiCheckBox* fullscreen = new QtGuiCheckBox("Enabled", true);
    4946      //fullscreen->setName();
    5047      layout->addWidget(fullscreen, 0, 0);
    5148
    52       QCheckBox* wireframe = new QCheckBox("Test");
     49      QtGuiCheckBox* wireframe = new QtGuiCheckBox("Test");
    5350      layout->addWidget(wireframe, 1, 0);
    5451
    55       QComboBox* resolution = new QComboBox();
     52      QtGuiComboBox* resolution = new QtGuiComboBox("SoundCard");
    5653      layout->addWidget(resolution, 2, 0);
    5754
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.cc

    r7531 r7539  
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "qt_gui.h"
     18#include "qt_gui_elements.h"
     19
    1920
    2021namespace OrxGui
     
    2324
    2425
     26  QtGuiCheckBox::QtGuiCheckBox(const std::string& name, bool defaultValue)
     27  : QCheckBox(QString().fromStdString(name)), Saveable(name)
     28  {
     29    //this->load(this->value());
     30  }
     31
     32  void QtGuiCheckBox::load(const MultiType& value)
     33  {
     34    this->setTristate(value.getBool());
     35        this->value() = value;
     36  }
    2537
    2638
    27   QtGuiComboBox::QtGuiComboBox(QWidget* parent, const std::string& name)
    28   : QComboBox(parent), Saveable(name)
     39
     40  const MultiType& QtGuiCheckBox::save()
     41  {
     42    return this->value();
     43  }
     44
     45  QtGuiComboBox::QtGuiComboBox(const std::string& name)
     46  : QComboBox(), Saveable(name)
    2947  {
    3048
     
    3250  }
    3351
     52  void QtGuiComboBox::load(const MultiType& value)
     53  {
     54    this->value() = value;
     55    //TODO
     56  }
     57
     58  const MultiType& QtGuiComboBox::save()
     59  {
     60    return this->value();
     61  }
    3462
    3563
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.h

    r7531 r7539  
    77#define __QT_GUI_ELEMENTS_H
    88
    9 #include "base_object.h"
    109#include "../gui_saveable.h"
    1110#include <list>
    1211
    1312// grouping
    14 #include <qgroupbox.h>
    15 #include <qprogressbar.h>
    16 #include <qlabel.h>
     13#include <QtGui/QGroupBox>
     14#include <QtGui/QProgressBar>
     15#include <QtGui/QLabel>
    1716
    1817// events
    19 #include <qpushbutton.h>
     18#include <QtGui/QPushButton>
    2019
    2120// options
    22 #include <qcheckbox.h>
    23 #include <qslider.h>
    24 #include <qlineedit.h>
     21#include <QtGui/QCheckBox>
     22#include <QtGui/QSlider>
     23#include <QtGui/QLineEdit>
     24#include <QtGui/QComboBox>
    2525
    2626namespace OrxGui
    2727{
    28 
    29   class QtGuiWidget : virtual public BaseObject
    30   {
    31   public:
    32   };
    33 
    34 
    35   class QtGuiContainer : public QtGuiWidget
    36   {
    37   public:
    38     virtual bool pack(QtGuiWidget* widget) = 0;
    39 
    40   protected:
    41     QtGuiContainer();
    42     ~QtGuiContainer();
    43 
    44   private:
    45 
    46   };
    47 
    48 
    49   typedef enum Orientation
    50   {
    51     horizontal,
    52     vertical
    53   };
    54 
    55   class QtGuiBox : public QtGuiContainer, public GuiSaveableGroup
    56   {
    57 
    58   public:
    59     QtGuiBox(Orientation orientation);
    60     ~QtGuiBox();
    61 
    62     virtual bool pack(QtGuiWidget* widget);
    63 
    64   private:
    65     std::list<QtGuiWidget*>   children;
    66 
    67   };
    68 
    69   class QtGuiGroupBox : public QtGuiContainer, public GuiSaveableGroup
    70   {
    71   public:
    72     QtGuiGroupBox(const std::string& groupName);
    73     ~QtGuiGroupBox();
    74 
    75     virtual bool pack(QtGuiWidget* widget);
    76 
    77   private:
    78     QtGuiWidget*              child;
    79   };
    80 
    81 
    82 
    83   class QtGuiCheckBox : public QCheckBox, public QtGuiWidget, public GuiSaveable
     28  class QtGuiCheckBox : public QCheckBox, public Saveable
    8429  {
    8530  public:
    8631    QtGuiCheckBox(const std::string& name, bool defaultValue = false);
    87     ~QtGuiCheckBox();
     32    virtual ~QtGuiCheckBox() {};
     33
     34    virtual void load(const MultiType& value);
     35    virtual const MultiType& save();
    8836
    8937  public slots:
     
    9442  };
    9543
    96 
    97   class QtGuiPushButtom : public QPushButton, public QtGuiWidget
    98   {
    99   public:
    100     QtGuiPushButtom();
    101     ~QtGuiPushButtom();
    102   };
    103 
    104   class QtGuiSlider : public QSlider, public QtGuiWidget, public GuiSaveable
     44  class QtGuiSlider : public QSlider, public Saveable
    10545  {
    10646  public:
    10747    QtGuiSlider();
    108     ~QtGuiSlider();
     48    virtual ~QtGuiSlider() {};
    10949
    11050  public slots:
     
    11858  class QtGuiComboBox : public QComboBox, public OrxGui::Saveable
    11959  {
    120     QtGuiComboBox(QWidget* parent, const std::string& name);
    121   }
     60    public:
     61    QtGuiComboBox(const std::string& name);
    12262
    123 
    124 
    125   class QtGuiTextLine : public QLineEdit, public QtGuiWidget, public GuiSaveable
    126   {
    127   public:
    128     QtGuiTextLine();
    129     ~QtGuiTextLine();
    130 
    131   public slots:
    132     void setTextLineValue(const char*);
    133   signals:
    134     void textLineChanged(const char*);
     63    virtual void load(const MultiType& value);
     64    virtual const MultiType& save();
    13565  };
    13666
    137 
    138 
    139   class QtGuiImage : public QtGuiWidget
    140   {
    141   }
    142   ;
    14367}
    14468
Note: See TracChangeset for help on using the changeset viewer.