Version: 9.15.0
SUIT_Application Class Referenceabstract

#include <SUIT_Application.h>

Inheritance diagram for SUIT_Application:
Inheritance graph

Public Member Functions

 SUIT_Application ()
 
virtual ~SUIT_Application ()
 
virtual SUIT_Desktopdesktop ()
 Returns main widget (Desktop) of the application (if it exists) More...
 
virtual bool isPossibleToClose (bool &)
 
virtual void closeApplication ()
 
virtual SUIT_StudyactiveStudy () const
 Returns active Study. If Application supports wirking with several studies this method should be redefined. More...
 
virtual QString applicationName () const =0
 Returns Name of application. Using is not defined. More...
 
virtual QString applicationVersion () const
 
virtual void start ()
 Shows the application's main widget. For non GUI application must be redefined. More...
 
virtual bool useFile (const QString &theFileName)
 Opens document <theFileName> into active Study. If Study is empty - creates it. More...
 
virtual void createEmptyStudy ()
 Creates new empty Study if active Study = 0. More...
 
virtual int getNbStudies () const
 
SUIT_ResourceMgrresourceMgr () const
 
SUIT_ShortcutMgrshortcutMgr () const
 Get access to shortcut manager. More...
 
void putInfo (const QString &, const int=0)
 Puts the message to the status bar. More...
 
virtual QString getFileName (bool open, const QString &initial, const QString &filters, const QString &caption, QWidget *parent)=0
 Invokes application-specific "Open/Save File" dialog and returns the selected file name. More...
 
virtual QString getDirectory (const QString &initial, const QString &caption, QWidget *parent)=0
 Invokes application-specific "Select Directory" dialog and returns the selected directory name. More...
 
virtual int viewManagerId (const SUIT_ViewManager *) const =0
 
virtual void viewManagers (const QString &, QList< SUIT_ViewManager * > &) const =0
 
QActionaction (const int) const
 
void addPostRoutine (void(*theRoutine)())
 
Create tool functions
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 &)
 

Protected Member Functions

Set menu shown functions
void setMenuShown (QAction *, const bool)
 
void setMenuShown (const int, const bool)
 

Set tool shown functions

typedef void(* PostRoutine) ()
 
SUIT_StudymyStudy
 
SUIT_DesktopmyDesktop
 
QMap< int, QAction * > myActionMap
 
SUIT_ShortcutMgrmyShortcutMgr
 
QLabelmyStatusLabel
 
QList< PostRoutinemyPostRoutines
 
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 *)
 
QActioncreateAction (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())
 
QActioncreateAction (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())
 
QActioncreateAction (const int, QObject *, const bool, const QString &, const QString &, const QString &, const QString &, const QIcon &=QIcon(), QObject *=nullptr, const char *=nullptr)
 
static QActionseparator ()
 
virtual void onDesktopActivated ()
 

Create menu functions

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)
 
void applicationClosed (SUIT_Application *)
 
void activated (SUIT_Application *)
 
void infoChanged (QString)
 
virtual void updateCommandsStatus ()
 
virtual void onHelpContextModule (const QString &, const QString &, const QString &=QString())
 
void onInfoClear ()
 
SUIT_ApplicationstartApplication (int, char **) const
 
SUIT_ApplicationstartApplication (const QString &, int, char **) const
 
virtual void setDesktop (SUIT_Desktop *)
 
virtual SUIT_StudycreateNewStudy ()
 Creates a new Study instance. Must be redefined in new application according to its Study type. More...
 
virtual void setActiveStudy (SUIT_Study *)
 

Detailed Description

An Application is a class which defines application configuration and behaviour. For example, Application object defines what Viewers are used in this application, what auxilliary windows are present, how user can dial with them. Also Application object defines an certain type of data structure by holding of pointer on an instance of SUIT_Study class (which represents Document data structure). In other words Application defines type of sata structure, type of used Viewers, type of main GUI widget (Desktop), and other auxilliary tools.

Member Typedef Documentation

◆ PostRoutine

typedef void(* SUIT_Application::PostRoutine) ()
private

Constructor & Destructor Documentation

◆ SUIT_Application()

SUIT_Application::SUIT_Application ( )

Default constructor

References SUIT_Session::insertApplication(), and SUIT_Session::session().

◆ ~SUIT_Application()

SUIT_Application::~SUIT_Application ( )
virtual

Destructor

References myPostRoutines, myStudy, setActiveStudy(), and setDesktop().

Member Function Documentation

◆ action()

QAction * SUIT_Application::action ( const int  id) const
Returns
action by it's SUIT identificator
Parameters
id- SUIT identificator

References myActionMap.

◆ actionId()

int SUIT_Application::actionId ( const QAction a) const
protected
Returns
SUIT identificator of action
Parameters
a- action

References myActionMap.

◆ actionIds()

QList< int > SUIT_Application::actionIds ( ) const
protected

References myActionMap.

◆ actions()

QList< QAction * > SUIT_Application::actions ( ) const
protected

References myActionMap.

◆ activated

void SUIT_Application::activated ( SUIT_Application )
signal

◆ activeStudy()

SUIT_Study * SUIT_Application::activeStudy ( ) const
virtual

Returns active Study. If Application supports wirking with several studies this method should be redefined.

Returns
active Study. If Application supports wirking with several studies this method should be redefined

References myStudy.

◆ addPostRoutine()

void SUIT_Application::addPostRoutine ( void(*)()  theRoutine)

References myPostRoutines.

◆ applicationClosed

void SUIT_Application::applicationClosed ( SUIT_Application )
signal

◆ applicationName()

virtual QString SUIT_Application::applicationName ( ) const
pure virtual

Returns Name of application. Using is not defined.

Implemented in STD_Application, LightApp_Application, and CAF_Application.

◆ applicationVersion()

QString SUIT_Application::applicationVersion ( ) const
virtual
Returns
version of application

Reimplemented in LightApp_Application.

◆ clearTool()

void SUIT_Application::clearTool ( const QString &  title)

Clears given toolbar.

Parameters
title- title of toolbar

References QtxActionToolMgr::clear(), desktop(), and SUIT_Desktop::toolMgr().

◆ closeApplication()

void SUIT_Application::closeApplication ( )
virtual

Performs some finalization of life cycle of this application. For instance, the application can force its documents(s) to close.

Reimplemented in STD_Application, and LightApp_Application.

References applicationClosed().

◆ createAction() [1/3]

QAction * SUIT_Application::createAction ( const int  id,
const QString &  text,
const QIcon &  icon,
const QString &  menu,
const QString &  tip,
const int  key,
QObject parent = 0,
const bool  toggle = false,
QObject reciever = 0,
const char *  member = 0,
const QString &  actionID = QString() 
)
protected

Creates action and registers it both in menu manager and tool manager

Returns
new instance of action
Parameters
id- proposed SUIT identificator
text- description
icon- icon for toolbar
menu- menu text
tip- tool tip
key- shortcut
parent- parent object
toggle- if it is true the action will be a toggle action, otherwise it will be a command action
reciever- object that contains slot
member- slot to be called when action is activated
actionID- application-unique action ID. Required by SUIT_ShortcutMgr for shortcut customization. May be left blank.

◆ createAction() [2/3]

QAction * SUIT_Application::createAction ( const int  id,
const QString &  text,
const QIcon &  icon,
const QString &  menu,
const QString &  tip,
const QKeySequence &  key,
QObject parent = 0,
const bool  toggle = false,
QObject reciever = 0,
const char *  member = 0,
const QString &  actionID = QString() 
)
protected

Creates action and registers it both in menu manager and tool manager

Returns
new instance of action
Parameters
id- proposed SUIT identificator
text- description
icon- icon for toolbar
menu- menu text
tip- tool tip
key- shortcut
parent- parent object
toggle- if it is TRUE the action will be a toggle action, otherwise it will be a command action
reciever- object that contains slot
member- slot to be called when action is activated
actionID- application-unique action ID. Required by SUIT_ShortcutMgr for shortcut customization. May be left blank.

References registerAction().

◆ createAction() [3/3]

QAction * SUIT_Application::createAction ( const int  id,
QObject parent,
const bool  toggle,
const QString &  actionID,
const QString &  toolTip,
const QString &  menuText,
const QString &  statusTip,
const QIcon &  icon = QIcon(),
QObject reciever = nullptr,
const char *  member = nullptr 
)
protected

Creates action and registers it both in menu manager and tool manager

Returns
new instance of action
Parameters
idproposed SUIT identificator
parentparent object
toggleif it is TRUE the action will be a toggle action, otherwise it will be a command action
actionIDapplication-unique action ID. Required by SUIT_ShortcutMgr for shortcut customization. May be left blank.
toolTip
menuTextcan be later retrieved using QAction::text();
statusTip
iconicon for toolbar
recieverobject that contains slot
memberslot to be called when action is activated

References registerAction().

◆ createEmptyStudy()

void SUIT_Application::createEmptyStudy ( )
virtual

Creates new empty Study if active Study = 0.

Creates new empty Study if active Study = 0

Reimplemented in STD_Application, LightApp_Application, and CAM_Application.

References activeStudy(), createNewStudy(), and setActiveStudy().

◆ createMenu() [1/6]

int SUIT_Application::createMenu ( const int  id,
const int  menu,
const int  group = -1,
const int  index = -1 
)

Creates new menu item

Returns
identificator of new action in menu manager
Parameters
id- SUIT identificator of action
menu- menu text of parent menu item
group- group in menu manager
index- index in menu

References action(), desktop(), QtxActionMenuMgr::insert(), and SUIT_Desktop::menuMgr().

◆ createMenu() [2/6]

int SUIT_Application::createMenu ( const int  id,
const QString &  menu,
const int  group = -1,
const int  index = -1 
)

Creates new menu item

Returns
identificator of new action in menu manager
Parameters
id- SUIT identificator of action
menu- menu text of parent menu item
group- group in menu manager
index- index in menu

References action(), desktop(), QtxActionMenuMgr::insert(), and SUIT_Desktop::menuMgr().

◆ createMenu() [3/6]

int SUIT_Application::createMenu ( const QString &  subMenu,
const int  menu,
const int  id = -1,
const int  group = -1,
const int  index = -1 
)

Creates new menu item

Returns
identificator of new action in menu manager
Parameters
subMenu- menu text of new item
menu- identificator of parent menu item
id- proposed identificator of action
group- group in menu manager
index- index in menu

References desktop(), QtxActionMenuMgr::insert(), and SUIT_Desktop::menuMgr().

◆ createMenu() [4/6]

int SUIT_Application::createMenu ( const QString &  subMenu,
const QString &  menu,
const int  id = -1,
const int  group = -1,
const int  index = -1 
)

Creates new menu item

Returns
identificator of new action in menu manager
Parameters
subMenu- menu text of new item
menu- menu text of parent menu item
id- proposed identificator of action
group- group in menu manager
index- index in menu

References desktop(), QtxActionMenuMgr::insert(), and SUIT_Desktop::menuMgr().

◆ createMenu() [5/6]

int SUIT_Application::createMenu ( QAction a,
const int  menu,
const int  id = -1,
const int  group = -1,
const int  index = -1 
)

Creates new menu item

Returns
SUIT identificator of new action
Parameters
a- action
menu- identificator of parent menu item
id- proposed SUIT identificator of action
group- group in menu manager
index- index in menu

References desktop(), QtxActionMenuMgr::insert(), SUIT_Desktop::menuMgr(), and registerAction().

◆ createMenu() [6/6]

int SUIT_Application::createMenu ( QAction a,
const QString &  menu,
const int  id = -1,
const int  group = -1,
const int  index = -1 
)

Creates new menu item

Returns
SUIT identificator of new action
Parameters
a- action
menu- menu text of parent menu item
id- proposed SUIT identificator of action
group- group in menu manager
index- index in menu

References desktop(), QtxActionMenuMgr::insert(), SUIT_Desktop::menuMgr(), and registerAction().

◆ createNewStudy()

SUIT_Study * SUIT_Application::createNewStudy ( )
protectedvirtual

Creates a new Study instance. Must be redefined in new application according to its Study type.

Creates new instance of study. By default, it is called from createEmptyStudy()

See also
createEmptyStudy()

Reimplemented in SalomeApp_Application, LightApp_Application, CAM_Application, and CAF_Application.

◆ createTool() [1/5]

int SUIT_Application::createTool ( const int  id,
const int  tBar,
const int  idx = -1 
)

Creates new toolbutton

Returns
"id" if all right or -1 otherwise
Parameters
id- SUIT identificator of action
tBar- identificator of toolbar
idx- index in toolbar

References action(), desktop(), QtxActionToolMgr::insert(), and SUIT_Desktop::toolMgr().

◆ createTool() [2/5]

int SUIT_Application::createTool ( const int  id,
const QString &  tBar,
const int  idx = -1 
)

Creates new toolbutton

Returns
"id" if all right or -1 otherwise
Parameters
id- SUIT identificator of action
tBar- name of toolbar
idx- index in toolbar

References action(), desktop(), QtxActionToolMgr::insert(), and SUIT_Desktop::toolMgr().

◆ createTool() [3/5]

int SUIT_Application::createTool ( const QString &  title,
const QString &  name = QString() 
)

Creates new toolbar

Returns
identificator of new toolbar in tool manager
Parameters
title- title of new toolbar
name- name (identifier) of new toolbar

References QtxActionToolMgr::createToolBar(), desktop(), and SUIT_Desktop::toolMgr().

◆ createTool() [4/5]

int SUIT_Application::createTool ( QAction a,
const int  tBar,
const int  id = -1,
const int  idx = -1 
)

Creates new toolbutton

Returns
SUIT identificator of new action
Parameters
a- action
tBar- identificator of toolbar
id- proposed SUIT identificator of action (if it is -1, then must be use any free)
idx- index in toolbar

References desktop(), QtxActionToolMgr::insert(), registerAction(), and SUIT_Desktop::toolMgr().

◆ createTool() [5/5]

int SUIT_Application::createTool ( QAction a,
const QString &  tBar,
const int  id = -1,
const int  idx = -1 
)

Creates new toolbutton

Returns
SUIT identificator of new action
Parameters
a- action
tBar- name of toolbar
id- proposed SUIT identificator of action (if it is -1, then must be use any free)
idx- index in toolbar

References desktop(), QtxActionToolMgr::insert(), registerAction(), and SUIT_Desktop::toolMgr().

◆ desktop()

SUIT_Desktop * SUIT_Application::desktop ( )
virtual

Returns main widget (Desktop) of the application (if it exists)

Returns
main window of application (desktop)

References myDesktop.

◆ getDirectory()

virtual QString SUIT_Application::getDirectory ( const QString &  initial,
const QString &  caption,
QWidget parent 
)
pure virtual

Invokes application-specific "Select Directory" dialog and returns the selected directory name.

Implemented in STD_Application, and LightApp_Application.

◆ getFileName()

virtual QString SUIT_Application::getFileName ( bool  open,
const QString &  initial,
const QString &  filters,
const QString &  caption,
QWidget parent 
)
pure virtual

Invokes application-specific "Open/Save File" dialog and returns the selected file name.

Implemented in STD_Application, and LightApp_Application.

◆ getNbStudies()

int SUIT_Application::getNbStudies ( ) const
virtual

Returns number of Studies. Must be redefined in Applications which support several studies for one Application instance.

Returns
number of Studies. Must be redefined in Applications which support several studies for one Application instance.

References activeStudy().

◆ infoChanged

void SUIT_Application::infoChanged ( QString  )
signal

◆ isPossibleToClose()

bool SUIT_Application::isPossibleToClose ( bool &  )
virtual

Returns false if application can not be closed (because of non saved data for example). This method called by SUIT_Session whin closing of application was requested.

Returns
false if application can not be closed (because of non saved data for example). This method called by SUIT_Session when closing of application was requested.

Reimplemented in STD_Application, and SalomeApp_Application.

◆ onDesktopActivated

void SUIT_Application::onDesktopActivated ( )
protectedvirtualslot

SLOT: it is called when desktop is activated

References activated().

◆ onHelpContextModule

void SUIT_Application::onHelpContextModule ( const QString &  ,
const QString &  ,
const QString &  = QString() 
)
virtualslot

SLOT: it is called when desktop is moved

SLOT: is used for Help browsing

◆ onInfoClear

void SUIT_Application::onInfoClear ( )
privateslot

Clear the information label in status bar after delay.

References infoChanged(), and myStatusLabel.

◆ putInfo()

void SUIT_Application::putInfo ( const QString &  msg,
const int  msec = 0 
)

Puts the message to the status bar.

Puts the message to the status bar

Parameters
msg- text of message
msec- time in milliseconds, after that the status label will be cleared

References DEFAULT_MESSAGE_DELAY, desktop(), infoChanged(), myStatusLabel, and onInfoClear().

◆ registerAction()

int SUIT_Application::registerAction ( const int  id,
QAction a 
)
protected

Registers action both in menu manager and tool manager

Parameters
id- proposed SUIT identificator (if it is -1, auto generated one is used)
a- action

References action(), actionId(), desktop(), SUIT_Desktop::menuMgr(), myActionMap, QtxActionMgr::registerAction(), and SUIT_Desktop::toolMgr().

◆ resourceMgr()

SUIT_ResourceMgr * SUIT_Application::resourceMgr ( ) const
Returns
global resource manager

References SUIT_Session::resourceMgr(), and SUIT_Session::session().

◆ separator()

QAction * SUIT_Application::separator ( )
staticprotected
Returns
global action used as separator

References QtxActionMgr::separator().

◆ setActionShown() [1/2]

void SUIT_Application::setActionShown ( const int  id,
const bool  on 
)
protected

Show/hide both menu item and tool button corresponding to action

Parameters
id- identificator in both menu manager and tool manager
on- if it is true, the item will be shown, otherwise it will be hidden

References setMenuShown(), and setToolShown().

◆ setActionShown() [2/2]

void SUIT_Application::setActionShown ( QAction a,
const bool  on 
)
protected

Show/hide both menu item and tool button corresponding to action

Parameters
a- action
on- if it is true, the item will be shown, otherwise it will be hidden

References setMenuShown(), and setToolShown().

◆ setActiveStudy()

void SUIT_Application::setActiveStudy ( SUIT_Study study)
protectedvirtual

Sets study as active

Parameters
study- instance of study to be set as active

Reimplemented in LightApp_Application, and CAM_Application.

References myStudy, and updateCommandsStatus().

◆ setDesktop()

void SUIT_Application::setDesktop ( SUIT_Desktop desk)
protectedvirtual

Sets the main window of application

Parameters
desk- new main window (desktop)

Reimplemented in STD_Application, and LightApp_Application.

References activated(), myDesktop, and onDesktopActivated().

◆ setMenuShown() [1/2]

void SUIT_Application::setMenuShown ( const int  id,
const bool  on 
)
protected

Show/hide menu item corresponding to action

Parameters
id- identificator of action in menu manager
on- if it is true, the item will be shown, otherwise it will be hidden

References action(), and setMenuShown().

◆ setMenuShown() [2/2]

void SUIT_Application::setMenuShown ( QAction a,
const bool  on 
)
protected

Show/hide menu item corresponding to action

Parameters
a- action
on- if it is true, the item will be shown, otherwise it will be hidden

References QtxActionMgr::actionId(), desktop(), SUIT_Desktop::menuMgr(), and QtxActionMenuMgr::setShown().

◆ setToolShown() [1/2]

void SUIT_Application::setToolShown ( const int  id,
const bool  on 
)
protected

Show/hide menu item corresponding to action

Parameters
id- identificator of action in tool manager
on- if it is true, the button will be shown, otherwise it will be hidden

References action(), and setToolShown().

◆ setToolShown() [2/2]

void SUIT_Application::setToolShown ( QAction a,
const bool  on 
)
protected

Show/hide tool button corresponding to action

Parameters
a- action
on- if it is true, the button will be shown, otherwise it will be hidden

References QtxActionMgr::actionId(), desktop(), QtxActionToolMgr::setShown(), and SUIT_Desktop::toolMgr().

◆ shortcutMgr()

SUIT_ShortcutMgr * SUIT_Application::shortcutMgr ( ) const

Get access to shortcut manager.

Returns
global shortcut manager

References SUIT_ShortcutMgr::get().

◆ start()

void SUIT_Application::start ( )
virtual

Shows the application's main widget. For non GUI application must be redefined.

Shows the application's main widget. For non GUI application must be redefined.

Reimplemented in STD_Application, SalomeApp_Application, LightApp_Application, and CAM_Application.

References desktop(), and SUIT_ShortcutMgr::Init().

◆ startApplication() [1/2]

SUIT_Application * SUIT_Application::startApplication ( const QString &  name,
int  argc,
char **  argv 
) const
protected

Initialize with application name and arguments

Parameters
name- name of application
argc- number of application arguments
argv- array of application arguments

References SUIT_Session::session(), and SUIT_Session::startApplication().

◆ startApplication() [2/2]

SUIT_Application * SUIT_Application::startApplication ( int  argc,
char **  argv 
) const
protected

Initialize with application arguments

Parameters
argc- number of application arguments
argv- array of application arguments

◆ updateCommandsStatus

void SUIT_Application::updateCommandsStatus ( )
virtualslot

Update status of the registerd actions

Reimplemented in STD_Application, SalomeApp_Application, LightApp_Application, CAM_Application, and CAF_Application.

◆ useFile()

bool SUIT_Application::useFile ( const QString &  theFileName)
virtual

Opens document <theFileName> into active Study. If Study is empty - creates it.

Opens document into active Study. If Study is empty - creates it.

Parameters
theFileName- name of document file

Reimplemented in STD_Application.

References activeStudy(), createEmptyStudy(), SUIT_Study::openDocument(), and setActiveStudy().

◆ viewManagerId()

virtual int SUIT_Application::viewManagerId ( const SUIT_ViewManager ) const
pure virtual

Implemented in STD_Application.

◆ viewManagers()

virtual void SUIT_Application::viewManagers ( const QString &  ,
QList< SUIT_ViewManager * > &   
) const
pure virtual

Implemented in STD_Application.

Member Data Documentation

◆ myActionMap

QMap<int, QAction*> SUIT_Application::myActionMap
private

◆ myDesktop

SUIT_Desktop* SUIT_Application::myDesktop
private

◆ myPostRoutines

QList<PostRoutine> SUIT_Application::myPostRoutines
private

◆ myShortcutMgr

SUIT_ShortcutMgr* SUIT_Application::myShortcutMgr
private

◆ myStatusLabel

QLabel* SUIT_Application::myStatusLabel
private

◆ myStudy

SUIT_Study* SUIT_Application::myStudy
private

The documentation for this class was generated from the following files: