Changeset 66569 in vbox
- Timestamp:
- Apr 14, 2017 11:13:47 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114596
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp
r65702 r66569 29 29 # include "UIExtraDataDefs.h" 30 30 # include "VBoxGlobalSettings.h" 31 # include "UIHostComboEditor.h"32 31 33 32 /* COM includes: */ … … 52 51 { 53 52 /* default settings */ 54 #if defined (VBOX_WS_WIN)55 hostCombo = "163"; // VK_RCONTROL56 #elif defined (VBOX_WS_X11)57 hostCombo = "65508"; // XK_Control_R58 #elif defined (VBOX_WS_MAC)59 hostCombo = "55"; // QZ_LMETA60 #else61 # warning "port me!"62 #endif63 53 #if defined(VBOX_WS_X11) && defined(DEBUG) 64 54 autoCapture = false; … … 76 66 VBoxGlobalSettingsData::VBoxGlobalSettingsData (const VBoxGlobalSettingsData &that) 77 67 { 78 hostCombo = that.hostCombo;79 68 autoCapture = that.autoCapture; 80 69 guiFeatures = that.guiFeatures; … … 93 82 { 94 83 return this == &that || 95 (hostCombo == that.hostCombo && 96 autoCapture == that.autoCapture && 84 (autoCapture == that.autoCapture && 97 85 guiFeatures == that.guiFeatures && 98 86 languageId == that.languageId && … … 122 110 gPropertyMap[] = 123 111 { 124 { "GUI/Input/HostKeyCombination", "hostCombo", "0|\\d*[1-9]\\d*(,\\d*[1-9]\\d*)?(,\\d*[1-9]\\d*)?", true },125 112 { "GUI/Input/AutoCapture", "autoCapture", "true|false", true }, 126 113 { "GUI/Customizations", "guiFeatures", "\\S+", true }, … … 131 118 { "GUI/HostScreenSaverDisabled", "hostScreenSaverDisabled", "true|false", true } 132 119 }; 133 134 void VBoxGlobalSettings::setHostCombo (const QString &hostCombo)135 {136 if (!UIHostCombo::isValidKeyCombo (hostCombo))137 {138 last_err = tr ("'%1' is an invalid host-combination code-sequence.").arg (hostCombo);139 return;140 }141 mData()->hostCombo = hostCombo;142 resetError();143 }144 120 145 121 bool VBoxGlobalSettings::isFeatureActive (const char *aFeature) const -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h
r62493 r66569 37 37 private: 38 38 39 QString hostCombo;40 39 bool autoCapture; 41 40 QString guiFeatures; … … 54 53 { 55 54 Q_OBJECT 56 Q_PROPERTY (QString hostCombo READ hostCombo WRITE setHostCombo)57 55 Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture) 58 56 Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures) … … 75 73 76 74 // Properties 77 78 QString hostCombo() const { return data()->hostCombo; }79 void setHostCombo (const QString &hostCombo);80 75 81 76 bool autoCapture() const { return data()->autoCapture; } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r62493 r66569 54 54 const char* UIExtraDataDefs::GUI_Input_SelectorShortcuts = "GUI/Input/SelectorShortcuts"; 55 55 const char* UIExtraDataDefs::GUI_Input_MachineShortcuts = "GUI/Input/MachineShortcuts"; 56 const char* UIExtraDataDefs::GUI_Input_HostKeyCombination = "GUI/Input/HostKeyCombination"; 56 57 57 58 /* Settings: Storage: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r64659 r66569 83 83 /** Holds Runtime UI shortcut overrides. */ 84 84 extern const char* GUI_Input_MachineShortcuts; 85 /** Holds Runtime UI host-key combination. */ 86 extern const char* GUI_Input_HostKeyCombination; 85 87 /** @} */ 86 88 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r63626 r66569 40 40 # include "UIDesktopWidgetWatchdog.h" 41 41 # include "UIExtraDataManager.h" 42 # include "UIHostComboEditor.h" 42 43 # include "UIMainEventListener.h" 43 44 # include "VBoxGlobalSettings.h" … … 2337 2338 } 2338 2339 2340 QString UIExtraDataManager::hostKeyCombination() 2341 { 2342 /* Acquire host-key combination: */ 2343 QString strHostCombo = extraDataString(GUI_Input_HostKeyCombination); 2344 /* Invent some sane default if it's absolutely wrong or invalid: */ 2345 QRegularExpression reTemplate("0|[1-9]\\d*(,[1-9]\\d*)?(,[1-9]\\d*)?"); 2346 if (!reTemplate.match(strHostCombo).hasMatch() || !UIHostCombo::isValidKeyCombo(strHostCombo)) 2347 { 2348 #if defined (VBOX_WS_MAC) 2349 strHostCombo = "55"; // QZ_LMETA 2350 #elif defined (VBOX_WS_WIN) 2351 strHostCombo = "163"; // VK_RCONTROL 2352 #elif defined (VBOX_WS_X11) 2353 strHostCombo = "65508"; // XK_Control_R 2354 #else 2355 # warning "port me!" 2356 #endif 2357 } 2358 /* Return host-combo: */ 2359 return strHostCombo; 2360 } 2361 2362 void UIExtraDataManager::setHostKeyCombination(const QString &strHostCombo) 2363 { 2364 /* Do not save anything if it's absolutely wrong or invalid: */ 2365 QRegularExpression reTemplate("0|[1-9]\\d*(,[1-9]\\d*)?(,[1-9]\\d*)?"); 2366 if (!reTemplate.match(strHostCombo).hasMatch() || !UIHostCombo::isValidKeyCombo(strHostCombo)) 2367 return; 2368 /* Define host-combo: */ 2369 setExtraDataString(GUI_Input_HostKeyCombination, strHostCombo); 2370 } 2371 2339 2372 QStringList UIExtraDataManager::shortcutOverrides(const QString &strPoolExtraDataID) 2340 2373 { … … 3986 4019 else if (strKey == GUI_Input_MachineShortcuts) 3987 4020 emit sigRuntimeUIShortcutChange(); 4021 /* Runtime UI host-key combintation changed? */ 4022 else if (strKey == GUI_Input_HostKeyCombination) 4023 emit sigRuntimeUIHostKeyCombinationChange(); 3988 4024 } 3989 4025 } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r62493 r66569 67 67 /** Notifies about Runtime UI keyboard shortcut change. */ 68 68 void sigRuntimeUIShortcutChange(); 69 /** Notifies about Runtime UI host-key combination change. */ 70 void sigRuntimeUIHostKeyCombinationChange(); 69 71 70 72 /** Notifies about menu-bar configuration change. */ … … 193 195 /** @name Settings: Keyboard 194 196 * @{ */ 197 /** Returns the Runtime UI host-key combination. */ 198 QString hostKeyCombination(); 199 /** Defines the Runtime UI host-key combination. */ 200 void setHostKeyCombination(const QString &strHostCombo); 201 195 202 /** Returns shortcut overrides for shortcut-pool with @a strPoolExtraDataID. */ 196 203 QStringList shortcutOverrides(const QString &strPoolExtraDataID); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r66566 r66569 2071 2071 "This icon, together with the mouse icon placed nearby, indicate the current keyboard and mouse capture state.</p>") + 2072 2072 tr("<p>The host key is currently defined as <b>%1</b>.</p>", "additional message box paragraph") 2073 .arg(UIHostCombo::toReadableString( vboxGlobal().settings().hostCombo())),2073 .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 2074 2074 "confirmInputCapture", 2075 2075 AlertButton_Ok | AlertButtonOption_Default, … … 2091 2091 "<p>Note that the main menu bar is hidden in full-screen mode. " 2092 2092 "You can access it by pressing <b>Host+Home</b>.</p>") 2093 .arg(strHotKey, UIHostCombo::toReadableString( vboxGlobal().settings().hostCombo())),2093 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 2094 2094 "confirmGoingFullscreen", 2095 2095 tr("Switch")); … … 2104 2104 "<p>Note that the main menu bar is hidden in seamless mode. " 2105 2105 "You can access it by pressing <b>Host+Home</b>.</p>") 2106 .arg(strHotKey, UIHostCombo::toReadableString( vboxGlobal().settings().hostCombo())),2106 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 2107 2107 "confirmGoingSeamless", 2108 2108 tr("Switch")); … … 2117 2117 "<p>Note that the main menu bar is hidden in scaled mode. " 2118 2118 "You can access it by pressing <b>Host+Home</b>.</p>") 2119 .arg(strHotKey, UIHostCombo::toReadableString( vboxGlobal().settings().hostCombo())),2119 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 2120 2120 "confirmGoingScale", 2121 2121 tr("Switch")); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
r62493 r66569 434 434 QApplication::translate("UIMessageCenter", "<p>The host key is currently defined as <b>%1</b>.</p>", 435 435 "additional message box paragraph") 436 .arg(UIHostCombo::toReadableString( vboxGlobal().settings().hostCombo())),436 .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 437 437 true); 438 438 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r65257 r66569 1005 1005 { 1006 1006 /* Make sure host-combination label will be updated: */ 1007 connect( &vboxGlobal().settings(), SIGNAL(propertyChanged(const char *, const char *)),1007 connect(gEDataManager, SIGNAL(sigRuntimeUIHostKeyCombinationChange()), 1008 1008 this, SLOT(sltUpdateAppearance())); 1009 1009 /* Translate finally: */ … … 1016 1016 void sltUpdateAppearance() 1017 1017 { 1018 setText(UIHostCombo::toReadableString( vboxGlobal().settings().hostCombo()));1018 setText(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())); 1019 1019 } 1020 1020 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r66495 r66569 533 533 if (!fSentRESEND) 534 534 { 535 QList <unsigned> shortCodes = UIHostCombo::modifiersToScanCodes( m_globalSettings.hostCombo());535 QList <unsigned> shortCodes = UIHostCombo::modifiersToScanCodes(gEDataManager->hostKeyCombination()); 536 536 QVector <LONG> codes; 537 537 foreach (unsigned idxCode, shortCodes) … … 572 572 #ifdef VBOX_WS_MAC 573 573 unsigned int hostComboModifierMask = 0; 574 QList<int> hostCombo = UIHostCombo::toKeyCodeList( m_globalSettings.hostCombo());574 QList<int> hostCombo = UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination()); 575 575 for (int i = 0; i < hostCombo.size(); ++i) 576 576 hostComboModifierMask |= ::DarwinKeyCodeToDarwinModifierMask(hostCombo.at(i)); … … 1901 1901 ? IsExtKeyPressed : IsKeyPressed; 1902 1902 if ( (event.flags & 0x80) /* released */ 1903 && ( ( UIHostCombo::toKeyCodeList( m_globalSettings.hostCombo()).contains(event.vkCode)1903 && ( ( UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination()).contains(event.vkCode) 1904 1904 && !m_fIsHostkeyInCapture) 1905 1905 || ( m_pressedKeys[event.scanCode & 0x7F] … … 1978 1978 { 1979 1979 /* Get host-combo key list: */ 1980 QSet<int> allHostComboKeys = UIHostCombo::toKeyCodeList( m_globalSettings.hostCombo()).toSet();1980 QSet<int> allHostComboKeys = UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination()).toSet(); 1981 1981 /* Get the type of key - simple or extended: */ 1982 1982 uint8_t uWhatPressed = fFlags & KeyExtended ? IsExtKeyPressed : IsKeyPressed; … … 2155 2155 { 2156 2156 /* Get host-combo key list: */ 2157 QSet<int> allHostComboKeys = UIHostCombo::toKeyCodeList( m_globalSettings.hostCombo()).toSet();2157 QSet<int> allHostComboKeys = UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination()).toSet(); 2158 2158 2159 2159 /* Update the map of pressed host-combo keys: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r66568 r66569 35 35 # include "UIHotKeyEditor.h" 36 36 # include "UIShortcutPool.h" 37 # include "UIExtraDataManager.h" 37 38 # include "VBoxGlobalSettings.h" 38 39 … … 892 893 893 894 /* Gather old input data: */ 894 oldInputData.shortcuts() << UIDataShortcutRow(m_pMachineTable, UIHostCombo::hostComboCacheKey(), tr("Host Key Combination"), m_settings.hostCombo(), QString());895 oldInputData.shortcuts() << UIDataShortcutRow(m_pMachineTable, UIHostCombo::hostComboCacheKey(), tr("Host Key Combination"), gEDataManager->hostKeyCombination(), QString()); 895 896 const QMap<QString, UIShortcut> &shortcuts = gShortcutPool->shortcuts(); 896 897 const QList<QString> shortcutKeys = shortcuts.keys(); … … 957 958 const QString strHostComboData = iHostComboItemData != -1 ? m_pCache->data().shortcuts().at(iHostComboItemData).currentSequence() : QString(); 958 959 if (strHostComboData != strHostComboBase) 959 m_settings.setHostCombo(strHostComboData);960 gEDataManager->setHostKeyCombination(strHostComboData); 960 961 961 962 /* Save other new shortcuts from the cache: */
Note:
See TracChangeset
for help on using the changeset viewer.