Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7555 in orxonox.OLD for branches/qt_gui/src/lib/gui/gui_saveable.cc


Ignore:
Timestamp:
May 7, 2006, 2:25:16 PM (18 years ago)
Author:
bensch
Message:

orxonox/qt_gui: more elaborate Saveables

File:
1 edited

Legend:

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

    r7549 r7555  
    1717
    1818#include "gui_saveable.h"
     19#include "gui.h"
    1920
    2021namespace OrxGui
     
    2425   * standard constructor
    2526  */
    26   Saveable::Saveable (const std::string& optionName)
     27  Saveable::Saveable (const std::string& optionName, SaveableGroup* group)
    2728  : BaseObject(optionName)
    2829  {
    2930    this->bSaveable = false;
     31
     32    this->group = group;
     33    this->group->addSaveable(this);
    3034
    3135  }
     
    3741  Saveable::~Saveable ()
    3842  {
     43    this->group->removeSaveable(this);
    3944    // delete what has to be deleted here
    4045  }
     
    4954
    5055  SaveableGroup::SaveableGroup(const std::string& groupName, OrxGui::Gui* gui)
    51       : Saveable(groupName)
     56      : BaseObject(groupName)
    5257  {
     58    assert (gui != NULL);
     59    this->gui = gui;
    5360
     61    this->gui->addSaveableGroup(this);
     62    //this->mainWidget = NULL;
    5463  }
    55 
    5664
    5765
     
    5967  SaveableGroup::~SaveableGroup()
    6068  {
    61     std::vector<SaveableGroup*>::iterator delGroup = std::find(saveableGroups.begin(), saveableGroups.end(), this);
    62 
    63     if (delGroup != saveableGroups.end() )
    64       saveableGroups.erase(delGroup);
     69    this->gui->removeSaveableGroup(this);
    6570  }
    6671
     72
     73  /**
     74   * @brief Adds a Saveable to the List.
     75   * @param saveable the saveable to add.
     76   */
     77  void SaveableGroup::addSaveable(Saveable* saveable)
     78  {
     79    if (std::find(this->saveables.begin(), this->saveables.end(), saveable) == this->saveables.end())
     80      this->saveables.push_back(saveable);
     81  }
     82
     83  /**
     84   * @brief Removes a Saveable from the List.
     85   * @param saveable the saveable to remove.
     86   */
     87  void SaveableGroup::removeSaveable(Saveable* saveable)
     88  {
     89    std::vector<Saveable*>::iterator delSav = std::find(this->saveables.begin(), this->saveables.end(), saveable);
     90    if (delSav != this->saveables.end())
     91      this->saveables.erase(delSav);
     92  }
     93
     94
     95  /**
     96   * @brief load the value onto the Group.
     97   * @param value the Value to load.
     98   */
    6799  void SaveableGroup::load(const MultiType& value)
    68100  {}
    69101
     102  /**
     103   * @brief save the value from the Group
     104   * @returns nothing.
     105   */
    70106  const MultiType& SaveableGroup::save()
    71107  {}
     
    73109
    74110
    75   std::vector<SaveableGroup*>  SaveableGroup::saveableGroups;
    76 
    77   void SaveableGroup::makingElementSaveable()
    78   {
    79     SaveableGroup::saveableGroups.push_back(this);
    80   }
    81 
    82 
    83111
    84112}
Note: See TracChangeset for help on using the changeset viewer.