VirtualBox

Ignore:
Timestamp:
Feb 15, 2013 1:12:31 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: 6065: Extend UIHotKey with type access API, using it in UIHotKeyTableModel.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

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

    r44711 r44712  
    260260                case UIHotKeyTableSection_Value: return m_filteredShortcuts[iIndex].key == UIHostCombo::hostComboCacheKey() ?
    261261                                                        QVariant::fromValue(UIHostComboWrapper(m_filteredShortcuts[iIndex].currentSequence)) :
    262                                                         QVariant::fromValue(UIHotKey(m_filteredShortcuts[iIndex].currentSequence,
     262                                                        QVariant::fromValue(UIHotKey(m_type == UIActionPoolType_Runtime ?
     263                                                                                     UIHotKeyType_Simple : UIHotKeyType_WithModifiers,
     264                                                                                     m_filteredShortcuts[iIndex].currentSequence,
    263265                                                                                     m_filteredShortcuts[iIndex].defaultSequence));
    264266                default: break;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.cpp

    r44682 r44712  
    103103UIHotKeyEditor::UIHotKeyEditor(QWidget *pParent)
    104104    : QIWithRetranslateUI<QWidget>(pParent)
     105    , m_fIsModifiersAllowed(false)
    105106    , m_pMainLayout(new QHBoxLayout(this))
    106107    , m_pLineEdit(new UIHotKeyLineEdit(this))
     
    251252void UIHotKeyEditor::fetchModifiersState()
    252253{
     254    /* Make sure modifiers allowed: */
     255    if (!m_fIsModifiersAllowed)
     256        return;
     257
    253258    /* If full sequence was not yet taken: */
    254259    if (!m_fSequenceTaken)
     
    386391void UIHotKeyEditor::setHotKey(const UIHotKey &hotKey)
    387392{
     393    m_fIsModifiersAllowed = hotKey.type() == UIHotKeyType_WithModifiers;
    388394    m_hotKey = hotKey;
    389395    m_pLineEdit->setText(hotKey.sequence());
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.h

    r44683 r44712  
    3333class UIHotKeyLineEdit;
    3434
     35/* Host key type enumerator: */
     36enum UIHotKeyType
     37{
     38    UIHotKeyType_Simple,
     39    UIHotKeyType_WithModifiers
     40};
     41
    3542/* A string pair wrapper for hot-key sequence: */
    3643class UIHotKey
     
    3946
    4047    /* Constructors: */
    41     UIHotKey() {}
    42     UIHotKey(const QString &strSequence,
     48    UIHotKey()
     49        : m_type(UIHotKeyType_Simple)
     50    {}
     51    UIHotKey(UIHotKeyType type,
     52             const QString &strSequence,
    4353             const QString &strDefaultSequence)
    44         : m_strSequence(strSequence)
     54        : m_type(type)
     55        , m_strSequence(strSequence)
    4556        , m_strDefaultSequence(strDefaultSequence)
    4657    {}
    4758    UIHotKey(const UIHotKey &other)
    48         : m_strSequence(other.sequence())
     59        : m_type(other.type())
     60        , m_strSequence(other.sequence())
    4961        , m_strDefaultSequence(other.defaultSequence())
    5062    {}
     
    5870    }
    5971
    60     /* API: Access stuff: */
     72    /* API: Type access stuff: */
     73    UIHotKeyType type() const { return m_type; }
     74
     75    /* API: Sequence access stuff: */
    6176    const QString& sequence() const { return m_strSequence; }
    6277    const QString& defaultSequence() const { return m_strDefaultSequence; }
     
    6681
    6782    /* Variables: */
     83    UIHotKeyType m_type;
    6884    QString m_strSequence;
    6985    QString m_strDefaultSequence;
     
    117133    /* Variables: */
    118134    mutable UIHotKey m_hotKey;
     135    mutable bool m_fIsModifiersAllowed;
    119136    QHBoxLayout *m_pMainLayout;
    120137    UIHotKeyLineEdit *m_pLineEdit;
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