VirtualBox

Changeset 64259 in vbox


Ignore:
Timestamp:
Oct 13, 2016 3:50:07 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 88): Preferences: Input page: Cleanup/rework: Reuse common enum.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/global
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp

    r64254 r64259  
    4444
    4545
     46/** Column index enumerator. */
     47enum UIHotKeyColumnIndex
     48{
     49    UIHotKeyColumnIndex_Description,
     50    UIHotKeyColumnIndex_Sequence,
     51    UIHotKeyColumnIndex_Max
     52};
     53
     54
    4655/* Global settings / Input page / Cache / Shortcut cache item: */
    4756struct UIShortcutCacheItem
     
    119128        switch (m_iColumn)
    120129        {
    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;
    123134            default: break;
    124135        }
     
    196207
    197208public:
    198 
    199     /* Hot-key table field indexes: */
    200     enum Section
    201     {
    202         Section_Name = 0,
    203         Section_Value = 1
    204     };
    205209
    206210    /* Constructor: */
     
    310314    switch (index.column())
    311315    {
    312         case UIHotKeyTable::Section_Name: return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
    313         case UIHotKeyTable::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;
    314318        default: break;
    315319    }
     
    330334            switch (iSection)
    331335            {
    332                 case UIHotKeyTable::Section_Name: return tr("Name");
    333                 case UIHotKeyTable::Section_Value: return tr("Shortcut");
     336                case UIHotKeyColumnIndex_Description: return tr("Name");
     337                case UIHotKeyColumnIndex_Sequence: return tr("Shortcut");
    334338                default: break;
    335339            }
     
    356360            switch (index.column())
    357361            {
    358                 case UIHotKeyTable::Section_Name:
     362                case UIHotKeyColumnIndex_Description:
    359363                {
    360364                    /* Return shortcut description: */
    361365                    return m_filteredShortcuts[iIndex].description;
    362366                }
    363                 case UIHotKeyTable::Section_Value:
     367                case UIHotKeyColumnIndex_Sequence:
    364368                {
    365369                    /* If that is host-combo cell: */
     
    386390            switch (index.column())
    387391            {
    388                 case UIHotKeyTable::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));
    394398                default: break;
    395399            }
     
    404408            switch (index.column())
    405409            {
    406                 case UIHotKeyTable::Section_Value:
     410                case UIHotKeyColumnIndex_Sequence:
    407411                {
    408412                    if (m_filteredShortcuts[iIndex].key != UIHostCombo::hostComboCacheKey() &&
     
    421425            switch (index.column())
    422426            {
    423                 case UIHotKeyTable::Section_Value:
     427                case UIHotKeyColumnIndex_Sequence:
    424428                {
    425429                    if (m_duplicatedSequences.contains(m_filteredShortcuts[iIndex].key))
     
    450454            switch (index.column())
    451455            {
    452                 case UIHotKeyTable::Section_Value:
     456                case UIHotKeyColumnIndex_Sequence:
    453457                {
    454458                    /* Get index: */
     
    557561
    558562    /* Configure sorting: */
    559     sortByColumn(Section_Name, Qt::AscendingOrder);
     563    sortByColumn(UIHotKeyColumnIndex_Description, Qt::AscendingOrder);
    560564    setSortingEnabled(true);
    561565}
     
    575579    horizontalHeader()->setStretchLastSection(false);
    576580#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);
    579583#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);
    582586#endif /* QT_VERSION < 0x050000 */
    583587
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h

    r64254 r64259  
    2121/* Qt includes: */
    2222#include <QAbstractTableModel>
    23 #include <QTableView>
    2423
    2524/* GUI includes: */
     
    3433class UIHotKeyTableModel;
    3534class UIHotKeyTable;
     35
    3636
    3737/* Global settings / Input page: */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette