Salome HOME
[bos #35160][EDF](2023-T1) Keyboard shortcuts.
authordish <Dmitrii.SHVYDKOI@opencascade.com>
Tue, 5 Dec 2023 20:28:37 +0000 (20:28 +0000)
committerdish <dmitrii.shvydkoi@opencascade.com>
Thu, 25 Jan 2024 10:50:35 +0000 (10:50 +0000)
Add all desktop actions, which are bound to non-empty key sequences in master branch, to shortcut editor.

17 files changed:
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/resources/LightApp.xml
src/Qtx/QtxAction.cxx
src/Qtx/QtxAction.h
src/Qtx/QtxWorkspaceAction.cxx
src/Qtx/QtxWorkspaceAction.h
src/Qtx/QtxWorkstack.cxx
src/Qtx/QtxWorkstack.h
src/Qtx/QtxWorkstackAction.cxx
src/Qtx/QtxWorkstackAction.h
src/STD/STD_Application.cxx
src/STD/STD_TabDesktop.cxx
src/SUIT/SUIT_Application.cxx
src/SUIT/SUIT_Application.h
src/SUIT/SUIT_ShortcutMgr.cxx
src/SalomeApp/SalomeApp_Application.cxx

index 2d7ce6bef85ca4dbed1f563e6dba47ff37438763..7f6c949fca220318a4de4c06055531021ce40a7f 100644 (file)
@@ -616,21 +616,14 @@ LightApp_SelectionMgr* LightApp_Application::selectionMgr() const
 /*!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 );
 }
 
@@ -646,7 +639,7 @@ void LightApp_Application::createActions()
   // 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
 
@@ -774,6 +767,11 @@ void LightApp_Application::createActions()
 
   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" ),
@@ -785,35 +783,37 @@ void LightApp_Application::createActions()
   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 );
@@ -830,7 +830,7 @@ void LightApp_Application::createActions()
 #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 );
index b9c19317d3ed1e9d0df97867a0da2499867b0416..3a0b70ad311c9da565869fd5d32b0a662556a0a4 100644 (file)
@@ -224,8 +224,7 @@ protected:
   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;
index 84ba5ea31e289c506d22603b9a62b1a660d3eaaf..e29587f4b669d5c0eef290a37a11bd6272f99d02 100644 (file)
   -->
   <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" />
index e2a31045096f4943fb7e75490caeb26acaa16b24..004207143b04512d35138059936dd0d81f2ade9b 100644 (file)
@@ -82,6 +82,33 @@ QtxAction::QtxAction( QObject* parent, bool toggle, const QString& ID )
   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.
 
index 3acae995648ac478f782b57ad0d7c72cf5be1f94..a286a6ab63837c9da6a41457150aa015251c0914 100644 (file)
@@ -29,8 +29,7 @@
 #include "Qtx.h"
 
 #include <QWidgetAction>
-
-class QIcon;
+#include <QIcon>
 
 #ifdef WIN32
 #pragma warning ( disable:4251 )
@@ -44,9 +43,10 @@ class QTX_EXPORT QtxAction : public QWidgetAction
 
 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();
 
index 4b37a3c7588f6c0b0dbdfe0682dd6ec57487983d..0decdea84accb12d928d0dff4e2192a2b61b35eb 100644 (file)
@@ -78,8 +78,8 @@ QtxWorkspace* QtxWorkspaceAction::workspace() const
 
 /*!
   \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
@@ -164,17 +164,6 @@ QString QtxWorkspaceAction::statusTip( const int id ) const
   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
@@ -403,7 +392,7 @@ void QtxWorkspaceAction::activateItem( const int idx )
 
 /*!
   \brief Called when menu item is activated by the user.
-  
+
   Perform the corresponding action.
 
   \param id menu item identifier
index 42e5f2ae355a9933226cd21e3ae49c16709eb59b..ffa676c46ab1b65ab27c1222c09681a7a932e70b 100644 (file)
@@ -63,7 +63,6 @@ public:
   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& );
index 6a5ba33f5e7173d72d6b2ab67fdc874155fc9128..c8a4f9ab4cd6dbd1fc97955a578ce521c1c4507b 100644 (file)
@@ -1728,10 +1728,10 @@ QtxWorkstack::QtxWorkstack( QWidget* parent )
   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() ) );
@@ -2181,19 +2181,6 @@ void QtxWorkstack::SetRelativePosition( QWidget* wid, const Qt::Orientation o,
   }
 }
 
-/*!
-  \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
index f9a192e807de6f47ebfd2a25333dee2dcb9f7c86..d696d9e6cbe38c8fb04f04bcc7c62e5b338ecdac 100644 (file)
@@ -96,7 +96,6 @@ public:
   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& );
@@ -112,7 +111,7 @@ public:
 
   QByteArray          saveState( int ) const;
   bool                restoreState( const QByteArray&, int );
-  
+
   void                setOpaqueResize( bool = true );
   bool                opaqueResize() const;
 
index 74913b2b15f4229198991098eca6d1a7588f9fa1..e441a5e599d5ee224ff0923cbb8cf0808afa086d 100644 (file)
@@ -125,14 +125,14 @@ QtxWorkstackAction::QtxWorkstackAction( QtxWorkstack* ws, QObject* parent )
   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 ) ) );
 
@@ -249,17 +249,6 @@ QString QtxWorkstackAction::statusTip( const int id ) const
   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
index e7313e6f512efd1ff18af2614cbac49544bfefc4..d524afb3976bdccd53969b113fcb2e4b8132779b 100644 (file)
@@ -67,7 +67,6 @@ public:
   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& );
index e5fc5df7fb58a694eaff6bc9a6fca20960e142f3..6dceb529f25a24e0bd7951f1b789a734c2f144aa 100644 (file)
@@ -191,26 +191,26 @@ void STD_Application::createActions()
   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 );
index ec674d5a2b417f4e3ab609150e023ae200819694..8b64dca057b33b0289b3d59b386f81f88689a32b 100644 (file)
@@ -56,10 +56,6 @@ myWorkstackAction( 0 )
   // 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,
@@ -216,14 +212,12 @@ void STD_TabDesktop::createActions()
                               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 )
index 41bbef40e35b2e78f10104a452c618646fbccb7a..17eab9ab13b41f11db013e66de5d5340ff12b3a5 100644 (file)
@@ -639,7 +639,7 @@ QList<int> SUIT_Application::actionIds() const
   \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,
@@ -662,7 +662,7 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons
   \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,
@@ -680,6 +680,35 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons
   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)
index 40f5a40e252522f27c2dd71f2900223504a088be..cdc07a9715663ba44c2c9eba4a867bc5384e8d82 100644 (file)
@@ -27,8 +27,8 @@
 
 #include <QObject>
 #include <QMap>
+#include <QIcon>
 
-class QIcon;
 class QLabel;
 class QString;
 class QAction;
@@ -177,11 +177,14 @@ protected:
   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();
index 4cfe2a2a7721a9f7be96e21f6585b0e1fc6b7bd1..501f050f903b4b411496625baec2844134188c4c 100644 (file)
@@ -92,7 +92,7 @@ static const QString SECTION_SHORTCUT_NAMES_PREFIX = QString("shortcut_translati
  * 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/".
 */
@@ -111,7 +111,7 @@ static const QString SECTION_SHORTCUT_NAMES_PREFIX = QString("shortcut_translati
 
 /*! \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
 {
@@ -239,7 +239,7 @@ public:
       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());
     }
   }
 
@@ -1077,8 +1077,8 @@ void SUIT_ShortcutMgr::registerAction(const QString& theActionID, QAction* theAc
     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.
index 82a1de82d4628a8c0126cc186d72d3a4e4df896f..3768626aa662c935dcd3dfd05f3bad77e0e3c2a2 100644 (file)
@@ -341,12 +341,12 @@ void SalomeApp_Application::createActions()
   //! 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(),
@@ -356,7 +356,7 @@ void SalomeApp_Application::createActions()
   //! 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(),
@@ -365,13 +365,13 @@ void SalomeApp_Application::createActions()
 
   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 );
 
@@ -2154,7 +2154,7 @@ void SalomeApp_Application::ensureShaperIsActivated()
     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");
   }