Changeset 64259 in vbox
- Timestamp:
- Oct 13, 2016 3:50:07 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/global
- Files:
-
- 2 edited
-
UIGlobalSettingsInput.cpp (modified) (12 diffs)
-
UIGlobalSettingsInput.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r64254 r64259 44 44 45 45 46 /** Column index enumerator. */ 47 enum UIHotKeyColumnIndex 48 { 49 UIHotKeyColumnIndex_Description, 50 UIHotKeyColumnIndex_Sequence, 51 UIHotKeyColumnIndex_Max 52 }; 53 54 46 55 /* Global settings / Input page / Cache / Shortcut cache item: */ 47 56 struct UIShortcutCacheItem … … 119 128 switch (m_iColumn) 120 129 { 121 case 0: return m_order == Qt::AscendingOrder ? item1.description < item2.description : item1.description > item2.description; 122 case 1: return m_order == Qt::AscendingOrder ? item1.currentSequence < item2.currentSequence : item1.currentSequence > item2.currentSequence; 130 case UIHotKeyColumnIndex_Description: 131 return m_order == Qt::AscendingOrder ? item1.description < item2.description : item1.description > item2.description; 132 case UIHotKeyColumnIndex_Sequence: 133 return m_order == Qt::AscendingOrder ? item1.currentSequence < item2.currentSequence : item1.currentSequence > item2.currentSequence; 123 134 default: break; 124 135 } … … 196 207 197 208 public: 198 199 /* Hot-key table field indexes: */200 enum Section201 {202 Section_Name = 0,203 Section_Value = 1204 };205 209 206 210 /* Constructor: */ … … 310 314 switch (index.column()) 311 315 { 312 case UIHotKey Table::Section_Name: return Qt::ItemIsEnabled | Qt::ItemIsSelectable;313 case UIHotKey Table::Section_Value: return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;316 case UIHotKeyColumnIndex_Description: return Qt::ItemIsEnabled | Qt::ItemIsSelectable; 317 case UIHotKeyColumnIndex_Sequence: return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; 314 318 default: break; 315 319 } … … 330 334 switch (iSection) 331 335 { 332 case UIHotKey Table::Section_Name: return tr("Name");333 case UIHotKey Table::Section_Value: return tr("Shortcut");336 case UIHotKeyColumnIndex_Description: return tr("Name"); 337 case UIHotKeyColumnIndex_Sequence: return tr("Shortcut"); 334 338 default: break; 335 339 } … … 356 360 switch (index.column()) 357 361 { 358 case UIHotKey Table::Section_Name:362 case UIHotKeyColumnIndex_Description: 359 363 { 360 364 /* Return shortcut description: */ 361 365 return m_filteredShortcuts[iIndex].description; 362 366 } 363 case UIHotKey Table::Section_Value:367 case UIHotKeyColumnIndex_Sequence: 364 368 { 365 369 /* If that is host-combo cell: */ … … 386 390 switch (index.column()) 387 391 { 388 case UIHotKey Table::Section_Value: return m_filteredShortcuts[iIndex].key == UIHostCombo::hostComboCacheKey() ?389 QVariant::fromValue(UIHostComboWrapper(m_filteredShortcuts[iIndex].currentSequence)) :390 QVariant::fromValue(UIHotKey(m_type == UIActionPoolType_Runtime ?391 UIHotKeyType_Simple : UIHotKeyType_WithModifiers,392 m_filteredShortcuts[iIndex].currentSequence,393 m_filteredShortcuts[iIndex].defaultSequence));392 case UIHotKeyColumnIndex_Sequence: return m_filteredShortcuts[iIndex].key == UIHostCombo::hostComboCacheKey() ? 393 QVariant::fromValue(UIHostComboWrapper(m_filteredShortcuts[iIndex].currentSequence)) : 394 QVariant::fromValue(UIHotKey(m_type == UIActionPoolType_Runtime ? 395 UIHotKeyType_Simple : UIHotKeyType_WithModifiers, 396 m_filteredShortcuts[iIndex].currentSequence, 397 m_filteredShortcuts[iIndex].defaultSequence)); 394 398 default: break; 395 399 } … … 404 408 switch (index.column()) 405 409 { 406 case UIHotKey Table::Section_Value:410 case UIHotKeyColumnIndex_Sequence: 407 411 { 408 412 if (m_filteredShortcuts[iIndex].key != UIHostCombo::hostComboCacheKey() && … … 421 425 switch (index.column()) 422 426 { 423 case UIHotKey Table::Section_Value:427 case UIHotKeyColumnIndex_Sequence: 424 428 { 425 429 if (m_duplicatedSequences.contains(m_filteredShortcuts[iIndex].key)) … … 450 454 switch (index.column()) 451 455 { 452 case UIHotKey Table::Section_Value:456 case UIHotKeyColumnIndex_Sequence: 453 457 { 454 458 /* Get index: */ … … 557 561 558 562 /* Configure sorting: */ 559 sortByColumn( Section_Name, Qt::AscendingOrder);563 sortByColumn(UIHotKeyColumnIndex_Description, Qt::AscendingOrder); 560 564 setSortingEnabled(true); 561 565 } … … 575 579 horizontalHeader()->setStretchLastSection(false); 576 580 #if QT_VERSION >= 0x050000 577 horizontalHeader()->setSectionResizeMode( Section_Name, QHeaderView::Interactive);578 horizontalHeader()->setSectionResizeMode( Section_Value, QHeaderView::Stretch);581 horizontalHeader()->setSectionResizeMode(UIHotKeyColumnIndex_Description, QHeaderView::Interactive); 582 horizontalHeader()->setSectionResizeMode(UIHotKeyColumnIndex_Sequence, QHeaderView::Stretch); 579 583 #else /* QT_VERSION < 0x050000 */ 580 horizontalHeader()->setResizeMode( Section_Name, QHeaderView::Interactive);581 horizontalHeader()->setResizeMode( Section_Value, QHeaderView::Stretch);584 horizontalHeader()->setResizeMode(UIHotKeyColumnIndex_Description, QHeaderView::Interactive); 585 horizontalHeader()->setResizeMode(UIHotKeyColumnIndex_Sequence, QHeaderView::Stretch); 582 586 #endif /* QT_VERSION < 0x050000 */ 583 587 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r64254 r64259 21 21 /* Qt includes: */ 22 22 #include <QAbstractTableModel> 23 #include <QTableView>24 23 25 24 /* GUI includes: */ … … 34 33 class UIHotKeyTableModel; 35 34 class UIHotKeyTable; 35 36 36 37 37 /* Global settings / Input page: */
Note:
See TracChangeset
for help on using the changeset viewer.

