- Timestamp:
- Nov 25, 2019 5:18:11 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r82186 r82187 247 247 /** Returns default keyboard shortcut for this action. */ 248 248 virtual QKeySequence defaultShortcut(UIActionPoolType) const { return QKeySequence(); } 249 /** Returns standard keyboard shortcut for this action. */ 250 virtual QKeySequence standardShortcut(UIActionPoolType) const { return QKeySequence(); } 249 251 250 252 /** Defines current keyboard shortcuts for this action. */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp
r82186 r82187 71 71 } 72 72 73 void UIShortcut::setStandardSequence(const QKeySequence &standardSequence) 74 { 75 m_standardSequence = standardSequence; 76 } 77 78 const QKeySequence &UIShortcut::standardSequence() const 79 { 80 return m_standardSequence; 81 } 82 73 83 QString UIShortcut::primaryToNativeText() const 74 84 { … … 130 140 newShortcut.setDescription(pAction->name()); 131 141 const QKeySequence &defaultSequence = pAction->defaultShortcut(pActionPool->type()); 132 newShortcut.setSequences(QList<QKeySequence>() << defaultSequence); 142 const QKeySequence &standardSequence = pAction->standardShortcut(pActionPool->type()); 143 newShortcut.setSequences(QList<QKeySequence>() << defaultSequence << standardSequence); 133 144 newShortcut.setDefaultSequence(defaultSequence); 145 newShortcut.setStandardSequence(standardSequence); 134 146 return newShortcut; 135 147 } … … 181 193 pAction->setShortcuts(existingShortcut.sequences()); 182 194 pAction->retranslateUi(); 183 /* Copy default sequencefrom the action to the shortcut: */195 /* Copy default and standard sequences from the action to the shortcut: */ 184 196 existingShortcut.setDefaultSequence(pAction->defaultShortcut(pActionPool->type())); 197 existingShortcut.setStandardSequence(pAction->standardShortcut(pActionPool->type())); 185 198 } 186 199 /* If shortcut key is NOT known yet: */ … … 191 204 /* Copy the action's default sequence to both the shortcut & the action: */ 192 205 const QKeySequence &defaultSequence = pAction->defaultShortcut(pActionPool->type()); 193 newShortcut.setSequences(QList<QKeySequence>() << defaultSequence); 206 const QKeySequence &standardSequence = pAction->standardShortcut(pActionPool->type()); 207 newShortcut.setSequences(QList<QKeySequence>() << defaultSequence << standardSequence); 194 208 newShortcut.setDefaultSequence(defaultSequence); 209 newShortcut.setStandardSequence(standardSequence); 195 210 pAction->setShortcuts(newShortcut.sequences()); 196 211 pAction->retranslateUi(); … … 299 314 QApplication::translate("UIActionPool", "Popup Menu"), 300 315 QList<QKeySequence>() << QString("Home"), 301 QString("Home"))); 316 QString("Home"), 317 QString())); 302 318 } 303 319 } … … 340 356 QString(), 341 357 QList<QKeySequence>() << strShortcutSequence, 358 QString(), 342 359 QString())); 343 360 else … … 381 398 /* Get corresponding shortcut: */ 382 399 const UIShortcut &shortcut = m_shortcuts[strShortcutKey]; 383 /* Check if the sequence for that shortcut differs from default: */ 384 if (shortcut.sequences().contains(shortcut.defaultSequence())) 400 /* Check if the sequence for that shortcut differs from default or standard: */ 401 if ( shortcut.sequences().contains(shortcut.defaultSequence()) 402 || shortcut.sequences().contains(shortcut.standardSequence())) 385 403 continue; 386 404 /* Add the shortcut sequence into overrides list: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.h
r82186 r82187 47 47 , m_sequences(QList<QKeySequence>()) 48 48 , m_defaultSequence(QKeySequence()) 49 , m_standardSequence(QKeySequence()) 49 50 {} 50 51 /** Constructs shortcut descriptor. … … 52 53 * @param strDescription Brings the shortcut description. 53 54 * @param sequences Brings the shortcut sequences. 54 * @param defaultSequence Brings the default shortcut sequence. */ 55 * @param defaultSequence Brings the default shortcut sequence. 56 * @param standardSequence Brings the standard shortcut sequence. */ 55 57 UIShortcut(const QString &strScope, 56 58 const QString &strDescription, 57 59 const QList<QKeySequence> &sequences, 58 const QKeySequence &defaultSequence) 60 const QKeySequence &defaultSequence, 61 const QKeySequence &standardSequence) 59 62 : m_strScope(strScope) 60 63 , m_strDescription(strDescription) 61 64 , m_sequences(sequences) 62 65 , m_defaultSequence(defaultSequence) 66 , m_standardSequence(standardSequence) 63 67 {} 64 68 … … 82 86 /** Returns the default shortcut sequence. */ 83 87 const QKeySequence &defaultSequence() const; 88 89 /** Defines the standard shortcut @a sequence. */ 90 void setStandardSequence(const QKeySequence &sequence); 91 /** Returns the standard shortcut sequence. */ 92 const QKeySequence &standardSequence() const; 84 93 85 94 /** Converts primary shortcut sequence to native text. */ … … 98 107 /** Holds the default shortcut sequence. */ 99 108 QKeySequence m_defaultSequence; 109 /** Holds the standard shortcut sequence. */ 110 QKeySequence m_standardSequence; 100 111 }; 101 112
Note:
See TracChangeset
for help on using the changeset viewer.