From 506058cad233289b296176b1626d10a64bfd7238 Mon Sep 17 00:00:00 2001 From: ouv Date: Mon, 27 Feb 2006 15:07:36 +0000 Subject: [PATCH] CTH9911 --- src/LightApp/LightApp_Application.cxx | 18 ++++ src/LightApp/LightApp_Application.h | 2 + src/LightApp/LightApp_Study.h | 148 +++++++++++++------------- 3 files changed, 95 insertions(+), 73 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index f788999e8..12bc204fe 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1745,6 +1745,9 @@ void LightApp_Application::currentViewManagers( QStringList& lst ) const /*!Update windows.*/ void LightApp_Application::updateWindows() { + if ( !activeStudy() ) + return; + QMap winMap; currentWindows( winMap ); @@ -1928,3 +1931,18 @@ void LightApp_Application::onRenameWindow() if( ok && !name.isEmpty() ) w->setCaption( name ); } + +/*! default name for an active study */ +void LightApp_Application::setDefaultStudyName( const QString& theName ) +{ + QStringList anInfoList; + modules( anInfoList, false ); + + LightApp_Study* aStudy = (LightApp_Study*)activeStudy(); + if( anInfoList.count() == 1 && // to avoid a conflict between different modules + !aStudy->isSaved() ) + { + aStudy->setStudyName( theName ); + updateDesktopTitle(); + } +} diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index 26f9c30c9..a3d10532b 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -96,6 +96,8 @@ public: SUIT_Accel* accel() const; + void setDefaultStudyName( const QString& theName ); + static int studyId(); signals: diff --git a/src/LightApp/LightApp_Study.h b/src/LightApp/LightApp_Study.h index 1280fd99a..2e0ac3226 100644 --- a/src/LightApp/LightApp_Study.h +++ b/src/LightApp/LightApp_Study.h @@ -16,76 +16,78 @@ // // See http://www.salome-platform.org/ // -#ifndef LIGHTAPP_STUDY_H -#define LIGHTAPP_STUDY_H - -#include -#include - -#include -#include -#include - -#include "string" -#include "vector" - -class SUIT_Application; -class CAM_DataModel; - -class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study -{ - Q_OBJECT - -public: - LightApp_Study( SUIT_Application* ); - virtual ~LightApp_Study(); - - virtual void createDocument(); - virtual bool openDocument( const QString& ); - virtual bool loadDocument( const QString& ); - - virtual bool saveDocument(); - virtual bool saveDocumentAs( const QString& ); - - virtual void closeDocument(bool permanently = true); - - virtual bool isSaved() const; - virtual bool isModified() const; - - virtual void addComponent ( const CAM_DataModel* dm); - - virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile ); - - virtual QString componentDataType( const QString& ) const; - virtual QString referencedToEntry( const QString& ) const; - virtual bool isComponent( const QString& ) const; - virtual void children( const QString&, QStringList& ) const; - virtual void components( QStringList& ) const; - -protected: - virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles ); - virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles ); - virtual bool saveStudyData ( const QString& theFileName ); - virtual bool openStudyData ( const QString& theFileName ); - - virtual std::vector GetListOfFiles ( const char* theModuleName ) const; - virtual void SetListOfFiles ( const char* theModuleName, - const std::vector theListOfFiles ); - - virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const; - -protected: - virtual bool openDataModel ( const QString&, CAM_DataModel* ); - -signals: - void saved ( SUIT_Study* ); - void opened ( SUIT_Study* ); - void closed ( SUIT_Study* ); - void created( SUIT_Study* ); - - -private: - LightApp_Driver* myDriver; -}; - -#endif +#ifndef LIGHTAPP_STUDY_H +#define LIGHTAPP_STUDY_H + +#include +#include + +#include +#include +#include + +#include "string" +#include "vector" + +class SUIT_Application; +class CAM_DataModel; + +class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study +{ + Q_OBJECT + +public: + LightApp_Study( SUIT_Application* ); + virtual ~LightApp_Study(); + + virtual void createDocument(); + virtual bool openDocument( const QString& ); + virtual bool loadDocument( const QString& ); + + virtual bool saveDocument(); + virtual bool saveDocumentAs( const QString& ); + + virtual void closeDocument(bool permanently = true); + + virtual bool isSaved() const; + virtual bool isModified() const; + + virtual void addComponent ( const CAM_DataModel* dm); + + virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile ); + + virtual QString componentDataType( const QString& ) const; + virtual QString referencedToEntry( const QString& ) const; + virtual bool isComponent( const QString& ) const; + virtual void children( const QString&, QStringList& ) const; + virtual void components( QStringList& ) const; + +protected: + virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles ); + virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles ); + virtual bool saveStudyData ( const QString& theFileName ); + virtual bool openStudyData ( const QString& theFileName ); + + virtual std::vector GetListOfFiles ( const char* theModuleName ) const; + virtual void SetListOfFiles ( const char* theModuleName, + const std::vector theListOfFiles ); + + virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const; + +protected: + virtual bool openDataModel ( const QString&, CAM_DataModel* ); + +signals: + void saved ( SUIT_Study* ); + void opened ( SUIT_Study* ); + void closed ( SUIT_Study* ); + void created( SUIT_Study* ); + + +private: + LightApp_Driver* myDriver; + + friend class LightApp_Application; +}; + +#endif -- 2.39.2