Changeset 7203 in orxonox.OLD for branches/std/src/lib/gui
- Timestamp:
- Mar 9, 2006, 5:28:10 PM (19 years ago)
- Location:
- branches/std/src/lib/gui/gtk_gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/gui/gtk_gui/gui_exec.cc
r7193 r7203 47 47 Frame* execFrame; //!< The Frame that holds the ExecutionOptions. 48 48 49 this->confFile = NULL;50 this->confDir = NULL;49 this->confFile = ""; 50 this->confDir = ""; 51 51 52 52 execFrame = new Frame("Execute-Tags:"); … … 137 137 GuiExec::~GuiExec() 138 138 { 139 if(this->confFile)140 delete []this->confFile;141 if(this->confDir)142 delete []this->confDir;143 139 } 144 140 … … 156 152 //! @todo F** Windows-support 157 153 #ifndef __WIN32__ 158 mkdir(this->confDir , 0755);154 mkdir(this->confDir.c_str(), 0755); 159 155 #else /* __WiN32__ */ 160 mkdir(this->confDir );156 mkdir(this->confDir.c_str()); 161 157 #endif /* __WIN32__ */ 162 158 } … … 170 166 void GuiExec::setConfFile(const char* fileName) 171 167 { 172 if (!this->confDir )168 if (!this->confDir.empty()) 173 169 this->setConfDir("~/"); 174 this->confFile = new char[strlen(this->confDir)+strlen(fileName)+2]; 175 sprintf(this->confFile, "%s/%s", this->confDir, fileName); 170 this->confFile = this->confDir + "/" + fileName; 176 171 PRINTF(5)("ConfigurationFile is %s.\n", this->confFile); 177 172 } … … 182 177 const char* GuiExec::getConfigFile() const 183 178 { 184 return this->confFile ;179 return this->confFile.c_str(); 185 180 } 186 181 … … 204 199 IniParser iniParser; 205 200 this->writeFileText(widget, &iniParser, 0); 206 char*fileName = ResourceManager::homeDirCheck(confFile);201 std::string fileName = ResourceManager::homeDirCheck(confFile); 207 202 iniParser.writeFile(fileName); 208 delete[] fileName;209 203 } 210 204 … … 259 253 void GuiExec::readFromFile(Widget* widget) 260 254 { 261 char*fileName = ResourceManager::homeDirCheck(confFile);255 std::string fileName = ResourceManager::homeDirCheck(confFile); 262 256 IniParser iniParser(fileName); 263 delete[] fileName;264 257 if (!iniParser.isOpen()) 265 258 return; … … 267 260 iniParser.firstSection(); 268 261 Widget* groupWidget = widget; 269 const char*groupName;270 const char*widgetName;262 std::string groupName; 263 std::string widgetName; 271 264 VarInfo varInfo; 272 while ( groupName = iniParser.getCurrentSection())265 while ((groupName = iniParser.getCurrentSection()) != "") 273 266 { 274 printf("GROUP:::%s\n", groupName);275 if((groupWidget = locateGroup(widget, groupName , 1))==NULL)267 PRINTF(4)("GROUP:::%s\n", groupName.c_str()); 268 if((groupWidget = locateGroup(widget, groupName.c_str(), 1))==NULL) 276 269 { 277 PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", groupName);270 PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", groupName.c_str()); 278 271 groupWidget = widget; 279 272 continue; … … 282 275 PRINT(4)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName); 283 276 284 const char*entryName;277 std::string entryName; 285 278 iniParser.firstVar(); 286 while( entryName = iniParser.getCurrentName())287 { 288 PRINTF(4)("ENTRY:::%s = %s\n", entryName , iniParser.getCurrentValue());289 varInfo.variableName = entryName ;290 varInfo.variableValue = iniParser.getCurrentValue() ;279 while((entryName = iniParser.getCurrentName()) != "") 280 { 281 PRINTF(4)("ENTRY:::%s = %s\n", entryName.c_str(), iniParser.getCurrentValue().c_str()); 282 varInfo.variableName = entryName.c_str(); 283 varInfo.variableValue = iniParser.getCurrentValue().c_str(); 291 284 groupWidget->walkThrough(this->readFileText, &varInfo, 0); 292 285 iniParser.nextVar(); -
branches/std/src/lib/gui/gtk_gui/gui_exec.h
r6981 r7203 11 11 #include "gui_gtk.h" 12 12 13 #include <string> 14 13 15 class Widget; 14 16 class CheckButton; … … 22 24 CheckButton* saveSettings; //!< A CheckBox for if the Options should be saved. 23 25 24 char* confDir;//!< The directory of the orxonox-configuration-files.25 char* confFile;//!< The name of the .orxonox.conf(ig)-file.26 std::string confDir; //!< The directory of the orxonox-configuration-files. 27 std::string confFile; //!< The name of the .orxonox.conf(ig)-file. 26 28 27 29 //! A struct that holds informations about variables. … … 58 60 struct HashTable 59 61 { 60 char*name; //!< name of the entry61 char*value; //!< value of the entry62 std::string name; //!< name of the entry 63 std::string value; //!< value of the entry 62 64 HashTable* next; //!< pointer to the next entry 63 65 };
Note: See TracChangeset
for help on using the changeset viewer.