Version: 9.15.0
SUIT_ShortcutMgr.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef SUIT_SHORTCUTMGR_H
24 #define SUIT_SHORTCUTMGR_H
25 
26 #include "SUIT.h"
27 
28 #include <QObject>
29 #include <QString>
30 #include <QKeySequence>
31 #include <QStringList>
32 #include <QIcon>
33 #include <map>
34 #include <set>
35 #include <memory>
36 #include <utility>
37 #include <limits>
38 #include <functional>
39 
40 class QAction;
41 class QtxAction;
42 class QJsonObject;
43 
44 #if defined WIN32
45 #pragma warning( disable: 4251 )
46 #endif
47 
48 // Define SHORTCUT_MGR_DBG to enable SUIT_ShortcutMgr debug logging.
49 // #define SHORTCUT_MGR_DBG
51 SUIT_EXPORT extern inline bool ShCutDbg() {
52 #ifdef SHORTCUT_MGR_DBG
53  return true;
54 #else
55  return false;
56 #endif
57 }
59 SUIT_EXPORT extern bool ShCutDbg(const QString& theString);
61 SUIT_EXPORT extern bool ShCutDbg(const char* theString);
62 
63 
70 {
71 public:
73 
76  std::set<QString> getIDsOfInterferingModules(const QString& theModuleID) const;
77 
78  std::set<QString> getIDsOfAllModules() const;
79 
81  bool isEmpty() const;
82 
93  std::set<std::pair<QString, QString>> setShortcut(
94  QString theModuleID,
95  const QString& theInModuleActionID,
96  const QKeySequence& theKeySequence,
97  bool theOverride
98  );
99 
105  std::set<std::pair<QString, QString>> getConflicts(
106  QString theModuleID,
107  const QString& theInModuleActionID,
108  const QKeySequence& theKeySequence
109  ) const;
110 
113  const QKeySequence& getKeySequence(QString theModuleID, const QString& theInModuleActionID) const;
114 
117  bool hasShortcut(QString theModuleID, const QString& theInModuleActionID) const;
118 
120  const std::map<QString, QKeySequence>& getModuleShortcutsInversed(const QString& theModuleID) const;
121 
124  const std::map<QString, QKeySequence> getModuleShortcutsInversed(const QString& theModuleID, const QString& theInModuleActionIDPrefix) const;
125 
134  std::map<QString, std::map<QString, std::pair<QKeySequence, QKeySequence>>> merge(
135  const SUIT_ShortcutContainer& theOther,
136  bool theOverride,
137  bool theTreatAbsentIncomingAsDisabled = false
138  );
139 
140  bool hasKeySequence(const QString& theModuleID, const QKeySequence& theKeySequence) const;
141 
143  QString toString() const;
144 
145 private:
148  std::map<QString, std::map<QKeySequence, QString>> myShortcuts;
149 
152  std::map<QString, std::map<QString, QKeySequence>> myShortcutsInversed;
153 };
154 
155 
157 
158 
160 class SUIT_EXPORT SUIT_ShortcutAssets : public std::enable_shared_from_this<SUIT_ShortcutAssets>
161 {
162 public:
163  enum class Type
164  {
165  Module,
166  Item // Folder, action or folder-action.
167  };
168 
169 
171  {
172  static const QString PROP_ID_NAME;
173  static const QString PROP_ID_TOOLTIP;
174 
175  bool fromJSON(const QJsonObject& theJsonObject);
176  void toJSON(QJsonObject& oJsonObject) const;
177 
178  QString myName;
179  QString myToolTip;
180  };
181 
182 
183  static const QString PROP_ID_LANG_DEPENDENT_ASSETS;
184  static const QString PROP_ID_ICON_PATH;
185  static const QString PROP_ID_CHILDREN;
186 
187 protected:
188  SUIT_ShortcutAssets(const QString& theModuleID);
189 
190 public:
191  virtual ~SUIT_ShortcutAssets() = 0;
192 
193  const std::map<QString, std::shared_ptr<SUIT_ShortcutItemAssets>>& children() const;
194 
199  std::shared_ptr<SUIT_ShortcutItemAssets> findDescendantItem(const QString& theRelativeID) const;
200 
207  std::shared_ptr<SUIT_ShortcutItemAssets> descendantItem(const QString& theRelativeID, bool theIsAction = true);
208 
209  virtual int depth() const = 0;
210  virtual SUIT_ShortcutAssets::Type type() const = 0;
211 
212 private:
215  bool fromJSONOwnProps(const QJsonObject& theJsonObject, const std::set<QString>& theLangs = {});
216 
217 public:
221  bool fromJSON(const QJsonObject& theJsonObject, bool theParseDescendants = true, const std::set<QString>& theLangs = {});
222 
227  bool fromJSON(const QJsonObject& theJsonObject, const QString& theRelativeID, const std::set<QString>& theLangs = {});
228 
229  void toJSON(QJsonObject& oJsonObject) const;
230 
232  virtual void merge(const SUIT_ShortcutAssets& theOther, bool theOverride);
233 
235  virtual void merge(SUIT_ShortcutAssets&& theOther, bool theOverride);
236 
237 private:
240  virtual bool fromJSONOtherProps(const QJsonObject& theJsonObject) { return false; };
241 
242  virtual void toJSONVirtual(QJsonObject& oJsonObject) const {};
243 
244 public:
245  void loadIcon(bool theReload = false);
246 
248  void forEachDescendant(const std::function<void(SUIT_ShortcutItemAssets&)>& theFunc) const;
249 
251  void forEachDescendant(const std::function<void(const SUIT_ShortcutItemAssets&)>& theFunc) const;
252 
254  void forEachDescendant(const std::function<void(std::shared_ptr<SUIT_ShortcutItemAssets>)>& theFunc) const;
255 
257  void forEachDescendant(const std::function<void(std::shared_ptr<const SUIT_ShortcutItemAssets>)>& theFunc) const;
258 
259  QString toString() const;
260  virtual QString description() const = 0;
261 
262  QStringList getLangs() const;
263  void clearAllLangsExcept(const QString& theLang);
264 
268  const LangDependentAssets* bestLangDependentAssets(QString theLang = QString()) const;
269 
270  virtual const QString& bestName(const QString& theLang = QString()) const = 0;
271 
275  virtual const QString& bestToolTip(const QString& theLang = QString()) const;
276 
277 public:
278  const QString myModuleID;
279 
280  std::map<QString, LangDependentAssets> myLangDependentAssets;
281  QString myIconPath;
282 
284  QIcon myIcon;
285 
286 private:
287  // { IDLastToken, assets }.
288  std::map<QString, std::shared_ptr<SUIT_ShortcutItemAssets>> myChildren;
289 };
290 
291 
294 {
295 private:
296  SUIT_ShortcutModuleAssets(const QString& theModuleID);
299 
300 public:
301  static std::shared_ptr<SUIT_ShortcutModuleAssets> create(const QString& theModuleID);
303 
304  int depth() const { return 0; };
306 
310  const QString& bestName(const QString& theLang = QString()) const;
311 
312  QString description() const;
313 };
314 
315 
320 {
321  friend class SUIT_ShortcutAssets;
322 
323 public:
324  static void loadDefaultIcons();
325  static const QString PROP_ID_IS_ACTION; // Absense of the key in JSON means myIsAction == true.
326 
327 private:
328  static QIcon DEFAUT_ICON_ACTION;
329  static QIcon DEFAUT_ICON_FOLDER;
331 
336  SUIT_ShortcutItemAssets(std::shared_ptr<SUIT_ShortcutModuleAssets> theModule, const QString& theIDLastToken, bool theIsAction = true);
337 
340  SUIT_ShortcutItemAssets(std::shared_ptr<SUIT_ShortcutItemAssets> theParentItem, const QString& theIDLastToken, bool theIsAction = true);
342  SUIT_ShortcutItemAssets& operator= (const SUIT_ShortcutItemAssets&) = delete;
343  static std::shared_ptr<SUIT_ShortcutItemAssets> create(std::shared_ptr<SUIT_ShortcutAssets> theParentItemOrModule, const QString& theIDLastToken, bool theIsAction = true);
344 
345  public:
347 
348  int depth() const;
350 
352  void merge(const SUIT_ShortcutItemAssets& theOther, bool theOverride);
353 
355  virtual void merge(SUIT_ShortcutItemAssets&& theOther, bool theOverride);
356 
357 private:
358  bool fromJSONOtherProps(const QJsonObject& theJsonObject);
359  void toJSONVirtual(QJsonObject& oJsonObject) const;
360 
361 public:
365  const QString& bestName(const QString& theLang = QString()) const;
366 
368  const QString& bestPath(const QString theLang = QString()) const;
369 
370  QString description() const;
371 
372  bool isAction() const;
373  bool isFolder() const;
374  std::shared_ptr<SUIT_ShortcutAssets> parent() const;
375  std::shared_ptr<SUIT_ShortcutModuleAssets> module() const;
376 
378  QString actionID() const;
379 
381  const QIcon& icon() const;
382 
383 private:
384  std::weak_ptr<SUIT_ShortcutAssets> myParent;
385 
387 
388 public:
389  const QString myIDLastToken;
390  const QString myInModuleID; // Composed as <depth_1_item.myIDLastToken>/...<depth_N_item.myIDLastToken>.../<this->myIDLastToken>. Synonym for inModuleActionID.
391 
392 private:
393  const int myDepth;
394 
396  mutable std::map<QString, QString> myBestPaths;
397 };
398 
399 
482 {
483  Q_OBJECT
484 
485 private:
489 
490 protected:
491  virtual ~SUIT_ShortcutMgr();
492 
493 public:
494  static const QString ROOT_MODULE_ID;
495 
497  static void Init();
498 
499  static SUIT_ShortcutMgr* get();
500 
502  static bool isKeySequenceValid(const QKeySequence& theKeySequence);
503 
505  static std::pair<bool, QKeySequence> toKeySequenceIfValid(const QString& theKeySequenceString);
506 
509  static bool isModuleIDValid(const QString& theModuleID);
510 
511  static bool isInModuleIDTokenValid(const QString& theInModuleIDToken);
512 
513  static bool isInModuleIDTokenMeta(const QString& theInModuleIDToken);
514 
519  static bool isInModuleActionIDValid(const QString& theInModuleActionID);
520 
522  static bool isInModuleMetaActionID(const QString& theInModuleActionID);
523 
527  static std::pair<QString, QString> splitIntoModuleIDAndInModuleID(const QString& theActionID);
528 
530  static QStringList splitIntoTokens(const QString& theRelativeID);
531 
533  static QString joinIntoRelativeID(const QStringList& theTokens);
534 
536  static bool isActionIDValid(const QString& theActionID);
537 
540  static QString makeActionID(const QString& theModuleID, const QString& theInModuleActionID);
541 
547  static void fillContainerFromPreferences(SUIT_ShortcutContainer& theContainer, bool theDefaultOnly);
548 
550  static void fillContainerFromPreferences(SUIT_ShortcutContainer& theContainer, bool theDefaultOnly, const QString& theSectionNamePrefix);
551 
555  static std::pair<std::shared_ptr<SUIT_ShortcutModuleAssets>, std::shared_ptr<SUIT_ShortcutItemAssets>>
556  getActionAssetsFromResources(const QString& theActionID, const std::set<QString>& theLangs = {});
557 
559  static QString currentLang();
560 
561 
563  void registerAction(const QString& theActionID, QAction* theAction);
564 
566  void registerAction(QtxAction* theAction);
567 
569  std::set<QAction*> getActions(const QString& theModuleID, const QString& theInModuleActionID) const;
570 
573  std::pair<QString, QString> getModuleIDAndInModuleID(const QAction* theAction) const;
574 
576  bool hasAction(const QAction* theAction) const;
577 
580  QString getActionID(const QAction* theAction) const;
581 
584  void setActionsOfModuleEnabled(const QString& theModuleID, const bool theEnable = true) const;
585 
586  [[deprecated("Use setActionsOfModuleEnabled(const QString&, bool) instead.")]]
587  void setSectionEnabled(const QString& theInModuleActionIDPrefix, bool theEnable = true) const;
588 
591  void setActionsWithPrefixInIDEnabled(const QString& theInModuleActionIDPrefix, bool theEnable = true) const;
592 
594  void rebindActionsToKeySequences() const;
595 
596  [[deprecated("Use rebindActionsToKeySequences() instead.")]]
597  void updateShortcuts() const;
598 
609  std::set<std::pair<QString, QString>> setShortcut(const QString& theActionID, const QKeySequence& theKeySequence, bool theOverride = false);
610  std::set<std::pair<QString, QString>> setShortcut(const QString& theModuleID, const QString& theInModuleActionID, const QKeySequence& theKeySequence, bool theOverride = false);
611 
612  const SUIT_ShortcutContainer& getShortcutContainer() const;
613 
615  void mergeShortcutContainer(const SUIT_ShortcutContainer& theContainer, bool theOverride = true, bool theTreatAbsentIncomingAsDisabled = false, bool theSaveToPreferences = true);
616 
618  const QKeySequence& getKeySequence(const QString& theModuleID, const QString& theInModuleActionID) const;
619 
621  const std::map<QString, QKeySequence>& getModuleShortcutsInversed(const QString& theModuleID) const;
622 
624  std::set<QString> getShortcutModuleIDs() const;
625 
628  std::set<QString> getIDsOfInterferingModules(const QString& theModuleID) const;
629 
630  std::shared_ptr<const SUIT_ShortcutModuleAssets> getModuleAssets(const QString& theModuleID) const;
631  const std::map<QString, std::shared_ptr<SUIT_ShortcutModuleAssets>>& getModuleAssets() const { return myModuleAssets; }
632 
634  QString getModuleName(const QString& theModuleID, const QString& theLang = "") const;
635 
636  std::shared_ptr<const SUIT_ShortcutItemAssets> getActionAssets(const QString& theModuleID, const QString& theInModuleActionID, bool theTryToCreateRuntimeAssetsIfAbsent = true) const;
637 
638  std::shared_ptr<const SUIT_ShortcutItemAssets> getActionAssets(const QString& theActionID, bool theTryToCreateRuntimeAssetsIfAbsent = true) const;
639 
641  std::shared_ptr<const SUIT_ShortcutItemAssets> createRuntimeActionAssets(const QString& theModuleID, const QString& theInModuleActionID) const;
642 
644  QString getActionName(const QString& theModuleID, const QString& theInModuleActionID, const QString& theLang = "") const;
645 
647  QtxAction* createAction(QObject* theParent, QObject* theReceiver, const char* theReceiverSlot, const QString& theActionID, const bool theIsToggle = false) const;
648 
649 private slots:
655  void onActionDestroyed(QObject* theObject);
656 
657  void onAnonymousActionDestroyed(QObject* theObject);
658 
659 private:
662  virtual bool eventFilter(QObject* theObject, QEvent* theEvent);
663 
665  std::set<std::pair<QString, QString>> setShortcutNoIDChecks(const QString& theModuleID, const QString& theInModuleActionID, const QKeySequence& theKeySequence, bool theOverride);
666 
697  void setShortcutsFromPreferences();
698 
701  static void saveShortcutsToPreferences(const std::map<QString, std::map<QString, QKeySequence>>& theShortcutsInversed);
702 
706  static void saveShortcutsToPreferences(const std::map<QString, std::map<QString, std::pair<QKeySequence, QKeySequence>>>& theShortcutsInversed);
707 
761  void setAssetsFromResources(QString theLanguage = QString());
762 
763  void registerAnonymousShortcut(QAction* const theAction);
764  void enableAnonymousShortcutsClashingWith(const QString& theModuleID, const bool theEnable) const;
765  void enableAnonymousShortcutsClashingWith(const QKeySequence& theKeySequence, bool theEnable) const;
766  QString anonymousShortcutsToString() const;
767 
768 private:
770 
772  std::map<QString, std::map<QString, std::set<QAction*>>> myActions;
773 
775  std::map<QAction*, std::pair<QString, QString>> myActionIDs; // To maintain uniqueness of actions and effectively retrieve IDs of registered actions.
776 
779 
780  /* nb!
781  Sets of moduleIDs and inModuleActionIDs are equal for myActions and myActionIDs.
782  Sets of moduleIDs and inModuleActionIDs may NOT be equal for myActions and myShortcutContainer.
783  */
784 
786  mutable std::map<QString, std::shared_ptr<SUIT_ShortcutModuleAssets>> myModuleAssets;
787 
790 
791  mutable std::set<QString> myActiveModuleIDs;
792 
797  std::map<QAction*, QKeySequence> myAnonymousShortcuts;
798 
799  std::map<QKeySequence, std::set<QAction*>> myAnonymousShortcutsInverse;
800 };
801 
802 
861 {
862 public:
865  static const std::vector<QString> SECTION_PREFIX_EVOLUTION;
866 
867 private:
871  {
872  public:
873  static const QString PROP_ID_MUTATIONS;
874  static const QString PROP_ID_PREFIX_OLD;
875  static const QString PROP_ID_PREFIX_NEW;
876  static const QString PROP_ID_OLD_TO_NEW_ACTION_ID_MAP;
877 
878  static bool isPairOfNewAndOldActionIDsValid(const QString& theSectionPrefixNew, const QString& theSectionPrefixOld);
879 
880  AIDSMutation(const QString& theSectionPrefixNew, const QString& theSectionPrefixOld);
881  AIDSMutation(const QJsonObject& theJsonObject, const bool theParseMap = true);
882 
883  const QString& getSectionPrefixOld() const { return mySectionPrefixOld; };
884  const QString& getSectionPrefixNew() const { return mySectionPrefixNew; };
885  const std::map<QString, QString>& getNewToOldActionIDMap() const { return myNewToOldActionIDMap; };
886  const std::map<QString, QString>& getOldToNewActionIDMap() const { return myOldToNewActionIDMap; };
887 
889  bool isConcurrent(const AIDSMutation& theOther) const;
890 
892  bool merge(const AIDSMutation& theOther);
893 
894  private:
897 
900 
903  std::map<QString, QString> myNewToOldActionIDMap;
904 
907  std::map<QString, QString> myOldToNewActionIDMap;
908  };
909 
910 public:
912 
914  bool doOldShortcutPreferencesExist() const;
915 
918  QString getActionID(const QString& theOldActionID, const QString& theOldSectionPrefix) const;
919 
923  std::pair<bool, QKeySequence> getOldUserDefinedKeySequence(const QString& theActionID) const;
924 
925  const SUIT_ShortcutContainer& getContainerWithOldShortcuts() const { return myShortcutContainer; };
926 
928  void removeOldShortcutPreferences();
929 
930 private:
931  void parseMutations();
932 
936  std::pair<bool, QKeySequence> getKeySequenceFromSection(const QString& theActionID, const QString& theSectionPrefix) const;
937 
938 private:
940  std::list<std::pair<QString, SUIT_ShortcutHistorian::AIDSMutation>> myOldPrefixToMutationList;
941 
943  std::map<QString, SUIT_ShortcutContainer> myShortcutContainers;
944 
947 };
948 
949 
950 namespace SUIT_tools {
951  class SUIT_SentenceMatcher;
952 }
953 
954 
960 {
961 public:
962  enum MatchField {
963  ID,
964  Name, // Also matches with path, composed as <depth_1_item.name>/...<depth_N_item.name>.../<actionItem.name>.
966  KeySequence
967  };
968 
970  {
971  public:
972  AssetsAndSearchData(std::shared_ptr<const SUIT_ShortcutItemAssets> theAssets = nullptr, double theMatchMetrics = std::numeric_limits<double>::infinity());
973 
974  void setMatchMetrics(double theMatchMetrics);
975  double matchMetrics() const { return myMatchMetrics; };
976 
977  std::shared_ptr<const SUIT_ShortcutItemAssets> myAssets;
978 
979  void toJSON(QJsonObject& oJsonObject) const;
980  QString toString() const;
981 
982  private:
985  };
986 
987 
988  static double matchKeySequenceString(const QString& theQuery, const QString& theKeySequence);
989 
1001  virtual ~SUIT_ActionSearcher();
1002 
1005  bool setIncludedModuleIDs(std::set<QString> theIncludedModuleIDs, bool doNotUpdateResults = false);
1006 
1009  bool includeDisabledActions(bool theOn, bool doNotUpdateResults = false);
1010  inline bool areDisabledActionsIncluded() const {return myIncludeDisabledActions;};
1011 
1014  bool setFieldsToMatch(const std::set<SUIT_ActionSearcher::MatchField>& theFields, bool doNotUpdateResults = false);
1015 
1019  std::pair<bool, bool> setKeySequenceGetter(
1020  const std::function<QString(const QString&, const QString&)>& theKeySequenceGetter = std::function<QString(const QString&, const QString&)>(),
1021  bool doNotUpdateResults = false
1022  );
1023 
1026  bool setCaseSensitive(bool theOn, bool doNotUpdateResults = false);
1027 
1029  bool setQuery(const QString& theQuery);
1030  inline const QString& getQuery() const;
1031 
1032  const std::map<QString, std::map<QString, SUIT_ActionSearcher::AssetsAndSearchData>>& getSearchResults() const;
1033 
1034 
1035 private:
1038  std::pair<bool, bool> filter();
1039 
1042  std::pair<bool, bool> filterResults();
1043 
1046  bool extendResults();
1047 
1048  double matchAction(const SUIT_ShortcutItemAssets& theAssets);
1049 
1050  QString toString() const;
1051 
1052 
1053  std::set<QString> myIncludedModuleIDs;
1055 
1056  std::set<SUIT_ActionSearcher::MatchField> myFieldsToMatch;
1058 
1059  /* getKeySequence(theModuleID, theInModuleActionID) */
1060  std::function<QString(const QString&, const QString&)> myKeySequenceGetter;
1061 
1062  /* { moduleID, {inModuleActionID, assetsAndSearchData}[] }[]. */
1063  std::map<QString, std::map<QString, SUIT_ActionSearcher::AssetsAndSearchData>> mySearchResults;
1064 };
1065 
1066 
1067 #if defined WIN32
1068 #pragma warning( default: 4251 )
1069 #endif
1070 
1071 #endif //SUIT_SHORTCUTMGR_H
#define SUIT_EXPORT
Definition: SUIT.h:36
bool ShCutDbg()
Definition: SUIT_ShortcutMgr.h:51
For more information see QT documentation.
Definition: SUIT_Application.h:42
Generic action class.
Definition: QtxAction.h:39
Definition: SUIT_ShortcutMgr.h:970
double myMatchMetrics
Ideally it should be number of weighted character permutations. Now it is just a number of characters...
Definition: SUIT_ShortcutMgr.h:984
std::shared_ptr< const SUIT_ShortcutItemAssets > myAssets
Definition: SUIT_ShortcutMgr.h:975
double matchMetrics() const
Definition: SUIT_ShortcutMgr.h:975
Searches in data, provided in action asset files and shortcut preferences.
Definition: SUIT_ShortcutMgr.h:960
SUIT_ActionSearcher(const SUIT_ActionSearcher &)=delete
std::set< SUIT_ActionSearcher::MatchField > myFieldsToMatch
Definition: SUIT_ShortcutMgr.h:1056
std::set< QString > myIncludedModuleIDs
Definition: SUIT_ShortcutMgr.h:1053
bool areDisabledActionsIncluded() const
Definition: SUIT_ShortcutMgr.h:1010
std::function< QString(const QString &, const QString &)> myKeySequenceGetter
Definition: SUIT_ShortcutMgr.h:1060
::SUIT_tools::SUIT_SentenceMatcher * myMatcher
Definition: SUIT_ShortcutMgr.h:1057
SUIT_ActionSearcher & operator=(const SUIT_ActionSearcher &)=delete
bool myIncludeDisabledActions
Definition: SUIT_ShortcutMgr.h:1054
std::map< QString, std::map< QString, SUIT_ActionSearcher::AssetsAndSearchData > > mySearchResults
Definition: SUIT_ShortcutMgr.h:1063
MatchField
Definition: SUIT_ShortcutMgr.h:962
@ ToolTip
Definition: SUIT_ShortcutMgr.h:965
@ ID
Definition: SUIT_ShortcutMgr.h:963
@ Name
Definition: SUIT_ShortcutMgr.h:964
Base class for GUI-related assets of module, action or folder. Used by Shortcut Manager,...
Definition: SUIT_ShortcutMgr.h:161
virtual const QString & bestName(const QString &theLang=QString()) const =0
static const QString PROP_ID_CHILDREN
Definition: SUIT_ShortcutMgr.h:185
virtual bool fromJSONOtherProps(const QJsonObject &theJsonObject)
Parses properties of SUIT_ShortcutAssets subclasses.
Definition: SUIT_ShortcutMgr.h:240
virtual int depth() const =0
std::map< QString, LangDependentAssets > myLangDependentAssets
Definition: SUIT_ShortcutMgr.h:280
std::map< QString, std::shared_ptr< SUIT_ShortcutItemAssets > > myChildren
Definition: SUIT_ShortcutMgr.h:288
QString myIconPath
Definition: SUIT_ShortcutMgr.h:281
virtual QString description() const =0
const QString myModuleID
Definition: SUIT_ShortcutMgr.h:278
Type
Definition: SUIT_ShortcutMgr.h:164
virtual void merge(const SUIT_ShortcutAssets &theOther, bool theOverride)
Definition: SUIT_ShortcutMgr.cxx:1080
virtual SUIT_ShortcutAssets::Type type() const =0
QIcon myIcon
Definition: SUIT_ShortcutMgr.h:284
static const QString PROP_ID_ICON_PATH
Definition: SUIT_ShortcutMgr.h:184
static const QString PROP_ID_LANG_DEPENDENT_ASSETS
Definition: SUIT_ShortcutMgr.h:183
virtual void toJSONVirtual(QJsonObject &oJsonObject) const
Definition: SUIT_ShortcutMgr.h:242
Provides means to keep and edit shortcuts in compliance with the application logics....
Definition: SUIT_ShortcutMgr.h:70
std::map< QString, std::map< QString, QKeySequence > > myShortcutsInversed
{ moduleID, { inModuleActionID, keySequence }[] }[].
Definition: SUIT_ShortcutMgr.h:152
std::map< QString, std::map< QKeySequence, QString > > myShortcuts
{ moduleID, { keySequence, inModuleActionID }[] }[].
Definition: SUIT_ShortcutMgr.h:148
Describes how action IDs evolved between consequtive versions of action ID sets. PS....
Definition: SUIT_ShortcutMgr.h:871
std::map< QString, QString > myOldToNewActionIDMap
The map only keeps changes between AIDS versions.
Definition: SUIT_ShortcutMgr.h:907
static const QString PROP_ID_PREFIX_NEW
Definition: SUIT_ShortcutMgr.h:875
static const QString PROP_ID_PREFIX_OLD
Definition: SUIT_ShortcutMgr.h:874
QString mySectionPrefixNew
New name prefix of a section in user preference files.
Definition: SUIT_ShortcutMgr.h:899
static const QString PROP_ID_OLD_TO_NEW_ACTION_ID_MAP
Definition: SUIT_ShortcutMgr.h:876
std::map< QString, QString > myNewToOldActionIDMap
The map only keeps changes between AIDS versions.
Definition: SUIT_ShortcutMgr.h:903
const std::map< QString, QString > & getNewToOldActionIDMap() const
Definition: SUIT_ShortcutMgr.h:885
const QString & getSectionPrefixOld() const
Definition: SUIT_ShortcutMgr.h:883
const std::map< QString, QString > & getOldToNewActionIDMap() const
Definition: SUIT_ShortcutMgr.h:886
const QString & getSectionPrefixNew() const
Definition: SUIT_ShortcutMgr.h:884
QString mySectionPrefixOld
Old name prefix of a section in user preference files.
Definition: SUIT_ShortcutMgr.h:896
static const QString PROP_ID_MUTATIONS
Definition: SUIT_ShortcutMgr.h:873
Sometimes developers change IDs of actions. And at the moment of release of these changes users may a...
Definition: SUIT_ShortcutMgr.h:861
std::map< QString, SUIT_ShortcutContainer > myShortcutContainers
{sectionNamePrefixOld, shortcutContainer}[].
Definition: SUIT_ShortcutMgr.h:943
const SUIT_ShortcutContainer & getContainerWithOldShortcuts() const
Definition: SUIT_ShortcutMgr.h:925
SUIT_ShortcutContainer myShortcutContainer
Merged myShortcutContainers.
Definition: SUIT_ShortcutMgr.h:946
std::list< std::pair< QString, SUIT_ShortcutHistorian::AIDSMutation > > myOldPrefixToMutationList
{sectionNamePrefixOld, mutation}[].
Definition: SUIT_ShortcutMgr.h:940
static const std::vector< QString > SECTION_PREFIX_EVOLUTION
{name prefix of a section in user preference files}[].
Definition: SUIT_ShortcutMgr.h:865
May represent not just an action, but also a folder within item tree of a module. May also represent ...
Definition: SUIT_ShortcutMgr.h:320
static QIcon DEFAUT_ICON_FOLDER
Definition: SUIT_ShortcutMgr.h:329
std::weak_ptr< SUIT_ShortcutAssets > myParent
Definition: SUIT_ShortcutMgr.h:384
std::map< QString, QString > myBestPaths
{lang, bestPath}[]
Definition: SUIT_ShortcutMgr.h:396
const QString myInModuleID
Definition: SUIT_ShortcutMgr.h:390
SUIT_ShortcutItemAssets(const SUIT_ShortcutItemAssets &)=delete
~SUIT_ShortcutItemAssets()=default
static QIcon DEFAUT_ICON_FOLDER_ACTION
Definition: SUIT_ShortcutMgr.h:330
bool myIsAction
Definition: SUIT_ShortcutMgr.h:386
static QIcon DEFAUT_ICON_ACTION
Definition: SUIT_ShortcutMgr.h:328
const int myDepth
Definition: SUIT_ShortcutMgr.h:393
SUIT_ShortcutAssets::Type type() const
Definition: SUIT_ShortcutMgr.h:349
static const QString PROP_ID_IS_ACTION
Definition: SUIT_ShortcutMgr.h:325
const QString myIDLastToken
Definition: SUIT_ShortcutMgr.h:389
Handles action shortcut customization.
Definition: SUIT_ShortcutMgr.h:482
std::map< QString, std::map< QString, std::set< QAction * > > > myActions
{ moduleID, { inModuleActionID, action[] }[] }[].
Definition: SUIT_ShortcutMgr.h:772
std::map< QKeySequence, std::set< QAction * > > myAnonymousShortcutsInverse
Definition: SUIT_ShortcutMgr.h:799
const std::map< QString, std::shared_ptr< SUIT_ShortcutModuleAssets > > & getModuleAssets() const
Definition: SUIT_ShortcutMgr.h:631
std::map< QString, std::shared_ptr< SUIT_ShortcutModuleAssets > > myModuleAssets
{moduleID, moduleAssets}[].
Definition: SUIT_ShortcutMgr.h:786
SUIT_ShortcutMgr & operator=(const SUIT_ShortcutMgr &)=delete
std::map< QAction *, std::pair< QString, QString > > myActionIDs
{ action, { moduleID, inModuleActionID } }[].
Definition: SUIT_ShortcutMgr.h:775
SUIT_ShortcutMgr(const SUIT_ShortcutMgr &)=delete
static SUIT_ShortcutMgr * myShortcutMgr
Definition: SUIT_ShortcutMgr.h:769
std::map< QAction *, QKeySequence > myAnonymousShortcuts
Actions without IDs, but with hard-coded non-empty key sequences.
Definition: SUIT_ShortcutMgr.h:797
SUIT_ShortcutContainer myShortcutContainer
Can not contain entries like { <non-root module ID>, { <meta-action ID>, actions[] } }.
Definition: SUIT_ShortcutMgr.h:778
std::set< QString > myActiveModuleIDs
Definition: SUIT_ShortcutMgr.h:791
bool myAssetsLoaded
True, if SUIT_ShortcutMgr::setAssetsFromResources(QString) was called.
Definition: SUIT_ShortcutMgr.h:789
static const QString ROOT_MODULE_ID
Definition: SUIT_ShortcutMgr.h:494
GUI-related module assets.
Definition: SUIT_ShortcutMgr.h:294
int depth() const
Definition: SUIT_ShortcutMgr.h:304
SUIT_ShortcutAssets::Type type() const
Definition: SUIT_ShortcutMgr.h:305
~SUIT_ShortcutModuleAssets()=default
SUIT_ShortcutModuleAssets(const SUIT_ShortcutModuleAssets &)=delete
Approximate string matcher, treats strings as sentences composed of words.
Definition: SUIT_SentenceMatcher.h:36
Definition: SUIT_ShortcutMgr.h:950
Definition: SUIT_ShortcutMgr.h:171
QString myName
Definition: SUIT_ShortcutMgr.h:178
QString myToolTip
Definition: SUIT_ShortcutMgr.h:179
static const QString PROP_ID_TOOLTIP
Definition: SUIT_ShortcutMgr.h:173
static const QString PROP_ID_NAME
Definition: SUIT_ShortcutMgr.h:172