From f7b89e44635b6146a15a561fd99b28ff4e4bd42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 26 Mar 2010 10:35:42 +0000 Subject: [PATCH] Moved more flags to QSettings git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8853 383ad7c9-94d9-4d36-a494-682f7c89f535 --- Core/Core.cc | 2 +- Core/ParseIni.cc | 25 ------- Core/optionHandling.cc | 8 +- OpenFlipper.cc | 4 +- common/GlobalOptions.cc | 39 +--------- common/GlobalOptions.hh | 27 +------ widgets/coreWidget/CoreWidget.cc | 100 ++++++++++++------------- widgets/optionsWidget/optionsWidget.cc | 11 +-- 8 files changed, 66 insertions(+), 150 deletions(-) diff --git a/Core/Core.cc b/Core/Core.cc index dccddbf9..8b4f5aaa 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -879,7 +879,7 @@ void Core::showToolbox( bool _state ) { } void Core::multiViewMode( int _mode ) { - if ( !OpenFlipper::Options::gui() || !OpenFlipper::Options::multiView() ) + if ( !OpenFlipper::Options::gui() || !OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() ) return; switch (_mode) diff --git a/Core/ParseIni.cc b/Core/ParseIni.cc index dd1dc616..8698da22 100644 --- a/Core/ParseIni.cc +++ b/Core/ParseIni.cc @@ -208,20 +208,6 @@ void Core::readApplicationOptions(INIFile& _ini) { OpenFlipper::Options::anaglyphRightEyeColorMatrix(set); } - //============================================================================ - // Load the setting for the toolbox window - //============================================================================ - bool hideToolbox = false; - if ( _ini.get_entry( hideToolbox, "Options" , "HideToolbox") ) - OpenFlipper::Options::hideToolbox(hideToolbox); - - //============================================================================ - // Load the setting for the fullscreen option - //============================================================================ - bool fullScreen = false; - if ( _ini.get_entry( fullScreen, "Options" , "FullScreen") ) - OpenFlipper::Options::fullScreen(fullScreen); - //============================================================================ // Load the setting for the object color option //============================================================================ @@ -286,10 +272,6 @@ void Core::readApplicationOptions(INIFile& _ini) { // ViewerProperties //============================================================================ - bool multiView = false; - if( _ini.get_entry(multiView, "Options", "MultiView") ) - OpenFlipper::Options::multiView(multiView); - uint viewerCount = 0; if( _ini.get_entry(viewerCount, "Options", "ViewerCount") ){ } @@ -486,7 +468,6 @@ void Core::writeApplicationOptions(INIFile& _ini) { _ini.add_entry("Options","Translation", OpenFlipper::Options::translation() ); _ini.add_entry("Options","GridVisible", OpenFlipper::Options::gridVisible() ); - _ini.add_entry("Options","MultiView", OpenFlipper::Options::multiView() ); _ini.add_entry("Options","ViewerCount", OpenFlipper::Options::examinerWidgets() ); if ( !_ini.section_exists("ViewerProperties") ) @@ -514,12 +495,6 @@ void Core::writeApplicationOptions(INIFile& _ini) { _ini.add_entry("Options","DefaultViewingDirection" + QString::number(i), OpenFlipper::Options::defaultViewingDirection(i) ); } - - _ini.add_entry("Options","HideToolbox", OpenFlipper::Options::hideToolbox() ); - - // check if we are in fullscreen mode: - _ini.add_entry("Options","FullScreen", OpenFlipper::Options::fullScreen() ); - _ini.add_entry("Options","DefaultBaseColor", (uint)OpenFlipper::Options::defaultBaseColor().rgba () ); _ini.add_entry("Options", "StereoMode",OpenFlipper::Options::stereoMode() ); diff --git a/Core/optionHandling.cc b/Core/optionHandling.cc index 905ca815..dcfc060b 100644 --- a/Core/optionHandling.cc +++ b/Core/optionHandling.cc @@ -77,7 +77,7 @@ void Core::applyOptions(){ if (OpenFlipper::Options::defaultToolboxMode() != "") coreWidget_->slotChangeView(OpenFlipper::Options::defaultToolboxMode(), QStringList(), QStringList()); //Set Fullscreen - if ( OpenFlipper::Options::fullScreen() ) + if ( OpenFlipperSettings().value("Core/Gui/fullscreen",false).toBool() ) coreWidget_->setWindowState( coreWidget_->windowState() | Qt::WindowFullScreen); else coreWidget_->setWindowState( (coreWidget_->windowState() | Qt::WindowFullScreen) ^ Qt::WindowFullScreen); @@ -134,7 +134,7 @@ void Core::applyOptions(){ } } - if ( OpenFlipper::Options::multiView() ) + if ( OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() ) coreWidget_->setViewerLayout( OpenFlipper::Options::defaultViewerLayout() ); // if ( OpenFlipper::Options::gridVisible() ) @@ -155,10 +155,8 @@ void Core::applyOptions(){ } //hideToolbox - if (OpenFlipper::Options::hideToolbox()) { - + if ( OpenFlipperSettings().value("Core/Gui/ToolBoxes/hidden",false).toBool() ) coreWidget_->showToolbox (false); - } //setup logFile if (logFile_ != 0){ diff --git a/OpenFlipper.cc b/OpenFlipper.cc index 0be9a30d..3dea76f1 100644 --- a/OpenFlipper.cc +++ b/OpenFlipper.cc @@ -231,13 +231,13 @@ bool parseCommandLineOptions(CSimpleOpt& args){ OpenFlipper::Options::stereo(false); break; case OPT_HIDDDEN_TOOLBOX: - OpenFlipper::Options::hideToolbox(true); + OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/hidden",true); break; case OPT_HIDDDEN_LOGGER: OpenFlipper::Options::loggerState(OpenFlipper::Options::Hidden); break; case OPT_FULLSCREEN: - OpenFlipper::Options::fullScreen(true); + OpenFlipperSettings().setValue("Core/Gui/fullscreen",false); break; case OPT_LOAD_POLYMESHES: openPolyMeshes = true; diff --git a/common/GlobalOptions.cc b/common/GlobalOptions.cc index 52fe6f1d..492070df 100644 --- a/common/GlobalOptions.cc +++ b/common/GlobalOptions.cc @@ -162,15 +162,6 @@ static bool drawModesInContextMenu_ = true; /// Set if a grid should be drawn in every viewer static bool gridVisible_ = false; -/// Store the toolbox gui Mode mode -static bool hideToolbox_ = false; - -/// Store if we should go into multiview Mode -static bool multiView_ = true; - -/// Start in Fullscreen Mode? -static bool fullScreen_ = false; - static QString defaultToolboxMode_ = ""; static QString title_ = "OpenFlipper v?"; @@ -530,16 +521,8 @@ void gridVisible(bool _visible) { gridVisible_ = _visible; } -void multiView( bool _multiView) { - multiView_ = _multiView; -} - -bool multiView() { - return multiView_; -} - unsigned int examinerWidgets() { - if ( multiView_) + if ( OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() ) return 4; else return 1; @@ -555,26 +538,6 @@ LoggerState loggerState( ) { return static_cast (OpenFlipperSettings().value("Core/Gui/LogWindow/LogWindowMode",0).toInt() ); } -/// Set if we start the toolbox widget closed -void hideToolbox( bool _hide) { - hideToolbox_ = _hide; -} - -/// Start the toolbox widget closed? -bool hideToolbox( ) { - return hideToolbox_; -} - -/// Start fullscreen Mode? -void fullScreen( bool _fs ) { - fullScreen_ = _fs; -} - -/// Start fullscreen Mode? -bool fullScreen( ) { - return fullScreen_; -} - /// Which mode should be the default for the toolbar? QString defaultToolboxMode( ) { return defaultToolboxMode_; diff --git a/common/GlobalOptions.hh b/common/GlobalOptions.hh index 3a860018..b33f55cc 100644 --- a/common/GlobalOptions.hh +++ b/common/GlobalOptions.hh @@ -92,8 +92,11 @@ * * Core/Gui/glViewer/stereoMousePick This setting controls if the mouse depth is picked in stereo mode(bool)\n * * Core/Gui/glViewer/restrictFrameRate This setting controls if the maximum frame rate should be restricted (bool)\n * * Core/Gui/glViewer/maxFrameRate If restrictFrameRate is set to yes, this setting controls the maximum frameRate used (unsigned int)\n +* * Core/Gui/glViewer/useMultipleViewers Use only one viewer or automatically generate multiple viewers (bool)\n +* * Core/Gui/ToolBoxes/hidden Hide the toolbox sidebar (bool)\n * * Core/Gui/LogWindow/LogWindowMode Log Window Mode .. 0 InScene, 1 Window, 2 Hidden (int)\n * * Core/Gui/splash This setting controls if the splash screen is shown at startup(bool)\n +* * Core/Gui/fullscreen Show OpenFlipper in Fullscreen Mode(bool)\n * * File Handling\n * * Core/CurrentDir The current Directory of the Application \n @@ -485,14 +488,6 @@ QString helpDirStr(); * @{ */ //=========================================================================== - /// Use multiview Mode? - DLLEXPORT - void multiView( bool _multiView); - - /// Use multiview Mode? - DLLEXPORT - bool multiView(); - /// Number of examiner widgets DLLEXPORT unsigned int examinerWidgets(); @@ -512,22 +507,6 @@ QString helpDirStr(); DLLEXPORT LoggerState loggerState( ); - /// Set if we start the toolbox widget closed - DLLEXPORT - void hideToolbox( bool _hide); - - /// Start the toolbox widget closed? - DLLEXPORT - bool hideToolbox( ); - - /// Start fullscreen Mode? - DLLEXPORT - void fullScreen( bool _fs ); - - /// Start fullscreen Mode? - DLLEXPORT - bool fullScreen( ); - /// Which mode should be the default for the toolbar? DLLEXPORT QString defaultToolboxMode( ); diff --git a/widgets/coreWidget/CoreWidget.cc b/widgets/coreWidget/CoreWidget.cc index bee361d2..bca2c51d 100644 --- a/widgets/coreWidget/CoreWidget.cc +++ b/widgets/coreWidget/CoreWidget.cc @@ -240,7 +240,7 @@ CoreWidget( QVector& _viewModes, // Create examiner // ====================================================================== - if ( !OpenFlipper::Options::multiView() ) { + if ( !OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() ) { glViewer* examinerWidget = new glViewer(glScene_, glWidget_, @@ -622,8 +622,8 @@ CoreWidget::toggleFullscreen() { } fullscreenState_ = (fullscreenState_ + 1) % 3; - - OpenFlipper::Options::fullScreen( bool( windowState() & Qt::WindowFullScreen) ); + + OpenFlipperSettings().setValue("Core/Gui/fullscreen", bool( windowState() & Qt::WindowFullScreen) ); show(); } @@ -643,7 +643,7 @@ CoreWidget::setFullscreen(bool _state ) { fullscreenState_ = (uint) _state; - OpenFlipper::Options::fullScreen( bool( windowState() & Qt::WindowFullScreen) ); + OpenFlipperSettings().setValue("Core/Gui/fullscreen", bool( windowState() & Qt::WindowFullScreen) ); show(); } @@ -802,7 +802,7 @@ void CoreWidget::toggleToolbox() { //toggle - showToolbox( OpenFlipper::Options::hideToolbox() ); + showToolbox( OpenFlipperSettings().value("Core/Gui/ToolBoxes/hidden",false).toBool() ); } //----------------------------------------------------------------------------- @@ -813,9 +813,9 @@ void CoreWidget::showToolbox( bool _state ) { //toggle - OpenFlipper::Options::hideToolbox( !_state ); + OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/hidden",!_state); - if ( OpenFlipper::Options::hideToolbox() ){ + if ( OpenFlipperSettings().value("Core/Gui/ToolBoxes/hidden",false).toBool() ){ //hide ViewMode Selection Widget toolBoxArea_->setVisible(false); @@ -904,57 +904,57 @@ void CoreWidget::showOptionsWidget() { void CoreWidget::nextViewerLayout() { - if (OpenFlipper::Options::multiView()) { - - switch (baseLayout_->mode()) { - case QtMultiViewLayout::SingleView: - baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); - baseLayout_->setMode(QtMultiViewLayout::Grid); - - // Update combo box in the toolbar - viewerLayoutBox_->setCurrentIndex(1); - break; - case QtMultiViewLayout::Grid: - baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); - baseLayout_->setMode(QtMultiViewLayout::HSplit); - - // Update combo box in the toolbar - viewerLayoutBox_->setCurrentIndex(2); - break; - case QtMultiViewLayout::HSplit: - baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); - baseLayout_->setMode(QtMultiViewLayout::SingleView); - - // Update combo box in the toolbar - viewerLayoutBox_->setCurrentIndex(0); - break; - } - } + if ( OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() ) { + + switch (baseLayout_->mode()) { + case QtMultiViewLayout::SingleView: + baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); + baseLayout_->setMode(QtMultiViewLayout::Grid); + + // Update combo box in the toolbar + viewerLayoutBox_->setCurrentIndex(1); + break; + case QtMultiViewLayout::Grid: + baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); + baseLayout_->setMode(QtMultiViewLayout::HSplit); + + // Update combo box in the toolbar + viewerLayoutBox_->setCurrentIndex(2); + break; + case QtMultiViewLayout::HSplit: + baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); + baseLayout_->setMode(QtMultiViewLayout::SingleView); + + // Update combo box in the toolbar + viewerLayoutBox_->setCurrentIndex(0); + break; + } + } } void CoreWidget::setViewerLayout(int _idx) { - if (OpenFlipper::Options::multiView()) { - - switch (_idx) { - case 0: - baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); - baseLayout_->setMode(QtMultiViewLayout::SingleView); - break; - case 1: - baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); - baseLayout_->setMode(QtMultiViewLayout::Grid); - break; - case 2: - baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); - baseLayout_->setMode(QtMultiViewLayout::HSplit); - break; - } + if ( OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() ) { + + switch (_idx) { + case 0: + baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); + baseLayout_->setMode(QtMultiViewLayout::SingleView); + break; + case 1: + baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); + baseLayout_->setMode(QtMultiViewLayout::Grid); + break; + case 2: + baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); + baseLayout_->setMode(QtMultiViewLayout::HSplit); + break; + } viewerLayoutBox_->setCurrentIndex(_idx); - } + } } void diff --git a/widgets/optionsWidget/optionsWidget.cc b/widgets/optionsWidget/optionsWidget.cc index 0db96b9d..3051a304 100644 --- a/widgets/optionsWidget/optionsWidget.cc +++ b/widgets/optionsWidget/optionsWidget.cc @@ -232,10 +232,10 @@ void OptionsWidget::updateViewerSettings(int _row){ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { //general - fullscreen->setChecked( OpenFlipper::Options::fullScreen() ); + fullscreen->setChecked( OpenFlipperSettings().value("Core/Gui/fullscreen",false).toBool() ); splash->setChecked( OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ); - toolbox->setChecked( !OpenFlipper::Options::hideToolbox() ); - + toolbox->setChecked( !OpenFlipperSettings().value("Core/Gui/ToolBoxes/hidden",false).toBool() ); + iconSmall->setChecked(false); iconNormal->setChecked(false); iconDefault->setChecked(false); @@ -552,9 +552,10 @@ void OptionsWidget::slotShowPluginOptions(const QString& _pluginName ){ void OptionsWidget::slotApply() { //general - OpenFlipper::Options::fullScreen( fullscreen->isChecked() ); + OpenFlipperSettings().setValue("Core/Gui/fullscreen",fullscreen->isChecked()); OpenFlipperSettings().setValue("Core/Gui/splash",splash->isChecked()); - OpenFlipper::Options::hideToolbox( !toolbox->isChecked() ); + OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/hidden",!toolbox->isChecked()); + if (loggerHidden->isChecked()) OpenFlipper::Options::loggerState( OpenFlipper::Options::Hidden ); else if (loggerInScene->isChecked()) -- GitLab