Changeset 98811 in vbox
- Timestamp:
- Mar 1, 2023 5:52:24 PM (21 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r98806 r98811 73 73 #include "CStringFormValue.h" 74 74 #include "CStorageController.h" 75 #ifdef VBOX_WITH_UPDATE_AGENT 76 # include "CSystemProperties.h" 77 #endif 75 #include "CSystemProperties.h" 78 76 #include "CUnattended.h" 79 77 #include "CUpdateAgent.h" … … 618 616 UIErrorString::formatErrorInfo(comAppliance), 619 617 QString(), QString(), pParent); 618 } 619 620 /* static */ 621 void UINotificationMessage::cannotAcquireSystemPropertiesParameter(const CSystemProperties &comProperties) 622 { 623 createMessage( 624 QApplication::translate("UIMessageCenter", "System properties failure ..."), 625 QApplication::translate("UIMessageCenter", "Failed to acquire system properties parameter.") + 626 UIErrorString::formatErrorInfo(comProperties)); 620 627 } 621 628 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r98806 r98811 79 79 class CNetworkAdapter; 80 80 class CStorageController; 81 class CSystemProperties; 81 82 class CVirtualBox; 82 83 class CVirtualBoxErrorInfo; … … 282 283 static void cannotAcquireApplianceParameter(const CAppliance &comAppliance, 283 284 UINotificationCenter *pParent = 0); 285 /** Notifies about inability to acquire ISystemProperties parameter. 286 * @param comProperties Brings the object parameter get acquired from. */ 287 static void cannotAcquireSystemPropertiesParameter(const CSystemProperties &comProperties); 284 288 /** Notifies about inability to acquire IExtPackManager parameter. 285 289 * @param comVBox Brings the object parameter get acquired from. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98810 r98811 829 829 { 830 830 return uisession()->acquireWhetherNetworkAdapterEnabled(uSlot, fEnabled); 831 } 832 833 bool UIMachine::acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled) 834 { 835 return uisession()->acquireWhetherAtLeastOneNetworkAdapterEnabled(fEnabled); 831 836 } 832 837 … … 1870 1875 { 1871 1876 /* Initialize Network menu: */ 1872 bool fAtLeastOneAdapterActive = false; 1873 const KChipsetType enmChipsetType = uisession()->machine().GetChipsetType(); 1874 ULONG uSlots = uiCommon().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(enmChipsetType); 1875 for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot) 1876 { 1877 const CNetworkAdapter &comNetworkAdapter = uisession()->machine().GetNetworkAdapter(uSlot); 1878 if (comNetworkAdapter.GetEnabled()) 1879 { 1880 fAtLeastOneAdapterActive = true; 1881 break; 1882 } 1883 } 1884 if (!fAtLeastOneAdapterActive) 1877 bool fAtLeastOneAdapterEnabled = false; 1878 acquireWhetherAtLeastOneNetworkAdapterEnabled(fAtLeastOneAdapterEnabled); 1879 if (!fAtLeastOneAdapterEnabled) 1885 1880 restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType) 1886 1881 (restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98810 r98811 563 563 /** Acquires whether network adapter is enabled. */ 564 564 bool acquireWhetherNetworkAdapterEnabled(ulong uSlot, bool &fEnabled); 565 /** Acquires whether at leasst one network adapter is enabled. */ 566 bool acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled); 565 567 /** Acquires whether network adapter cable is connected. */ 566 568 bool acquireWhetherNetworkCableConnected(ulong uSlot, bool &fConnected); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98810 r98811 1107 1107 else 1108 1108 fEnabled = fAdapterEnabled == TRUE; 1109 } 1110 return fSuccess; 1111 } 1112 1113 bool UISession::acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled) 1114 { 1115 /* Acquire system properties: */ 1116 CVirtualBox comVBox = uiCommon().virtualBox(); 1117 AssertReturn(comVBox.isNotNull(), false); 1118 CSystemProperties comProperties = comVBox.GetSystemProperties(); 1119 if (!comVBox.isOk()) 1120 { 1121 UINotificationMessage::cannotAcquireVirtualBoxParameter(comVBox); 1122 return false; 1123 } 1124 1125 /* Acquire chipset type: */ 1126 KChipsetType enmChipsetType = KChipsetType_Null; 1127 bool fSuccess = acquireChipsetType(enmChipsetType); 1128 if (fSuccess) 1129 { 1130 /* Acquire maximum network adapters count: */ 1131 const ulong uSlots = comProperties.GetMaxNetworkAdapters(enmChipsetType); 1132 fSuccess = comProperties.isOk(); 1133 if (!fSuccess) 1134 UINotificationMessage::cannotAcquireSystemPropertiesParameter(comProperties); 1135 else 1136 { 1137 /* Search for 1st enabled adapter: */ 1138 for (ulong uSlot = 0; uSlot < uSlots; ++uSlot) 1139 { 1140 bool fAdapterEnabled = false; 1141 fSuccess = acquireWhetherNetworkAdapterEnabled(uSlot, fAdapterEnabled); 1142 if (!fSuccess) 1143 break; 1144 if (!fAdapterEnabled) 1145 continue; 1146 fEnabled = true; 1147 break; 1148 } 1149 } 1109 1150 } 1110 1151 return fSuccess; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98810 r98811 373 373 /** Acquires whether network adapter is enabled. */ 374 374 bool acquireWhetherNetworkAdapterEnabled(ulong uSlot, bool &fEnabled); 375 /** Acquires whether at leasst one network adapter is enabled. */ 376 bool acquireWhetherAtLeastOneNetworkAdapterEnabled(bool &fEnabled); 375 377 /** Acquires whether network adapter cable is connected. */ 376 378 bool acquireWhetherNetworkCableConnected(ulong uSlot, bool &fConnected);
Note:
See TracChangeset
for help on using the changeset viewer.