Changeset 34105 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Nov 16, 2010 11:32:27 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r33844 r34105 620 620 CMachine machine = session().GetConsole().GetMachine(); 621 621 622 /* Availability settings: */623 {624 /* VRDE Stuff: */625 CVRDEServer server = machine.GetVRDEServer();626 if (server.isNull())627 {628 /* Hide VRDE Action: */629 uimachine()->actionsPool()->action(UIActionIndex_Toggle_VRDEServer)->setVisible(false);630 }631 else632 {633 /* Check/Uncheck VRDE action depending on VRDE server status: */634 uimachine()->actionsPool()->action(UIActionIndex_Toggle_VRDEServer)->setChecked(server.GetEnabled());635 }636 }637 638 622 /* Load extra-data settings: */ 639 623 { … … 941 925 const CMachine &machine = session().GetConsole().GetMachine(); 942 926 943 /* Availability settings: */ 944 { 945 /* USB Stuff: */ 946 const CUSBController &usbController = machine.GetUSBController(); 947 if ( usbController.isNull() 948 || !usbController.GetEnabled() 949 || !usbController.GetProxyAvailable()) 950 { 951 /* Hide USB menu if controller is NULL or no USB proxy available: */ 952 uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setVisible(false); 953 } 954 else 955 { 956 /* Enable/Disable USB menu depending on USB controller: */ 957 uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setEnabled(usbController.GetEnabled()); 958 } 959 } 960 961 /* Prepare some initial settings: */ 927 /* Storage stuff: */ 962 928 { 963 929 /* Initialize CD/FD menus: */ … … 965 931 int iDevicesCountFD = 0; 966 932 const CMediumAttachmentVector &attachments = machine.GetMediumAttachments(); 967 foreach (const CMediumAttachment &attachment, attachments) 968 { 933 for (int i = 0; i < attachments.size(); ++i) 934 { 935 const CMediumAttachment &attachment = attachments[i]; 969 936 if (attachment.GetType() == KDeviceType_DVD) 970 ++ 937 ++iDevicesCountCD; 971 938 if (attachment.GetType() == KDeviceType_Floppy) 972 ++ 939 ++iDevicesCountFD; 973 940 } 974 941 QAction *pOpticalDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices); … … 978 945 pFloppyDevicesMenu->setData(iDevicesCountFD); 979 946 pFloppyDevicesMenu->setVisible(iDevicesCountFD); 947 } 948 949 /* VRDE stuff: */ 950 { 951 /* Get VRDE server: */ 952 CVRDEServer server = machine.GetVRDEServer(); 953 bool fIsVRDEServerAvailable = !server.isNull(); 954 /* Show/Hide VRDE action depending on VRDE server availability status: */ 955 uimachine()->actionsPool()->action(UIActionIndex_Toggle_VRDEServer)->setVisible(fIsVRDEServerAvailable); 956 /* Check/Uncheck VRDE action depending on VRDE server activity status: */ 957 if (fIsVRDEServerAvailable) 958 uimachine()->actionsPool()->action(UIActionIndex_Toggle_VRDEServer)->setChecked(server.GetEnabled()); 959 } 960 961 /* Network stuff: */ 962 { 963 bool fAtLeastOneAdapterActive = false; 964 ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount(); 965 for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot) 966 { 967 const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot); 968 if (adapter.GetEnabled()) 969 { 970 fAtLeastOneAdapterActive = true; 971 break; 972 } 973 } 974 /* Show/Hide Network Adapters action depending on overall adapters activity status: */ 975 uimachine()->actionsPool()->action(UIActionIndex_Simple_NetworkAdaptersDialog)->setVisible(fAtLeastOneAdapterActive); 976 } 977 978 /* USB stuff: */ 979 { 980 /* Get USB controller: */ 981 const CUSBController &usbController = machine.GetUSBController(); 982 bool fUSBControllerEnabled = !usbController.isNull() && usbController.GetEnabled() && usbController.GetProxyAvailable(); 983 /* Show/Hide USB menu depending on controller availability, activity and USB-proxy presence: */ 984 uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setVisible(fUSBControllerEnabled); 980 985 } 981 986 }
Note:
See TracChangeset
for help on using the changeset viewer.