Introduces an application class which provides modular architecture. More...
#include <CAM_Application.h>

Classes | |
| struct | ModuleInfo |
| struct | ModuleShortInfo |
Public Types | |
| typedef QList< CAM_Module * > | ModuleList |
| typedef QList< ModuleShortInfo > | ModuleShortInfoList |
Public Types inherited from STD_Application | |
| enum | { MenuFileId , FileNewId , FileOpenId , FileReopenId , FileCloseId , FileSaveId , FileSaveAsId , FileExitId , MenuViewId , ViewWindowsId , ViewToolBarsId , ViewStatusBarId , NewWindowId , MenuEditId , EditCutId , EditCopyId , EditPasteId , MenuHelpId , HelpAboutId , UserID } |
Public Member Functions | |
| CAM_Application (const bool=true) | |
| Constructor. More... | |
| virtual | ~CAM_Application () |
| Destructor. More... | |
| virtual void | start () |
| Start an application. More... | |
| CAM_Module * | activeModule () const |
| Get active module. More... | |
| CAM_Module * | module (const QString &) const |
| Get the module with specified name. More... | |
| ModuleList | modules () const |
| Get all loaded modules. More... | |
| void | modules (ModuleList &) const |
| Get all loaded modules. More... | |
| void | modules (QStringList &, const bool loaded=true) const |
| Get names of all modules. More... | |
| virtual void | addModule (CAM_Module *) |
| Add module mod to the modules list. More... | |
| virtual void | loadModules () |
| Load modules from the modules information list. More... | |
| virtual CAM_Module * | loadModule (const QString &, const bool=true) |
| Load module modName. More... | |
| virtual bool | activateModule (const QString &) |
| Activate module modName. More... | |
| bool | activateOperation (const QString &modName, const int actionId) |
| Load module modName and activate its operation, corresponding to actionId. This method is dedicated to run operations of some module from any other module. More... | |
| bool | activateOperation (const QString &modName, const QString &actionId) |
| Load module modName and activate its operation, corresponding to actionId. This method is dedicated to run operations of some module from any other module. More... | |
| bool | activateOperation (const QString &modName, const QString &actionId, const QString &pluginName) |
| Load module modName and activate its operation, corresponding to actionId and pluginName. This method is dedicated to run operations of some module from any other module. More... | |
| virtual void | contextMenuPopup (const QString &, QMenu *, QString &) |
| Add common menu items to the popup menu. More... | |
| virtual void | createEmptyStudy () |
| Create new empty study. More... | |
Public Member Functions inherited from STD_Application | |
| STD_Application () | |
| virtual | ~STD_Application () |
| virtual QString | applicationName () const |
| virtual bool | isPossibleToClose (bool &) |
| virtual bool | useFile (const QString &) |
| void | setEditEnabled (const bool) |
| bool | isEditEnabled () const |
| void | clearViewManagers () |
| virtual void | addViewManager (SUIT_ViewManager *) |
| virtual void | removeViewManager (SUIT_ViewManager *) |
| SUIT_ViewManager * | activeViewManager () const |
| SUIT_ViewManager * | viewManager (const QString &) const |
| bool | containsViewManager (SUIT_ViewManager *) const |
| ViewManagerList | viewManagers () const |
| void | viewManagers (ViewManagerList &) const |
| void | viewManagers (const QString &, ViewManagerList &) const |
| virtual int | viewManagerId (const SUIT_ViewManager *) const |
| virtual QString | getFileFilter (bool open) const |
| virtual QString | getFileName (bool open, const QString &initial, const QString &filters, const QString &caption, QWidget *parent) |
| QString | getDirectory (const QString &initial, const QString &caption, QWidget *parent) |
| virtual void | closeApplication () |
| bool | exitConfirmation () const |
| void | setExitConfirmation (const bool) |
| virtual void | updateDesktopTitle () |
| int | showNotification (const QString &message, const QString &title, int timeout=-1) |
| Show notification with specified text and title. More... | |
| void | hideNotification (const QString &message) |
| Close notifications with specified text. More... | |
| void | hideNotification (int id) |
| Closes the notifications with specified identifier. More... | |
Public Member Functions inherited from SUIT_Application | |
| SUIT_Application () | |
| virtual | ~SUIT_Application () |
| virtual SUIT_Desktop * | desktop () |
| Returns main widget (Desktop) of the application (if it exists) More... | |
| virtual SUIT_Study * | activeStudy () const |
| Returns active Study. If Application supports wirking with several studies this method should be redefined. More... | |
| virtual QString | applicationVersion () const |
| virtual int | getNbStudies () const |
| SUIT_ResourceMgr * | resourceMgr () const |
| SUIT_ShortcutMgr * | shortcutMgr () const |
| Get access to shortcut manager. More... | |
| void | putInfo (const QString &, const int=0) |
| Puts the message to the status bar. More... | |
| QAction * | action (const int) const |
| void | addPostRoutine (void(*theRoutine)()) |
| int | createTool (const QString &, const QString &=QString()) |
| int | createTool (const int, const int, const int=-1) |
| int | createTool (const int, const QString &, const int=-1) |
| int | createTool (QAction *, const int, const int=-1, const int=-1) |
| int | createTool (QAction *, const QString &, const int=-1, const int=-1) |
| void | clearTool (const QString &) |
| int | createMenu (const QString &, const int, const int=-1, const int=-1, const int=-1) |
| int | createMenu (const QString &, const QString &, const int=-1, const int=-1, const int=-1) |
| int | createMenu (const int, const int, const int=-1, const int=-1) |
| int | createMenu (const int, const QString &, const int=-1, const int=-1) |
| int | createMenu (QAction *, const int, const int=-1, const int=-1, const int=-1) |
| int | createMenu (QAction *, const QString &, const int=-1, const int=-1, const int=-1) |
Static Public Member Functions | |
| static QString | moduleName (const QString &) |
| Get module name by its title (user name). More... | |
| static QString | moduleTitle (const QString &) |
| Get module title (user name) by its name. More... | |
| static QString | moduleIcon (const QString &) |
| Get module icon name. More... | |
| static QString | moduleDescription (const QString &) |
| Get module description. More... | |
| static QString | moduleLibrary (const QString &, const bool=true) |
| Get module library name by its title (user name). More... | |
| static QString | moduleDisplayer (const QString &) |
| Get displayer proxy for given module, by its title (user name). More... | |
| static ModuleShortInfoList | getVersionInfo () |
| Return information about version of the each module. More... | |
| static void | logUserEvent (const QString &) |
| Log GUI event. More... | |
| static void | logAction (QAction *, const QString &=QString()) |
| Log given action. More... | |
| static void | logStructuredUserEvent (const QString &module, const QString §ion, const QString &action, const QString &event, const QString &message="") |
Protected Member Functions | |
| virtual SUIT_Study * | createNewStudy () |
| Create new study. More... | |
| virtual void | updateCommandsStatus () |
| Update menu commands status. More... | |
| virtual bool | checkModule (const QString &) |
| Check module availability. More... | |
| virtual void | moduleAdded (CAM_Module *) |
| Callback function, called when the module is added to the application. More... | |
| virtual void | moduleDeactivated (CAM_Module *) |
| Callback function, called when the module is just deactivated. More... | |
| virtual void | beforeCloseDoc (SUIT_Study *) |
| Prepare application to study closing. More... | |
| virtual void | afterCloseDoc () |
| virtual bool | activateModule (CAM_Module *=0) |
| Activate module mod. More... | |
| virtual void | setActiveStudy (SUIT_Study *) |
| Set active study. More... | |
| virtual bool | abortAllOperations () |
| Abort active operations if there are any. More... | |
| bool | appendModuleInfo (const QString &) |
| void | removeModuleInfo (const QString &) |
| void | showAllModuleInfo () |
Protected Member Functions inherited from STD_Application | |
| virtual void | createActions () |
| virtual void | customize () |
| 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 *) |
| virtual void | setActiveViewManager (SUIT_ViewManager *) |
| virtual int | openChoice (const QString &) |
| virtual bool | openAction (const int, const QString &) |
| virtual int | closeChoice (const QString &) |
| virtual bool | closeAction (const int, bool &) |
| virtual bool | closeDoc (bool ask=true) |
| virtual bool | closeActiveDoc (bool permanently=true) |
Protected Member Functions inherited from SUIT_Application | |
| void | setMenuShown (QAction *, const bool) |
| void | setMenuShown (const int, const bool) |
| void | setToolShown (QAction *, const bool) |
| void | setToolShown (const int, const bool) |
| void | setActionShown (QAction *, const bool) |
| void | setActionShown (const int, const bool) |
| int | actionId (const QAction *) const |
| QList< QAction * > | actions () const |
| QList< int > | actionIds () const |
| int | registerAction (const int, QAction *) |
| QAction * | createAction (const int, const QString &, const QIcon &, const QString &, const QString &, const int, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString()) |
| QAction * | createAction (const int, const QString &, const QIcon &, const QString &, const QString &, const QKeySequence &, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString()) |
| QAction * | createAction (const int, QObject *, const bool, const QString &, const QString &, const QString &, const QString &, const QIcon &=QIcon(), QObject *=nullptr, const char *=nullptr) |
| SUIT_Application * | startApplication (int, char **) const |
| SUIT_Application * | startApplication (const QString &, int, char **) const |
Private Types | |
| enum | { stInvalid = -1 , stUnknown = 0 , stNoGui , stInaccessible , stReady } |
| typedef QList< ModuleInfo > | ModuleInfoList |
Private Member Functions | |
| void | readModuleList () |
| Read modules information list. More... | |
Private Attributes | |
| CAM_Module * | myModule |
| active module More... | |
| ModuleList | myModules |
| loaded modules list More... | |
| bool | myAutoLoad |
| auto loading flag More... | |
| bool | myBlocked |
| "blocked" flag, internal usage More... | |
Static Private Attributes | |
| static ModuleInfoList | myInfoList |
| modules info list More... | |
Additional Inherited Members | |
Public Slots inherited from STD_Application | |
| virtual void | onNewDoc () |
| virtual bool | onNewDoc (const QString &) |
| virtual void | onCloseDoc (bool ask=true) |
| virtual bool | onSaveDoc () |
| virtual bool | onSaveAsDoc () |
| virtual void | onOpenDoc () |
| virtual bool | onOpenDoc (const QString &) |
| virtual bool | onReopenDoc () |
| virtual void | onExit () |
| virtual void | onCopy () |
| virtual void | onPaste () |
| virtual void | onViewStatusBar (bool) |
| virtual void | onHelpAbout () |
| virtual void | onDesktopClosing (SUIT_Desktop *, QCloseEvent *) |
| virtual void | onConnectPopupRequest (SUIT_PopupClient *, QContextMenuEvent *) |
Public Slots inherited from SUIT_Application | |
| virtual void | onHelpContextModule (const QString &, const QString &, const QString &=QString()) |
Signals inherited from STD_Application | |
| void | viewManagerAdded (SUIT_ViewManager *) |
| void | viewManagerRemoved (SUIT_ViewManager *) |
| void | viewManagerActivated (SUIT_ViewManager *) |
| void | appClosed () |
Signals inherited from SUIT_Application | |
| void | applicationClosed (SUIT_Application *) |
| void | activated (SUIT_Application *) |
| void | infoChanged (QString) |
Protected Types inherited from STD_Application | |
| enum | { OpenCancel , OpenNew , OpenExist } |
| enum | { CloseCancel , CloseSave , CloseDiscard } |
Protected Slots inherited from SUIT_Application | |
| virtual void | onDesktopActivated () |
Static Protected Member Functions inherited from SUIT_Application | |
| static QAction * | separator () |
Introduces an application class which provides modular architecture.
This class defines multi-modular application configuration and behaviour. Each module (CAM_Module) can have own data model, document windows and viewers, etc.
An application provides all necessary functionality for modules management, like
|
private |
| typedef QList<CAM_Module*> CAM_Application::ModuleList |
| CAM_Application::CAM_Application | ( | const bool | autoLoad = true | ) |
Constructor.
Read modules list (from command line or from resource file). If autoLoad parameter is true all the modules will be loaded immediately after application starting, otherwise each module will be loaded by demand (with activateModule()).
| autoLoad | auto loading flag |
References readModuleList().
|
virtual |
|
protectedvirtual |
Abort active operations if there are any.
Iterates through all modules and asks each of them if there are pending operations that cannot be aborted.
false if some operation cannot be aborted Reimplemented from STD_Application.
References myModules.
|
protectedvirtual |
Activate module mod.
Shows error message if module could not be activated in the current study.
| mod | module object pointer |
true, if module is loaded and activated successfully and false otherwise Reimplemented in LightApp_Application.
References CAM_Module::activateModule(), SUIT_Application::activeStudy(), CAM_Module::connectToStudy(), SUIT_MessageBox::critical(), CAM_Module::deactivateModule(), SUIT_Application::desktop(), logStructuredUserEvent(), moduleDeactivated(), CAM_Module::moduleName(), myModule, CAM_Module::setMenuShown(), CAM_Module::setToolShown(), and updateCommandsStatus().
|
virtual |
Activate module modName.
| modName | module name |
true, if module is loaded and activated successfully and false otherwise Reimplemented in LightApp_Application.
References SUIT_Application::activeStudy(), addModule(), loadModule(), module(), moduleTitle(), and myBlocked.
| bool CAM_Application::activateOperation | ( | const QString & | modName, |
| const int | actionId | ||
| ) |
Load module modName and activate its operation, corresponding to actionId. This method is dedicated to run operations of some module from any other module.
| modName | module name |
| actionId | is a numerical unique operation identifier |
true in case of success and false otherwise References SUIT_Application::actionId(), CAM_Module::activateOperation(), addModule(), and loadModule().
| bool CAM_Application::activateOperation | ( | const QString & | modName, |
| const QString & | actionId | ||
| ) |
Load module modName and activate its operation, corresponding to actionId. This method is dedicated to run operations of some module from any other module.
| modName | module name |
| actionId | is a string unique operation identifier |
true in case of success and false otherwise References SUIT_Application::actionId(), CAM_Module::activateOperation(), addModule(), and loadModule().
| bool CAM_Application::activateOperation | ( | const QString & | modName, |
| const QString & | actionId, | ||
| const QString & | pluginName | ||
| ) |
Load module modName and activate its operation, corresponding to actionId and pluginName. This method is dedicated to run operations of some module from any other module.
| modName | module name |
| actionId | is a string unique operation identifier |
| pluginName | is a name of a plugin where the operation is implemented |
true in case of success and false otherwise References SUIT_Application::actionId(), CAM_Module::activateOperation(), addModule(), and loadModule().
| CAM_Module * CAM_Application::activeModule | ( | ) | const |
|
virtual |
Add module mod to the modules list.
Performes module initialization. Does nothing if the module is already added.
| mod | module being added |
References CAM_Module::initialize(), module(), moduleAdded(), CAM_Module::moduleName(), myInfoList, and myModules.
|
protectedvirtual |
Virtual function. Not implemented here.
Reimplemented from STD_Application.
Reimplemented in SalomeApp_Application, and LightApp_Application.
|
protected |
References QtxResourceMgr::booleanValue(), CAM_Application::ModuleInfo::description, CAM_Application::ModuleInfo::displayer, CAM_Application::ModuleInfo::icon, CAM_Application::ModuleInfo::library, Qtx::libraryName(), moduleTitle(), myInfoList, CAM_Application::ModuleInfo::name, SUIT_Session::resourceMgr(), SUIT_Session::session(), CAM_Application::ModuleInfo::status, stNoGui, QtxResourceMgr::stringValue(), stUnknown, CAM_Application::ModuleInfo::title, and CAM_Application::ModuleInfo::version.
|
protectedvirtual |
Prepare application to study closing.
Closes all modules in study theDoc.
| theDoc | study |
Reimplemented from STD_Application.
Reimplemented in LightApp_Application.
References myModules.
|
protectedvirtual |
Check module availability.
The method can be redefined in successors. Default implementation returns true.
| title | module title |
true if module is accessible; false otherwise Reimplemented in LightApp_Application.
|
virtual |
Add common menu items to the popup menu.
Menu items list is defined by the active module.
| type | popup menu context |
| menu | popup menu |
| title | popup menu title, which can be set by the module if required |
Reimplemented from STD_Application.
Reimplemented in SalomeApp_Application, and LightApp_Application.
References activeModule(), and CAM_Module::contextMenuPopup().
|
virtual |
Create new empty study.
Reimplemented from STD_Application.
Reimplemented in LightApp_Application.
References SUIT_Application::activeStudy(), and STD_Application::createEmptyStudy().
|
protectedvirtual |
Create new study.
Reimplemented from SUIT_Application.
Reimplemented in SalomeApp_Application, and LightApp_Application.
|
static |
Return information about version of the each module.
References myInfoList, CAM_Application::ModuleShortInfo::name, and CAM_Application::ModuleShortInfo::version.
|
virtual |
Load module modName.
The function prints warning message if:
| modName | module name |
Reimplemented in LightApp_Application.
References SUIT_Application::desktop(), GET_MODULE_NAME, GET_VERSION_NAME, module(), moduleLibrary(), moduleName(), myInfoList, CAM_Module::setModuleName(), CAM_Module::setName(), and SUIT_MessageBox::warning().
|
virtual |
Load modules from the modules information list.
If some module can not be loaded, an error message is shown.
References addModule(), SUIT_MessageBox::critical(), SUIT_Application::desktop(), loadModule(), and myInfoList.
|
static |
Log given action.
| action | GUI action being logged. |
| moduleName | optional name of module, owning an action |
References SUIT_Application::action(), logStructuredUserEvent(), and moduleName().
|
static |
References SUIT_Application::action(), logUserEvent(), and module().
|
static |
| CAM_Module * CAM_Application::module | ( | const QString & | modName | ) | const |
|
protectedvirtual |
Callback function, called when the module is added to the application.
This virtual method can be re-implemented in the successors. Base implementation does nothing.
| mod | module being added |
Reimplemented in LightApp_Application.
|
protectedvirtual |
Callback function, called when the module is just deactivated.
This virtual method can be re-implemented in the successors. Base implementation does nothing.
| mod | module just deactivated |
Reimplemented in LightApp_Application.
|
static |
Get module description.
| name | module name or title |
References myInfoList.
|
static |
Get displayer proxy for given module, by its title (user name).
| name | module name or title |
References myInfoList.
|
static |
Get module icon name.
| name | module name or title |
References myInfoList.
|
static |
Get module library name by its title (user name).
| title | module name or title |
| full | if true, return full library name, otherwise return its internal name |
References Qtx::library(), and myInfoList.
|
static |
Get module name by its title (user name).
| title | module title (user name) |
References myInfoList.
| CAM_Application::ModuleList CAM_Application::modules | ( | ) | const |
| void CAM_Application::modules | ( | CAM_Application::ModuleList & | out | ) | const |
| void CAM_Application::modules | ( | QStringList & | lst, |
| const bool | loaded = true |
||
| ) | const |
Get names of all modules.
Get loaded modules names if loaded is true, otherwise get all avaiable modules names.
| lst | output list of modules names |
| loaded | boolean flag, defines what modules names to return |
References myInfoList, myModules, and stNoGui.
|
static |
Get module title (user name) by its name.
| name | module name |
References myInfoList.
|
private |
Read modules information list.
This function first tries to get the modules names list by parsing the application command line arguments, looking for the "--modules ( <mod_name>[:<mod_name>...] )" option. List of modules is separated by colon symbol (":").
If "--modules" command line option is not used, the list of modules is retrieved from the application resource file: parameter "modules" of the section "launch".
Then the information about each module (module title (user name), library name) is retrieved from the corresponding section of resource file with help of resources manager.
Shows the warning message, if module information list is empty.
References appendModuleInfo(), SUIT_Application::desktop(), modules(), myInfoList, SUIT_Session::resourceMgr(), SUIT_Session::session(), QtxResourceMgr::stringValue(), and SUIT_MessageBox::warning().
|
protected |
References myInfoList, and CAM_Application::ModuleInfo::name.
|
protectedvirtual |
Set active study.
| study | study to be made active |
Reimplemented from SUIT_Application.
Reimplemented in LightApp_Application.
References SUIT_Application::setActiveStudy().
|
protected |
References myInfoList.
|
virtual |
Start an application.
Load all modules, if "auto loading" flag has been set to true.
Reimplemented from STD_Application.
Reimplemented in SalomeApp_Application, and LightApp_Application.
References checkModule(), loadModules(), myAutoLoad, myInfoList, STD_Application::start(), stInaccessible, stReady, and stUnknown.
|
protectedvirtual |
Update menu commands status.
Reimplemented from STD_Application.
Reimplemented in SalomeApp_Application, and LightApp_Application.
References activeModule(), CAM_Module::updateCommandsStatus(), and STD_Application::updateCommandsStatus().
|
private |
auto loading flag
|
private |
"blocked" flag, internal usage
|
staticprivate |
modules info list
|
private |
active module
|
private |
loaded modules list