From 0ca5e3eb1b20d74f6fd7d3d898b99a47a5c4d2d7 Mon Sep 17 00:00:00 2001 From: stv Date: Thu, 22 Dec 2005 07:26:15 +0000 Subject: [PATCH] Methods loadPreferences() and savePreferences(). --- src/STD/STD_Application.cxx | 35 ++++++++++++++++++++++++++++++++++- src/STD/STD_Application.h | 5 +++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 706ecedb5..49d5cfcfc 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -81,13 +81,27 @@ void STD_Application::start() updateCommandsStatus(); setEditEnabled( myEditEnabled ); + loadPreferences(); + SUIT_Application::start(); } +/*! + Close the Application +*/ +void STD_Application::closeApplication() +{ + if ( desktop() ) + savePreferences(); + + SUIT_Application::closeApplication(); +} + /*!Event on closing desktop*/ void STD_Application::onDesktopClosing( SUIT_Desktop*, QCloseEvent* e ) { - if (SUIT_Session::session()->applications().count() < 2) { + if ( SUIT_Session::session()->applications().count() < 2 ) + { onExit(); return; } @@ -106,6 +120,8 @@ void STD_Application::onDesktopClosing( SUIT_Desktop*, QCloseEvent* e ) setActiveStudy( 0 ); delete study; + savePreferences(); + setDesktop( 0 ); closeApplication(); @@ -383,7 +399,10 @@ void STD_Application::onCloseDoc( bool ask ) // STV: aNbStudies - number of currently existing studies (exclude currently closed) // STV: aNbStudies should be compared with 0. if ( aNbStudies ) + { + savePreferences(); setDesktop( 0 ); + } else { updateDesktopTitle(); @@ -829,6 +848,20 @@ void STD_Application::setDesktop( SUIT_Desktop* desk ) this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) ); } +/*! + Allow to load preferences before the desktop will be shown. +*/ +void STD_Application::loadPreferences() +{ +} + +/*! + Allow to save preferences before the application will be closed. +*/ +void STD_Application::savePreferences() +{ +} + void STD_Application::studyCreated( SUIT_Study* ) { updateDesktopTitle(); diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index ce925fa5c..c8e3b4ad5 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -80,6 +80,8 @@ public: virtual void start(); + virtual void closeApplication(); + virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ) {} signals: @@ -129,6 +131,9 @@ protected: virtual void setDesktop( SUIT_Desktop* ); + virtual void loadPreferences(); + virtual void savePreferences(); + virtual void studySaved( SUIT_Study* ); virtual void studyOpened( SUIT_Study* ); virtual void studyCreated( SUIT_Study* ); -- 2.39.2