- Timestamp:
- Oct 13, 2016 4:14:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r64261 r64262 65 65 const QString &strCurrentSequence, 66 66 const QString &strDefaultSequence) 67 : key(strKey)68 , description(strDescription)69 , currentSequence(strCurrentSequence)70 , defaultSequence(strDefaultSequence)67 : m_strKey(strKey) 68 , m_strDescription(strDescription) 69 , m_strCurrentSequence(strCurrentSequence) 70 , m_strDefaultSequence(strDefaultSequence) 71 71 {} 72 72 73 73 /** Constructs table row on the basis of @a other one. */ 74 74 UIShortcutCacheItem(const UIShortcutCacheItem &other) 75 : key(other.key)76 , description(other.description)77 , currentSequence(other.currentSequence)78 , defaultSequence(other.defaultSequence)75 : m_strKey(other.key()) 76 , m_strDescription(other.description()) 77 , m_strCurrentSequence(other.currentSequence()) 78 , m_strDefaultSequence(other.defaultSequence()) 79 79 {} 80 80 … … 83 83 { 84 84 /* Reassign variables: */ 85 key = other.key;86 description = other.description;87 currentSequence = other.currentSequence;88 defaultSequence = other.defaultSequence;85 m_strKey = other.key(); 86 m_strDescription = other.description(); 87 m_strCurrentSequence = other.currentSequence(); 88 m_strDefaultSequence = other.defaultSequence(); 89 89 90 90 /* Return this: */ … … 96 96 { 97 97 /* Compare by the key only: */ 98 return key == other.key; 99 } 98 return m_strKey == other.key(); 99 } 100 101 /** Returns the key. */ 102 QString key() const { return m_strKey; } 103 /** Returns the description. */ 104 QString description() const { return m_strDescription; } 105 /** Returns the current sequence. */ 106 QString currentSequence() const { return m_strCurrentSequence; } 107 /** Returns the default sequence. */ 108 QString defaultSequence() const { return m_strDefaultSequence; } 109 110 /** Defines @a strCurrentSequence. */ 111 void setCurrentSequence(const QString &strCurrentSequence) { m_strCurrentSequence = strCurrentSequence; } 112 113 private: 100 114 101 115 /** Holds the key. */ 102 QString key;116 QString m_strKey; 103 117 /** Holds the description. */ 104 QString description;118 QString m_strDescription; 105 119 /** Holds the current sequence. */ 106 QString currentSequence;120 QString m_strCurrentSequence; 107 121 /** Holds the default sequence. */ 108 QString defaultSequence;122 QString m_strDefaultSequence; 109 123 }; 110 124 … … 155 169 { 156 170 case UIHotKeyColumnIndex_Description: 157 return m_order == Qt::AscendingOrder ? item1.description < item2.description : item1.description > item2.description;171 return m_order == Qt::AscendingOrder ? item1.description() < item2.description() : item1.description() > item2.description(); 158 172 case UIHotKeyColumnIndex_Sequence: 159 return m_order == Qt::AscendingOrder ? item1.currentSequence < item2.currentSequence : item1.currentSequence > item2.currentSequence;173 return m_order == Qt::AscendingOrder ? item1.currentSequence() < item2.currentSequence() : item1.currentSequence() > item2.currentSequence(); 160 174 default: break; 161 175 } 162 return m_order == Qt::AscendingOrder ? item1.key < item2.key : item1.key > item2.key;176 return m_order == Qt::AscendingOrder ? item1.key() < item2.key() : item1.key() > item2.key(); 163 177 } 164 178 … … 267 281 { 268 282 /* Filter out unnecessary shortcuts: */ 269 if ((m_type == UIActionPoolType_Selector && item.key .startsWith(GUI_Input_MachineShortcuts)) ||270 (m_type == UIActionPoolType_Runtime && item.key .startsWith(GUI_Input_SelectorShortcuts)))283 if ((m_type == UIActionPoolType_Selector && item.key().startsWith(GUI_Input_MachineShortcuts)) || 284 (m_type == UIActionPoolType_Runtime && item.key().startsWith(GUI_Input_SelectorShortcuts))) 271 285 continue; 272 286 /* Load shortcut cache item into model: */ … … 299 313 QMap<QString, QString> usedSequences; 300 314 foreach (const UIShortcutCacheItem &item, m_shortcuts) 301 if (!item.currentSequence .isEmpty())302 usedSequences.insertMulti(item.currentSequence , item.key);315 if (!item.currentSequence().isEmpty()) 316 usedSequences.insertMulti(item.currentSequence(), item.key()); 303 317 /* Enumerate all the duplicated sequences: */ 304 318 QSet<QString> duplicatedSequences; … … 391 405 { 392 406 /* Return shortcut description: */ 393 return m_filteredShortcuts[iIndex].description ;407 return m_filteredShortcuts[iIndex].description(); 394 408 } 395 409 case UIHotKeyColumnIndex_Sequence: 396 410 { 397 411 /* If that is host-combo cell: */ 398 if (m_filteredShortcuts[iIndex].key == UIHostCombo::hostComboCacheKey())412 if (m_filteredShortcuts[iIndex].key() == UIHostCombo::hostComboCacheKey()) 399 413 /* We should return host-combo: */ 400 return UIHostCombo::toReadableString(m_filteredShortcuts[iIndex].currentSequence );414 return UIHostCombo::toReadableString(m_filteredShortcuts[iIndex].currentSequence()); 401 415 /* In other cases we should return hot-combo: */ 402 QString strHotCombo = m_filteredShortcuts[iIndex].currentSequence ;416 QString strHotCombo = m_filteredShortcuts[iIndex].currentSequence(); 403 417 /* But if that is machine table and hot-combo is not empty: */ 404 418 if (m_type == UIActionPoolType_Runtime && !strHotCombo.isEmpty()) … … 418 432 switch (index.column()) 419 433 { 420 case UIHotKeyColumnIndex_Sequence: return m_filteredShortcuts[iIndex].key == UIHostCombo::hostComboCacheKey() ?421 QVariant::fromValue(UIHostComboWrapper(m_filteredShortcuts[iIndex].currentSequence )) :434 case UIHotKeyColumnIndex_Sequence: return m_filteredShortcuts[iIndex].key() == UIHostCombo::hostComboCacheKey() ? 435 QVariant::fromValue(UIHostComboWrapper(m_filteredShortcuts[iIndex].currentSequence())) : 422 436 QVariant::fromValue(UIHotKey(m_type == UIActionPoolType_Runtime ? 423 437 UIHotKeyType_Simple : UIHotKeyType_WithModifiers, 424 m_filteredShortcuts[iIndex].currentSequence ,425 m_filteredShortcuts[iIndex].defaultSequence ));438 m_filteredShortcuts[iIndex].currentSequence(), 439 m_filteredShortcuts[iIndex].defaultSequence())); 426 440 default: break; 427 441 } … … 438 452 case UIHotKeyColumnIndex_Sequence: 439 453 { 440 if (m_filteredShortcuts[iIndex].key != UIHostCombo::hostComboCacheKey() &&441 m_filteredShortcuts[iIndex].currentSequence != m_filteredShortcuts[iIndex].defaultSequence)454 if (m_filteredShortcuts[iIndex].key() != UIHostCombo::hostComboCacheKey() && 455 m_filteredShortcuts[iIndex].currentSequence() != m_filteredShortcuts[iIndex].defaultSequence()) 442 456 font.setBold(true); 443 457 break; … … 455 469 case UIHotKeyColumnIndex_Sequence: 456 470 { 457 if (m_duplicatedSequences.contains(m_filteredShortcuts[iIndex].key ))471 if (m_duplicatedSequences.contains(m_filteredShortcuts[iIndex].key())) 458 472 return QBrush(Qt::red); 459 473 break; … … 491 505 if (iShortcutIndex != -1) 492 506 { 493 filteredShortcut. currentSequence = filteredShortcut.key== UIHostCombo::hostComboCacheKey() ?494 value.value<UIHostComboWrapper>().toString() :495 value.value<UIHotKey>().sequence();507 filteredShortcut.setCurrentSequence(filteredShortcut.key() == UIHostCombo::hostComboCacheKey() ? 508 value.value<UIHostComboWrapper>().toString() : 509 value.value<UIHotKey>().sequence()); 496 510 m_shortcuts[iShortcutIndex] = filteredShortcut; 497 511 emit sigRevalidationRequired(); … … 550 564 { 551 565 /* If neither description nor sequence matches the filter, skip item: */ 552 if (!item.description .contains(m_strFilter, Qt::CaseInsensitive) &&553 !item.currentSequence .contains(m_strFilter, Qt::CaseInsensitive))566 if (!item.description().contains(m_strFilter, Qt::CaseInsensitive) && 567 !item.currentSequence().contains(m_strFilter, Qt::CaseInsensitive)) 554 568 continue; 555 569 /* Add that item: */ … … 775 789 int iIndexOfHostComboItem = m_pCache->m_shortcuts.indexOf(fakeHostComboItem); 776 790 if (iIndexOfHostComboItem != -1) 777 m_settings.setHostCombo(m_pCache->m_shortcuts[iIndexOfHostComboItem].currentSequence );791 m_settings.setHostCombo(m_pCache->m_shortcuts[iIndexOfHostComboItem].currentSequence()); 778 792 /* Iterate over cached shortcuts: */ 779 793 QMap<QString, QString> sequences; 780 794 foreach (const UIShortcutCacheItem &item, m_pCache->m_shortcuts) 781 sequences.insert(item.key , item.currentSequence);795 sequences.insert(item.key(), item.currentSequence()); 782 796 /* Save shortcut sequences from cache: */ 783 797 gShortcutPool->setOverrides(sequences);
Note:
See TracChangeset
for help on using the changeset viewer.