]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Methods loadPreferences() and savePreferences().
authorstv <stv@opencascade.com>
Thu, 22 Dec 2005 07:26:15 +0000 (07:26 +0000)
committerstv <stv@opencascade.com>
Thu, 22 Dec 2005 07:26:15 +0000 (07:26 +0000)
src/STD/STD_Application.cxx
src/STD/STD_Application.h

index 706ecedb5620104e0fb2fb220245d06ac66101c9..49d5cfcfcc8b43622d353b3511afd1bfec9960e1 100755 (executable)
@@ -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();
index ce925fa5ca429fa028f6cb1cb0bf43279755c640..c8e3b4ad59d0c844bca607902f3b4b62c1966c77 100755 (executable)
@@ -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* );