Changeset 44586 in vbox
- Timestamp:
- Feb 7, 2013 1:52:35 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp
r44585 r44586 210 210 } 211 211 212 void UIShortcutPool::cleanup() 213 { 214 /* Save overrides: */ 215 saveOverrides(); 216 } 217 212 218 void UIShortcutPool::loadDefaults() 213 219 { … … 253 259 /* Get corresponding value: */ 254 260 UIShortcut &shortcut = m_shortcuts[strShortcutKey]; 255 /* Check if corresponding shortcut overrid en by value: */261 /* Check if corresponding shortcut overridden by value: */ 256 262 if (shortcut.toString().compare(strShortcutSequence, Qt::CaseInsensitive) != 0) 257 263 { … … 267 273 } 268 274 275 void UIShortcutPool::saveOverrides() 276 { 277 /* Load selector overrides: */ 278 saveOverridesFor(GUI_Input_SelectorShortcuts); 279 /* Load machine overrides: */ 280 saveOverridesFor(GUI_Input_MachineShortcuts); 281 } 282 283 void UIShortcutPool::saveOverridesFor(const QString &strPoolExtraDataID) 284 { 285 /* Compose shortcut prefix: */ 286 const QString strShortcutPrefix(m_strShortcutKeyTemplate.arg(strPoolExtraDataID, QString())); 287 /* Populate the list of all the known overrides: */ 288 QStringList overrides; 289 const QList<QString> shortcutKeys = m_shortcuts.keys(); 290 foreach (const QString &strShortcutKey, shortcutKeys) 291 { 292 /* Check if the key starts from the proper prefix: */ 293 if (!strShortcutKey.startsWith(strShortcutPrefix)) 294 continue; 295 /* Get corresponding shortcut: */ 296 const UIShortcut &shortcut = m_shortcuts[strShortcutKey]; 297 /* Check if the sequence for that shortcut differs from default: */ 298 if (shortcut.sequence() == shortcut.defaultSequence()) 299 continue; 300 /* Add the shortcut sequence into overrides list: */ 301 overrides << QString("%1=%2").arg(QString(strShortcutKey).remove(strShortcutPrefix), 302 shortcut.sequence().toString()); 303 } 304 /* Save overrides into the extra-data: */ 305 vboxGlobal().virtualBox().SetExtraDataStringList(strPoolExtraDataID, overrides); 306 } 307 269 308 UIShortcut& UIShortcutPool::shortcut(const QString &strShortcutKey) 270 309 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.h
r44585 r44586 115 115 116 116 /* Helper: Cleanup stuff: */ 117 void cleanup() {}117 void cleanup(); 118 118 119 119 /* Helpers: Shortcuts stuff: */ … … 121 121 void loadOverrides(); 122 122 void loadOverridesFor(const QString &strPoolExtraDataID); 123 void saveOverrides(); 124 void saveOverridesFor(const QString &strPoolExtraDataID); 123 125 124 126 /* Helper: Shortcut stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.