Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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