Changeset 52132 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 22, 2014 4:23:57 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r52130 r52132 1009 1009 void UIMachineLogic::prepareMenu() 1010 1010 { 1011 /* Update action-pool visibility: */1012 uisession()->updateActionPoolVisibility();1013 1014 1011 /* Update 'Machine' menu: */ 1015 1012 updateMenuMachine(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r52130 r52132 172 172 , m_fIsHidingHostPointer(true) 173 173 { 174 /* Prepare actions: */ 175 prepareActions(); 176 174 177 /* Prepare connections: */ 175 178 prepareConnections(); … … 967 970 connect(gConsoleEvents, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)), 968 971 this, SLOT(sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect))); 972 } 973 974 void UISession::prepareActions() 975 { 976 /* Get host/machine: */ 977 const CHost host = vboxGlobal().host(); 978 const CMachine machine = session().GetConsole().GetMachine(); 979 980 /* Storage stuff: */ 981 { 982 /* Initialize CD/FD menus: */ 983 int iDevicesCountCD = 0; 984 int iDevicesCountFD = 0; 985 foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments()) 986 { 987 if (attachment.GetType() == KDeviceType_DVD) 988 ++iDevicesCountCD; 989 if (attachment.GetType() == KDeviceType_Floppy) 990 ++iDevicesCountFD; 991 } 992 QAction *pOpticalDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices); 993 QAction *pFloppyDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices); 994 pOpticalDevicesMenu->setData(iDevicesCountCD); 995 pOpticalDevicesMenu->setVisible(iDevicesCountCD); 996 pFloppyDevicesMenu->setData(iDevicesCountFD); 997 pFloppyDevicesMenu->setVisible(iDevicesCountFD); 998 } 999 1000 /* Network stuff: */ 1001 { 1002 /* Initialize Network menu: */ 1003 bool fAtLeastOneAdapterActive = false; 1004 const KChipsetType chipsetType = machine.GetChipsetType(); 1005 ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType); 1006 for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot) 1007 { 1008 const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot); 1009 if (adapter.GetEnabled()) 1010 { 1011 fAtLeastOneAdapterActive = true; 1012 break; 1013 } 1014 } 1015 gActionPool->action(UIActionIndexRuntime_Menu_Network)->setVisible(fAtLeastOneAdapterActive); 1016 } 1017 1018 /* USB stuff: */ 1019 { 1020 /* Check whether there is at least one USB controller with an available proxy. */ 1021 const bool fUSBEnabled = !machine.GetUSBDeviceFilters().isNull() 1022 && !machine.GetUSBControllers().isEmpty() 1023 && machine.GetUSBProxyAvailable(); 1024 gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->setVisible(fUSBEnabled); 1025 } 1026 1027 /* WebCams stuff: */ 1028 { 1029 /* Check whether there is an accessible video input devices pool: */ 1030 host.GetVideoInputDevices(); 1031 const bool fWebCamsEnabled = host.isOk() && !machine.GetUSBControllers().isEmpty(); 1032 gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->setVisible(fWebCamsEnabled); 1033 } 969 1034 } 970 1035 … … 1443 1508 } 1444 1509 1445 void UISession::updateActionPoolVisibility()1446 {1447 /* Get host: */1448 const CHost &host = vboxGlobal().host();1449 1450 /* Get uisession machine: */1451 const CMachine &machine = session().GetConsole().GetMachine();1452 1453 /* Storage stuff: */1454 {1455 /* Initialize CD/FD menus: */1456 int iDevicesCountCD = 0;1457 int iDevicesCountFD = 0;1458 const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();1459 for (int i = 0; i < attachments.size(); ++i)1460 {1461 const CMediumAttachment &attachment = attachments[i];1462 if (attachment.GetType() == KDeviceType_DVD)1463 ++iDevicesCountCD;1464 if (attachment.GetType() == KDeviceType_Floppy)1465 ++iDevicesCountFD;1466 }1467 QAction *pOpticalDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices);1468 QAction *pFloppyDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices);1469 pOpticalDevicesMenu->setData(iDevicesCountCD);1470 pOpticalDevicesMenu->setVisible(iDevicesCountCD);1471 pFloppyDevicesMenu->setData(iDevicesCountFD);1472 pFloppyDevicesMenu->setVisible(iDevicesCountFD);1473 }1474 1475 /* Network stuff: */1476 {1477 bool fAtLeastOneAdapterActive = false;1478 ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);1479 for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)1480 {1481 const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);1482 if (adapter.GetEnabled())1483 {1484 fAtLeastOneAdapterActive = true;1485 break;1486 }1487 }1488 1489 /* Show/Hide Network sub-menu depending on overall adapters activity status: */1490 gActionPool->action(UIActionIndexRuntime_Menu_Network)->setVisible(fAtLeastOneAdapterActive);1491 }1492 1493 /* USB stuff: */1494 {1495 /* Check whether there is at least one USB controllers with an available proxy. */1496 bool fUSBEnabled = !machine.GetUSBDeviceFilters().isNull()1497 && !machine.GetUSBControllers().isEmpty()1498 && machine.GetUSBProxyAvailable();1499 1500 /* Show/Hide USB menu depending on controller availability, activity and USB-proxy presence: */1501 gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->setVisible(fUSBEnabled);1502 }1503 1504 /* WebCams stuff: */1505 {1506 /* Check whether there is an accessible video input devices pool: */1507 const CHostVideoInputDeviceVector &webcams = host.GetVideoInputDevices(); Q_UNUSED(webcams);1508 bool fWebCamsEnabled = host.isOk() && !machine.GetUSBControllers().isEmpty();1509 1510 /* Show/Hide WebCams menu depending on ExtPack availability: */1511 gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->setVisible(fWebCamsEnabled);1512 }1513 }1514 1515 1510 bool UISession::preparePowerUp() 1516 1511 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r52129 r52132 92 92 UIMachineLogic* machineLogic() const; 93 93 QWidget* mainMachineWindow() const; 94 void updateActionPoolVisibility();95 94 QCursor cursor() const { return m_cursor; } 96 95 … … 319 318 320 319 /* Prepare helpers: */ 320 void prepareActions(); 321 321 void prepareConnections(); 322 322 void prepareConsoleEventHandlers(); … … 331 331 void cleanupConsoleEventHandlers(); 332 332 void cleanupConnections(); 333 //void cleanupActions() {} 333 334 334 335 /* Update helpers: */
Note:
See TracChangeset
for help on using the changeset viewer.