Changeset 98399 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 1, 2023 2:48:38 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo
-
old new 19 19 /branches/dsen/gui2:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 20 20 /branches/dsen/gui3:79645-79692 21 /branches/dsen/gui4:155183-155185,155187,155198,155200-155201,155205,155228,155235,155243,155248,155282,155285,155287-155288,155311 21 /branches/dsen/gui4:155183-155185,155187,155198,155200-155201,155205,155228,155235,155243,155248,155282,155285,155287-155288,155311,155316 22 22 /trunk/src:92342,154921
-
- Property svn:mergeinfo
-
trunk/src/VBox
- Property svn:mergeinfo
-
old new 19 19 /branches/dsen/gui2/src/VBox:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 20 20 /branches/dsen/gui3/src/VBox:79645-79692 21 /branches/dsen/gui4/src/VBox:155183-155185,155187,155198,155200-155201,155205,155228,155235,155243,155248,155282,155285,155287-155288,155311 21 /branches/dsen/gui4/src/VBox:155183-155185,155187,155198,155200-155201,155205,155228,155235,155243,155248,155282,155285,155287-155288,155311,155316
-
- Property svn:mergeinfo
-
trunk/src/VBox/Frontends
- Property svn:mergeinfo
-
old new 16 16 /branches/dsen/gui2/src/VBox/Frontends:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 17 17 /branches/dsen/gui3/src/VBox/Frontends:79645-79692 18 /branches/dsen/gui4/src/VBox/Frontends:155183-155185,155187,155198,155200-155201,155205,155228,155235,155243,155248,155282,155285,155287-155288,155311 18 /branches/dsen/gui4/src/VBox/Frontends:155183-155185,155187,155198,155200-155201,155205,155228,155235,155243,155248,155282,155285,155287-155288,155311,155316
-
- Property svn:mergeinfo
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r98379 r98399 1910 1910 1911 1911 /* Make sure action-pool knows frame-buffer size: */ 1912 m_pMachineView->ui session()->actionPool()->toRuntime()->setGuestScreenSize(m_pMachineView->screenId(),1912 m_pMachineView->uimachine()->actionPool()->toRuntime()->setGuestScreenSize(m_pMachineView->screenId(), 1913 1913 QSize(m_iWidth, m_iHeight)); 1914 1914 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98398 r98399 31 31 #endif 32 32 #ifdef VBOX_WS_MAC 33 # include <QMenuBar> 33 34 # include <QTimer> 34 35 #endif … … 51 52 52 53 /* COM includes: */ 54 #include "CAudioAdapter.h" 55 #include "CAudioSettings.h" 53 56 #include "CConsole.h" 54 57 #include "CGraphicsAdapter.h" 58 #include "CHostVideoInputDevice.h" 55 59 #include "CMachine.h" 60 #include "CNetworkAdapter.h" 56 61 #include "CProgress.h" 62 #include "CRecordingSettings.h" 57 63 #include "CSession.h" 58 64 #include "CSnapshot.h" 65 #include "CSystemProperties.h" 66 #include "CUSBController.h" 67 #include "CUSBDeviceFilters.h" 68 #include "CVRDEServer.h" 59 69 60 70 … … 216 226 } 217 227 228 void UIMachine::updateStateAdditionsActions() 229 { 230 /* Make sure action-pool knows whether GA supports graphics: */ 231 actionPool()->toRuntime()->setGuestSupportsGraphics(uisession()->isGuestSupportsGraphics()); 232 /* Enable/Disable Upgrade Additions action depending on feature status: */ 233 actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions)->setEnabled(uisession()->guestAdditionsUpgradable()); 234 } 235 236 void UIMachine::updateStateAudioActions() 237 { 238 /* Make sure Audio adapter is present: */ 239 const CAudioSettings comAudioSettings = uisession()->machine().GetAudioSettings(); 240 AssertMsgReturnVoid(uisession()->machine().isOk() && comAudioSettings.isNotNull(), 241 ("Audio audio settings should NOT be null!\n")); 242 const CAudioAdapter comAdapter = comAudioSettings.GetAdapter(); 243 AssertMsgReturnVoid(comAudioSettings.isOk() && comAdapter.isNotNull(), 244 ("Audio audio adapter should NOT be null!\n")); 245 246 /* Check/Uncheck Audio adapter output/input actions depending on features status: */ 247 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(true); 248 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->setChecked(comAdapter.GetEnabledOut()); 249 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(false); 250 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(true); 251 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->setChecked(comAdapter.GetEnabledIn()); 252 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(false); 253 } 254 255 void UIMachine::updateStateRecordingAction() 256 { 257 /* Make sure recording settingss present: */ 258 const CRecordingSettings comRecordingSettings = uisession()->machine().GetRecordingSettings(); 259 AssertMsgReturnVoid(uisession()->machine().isOk() && comRecordingSettings.isNotNull(), 260 ("Recording settings can't be null!\n")); 261 262 /* Check/Uncheck Capture action depending on feature status: */ 263 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->blockSignals(true); 264 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->setChecked(comRecordingSettings.GetEnabled()); 265 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->blockSignals(false); 266 } 267 268 void UIMachine::updateStateVRDEServerAction() 269 { 270 /* Make sure VRDE server present: */ 271 const CVRDEServer comServer = uisession()->machine().GetVRDEServer(); 272 AssertMsgReturnVoid(uisession()->machine().isOk() && comServer.isNotNull(), 273 ("VRDE server can't be null!\n")); 274 275 /* Check/Uncheck VRDE Server action depending on feature status: */ 276 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(true); 277 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setChecked(comServer.GetEnabled()); 278 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(false); 279 } 280 218 281 bool UIMachine::isScreenVisibleHostDesires(ulong uScreenId) const 219 282 { … … 260 323 261 324 /* Make sure action-pool knows guest-screen visibility status: */ 262 uisession()->actionPool()->toRuntime()->setGuestScreenVisible(uScreenId, fIsMonitorVisible);325 actionPool()->toRuntime()->setGuestScreenVisible(uScreenId, fIsMonitorVisible); 263 326 } 264 327 … … 348 411 } 349 412 } 413 414 void UIMachine::sltHandleAdditionsActualChange() 415 { 416 updateStateAdditionsActions(); 417 emit sigAdditionsStateChange(); 418 } 419 420 void UIMachine::sltHandleAudioAdapterChange() 421 { 422 updateStateAudioActions(); 423 emit sigAudioAdapterChange(); 424 } 425 426 void UIMachine::sltHandleRecordingChange() 427 { 428 updateStateRecordingAction(); 429 emit sigRecordingChange(); 430 } 431 432 void UIMachine::sltHandleStorageDeviceChange(const CMediumAttachment &comAttachment, bool fRemoved, bool fSilent) 433 { 434 updateActionRestrictions(); 435 emit sigStorageDeviceChange(comAttachment, fRemoved, fSilent); 436 } 437 438 void UIMachine::sltHandleVRDEChange() 439 { 440 updateStateVRDEServerAction(); 441 emit sigVRDEChange(); 442 } 443 444 #ifdef VBOX_WS_MAC 445 void UIMachine::sltHandleMenuBarConfigurationChange(const QUuid &uMachineID) 446 { 447 /* Skip unrelated machine IDs: */ 448 if (uiCommon().managedVMUuid() != uMachineID) 449 return; 450 451 /* Update Mac OS X menu-bar: */ 452 updateMenu(); 453 } 454 #endif /* VBOX_WS_MAC */ 350 455 351 456 void UIMachine::sltHandleHostScreenCountChange() … … 581 686 , m_pMachineLogic(0) 582 687 , m_pMachineWindowIcon(0) 688 , m_pActionPool(0) 689 #ifdef VBOX_WS_MAC 690 , m_pMenuBar(0) 691 #endif 583 692 #ifdef VBOX_WS_MAC 584 693 , m_pWatchdogDisplayChange(0) … … 623 732 /* Prepare stuff: */ 624 733 prepareSessionConnections(); 734 prepareActions(); 625 735 prepareScreens(); 626 736 prepareBranding(); … … 631 741 return false; 632 742 633 /* Update stuff: */ 743 /* Update stuff which doesn't send events on init: */ 744 updateStateAudioActions(); 634 745 updateMouseState(); 635 746 … … 642 753 /* Console events stuff: */ 643 754 connect(uisession(), &UISession::sigAudioAdapterChange, 644 this, &UIMachine::s igAudioAdapterChange);755 this, &UIMachine::sltHandleAudioAdapterChange); 645 756 connect(uisession(), &UISession::sigAdditionsStateChange, 646 757 this, &UIMachine::sigAdditionsStateChange); 647 758 connect(uisession(), &UISession::sigAdditionsStateActualChange, 648 this, &UIMachine::s igAdditionsStateActualChange);759 this, &UIMachine::sltHandleAdditionsActualChange); 649 760 connect(uisession(), &UISession::sigClipboardModeChange, 650 761 this, &UIMachine::sigClipboardModeChange); … … 662 773 this, &UIMachine::sigNetworkAdapterChange); 663 774 connect(uisession(), &UISession::sigRecordingChange, 664 this, &UIMachine::s igRecordingChange);775 this, &UIMachine::sltHandleRecordingChange); 665 776 connect(uisession(), &UISession::sigSharedFolderChange, 666 777 this, &UIMachine::sigSharedFolderChange); 667 778 connect(uisession(), &UISession::sigStorageDeviceChange, 668 this, &UIMachine::s igStorageDeviceChange);779 this, &UIMachine::sltHandleStorageDeviceChange); 669 780 connect(uisession(), &UISession::sigUSBControllerChange, 670 781 this, &UIMachine::sigUSBControllerChange); … … 672 783 this, &UIMachine::sigUSBDeviceStateChange); 673 784 connect(uisession(), &UISession::sigVRDEChange, 674 this, &UIMachine::s igVRDEChange);785 this, &UIMachine::sltHandleVRDEChange); 675 786 connect(uisession(), &UISession::sigRuntimeError, 676 787 this, &UIMachine::sigRuntimeError); … … 779 890 /* Make sure action-pool knows guest-screen visibility status: */ 780 891 for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex) 781 uisession()->actionPool()->toRuntime()->setGuestScreenVisible(iScreenIndex, m_monitorVisibilityVector.at(iScreenIndex));892 actionPool()->toRuntime()->setGuestScreenVisible(iScreenIndex, m_monitorVisibilityVector.at(iScreenIndex)); 782 893 } 783 894 … … 802 913 } 803 914 915 void UIMachine::prepareActions() 916 { 917 /* Create action-pool: */ 918 m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime); 919 if (actionPool()) 920 { 921 /* Make sure action-pool knows guest-screen count: */ 922 actionPool()->toRuntime()->setGuestScreenCount(uisession()->frameBuffers().size()); 923 /* Update action restrictions: */ 924 updateActionRestrictions(); 925 926 #ifdef VBOX_WS_MAC 927 /* Create Mac OS X menu-bar: */ 928 m_pMenuBar = new QMenuBar; 929 if (m_pMenuBar) 930 { 931 /* Configure Mac OS X menu-bar: */ 932 connect(gEDataManager, &UIExtraDataManager::sigMenuBarConfigurationChange, 933 this, &UIMachine::sltHandleMenuBarConfigurationChange); 934 /* Update Mac OS X menu-bar: */ 935 updateMenu(); 936 } 937 #endif /* VBOX_WS_MAC */ 938 939 /* Get machine ID: */ 940 const QUuid uMachineID = uiCommon().managedVMUuid(); 941 Q_UNUSED(uMachineID); 942 943 #ifdef VBOX_WS_MAC 944 /* User-element (Menu-bar and Dock) options: */ 945 { 946 const bool fDisabled = gEDataManager->guiFeatureEnabled(GUIFeatureType_NoUserElements); 947 if (fDisabled) 948 UICocoaApplication::instance()->hideUserElements(); 949 } 950 #else /* !VBOX_WS_MAC */ 951 /* Menu-bar options: */ 952 { 953 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoMenuBar); 954 const bool fEnabledForMachine = gEDataManager->menuBarEnabled(uMachineID); 955 const bool fEnabled = fEnabledGlobally && fEnabledForMachine; 956 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(fEnabled); 957 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->blockSignals(true); 958 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->setChecked(fEnabled); 959 actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->blockSignals(false); 960 } 961 #endif /* !VBOX_WS_MAC */ 962 963 /* View options: */ 964 const bool fGuestScreenAutoresize = gEDataManager->guestScreenAutoResizeEnabled(uMachineID); 965 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->blockSignals(true); 966 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->setChecked(fGuestScreenAutoresize); 967 actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->blockSignals(false); 968 969 /* Input options: */ 970 const bool fMouseIntegrated = isMouseIntegrated(); // no e-data for now .. 971 actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->blockSignals(true); 972 actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->setChecked(fMouseIntegrated); 973 actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->blockSignals(false); 974 975 /* Device options: */ 976 actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions)->setEnabled(false); 977 978 /* Status-bar options: */ 979 { 980 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoStatusBar); 981 const bool fEnabledForMachine = gEDataManager->statusBarEnabled(uMachineID); 982 const bool fEnabled = fEnabledGlobally && fEnabledForMachine; 983 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(fEnabled); 984 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->blockSignals(true); 985 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setChecked(fEnabled); 986 actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->blockSignals(false); 987 } 988 } 989 } 990 804 991 void UIMachine::prepareMachineLogic() 805 992 { … … 844 1031 } 845 1032 1033 void UIMachine::cleanupActions() 1034 { 1035 #ifdef VBOX_WS_MAC 1036 /* Destroy Mac OS X menu-bar: */ 1037 delete m_pMenuBar; 1038 m_pMenuBar = 0; 1039 #endif /* VBOX_WS_MAC */ 1040 1041 /* Destroy action-pool if necessary: */ 1042 if (actionPool()) 1043 UIActionPool::destroy(actionPool()); 1044 } 1045 846 1046 void UIMachine::cleanupBranding() 847 1047 { … … 875 1075 cleanupBranding(); 876 1076 cleanupScreens(); 1077 cleanupActions(); 877 1078 878 1079 /* Cleanup session UI: */ … … 884 1085 sltChangeVisualState(m_initialVisualState); 885 1086 } 1087 1088 void UIMachine::updateActionRestrictions() 1089 { 1090 /* Get host and prepare restrictions: */ 1091 const CHost comHost = uiCommon().host(); 1092 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionForMachine = 1093 UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid; 1094 UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionForView = 1095 UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid; 1096 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionForDevices = 1097 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid; 1098 1099 /* Separate process stuff: */ 1100 { 1101 /* Initialize 'Machine' menu: */ 1102 if (!uiCommon().isSeparateProcess()) 1103 restrictionForMachine = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType) 1104 (restrictionForMachine | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach); 1105 } 1106 1107 /* VRDE server stuff: */ 1108 { 1109 /* Initialize 'View' menu: */ 1110 const CVRDEServer comServer = uisession()->machine().GetVRDEServer(); 1111 if (comServer.isNull()) 1112 restrictionForView = (UIExtraDataMetaDefs::RuntimeMenuViewActionType) 1113 (restrictionForView | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer); 1114 } 1115 1116 /* Storage stuff: */ 1117 { 1118 /* Initialize CD/FD menus: */ 1119 int iDevicesCountCD = 0; 1120 int iDevicesCountFD = 0; 1121 foreach (const CMediumAttachment &comAttachment, uisession()->machine().GetMediumAttachments()) 1122 { 1123 if (comAttachment.GetType() == KDeviceType_DVD) 1124 ++iDevicesCountCD; 1125 if (comAttachment.GetType() == KDeviceType_Floppy) 1126 ++iDevicesCountFD; 1127 } 1128 QAction *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices); 1129 QAction *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices); 1130 pOpticalDevicesMenu->setData(iDevicesCountCD); 1131 pFloppyDevicesMenu->setData(iDevicesCountFD); 1132 if (!iDevicesCountCD) 1133 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1134 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices); 1135 if (!iDevicesCountFD) 1136 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1137 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices); 1138 } 1139 1140 /* Audio stuff: */ 1141 { 1142 /* Check whether audio controller is enabled. */ 1143 const CAudioSettings comAudioSettings = uisession()->machine().GetAudioSettings(); 1144 const CAudioAdapter comAudioAdapter = comAudioSettings.GetAdapter(); 1145 if (comAudioAdapter.isNull() || !comAudioAdapter.GetEnabled()) 1146 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1147 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio); 1148 } 1149 1150 /* Network stuff: */ 1151 { 1152 /* Initialize Network menu: */ 1153 bool fAtLeastOneAdapterActive = false; 1154 const KChipsetType enmChipsetType = uisession()->machine().GetChipsetType(); 1155 ULONG uSlots = uiCommon().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(enmChipsetType); 1156 for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot) 1157 { 1158 const CNetworkAdapter &comNetworkAdapter = uisession()->machine().GetNetworkAdapter(uSlot); 1159 if (comNetworkAdapter.GetEnabled()) 1160 { 1161 fAtLeastOneAdapterActive = true; 1162 break; 1163 } 1164 } 1165 if (!fAtLeastOneAdapterActive) 1166 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1167 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network); 1168 } 1169 1170 /* USB stuff: */ 1171 { 1172 /* Check whether there is at least one USB controller with an available proxy. */ 1173 const bool fUSBEnabled = !uisession()->machine().GetUSBDeviceFilters().isNull() 1174 && !uisession()->machine().GetUSBControllers().isEmpty() 1175 && uisession()->machine().GetUSBProxyAvailable(); 1176 if (!fUSBEnabled) 1177 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1178 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices); 1179 } 1180 1181 /* WebCams stuff: */ 1182 { 1183 /* Check whether there is an accessible video input devices pool: */ 1184 comHost.GetVideoInputDevices(); 1185 const bool fWebCamsEnabled = comHost.isOk() && !uisession()->machine().GetUSBControllers().isEmpty(); 1186 if (!fWebCamsEnabled) 1187 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1188 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams); 1189 } 1190 1191 /* Apply cumulative restriction for 'Machine' menu: */ 1192 actionPool()->toRuntime()->setRestrictionForMenuMachine(UIActionRestrictionLevel_Session, restrictionForMachine); 1193 /* Apply cumulative restriction for 'View' menu: */ 1194 actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Session, restrictionForView); 1195 /* Apply cumulative restriction for 'Devices' menu: */ 1196 actionPool()->toRuntime()->setRestrictionForMenuDevices(UIActionRestrictionLevel_Session, restrictionForDevices); 1197 } 1198 1199 #ifdef VBOX_WS_MAC 1200 void UIMachine::updateMenu() 1201 { 1202 /* Rebuild Mac OS X menu-bar: */ 1203 m_pMenuBar->clear(); 1204 foreach (QMenu *pMenu, actionPool()->menus()) 1205 { 1206 UIMenu *pMenuUI = qobject_cast<UIMenu*>(pMenu); 1207 if (!pMenuUI->isConsumable() || !pMenuUI->isConsumed()) 1208 m_pMenuBar->addMenu(pMenuUI); 1209 if (pMenuUI->isConsumable() && !pMenuUI->isConsumed()) 1210 pMenuUI->setConsumed(true); 1211 } 1212 /* Update the dock menu as well: */ 1213 if (machineLogic()) 1214 machineLogic()->updateDock(); 1215 } 1216 #endif /* VBOX_WS_MAC */ 886 1217 887 1218 void UIMachine::updateHostScreenData() … … 893 1224 894 1225 /* Make sure action-pool knows host-screen count: */ 895 uisession()->actionPool()->toRuntime()->setHostScreenCount(m_hostScreens.size());1226 actionPool()->toRuntime()->setHostScreenCount(m_hostScreens.size()); 896 1227 } 897 1228 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98398 r98399 47 47 /* Forward declarations: */ 48 48 class QWidget; 49 class UIActionPool; 49 50 class UISession; 50 51 class UIMachineLogic; 51 52 #ifdef VBOX_WS_MAC 53 class QMenuBar; 52 54 class QTimer; 53 55 #endif … … 180 182 /** @} */ 181 183 184 /** @name Actions stuff. 185 ** @{ */ 186 /** Returns the action-pool instance. */ 187 UIActionPool *actionPool() const { return m_pActionPool; } 188 189 /** Updates additions actions state. */ 190 void updateStateAdditionsActions(); 191 /** Updates Audio action state. */ 192 void updateStateAudioActions(); 193 /** Updates Recording action state. */ 194 void updateStateRecordingAction(); 195 /** Updates VRDE server action state. */ 196 void updateStateVRDEServerAction(); 197 /** @} */ 198 182 199 /** @name Host-screen stuff. 183 200 ** @{ */ … … 297 314 /** Visual state-change handler. */ 298 315 void sltChangeVisualState(UIVisualStateType visualStateType); 316 317 /** @name COM events stuff. 318 ** @{ */ 319 /** Handles additions state actual change signal. */ 320 void sltHandleAdditionsActualChange(); 321 /** Handles audio adapter change signal. */ 322 void sltHandleAudioAdapterChange(); 323 /** Handles recording change signal. */ 324 void sltHandleRecordingChange(); 325 /** Handles storage device change for @a attachment, which was @a fRemoved and it was @a fSilent for guest. */ 326 void sltHandleStorageDeviceChange(const CMediumAttachment &comAttachment, bool fRemoved, bool fSilent); 327 /** Handles VRDE change signal. */ 328 void sltHandleVRDEChange(); 329 /** @} */ 330 331 /** @name Actions stuff. 332 ** @{ */ 333 #ifdef VBOX_WS_MAC 334 /** Mac OS X: Handles menu-bar configuration-change. */ 335 void sltHandleMenuBarConfigurationChange(const QUuid &uMachineID); 336 #endif 337 /** @} */ 299 338 300 339 /** @name Host-screen stuff. … … 372 411 /** Prepare routine: Branding. */ 373 412 void prepareBranding(); 413 /** Prepare routine: Actions stuff. */ 414 void prepareActions(); 374 415 /** Prepare routine: Machine-logic stuff. */ 375 416 void prepareMachineLogic(); … … 377 418 /** Cleanup routine: Machine-logic stuff. */ 378 419 void cleanupMachineLogic(); 420 /** Cleanup routine: Actions stuff. */ 421 void cleanupActions(); 379 422 /** Cleanup routine: Branding. */ 380 423 void cleanupBranding(); … … 388 431 /** Moves VM to initial state. */ 389 432 void enterInitialVisualState(); 433 434 /** @name Actions stuff. 435 ** @{ */ 436 /** Updates action restrictions. */ 437 void updateActionRestrictions(); 438 439 #ifdef VBOX_WS_MAC 440 /** Mac OS X: Updates menu-bar content. */ 441 void updateMenu(); 442 #endif 443 /** @} */ 390 444 391 445 /** @name Host-screen stuff. … … 454 508 /** @} */ 455 509 510 /** @name Actions stuff. 511 ** @{ */ 512 /** Holds the action-pool instance. */ 513 UIActionPool *m_pActionPool; 514 515 #ifdef VBOX_WS_MAC 516 /** Mac OS X: Holds the menu-bar instance. */ 517 QMenuBar *m_pMenuBar; 518 #endif 519 /** @} */ 520 456 521 /** @name Host-screen stuff. 457 522 * @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r98386 r98399 278 278 UIActionPool *UIMachineLogic::actionPool() const 279 279 { 280 return ui session()->actionPool();280 return uimachine()->actionPool(); 281 281 } 282 282 … … 2001 2001 { 2002 2002 /* Make sure action is updated: */ 2003 ui session()->updateStatusRecording();2003 uimachine()->updateStateRecordingAction(); 2004 2004 /* Notify about the error: */ 2005 2005 return UINotificationMessage::cannotToggleRecording(comRecordingSettings, machine().GetName(), fEnabled); … … 2011 2011 { 2012 2012 /* Make sure action is updated: */ 2013 ui session()->updateStatusRecording();2013 uimachine()->updateStateRecordingAction(); 2014 2014 /* Notify about the error: */ 2015 2015 return UINotificationMessage::cannotSaveMachineSettings(machine()); … … 2037 2037 { 2038 2038 /* Make sure action is updated: */ 2039 ui session()->updateStatusVRDE();2039 uimachine()->updateStateVRDEServerAction(); 2040 2040 /* Notify about the error: */ 2041 2041 return UINotificationMessage::cannotToggleVRDEServer(server, machineName(), fEnabled); … … 2047 2047 { 2048 2048 /* Make sure action is updated: */ 2049 ui session()->updateStatusVRDE();2049 uimachine()->updateStateVRDEServerAction(); 2050 2050 /* Notify about the error: */ 2051 2051 return UINotificationMessage::cannotSaveMachineSettings(machine()); … … 2246 2246 { 2247 2247 /* Make sure action is updated: */ 2248 ui session()->updateAudioOutput();2248 uimachine()->updateStateAudioActions(); 2249 2249 /* Notify about the error: */ 2250 2250 return UINotificationMessage::cannotToggleAudioOutput(comAdapter, machineName(), fEnabled); … … 2256 2256 { 2257 2257 /* Make sure action is updated: */ 2258 ui session()->updateAudioOutput();2258 uimachine()->updateStateAudioActions(); 2259 2259 /* Notify about the error: */ 2260 2260 return UINotificationMessage::cannotSaveMachineSettings(machine()); … … 2283 2283 { 2284 2284 /* Make sure action is updated: */ 2285 ui session()->updateAudioInput();2285 uimachine()->updateStateAudioActions(); 2286 2286 /* Notify about the error: */ 2287 2287 return UINotificationMessage::cannotToggleAudioInput(comAdapter, machineName(), fEnabled); … … 2293 2293 { 2294 2294 /* Make sure action is updated: */ 2295 ui session()->updateAudioInput();2295 uimachine()->updateStateAudioActions(); 2296 2296 /* Notify about the error: */ 2297 2297 return UINotificationMessage::cannotSaveMachineSettings(machine()); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98398 r98399 28 28 /* Qt includes: */ 29 29 #include <QApplication> 30 #include <QMenuBar>31 30 #include <QWidget> 32 31 #ifdef VBOX_WS_WIN … … 57 56 58 57 /* COM includes: */ 59 #include "CAudioAdapter.h"60 #include "CAudioSettings.h"61 58 #include "CGraphicsAdapter.h" 62 59 #include "CHostNetworkInterface.h" 63 60 #include "CHostUSBDevice.h" 64 #include "CHostVideoInputDevice.h"65 61 #include "CMedium.h" 66 62 #include "CMediumAttachment.h" 67 #include "CNetworkAdapter.h"68 63 #include "CSnapshot.h" 69 #include "CRecordingSettings.h"70 64 #include "CStorageController.h" 71 65 #include "CSystemProperties.h" … … 73 67 #include "CUSBDeviceFilter.h" 74 68 #include "CUSBDeviceFilters.h" 75 #include "CVRDEServer.h" 69 #ifdef VBOX_WITH_NETFLT 70 # include "CNetworkAdapter.h" 71 #endif 76 72 77 73 /* External includes: */ … … 462 458 } 463 459 464 #ifdef RT_OS_DARWIN465 void UISession::sltHandleMenuBarConfigurationChange(const QUuid &uMachineID)466 {467 /* Skip unrelated machine IDs: */468 if (uiCommon().managedVMUuid() != uMachineID)469 return;470 471 /* Update Mac OS X menu-bar: */472 updateMenu();473 }474 #endif /* RT_OS_DARWIN */475 476 460 void UISession::sltStateChange(KMachineState state) 477 461 { … … 486 470 emit sigMachineStateChange(); 487 471 } 488 }489 490 void UISession::sltVRDEChange()491 {492 /* Make sure VRDE server is present: */493 const CVRDEServer server = machine().GetVRDEServer();494 AssertMsgReturnVoid(machine().isOk() && !server.isNull(),495 ("VRDE server should NOT be null!\n"));496 497 /* Check/Uncheck VRDE Server action depending on feature status: */498 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(true);499 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setChecked(server.GetEnabled());500 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(false);501 502 /* Notify listeners about VRDE change: */503 emit sigVRDEChange();504 }505 506 void UISession::sltRecordingChange()507 {508 CRecordingSettings comRecordingSettings = machine().GetRecordingSettings();509 510 /* Check/Uncheck Capture action depending on feature status: */511 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->blockSignals(true);512 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->setChecked(comRecordingSettings.GetEnabled());513 actionPool()->action(UIActionIndexRT_M_View_M_Recording_T_Start)->blockSignals(false);514 515 /* Notify listeners about Recording change: */516 emit sigRecordingChange();517 }518 519 void UISession::sltHandleStorageDeviceChange(const CMediumAttachment &attachment, bool fRemoved, bool fSilent)520 {521 /* Update action restrictions: */522 updateActionRestrictions();523 524 /* Notify listeners about storage device change: */525 emit sigStorageDeviceChange(attachment, fRemoved, fSilent);526 }527 528 void UISession::sltAudioAdapterChange()529 {530 /* Make sure Audio adapter is present: */531 const CAudioSettings comAudioSettings = machine().GetAudioSettings();532 const CAudioAdapter comAdapter = comAudioSettings.GetAdapter();533 AssertMsgReturnVoid(machine().isOk() && comAdapter.isNotNull(),534 ("Audio adapter should NOT be null!\n"));535 536 /* Check/Uncheck Audio adapter output/input actions depending on features status: */537 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(true);538 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->setChecked(comAdapter.GetEnabledOut());539 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(false);540 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(true);541 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->setChecked(comAdapter.GetEnabledIn());542 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(false);543 544 /* Notify listeners about Audio adapter change: */545 emit sigAudioAdapterChange();546 547 472 } 548 473 … … 605 530 m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless; 606 531 607 /* Make sure action-pool knows whether GA supports graphics: */608 actionPool()->toRuntime()->setGuestSupportsGraphics(m_fIsGuestSupportsGraphics);609 610 if (actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions))611 actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions)->setEnabled(guestAdditionsUpgradable());612 613 532 /* Notify listeners about GA state really changed: */ 614 533 LogRel(("GUI: UISession::sltAdditionsChange: GA state really changed, notifying listeners.\n")); … … 627 546 , m_pMachine(pMachine) 628 547 , m_pConsoleEventhandler(0) 629 , m_pActionPool(0)630 #ifdef VBOX_WS_MAC631 , m_pMenuBar(0)632 #endif /* VBOX_WS_MAC */633 548 /* Common variables: */ 634 549 , m_machineStatePrevious(KMachineState_Null) … … 669 584 670 585 /* Prepare GUI stuff: */ 671 prepareActions();672 586 prepareConnections(); 673 587 prepareSignalHandling(); … … 749 663 this, &UISession::sltAdditionsChange); 750 664 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigAudioAdapterChange, 751 this, &UISession::s ltAudioAdapterChange);665 this, &UISession::sigAudioAdapterChange); 752 666 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigClipboardModeChange, 753 667 this, &UISession::sigClipboardModeChange); … … 763 677 this, &UISession::sigNetworkAdapterChange); 764 678 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigRecordingChange, 765 this, &UISession::s ltRecordingChange);679 this, &UISession::sigRecordingChange); 766 680 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigSharedFolderChange, 767 681 this, &UISession::sigSharedFolderChange); … … 769 683 this, &UISession::sltStateChange); 770 684 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigStorageDeviceChange, 771 this, &UISession::s ltHandleStorageDeviceChange);685 this, &UISession::sigStorageDeviceChange); 772 686 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigUSBControllerChange, 773 687 this, &UISession::sigUSBControllerChange); … … 775 689 this, &UISession::sigUSBDeviceStateChange); 776 690 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigVRDEChange, 777 this, &UISession::s ltVRDEChange);691 this, &UISession::sigVRDEChange); 778 692 connect(m_pConsoleEventhandler, &UIConsoleEventHandler::sigRuntimeError, 779 693 this, &UISession::sigRuntimeError); … … 803 717 } 804 718 805 void UISession::prepareActions()806 {807 /* Create action-pool: */808 m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);809 if (actionPool())810 {811 /* Make sure action-pool knows guest-screen count: */812 actionPool()->toRuntime()->setGuestScreenCount(m_frameBufferVector.size());813 /* Update action restrictions: */814 updateActionRestrictions();815 816 #ifdef VBOX_WS_MAC817 /* Create Mac OS X menu-bar: */818 m_pMenuBar = new QMenuBar;819 if (m_pMenuBar)820 {821 /* Configure Mac OS X menu-bar: */822 connect(gEDataManager, &UIExtraDataManager::sigMenuBarConfigurationChange,823 this, &UISession::sltHandleMenuBarConfigurationChange);824 /* Update Mac OS X menu-bar: */825 updateMenu();826 }827 #endif /* VBOX_WS_MAC */828 /* Postpone enabling the GA update action until GA's are loaded: */829 if (actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions))830 actionPool()->action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions)->setEnabled(false);831 }832 }833 834 719 void UISession::prepareConnections() 835 720 { … … 856 741 const QUuid uMachineID = uiCommon().managedVMUuid(); 857 742 858 /* Should guest autoresize? */859 QAction *pGuestAutoresizeSwitch = actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize);860 pGuestAutoresizeSwitch->setChecked(gEDataManager->guestScreenAutoResizeEnabled(uMachineID));861 862 #ifdef VBOX_WS_MAC863 /* User-element (Menu-bar and Dock) options: */864 {865 const bool fDisabled = gEDataManager->guiFeatureEnabled(GUIFeatureType_NoUserElements);866 if (fDisabled)867 UICocoaApplication::instance()->hideUserElements();868 }869 #else /* !VBOX_WS_MAC */870 /* Menu-bar options: */871 {872 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoMenuBar);873 const bool fEnabledForMachine = gEDataManager->menuBarEnabled(uMachineID);874 const bool fEnabled = fEnabledGlobally && fEnabledForMachine;875 QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings);876 pActionMenuBarSettings->setEnabled(fEnabled);877 QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility);878 pActionMenuBarSwitch->blockSignals(true);879 pActionMenuBarSwitch->setChecked(fEnabled);880 pActionMenuBarSwitch->blockSignals(false);881 }882 #endif /* !VBOX_WS_MAC */883 884 /* Status-bar options: */885 {886 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoStatusBar);887 const bool fEnabledForMachine = gEDataManager->statusBarEnabled(uMachineID);888 const bool fEnabled = fEnabledGlobally && fEnabledForMachine;889 QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings);890 pActionStatusBarSettings->setEnabled(fEnabled);891 QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility);892 pActionStatusBarSwitch->blockSignals(true);893 pActionStatusBarSwitch->setChecked(fEnabled);894 pActionStatusBarSwitch->blockSignals(false);895 }896 897 /* Input options: */898 actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->setChecked(uimachine()->isMouseIntegrated());899 900 /* Devices options: */901 {902 const CAudioSettings comAudioSettings = m_machine.GetAudioSettings();903 const CAudioAdapter comAdapter = comAudioSettings.GetAdapter();904 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(true);905 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->setChecked(comAdapter.GetEnabledOut());906 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Output)->blockSignals(false);907 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(true);908 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->setChecked(comAdapter.GetEnabledIn());909 actionPool()->action(UIActionIndexRT_M_Devices_M_Audio_T_Input)->blockSignals(false);910 }911 912 743 /* What is the default close action and the restricted are? */ 913 744 m_defaultCloseAction = gEDataManager->defaultMachineCloseAction(uMachineID); … … 918 749 && (m_restrictedCloseActions & MachineCloseAction_PowerOff); 919 750 } 920 }921 922 void UISession::cleanupActions()923 {924 #ifdef VBOX_WS_MAC925 /* Destroy Mac OS X menu-bar: */926 delete m_pMenuBar;927 m_pMenuBar = 0;928 #endif /* VBOX_WS_MAC */929 930 /* Destroy action-pool if necessary: */931 if (actionPool())932 UIActionPool::destroy(actionPool());933 751 } 934 752 … … 950 768 } 951 769 m_frameBufferVector.clear(); 952 953 /* Make sure action-pool knows guest-screen count: */954 if (actionPool())955 actionPool()->toRuntime()->setGuestScreenCount(m_frameBufferVector.size());956 770 } 957 771 … … 1005 819 } 1006 820 } 1007 1008 void UISession::cleanup()1009 {1010 /* Cleanup GUI stuff: */1011 //cleanupSignalHandling();1012 //cleanupScreens();1013 //cleanupConnections();1014 cleanupActions();1015 }1016 1017 #ifdef VBOX_WS_MAC1018 void UISession::updateMenu()1019 {1020 /* Rebuild Mac OS X menu-bar: */1021 m_pMenuBar->clear();1022 foreach (QMenu *pMenu, actionPool()->menus())1023 {1024 UIMenu *pMenuUI = qobject_cast<UIMenu*>(pMenu);1025 if (!pMenuUI->isConsumable() || !pMenuUI->isConsumed())1026 m_pMenuBar->addMenu(pMenuUI);1027 if (pMenuUI->isConsumable() && !pMenuUI->isConsumed())1028 pMenuUI->setConsumed(true);1029 }1030 /* Update the dock menu as well: */1031 if (machineLogic())1032 machineLogic()->updateDock();1033 }1034 #endif /* VBOX_WS_MAC */1035 821 1036 822 bool UISession::preprocessInitialization() … … 1269 1055 } 1270 1056 1271 void UISession::updateActionRestrictions()1272 {1273 /* Get host and prepare restrictions: */1274 const CHost host = uiCommon().host();1275 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionForMachine = UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid;1276 UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionForView = UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid;1277 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionForDevices = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;1278 1279 /* Separate process stuff: */1280 {1281 /* Initialize 'Machine' menu: */1282 if (!uiCommon().isSeparateProcess())1283 restrictionForMachine = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)(restrictionForMachine | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach);1284 }1285 1286 /* VRDE server stuff: */1287 {1288 /* Initialize 'View' menu: */1289 const CVRDEServer server = machine().GetVRDEServer();1290 if (server.isNull())1291 restrictionForView = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)(restrictionForView | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);1292 }1293 1294 /* Storage stuff: */1295 {1296 /* Initialize CD/FD menus: */1297 int iDevicesCountCD = 0;1298 int iDevicesCountFD = 0;1299 foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())1300 {1301 if (attachment.GetType() == KDeviceType_DVD)1302 ++iDevicesCountCD;1303 if (attachment.GetType() == KDeviceType_Floppy)1304 ++iDevicesCountFD;1305 }1306 QAction *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices);1307 QAction *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices);1308 pOpticalDevicesMenu->setData(iDevicesCountCD);1309 pFloppyDevicesMenu->setData(iDevicesCountFD);1310 if (!iDevicesCountCD)1311 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);1312 if (!iDevicesCountFD)1313 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);1314 }1315 1316 /* Audio stuff: */1317 {1318 /* Check whether audio controller is enabled. */1319 const CAudioSettings comAudioSettings = machine().GetAudioSettings();1320 const CAudioAdapter comAdapter = comAudioSettings.GetAdapter();1321 if (comAdapter.isNull() || !comAdapter.GetEnabled())1322 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio);1323 }1324 1325 /* Network stuff: */1326 {1327 /* Initialize Network menu: */1328 bool fAtLeastOneAdapterActive = false;1329 const KChipsetType chipsetType = machine().GetChipsetType();1330 ULONG uSlots = uiCommon().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType);1331 for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)1332 {1333 const CNetworkAdapter &adapter = machine().GetNetworkAdapter(uSlot);1334 if (adapter.GetEnabled())1335 {1336 fAtLeastOneAdapterActive = true;1337 break;1338 }1339 }1340 if (!fAtLeastOneAdapterActive)1341 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);1342 }1343 1344 /* USB stuff: */1345 {1346 /* Check whether there is at least one USB controller with an available proxy. */1347 const bool fUSBEnabled = !machine().GetUSBDeviceFilters().isNull()1348 && !machine().GetUSBControllers().isEmpty()1349 && machine().GetUSBProxyAvailable();1350 if (!fUSBEnabled)1351 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);1352 }1353 1354 /* WebCams stuff: */1355 {1356 /* Check whether there is an accessible video input devices pool: */1357 host.GetVideoInputDevices();1358 const bool fWebCamsEnabled = host.isOk() && !machine().GetUSBControllers().isEmpty();1359 if (!fWebCamsEnabled)1360 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);1361 }1362 1363 /* Apply cumulative restriction for 'Machine' menu: */1364 actionPool()->toRuntime()->setRestrictionForMenuMachine(UIActionRestrictionLevel_Session, restrictionForMachine);1365 /* Apply cumulative restriction for 'View' menu: */1366 actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Session, restrictionForView);1367 /* Apply cumulative restriction for 'Devices' menu: */1368 actionPool()->toRuntime()->setRestrictionForMenuDevices(UIActionRestrictionLevel_Session, restrictionForDevices);1369 }1370 1371 1057 #ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER 1372 1058 /** -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98386 r98399 179 179 KMachineState machineStatePrevious() const { return m_machineStatePrevious; } 180 180 KMachineState machineState() const { return m_machineState; } 181 UIActionPool *actionPool() const { return m_pActionPool; }182 181 UIMachineLogic* machineLogic() const; 183 182 QWidget* mainMachineWindow() const; … … 263 262 const QVector<UIFrameBuffer*>& frameBuffers() const { return m_frameBufferVector; } 264 263 265 /** Updates VRDE Server action state. */266 void updateStatusVRDE() { sltVRDEChange(); }267 /** Updates Recording action state. */268 void updateStatusRecording() { sltRecordingChange(); }269 /** Updates Audio output action state. */270 void updateAudioOutput() { sltAudioAdapterChange(); }271 /** Updates Audio input action state. */272 void updateAudioInput() { sltAudioAdapterChange(); }273 274 264 /** @name CPU hardware virtualization features for VM. 275 265 ** @{ */ … … 305 295 void sltDetachCOM(); 306 296 307 #ifdef RT_OS_DARWIN308 /** Mac OS X: Handles menu-bar configuration-change. */309 void sltHandleMenuBarConfigurationChange(const QUuid &uMachineID);310 #endif /* RT_OS_DARWIN */311 312 297 /* Console events slots */ 313 298 void sltStateChange(KMachineState state); 314 299 void sltAdditionsChange(); 315 void sltVRDEChange();316 void sltRecordingChange();317 /** Handles storage device change for @a attachment, which was @a fRemoved and it was @a fSilent for guest. */318 void sltHandleStorageDeviceChange(const CMediumAttachment &attachment, bool fRemoved, bool fSilent);319 /** Handles audio adapter change. */320 void sltAudioAdapterChange();321 300 322 301 /** Handles signal about machine state saved. … … 347 326 void prepareConsoleEventHandlers(); 348 327 void prepareFramebuffers(); 349 void prepareActions();350 328 void prepareConnections(); 351 329 void prepareSignalHandling(); … … 355 333 356 334 /* Cleanup helpers: */ 357 //void cleanupSignalHandling() {}358 //void cleanupScreens() {}359 //void cleanupConnections() {}360 void cleanupActions();361 335 void cleanupFramebuffers(); 362 336 void cleanupConsoleEventHandlers(); 363 337 void cleanupNotificationCenter(); 364 338 void cleanupSession(); 365 void cleanup();366 367 #ifdef VBOX_WS_MAC368 /** Mac OS X: Updates menu-bar content. */369 void updateMenu();370 #endif /* VBOX_WS_MAC */371 339 372 340 /* Common helpers: */ … … 376 344 /** Loads VM settings. */ 377 345 void loadVMSettings(); 378 379 /** Updates action restrictions. */380 void updateActionRestrictions();381 346 382 347 /* Private variables: */ … … 406 371 QString m_strMachineName; 407 372 408 /** Holds the action-pool instance. */409 UIActionPool *m_pActionPool;410 411 #ifdef VBOX_WS_MAC412 /** Holds the menu-bar instance. */413 QMenuBar *m_pMenuBar;414 #endif /* VBOX_WS_MAC */415 416 373 /* Frame-buffers vector: */ 417 374 QVector<UIFrameBuffer*> m_frameBufferVector;
Note:
See TracChangeset
for help on using the changeset viewer.