1 // Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef CAM_APPLICATION_H
24 #define CAM_APPLICATION_H
28 #include <STD_Application.h>
35 #pragma warning( disable:4251 )
38 class CAM_EXPORT CAM_Application : public STD_Application
43 typedef QList<CAM_Module*> ModuleList;
44 typedef struct { QString name; QString version; } ModuleShortInfo;
45 typedef QList<ModuleShortInfo> ModuleShortInfoList;
48 CAM_Application( const bool = true );
49 virtual ~CAM_Application();
53 CAM_Module* activeModule() const;
54 CAM_Module* module( const QString& ) const;
56 ModuleList modules() const;
57 void modules( ModuleList& ) const;
58 void modules( QStringList&,
59 const bool loaded = true ) const;
61 virtual void addModule( CAM_Module* );
63 virtual void loadModules();
64 virtual CAM_Module* loadModule( const QString&, const bool = true );
66 virtual bool activateModule( const QString& );
68 bool activateOperation( const QString& modName,
70 bool activateOperation( const QString& modName,
71 const QString& actionId );
72 bool activateOperation( const QString& modName,
73 const QString& actionId,
74 const QString& pluginName );
76 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
78 static QString moduleName( const QString& );
79 static QString moduleTitle( const QString& );
80 static QString moduleIcon( const QString& );
81 static QString moduleDescription( const QString& );
82 static QString moduleLibrary( const QString&,
84 static QString moduleDisplayer( const QString& );
86 virtual void createEmptyStudy();
88 static ModuleShortInfoList getVersionInfo();
90 static void logUserEvent( const QString& );
91 static void logAction( QAction*, const QString& = QString() );
92 static void logStructuredUserEvent( const QString& module,
93 const QString& section,
94 const QString& action,
96 const QString& message = "" );
99 virtual SUIT_Study* createNewStudy();
100 virtual void updateCommandsStatus();
102 virtual bool checkModule( const QString& );
103 virtual void moduleAdded( CAM_Module* );
104 virtual void moduleDeactivated( CAM_Module* );
105 virtual void beforeCloseDoc( SUIT_Study* );
106 virtual void afterCloseDoc();
107 virtual bool activateModule( CAM_Module* = 0 );
109 virtual void setActiveStudy( SUIT_Study* );
111 virtual bool abortAllOperations();
114 bool appendModuleInfo( const QString& );
115 void removeModuleInfo( const QString& );
118 enum { stInvalid = -1, stUnknown = 0, stNoGui, stInaccessible, stReady };
121 QString name, title, icon, library, version, description, displayer;
123 ModuleInfo() : status( stInvalid ) {}
125 void readModuleList();
128 typedef QList<ModuleInfo> ModuleInfoList;
129 static ModuleInfoList myInfoList; //!< modules info list
130 CAM_Module* myModule; //!< active module
131 ModuleList myModules; //!< loaded modules list
132 bool myAutoLoad; //!< auto loading flag
133 bool myBlocked; //!< "blocked" flag, internal usage
137 #pragma warning( default:4251 )