Changeset 56757 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 2, 2015 2:59:03 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101405
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r56736 r56757 103 103 #endif /* !Q_WS_MAC */ 104 104 105 void UIMenuBarEditorWidget::setRestrictionsOfMenuBar(UIExtraDataMetaDefs::MenuType restrictions) 106 { 107 /* Cache passed restrictions: */ 108 m_restrictionsOfMenuBar = restrictions; 109 /* Get static meta-object: */ 110 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 111 112 /* We have UIExtraDataMetaDefs::MenuType enum registered, so we can enumerate it: */ 113 const int iEnumIndex = smo.indexOfEnumerator("MenuType"); 114 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 115 /* Handle other enum-values: */ 116 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 117 { 118 /* Get iterated enum-value: */ 119 const UIExtraDataMetaDefs::MenuType enumValue = 120 static_cast<const UIExtraDataMetaDefs::MenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 121 /* Skip MenuType_Invalid & MenuType_All enum-value: */ 122 if (enumValue == UIExtraDataMetaDefs::MenuType_Invalid || 123 enumValue == UIExtraDataMetaDefs::MenuType_All) 124 continue; 125 /* Which key required action registered under? */ 126 const QString strKey = gpConverter->toInternalString(enumValue); 127 if (!m_actions.contains(strKey)) 128 continue; 129 /* Update action 'checked' state: */ 130 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuBar & enumValue)); 131 } 132 } 133 134 void UIMenuBarEditorWidget::setRestrictionsOfMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType restrictions) 135 { 136 /* Cache passed restrictions: */ 137 m_restrictionsOfMenuApplication = restrictions; 138 /* Get static meta-object: */ 139 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 140 141 /* We have UIExtraDataMetaDefs::MenuApplicationActionType enum registered, so we can enumerate it: */ 142 const int iEnumIndex = smo.indexOfEnumerator("MenuApplicationActionType"); 143 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 144 /* Handle other enum-values: */ 145 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 146 { 147 /* Get iterated enum-value: */ 148 const UIExtraDataMetaDefs::MenuApplicationActionType enumValue = 149 static_cast<const UIExtraDataMetaDefs::MenuApplicationActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 150 /* Skip MenuApplicationActionType_Invalid & MenuApplicationActionType_All enum-value: */ 151 if (enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_Invalid || 152 enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_All) 153 continue; 154 /* Which key required action registered under? */ 155 const QString strKey = gpConverter->toInternalString(enumValue); 156 if (!m_actions.contains(strKey)) 157 continue; 158 /* Update action 'checked' state: */ 159 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuApplication & enumValue)); 160 } 161 } 162 163 void UIMenuBarEditorWidget::setRestrictionsOfMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions) 164 { 165 /* Cache passed restrictions: */ 166 m_restrictionsOfMenuMachine = restrictions; 167 /* Get static meta-object: */ 168 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 169 170 /* We have UIExtraDataMetaDefs::RuntimeMenuMachineActionType enum registered, so we can enumerate it: */ 171 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuMachineActionType"); 172 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 173 /* Handle other enum-values: */ 174 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 175 { 176 /* Get iterated enum-value: */ 177 const UIExtraDataMetaDefs::RuntimeMenuMachineActionType enumValue = 178 static_cast<const UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 179 /* Skip RuntimeMenuMachineActionType_Invalid & RuntimeMenuMachineActionType_All enum-value: */ 180 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid || 181 enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All) 182 continue; 183 /* Which key required action registered under? */ 184 const QString strKey = gpConverter->toInternalString(enumValue); 185 if (!m_actions.contains(strKey)) 186 continue; 187 /* Update action 'checked' state: */ 188 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuMachine & enumValue)); 189 } 190 } 191 192 void UIMenuBarEditorWidget::setRestrictionsOfMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions) 193 { 194 /* Cache passed restrictions: */ 195 m_restrictionsOfMenuView = restrictions; 196 /* Get static meta-object: */ 197 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 198 199 /* We have UIExtraDataMetaDefs::RuntimeMenuViewActionType enum registered, so we can enumerate it: */ 200 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuViewActionType"); 201 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 202 /* Handle other enum-values: */ 203 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 204 { 205 /* Get iterated enum-value: */ 206 const UIExtraDataMetaDefs::RuntimeMenuViewActionType enumValue = 207 static_cast<const UIExtraDataMetaDefs::RuntimeMenuViewActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 208 /* Skip RuntimeMenuViewActionType_Invalid & RuntimeMenuViewActionType_All enum-value: */ 209 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid || 210 enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_All) 211 continue; 212 /* Which key required action registered under? */ 213 const QString strKey = gpConverter->toInternalString(enumValue); 214 if (!m_actions.contains(strKey)) 215 continue; 216 /* Update action 'checked' state: */ 217 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuView & enumValue)); 218 } 219 } 220 221 void UIMenuBarEditorWidget::setRestrictionsOfMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions) 222 { 223 /* Cache passed restrictions: */ 224 m_restrictionsOfMenuInput = restrictions; 225 /* Get static meta-object: */ 226 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 227 228 /* We have UIExtraDataMetaDefs::RuntimeMenuInputActionType enum registered, so we can enumerate it: */ 229 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuInputActionType"); 230 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 231 /* Handle other enum-values: */ 232 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 233 { 234 /* Get iterated enum-value: */ 235 const UIExtraDataMetaDefs::RuntimeMenuInputActionType enumValue = 236 static_cast<const UIExtraDataMetaDefs::RuntimeMenuInputActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 237 /* Skip RuntimeMenuInputActionType_Invalid & RuntimeMenuInputActionType_All enum-value: */ 238 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid || 239 enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_All) 240 continue; 241 /* Which key required action registered under? */ 242 const QString strKey = gpConverter->toInternalString(enumValue); 243 if (!m_actions.contains(strKey)) 244 continue; 245 /* Update action 'checked' state: */ 246 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuInput & enumValue)); 247 } 248 } 249 250 void UIMenuBarEditorWidget::setRestrictionsOfMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions) 251 { 252 /* Cache passed restrictions: */ 253 m_restrictionsOfMenuDevices = restrictions; 254 /* Get static meta-object: */ 255 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 256 257 /* We have UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enum registered, so we can enumerate it: */ 258 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDevicesActionType"); 259 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 260 /* Handle other enum-values: */ 261 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 262 { 263 /* Get iterated enum-value: */ 264 const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enumValue = 265 static_cast<const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 266 /* Skip RuntimeMenuDevicesActionType_Invalid & RuntimeMenuDevicesActionType_All enum-value: */ 267 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid || 268 enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All) 269 continue; 270 /* Which key required action registered under? */ 271 const QString strKey = gpConverter->toInternalString(enumValue); 272 if (!m_actions.contains(strKey)) 273 continue; 274 /* Update action 'checked' state: */ 275 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuDevices & enumValue)); 276 } 277 } 278 279 #ifdef VBOX_WITH_DEBUGGER_GUI 280 void UIMenuBarEditorWidget::setRestrictionsOfMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions) 281 { 282 /* Cache passed restrictions: */ 283 m_restrictionsOfMenuDebug = restrictions; 284 /* Get static meta-object: */ 285 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 286 287 /* We have UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enum registered, so we can enumerate it: */ 288 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDebuggerActionType"); 289 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 290 /* Handle other enum-values: */ 291 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 292 { 293 /* Get iterated enum-value: */ 294 const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enumValue = 295 static_cast<const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 296 /* Skip RuntimeMenuDebuggerActionType_Invalid & RuntimeMenuDebuggerActionType_All enum-value: */ 297 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid || 298 enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All) 299 continue; 300 /* Which key required action registered under? */ 301 const QString strKey = gpConverter->toInternalString(enumValue); 302 if (!m_actions.contains(strKey)) 303 continue; 304 /* Update action 'checked' state: */ 305 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuDebug & enumValue)); 306 } 307 } 308 #endif /* VBOX_WITH_DEBUGGER_GUI */ 309 310 #ifdef Q_WS_MAC 311 void UIMenuBarEditorWidget::setRestrictionsOfMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType restrictions) 312 { 313 /* Cache passed restrictions: */ 314 m_restrictionsOfMenuWindow = restrictions; 315 /* Get static meta-object: */ 316 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 317 318 /* We have UIExtraDataMetaDefs::MenuWindowActionType enum registered, so we can enumerate it: */ 319 const int iEnumIndex = smo.indexOfEnumerator("MenuWindowActionType"); 320 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 321 /* Handle other enum-values: */ 322 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 323 { 324 /* Get iterated enum-value: */ 325 const UIExtraDataMetaDefs::MenuWindowActionType enumValue = 326 static_cast<const UIExtraDataMetaDefs::MenuWindowActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 327 /* Skip MenuWindowActionType_Invalid & MenuWindowActionType_All enum-value: */ 328 if (enumValue == UIExtraDataMetaDefs::MenuWindowActionType_Invalid || 329 enumValue == UIExtraDataMetaDefs::MenuWindowActionType_All) 330 continue; 331 /* Which key required action registered under? */ 332 const QString strKey = gpConverter->toInternalString(enumValue); 333 if (!m_actions.contains(strKey)) 334 continue; 335 /* Update action 'checked' state: */ 336 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuWindow & enumValue)); 337 } 338 } 339 #endif /* Q_WS_MAC */ 340 341 void UIMenuBarEditorWidget::setRestrictionsOfMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType restrictions) 342 { 343 /* Cache passed restrictions: */ 344 m_restrictionsOfMenuHelp = restrictions; 345 /* Get static meta-object: */ 346 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 347 348 /* We have UIExtraDataMetaDefs::MenuHelpActionType enum registered, so we can enumerate it: */ 349 const int iEnumIndex = smo.indexOfEnumerator("MenuHelpActionType"); 350 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 351 /* Handle other enum-values: */ 352 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 353 { 354 /* Get iterated enum-value: */ 355 const UIExtraDataMetaDefs::MenuHelpActionType enumValue = 356 static_cast<const UIExtraDataMetaDefs::MenuHelpActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 357 /* Skip MenuHelpActionType_Invalid & MenuHelpActionType_All enum-value: */ 358 if (enumValue == UIExtraDataMetaDefs::MenuHelpActionType_Invalid || 359 enumValue == UIExtraDataMetaDefs::MenuHelpActionType_All) 360 continue; 361 /* Which key required action registered under? */ 362 const QString strKey = gpConverter->toInternalString(enumValue); 363 if (!m_actions.contains(strKey)) 364 continue; 365 /* Update action 'checked' state: */ 366 m_actions.value(strKey)->setChecked(!(m_restrictionsOfMenuHelp & enumValue)); 367 } 368 } 369 105 370 void UIMenuBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID) 106 371 { … … 109 374 return; 110 375 111 /* Update menus: */ 112 updateMenus(); 376 /* Recache menu-bar configuration: */ 377 setRestrictionsOfMenuBar(gEDataManager->restrictedRuntimeMenuTypes(machineID())); 378 setRestrictionsOfMenuApplication(gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID())); 379 setRestrictionsOfMenuMachine(gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID())); 380 setRestrictionsOfMenuView(gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID())); 381 setRestrictionsOfMenuInput(gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID())); 382 setRestrictionsOfMenuDevices(gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID())); 383 #ifdef VBOX_WITH_DEBUGGER_GUI 384 setRestrictionsOfMenuDebug(gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID())); 385 #endif /* VBOX_WITH_DEBUGGER_GUI */ 386 #ifdef Q_WS_MAC 387 setRestrictionsOfMenuWindow(gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID())); 388 #endif /* Q_WS_MAC */ 389 setRestrictionsOfMenuHelp(gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID())); 113 390 } 114 391 … … 127 404 const UIExtraDataMetaDefs::MenuType type = 128 405 static_cast<UIExtraDataMetaDefs::MenuType>(pAction->property("type").toInt()); 129 /* Load current menu-bar restrictions: */130 UIExtraDataMetaDefs::MenuType restrictions = gEDataManager->restrictedRuntimeMenuTypes(machineID());131 406 /* Invert restriction for sender type: */ 132 restrictions = (UIExtraDataMetaDefs::MenuType)(restrictions ^ type); 133 /* Save updated menu-bar restrictions: */ 134 gEDataManager->setRestrictedRuntimeMenuTypes(restrictions, machineID()); 407 m_restrictionsOfMenuBar = (UIExtraDataMetaDefs::MenuType)(m_restrictionsOfMenuBar ^ type); 408 if (m_fStartedFromVMSettings) 409 { 410 /* Reapply menu-bar restrictions from cache: */ 411 setRestrictionsOfMenuBar(m_restrictionsOfMenuBar); 412 } 413 else 414 { 415 /* Save updated menu-bar restrictions: */ 416 gEDataManager->setRestrictedRuntimeMenuTypes(m_restrictionsOfMenuBar, machineID()); 417 } 135 418 break; 136 419 } … … 140 423 const UIExtraDataMetaDefs::MenuApplicationActionType type = 141 424 static_cast<UIExtraDataMetaDefs::MenuApplicationActionType>(pAction->property("type").toInt()); 142 /* Load current menu-bar restrictions: */143 UIExtraDataMetaDefs::MenuApplicationActionType restrictions = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());144 425 /* Invert restriction for sender type: */ 145 restrictions = (UIExtraDataMetaDefs::MenuApplicationActionType)(restrictions ^ type); 146 /* Save updated menu-bar restrictions: */ 147 gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(restrictions, machineID()); 426 m_restrictionsOfMenuApplication = (UIExtraDataMetaDefs::MenuApplicationActionType)(m_restrictionsOfMenuApplication ^ type); 427 if (m_fStartedFromVMSettings) 428 { 429 /* Reapply menu-bar restrictions from cache: */ 430 setRestrictionsOfMenuApplication(m_restrictionsOfMenuApplication); 431 } 432 else 433 { 434 /* Save updated menu-bar restrictions: */ 435 gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(m_restrictionsOfMenuApplication, machineID()); 436 } 148 437 break; 149 438 } … … 153 442 const UIExtraDataMetaDefs::RuntimeMenuMachineActionType type = 154 443 static_cast<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(pAction->property("type").toInt()); 155 /* Load current menu-bar restrictions: */156 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());157 444 /* Invert restriction for sender type: */ 158 restrictions = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)(restrictions ^ type); 159 /* Save updated menu-bar restrictions: */ 160 gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(restrictions, machineID()); 445 m_restrictionsOfMenuMachine = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)(m_restrictionsOfMenuMachine ^ type); 446 if (m_fStartedFromVMSettings) 447 { 448 /* Reapply menu-bar restrictions from cache: */ 449 setRestrictionsOfMenuMachine(m_restrictionsOfMenuMachine); 450 } 451 else 452 { 453 /* Save updated menu-bar restrictions: */ 454 gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(m_restrictionsOfMenuMachine, machineID()); 455 } 161 456 break; 162 457 } … … 166 461 const UIExtraDataMetaDefs::RuntimeMenuViewActionType type = 167 462 static_cast<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(pAction->property("type").toInt()); 168 /* Load current menu-bar restrictions: */169 UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());170 463 /* Invert restriction for sender type: */ 171 restrictions = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)(restrictions ^ type); 172 /* Save updated menu-bar restrictions: */ 173 gEDataManager->setRestrictedRuntimeMenuViewActionTypes(restrictions, machineID()); 464 m_restrictionsOfMenuView = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)(m_restrictionsOfMenuView ^ type); 465 if (m_fStartedFromVMSettings) 466 { 467 /* Reapply menu-bar restrictions from cache: */ 468 setRestrictionsOfMenuView(m_restrictionsOfMenuView); 469 } 470 else 471 { 472 /* Save updated menu-bar restrictions: */ 473 gEDataManager->setRestrictedRuntimeMenuViewActionTypes(m_restrictionsOfMenuView, machineID()); 474 } 174 475 break; 175 476 } … … 179 480 const UIExtraDataMetaDefs::RuntimeMenuInputActionType type = 180 481 static_cast<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(pAction->property("type").toInt()); 181 /* Load current menu-bar restrictions: */182 UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());183 482 /* Invert restriction for sender type: */ 184 restrictions = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)(restrictions ^ type); 185 /* Save updated menu-bar restrictions: */ 186 gEDataManager->setRestrictedRuntimeMenuInputActionTypes(restrictions, machineID()); 483 m_restrictionsOfMenuInput = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)(m_restrictionsOfMenuInput ^ type); 484 if (m_fStartedFromVMSettings) 485 { 486 /* Reapply menu-bar restrictions from cache: */ 487 setRestrictionsOfMenuInput(m_restrictionsOfMenuInput); 488 } 489 else 490 { 491 /* Save updated menu-bar restrictions: */ 492 gEDataManager->setRestrictedRuntimeMenuInputActionTypes(m_restrictionsOfMenuInput, machineID()); 493 } 187 494 break; 188 495 } … … 192 499 const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType type = 193 500 static_cast<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(pAction->property("type").toInt()); 194 /* Load current menu-bar restrictions: */195 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());196 501 /* Invert restriction for sender type: */ 197 restrictions = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictions ^ type); 198 /* Save updated menu-bar restrictions: */ 199 gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(restrictions, machineID()); 502 m_restrictionsOfMenuDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(m_restrictionsOfMenuDevices ^ type); 503 if (m_fStartedFromVMSettings) 504 { 505 /* Reapply menu-bar restrictions from cache: */ 506 setRestrictionsOfMenuDevices(m_restrictionsOfMenuDevices); 507 } 508 else 509 { 510 /* Save updated menu-bar restrictions: */ 511 gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(m_restrictionsOfMenuDevices, machineID()); 512 } 200 513 break; 201 514 } … … 206 519 const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType type = 207 520 static_cast<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(pAction->property("type").toInt()); 208 /* Load current menu-bar restrictions: */209 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());210 521 /* Invert restriction for sender type: */ 211 restrictions = (UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType)(restrictions ^ type); 212 /* Save updated menu-bar restrictions: */ 213 gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(restrictions, machineID()); 522 m_restrictionsOfMenuDebug = (UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType)(m_restrictionsOfMenuDebug ^ type); 523 if (m_fStartedFromVMSettings) 524 { 525 /* Reapply menu-bar restrictions from cache: */ 526 setRestrictionsOfMenuDebug(m_restrictionsOfMenuDebug); 527 } 528 else 529 { 530 /* Save updated menu-bar restrictions: */ 531 gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(m_restrictionsOfMenuDebug, machineID()); 532 } 214 533 break; 215 534 } … … 221 540 const UIExtraDataMetaDefs::MenuWindowActionType type = 222 541 static_cast<UIExtraDataMetaDefs::MenuWindowActionType>(pAction->property("type").toInt()); 223 /* Load current menu-bar restrictions: */224 UIExtraDataMetaDefs::MenuWindowActionType restrictions = gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID());225 542 /* Invert restriction for sender type: */ 226 restrictions = (UIExtraDataMetaDefs::MenuWindowActionType)(restrictions ^ type); 227 /* Save updated menu-bar restrictions: */ 228 gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(restrictions, machineID()); 543 m_restrictionsOfMenuWindow = (UIExtraDataMetaDefs::MenuWindowActionType)(m_restrictionsOfMenuWindow ^ type); 544 if (m_fStartedFromVMSettings) 545 { 546 /* Reapply menu-bar restrictions from cache: */ 547 setRestrictionsOfMenuWindow(m_restrictionsOfMenuWindow); 548 } 549 else 550 { 551 /* Save updated menu-bar restrictions: */ 552 gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(m_restrictionsOfMenuWindow, machineID()); 553 } 229 554 break; 230 555 } … … 235 560 const UIExtraDataMetaDefs::MenuHelpActionType type = 236 561 static_cast<UIExtraDataMetaDefs::MenuHelpActionType>(pAction->property("type").toInt()); 237 /* Load current menu-bar restrictions: */238 UIExtraDataMetaDefs::MenuHelpActionType restrictions = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());239 562 /* Invert restriction for sender type: */ 240 restrictions = (UIExtraDataMetaDefs::MenuHelpActionType)(restrictions ^ type); 241 /* Save updated menu-bar restrictions: */ 242 gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(restrictions, machineID()); 243 break; 563 m_restrictionsOfMenuHelp = (UIExtraDataMetaDefs::MenuHelpActionType)(m_restrictionsOfMenuHelp ^ type); 564 if (m_fStartedFromVMSettings) 565 { 566 /* Reapply menu-bar restrictions from cache: */ 567 setRestrictionsOfMenuHelp(m_restrictionsOfMenuHelp); 568 } 569 else 570 { 571 /* Save updated menu-bar restrictions: */ 572 gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(m_restrictionsOfMenuHelp, machineID()); 573 } break; 244 574 } 245 575 default: break; … … 345 675 prepareMenuHelp(); 346 676 347 /* Listen for the menu-bar configuration changes if necessary: */348 677 if (!m_fStartedFromVMSettings) 349 678 { 679 /* Cache menu-bar configuration: */ 680 setRestrictionsOfMenuBar(gEDataManager->restrictedRuntimeMenuTypes(machineID())); 681 setRestrictionsOfMenuApplication(gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID())); 682 setRestrictionsOfMenuMachine(gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID())); 683 setRestrictionsOfMenuView(gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID())); 684 setRestrictionsOfMenuInput(gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID())); 685 setRestrictionsOfMenuDevices(gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID())); 686 #ifdef VBOX_WITH_DEBUGGER_GUI 687 setRestrictionsOfMenuDebug(gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID())); 688 #endif /* VBOX_WITH_DEBUGGER_GUI */ 689 #ifdef Q_WS_MAC 690 setRestrictionsOfMenuWindow(gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID())); 691 #endif /* Q_WS_MAC */ 692 setRestrictionsOfMenuHelp(gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID())); 693 /* And listen for the menu-bar configuration changes after that: */ 350 694 connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)), 351 695 this, SLOT(sltHandleConfigurationChange(const QString&))); 352 696 } 353 354 /* Update menus: */355 updateMenus();356 697 } 357 698 … … 656 997 } 657 998 658 void UIMenuBarEditorWidget::updateMenus()659 {660 /* Recache menu-bar configuration: */661 const UIExtraDataMetaDefs::MenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(machineID());662 /* Get static meta-object: */663 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;664 665 /* We have UIExtraDataMetaDefs::MenuType enum registered, so we can enumerate it: */666 const int iEnumIndex = smo.indexOfEnumerator("MenuType");667 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);668 /* Handle other enum-values: */669 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)670 {671 /* Get iterated enum-value: */672 const UIExtraDataMetaDefs::MenuType enumValue =673 static_cast<const UIExtraDataMetaDefs::MenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));674 /* Skip MenuType_Invalid & MenuType_All enum-value: */675 if (enumValue == UIExtraDataMetaDefs::MenuType_Invalid ||676 enumValue == UIExtraDataMetaDefs::MenuType_All)677 continue;678 /* Which key required action registered under? */679 const QString strKey = gpConverter->toInternalString(enumValue);680 if (!m_actions.contains(strKey))681 continue;682 /* Update action 'checked' state: */683 m_actions.value(strKey)->setChecked(!(restrictionsMenuBar & enumValue));684 }685 686 /* Update known menu-bar menus: */687 updateMenuApplication();688 updateMenuMachine();689 updateMenuView();690 updateMenuInput();691 updateMenuDevices();692 #ifdef VBOX_WITH_DEBUGGER_GUI693 updateMenuDebug();694 #endif /* VBOX_WITH_DEBUGGER_GUI */695 #ifdef Q_WS_MAC696 updateMenuWindow();697 #endif /* Q_WS_MAC */698 updateMenuHelp();699 }700 701 void UIMenuBarEditorWidget::updateMenuApplication()702 {703 /* Recache menu-bar configuration: */704 const UIExtraDataMetaDefs::MenuApplicationActionType restrictionsMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());705 /* Get static meta-object: */706 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;707 708 /* We have UIExtraDataMetaDefs::MenuApplicationActionType enum registered, so we can enumerate it: */709 const int iEnumIndex = smo.indexOfEnumerator("MenuApplicationActionType");710 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);711 /* Handle other enum-values: */712 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)713 {714 /* Get iterated enum-value: */715 const UIExtraDataMetaDefs::MenuApplicationActionType enumValue =716 static_cast<const UIExtraDataMetaDefs::MenuApplicationActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));717 /* Skip MenuApplicationActionType_Invalid & MenuApplicationActionType_All enum-value: */718 if (enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_Invalid ||719 enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_All)720 continue;721 /* Which key required action registered under? */722 const QString strKey = gpConverter->toInternalString(enumValue);723 if (!m_actions.contains(strKey))724 continue;725 /* Update action 'checked' state: */726 m_actions.value(strKey)->setChecked(!(restrictionsMenuApplication & enumValue));727 }728 }729 730 void UIMenuBarEditorWidget::updateMenuMachine()731 {732 /* Recache menu-bar configuration: */733 const UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionsMenuMachine = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());734 /* Get static meta-object: */735 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;736 737 /* We have UIExtraDataMetaDefs::RuntimeMenuMachineActionType enum registered, so we can enumerate it: */738 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuMachineActionType");739 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);740 /* Handle other enum-values: */741 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)742 {743 /* Get iterated enum-value: */744 const UIExtraDataMetaDefs::RuntimeMenuMachineActionType enumValue =745 static_cast<const UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));746 /* Skip RuntimeMenuMachineActionType_Invalid & RuntimeMenuMachineActionType_All enum-value: */747 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid ||748 enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All)749 continue;750 /* Which key required action registered under? */751 const QString strKey = gpConverter->toInternalString(enumValue);752 if (!m_actions.contains(strKey))753 continue;754 /* Update action 'checked' state: */755 m_actions.value(strKey)->setChecked(!(restrictionsMenuMachine & enumValue));756 }757 }758 759 void UIMenuBarEditorWidget::updateMenuView()760 {761 /* Recache menu-bar configuration: */762 const UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionsMenuView = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());763 /* Get static meta-object: */764 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;765 766 /* We have UIExtraDataMetaDefs::RuntimeMenuViewActionType enum registered, so we can enumerate it: */767 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuViewActionType");768 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);769 /* Handle other enum-values: */770 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)771 {772 /* Get iterated enum-value: */773 const UIExtraDataMetaDefs::RuntimeMenuViewActionType enumValue =774 static_cast<const UIExtraDataMetaDefs::RuntimeMenuViewActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));775 /* Skip RuntimeMenuViewActionType_Invalid & RuntimeMenuViewActionType_All enum-value: */776 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid ||777 enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_All)778 continue;779 /* Which key required action registered under? */780 const QString strKey = gpConverter->toInternalString(enumValue);781 if (!m_actions.contains(strKey))782 continue;783 /* Update action 'checked' state: */784 m_actions.value(strKey)->setChecked(!(restrictionsMenuView & enumValue));785 }786 }787 788 void UIMenuBarEditorWidget::updateMenuInput()789 {790 /* Recache menu-bar configuration: */791 const UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictionsMenuInput = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());792 /* Get static meta-object: */793 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;794 795 /* We have UIExtraDataMetaDefs::RuntimeMenuInputActionType enum registered, so we can enumerate it: */796 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuInputActionType");797 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);798 /* Handle other enum-values: */799 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)800 {801 /* Get iterated enum-value: */802 const UIExtraDataMetaDefs::RuntimeMenuInputActionType enumValue =803 static_cast<const UIExtraDataMetaDefs::RuntimeMenuInputActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));804 /* Skip RuntimeMenuInputActionType_Invalid & RuntimeMenuInputActionType_All enum-value: */805 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid ||806 enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_All)807 continue;808 /* Which key required action registered under? */809 const QString strKey = gpConverter->toInternalString(enumValue);810 if (!m_actions.contains(strKey))811 continue;812 /* Update action 'checked' state: */813 m_actions.value(strKey)->setChecked(!(restrictionsMenuInput & enumValue));814 }815 }816 817 void UIMenuBarEditorWidget::updateMenuDevices()818 {819 /* Recache menu-bar configuration: */820 const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionsMenuDevices = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());821 /* Get static meta-object: */822 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;823 824 /* We have UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enum registered, so we can enumerate it: */825 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDevicesActionType");826 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);827 /* Handle other enum-values: */828 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)829 {830 /* Get iterated enum-value: */831 const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enumValue =832 static_cast<const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));833 /* Skip RuntimeMenuDevicesActionType_Invalid & RuntimeMenuDevicesActionType_All enum-value: */834 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid ||835 enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All)836 continue;837 /* Which key required action registered under? */838 const QString strKey = gpConverter->toInternalString(enumValue);839 if (!m_actions.contains(strKey))840 continue;841 /* Update action 'checked' state: */842 m_actions.value(strKey)->setChecked(!(restrictionsMenuDevices & enumValue));843 }844 }845 846 #ifdef VBOX_WITH_DEBUGGER_GUI847 void UIMenuBarEditorWidget::updateMenuDebug()848 {849 /* Recache menu-bar configuration: */850 const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictionsMenuDebug = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());851 /* Get static meta-object: */852 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;853 854 /* We have UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enum registered, so we can enumerate it: */855 const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDebuggerActionType");856 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);857 /* Handle other enum-values: */858 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)859 {860 /* Get iterated enum-value: */861 const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enumValue =862 static_cast<const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));863 /* Skip RuntimeMenuDebuggerActionType_Invalid & RuntimeMenuDebuggerActionType_All enum-value: */864 if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid ||865 enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All)866 continue;867 /* Which key required action registered under? */868 const QString strKey = gpConverter->toInternalString(enumValue);869 if (!m_actions.contains(strKey))870 continue;871 /* Update action 'checked' state: */872 m_actions.value(strKey)->setChecked(!(restrictionsMenuDebug & enumValue));873 }874 }875 #endif /* VBOX_WITH_DEBUGGER_GUI */876 877 #ifdef Q_WS_MAC878 void UIMenuBarEditorWidget::updateMenuWindow()879 {880 /* Recache menu-bar configuration: */881 const UIExtraDataMetaDefs::MenuWindowActionType restrictionsMenuWindow = gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID());882 /* Get static meta-object: */883 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;884 885 /* We have UIExtraDataMetaDefs::MenuWindowActionType enum registered, so we can enumerate it: */886 const int iEnumIndex = smo.indexOfEnumerator("MenuWindowActionType");887 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);888 /* Handle other enum-values: */889 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)890 {891 /* Get iterated enum-value: */892 const UIExtraDataMetaDefs::MenuWindowActionType enumValue =893 static_cast<const UIExtraDataMetaDefs::MenuWindowActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));894 /* Skip MenuWindowActionType_Invalid & MenuWindowActionType_All enum-value: */895 if (enumValue == UIExtraDataMetaDefs::MenuWindowActionType_Invalid ||896 enumValue == UIExtraDataMetaDefs::MenuWindowActionType_All)897 continue;898 /* Which key required action registered under? */899 const QString strKey = gpConverter->toInternalString(enumValue);900 if (!m_actions.contains(strKey))901 continue;902 /* Update action 'checked' state: */903 m_actions.value(strKey)->setChecked(!(restrictionsMenuWindow & enumValue));904 }905 }906 #endif /* Q_WS_MAC */907 908 void UIMenuBarEditorWidget::updateMenuHelp()909 {910 /* Recache menu-bar configuration: */911 const UIExtraDataMetaDefs::MenuHelpActionType restrictionsMenuHelp = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());912 /* Get static meta-object: */913 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;914 915 /* We have UIExtraDataMetaDefs::MenuHelpActionType enum registered, so we can enumerate it: */916 const int iEnumIndex = smo.indexOfEnumerator("MenuHelpActionType");917 QMetaEnum metaEnum = smo.enumerator(iEnumIndex);918 /* Handle other enum-values: */919 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)920 {921 /* Get iterated enum-value: */922 const UIExtraDataMetaDefs::MenuHelpActionType enumValue =923 static_cast<const UIExtraDataMetaDefs::MenuHelpActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));924 /* Skip MenuHelpActionType_Invalid & MenuHelpActionType_All enum-value: */925 if (enumValue == UIExtraDataMetaDefs::MenuHelpActionType_Invalid ||926 enumValue == UIExtraDataMetaDefs::MenuHelpActionType_All)927 continue;928 /* Which key required action registered under? */929 const QString strKey = gpConverter->toInternalString(enumValue);930 if (!m_actions.contains(strKey))931 continue;932 /* Update action 'checked' state: */933 m_actions.value(strKey)->setChecked(!(restrictionsMenuHelp & enumValue));934 }935 }936 937 999 void UIMenuBarEditorWidget::retranslateUi() 938 1000 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.h
r56736 r56757 23 23 24 24 /* GUI includes: */ 25 #include "UIExtraDataDefs.h" 25 26 #include "UISlidingToolBar.h" 26 27 #include "QIWithRetranslateUI.h" … … 92 93 #endif /* !Q_WS_MAC */ 93 94 95 /** Returns the cached restrictions of menu-bar. */ 96 UIExtraDataMetaDefs::MenuType restrictionsOfMenuBar() const { return m_restrictionsOfMenuBar; } 97 /** Returns the cached restrictions of menu 'Application'. */ 98 UIExtraDataMetaDefs::MenuApplicationActionType restrictionsOfMenuApplication() const { return m_restrictionsOfMenuApplication; } 99 /** Returns the cached restrictions of menu 'Machine'. */ 100 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionsOfMenuMachine() const { return m_restrictionsOfMenuMachine; } 101 /** Returns the cached restrictions of menu 'View'. */ 102 UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionsOfMenuView() const { return m_restrictionsOfMenuView; } 103 /** Returns the cached restrictions of menu 'Input'. */ 104 UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictionsOfMenuInput() const { return m_restrictionsOfMenuInput; } 105 /** Returns the cached restrictions of menu 'Devices'. */ 106 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionsOfMenuDevices() const { return m_restrictionsOfMenuDevices; } 107 #ifdef VBOX_WITH_DEBUGGER_GUI 108 /** Returns the cached restrictions of menu 'Debug'. */ 109 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictionsOfMenuDebug() const { return m_restrictionsOfMenuDebug; } 110 #endif /* VBOX_WITH_DEBUGGER_GUI */ 111 #ifdef Q_WS_MAC 112 /** Mac OS X: Returns the cached restrictions of menu 'Window'. */ 113 UIExtraDataMetaDefs::MenuWindowActionType restrictionsOfMenuWindow() const { return m_restrictionsOfMenuWindow; } 114 #endif /* Q_WS_MAC */ 115 /** Returns the cached restrictions of menu 'Help'. */ 116 UIExtraDataMetaDefs::MenuHelpActionType restrictionsOfMenuHelp() const { return m_restrictionsOfMenuHelp; } 117 118 /** Defines the cached @a restrictions of menu-bar. */ 119 void setRestrictionsOfMenuBar(UIExtraDataMetaDefs::MenuType restrictions); 120 /** Defines the cached @a restrictions of menu 'Application'. */ 121 void setRestrictionsOfMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType restrictions); 122 /** Defines the cached @a restrictions of menu 'Machine'. */ 123 void setRestrictionsOfMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions); 124 /** Defines the cached @a restrictions of menu 'View'. */ 125 void setRestrictionsOfMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions); 126 /** Defines the cached @a restrictions of menu 'Input'. */ 127 void setRestrictionsOfMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions); 128 /** Defines the cached @a restrictions of menu 'Devices'. */ 129 void setRestrictionsOfMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions); 130 #ifdef VBOX_WITH_DEBUGGER_GUI 131 /** Defines the cached @a restrictions of menu 'Debug'. */ 132 void setRestrictionsOfMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions); 133 #endif /* VBOX_WITH_DEBUGGER_GUI */ 134 #ifdef Q_WS_MAC 135 /** Mac OS X: Defines the cached @a restrictions of menu 'Window'. */ 136 void setRestrictionsOfMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType restrictions); 137 #endif /* Q_WS_MAC */ 138 /** Defines the cached @a restrictions of menu 'Help'. */ 139 void setRestrictionsOfMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType restrictions); 140 94 141 private slots: 95 142 … … 143 190 /** Prepare 'Help' menu routine. */ 144 191 void prepareMenuHelp(); 145 146 /** Update menus routine. */147 void updateMenus();148 /** Update 'Application' menu routine. */149 void updateMenuApplication();150 /** Update 'Machine' menu routine. */151 void updateMenuMachine();152 /** Update 'View' menu routine. */153 void updateMenuView();154 /** Update 'Input' menu routine. */155 void updateMenuInput();156 /** Update 'Devices' menu routine. */157 void updateMenuDevices();158 #ifdef VBOX_WITH_DEBUGGER_GUI159 /** Update 'Debug' menu routine. */160 void updateMenuDebug();161 #endif /* VBOX_WITH_DEBUGGER_GUI */162 #ifdef Q_WS_MAC163 /** Mac OS X: Update 'Window' menu routine. */164 void updateMenuWindow();165 #endif /* Q_WS_MAC */166 /** Update 'Help' menu routine. */167 void updateMenuHelp();168 192 169 193 /** Retranslation routine. */ … … 200 224 QMap<QString, QAction*> m_actions; 201 225 /** @} */ 226 227 /** @name Contents: Restrictions 228 * @{ */ 229 /** Holds the cached restrictions of menu-bar. */ 230 UIExtraDataMetaDefs::MenuType m_restrictionsOfMenuBar; 231 /** Holds the cached restrictions of menu 'Application'. */ 232 UIExtraDataMetaDefs::MenuApplicationActionType m_restrictionsOfMenuApplication; 233 /** Holds the cached restrictions of menu 'Machine'. */ 234 UIExtraDataMetaDefs::RuntimeMenuMachineActionType m_restrictionsOfMenuMachine; 235 /** Holds the cached restrictions of menu 'View'. */ 236 UIExtraDataMetaDefs::RuntimeMenuViewActionType m_restrictionsOfMenuView; 237 /** Holds the cached restrictions of menu 'Input'. */ 238 UIExtraDataMetaDefs::RuntimeMenuInputActionType m_restrictionsOfMenuInput; 239 /** Holds the cached restrictions of menu 'Devices'. */ 240 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType m_restrictionsOfMenuDevices; 241 #ifdef VBOX_WITH_DEBUGGER_GUI 242 /** Holds the cached restrictions of menu 'Debug'. */ 243 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType m_restrictionsOfMenuDebug; 244 #endif /* VBOX_WITH_DEBUGGER_GUI */ 245 #ifdef Q_WS_MAC 246 /** Mac OS X: Holds the cached restrictions of menu 'Window'. */ 247 UIExtraDataMetaDefs::MenuWindowActionType m_restrictionsOfMenuWindow; 248 #endif /* Q_WS_MAC */ 249 /** Holds the cached restrictions of menu 'Help'. */ 250 UIExtraDataMetaDefs::MenuHelpActionType m_restrictionsOfMenuHelp; 251 /** @} */ 202 252 }; 203 253 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r56751 r56757 60 60 #ifndef Q_WS_MAC 61 61 interfaceData.m_fMenuBarEnabled = gEDataManager->menuBarEnabled(m_machine.GetId()); 62 #endif /* !Q_WS_MAC */ 63 interfaceData.m_restrictionsOfMenuBar = gEDataManager->restrictedRuntimeMenuTypes(m_machine.GetId()); 64 interfaceData.m_restrictionsOfMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(m_machine.GetId()); 65 interfaceData.m_restrictionsOfMenuMachine = gEDataManager->restrictedRuntimeMenuMachineActionTypes(m_machine.GetId()); 66 interfaceData.m_restrictionsOfMenuView = gEDataManager->restrictedRuntimeMenuViewActionTypes(m_machine.GetId()); 67 interfaceData.m_restrictionsOfMenuInput = gEDataManager->restrictedRuntimeMenuInputActionTypes(m_machine.GetId()); 68 interfaceData.m_restrictionsOfMenuDevices = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(m_machine.GetId()); 69 #ifdef VBOX_WITH_DEBUGGER_GUI 70 interfaceData.m_restrictionsOfMenuDebug = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(m_machine.GetId()); 71 #endif /* VBOX_WITH_DEBUGGER_GUI */ 72 #ifdef Q_WS_MAC 73 interfaceData.m_restrictionsOfMenuWindow = gEDataManager->restrictedRuntimeMenuWindowActionTypes(m_machine.GetId()); 74 #endif /* Q_WS_MAC */ 75 interfaceData.m_restrictionsOfMenuHelp = gEDataManager->restrictedRuntimeMenuHelpActionTypes(m_machine.GetId()); 76 #ifndef Q_WS_MAC 62 77 interfaceData.m_fShowMiniToolBar = gEDataManager->miniToolbarEnabled(m_machine.GetId()); 63 78 interfaceData.m_fMiniToolBarAtTop = gEDataManager->miniToolbarAlignment(m_machine.GetId()) == Qt::AlignTop; … … 84 99 #ifndef Q_WS_MAC 85 100 m_pMenuBarEditor->setMenuBarEnabled(interfaceData.m_fMenuBarEnabled); 101 #endif /* !Q_WS_MAC */ 102 m_pMenuBarEditor->setRestrictionsOfMenuBar(interfaceData.m_restrictionsOfMenuBar); 103 m_pMenuBarEditor->setRestrictionsOfMenuApplication(interfaceData.m_restrictionsOfMenuApplication); 104 m_pMenuBarEditor->setRestrictionsOfMenuMachine(interfaceData.m_restrictionsOfMenuMachine); 105 m_pMenuBarEditor->setRestrictionsOfMenuView(interfaceData.m_restrictionsOfMenuView); 106 m_pMenuBarEditor->setRestrictionsOfMenuInput(interfaceData.m_restrictionsOfMenuInput); 107 m_pMenuBarEditor->setRestrictionsOfMenuDevices(interfaceData.m_restrictionsOfMenuDevices); 108 #ifdef VBOX_WITH_DEBUGGER_GUI 109 m_pMenuBarEditor->setRestrictionsOfMenuDebug(interfaceData.m_restrictionsOfMenuDebug); 110 #endif /* VBOX_WITH_DEBUGGER_GUI */ 111 #ifdef Q_WS_MAC 112 m_pMenuBarEditor->setRestrictionsOfMenuWindow(interfaceData.m_restrictionsOfMenuWindow); 113 #endif /* Q_WS_MAC */ 114 m_pMenuBarEditor->setRestrictionsOfMenuHelp(interfaceData.m_restrictionsOfMenuHelp); 115 #ifndef Q_WS_MAC 86 116 m_pCheckBoxShowMiniToolBar->setChecked(interfaceData.m_fShowMiniToolBar); 87 117 m_pComboToolBarAlignment->setChecked(interfaceData.m_fMiniToolBarAtTop); … … 108 138 #ifndef Q_WS_MAC 109 139 interfaceData.m_fMenuBarEnabled = m_pMenuBarEditor->isMenuBarEnabled(); 140 #endif /* !Q_WS_MAC */ 141 interfaceData.m_restrictionsOfMenuBar = m_pMenuBarEditor->restrictionsOfMenuBar(); 142 interfaceData.m_restrictionsOfMenuApplication = m_pMenuBarEditor->restrictionsOfMenuApplication(); 143 interfaceData.m_restrictionsOfMenuMachine = m_pMenuBarEditor->restrictionsOfMenuMachine(); 144 interfaceData.m_restrictionsOfMenuView = m_pMenuBarEditor->restrictionsOfMenuView(); 145 interfaceData.m_restrictionsOfMenuInput = m_pMenuBarEditor->restrictionsOfMenuInput(); 146 interfaceData.m_restrictionsOfMenuDevices = m_pMenuBarEditor->restrictionsOfMenuDevices(); 147 #ifdef VBOX_WITH_DEBUGGER_GUI 148 interfaceData.m_restrictionsOfMenuDebug = m_pMenuBarEditor->restrictionsOfMenuDebug(); 149 #endif /* VBOX_WITH_DEBUGGER_GUI */ 150 #ifdef Q_WS_MAC 151 interfaceData.m_restrictionsOfMenuWindow = m_pMenuBarEditor->restrictionsOfMenuWindow(); 152 #endif /* Q_WS_MAC */ 153 interfaceData.m_restrictionsOfMenuHelp = m_pMenuBarEditor->restrictionsOfMenuHelp(); 154 #ifndef Q_WS_MAC 110 155 interfaceData.m_fShowMiniToolBar = m_pCheckBoxShowMiniToolBar->isChecked(); 111 156 interfaceData.m_fMiniToolBarAtTop = m_pComboToolBarAlignment->isChecked(); … … 137 182 #ifndef Q_WS_MAC 138 183 gEDataManager->setMenuBarEnabled(interfaceData.m_fMenuBarEnabled, m_machine.GetId()); 184 #endif /* !Q_WS_MAC */ 185 gEDataManager->setRestrictedRuntimeMenuTypes(interfaceData.m_restrictionsOfMenuBar, m_machine.GetId()); 186 gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(interfaceData.m_restrictionsOfMenuApplication, m_machine.GetId()); 187 gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(interfaceData.m_restrictionsOfMenuMachine, m_machine.GetId()); 188 gEDataManager->setRestrictedRuntimeMenuViewActionTypes(interfaceData.m_restrictionsOfMenuView, m_machine.GetId()); 189 gEDataManager->setRestrictedRuntimeMenuInputActionTypes(interfaceData.m_restrictionsOfMenuInput, m_machine.GetId()); 190 gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(interfaceData.m_restrictionsOfMenuDevices, m_machine.GetId()); 191 #ifdef VBOX_WITH_DEBUGGER_GUI 192 gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(interfaceData.m_restrictionsOfMenuDebug, m_machine.GetId()); 193 #endif /* VBOX_WITH_DEBUGGER_GUI */ 194 #ifdef Q_WS_MAC 195 gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(interfaceData.m_restrictionsOfMenuWindow, m_machine.GetId()); 196 #endif /* Q_WS_MAC */ 197 gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(interfaceData.m_restrictionsOfMenuHelp, m_machine.GetId()); 198 #ifndef Q_WS_MAC 139 199 gEDataManager->setMiniToolbarEnabled(interfaceData.m_fShowMiniToolBar, m_machine.GetId()); 140 200 gEDataManager->setMiniToolbarAlignment(interfaceData.m_fMiniToolBarAtTop ? Qt::AlignTop : Qt::AlignBottom, m_machine.GetId()); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
r56751 r56757 34 34 #ifndef Q_WS_MAC 35 35 , m_fMenuBarEnabled(false) 36 #endif /* !Q_WS_MAC */ 37 , m_restrictionsOfMenuBar(UIExtraDataMetaDefs::MenuType_Invalid) 38 , m_restrictionsOfMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Invalid) 39 , m_restrictionsOfMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid) 40 , m_restrictionsOfMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid) 41 , m_restrictionsOfMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid) 42 , m_restrictionsOfMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid) 43 #ifdef VBOX_WITH_DEBUGGER_GUI 44 , m_restrictionsOfMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid) 45 #endif /* VBOX_WITH_DEBUGGER_GUI */ 46 #ifdef Q_WS_MAC 47 , m_restrictionsOfMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType_Invalid) 48 #endif /* Q_WS_MAC */ 49 , m_restrictionsOfMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Invalid) 50 #ifndef Q_WS_MAC 36 51 , m_fShowMiniToolBar(false) 37 52 , m_fMiniToolBarAtTop(false) … … 47 62 #ifndef Q_WS_MAC 48 63 && (m_fMenuBarEnabled == other.m_fMenuBarEnabled) 64 #endif /* !Q_WS_MAC */ 65 && (m_restrictionsOfMenuBar == other.m_restrictionsOfMenuBar) 66 && (m_restrictionsOfMenuApplication == other.m_restrictionsOfMenuApplication) 67 && (m_restrictionsOfMenuMachine == other.m_restrictionsOfMenuMachine) 68 && (m_restrictionsOfMenuView == other.m_restrictionsOfMenuView) 69 && (m_restrictionsOfMenuInput == other.m_restrictionsOfMenuInput) 70 && (m_restrictionsOfMenuDevices == other.m_restrictionsOfMenuDevices) 71 #ifdef VBOX_WITH_DEBUGGER_GUI 72 && (m_restrictionsOfMenuDebug == other.m_restrictionsOfMenuDebug) 73 #endif /* VBOX_WITH_DEBUGGER_GUI */ 74 #ifdef Q_WS_MAC 75 && (m_restrictionsOfMenuWindow == other.m_restrictionsOfMenuWindow) 76 #endif /* Q_WS_MAC */ 77 && (m_restrictionsOfMenuHelp == other.m_restrictionsOfMenuHelp) 78 #ifndef Q_WS_MAC 49 79 && (m_fShowMiniToolBar == other.m_fShowMiniToolBar) 50 80 && (m_fMiniToolBarAtTop == other.m_fMiniToolBarAtTop) … … 63 93 #ifndef Q_WS_MAC 64 94 bool m_fMenuBarEnabled; 95 #endif /* !Q_WS_MAC */ 96 UIExtraDataMetaDefs::MenuType m_restrictionsOfMenuBar; 97 UIExtraDataMetaDefs::MenuApplicationActionType m_restrictionsOfMenuApplication; 98 UIExtraDataMetaDefs::RuntimeMenuMachineActionType m_restrictionsOfMenuMachine; 99 UIExtraDataMetaDefs::RuntimeMenuViewActionType m_restrictionsOfMenuView; 100 UIExtraDataMetaDefs::RuntimeMenuInputActionType m_restrictionsOfMenuInput; 101 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType m_restrictionsOfMenuDevices; 102 #ifdef VBOX_WITH_DEBUGGER_GUI 103 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType m_restrictionsOfMenuDebug; 104 #endif /* VBOX_WITH_DEBUGGER_GUI */ 105 #ifdef Q_WS_MAC 106 UIExtraDataMetaDefs::MenuWindowActionType m_restrictionsOfMenuWindow; 107 #endif /* Q_WS_MAC */ 108 UIExtraDataMetaDefs::MenuHelpActionType m_restrictionsOfMenuHelp; 109 #ifndef Q_WS_MAC 65 110 bool m_fShowMiniToolBar; 66 111 bool m_fMiniToolBarAtTop;
Note:
See TracChangeset
for help on using the changeset viewer.