Developer Documentation
ParseIni.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 
43 
44 
45 
46 
47 //=============================================================================
48 //
49 // CLASS Core - IMPLEMENTATION
50 //
51 //=============================================================================
52 
53 
54 //== INCLUDES =================================================================
55 
56 // -------------------- mview
57 #include "Core.hh"
58 // -------------------- ACG
59 
60 #include <OpenFlipper/common/RecentFiles.hh>
61 
62 //#include <ObjectTypes/Light/Light.hh>
63 
64 #include <OpenFlipper/ACGHelper/DrawModeConverter.hh>
65 
66 //== IMPLEMENTATION ==========================================================
67 
68 
73  // Parse standard options
74  if ( _ini.section_exists("Options") ) {
75 
76  // load ViewModes
77  int viewModeCount;
78  if (_ini.get_entry(viewModeCount,"Options","ViewModeCount") )
79  for (int i=0; i < viewModeCount; i++){
80 
81  QString entryToolbars;
82  QString entryToolboxes;
83  QString entryContextMenus;
84  QString entryIcon;
85 
86  QString keyToolbars = "ViewModeToolbars" + QString::number(i);
87  QString keyToolboxes = "ViewModeToolboxes" + QString::number(i);
88  QString keyContextMenus = "ViewModeContextMenus" + QString::number(i);
89  QString keyIcon = "ViewModeIcon" + QString::number(i);
90 
91  // Read the entries
92  if ( !_ini.get_entry( entryToolbars , "Options" , keyToolbars ) ) continue;
93  if ( !_ini.get_entry( entryToolboxes , "Options" , keyToolboxes ) ) continue;
94  if ( !_ini.get_entry( entryContextMenus , "Options" , keyContextMenus ) ) continue;
95  if ( !_ini.get_entry( entryIcon , "Options" , keyIcon ) ) continue;
96 
97  QStringList toolBars = entryToolbars.split(";");
98  QStringList toolBoxes = entryToolboxes.split(";");
99  QStringList contextMenus = entryContextMenus.split(";");
100 
101  // Get Mode name ( prepended to all toolbox/toolbar/context menu lists )
102  QString mode = toolBoxes.first();
103 
104  // Remove leading Modes
105  toolBoxes.removeFirst();
106  toolBars.removeFirst();
107  contextMenus.removeFirst();
108 
109  // Check if the mode already exists
110  bool found = false;
111  for (int i=0; i < viewModes_.size(); i++)
112  if (viewModes_[i]->name == mode)
113  found = true;
114 
115  if (!found){
116  ViewMode* vm = new ViewMode();
117  vm->name = mode;
118  vm->custom = true;
119  vm->visibleToolbars = toolBars;
120  vm->visibleToolboxes = toolBoxes;
121  vm->visibleContextMenus = contextMenus;
122  vm->icon = entryIcon;
123  viewModes_.push_back(vm);
124  }
125 
126  }
127 
128  //load default dataType
129  QString type;
130  if (_ini.get_entry(type, "Options" , "default_DataType" ))
131  OpenFlipper::Options::lastDataType(type);
132 
133  //============================================================================
134  // Load the startup dir for file dialogs
135  //============================================================================
136  QString startup_dir;
137  if( _ini.get_entry(startup_dir, "Options", "StartupDir") )
138  OpenFlipperSettings().setValue("Core/CurrentDir", startup_dir );
139 
140  //============================================================================
141  // Load the default script directory
142  //============================================================================
143  QString script_dir;
144  if( _ini.get_entry(script_dir, "Options", "CurrentScriptDir") )
145  OpenFlipper::Options::currentScriptDir(script_dir);
146 
147  //============================================================================
148  // Load the default texture directory
149  //============================================================================
150  QString current_texture_dir;
151  if( _ini.get_entry(current_texture_dir, "Options", "CurrentTextureDir") )
152  OpenFlipper::Options::currentTextureDir(current_texture_dir);
153 
154  //============================================================================
155  // Load the random base color setting
156  //============================================================================
157  bool random_default_color = false;
158  if ( _ini.get_entry( random_default_color, "Options" , "RandomDefaultColor") )
159  OpenFlipper::Options::randomDefaultColor( random_default_color );
160 
161  //============================================================================
162  // Load the synchronization setting
163  //============================================================================
164  bool synchronization = false;
165  if ( _ini.get_entry( synchronization, "Options" , "Synchronization") )
166  OpenFlipper::Options::synchronization(synchronization);
167 
168  //============================================================================
169  // Load the stereo mode setting
170  //============================================================================
171  //bool stereo = false;
172  //if ( _ini.get_entry( stereo, "Options" , "Stereo") )
173  // OpenFlipper::Options::stereo(stereo);
174 
175  //============================================================================
176  // Load the stereo mode setting
177  //============================================================================
178  int stereoMode = 0;
179  if ( _ini.get_entry( stereoMode, "Options" , "StereoMode") )
180  OpenFlipper::Options::stereoMode(static_cast<OpenFlipper::Options::StereoMode> (stereoMode));
181 
182  //============================================================================
183  // Load the custom anaglyph stereo mode color matrices
184  //============================================================================
185  std::vector<float> mat;
186  if ( _ini.get_entry( mat, "Options" , "CustomAnaglyphLeftEye") && mat.size () == 9)
187  {
188  OpenFlipper::Options::anaglyphLeftEyeColorMatrix(mat);
189  }
190  else
191  {
192  std::vector<float> set (9,0.0);
193  set[0] = 0.299f;
194  set[3] = 0.587f;
195  set[6] = 0.114f;
196  OpenFlipper::Options::anaglyphLeftEyeColorMatrix(set);
197  }
198 
199  if ( _ini.get_entry( mat, "Options" , "CustomAnaglyphRightEye") && mat.size () == 9)
200  {
201  OpenFlipper::Options::anaglyphRightEyeColorMatrix(mat);
202  }
203  else
204  {
205  std::vector<float> set (9,0.0);
206  set[4] = 1.0;
207  set[8] = 1.0;
208  OpenFlipper::Options::anaglyphRightEyeColorMatrix(set);
209  }
210 
211  //============================================================================
212  // Load the setting for the object color option
213  //============================================================================
214  unsigned int defaultColor = 0;
215  if ( _ini.get_entry( defaultColor, "Options" , "DefaultColor") )
216  OpenFlipper::Options::defaultColor(QRgb(defaultColor));
217 
218  //============================================================================
219  // Load the setting for the default Toolbox mode
220  //============================================================================
221  QString viewmode = "";
222  if ( _ini.get_entry( viewmode, "Options" , "CurrentViewMode") )
223  OpenFlipper::Options::currentViewMode(viewmode);
224 
225  //============================================================================
226  // Load the setting for the viewer layout
227  //============================================================================
228  int viewerLayout = 0;
229  if ( _ini.get_entry( viewerLayout, "Options" , "DefaultViewerLayout") )
230  OpenFlipper::Options::defaultViewerLayout(viewerLayout);
231 
232  //============================================================================
233  // Load the viewer settings
234  //============================================================================
235  std::vector< QString > draw_modes;
236 
237  for (int i=0; i < 4/*PluginFunctions::viewers()*/; i++ ){
238 
239  if( _ini.get_entry(draw_modes, "Options", "DefaultDrawModes" + QString::number(i) ) )
240  OpenFlipper::Options::defaultDrawMode( listToDrawMode(draw_modes), i );
241 
242  }
243 
244  //============================================================================
245  // Load slotDebugging state
246  //============================================================================
247  bool doSlotDebugging = false;
248  if( _ini.get_entry(doSlotDebugging, "Options", "SlotDebugging") )
249  OpenFlipper::Options::doSlotDebugging(doSlotDebugging);
250 
251  //============================================================================
252  // ViewerProperties
253  //============================================================================
254 
255  unsigned int viewerCount = 0;
256  if( _ini.get_entry(viewerCount, "Options", "ViewerCount") ){
257  }
258 
259  for ( unsigned int i = 0 ; i < viewerCount; ++i ) {
260 
261  if (OpenFlipper::Options::examinerWidgets() < i)
262  break;
263 
264  QString entryHeader = "Viewer" + QString::number(i) + "/";
265 
266  // Load the animation setting
267  PluginFunctions::viewerProperties(i).animation(OpenFlipperSettings().value(entryHeader+"Animation",false).toBool());
268 
269  // Load the twoSidedLighting setting
270  PluginFunctions::viewerProperties(i).twoSidedLighting(OpenFlipperSettings().value(entryHeader+"TwoSidedLighting",false).toBool());
271 
272  // Load the backface culling setting
273  PluginFunctions::viewerProperties(i).backFaceCulling(OpenFlipperSettings().value(entryHeader+"BackfaceCulling",false).toBool());
274 
275  // Load the setting for the background color option
276  PluginFunctions::viewerProperties(i).backgroundColor(OpenFlipperSettings().value(entryHeader+"BackgroundColor",QColor(0,0,0)).value< QColor >());
277  }
278 
279  }
280 }
281 
286 
287  // save ViewModes
288  QVector< QString > toolboxes;
289  QVector< QString > toolbars;
290  QVector< QString > contextmenus;
291  QVector< QString > icons;
292 
293  if ( OpenFlipper::Options::gui() )
294  for (int i=0; i < coreWidget_->viewModes_.size(); i++)
295  if (coreWidget_->viewModes_[i]->custom){
296 
297  //store name
298  QString entryToolboxes = coreWidget_->viewModes_[i]->name;
299 
300  //store widgets
301  for (int j=0; j < coreWidget_->viewModes_[i]->visibleToolboxes.size(); j++)
302  entryToolboxes += ";" + coreWidget_->viewModes_[i]->visibleToolboxes[j];
303 
304  toolboxes.push_back(entryToolboxes);
305 
306  //store name
307  QString entryToolbars = coreWidget_->viewModes_[i]->name;
308 
309  //store widgets
310  for (int j=0; j < coreWidget_->viewModes_[i]->visibleToolbars.size(); j++)
311  entryToolbars += ";" + coreWidget_->viewModes_[i]->visibleToolbars[j];
312 
313  toolbars.push_back(entryToolbars);
314 
315  QString entryContextMenus = coreWidget_->viewModes_[i]->name;
316 
317  //store widgets
318  for (int j=0; j < coreWidget_->viewModes_[i]->visibleContextMenus.size(); j++)
319  entryContextMenus += ";" + coreWidget_->viewModes_[i]->visibleContextMenus[j];
320 
321  contextmenus.push_back(entryContextMenus);
322 
323  icons.push_back(coreWidget_->viewModes_[i]->icon);
324  }
325 
326  //save viewmodes to ini
327  _ini.add_entry("Options","ViewModeCount" ,toolboxes.size());
328  for (int i=0; i < toolboxes.size(); i++) {
329  _ini.add_entry("Options","ViewModeToolboxes" + QString::number(i) ,toolboxes[i]);
330  _ini.add_entry("Options","ViewModeToolbars" + QString::number(i) ,toolbars[i] );
331  _ini.add_entry("Options","ViewModeContextMenus" + QString::number(i) ,contextmenus[i] );
332  _ini.add_entry("Options","ViewModeIcon" + QString::number(i) ,icons[i] );
333  }
334 
335  //save KeyBindings
336  if ( OpenFlipper::Options::gui() )
338 
339  //write default dataType to INI
340  _ini.add_entry( "Options" , "default_DataType" , OpenFlipper::Options::lastDataType() );
341 
342  //write current ViewMode
343  _ini.add_entry("Options","CurrentViewMode",OpenFlipper::Options::currentViewMode() );
344 
345  //============================================================================
346  // Debugging
347  //============================================================================
348  _ini.add_entry("Options","SlotDebugging",OpenFlipper::Options::doSlotDebugging() );
349 
350  QString dir = OpenFlipperSettings().value("Core/CurrentDir").toString().toUtf8();
351  _ini.add_entry("Options","StartupDir",dir);
352 
353  QString scriptDir = OpenFlipper::Options::currentScriptDirStr().toUtf8();
354  _ini.add_entry("Options","CurrentScriptDir",scriptDir);
355 
356  QString current_texture_dir = OpenFlipper::Options::currentTextureDirStr().toUtf8();
357  _ini.add_entry("Options","CurrentTextureDir",current_texture_dir);
358 
359  _ini.add_entry("Options","RandomDefaultColor", OpenFlipper::Options::randomDefaultColor() );
360 
361  if ( OpenFlipper::Options::gui() ) {
362 
363  _ini.add_entry("Options","DefaultViewerLayout", OpenFlipper::Options::defaultViewerLayout() );
364 
365  _ini.add_entry("Options","ViewerCount", OpenFlipper::Options::examinerWidgets() );
366 
367  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
368  QString entryHead = "Viewer" + QString::number(i) + "/";
369  OpenFlipperSettings().setValue(entryHead + "Animation", PluginFunctions::viewerProperties(i).animation());
370  OpenFlipperSettings().setValue(entryHead + "BackfaceCulling", PluginFunctions::viewerProperties(i).backFaceCulling());
371  OpenFlipperSettings().setValue(entryHead + "TwoSidedLighting", PluginFunctions::viewerProperties(i).twoSidedLighting());
372  OpenFlipperSettings().setValue(entryHead + "BackgroundColor", PluginFunctions::viewerProperties(i).backgroundQColor());
373  }
374 
375  //============================================================================
376  // Save the current viewer properties
377  //============================================================================
378  std::vector< QString > draw_modes;
379 
380  for (int i=0; i < PluginFunctions::viewers(); i++ ){
381 
382  draw_modes = drawModeToList( OpenFlipper::Options::defaultDrawMode(i) );
383  _ini.add_entry("Options","DefaultDrawModes" + QString::number(i), draw_modes);
384 
385  }
386 
387  _ini.add_entry("Options","DefaultColor", (uint)OpenFlipper::Options::defaultColor().rgba () );
388 
389  _ini.add_entry("Options", "StereoMode",OpenFlipper::Options::stereoMode() );
390 
391  _ini.add_entry("Options" , "CustomAnaglyphLeftEye", OpenFlipper::Options::anaglyphLeftEyeColorMatrix() );
392  _ini.add_entry("Options" , "CustomAnaglyphRightEye", OpenFlipper::Options::anaglyphRightEyeColorMatrix() );
393  }
394 
395  emit saveOnExit(_ini);
396 
397  // _ini.add_entry("Options","Stereo",OpenFlipper::Options::stereo() );
398 }
399 
400 void Core::openIniFile( QString _filename,
401  bool _coreSettings,
402  bool _perPluginSettings,
403  bool _loadObjects ){
404  INIFile ini;
405 
406  if ( ! ini.connect(_filename,false) ) {
407  emit log(LOGERR,tr("Failed to connect to ini file") + _filename);
408  return;
409  }
410 
411  if ( OpenFlipper::Options::gui() ) {
412  coreWidget_->statusMessage( tr("Loading ini File ") + _filename + " ...");
414  }
415 
416  // Tell plugins that we are currently reading an ini file
417  OpenFlipper::Options::blockSceneGraphUpdates();
418 
419  // Load Core settings only if requested
420  if ( _coreSettings )
422 
423  // if requested load per Plugin settings from the settings file
424  if ( _perPluginSettings )
425  emit iniLoadOptions( ini );
426 
427  if ( _loadObjects ) {
428 
429  QStringList openFiles;
430 
431  // Parse File section for files to open
432  if ( ini.section_exists("OpenFiles") && ini.get_entry(openFiles,"OpenFiles","open") ) {
433 
434  for ( int i = 0 ; i < openFiles.size(); ++i ) {
435 
436  QString sectionName = openFiles[i];
437 
438  // Check if the string read is empty (e.g. colon at the end of the line ...)
439  // So skip trying to read files without a filename.
440  if ( sectionName.isEmpty() ) {
441  emit log(LOGWARN,tr("Warning from ini file parser: OpenFiles list contains empty string.") );
442  continue;
443  }
444 
445  // Check if the specified section exists
446  if ( !ini.section_exists(sectionName) ) {
447  emit log(LOGERR,tr("Error parsing ini file. OpenFiles section %1 not found in File!").arg(sectionName));
448  continue;
449  }
450 
451  // Get the path for the file which should be opened
452  QString path;
453  if ( !ini.get_entry( path, sectionName , "path" ) ) {
454  emit log(LOGERR,tr("Error parsing ini file. Section %1 contains no path description!").arg(sectionName));
455  continue;
456  }
457 
458  // Check if path is relative ( The path is considered to be relative if the first character is a ".")
459  if (path.startsWith( "." + OpenFlipper::Options::dirSeparator() )){
460 
461  // check if _filename contains a path by testing if it contains a directory separator
462  if (_filename.section(OpenFlipper::Options::dirSeparator(), 0, -2) != ""){
463  path.remove(0,1); // remove .
464  path = _filename.section(OpenFlipper::Options::dirSeparator(), 0, -2) + path;
465  }
466 
467  }
468 
469  int tmpType;
470  DataType type = typeId("TriangleMesh");
471 
472  // First check for old datatype style (Only numbers .. therefore not consistent for runtime added types)
473  if ( ini.get_entry( tmpType, sectionName , "type" )) {
474  type = DataType(tmpType);
475  emit log(LOGWARN, tr("This ini file uses old int style ObjectType fields!") );
476  emit log(LOGWARN, tr("Please convert it to new format! ( ... just save it )") );
477  } else {
478 
479  // Read new style type. The type is represented by its name (as a QString)
480  QString typeName="";
481  if ( ini.get_entry( typeName, sectionName , "type" )) {
482  type = typeId(typeName);
483  } else
484  emit log(LOGWARN, tr("Unable to get DataType for object %1 assuming Triangle Mesh!").arg(sectionName) );
485  }
486 
487  // Now the object gets loaded based on the given datatype
488  int newObjectId = loadObject(type, path);
489 
490  // get the new object from the object tree ( If that fails, the object was not loaded correctly)
491  BaseObject* object = objectRoot_->childExists( newObjectId );
492  if ( object == 0 ) {
493  emit log(LOGERR,tr("Unable to open Object ") + path);
494  continue;
495  }
496 
497  // Read the target flag setting
498  bool flag;
499  if ( ini.get_entry( flag, sectionName , "target" ) )
500  object->target(flag);
501 
502  // Read the source flag setting
503  if ( ini.get_entry( flag, sectionName , "source" ) )
504  object->source(flag);
505 
506  // Tell plugins to load their per object settings
507  emit iniLoad( ini,object->id() );
508 
509  }
510  }
511 
512  }
513 
514  // Tell Plugins that all objects are loaded and they should read the remaining parts if necessary
515  if ( _perPluginSettings )
516  emit iniLoadOptionsLast( ini );
517 
518  // close ini file
519  ini.disconnect();
520 
521  // As the reading has been completed, tell plugins that we do not read an ini file anymore.
522  OpenFlipper::Options::unblockSceneGraphUpdates();
523 
524  // Reset scenegraph and reset trackball center
525  // This will also recompute the bounding boxes as well as the near and far plane
526  resetScenegraph(true);
527 
528  if ( OpenFlipper::Options::gui() ){
529  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
530  PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::defaultDrawMode(i) );
531  coreWidget_->examiner_widgets_[i]->viewAll();
532  }
533 
534  coreWidget_->statusMessage( tr("Loading ini File ") + _filename + tr(" ... Done"), 4000);
536  }
537 
538 }
539 
540 void Core::writeIniFile(QString _filename,
541  bool _relativePaths,
542  bool _targetOnly,
543  bool _saveSystemSettings,
544  bool _savePluginSettings ,
545  bool _saveObjectInfo,
546  std::map<int,QString>& _fileMapping) {
547 
548  INIFile ini;
549 
550  if ( ! ini.connect(_filename,true) ) {
551  emit log(LOGERR,tr("Failed to connect to _ini file") + _filename);
552  return;
553  }
554 
555  if ( OpenFlipper::Options::gui() ) {
556  coreWidget_->statusMessage( tr("Saving ini File ") + _filename + " ...");
558  }
559 
560  // Only save application settings when requested
561  if ( _saveSystemSettings )
563 
564  if ( _savePluginSettings )
565  emit iniSaveOptions( ini );
566 
567  if ( _saveObjectInfo ) {
568  // This vector will hold the file sections to open
569  QStringList openFiles;
570 
571 
573  if ( _targetOnly )
574  restriction = PluginFunctions::TARGET_OBJECTS;
575  else
576  restriction = PluginFunctions::ALL_OBJECTS;
577 
578  QString keyName;
579  QString sectionName;
580  for ( PluginFunctions::ObjectIterator o_it(restriction) ;
581  o_it != PluginFunctions::objectsEnd(); ++o_it) {
582 
583  QString file;
584  std::map<int,QString>::iterator f = _fileMapping.find(o_it->id());
585  if(f == _fileMapping.end()) {
586  file = o_it->path() + OpenFlipper::Options::dirSeparator() + o_it->name();
587  } else {
588  file = f->second;
589  }
590 
591  /* @Todo: This is broken when Light source Object type is not available!
592  // Don't save default light source objects
593  LightObject* light = 0;
594  PluginFunctions::getObject( o_it->id(), light );
595  if(light != 0) {
596  if(light->defaultLight()) continue;
597  }
598  */
599 
600  if (QFile(file).exists()){
601  // Add a section for this object
602  sectionName = o_it->name();
603  openFiles.push_back( sectionName );
604 
605  //modify filename if relativePaths are wanted
606  if (_relativePaths){
607  int prefixLen = _filename.section(OpenFlipper::Options::dirSeparator(),0,-2).length();
608  file.remove(0, prefixLen);
609  file = "." + file;
610  }
611  // Add the path of this object to the section
612  ini.add_entry( sectionName , "path" , file );
613  ini.add_entry( sectionName , "type" , typeName(o_it->dataType() ) );
614  ini.add_entry( sectionName , "target" , o_it->target() );
615  ini.add_entry( sectionName , "source" , o_it->source() );
616 
617  }
618  }
619 
620  ini.add_entry("OpenFiles","open",openFiles);
621 
622  // Tell plugins to save their information for the given object
624  o_it != PluginFunctions::objectsEnd(); ++o_it) {
625 
626  /* @Todo: This is broken when Light source Object type is not available!
627  // Don't save default light source objects
628  LightObject* light = 0;
629  PluginFunctions::getObject( o_it->id(), light );
630  if(light != 0) {
631  if(light->defaultLight()) continue;
632  }
633  */
634 
635  emit iniSave( ini , o_it->id() );
636  }
637  }
638 
639 
640 
641  ini.disconnect();
642 
643  if ( OpenFlipper::Options::gui() ) {
644  coreWidget_->statusMessage( tr("Saving ini File ") + _filename + tr(" ... Done"), 4000);
646  }
647 }
648 
649 
650 //=============================================================================
QStringList visibleContextMenus
List of context Menus in this view mode.
Definition: CoreWidget.hh:143
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
Status is ready (green light)
BaseObject * childExists(int _objectId)
Check if the element exists in the subtree of this element.
Definition: BaseObject.cc:516
bool custom
Is this a user defined custom view mode or a plugin generated one.
Definition: CoreWidget.hh:134
void iniLoadOptions(INIFile &_ini)
This signal is used to tell the plugins to load their new status.
Status is processing and blocked system will not allow interaction (red light)
void iniLoadOptionsLast(INIFile &_ini)
This signal is used to tell the plugins to load their new status after objects are loaded...
QString icon
Definition: CoreWidget.hh:131
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
Definition: Types.cc:154
QStringList visibleToolbars
List of Toolbars in this view mode.
Definition: CoreWidget.hh:140
void iniSave(INIFile &_ini, int _id)
This signal is used to tell the plugins to save the data of _id to the given file.
void iniSaveOptions(INIFile &_ini)
This signal is used to tell the plugins to save their current status.
int id() const
Definition: BaseObject.cc:190
void writeIniFile(QString _filename, bool _relativePaths, bool _targetOnly, bool _saveSystemSettings, bool _savePluginSettings, bool _saveObjectInfo, std::map< int, QString > &_fileMapping)
Write current status to ini file (Application and File Options)
Definition: ParseIni.cc:540
void openIniFile(QString _filename, bool _coreSettings, bool _perPluginSettings, bool _loadObjects)
Load information from an ini file.
Definition: ParseIni.cc:400
void saveOnExit(INIFile &_ini)
This signal is emitted before the core deletes its data and exits.
bool section_exists(const QString &_section) const
Check if given section exists in the current INI file.
Definition: INIFile.cc:227
void twoSidedLighting(bool _state)
set 2-sided lighting on/off
QString name
Name of the View Mode.
Definition: CoreWidget.hh:127
bool source()
Definition: BaseObject.cc:291
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
const QStringList TARGET_OBJECTS("target")
Iterable object range.
void animation(bool _state)
set 2-sided lighting on/off
QStringList IteratorRestriction
Iterable object range.
void log(Logtype _type, QString _message)
Logg with OUT,WARN or ERR as type.
bool connect(const QString &name, const bool create)
Connect INIFile object with given filename.
Definition: INIFile.cc:70
CoreWidget * coreWidget_
The main applications widget ( only created in gui mode )
Definition: Core.hh:1596
int viewers()
Get the number of viewers.
const QStringList ALL_OBJECTS
Iterable object range.
bool target()
Definition: BaseObject.cc:273
void saveKeyBindings(INIFile &_ini)
Store current key assignments to a given INI file.
Definition: keyHandling.cc:453
BaseObject * objectRoot_
Pointer to the data rootNode;.
Definition: Core.hh:1593
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
ACG::Vec4f backgroundColor()
Get current background color.
void iniLoad(INIFile &, int)
If an ini File is opened, this signal is send to Plugins capable of handling ini files.
QStringList visibleToolboxes
List of Visible Toolboxes in this view mode.
Definition: CoreWidget.hh:137
ViewMode struct This struct contains a ViewMode and its status information such as used widgets...
Definition: CoreWidget.hh:124
void loadObject()
Open Load Widget.
bool backFaceCulling()
Get current state of backface culling.
void add_entry(const QString &_section, const QString &_key, const QString &_value)
Addition / modification of a string entry.
Definition: INIFile.cc:257
void writeApplicationOptions(INIFile &_ini)
Write Application options to ini file.
Definition: ParseIni.cc:285
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
Predefined datatypes.
Definition: DataTypes.hh:83
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
std::vector< glViewer *> examiner_widgets_
Examiner Widget.
Definition: CoreWidget.hh:677
QVector< ViewMode * > viewModes_
List of available draw modes.
Definition: Core.hh:1605
void readApplicationOptions(INIFile &_ini)
Get and set Application options from ini file.
Definition: ParseIni.cc:72
QVector< ViewMode * > & viewModes_
List of currently available viewModes.
Definition: CoreWidget.hh:585
void disconnect()
Remove connection of this object to a file.
Definition: INIFile.cc:122
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
Definition: Types.cc:139
void resetScenegraph(bool _resetTrackBall)
Class for the handling of simple configuration files.
Definition: INIFile.hh:99
bool get_entry(QString &_val, const QString &_section, const QString &_key) const
Access to a string entry.
Definition: INIFile.cc:433