Changeset 79963 in vbox
- Timestamp:
- Jul 24, 2019 6:21:31 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r79962 r79963 107 107 108 108 /** Holds the RAM size. */ 109 int 109 int m_iMemorySize; 110 110 /** Holds the boot items. */ 111 UIBootItemDataList 111 UIBootItemDataList m_bootItems; 112 112 /** Holds the chipset type. */ 113 KChipsetType 113 KChipsetType m_chipsetType; 114 114 /** Holds the pointing HID type. */ 115 KPointingHIDType 115 KPointingHIDType m_pointingHIDType; 116 116 /** Holds whether the IO APIC is enabled. */ 117 bool 117 bool m_fEnabledIoApic; 118 118 /** Holds whether the EFI is enabled. */ 119 bool 119 bool m_fEnabledEFI; 120 120 /** Holds whether the UTC is enabled. */ 121 bool 121 bool m_fEnabledUTC; 122 122 123 123 /** Holds the CPU count. */ … … 235 235 /* Gather old 'Motherboard' data: */ 236 236 oldSystemData.m_iMemorySize = m_machine.GetMemorySize(); 237 oldSystemData.m_bootItems = loadBootItems(m_machine); 237 238 oldSystemData.m_chipsetType = m_machine.GetChipsetType(); 238 239 oldSystemData.m_pointingHIDType = m_machine.GetPointingHIDType(); … … 240 241 oldSystemData.m_fEnabledEFI = m_machine.GetFirmwareType() >= KFirmwareType_EFI && m_machine.GetFirmwareType() <= KFirmwareType_EFIDUAL; 241 242 oldSystemData.m_fEnabledUTC = m_machine.GetRTCUseUTC(); 242 /* Gather boot-items of current VM: */243 QList<KDeviceType> usedBootItems;244 for (int i = 1; i <= m_possibleBootItems.size(); ++i)245 {246 KDeviceType type = m_machine.GetBootOrder(i);247 if (type != KDeviceType_Null)248 {249 usedBootItems << type;250 UIBootItemData data;251 data.m_enmType = type;252 data.m_fEnabled = true;253 oldSystemData.m_bootItems << data;254 }255 }256 /* Gather other unique boot-items: */257 for (int i = 0; i < m_possibleBootItems.size(); ++i)258 {259 KDeviceType type = m_possibleBootItems[i];260 if (!usedBootItems.contains(type))261 {262 UIBootItemData data;263 data.m_enmType = type;264 data.m_fEnabled = false;265 oldSystemData.m_bootItems << data;266 }267 }268 243 269 244 /* Gather old 'Processor' data: */ … … 1170 1145 } 1171 1146 1147 UIBootItemDataList UIMachineSettingsSystem::loadBootItems(const CMachine &comMachine) 1148 { 1149 /* Prepare boot items: */ 1150 UIBootItemDataList bootItems; 1151 1152 /* Gather boot-items of current VM: */ 1153 QList<KDeviceType> usedBootItems; 1154 for (int i = 1; i <= m_possibleBootItems.size(); ++i) 1155 { 1156 const KDeviceType enmType = comMachine.GetBootOrder(i); 1157 if (enmType != KDeviceType_Null) 1158 { 1159 usedBootItems << enmType; 1160 UIBootItemData data; 1161 data.m_enmType = enmType; 1162 data.m_fEnabled = true; 1163 bootItems << data; 1164 } 1165 } 1166 /* Gather other unique boot-items: */ 1167 for (int i = 0; i < m_possibleBootItems.size(); ++i) 1168 { 1169 const KDeviceType enmType = m_possibleBootItems[i]; 1170 if (!usedBootItems.contains(enmType)) 1171 { 1172 UIBootItemData data; 1173 data.m_enmType = enmType; 1174 data.m_fEnabled = false; 1175 bootItems << data; 1176 } 1177 } 1178 1179 /* Return boot items: */ 1180 return bootItems; 1181 } 1182 1183 void UIMachineSettingsSystem::saveBootItems(const UIBootItemDataList &bootItems, CMachine &comMachine) 1184 { 1185 bool fSuccess = true; 1186 int iBootIndex = 0; 1187 for (int i = 0; fSuccess && i < bootItems.size(); ++i) 1188 { 1189 if (bootItems.at(i).m_fEnabled) 1190 { 1191 comMachine.SetBootOrder(++iBootIndex, bootItems.at(i).m_enmType); 1192 fSuccess = comMachine.isOk(); 1193 } 1194 } 1195 for (int i = 0; fSuccess && i < bootItems.size(); ++i) 1196 { 1197 if (!bootItems.at(i).m_fEnabled) 1198 { 1199 comMachine.SetBootOrder(++iBootIndex, KDeviceType_Null); 1200 fSuccess = comMachine.isOk(); 1201 } 1202 } 1203 } 1204 1172 1205 bool UIMachineSettingsSystem::saveSystemData() 1173 1206 { … … 1209 1242 fSuccess = m_machine.isOk(); 1210 1243 } 1244 /* Save boot items: */ 1245 if (fSuccess && isMachineOffline() && newSystemData.m_bootItems != oldSystemData.m_bootItems) 1246 { 1247 saveBootItems(newSystemData.m_bootItems, m_machine); 1248 fSuccess = m_machine.isOk(); 1249 } 1211 1250 /* Save chipset type: */ 1212 1251 if (fSuccess && isMachineOffline() && newSystemData.m_chipsetType != oldSystemData.m_chipsetType) … … 1238 1277 m_machine.SetRTCUseUTC(newSystemData.m_fEnabledUTC); 1239 1278 fSuccess = m_machine.isOk(); 1240 }1241 /* Save boot items: */1242 if (fSuccess && isMachineOffline() && newSystemData.m_bootItems != oldSystemData.m_bootItems)1243 {1244 int iBootIndex = 0;1245 for (int i = 0; fSuccess && i < newSystemData.m_bootItems.size(); ++i)1246 {1247 if (newSystemData.m_bootItems.at(i).m_fEnabled)1248 {1249 m_machine.SetBootOrder(++iBootIndex, newSystemData.m_bootItems.at(i).m_enmType);1250 fSuccess = m_machine.isOk();1251 }1252 }1253 for (int i = 0; fSuccess && i < newSystemData.m_bootItems.size(); ++i)1254 {1255 if (!newSystemData.m_bootItems.at(i).m_fEnabled)1256 {1257 m_machine.SetBootOrder(++iBootIndex, KDeviceType_Null);1258 fSuccess = m_machine.isOk();1259 }1260 }1261 1279 } 1262 1280 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r76581 r79963 29 29 struct UIDataSettingsMachineSystem; 30 30 typedef UISettingsCache<UIDataSettingsMachineSystem> UISettingsCacheMachineSystem; 31 class CMachine; 31 32 32 33 /** Machine settings: System page. */ … … 150 151 /** Adjusts boot-order tree-widget size. */ 151 152 void adjustBootOrderTWSize(); 153 /** Loads boot item list for passed @a comMachine. */ 154 UIBootItemDataList loadBootItems(const CMachine &comMachine); 155 /** Saves @a bootItems list to passed @a comMachine. */ 156 void saveBootItems(const UIBootItemDataList &bootItems, CMachine &comMachine); 152 157 153 158 /** Saves existing system data from the cache. */
Note:
See TracChangeset
for help on using the changeset viewer.