Salome HOME
updated copyright message
[modules/gui.git] / src / LightApp / LightApp_Application.h
index cc6ce1ea87aa0f2fa02d4a4015bbe6f04cd04339..cb2102e1977519d6a6cbee1ba89ae6dd65f777bb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #include <SUIT_DataObject.h>
 #include <CAM_Application.h>
 
+#include <QPixmap>
 #include <QPointer>
 #include <QStringList>
 
 class LogWindow;
+class QtxInfoPanel;
 #ifndef DISABLE_PYCONSOLE
 class PyConsole_Console;
 class PyConsole_Interp;
@@ -49,6 +51,7 @@ class LightApp_Preferences;
 class LightApp_SelectionMgr;
 class LightApp_FullScreenHelper;
 class LightApp_DataObject;
+class LightApp_ModuleAction;
 class SUIT_DataBrowser;
 class SUIT_Study;
 class SUIT_Accel;
@@ -75,6 +78,7 @@ class LIGHTAPP_EXPORT LightApp_Application : public CAM_Application, public SUIT
 
 public:
   typedef enum { WT_ObjectBrowser,
+                WT_InfoPanel,
 #ifndef DISABLE_PYCONSOLE
                  WT_PyConsole,
 #endif
@@ -88,7 +92,8 @@ public:
          CloseId, CloseAllId, GroupAllId,
          PreferencesId, MRUId, ModulesListId,
          NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId,
-         NewQxSceneViewId, NewGraphicsViewId, NewPVViewId, NewPyViewerId, StyleId, FullScreenId,
+         NewQxSceneViewId, NewGraphicsViewId, NewPVViewId, NewPyViewerId, NewPV3DViewId, StyleId, FullScreenId,
+         WebSiteId, ForumId, VideosId, TutorialsId,
          UserID };
 
 protected:
@@ -110,6 +115,7 @@ public:
 
   LogWindow*                          logWindow();
   SUIT_DataBrowser*                   objectBrowser();
+  QtxInfoPanel*                       infoPanel();
 #ifndef DISABLE_PYCONSOLE
   PyConsole_Console*                  pythonConsole(const bool force = false);
 #endif
@@ -178,15 +184,19 @@ public:
   void                                emitOperationFinished( const QString&, const QString&, const QStringList& );
 
   void                                updateVisibilityState( DataObjectList& theList,
-                                                             SUIT_ViewModel* theViewModel );  
+                                                             SUIT_ViewModel* theViewModel );
 
-  virtual bool                        checkExistingDoc();
+  void                                updatePresentations( const QString& theComponent,
+                                                           const QStringList& theViewManagerTypes );
+
+  virtual bool                        checkExistingDoc( bool = true );
 
 #ifndef DISABLE_PYCONSOLE
   PyConsole_Interp*                   getPyInterp();
 #endif
 
 signals:
+  void                                moduleActivated( const QString& );
   void                                studyOpened();
   void                                studySaved();
   void                                studyClosed();
@@ -208,7 +218,10 @@ public slots:
   virtual void                        onDockWindowVisibilityChanged( bool );
 
 protected:
+  void                                showHelp( const QString& );
   virtual void                        createActions();
+  virtual void                        addExtensionsActions(LightApp_ModuleAction* moduleAction);
+  virtual void                        customize();
   virtual void                        createActionForViewer( const int id,
                                                              const int parentId,
                                                              const QString& suffix,
@@ -221,9 +234,12 @@ protected:
   virtual void                        setActiveStudy( SUIT_Study* );
   virtual void                        updateCommandsStatus();
 
+  virtual bool                        canOpenDoc( const QString& );
+
   virtual void                        beforeCloseDoc( SUIT_Study* );
   virtual void                        afterCloseDoc();
   virtual void                        moduleAdded( CAM_Module* );
+  virtual void                        moduleDeactivated( CAM_Module* );
   virtual bool                        activateModule( CAM_Module* = 0 );
 
   LightApp_Preferences*               preferences( const bool ) const;
@@ -240,6 +256,8 @@ protected:
   virtual PyConsole_Interp*           createPyInterp();
 #endif
 
+  virtual void                        addCatalogue( const QString&, const QString& ) {}
+
 protected slots:
   virtual void                        onDesktopActivated();
   virtual void                        onViewManagerRemoved( SUIT_ViewManager* );
@@ -247,6 +265,9 @@ protected slots:
 
   void                                onNewWindow();
   virtual void                        onModuleActivation( const QString& );
+  void                                onExtAdding();
+  void                                onExtRemoving( const QString& );
+  void                                onShowExtInfo();
   void                                onCloseView( SUIT_ViewManager* );
 
   virtual void                        onStudyCreated( SUIT_Study* );
@@ -263,6 +284,8 @@ protected slots:
 
   virtual void                        onDesktopMessage( const QString& );
 
+  virtual void                        onInfoPanelShown();
+
 private slots:
   void                                onSelection();
   void                                onRefresh();
@@ -280,7 +303,6 @@ protected:
   void                                updateWindows();
   void                                updateViewManagers();
   void                                updateModuleActions();
-  void                                removeModuleAction( const QString& );
 
   bool                                checkModule( const QString& );
 
@@ -296,7 +318,7 @@ protected:
   QString                             defaultModule() const;
   virtual void                        currentWindows( QMap<int, int>& ) const;
   void                                currentViewManagers( QStringList& ) const;
-  void                                moduleIconNames( QMap<QString, QString>& ) const;
+  QPixmap                             moduleIcon( const QString&, const int = -1 ) const;
 
   QDockWidget*                        windowDock( QWidget* ) const;
   QByteArray                          dockWindowsState( const QMap<QString, bool>&, const QMap<QString, bool>& ) const;
@@ -306,22 +328,29 @@ protected:
   virtual bool                        openAction( const int, const QString& );
 
   void                                showPreferences( const QString& = QString() );
+  void                                showPreferences( const QStringList& );
 
 private:
+  bool                                addUserModule( const QString&, const QString&, bool = false );
+  void                                removeUserModule(const QString& moduleInnerName, LightApp_ModuleAction* moduleAction);
   void                                emptyPreferences( const QString& );
   QList<QToolBar*>                    findToolBars( const QStringList& names = QStringList() );
-  
-  QByteArray                          processState(QByteArray& input, 
-                                                  const bool processWin,
-                                                  const bool processTb,
-                                                  const bool isRestoring,
-                                                  QByteArray defaultState = QByteArray());
+  void                                createHelpItems( const QString& );
+  void                                removeHelpItems( const QString& );
+
+  QByteArray                          processState(QByteArray& input,
+                                                   const bool processWin,
+                                                   const bool processTb,
+                                                   const bool isRestoring,
+                                                   QByteArray defaultState = QByteArray());
 
 protected:
-  typedef QPointer<QWidget>         WinPtr;
-  typedef QMap<int, WinPtr>         WinMap;
-  typedef QMap<QString, QByteArray> WinVis;
-  typedef QMap<QString, QByteArray> WinGeom;
+  typedef QPointer<QWidget>          WinPtr;
+  typedef QMap<int, WinPtr>          WinMap;
+  typedef QMap<QString, QByteArray>  WinVis;
+  typedef QMap<QString, QByteArray>  WinGeom;
+  typedef QList<int>                 IdList;
+  typedef QMap<QString, IdList>      IdMap;
 
   enum { OpenReload = CAM_Application::OpenExist + 1 };
 
@@ -333,6 +362,7 @@ protected:
 
   WinMap                              myWin;
   WinVis                              myWinVis;
+  IdMap                               myHelpItems;
 
   SUIT_Accel*                         myAccel;
   QTimer*                             myAutoSaveTimer;
@@ -340,6 +370,8 @@ protected:
   static LightApp_Preferences*        _prefs_;
 
   QStringList                         myUserWmTypes;
+
+  friend void LightAppCleanUpAppResources();
 };
 
 #ifdef WIN32