Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7855 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
May 25, 2006, 3:42:18 PM (19 years ago)
Author:
bensch
Message:

qtgui: cleanup as patrick sugested

Location:
trunk/src/lib/gui
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl_gui/Makefile.am

    r6287 r7855  
    1111libORXglgui_a_SOURCES = glmenu/glmenu_imagescreen.cc \
    1212                        glgui_handler.cc \
     13                        signal_connector.cc \
    1314                        glgui_mainwidget.cc \
    1415                        glgui_widget.cc \
     
    2324
    2425noinst_HEADERS= glmenu/glmenu_imagescreen.h \
     26                signal_connector.h \
    2527                glgui.h \
    2628                glgui_handler.h \
  • trunk/src/lib/gui/gl_gui/glgui.h

    r7779 r7855  
    88#include "glgui_widget.h"
    99
     10#include "glgui_bar.h"
     11#include "glgui_box.h"
     12#include "glgui_button.h"
     13#include "glgui_checkbutton.h"
     14#include "glgui_colorselector.h"
     15
    1016namespace OrxGui
    1117{
     18
    1219
    1320};
  • trunk/src/lib/gui/gl_gui/glgui_widget.cc

    r7779 r7855  
    5858    this->frontModel = 0;
    5959
    60     this->widgetSignals.resize(GLGuiSignalCount, NULL);
     60    this->widgetSignals.resize(SignalCount, SignalConnector());
    6161  }
    6262
     
    6464  bool GLGuiWidget::focusOverWidget(float x, float y)
    6565  {
    66     if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x+ this->getSizeX2D() > x &&
    67         this->getAbsCoor2D().y < y && this->getAbsCoor2D().y+ this->getSizeX2D() > y)
     66    if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x + this->getSizeX2D() > x &&
     67        this->getAbsCoor2D().y < y && this->getAbsCoor2D().y + this->getSizeY2D() > y)
    6868      return true;
    6969    else
     
    7676   * @param signal the name of the Signal
    7777   */
    78   void GLGuiWidget::connectSignal(GLGuiSignalType signalType, BaseObject*, const Executor* signal)
     78  void GLGuiWidget::connectSignal(SignalType signalType, BaseObject* object, const Executor* signal)
    7979  {
    80     if (signalType >= GLGuiSignalCount)
     80    if (signalType >= this->widgetSignals.size())
    8181      return;
    8282
    83     if (this->widgetSignals[signalType] != NULL)
    84       PRINTF(2)("Already connected a Signal to '%s::%s' type %s... overwriting\n", this->getClassName(), this->getName(), "TEST");
     83//    if (this->widgetSignals[signalType] != NULL)
     84//      PRINTF(2)("Already connected a Signal to '%s::%s' type %s... overwriting\n", this->getClassName(), this->getName(), "TEST");
    8585
    86     //this->widgetSignals[signalType] = ;
     86    this->widgetSignals[signalType] = SignalConnector(object, signal);
    8787  }
    8888
     
    9191   * @param signalType the type of Signal to remove.
    9292   */
    93   void GLGuiWidget::disconnectSignal(GLGuiSignalType signalType)
     93  void GLGuiWidget::disconnectSignal(SignalType signalType)
    9494  {
    95     if (signalType > GLGuiSignalCount)
     95    if (signalType >= this->widgetSignals.size())
    9696      return;
    9797
    98     this->widgetSignals[signalType] = NULL;
     98    this->widgetSignals[signalType] = SignalConnector();
    9999  }
    100100
  • trunk/src/lib/gui/gl_gui/glgui_widget.h

    r7779 r7855  
    2222  typedef enum
    2323  {
    24     GLGuiSignal_click     = 0,
    25     GLGuiSignal_release,
    26     GLGuiSignal_rollOn,
    27     GLGuiSignal_rollOff,
    28     GLGuiSignal_open,
    29     GLGuiSignal_close,
    30     GLGuiSignal_destroy,
     24    Signal_click     = 0,
     25    Signal_release,
     26    Signal_rollOn,
     27    Signal_rollOff,
     28    Signal_open,
     29    Signal_close,
     30    Signal_destroy,
    3131
    32     GLGuiSignalCount,
    33   } GLGuiSignalType;
     32    SignalCount,
     33  } SignalType;
     34
    3435
    3536  //! if the Element should be visible by default.
     
    5152    void hide();
    5253
    53     void connectSignal(GLGuiSignalType signalType, BaseObject* obj, const Executor* signal);
    54     void disconnectSignal(GLGuiSignalType signalType);
     54    void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal);
     55    void disconnectSignal(SignalType signalType);
    5556    bool focusOverWidget(float x, float y);
    5657
    5758    // if something was clickt on the GUI-widget.
    58     virtual void click(const Event& event) {};
    59     virtual void release(const Event& event) {};
     59    virtual void clicked(const Event& event) {};
     60    virtual void released(const Event& event) {};
    6061
    61     virtual void receiveFocus() {};
    62     virtual void removeFocus() {};
     62    virtual void receivedFocus() {};
     63    virtual void removedFocus() {};
     64
     65    virtual void destroyed() {};
    6366
    6467    virtual void update() {};
     
    7578    void init();
    7679
     80
     81
     82
    7783  protected:
    7884    Material               backMat;
     
    8389
    8490  private:
    85     std::vector<SignalConnector*> widgetSignals;
     91    std::vector<SignalConnector> widgetSignals;
    8692
    8793    bool                   focusable;        //!< If this widget can receive focus.
  • trunk/src/lib/gui/gl_gui/signal_connector.cc

    r7779 r7855  
    2121{
    2222
     23  SignalConnector::SignalConnector( )
     24  {
     25    this->object = NULL;
     26    this->exec = NULL;
     27  }
     28
    2329  SignalConnector::SignalConnector(BaseObject* object, const Executor* executor)
    24       : object(object), exec(exec)
    25   {};
     30  {
     31    this->object = object;
     32    this->exec = executor;
     33  };
     34
     35  SignalConnector::SignalConnector(const SignalConnector& signalConnector)
     36  {
     37    this->object = signalConnector.object;
     38    this->exec = (signalConnector.exec == NULL) ? NULL : signalConnector.exec->clone();
     39  }
     40
     41  SignalConnector::~SignalConnector()
     42  {
     43    delete exec;
     44  }
     45
     46  SignalConnector& SignalConnector::operator=(const SignalConnector& signalConnector)
     47  {
     48    delete this->exec;
     49    this->object = signalConnector.object;
     50    this->exec = (signalConnector.exec == NULL) ? NULL : signalConnector.exec->clone();
     51  }
     52
     53  void SignalConnector::operator()(const std::string& parameters) const
     54  {
     55    if (exec != NULL && object != NULL)
     56      (*this->exec)(this->object, parameters);
     57  }
     58
    2659}
  • trunk/src/lib/gui/gl_gui/signal_connector.h

    r7779 r7855  
    11/*!
    22 * @file signal_connector.h
    3  * @brief Definition of ...
     3 * @brief Definition of a SignalConnector class
    44*/
    55
     
    1111namespace OrxGui
    1212{
    13   //! A class for ...
     13  //! A class for Conncting Signals to Objects, inside of the GUI
    1414  class SignalConnector
    1515  {
    1616  public:
     17    SignalConnector();
    1718    SignalConnector(BaseObject* object, const Executor* exec);
    1819    SignalConnector(const SignalConnector& signalConnector);
    19     ~SignalConnector() { delete exec; }
     20    ~SignalConnector();
    2021
    2122    SignalConnector& operator=(const SignalConnector& signalConnector);
    2223
     24    void operator()(const std::string& parameters) const;
     25    void execute(const std::string& parameters) const { (*this)(parameters); };
     26
     27    bool isClean() const { return (this->object == NULL || this->exec == NULL); }
     28
     29
    2330  private:
    24     const Executor*     exec;
    25     BaseObject*         object;
     31    BaseObject*          object;         //!< The object to call.
     32    const Executor*      exec;           //!< The Executor, that will be called, on object.
    2633  };
    2734}
  • trunk/src/lib/gui/qt_gui/gui_audio.cc

    r7661 r7855  
    5353      QtGuiComboBox* soundCard = new QtGuiComboBox(CONFIG_NAME_SOUNDCARD, this, "");
    5454      layout->addWidget(soundCard, 0, 2);
     55      soundCard->addItem("Not supportet yet");
     56
    5557
    5658
  • trunk/src/lib/gui/qt_gui/gui_general.cc

    r7661 r7855  
    6060
    6161      debug->addItem("0 - minimal");
    62 #if DEBUG >=1
     62#if DEBUG_LEVEL >=1
    6363      debug->addItem("1 - errors");
    6464#endif
    65 #if DEBUG >=2
     65#if DEBUG_LEVEL >=2
    6666      debug->addItem("2 - warnings");
    6767#endif
    68 #if DEBUG >=3
     68#if DEBUG_LEVEL >=3
    6969      debug->addItem("3 - information");
    7070#endif
    71 #if DEBUG >=4
     71#if DEBUG_LEVEL >=4
    7272      debug->addItem("4 - debug");
    7373#endif
    74 #if DEBUG >=5
     74#if DEBUG_LEVEL >=5
    7575      debug->addItem("5 - extremely debug");
    7676#endif
  • trunk/src/lib/gui/qt_gui/qt_gui.cc

    r7661 r7855  
    2525#include "q_image_widget.h"
    2626
     27#include "gui_general.h"
    2728#include "gui_video.h"
    2829#include "gui_audio.h"
    2930#include "gui_control.h"
    30 #include "gui_general.h"
    3131
    3232#include "banner.xpm"
     
    5353      QToolBox* toolBox = new QToolBox(groupBox);
    5454      {
    55 
     55        toolBox->addItem(new GuiGeneral(this), "General");
    5656        toolBox->addItem(new GuiVideo(this), "Video");
    5757        toolBox->addItem(new GuiAudio(this), "Audio");
    5858        toolBox->addItem(new GuiControl(this), "Control");
    59         toolBox->addItem(new GuiGeneral(this), "General");
    6059      }
    6160      mainLayout->addWidget(toolBox,1,1, 1, 3);
Note: See TracChangeset for help on using the changeset viewer.