- Timestamp:
- Aug 23, 2018 4:33:13 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r73791 r73859 191 191 void setName(const QString &strName); 192 192 193 /** Returns action shortcut scope. */ 194 const QString &shortcutScope() const { return m_strShortcutScope; } 195 /** Defines action @a strShortcutScope. */ 196 void setShortcutScope(const QString &strShortcutScope) { m_strShortcutScope = strShortcutScope; } 197 193 198 /** Returns action extra-data ID. */ 194 199 virtual int extraDataID() const { return 0; } … … 248 253 /** Holds the action name. */ 249 254 QString m_strName; 255 /** Holds the action shortcut scope. */ 256 QString m_strShortcutScope; 250 257 /** Holds the action shortcut. */ 251 258 QKeySequence m_shortcut; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp
r73667 r73859 37 37 *********************************************************************************************************************************/ 38 38 39 void UIShortcut::setScope(const QString &strScope) 40 { 41 m_strScope = strScope; 42 } 43 44 const QString &UIShortcut::scope() const 45 { 46 return m_strScope; 47 } 48 39 49 void UIShortcut::setDescription(const QString &strDescription) 40 50 { … … 118 128 /* Create and return new one: */ 119 129 UIShortcut &newShortcut = m_shortcuts[strShortcutKey]; 130 newShortcut.setScope(pAction->shortcutScope()); 120 131 newShortcut.setDescription(pAction->name()); 121 132 newShortcut.setSequence(pAction->defaultShortcut(pActionPool->type())); … … 163 174 /* Get corresponding shortcut: */ 164 175 UIShortcut &existingShortcut = m_shortcuts[strShortcutKey]; 176 /* Copy the scope from the action to the shortcut: */ 177 existingShortcut.setScope(pAction->shortcutScope()); 165 178 /* Copy the description from the action to the shortcut: */ 166 179 existingShortcut.setDescription(pAction->name()); … … 182 195 pAction->retranslateUi(); 183 196 /* Copy the description from the action to the shortcut: */ 197 newShortcut.setScope(pAction->shortcutScope()); 184 198 newShortcut.setDescription(pAction->name()); 185 199 } … … 281 295 /* Default shortcut for the Runtime Popup Menu: */ 282 296 m_shortcuts.insert(s_strShortcutKeyTemplateRuntime.arg("PopupMenu"), 283 UIShortcut(QApplication::translate("UIActionPool", "Popup Menu"), 297 UIShortcut(QString(), 298 QApplication::translate("UIActionPool", "Popup Menu"), 284 299 QString("Home"), QString("Home"))); 285 300 } … … 319 334 /* Modify map with composed key/value: */ 320 335 if (!m_shortcuts.contains(strShortcutKey)) 321 m_shortcuts.insert(strShortcutKey, UIShortcut(QString(), strShortcutSequence, QString()));336 m_shortcuts.insert(strShortcutKey, UIShortcut(QString(), QString(), strShortcutSequence, QString())); 322 337 else 323 338 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.h
r71630 r73859 40 40 /** Constructs empty shortcut descriptor. */ 41 41 UIShortcut() 42 : m_strDescription(QString()) 42 : m_strScope(QString()) 43 , m_strDescription(QString()) 43 44 , m_sequence(QKeySequence()) 44 45 , m_defaultSequence(QKeySequence()) 45 46 {} 46 47 /** Constructs shortcut descriptor. 48 * @param strScope Brings the shortcut scope. 47 49 * @param strDescription Brings the shortcut description. 48 50 * @param sequence Brings the shortcut sequence. 49 51 * @param defaultSequence Brings the default shortcut sequence. */ 50 UIShortcut(const QString &strDescription, 52 UIShortcut(const QString &strScope, 53 const QString &strDescription, 51 54 const QKeySequence &sequence, 52 55 const QKeySequence &defaultSequence) 53 : m_strDescription(strDescription) 56 : m_strScope(strScope) 57 , m_strDescription(strDescription) 54 58 , m_sequence(sequence) 55 59 , m_defaultSequence(defaultSequence) 56 60 {} 61 62 /** Defines the shortcut @a strScope. */ 63 void setScope(const QString &strScope); 64 /** Returns the shortcut scope. */ 65 const QString &scope() const; 57 66 58 67 /** Defines the shortcut @a strDescription. */ … … 76 85 private: 77 86 87 /** Holds the shortcut scope. */ 88 QString m_strScope; 78 89 /** Holds the shortcut description. */ 79 90 QString m_strDescription; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r71525 r73859 91 91 /** Constructs table row on the basis of passed arguments. 92 92 * @param pParent Brings the row this cell belongs too. 93 * @param strKey Brings the unique key inentifying held sequence. 93 * @param strKey Brings the unique key identifying held sequence. 94 * @param strScope Brings the scope of the held sequence. 94 95 * @param strDescription Brings the deescription for the held sequence. 95 96 * @param strCurrentSequence Brings the current held sequence. 96 97 * @param strDefaultSequence Brings the default held sequence. */ 97 98 UIDataShortcutRow(QITableView *pParent, 98 const QString &strKey, 99 const QString &strDescription, 100 const QString &strCurrentSequence, 101 const QString &strDefaultSequence) 99 const QString &strKey, 100 const QString &strScope, 101 const QString &strDescription, 102 const QString &strCurrentSequence, 103 const QString &strDefaultSequence) 102 104 : QITableViewRow(pParent) 103 105 , m_strKey(strKey) 106 , m_strScope(strScope) 104 107 , m_strDescription(strDescription) 105 108 , m_strCurrentSequence(strCurrentSequence) … … 114 117 : QITableViewRow(other.table()) 115 118 , m_strKey(other.key()) 119 , m_strScope(other.scope()) 116 120 , m_strDescription(other.description()) 117 121 , m_strCurrentSequence(other.currentSequence()) … … 135 139 setTable(other.table()); 136 140 m_strKey = other.key(); 141 m_strScope = other.scope(); 137 142 m_strDescription = other.description(); 138 143 m_strCurrentSequence = other.currentSequence(); … … 153 158 return true 154 159 && (m_strKey == other.key()) 160 && (m_strScope == other.scope()) 155 161 && (m_strCurrentSequence == other.currentSequence()) 156 162 ; … … 159 165 /** Returns the key. */ 160 166 QString key() const { return m_strKey; } 167 /** Returns the scope. */ 168 QString scope() const { return m_strScope; } 161 169 /** Returns the description. */ 162 170 QString description() const { return m_strDescription; } … … 211 219 /** Holds the key. */ 212 220 QString m_strKey; 221 /** Holds the scope. */ 222 QString m_strScope; 213 223 /** Holds the description. */ 214 224 QString m_strDescription; … … 504 514 QMap<QString, QString> usedSequences; 505 515 foreach (const UIDataShortcutRow &item, m_shortcuts) 506 if (!item.currentSequence().isEmpty()) 507 usedSequences.insertMulti(item.currentSequence(), item.key()); 516 { 517 QString strKey = item.currentSequence(); 518 if (!strKey.isEmpty()) 519 { 520 const QString strScope = item.scope(); 521 strKey = strScope.isNull() ? strKey : QString("%1: %2").arg(strScope, strKey); 522 usedSequences.insertMulti(strKey, item.key()); 523 } 524 } 508 525 /* Enumerate all the duplicated sequences: */ 509 526 QSet<QString> duplicatedSequences; … … 595 612 case UIHotKeyColumnIndex_Description: 596 613 { 597 /* Return shortcut description: */ 598 return m_filteredShortcuts[iIndex].description(); 614 /* Return shortcut scope and description: */ 615 const QString strScope = m_filteredShortcuts[iIndex].scope(); 616 const QString strDescription = m_filteredShortcuts[iIndex].description(); 617 return strScope.isNull() ? strDescription : tr("%1: %2", "scope: description").arg(strScope, strDescription); 599 618 } 600 619 case UIHotKeyColumnIndex_Sequence: … … 720 739 qStableSort(m_shortcuts.begin(), m_shortcuts.end(), UIShortcutCacheItemFunctor(iColumn, order)); 721 740 /* Make sure host-combo item is always the first one: */ 722 UIDataShortcutRow fakeHostComboItem(0, UIHostCombo::hostComboCacheKey(), QString(), QString(), QString() );741 UIDataShortcutRow fakeHostComboItem(0, UIHostCombo::hostComboCacheKey(), QString(), QString(), QString(), QString()); 723 742 int iIndexOfHostComboItem = UIFunctorFindShortcut(UIFunctorFindShortcut::Base)(m_shortcuts, fakeHostComboItem); 724 743 if (iIndexOfHostComboItem != -1) … … 754 773 foreach (const UIDataShortcutRow &item, m_shortcuts) 755 774 { 756 /* If neither description nor sequence matches the filter, skip item: */ 757 if (!item.description().contains(m_strFilter, Qt::CaseInsensitive) && 775 /* If neither scope nor description or sequence matches the filter, skip item: */ 776 if (!item.scope().contains(m_strFilter, Qt::CaseInsensitive) && 777 !item.description().contains(m_strFilter, Qt::CaseInsensitive) && 758 778 !item.currentSequence().contains(m_strFilter, Qt::CaseInsensitive)) 759 779 continue; … … 889 909 890 910 /* Gather old input data: */ 891 oldInputData.shortcuts() << UIDataShortcutRow(m_pMachineTable, UIHostCombo::hostComboCacheKey(), tr("Host Key Combination"), gEDataManager->hostKeyCombination(), QString()); 911 oldInputData.shortcuts() << UIDataShortcutRow(m_pMachineTable, 912 UIHostCombo::hostComboCacheKey(), 913 QString(), 914 tr("Host Key Combination"), 915 gEDataManager->hostKeyCombination(), 916 QString()); 892 917 const QMap<QString, UIShortcut> &shortcuts = gShortcutPool->shortcuts(); 893 918 const QList<QString> shortcutKeys = shortcuts.keys(); … … 898 923 strShortcutKey.startsWith(GUI_Input_SelectorShortcuts) ? m_pSelectorTable : 0; 899 924 AssertPtr(pParent); 900 oldInputData.shortcuts() << UIDataShortcutRow(pParent, strShortcutKey, VBoxGlobal::removeAccelMark(shortcut.description()), 925 oldInputData.shortcuts() << UIDataShortcutRow(pParent, 926 strShortcutKey, 927 shortcut.scope(), 928 VBoxGlobal::removeAccelMark(shortcut.description()), 901 929 shortcut.sequence().toString(QKeySequence::NativeText), 902 930 shortcut.defaultSequence().toString(QKeySequence::NativeText)); … … 1156 1184 1157 1185 /* Save new host-combo shortcut from the cache: */ 1158 const UIDataShortcutRow fakeHostComboItem(0, UIHostCombo::hostComboCacheKey(), QString(), QString(), QString() );1186 const UIDataShortcutRow fakeHostComboItem(0, UIHostCombo::hostComboCacheKey(), QString(), QString(), QString(), QString()); 1159 1187 const int iHostComboItemBase = UIFunctorFindShortcut(UIFunctorFindShortcut::Base)(oldInputData.shortcuts(), fakeHostComboItem); 1160 1188 const int iHostComboItemData = UIFunctorFindShortcut(UIFunctorFindShortcut::Base)(newInputData.shortcuts(), fakeHostComboItem);
Note:
See TracChangeset
for help on using the changeset viewer.