Add all desktop actions, which are bound to non-empty key sequences in master branch, to shortcut editor.
/*!Creat action "New window" for certain type of viewer:*/
void LightApp_Application::createActionForViewer( const int id,
const int parentId,
- const QString& suffix,
- const int accel )
+ const QString& suffix )
{
QString vtlt = tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() );
QString tip = tr( "CREATING_NEW_WINDOW" ).arg( vtlt.remove( "&" ) );
- QAction* a = createAction( id, // menu action id
- tip, // status tip
- QIcon(), // icon
- vtlt, // menu text
- tip, // tooltip
- accel, // shortcut
- desktop(), // parent
- false, // toggle flag
- this, // receiver
- SLOT( onNewWindow() ) ); // slot
+ QAction* a = createAction(id, desktop(), false /*toggle*/, "/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_" + suffix,
+ tip, vtlt, tip, QIcon(),
+ this, SLOT(onNewWindow()));
+
createMenu( a, parentId, -1 );
}
// Preferences
createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIcon(),
tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
- Qt::CTRL+Qt::Key_P, desk, false, this, SLOT( onPreferences() ) );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onPreferences() ), "/PRP_DESK_PREFERENCES" );
// Help menu
createAction( CloseId, tr( "TOT_CLOSE" ), QIcon(), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ),
Qt::CTRL+Qt::Key_F4, desk, false, this, SLOT( onCloseWindow() ) );
+
+ createAction( CloseId, desk, false /*toggle*/, "/PRP_CLOSE",
+ tr( "TOT_CLOSE" ), tr( "MEN_DESK_CLOSE" ), tr( "PRP_CLOSE" ), QIcon(),
+ this, SLOT( onCloseWindow() ) );
+
createAction( CloseAllId, tr( "TOT_CLOSE_ALL" ), QIcon(), tr( "MEN_DESK_CLOSE_ALL" ), tr( "PRP_CLOSE_ALL" ),
0, desk, false, this, SLOT( onCloseAllWindow() ) );
createAction( GroupAllId, tr( "TOT_GROUP_ALL" ), QIcon(), tr( "MEN_DESK_GROUP_ALL" ), tr( "PRP_GROUP_ALL" ),
createMenu( separator(), windowMenu, -1, 0 );
#ifndef DISABLE_GLVIEWER
- createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ), Qt::ALT+Qt::Key_G );
+ createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ) );
#endif
#ifndef DISABLE_PLOT2DVIEWER
- createActionForViewer( NewPlot2dId, newWinMenu, QString::number( 1 ), Qt::ALT+Qt::Key_P );
+ createActionForViewer( NewPlot2dId, newWinMenu, QString::number( 1 ) );
#endif
#ifndef DISABLE_OCCVIEWER
- createActionForViewer( NewOCCViewId, newWinMenu, QString::number( 2 ), Qt::ALT+Qt::Key_O );
+ createActionForViewer( NewOCCViewId, newWinMenu, QString::number( 2 ) );
#endif
#ifndef DISABLE_VTKVIEWER
- createActionForViewer( NewVTKViewId, newWinMenu, QString::number( 3 ), Qt::ALT+Qt::Key_K );
+ createActionForViewer( NewVTKViewId, newWinMenu, QString::number( 3 ) );
#endif
#ifndef DISABLE_QXGRAPHVIEWER
- createActionForViewer( NewQxSceneViewId, newWinMenu, QString::number( 4 ), Qt::ALT+Qt::Key_S );
+ createActionForViewer( NewQxSceneViewId, newWinMenu, QString::number( 4 ) );
#endif
#ifndef DISABLE_GRAPHICSVIEW
- createActionForViewer( NewGraphicsViewId, newWinMenu, QString::number( 5 ), Qt::ALT+Qt::Key_C );
+ createActionForViewer( NewGraphicsViewId, newWinMenu, QString::number( 5 ) );
#endif
#ifndef DISABLE_PVVIEWER
- createActionForViewer( NewPVViewId, newWinMenu, QString::number( 6 ), Qt::ALT+Qt::Key_A );
+ createActionForViewer( NewPVViewId, newWinMenu, QString::number( 6 ) );
#endif
#ifndef DISABLE_PYVIEWER
- createActionForViewer( NewPyViewerId, newWinMenu, QString::number( 7 ), Qt::ALT+Qt::Key_Y );
+ createActionForViewer( NewPyViewerId, newWinMenu, QString::number( 7 ) );
#endif
#ifndef DISABLE_PV3DVIEWER
- createActionForViewer( NewPV3DViewId, newWinMenu, QString::number( 8 ), Qt::ALT+Qt::Key_3 );
+ createActionForViewer( NewPV3DViewId, newWinMenu, QString::number( 8 ) );
#endif
- createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
- Qt::ALT+Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
+ createAction( RenameId, desk, false /*toggle*/, "/PRP_RENAME",
+ tr( "TOT_RENAME" ), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ), QIcon(),
+ this, SLOT( onRenameWindow() ) );
+
createMenu( RenameId, windowMenu, -1 );
int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
#endif // USE_SALOME_STYLE
createAction( FullScreenId, tr( "TOT_FULLSCREEN" ), QIcon(), tr( "MEN_DESK_FULLSCREEN" ), tr( "PRP_FULLSCREEN" ),
- Qt::Key_F11, desk, false, this, SLOT( onFullScreen() ) );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onFullScreen() ), "/PRP_FULLSCREEN" );
int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1 );
virtual void customize();
virtual void createActionForViewer( const int id,
const int parentId,
- const QString& suffix,
- const int accel );
+ const QString& suffix );
virtual SUIT_Study* createNewStudy();
virtual QWidget* createWindow( const int );
virtual void defaultWindows( QMap<int, int>& ) const;
-->
<section name="shortcuts:">
<!--Actions of these shortcuts are available even if no module is active-->
+ <parameter name="PRP_DESK_FILE_LOAD_SCRIPT" value="Ctrl+T"/>
+ <parameter name="PRP_DESK_FILE_DUMP_STUDY" value="Ctrl+D"/>
+ <parameter name="PRP_DESK_CONNECT" value="Ctrl+L"/>
+ <parameter name="PRP_DESK_DISCONNECT" value="Ctrl+U"/>
+ <parameter name="PRP_DESK_CATALOG_GENERATOR" value="Alt+Shift+G"/>
+ <parameter name="PRP_DESK_PREFERENCES" value="Ctrl+P"/>
+ <parameter name="PRP_RENAME" value="Alt+Shift+R"/>
+ <parameter name="PRP_CLOSE" value="Ctrl+F4"/>
+ <parameter name="PRP_FULLSCREEN" value="F11"/>
+ <parameter name="PRP_DESK_WINDOW_HSPLIT" value="Alt+Shift+H"/>
+ <parameter name="PRP_DESK_WINDOW_VSPLIT" value="Alt+Shift+V"/>
+ <parameter name="PRP_DESK_VIEW_STATUSBAR" value="Alt+Shift+S"/>
+ <parameter name="PRP_DESK_HELP_ABOUT" value="Alt+Shift+A"/>
<parameter name="TOT_DESK_FILE_NEW" value="Ctrl+N"/>
<parameter name="TOT_DESK_FILE_OPEN" value="Ctrl+O"/>
<parameter name="TOT_DESK_FILE_CLOSE" value="Ctrl+W"/>
<parameter name="TOT_DESK_FILE_EXIT" value="Ctrl+Q"/>
<parameter name="TOT_DESK_FILE_SAVE" value="Ctrl+S"/>
<parameter name="TOT_DESK_FILE_SAVEAS" value="Ctrl+Shift+S"/>
- <parameter name="TOT_DESK_EDIT_COPY" value="Ctrl+C"/>
+ <parameter name="#TOT_DESK_EDIT_COPY" value="Ctrl+C"/>
<parameter name="TOT_DESK_EDIT_PASTE" value="Ctrl+V"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_0" value="Alt+G"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_1" value="Alt+P"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_2" value="Alt+O"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_3" value="Alt+K"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_4" value="Alt+S"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_5" value="Alt+C"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_6" value="Alt+A"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_7" value="Alt+Y"/>
+ <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_8" value="Alt+3"/>
<parameter name="#General/Objects(s)/Show" value="Ctrl+Alt+S"/>
<parameter name="#General/Objects(s)/Hide" value="Ctrl+Alt+H"/>
<parameter name="#Viewers/View/Set X+" value="Ctrl+Alt+B"/>
<parameter name="#Viewers/View/Rotate clockwise" value=""/>
<parameter name="#Viewers/View/Reset" value="Ctrl+Alt+E"/>
</section>
- <section name="shortcuts:SHAPER">
- </section>
- <section name="shortcuts:GEOM">
- <parameter name="Isolines/Increase number" value="Meta+I"/>
- <parameter name="Isolines/Decrease number" value="Meta+D"/>
- <parameter name="Transparency/Increase" value="Meta+Y"/>
- <parameter name="Transparency/Decrease" value="Meta+T"/>
- </section>
<!--Names of actions for shortcut editor
See SUIT_ShortcutMgr for details
-->
+ <section name="shortcut_translations:/PRP_DESK_CONNECT">
+ <parameter name="en" value="Connect active study"/>
+ <parameter name="fr" value="Connecter l'étude en cours"/>
+ <parameter name="ja" value="アクティブスタディの接続"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_DISCONNECT">
+ <parameter name="en" value="Disconnect the current study"/>
+ <parameter name="fr" value="Déconnecter l'étude en cours"/>
+ <parameter name="ja" value="カレントスタディの切断"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_FILE_LOAD_SCRIPT">
+ <parameter name="en" value="Load python script from file"/>
+ <parameter name="fr" value="Exécuter un script Python à partir d'un fichier"/>
+ <parameter name="ja" value="ファイルからPythonスクリプトを読込み"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_FILE_DUMP_STUDY">
+ <parameter name="en" value="Dump study to the python script"/>
+ <parameter name="fr" value="Génèrer le script python de l'étude"/>
+ <parameter name="ja" value="Pythonスクリプトにスタディをダンプする"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_CATALOG_GENERATOR">
+ <parameter name="en" value="Generate XML catalog of a component's interface"/>
+ <parameter name="fr" value="Générer un catalogue XML de l'interface du composant"/>
+ <parameter name="ja" value="コンポーネントインターフェイスのXMLカタログを生成"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_PREFERENCES">
+ <parameter name="en" value="Open preference window"/>
+ <parameter name="fr" value="Ouvrir la fenêtre des préférences"/>
+ <parameter name="ja" value="設定ウィンドウを開く"/>
+ </section>
+ <section name="shortcut_translations:/PRP_RENAME">
+ <parameter name="en" value="Rename active window"/>
+ <parameter name="fr" value="Renommer la fenêtre active"/>
+ <parameter name="ja" value="アクティブなウィンドウの名前を変更"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CLOSE">
+ <parameter name="en" value="Close active window"/>
+ <parameter name="fr" value="Fermer la fenêtre active"/>
+ <parameter name="ja" value="アクティブ ウィンドウを閉じる"/>
+ </section>
+ <section name="shortcut_translations:/PRP_FULLSCREEN">
+ <parameter name="en" value="Switch to full screen mode"/>
+ <parameter name="fr" value="Basculer en mode plein écran"/>
+ <parameter name="ja" value="全画面表示モードに切り替え"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_WINDOW_HSPLIT">
+ <parameter name="en" value="Split the active window on two horizontal parts"/>
+ <parameter name="fr" value="Diviser la fenêtre actuelle en deux parties horizontales"/>
+ <parameter name="ja" value="現在のウィンドウを 2つに水平分割"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_WINDOW_VSPLIT">
+ <parameter name="en" value="Split the active window on two vertical parts"/>
+ <parameter name="fr" value="Diviser la fenêtre actuelle en deux parties verticales"/>
+ <parameter name="ja" value="現在のウィンドウを2つに上下分割"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_VIEW_STATUSBAR">
+ <parameter name="en" value="Toggle status bar view on/off"/>
+ <parameter name="fr" value="Activer ou désactiver la barre de status"/>
+ <parameter name="ja" value="ステータスバーの有効/無効"/>
+ </section>
+ <section name="shortcut_translations:/PRP_DESK_HELP_ABOUT">
+ <parameter name="en" value="Show 'About' dialog"/>
+ <parameter name="fr" value="Montrer la boîte de dialogue 'A propos'"/>
+ <parameter name="ja" value="ソフト情報の表示"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_0">
+ <parameter name="en" value="Create new GL 2D view"/>
+ <parameter name="fr" value="Créer une nouvelle Scène GL"/>
+ <parameter name="ja" value="新しい GL 2D view(G) を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_1">
+ <parameter name="en" value="Create new Plot 2D view"/>
+ <parameter name="fr" value="Créer une nouvelle Scène Plot2d"/>
+ <parameter name="ja" value="新しい Plot 2D View(P) を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_2">
+ <parameter name="en" value="Create new OCC 3D view"/>
+ <parameter name="fr" value="Créer une nouvelle Scène OCC"/>
+ <parameter name="ja" value="新しい OCC 3D View(O) を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_3">
+ <parameter name="en" value="Create new VTK 3D view"/>
+ <parameter name="fr" value="Créer une nouvelle Scène VTK"/>
+ <parameter name="ja" value="新しい VTK 3D View(K) を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_4">
+ <parameter name="en" value="Create new QxScene 2D view"/>
+ <parameter name="fr" value="Créer une nouvelle Scène QxScene"/>
+ <parameter name="ja" value="新しい シーン QxScene(S) を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_5">
+ <parameter name="en" value="Create new Graphics view"/>
+ <parameter name="fr" value="Créer une nouvelle Scène Graphiques"/>
+ <parameter name="ja" value="新しい グラフィックの表示 (r) を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_6">
+ <parameter name="en" value="Create new ParaView view"/>
+ <parameter name="fr" value="Créer une nouvelle Scène ParaView"/>
+ <parameter name="ja" value="新しい ParaView 表示 (w) を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_7">
+ <parameter name="en" value="Create new Python view"/>
+ <parameter name="fr" value="Créer une nouvelle Vue Python"/>
+ <parameter name="ja" value="新しい Python view を作成します。"/>
+ </section>
+ <section name="shortcut_translations:/PRP_CREATE_NEW_WINDOW_FOR_VIEWER_8">
+ <parameter name="en" value="Create new ParaView3D view"/>
+ <parameter name="fr" value="Créer une nouvelle ParaView3D view"/>
+ <parameter name="ja" value="新しい ParaView3D view を作成します。"/>
+ </section>
<section name="shortcut_translations:/#General/Objects(s)/Show">
<parameter name="en" value="Show"/>
<parameter name="fr" value="Afficher"/>
<parameter name="fr" value="Restaurer le point de vue"/>
<parameter name="ja" value="ビューのポイントを復元します。"/>
</section>
- <section name="shortcut_translations:GEOM/Isolines/Increase number">
- <parameter name="en" value="Increase number of isolines"/>
- <parameter name="fr" value="Augmenter le nombre d'isolignes"/>
- <parameter name="ja" value="等値線の数を増やす"/>
- </section>
- <section name="shortcut_translations:GEOM/Isolines/Decrease number">
- <parameter name="en" value="Decrease number of isolines"/>
- <parameter name="fr" value="Diminuer le nombre d'isolignes"/>
- <parameter name="ja" value="等値線の数を減らす"/>
- </section>
- <section name="shortcut_translations:GEOM/Transparency/Increase">
- <parameter name="en" value="Increase transparency"/>
- <parameter name="fr" value="Augmenter la transparence"/>
- <parameter name="ja" value="透明度を高める"/>
- </section>
- <section name="shortcut_translations:GEOM/Transparency/Decrease">
- <parameter name="en" value="Decrease transparency"/>
- <parameter name="fr" value="Diminuer la transparence"/>
- <parameter name="ja" value="透明度を下げる"/>
- </section>
<section name="ExternalBrowser" >
<!-- External HELP browser settings -->
<parameter name="winapplication" value="C:\Program Files\Internet Explorer\iexplore.exe" />
QApplication::instance()->installEventFilter( this );
}
+/*!
+ \brief Constructor.
+
+ Creates an action owned by \a parent. Parameters \a text,
+ \a menuText and \a ID specify the action's attributes.
+ Parameter \a toggle can be used to make the action checkable.
+ Parameter \a ID is used to de(serialize) shortcut settings.
+
+ \param parent parent object
+ \param toggle if \c true the action is a toggle action
+ \param ID shortcut action identifier
+ \param toolTip tooltip text
+ \param text menu text
+*/
+QtxAction::QtxAction( QObject* parent, bool toggle, const QString& ID,
+ const QString& toolTip, const QString& text, const QIcon& icon )
+: QWidgetAction( parent )
+{
+ setCheckable( toggle );
+ setID(ID);
+ setToolTip( toolTip );
+ setText( text );
+ setIcon( icon );
+
+ QApplication::instance()->installEventFilter( this );
+}
+
/*!
\brief Constructor.
#include "Qtx.h"
#include <QWidgetAction>
-
-class QIcon;
+#include <QIcon>
#ifdef WIN32
#pragma warning ( disable:4251 )
public:
QtxAction( QObject* = 0, bool = false, const QString& = QString() );
- QtxAction( const QString&, const QString&, int, QObject*, bool = false, const QString& = QString() );
+ QtxAction( QObject*, bool, const QString&, const QString&, const QString& = QString(), const QIcon& = QIcon());
+ QtxAction( const QString&, const QString&, int , QObject*, bool = false, const QString& = QString() );
QtxAction( const QString&, const QString&, const QKeySequence&, QObject*, bool = false, const QString& = QString() );
- QtxAction( const QString&, const QIcon&, const QString&, int, QObject*, bool = false, const QString& = QString() );
+ QtxAction( const QString&, const QIcon&, const QString&, int , QObject*, bool = false, const QString& = QString() );
QtxAction( const QString&, const QIcon&, const QString&, const QKeySequence&, QObject*, bool = false, const QString& = QString() );
virtual ~QtxAction();
/*!
\brief Set actions to be visible in the menu.
-
- Actions, which IDs are set in \a flags parameter, will be shown in the
+
+ Actions, which IDs are set in \a flags parameter, will be shown in the
menu bar. Other actions will not be shown.
\param flags ORed together actions flags
return txt;
}
-/*!
- \brief Set keyboard accelerator for the specified action.
- \param id menu action ID
- \param a new keyboard accelerator
-*/
-void QtxWorkspaceAction::setAccel( const int id, const int a )
-{
- if ( action( id ) )
- action( id )->setShortcut( a );
-}
-
/*!
\brief Set menu item icon for the specified action.
\param id menu action ID
/*!
\brief Called when menu item is activated by the user.
-
+
Perform the corresponding action.
\param id menu item identifier
int accel( const int ) const;
QString statusTip( const int ) const;
- void setAccel( const int, const int );
void setIcon( const int, const QIcon& );
void setText( const int, const QString& );
void setStatusTip( const int, const QString& );
myWorkWin( 0 ),
myWorkArea( 0 )
{
- myActionsMap.insert( SplitVertical, new QtxAction( QString(), tr( "Split vertically" ), 0, this ) );
- myActionsMap.insert( SplitHorizontal, new QtxAction( QString(), tr( "Split horizontally" ), 0, this ) );
- myActionsMap.insert( Close, new QtxAction( QString(), tr( "Close" ), 0, this ) );
- myActionsMap.insert( Rename, new QtxAction( QString(), tr( "Rename" ), 0, this ) );
+ myActionsMap.insert( SplitVertical, new QtxAction( this, false /*toggle*/, "/PRP_DESK_WINDOW_VSPLIT", tr( "Split vertically" ) ) );
+ myActionsMap.insert( SplitHorizontal, new QtxAction( this, false /*toggle*/, "/PRP_DESK_WINDOW_HSPLIT", tr( "Split horizontally" ) ) );
+ myActionsMap.insert( Close, new QtxAction( this, false /*toggle*/, tr( "Close" ) ) );
+ myActionsMap.insert( Rename, new QtxAction( this, false /*toggle*/, tr( "Rename" ) ) );
connect( myActionsMap[SplitVertical], SIGNAL( triggered( bool ) ), this, SLOT( splitVertical() ) );
connect( myActionsMap[SplitHorizontal], SIGNAL( triggered( bool ) ), this, SLOT( splitHorizontal() ) );
}
}
-/*!
- \brief Set accelerator key-combination for the action with specified \a id.
- \param id action ID
- \param accel action accelerator
-*/
-void QtxWorkstack::setAccel( const int id, const int accel )
-{
- if ( !myActionsMap.contains( id ) )
- return;
-
- myActionsMap[id]->setShortcut( accel );
-}
-
/*!
\brief Get the action's accelerator key-combination.
\param id action ID
void setActiveWindow( QWidget* );
int accel( const int ) const;
- void setAccel( const int, const int );
QIcon icon( const int ) const;
void setIcon( const int, const QIcon& );
QByteArray saveState( int ) const;
bool restoreState( const QByteArray&, int );
-
+
void setOpaqueResize( bool = true );
bool opaqueResize() const;
if ( myWorkstack )
insertAction( myWorkstack->action( QtxWorkstack::SplitVertical ), SplitVertical );
else
- insertAction( new QtxAction( tr( "Split the active window on two vertical parts" ),
- tr( "Split vertically" ), 0, this ), SplitVertical );
+ insertAction( new QtxAction(this, false /*toggle*/, "/PRP_DESK_WINDOW_VSPLIT",
+ tr( "Split the active window on two vertical parts" ), tr( "Split vertically" )), SplitVertical);
if ( myWorkstack )
insertAction( myWorkstack->action( QtxWorkstack::SplitHorizontal ), SplitHorizontal );
else
- insertAction( new QtxAction( tr( "Split the active window on two horizontal parts" ),
- tr( "Split horizontally" ), 0, this ), SplitHorizontal );
+ insertAction( new QtxAction(this, false /*toggle*/, "/PRP_DESK_WINDOW_HSPLIT",
+ tr( "Split the active window on two horizontal parts" ), tr( "Split horizontally" )), SplitHorizontal);
connect( this, SIGNAL( triggered( int ) ), this, SLOT( onTriggered( int ) ) );
return txt;
}
-/*!
- \brief Set keyboard accelerator for the specified action.
- \param id menu action ID
- \param a new keyboard accelerator
-*/
-void QtxWorkstackAction::setAccel( const int id, const int a )
-{
- if ( action( id ) )
- action( id )->setShortcut( a );
-}
-
/*!
\brief Set menu item icon for the specified action.
\param id menu action ID
int accel( const int ) const;
QString statusTip( const int ) const;
- void setAccel( const int, const int );
void setIcon( const int, const QIcon& );
void setText( const int, const QString& );
void setStatusTip( const int, const QString& );
createAction( EditCopyId, tr( "TOT_DESK_EDIT_COPY" ),
resMgr->loadPixmap( "STD", tr( "ICON_EDIT_COPY" ) ),
tr( "MEN_DESK_EDIT_COPY" ), tr( "PRP_DESK_EDIT_COPY" ),
- QKeySequence::UnknownKey, desk, false, this, SLOT( onCopy() ), "/TOT_DESK_EDIT_COPY" );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onCopy() ), "/#TOT_DESK_EDIT_COPY" );
createAction( EditPasteId, tr( "TOT_DESK_EDIT_PASTE" ),
resMgr->loadPixmap( "STD", tr( "ICON_EDIT_PASTE" ) ),
tr( "MEN_DESK_EDIT_PASTE" ), tr( "PRP_DESK_EDIT_PASTE" ),
QKeySequence::UnknownKey, desk, false, this, SLOT( onPaste() ), "/TOT_DESK_EDIT_PASTE" );
- QAction* a = createAction( ViewStatusBarId, tr( "TOT_DESK_VIEW_STATUSBAR" ),
- QIcon(), tr( "MEN_DESK_VIEW_STATUSBAR" ),
- tr( "PRP_DESK_VIEW_STATUSBAR" ), Qt::ALT+Qt::SHIFT+Qt::Key_S, desk, true );
+ QAction* a = createAction( ViewStatusBarId, desk, true /*toggle*/, "/PRP_DESK_VIEW_STATUSBAR",
+ tr( "TOT_DESK_VIEW_STATUSBAR" ), tr( "MEN_DESK_VIEW_STATUSBAR" ), tr( "PRP_DESK_VIEW_STATUSBAR" ));
+
a->setChecked( desk->statusBar()->isVisibleTo( desk ) );
connect( a, SIGNAL( toggled( bool ) ), this, SLOT( onViewStatusBar( bool ) ) );
createAction( NewWindowId, tr( "TOT_DESK_NEWWINDOW" ), QIcon(),
tr( "MEN_DESK_NEWWINDOW" ), tr( "PRP_DESK_NEWWINDOW" ), 0, desk );
- createAction( HelpAboutId, tr( "TOT_DESK_HELP_ABOUT" ),
- resMgr->loadPixmap( "STD", tr( "ICON_DESK_ABOUT" ) ),
- tr( "MEN_DESK_HELP_ABOUT" ), tr( "PRP_DESK_HELP_ABOUT" ),
- Qt::ALT+Qt::SHIFT+Qt::Key_A, desk, false, this, SLOT( onHelpAbout() ) );
+ createAction( HelpAboutId, desk, false /*toggle*/, "/PRP_DESK_HELP_ABOUT",
+ tr( "TOT_DESK_HELP_ABOUT" ), tr( "MEN_DESK_HELP_ABOUT" ), tr( "PRP_DESK_HELP_ABOUT" ),
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_ABOUT" ) ),
+ this, SLOT( onHelpAbout() ) );
QtxDockAction* dwa = new QtxDockAction( tr( "TOT_DOCKWINDOWS" ), tr( "MEN_DESK_VIEW_DOCKWINDOWS" ), desk );
// But the workstack must occupy as much space as possible -- set Expanding for it.
myWorkstack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- myWorkstack->setAccel( QtxWorkstack::SplitVertical, Qt::ALT + Qt::SHIFT + Qt::Key_V );
- myWorkstack->setAccel( QtxWorkstack::SplitHorizontal, Qt::ALT + Qt::SHIFT + Qt::Key_H );
- //myWorkstack->setAccel( QtxWorkstack::Close, Qt::CTRL + Qt::Key_F4 );
-
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if ( resMgr ) {
myWorkstack->setIcon( QtxWorkstack::SplitVertical,
resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HSPLIT" ) ) );
myWorkstackAction->setText( QtxWorkstackAction::SplitHorizontal, tr( "MEN_DESK_WINDOW_HSPLIT" ) );
myWorkstackAction->setStatusTip( QtxWorkstackAction::SplitHorizontal, tr( "PRP_DESK_WINDOW_HSPLIT" ) );
- myWorkstackAction->setAccel( QtxWorkstackAction::SplitHorizontal, Qt::ALT + Qt::SHIFT + Qt::Key_H );
// Split Vertical
myWorkstackAction->setIcon( QtxWorkstackAction::SplitVertical,
resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VSPLIT" ) ) );
myWorkstackAction->setText( QtxWorkstackAction::SplitVertical, tr( "MEN_DESK_WINDOW_VSPLIT" ) );
myWorkstackAction->setStatusTip( QtxWorkstackAction::SplitVertical, tr( "PRP_DESK_WINDOW_VSPLIT" ) );
- myWorkstackAction->setAccel( QtxWorkstackAction::SplitVertical, Qt::ALT + Qt::SHIFT + Qt::Key_V );
QAction* anArrangeViewsAction = myWorkstackAction->getArrangeViewsAction();
if( anArrangeViewsAction )
\param toggle - if it is \c true the action will be a toggle action, otherwise it will be a command action
\param reciever - object that contains slot
\param member - slot to be called when action is activated
- \param actionID - application-unique action ID
+ \param actionID - application-unique action ID. Required by SUIT_ShortcutMgr for shortcut customization. May be left blank.
*/
QAction* SUIT_Application::createAction( const int id, const QString& text, const QIcon& icon,
const QString& menu, const QString& tip, const int key,
\param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action
\param reciever - object that contains slot
\param member - slot to be called when action is activated
- \param actionID - application-unique action ID
+ \param actionID - application-unique action ID. Required by SUIT_ShortcutMgr for shortcut customization. May be left blank.
*/
QAction* SUIT_Application::createAction( const int id, const QString& text, const QIcon& icon,
const QString& menu, const QString& tip, const QKeySequence& key,
return a;
}
+/*!
+ Creates action and registers it both in menu manager and tool manager
+ \return new instance of action
+ \param id proposed SUIT identificator
+ \param parent parent object
+ \param toggle if it is TRUE the action will be a toggle action, otherwise it will be a command action
+ \param actionID application-unique action ID. Required by SUIT_ShortcutMgr for shortcut customization. May be left blank.
+ \param toolTip
+ \param menuText can be later retrieved using QAction::text();
+ \param statusTip
+ \param icon icon for toolbar
+ \param reciever object that contains slot
+ \param member slot to be called when action is activated
+*/
+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,
+ QObject* reciever, const char* member )
+{
+ QtxAction* a = new QtxAction( parent, toggle, actionID, toolTip, menuText, icon);
+ a->setStatusTip( statusTip );
+
+ if ( reciever && member )
+ connect( a, SIGNAL( triggered( bool ) ), reciever, member );
+
+ registerAction( id, a );
+
+ return a;
+}
+
/*!
Registers action both in menu manager and tool manager
\param id - proposed SUIT identificator (if it is -1, auto generated one is used)
#include <QObject>
#include <QMap>
+#include <QIcon>
-class QIcon;
class QLabel;
class QString;
class 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() );
+ 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() );
+ 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);
protected slots:
virtual void onDesktopActivated();
* from instances of QtxActions, if a shortcut or name translation is absent in resource files.
*
* (1) Set required language in the application settings and run features of interest.
- * For all actions from these features, their toolTip()s will be dumped to appropriate places in dump files.
+ * For all actions from these features, their statusTip()s will be dumped to appropriate places in dump files.
*
* Content of dump files is appended on every run. Files are located in "<APP_DIR>/shortcut_mgr_dev/".
*/
/*! \brief Generates XML files with appearing in runtime shortcuts,
using key sequences of QActions passed to the shortcut manager,
- and translations, using QAction::toolTip(), of QtxActions passed to the shortcut manager.
+ and translations, using QAction::statusTip(), of QtxActions passed to the shortcut manager.
Content of these files can be easily copied to resource files. */
class DevTools
{
if (SUIT_ShortcutMgr::getActionNameFromResources(theAction->ID(), lang).first)
return;
- collectTranslation(moduleIDAndActionID.first, moduleIDAndActionID.second, lang, theAction->toolTip());
+ collectTranslation(moduleIDAndActionID.first, moduleIDAndActionID.second, lang, theAction->statusTip());
}
}
return;
}
- { // An action with the same memory address was registered earlier.
- // Clear all data about it to start registering procedure from scratch.
+ { // If an action with the same memory address was registered earlier,
+ // clear all data about it to start registering procedure from scratch.
auto itPreviousModuleAndActionID = myActionIDs.find(theAction);
if (itPreviousModuleAndActionID != myActionIDs.end()) {
// Clear the data from myActions.
//! Dump study
createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIcon(),
tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
- Qt::CTRL+Qt::Key_D, desk, false, this, SLOT( onDumpStudy() ) );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onDumpStudy() ), "/PRP_DESK_FILE_DUMP_STUDY" );
//! Load script
createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIcon(),
tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
- Qt::CTRL+Qt::Key_T, desk, false, this, SLOT( onLoadScript() ) );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onLoadScript() ), "/PRP_DESK_FILE_LOAD_SCRIPT" );
//! Properties
createAction( PropertiesId, tr( "TOT_DESK_PROPERTIES" ), QIcon(),
//! Catalog Generator
createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIcon(),
tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
- Qt::ALT+Qt::SHIFT+Qt::Key_G, desk, false, this, SLOT( onCatalogGen() ) );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onCatalogGen() ), "/PRP_DESK_CATALOG_GENERATOR" );
//! Registry Display
createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ), QIcon(),
createAction( ConnectId, tr( "TOT_DESK_CONNECT_STUDY" ), QIcon(),
tr( "MEN_DESK_CONNECT" ), tr( "PRP_DESK_CONNECT" ),
- Qt::CTRL+Qt::Key_L, desk, false, this, SLOT( onLoadDoc() ) );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onLoadDoc() ), "/PRP_DESK_CONNECT" );
//no need at this action for mono-study application because study is always exists
action( ConnectId )->setVisible( false );
createAction( DisconnectId, tr( "TOT_DESK_DISCONNECT_STUDY" ), QIcon(),
tr( "MEN_DESK_DISCONNECT" ), tr( "PRP_DESK_DISCONNECT" ),
- Qt::CTRL+Qt::Key_U, desk, false, this, SLOT( onUnloadDoc() ) );
+ QKeySequence::UnknownKey, desk, false, this, SLOT( onUnloadDoc() ), "/PRP_DESK_DISCONNECT" );
//no need at this action for mono-study application because study is always exists
action( DisconnectId )->setVisible( false );
study->dataModels( models );
for( int i = 0; i < models.count() && !shaperIsActive; i++ )
shaperIsActive = models[i]->module()->moduleName() == "Shaper";
-
+
if (shaper && !shaperIsActive)
onDesktopMessage("register_module_in_study/Shaper");
}