Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7632 in orxonox.OLD


Ignore:
Timestamp:
May 17, 2006, 9:23:45 AM (18 years ago)
Author:
bensch
Message:

Saving and defaultValues introduced

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

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/lib/graphics/graphics_engine.cc

    r7428 r7632  
    155155{
    156156  // looking if we are in fullscreen-mode
    157   const std::string fullscreen = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_FULLSCREEN, "0");
    158 
    159   if (fullscreen[0] == '1' || fullscreen == "true")
     157  MultiType fullscreen = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_FULLSCREEN, "0");
     158
     159  if (fullscreen.getBool())
    160160    this->fullscreenFlag = SDL_FULLSCREEN;
    161161
    162162  // looking if we are in fullscreen-mode
    163   const std::string textures = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO_ADVANCED, CONFIG_NAME_TEXTURES, "0");
    164   if (textures[0] == '1' || textures == "true")
    165     Texture::setTextureEnableState(true);
    166   else
    167     Texture::setTextureEnableState(false);
     163  MultiType textures = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO_ADVANCED, CONFIG_NAME_TEXTURES, "1");
     164    Texture::setTextureEnableState(textures.getBool());
    168165
    169166  // searching for a usefull resolution
  • branches/qt_gui/src/lib/gui/gui_saveable.cc

    r7630 r7632  
    2626   * standard constructor
    2727  */
    28   Saveable::Saveable (const std::string& optionName, SaveableGroup* group)
     28  Saveable::Saveable (const std::string& optionName, SaveableGroup* group, const MultiType& defaultValue)
    2929  : BaseObject(optionName)
    3030  {
    3131    this->bSaveable = false;
     32    this->_defaultValue = defaultValue;
    3233
    3334    assert(group != NULL);
  • branches/qt_gui/src/lib/gui/gui_saveable.h

    r7608 r7632  
    3333
    3434  protected:
    35     Saveable(const std::string& optionName, SaveableGroup* group);
     35    Saveable(const std::string& optionName, SaveableGroup* group, const MultiType& defaultValue);
    3636    virtual void makingElementSaveable() {};
    3737
     
    3939    SaveableGroup*  group;
    4040    MultiType       _value;
     41    MultiType       _defaultValue;
    4142    bool            bSaveable;
    4243  };
  • branches/qt_gui/src/lib/gui/qt_gui/gui_audio.cc

    r7608 r7632  
    5151      QLabel* soundCardLabel = new QLabel("Soundcard");
    5252      layout->addWidget(soundCardLabel, 1,1);
    53       QtGuiComboBox* soundCard = new QtGuiComboBox(CONFIG_NAME_SOUNDCARD, this);
     53      QtGuiComboBox* soundCard = new QtGuiComboBox(CONFIG_NAME_SOUNDCARD, this, "");
    5454      layout->addWidget(soundCard, 2, 1);
    5555
    5656
    57       QtGuiSlider* channels = new QtGuiSlider(CONFIG_NAME_AUDIO_CHANNELS, this, Qt::Vertical);
     57      QtGuiSlider* channels = new QtGuiSlider(CONFIG_NAME_AUDIO_CHANNELS, this, 16, Qt::Vertical);
    5858      layout->addWidget(channels, 0, 0, 2, 1);
    5959      QLabel* channelsLabel = new QLabel("Channels");
     
    6666      QLabel* musicLabel = new QLabel("Music Volume");
    6767      layout->addWidget(musicLabel, 0, 2);
    68       QtGuiSlider* musicVolume = new QtGuiSlider(CONFIG_NAME_MUSIC_VOLUME, this);
     68      QtGuiSlider* musicVolume = new QtGuiSlider(CONFIG_NAME_MUSIC_VOLUME, this, 80);
    6969      layout->addWidget(musicVolume, 1, 2);
    7070
     
    7272      QLabel* effectsLabel = new QLabel("Effects Volume");
    7373      layout->addWidget(effectsLabel, 2,2);
    74       QtGuiSlider* effectVolume = new QtGuiSlider(CONFIG_NAME_EFFECTS_VOLUME, this);
     74      QtGuiSlider* effectVolume = new QtGuiSlider(CONFIG_NAME_EFFECTS_VOLUME, this, 80);
    7575      layout->addWidget(effectVolume, 3, 2);
    7676    }
  • branches/qt_gui/src/lib/gui/qt_gui/gui_general.cc

    r7608 r7632  
    4747      QLabel* dataDirLabel = new QLabel("DataDirectory");
    4848      layout->addWidget(dataDirLabel, 0,0);
    49       this->dataDir = new QtGuiInputLine(CONFIG_NAME_DATADIR, this);
     49      this->dataDir = new QtGuiInputLine(CONFIG_NAME_DATADIR, this, DEFAULT_DATA_DIR);
    5050      layout->addWidget(dataDir, 0, 1, 1, 2);
    5151      QPushButton* dataFileDialogButton = new QPushButton("browse");
     
    5656      QLabel* debugLabel = new QLabel("debug-mode");
    5757      layout->addWidget(debugLabel, 1,0);
    58       QtGuiComboBox* debug = new QtGuiComboBox(CONFIG_NAME_DEBUG_LEVEL, this);
     58      QtGuiComboBox* debug = new QtGuiComboBox(CONFIG_NAME_DEBUG_LEVEL, this, "3 - information");
    5959      layout->addWidget(debug, 1, 1, 1, 2);
    6060
  • branches/qt_gui/src/lib/gui/qt_gui/gui_video.cc

    r7608 r7632  
    4444
    4545    {
    46       QtGuiCheckBox* fullscreen = new QtGuiCheckBox(CONFIG_NAME_FULLSCREEN, this);
     46      QtGuiCheckBox* fullscreen = new QtGuiCheckBox(CONFIG_NAME_FULLSCREEN, this, false);
    4747      //fullscreen->setName();
    4848      layout->addWidget(fullscreen, 0, 0);
    4949
    50       QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this);
     50      QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this, false);
    5151      layout->addWidget(wireframe, 1, 0);
    5252
    5353      {
    54         QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this);
     54        QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this, "640x480");
    5555        layout->addWidget(resolution, 2, 0);
    5656        std::vector<QString> resolutions;
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc

    r7608 r7632  
    8181  QtGui::~QtGui()
    8282  {
    83     this->saveAll();
    84 
    8583    delete this->mainWindow;
    8684  }
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.cc

    r7608 r7632  
    2424
    2525  QtGuiCheckBox::QtGuiCheckBox(const std::string& name, SaveableGroup* group, bool defaultValue)
    26   : QCheckBox(QString().fromStdString(name)), Saveable(name, group)
     26  : QCheckBox(QString().fromStdString(name)), Saveable(name, group, defaultValue)
    2727  {
    2828    //this->load(this->value());
     
    5050
    5151
    52   QtGuiSlider::QtGuiSlider(const std::string& name, SaveableGroup* group, Qt::Orientation orientation)
    53   : QSlider(orientation), Saveable(name, group)
     52  QtGuiSlider::QtGuiSlider(const std::string& name, SaveableGroup* group, int defaultValue, Qt::Orientation orientation)
     53  : QSlider(orientation), Saveable(name, group, defaultValue)
    5454  {
    5555
     
    7777
    7878
    79   QtGuiComboBox::QtGuiComboBox(const std::string& name, SaveableGroup* group)
    80   : QComboBox(), Saveable(name, group)
     79  QtGuiComboBox::QtGuiComboBox(const std::string& name, SaveableGroup* group, const std::string& defaultValue)
     80  : QComboBox(), Saveable(name, group, defaultValue)
    8181  {
    8282
     
    9797
    9898
    99   QtGuiInputLine::QtGuiInputLine(const std::string& name, SaveableGroup* group)
    100   : QLineEdit(), Saveable(name, group)
     99  QtGuiInputLine::QtGuiInputLine(const std::string& name, SaveableGroup* group, const std::string& defaultValue)
     100  : QLineEdit(), Saveable(name, group, defaultValue)
    101101  {
    102102
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.h

    r7608 r7632  
    4848
    4949  public:
    50     QtGuiSlider(const std::string& name, SaveableGroup* group, Qt::Orientation orientation = Qt::Horizontal);
     50    QtGuiSlider(const std::string& name, SaveableGroup* group, int defaultValue = 0, Qt::Orientation orientation = Qt::Horizontal);
    5151    virtual ~QtGuiSlider();
    5252
     
    6767
    6868  public:
    69     QtGuiComboBox(const std::string& name, SaveableGroup* group);
     69    QtGuiComboBox(const std::string& name, SaveableGroup* group, const std::string& defaultValue);
    7070
    7171    virtual void load();
     
    7878
    7979  public:
    80     QtGuiInputLine(const std::string& name, SaveableGroup* group);
     80    QtGuiInputLine(const std::string& name, SaveableGroup* group, const std::string& defaultValue);
    8181
    8282    virtual void load();
Note: See TracChangeset for help on using the changeset viewer.