Changeset 46686 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 19, 2013 5:58:20 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86582
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
r46647 r46686 65 65 const char* UIDefs::GUI_PassCAD = "GUI/PassCAD"; 66 66 const char* UIDefs::GUI_DefaultCloseAction = "GUI/DefaultCloseAction"; 67 const char* UIDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators"; 67 68 68 69 /* Mini tool-bar definitions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r46682 r46686 137 137 extern const char* GUI_PassCAD; 138 138 extern const char* GUI_DefaultCloseAction; 139 extern const char* GUI_RestrictedStatusBarIndicators; 139 140 140 141 /* Mini tool-bar declarations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r46502 r46686 3721 3721 /* 'true' if guest-screen auto-mounting approved by the extra-data: */ 3722 3722 return isApprovedByExtraData(machine, GUI_AutomountGuestScreens); 3723 } 3724 3725 /* static */ 3726 bool VBoxGlobal::isItemRestrictedByExtraData(CMachine &machine, 3727 const QString &strExtraDataKey, 3728 const QString &strItemName) 3729 { 3730 /* Load corresponding extra-data value: */ 3731 QString strExtraDataValue(machine.GetExtraData(strExtraDataKey)); 3732 3733 /* 'false' if value was not set: */ 3734 if (strExtraDataValue.isEmpty()) 3735 return false; 3736 3737 /* Check if value represented as *string-list* contains passed *string-item*: */ 3738 return strExtraDataValue.split(",").contains(strItemName, Qt::CaseInsensitive); 3739 } 3740 3741 /* static */ 3742 bool VBoxGlobal::shouldWeShowStatusBarIndicator(CMachine &machine, const QString &strStatusBarIndicatorName) 3743 { 3744 /* Check if list of restricted status-bar indicators contains passed status-bar indicator-name: */ 3745 return !isItemRestrictedByExtraData(machine, GUI_RestrictedStatusBarIndicators, strStatusBarIndicatorName); 3723 3746 } 3724 3747 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r46433 r46686 383 383 bool fIncludingMachineGeneralCheck = false); 384 384 static bool shouldWeAutoMountGuestScreens(CMachine &machine, bool fIncludingSanityCheck = true); 385 386 static bool isItemRestrictedByExtraData(CMachine &machine, const QString &strExtraDataKey, const QString &strItemName); 387 static bool shouldWeShowStatusBarIndicator(CMachine &machine, const QString &strStatusBarIndicatorName); 385 388 386 389 #ifdef RT_OS_LINUX -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r46682 r46686 757 757 void UIIndicatorsPool::prepare() 758 758 { 759 /* Access machine: */ 760 CMachine machine = m_session.GetMachine(); 761 759 762 /* Populate indicator-pool: */ 760 763 for (int iIndex = 0; iIndex < IndicatorType_Max; ++iIndex) 761 764 { 765 /* Make sure indicator presence is permitted: */ 766 IndicatorType index = static_cast<IndicatorType>(iIndex); 767 QString strIndicatorExtraDataName = gpConverter->toInternalString(static_cast<IndicatorType>(index)); 768 if (!vboxGlobal().shouldWeShowStatusBarIndicator(machine, strIndicatorExtraDataName)) 769 continue; 770 762 771 /* Prepare indicator: */ 763 IndicatorType index = static_cast<IndicatorType>(iIndex);764 772 switch (index) 765 773 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r46682 r46686 51 51 : UIMachineWindow(pMachineLogic, uScreenId) 52 52 , m_pIndicatorsPool(new UIIndicatorsPool(pMachineLogic->uisession()->session(), this)) 53 , m_pNameHostkey(0) 53 54 , m_pIdleTimer(0) 54 55 { … … 115 116 { 116 117 /* Update indicators: */ 117 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_HardDisks), KDeviceType_HardDisk); 118 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_OpticalDisks), KDeviceType_DVD); 119 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_FloppyDisks), KDeviceType_Floppy); 120 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_USB), KDeviceType_USB); 121 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_Network), KDeviceType_Network); 122 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_SharedFolders), KDeviceType_SharedFolder); 118 if (indicatorsPool()->indicator(IndicatorType_HardDisks)) 119 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_HardDisks), KDeviceType_HardDisk); 120 if (indicatorsPool()->indicator(IndicatorType_OpticalDisks)) 121 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_OpticalDisks), KDeviceType_DVD); 122 if (indicatorsPool()->indicator(IndicatorType_FloppyDisks)) 123 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_FloppyDisks), KDeviceType_Floppy); 124 if (indicatorsPool()->indicator(IndicatorType_USB)) 125 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_USB), KDeviceType_USB); 126 if (indicatorsPool()->indicator(IndicatorType_Network)) 127 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_Network), KDeviceType_Network); 128 if (indicatorsPool()->indicator(IndicatorType_SharedFolders)) 129 updateIndicatorState(indicatorsPool()->indicator(IndicatorType_SharedFolders), KDeviceType_SharedFolder); 123 130 } 124 131 … … 172 179 { 173 180 /* Update host-combination status-bar label: */ 174 m_pNameHostkey->setText(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo())); 181 if (m_pNameHostkey) 182 m_pNameHostkey->setText(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo())); 175 183 } 176 184 … … 231 239 VBoxGlobal::setLayoutMargin(pIndicatorBoxHLayout, 0); 232 240 pIndicatorBoxHLayout->setSpacing(5); 241 bool fAtLeastOneAddedToLeftSection = false; 233 242 234 243 /* Hard Disks: */ 235 pIndicatorBoxHLayout->addWidget(indicatorsPool()->indicator(IndicatorType_HardDisks)); 244 if (QIStateIndicator *pLedHardDisks = indicatorsPool()->indicator(IndicatorType_HardDisks)) 245 { 246 pIndicatorBoxHLayout->addWidget(pLedHardDisks); 247 fAtLeastOneAddedToLeftSection = true; 248 } 236 249 237 250 /* Optical Disks: */ 238 QIStateIndicator *pLedOpticalDisks = indicatorsPool()->indicator(IndicatorType_OpticalDisks); 239 pIndicatorBoxHLayout->addWidget(pLedOpticalDisks); 240 connect(pLedOpticalDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 241 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 251 if (QIStateIndicator *pLedOpticalDisks = indicatorsPool()->indicator(IndicatorType_OpticalDisks)) 252 { 253 pIndicatorBoxHLayout->addWidget(pLedOpticalDisks); 254 connect(pLedOpticalDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 255 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 256 fAtLeastOneAddedToLeftSection = true; 257 } 242 258 243 259 /* Floppy Disks: */ 244 QIStateIndicator *pLedFloppyDisks = indicatorsPool()->indicator(IndicatorType_FloppyDisks); 245 pIndicatorBoxHLayout->addWidget(pLedFloppyDisks); 246 connect(pLedFloppyDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 247 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 260 if (QIStateIndicator *pLedFloppyDisks = indicatorsPool()->indicator(IndicatorType_FloppyDisks)) 261 { 262 pIndicatorBoxHLayout->addWidget(pLedFloppyDisks); 263 connect(pLedFloppyDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 264 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 265 fAtLeastOneAddedToLeftSection = true; 266 } 248 267 249 268 /* USB: */ 250 QIStateIndicator *pLedUSB = indicatorsPool()->indicator(IndicatorType_USB); 251 pIndicatorBoxHLayout->addWidget(pLedUSB); 252 connect(pLedUSB, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 253 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 269 if (QIStateIndicator *pLedUSB = indicatorsPool()->indicator(IndicatorType_USB)) 270 { 271 pIndicatorBoxHLayout->addWidget(pLedUSB); 272 connect(pLedUSB, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 273 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 274 fAtLeastOneAddedToLeftSection = true; 275 } 254 276 255 277 /* Network: */ 256 QIStateIndicator *pLedNetwork = indicatorsPool()->indicator(IndicatorType_Network); 257 pIndicatorBoxHLayout->addWidget(pLedNetwork); 258 connect(pLedNetwork, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 259 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 278 if (QIStateIndicator *pLedNetwork = indicatorsPool()->indicator(IndicatorType_Network)) 279 { 280 pIndicatorBoxHLayout->addWidget(pLedNetwork); 281 connect(pLedNetwork, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 282 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 283 fAtLeastOneAddedToLeftSection = true; 284 } 260 285 261 286 /* Shared Folders: */ 262 QIStateIndicator *pLedSharedFolders = indicatorsPool()->indicator(IndicatorType_SharedFolders); 263 pIndicatorBoxHLayout->addWidget(pLedSharedFolders); 264 connect(pLedSharedFolders, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 265 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 287 if (QIStateIndicator *pLedSharedFolders = indicatorsPool()->indicator(IndicatorType_SharedFolders)) 288 { 289 pIndicatorBoxHLayout->addWidget(pLedSharedFolders); 290 connect(pLedSharedFolders, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 291 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 292 fAtLeastOneAddedToLeftSection = true; 293 } 266 294 267 295 /* Video Capture: */ 268 QIStateIndicator *pLedVideoCapture = indicatorsPool()->indicator(IndicatorType_VideoCapture); 269 pIndicatorBoxHLayout->addWidget(pLedVideoCapture); 270 connect(pLedVideoCapture, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 271 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 296 if (QIStateIndicator *pLedVideoCapture = indicatorsPool()->indicator(IndicatorType_VideoCapture)) 297 { 298 pIndicatorBoxHLayout->addWidget(pLedVideoCapture); 299 connect(pLedVideoCapture, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 300 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 301 fAtLeastOneAddedToLeftSection = true; 302 } 272 303 273 304 /* Features: */ 274 pIndicatorBoxHLayout->addWidget(indicatorsPool()->indicator(IndicatorType_Features)); 305 if (QIStateIndicator *pLedFeatures = indicatorsPool()->indicator(IndicatorType_Features)) 306 { 307 pIndicatorBoxHLayout->addWidget(pLedFeatures); 308 fAtLeastOneAddedToLeftSection = true; 309 } 275 310 276 311 /* Separator: */ 277 QFrame *pSeparator = new QFrame; 278 pSeparator->setFrameStyle(QFrame::VLine | QFrame::Sunken); 279 pIndicatorBoxHLayout->addWidget(pSeparator); 312 if (fAtLeastOneAddedToLeftSection) 313 { 314 QFrame *pSeparator = new QFrame; 315 pSeparator->setFrameStyle(QFrame::VLine | QFrame::Sunken); 316 pIndicatorBoxHLayout->addWidget(pSeparator); 317 } 280 318 281 319 /* Mouse: */ 282 QIStateIndicator *pLedMouse = indicatorsPool()->indicator(IndicatorType_Mouse); 283 pIndicatorBoxHLayout->addWidget(pLedMouse); 284 connect(pLedMouse, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 285 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 320 if (QIStateIndicator *pLedMouse = indicatorsPool()->indicator(IndicatorType_Mouse)) 321 { 322 pIndicatorBoxHLayout->addWidget(pLedMouse); 323 connect(pLedMouse, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)), 324 this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*))); 325 } 286 326 287 327 /* Keyboard: */ 288 m_pCntHostkey = new QWidget; 289 QHBoxLayout *pHostkeyLedContainerLayout = new QHBoxLayout(m_pCntHostkey); 290 VBoxGlobal::setLayoutMargin(pHostkeyLedContainerLayout, 0); 291 pHostkeyLedContainerLayout->setSpacing(3); 292 pIndicatorBoxHLayout->addWidget(m_pCntHostkey); 293 pHostkeyLedContainerLayout->addWidget(indicatorsPool()->indicator(IndicatorType_Keyboard)); 294 m_pNameHostkey = new QLabel(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo())); 295 pHostkeyLedContainerLayout->addWidget(m_pNameHostkey); 328 if (QIStateIndicator *pLedKeyboard = indicatorsPool()->indicator(IndicatorType_Keyboard)) 329 { 330 if (QWidget *pContainerWidgetHostkey = new QWidget) 331 { 332 if (QHBoxLayout *pContainerLayoutHostkey = new QHBoxLayout(pContainerWidgetHostkey)) 333 { 334 VBoxGlobal::setLayoutMargin(pContainerLayoutHostkey, 0); 335 pContainerLayoutHostkey->setSpacing(3); 336 m_pNameHostkey = new QLabel(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo())); 337 pContainerLayoutHostkey->addWidget(pLedKeyboard); 338 pContainerLayoutHostkey->addWidget(m_pNameHostkey); 339 } 340 pIndicatorBoxHLayout->addWidget(pContainerWidgetHostkey); 341 } 342 } 296 343 297 344 /* Add to status-bar: */ … … 343 390 344 391 /* Connect keyboard state-change handler: */ 345 connect(machineLogic()->keyboardHandler(), SIGNAL(keyboardStateChanged(int)), indicatorsPool()->indicator(IndicatorType_Keyboard), SLOT(setState(int))); 392 if (indicatorsPool()->indicator(IndicatorType_Keyboard)) 393 connect(machineLogic()->keyboardHandler(), SIGNAL(keyboardStateChanged(int)), 394 indicatorsPool()->indicator(IndicatorType_Keyboard), SLOT(setState(int))); 346 395 /* Connect mouse state-change handler: */ 347 connect(machineLogic()->mouseHandler(), SIGNAL(mouseStateChanged(int)), indicatorsPool()->indicator(IndicatorType_Mouse), SLOT(setState(int))); 396 if (indicatorsPool()->indicator(IndicatorType_Mouse)) 397 connect(machineLogic()->mouseHandler(), SIGNAL(mouseStateChanged(int)), 398 indicatorsPool()->indicator(IndicatorType_Mouse), SLOT(setState(int))); 348 399 /* Early initialize created connections: */ 349 indicatorsPool()->indicator(IndicatorType_Keyboard)->setState(machineLogic()->keyboardHandler()->keyboardState()); 350 indicatorsPool()->indicator(IndicatorType_Mouse)->setState(machineLogic()->mouseHandler()->mouseState()); 400 if (indicatorsPool()->indicator(IndicatorType_Keyboard)) 401 indicatorsPool()->indicator(IndicatorType_Keyboard)->setState(machineLogic()->keyboardHandler()->keyboardState()); 402 if (indicatorsPool()->indicator(IndicatorType_Mouse)) 403 indicatorsPool()->indicator(IndicatorType_Mouse)->setState(machineLogic()->mouseHandler()->mouseState()); 351 404 } 352 405 … … 430 483 { 431 484 /* USB Stuff: */ 432 const CUSBController &usbController = m.GetUSBController(); 433 if ( usbController.isNull() 434 || !usbController.GetEnabled() 435 || !usbController.GetProxyAvailable()) 485 if (indicatorsPool()->indicator(IndicatorType_USB)) 436 486 { 437 /* Hide USB menu: */ 438 indicatorsPool()->indicator(IndicatorType_USB)->setHidden(true); 439 } 440 else 441 { 442 /* Toggle USB LED: */ 443 indicatorsPool()->indicator(IndicatorType_USB)->setState( 444 usbController.GetEnabled() ? KDeviceActivity_Idle : KDeviceActivity_Null); 487 const CUSBController &usbController = m.GetUSBController(); 488 if ( usbController.isNull() 489 || !usbController.GetEnabled() 490 || !usbController.GetProxyAvailable()) 491 { 492 /* Hide USB menu: */ 493 indicatorsPool()->indicator(IndicatorType_USB)->setHidden(true); 494 } 495 else 496 { 497 /* Toggle USB LED: */ 498 indicatorsPool()->indicator(IndicatorType_USB)->setState( 499 usbController.GetEnabled() ? KDeviceActivity_Idle : KDeviceActivity_Null); 500 } 445 501 } 446 502 } … … 495 551 496 552 /* Translate host-combo LED: */ 497 m_pNameHostkey->setToolTip( 498 QApplication::translate("UIMachineWindowNormal", "Shows the currently assigned Host key.<br>" 499 "This key, when pressed alone, toggles the keyboard and mouse " 500 "capture state. It can also be used in combination with other keys " 501 "to quickly perform actions from the main menu.")); 502 m_pNameHostkey->setText(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo())); 553 if (m_pNameHostkey) 554 { 555 m_pNameHostkey->setToolTip( 556 QApplication::translate("UIMachineWindowNormal", "Shows the currently assigned Host key.<br>" 557 "This key, when pressed alone, toggles the keyboard and mouse " 558 "capture state. It can also be used in combination with other keys " 559 "to quickly perform actions from the main menu.")); 560 m_pNameHostkey->setText(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo())); 561 } 503 562 } 504 563 … … 565 624 } 566 625 } 567 if (iElement & UIVisualElement_HDStuff) 626 if ((iElement & UIVisualElement_HDStuff) && 627 indicatorsPool()->indicator(IndicatorType_HardDisks)) 568 628 indicatorsPool()->indicator(IndicatorType_HardDisks)->updateAppearance(); 569 if (iElement & UIVisualElement_CDStuff) 629 if ((iElement & UIVisualElement_CDStuff) && 630 indicatorsPool()->indicator(IndicatorType_OpticalDisks)) 570 631 indicatorsPool()->indicator(IndicatorType_OpticalDisks)->updateAppearance(); 571 if (iElement & UIVisualElement_FDStuff) 632 if ((iElement & UIVisualElement_FDStuff) && 633 indicatorsPool()->indicator(IndicatorType_FloppyDisks)) 572 634 indicatorsPool()->indicator(IndicatorType_FloppyDisks)->updateAppearance(); 573 if (iElement & UIVisualElement_NetworkStuff) 635 if ((iElement & UIVisualElement_NetworkStuff) && 636 indicatorsPool()->indicator(IndicatorType_Network)) 574 637 indicatorsPool()->indicator(IndicatorType_Network)->updateAppearance(); 575 if (iElement & UIVisualElement_USBStuff && 638 if ((iElement & UIVisualElement_USBStuff) && 639 indicatorsPool()->indicator(IndicatorType_USB) && 576 640 !indicatorsPool()->indicator(IndicatorType_USB)->isHidden()) 577 641 indicatorsPool()->indicator(IndicatorType_USB)->updateAppearance(); 578 if (iElement & UIVisualElement_SharedFolderStuff) 642 if ((iElement & UIVisualElement_SharedFolderStuff) && 643 indicatorsPool()->indicator(IndicatorType_SharedFolders)) 579 644 indicatorsPool()->indicator(IndicatorType_SharedFolders)->updateAppearance(); 580 if (iElement & UIVisualElement_VideoCapture) 645 if ((iElement & UIVisualElement_VideoCapture) && 646 indicatorsPool()->indicator(IndicatorType_VideoCapture)) 581 647 indicatorsPool()->indicator(IndicatorType_VideoCapture)->updateAppearance(); 582 if (iElement & UIVisualElement_FeaturesStuff) 648 if ((iElement & UIVisualElement_FeaturesStuff) && 649 indicatorsPool()->indicator(IndicatorType_Features)) 583 650 indicatorsPool()->indicator(IndicatorType_Features)->updateAppearance(); 584 651 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r46582 r46686 95 95 /* Widgets: */ 96 96 UIIndicatorsPool *m_pIndicatorsPool; 97 QWidget *m_pCntHostkey;98 97 QLabel *m_pNameHostkey; 99 98
Note:
See TracChangeset
for help on using the changeset viewer.