Changeset 64254 in vbox
- Timestamp:
- Oct 13, 2016 2:51:50 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111264
- 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
r64180 r64254 42 42 /* Namespaces: */ 43 43 using namespace UIExtraDataDefs; 44 45 46 /* Global settings / Input page / Cache / Shortcut cache item: */ 47 struct UIShortcutCacheItem 48 { 49 UIShortcutCacheItem(const QString &strKey, 50 const QString &strDescription, 51 const QString &strCurrentSequence, 52 const QString &strDefaultSequence) 53 : key(strKey) 54 , description(strDescription) 55 , currentSequence(strCurrentSequence) 56 , defaultSequence(strDefaultSequence) 57 {} 58 59 UIShortcutCacheItem(const UIShortcutCacheItem &other) 60 : key(other.key) 61 , description(other.description) 62 , currentSequence(other.currentSequence) 63 , defaultSequence(other.defaultSequence) 64 {} 65 66 UIShortcutCacheItem& operator=(const UIShortcutCacheItem &other) 67 { 68 key = other.key; 69 description = other.description; 70 currentSequence = other.currentSequence; 71 defaultSequence = other.defaultSequence; 72 return *this; 73 } 74 75 bool operator==(const UIShortcutCacheItem &other) const 76 { 77 return key == other.key; 78 } 79 80 QString key; 81 QString description; 82 QString currentSequence; 83 QString defaultSequence; 84 }; 85 86 /* Global settings / Input page / Cache / Shortcut cache: */ 87 typedef QList<UIShortcutCacheItem> UIShortcutCache; 88 89 /* Global settings / Input page / Cache: */ 90 class UISettingsCacheGlobalInput : public QObject 91 { 92 Q_OBJECT; 93 94 public: 95 96 UISettingsCacheGlobalInput(QObject *pParent) 97 : QObject(pParent) 98 , m_fAutoCapture(false) 99 {} 100 101 UIShortcutCache m_shortcuts; 102 bool m_fAutoCapture; 103 }; 44 104 45 105 … … 562 622 , m_pSelectorFilterEditor(0), m_pSelectorModel(0), m_pSelectorTable(0) 563 623 , m_pMachineFilterEditor(0), m_pMachineModel(0), m_pMachineTable(0) 624 , m_pCache(new UISettingsCacheGlobalInput(this)) 564 625 { 565 626 /* Apply UI decorations: */ … … 630 691 631 692 /* Load host-combo shortcut to cache: */ 632 m_ cache.m_shortcuts << UIShortcutCacheItem(UIHostCombo::hostComboCacheKey(), tr("Host Key Combination"), m_settings.hostCombo(), QString());693 m_pCache->m_shortcuts << UIShortcutCacheItem(UIHostCombo::hostComboCacheKey(), tr("Host Key Combination"), m_settings.hostCombo(), QString()); 633 694 /* Load all other shortcuts to cache: */ 634 695 const QMap<QString, UIShortcut>& shortcuts = gShortcutPool->shortcuts(); … … 637 698 { 638 699 const UIShortcut &shortcut = shortcuts[strShortcutKey]; 639 m_ cache.m_shortcuts << UIShortcutCacheItem(strShortcutKey, VBoxGlobal::removeAccelMark(shortcut.description()),700 m_pCache->m_shortcuts << UIShortcutCacheItem(strShortcutKey, VBoxGlobal::removeAccelMark(shortcut.description()), 640 701 shortcut.sequence().toString(QKeySequence::NativeText), 641 702 shortcut.defaultSequence().toString(QKeySequence::NativeText)); 642 703 } 643 704 /* Load other things to cache: */ 644 m_ cache.m_fAutoCapture = m_settings.autoCapture();705 m_pCache->m_fAutoCapture = m_settings.autoCapture(); 645 706 646 707 /* Upload properties & settings to data: */ … … 653 714 { 654 715 /* Fetch from cache: */ 655 m_pSelectorModel->load(m_ cache.m_shortcuts);656 m_pMachineModel->load(m_ cache.m_shortcuts);657 m_pEnableAutoGrabCheckbox->setChecked(m_ cache.m_fAutoCapture);716 m_pSelectorModel->load(m_pCache->m_shortcuts); 717 m_pMachineModel->load(m_pCache->m_shortcuts); 718 m_pEnableAutoGrabCheckbox->setChecked(m_pCache->m_fAutoCapture); 658 719 659 720 /* Revalidate: */ … … 666 727 { 667 728 /* Upload to cache: */ 668 m_pSelectorModel->save(m_ cache.m_shortcuts);669 m_pMachineModel->save(m_ cache.m_shortcuts);670 m_ cache.m_fAutoCapture = m_pEnableAutoGrabCheckbox->isChecked();729 m_pSelectorModel->save(m_pCache->m_shortcuts); 730 m_pMachineModel->save(m_pCache->m_shortcuts); 731 m_pCache->m_fAutoCapture = m_pEnableAutoGrabCheckbox->isChecked(); 671 732 } 672 733 … … 680 741 /* Save host-combo shortcut from cache: */ 681 742 UIShortcutCacheItem fakeHostComboItem(UIHostCombo::hostComboCacheKey(), QString(), QString(), QString()); 682 int iIndexOfHostComboItem = m_ cache.m_shortcuts.indexOf(fakeHostComboItem);743 int iIndexOfHostComboItem = m_pCache->m_shortcuts.indexOf(fakeHostComboItem); 683 744 if (iIndexOfHostComboItem != -1) 684 m_settings.setHostCombo(m_ cache.m_shortcuts[iIndexOfHostComboItem].currentSequence);745 m_settings.setHostCombo(m_pCache->m_shortcuts[iIndexOfHostComboItem].currentSequence); 685 746 /* Iterate over cached shortcuts: */ 686 747 QMap<QString, QString> sequences; 687 foreach (const UIShortcutCacheItem &item, m_ cache.m_shortcuts)748 foreach (const UIShortcutCacheItem &item, m_pCache->m_shortcuts) 688 749 sequences.insert(item.key, item.currentSequence); 689 750 /* Save shortcut sequences from cache: */ 690 751 gShortcutPool->setOverrides(sequences); 691 752 /* Save other things from cache: */ 692 m_settings.setAutoCapture(m_ cache.m_fAutoCapture);753 m_settings.setAutoCapture(m_pCache->m_fAutoCapture); 693 754 694 755 /* Upload properties & settings to data: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r64170 r64254 31 31 class QTabWidget; 32 32 class QLineEdit; 33 class UISettingsCacheGlobalInput; 33 34 class UIHotKeyTableModel; 34 35 class UIHotKeyTable; 35 36 /* Global settings / Input page / Cache / Shortcut cache item: */37 struct UIShortcutCacheItem38 {39 UIShortcutCacheItem(const QString &strKey,40 const QString &strDescription,41 const QString &strCurrentSequence,42 const QString &strDefaultSequence)43 : key(strKey)44 , description(strDescription)45 , currentSequence(strCurrentSequence)46 , defaultSequence(strDefaultSequence)47 {}48 49 UIShortcutCacheItem(const UIShortcutCacheItem &other)50 : key(other.key)51 , description(other.description)52 , currentSequence(other.currentSequence)53 , defaultSequence(other.defaultSequence)54 {}55 56 UIShortcutCacheItem& operator=(const UIShortcutCacheItem &other)57 {58 key = other.key;59 description = other.description;60 currentSequence = other.currentSequence;61 defaultSequence = other.defaultSequence;62 return *this;63 }64 65 bool operator==(const UIShortcutCacheItem &other) const66 {67 return key == other.key;68 }69 70 QString key;71 QString description;72 QString currentSequence;73 QString defaultSequence;74 };75 76 /* Global settings / Input page / Cache / Shortcut cache: */77 typedef QList<UIShortcutCacheItem> UIShortcutCache;78 79 /* Global settings / Input page / Cache: */80 struct UISettingsCacheGlobalInput81 {82 UIShortcutCache m_shortcuts;83 bool m_fAutoCapture;84 };85 36 86 37 /* Global settings / Input page: */ … … 131 82 void prepareValidation(); 132 83 133 /* Cache: */134 UISettingsCacheGlobalInput m_cache;135 84 QTabWidget *m_pTabWidget; 136 85 QLineEdit *m_pSelectorFilterEditor; … … 140 89 UIHotKeyTableModel *m_pMachineModel; 141 90 UIHotKeyTable *m_pMachineTable; 91 92 /** Holds the cache instance. */ 93 UISettingsCacheGlobalInput *m_pCache; 142 94 }; 143 95
Note:
See TracChangeset
for help on using the changeset viewer.