Changeset 79981 in vbox
- Timestamp:
- Jul 25, 2019 2:59:57 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r79976 r79981 771 771 m_pLayoutBootOrder->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 3); 772 772 #endif 773 774 /* Boot-order tree-widget created in the .ui file. */775 AssertPtrReturnVoid(m_pBootOrderEditor);776 {777 /* Populate possible boot items list.778 * Currently, it seems, we are supporting only 4 possible boot device types:779 * 1. Floppy, 2. DVD-ROM, 3. Hard Disk, 4. Network.780 * But maximum boot devices count supported by machine781 * should be retrieved through the ISystemProperties getter.782 * Moreover, possible boot device types are not listed in some separate Main vector,783 * so we should get them (randomely?) from the list of all device types.784 * Until there will be separate Main getter for list of supported boot device types,785 * this list will be hard-coded here... */786 const CSystemProperties properties = uiCommon().virtualBox().GetSystemProperties();787 const int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition());788 for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition)789 {790 switch (iBootPosition)791 {792 case 1: m_possibleBootItems << KDeviceType_Floppy; break;793 case 2: m_possibleBootItems << KDeviceType_DVD; break;794 case 3: m_possibleBootItems << KDeviceType_HardDisk; break;795 case 4: m_possibleBootItems << KDeviceType_Network; break;796 default: break;797 }798 }799 }800 773 } 801 774 … … 1026 999 } 1027 1000 1028 UIBootItemDataList UIMachineSettingsSystem::loadBootItems(const CMachine &comMachine)1029 {1030 /* Prepare boot items: */1031 UIBootItemDataList bootItems;1032 1033 /* Gather boot-items of current VM: */1034 QList<KDeviceType> usedBootItems;1035 for (int i = 1; i <= m_possibleBootItems.size(); ++i)1036 {1037 const KDeviceType enmType = comMachine.GetBootOrder(i);1038 if (enmType != KDeviceType_Null)1039 {1040 usedBootItems << enmType;1041 UIBootItemData data;1042 data.m_enmType = enmType;1043 data.m_fEnabled = true;1044 bootItems << data;1045 }1046 }1047 /* Gather other unique boot-items: */1048 for (int i = 0; i < m_possibleBootItems.size(); ++i)1049 {1050 const KDeviceType enmType = m_possibleBootItems[i];1051 if (!usedBootItems.contains(enmType))1052 {1053 UIBootItemData data;1054 data.m_enmType = enmType;1055 data.m_fEnabled = false;1056 bootItems << data;1057 }1058 }1059 1060 /* Return boot items: */1061 return bootItems;1062 }1063 1064 void UIMachineSettingsSystem::saveBootItems(const UIBootItemDataList &bootItems, CMachine &comMachine)1065 {1066 bool fSuccess = true;1067 int iBootIndex = 0;1068 for (int i = 0; fSuccess && i < bootItems.size(); ++i)1069 {1070 if (bootItems.at(i).m_fEnabled)1071 {1072 comMachine.SetBootOrder(++iBootIndex, bootItems.at(i).m_enmType);1073 fSuccess = comMachine.isOk();1074 }1075 }1076 for (int i = 0; fSuccess && i < bootItems.size(); ++i)1077 {1078 if (!bootItems.at(i).m_fEnabled)1079 {1080 comMachine.SetBootOrder(++iBootIndex, KDeviceType_Null);1081 fSuccess = comMachine.isOk();1082 }1083 }1084 }1085 1086 1001 bool UIMachineSettingsSystem::saveSystemData() 1087 1002 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r79976 r79981 143 143 void retranslateComboParavirtProvider(); 144 144 145 /** Loads boot item list for passed @a comMachine. */146 UIBootItemDataList loadBootItems(const CMachine &comMachine);147 /** Saves @a bootItems list to passed @a comMachine. */148 void saveBootItems(const UIBootItemDataList &bootItems, CMachine &comMachine);149 150 145 /** Saves existing system data from the cache. */ 151 146 bool saveSystemData(); … … 156 151 /** Saves existing 'Acceleration' data from the cache. */ 157 152 bool saveAccelerationData(); 158 159 /** Holds the list of all possible boot items. */160 QList<KDeviceType> m_possibleBootItems;161 153 162 154 /** Holds the minimum guest CPU count. */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootOrderEditor.cpp
r79979 r79981 23 23 /* GUI includes: */ 24 24 #include "UIBootOrderEditor.h" 25 #include "UICommon.h" 25 26 #include "UIConverter.h" 26 27 #include "UIIconPool.h" 27 28 #include "UIToolBar.h" 29 30 /* COM includes: */ 31 #include "COMEnums.h" 32 #include "CMachine.h" 33 #include "CSystemProperties.h" 28 34 29 35 … … 283 289 284 290 /********************************************************************************************************************************* 291 * Class UIBootDataTools implementation. * 292 *********************************************************************************************************************************/ 293 294 UIBootItemDataList UIBootDataTools::loadBootItems(const CMachine &comMachine) 295 { 296 /* Gather a list of all possible boot items. 297 * Currently, it seems, we are supporting only 4 possible boot device types: 298 * 1. Floppy, 2. DVD-ROM, 3. Hard Disk, 4. Network. 299 * But maximum boot devices count supported by machine should be retrieved 300 * through the ISystemProperties getter. Moreover, possible boot device 301 * types are not listed in some separate Main vector, so we should get them 302 * (randomely?) from the list of all device types. Until there will be a 303 * separate Main getter for list of supported boot device types, this list 304 * will be hard-coded here... */ 305 QVector<KDeviceType> possibleBootItems = QVector<KDeviceType>() << KDeviceType_Floppy 306 << KDeviceType_DVD 307 << KDeviceType_HardDisk 308 << KDeviceType_Network; 309 const CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 310 const int iPossibleBootListSize = qMin((ULONG)4, comProperties.GetMaxBootPosition()); 311 possibleBootItems.resize(iPossibleBootListSize); 312 313 /* Prepare boot items: */ 314 UIBootItemDataList bootItems; 315 316 /* Gather boot-items of current VM: */ 317 QList<KDeviceType> usedBootItems; 318 for (int i = 1; i <= possibleBootItems.size(); ++i) 319 { 320 const KDeviceType enmType = comMachine.GetBootOrder(i); 321 if (enmType != KDeviceType_Null) 322 { 323 usedBootItems << enmType; 324 UIBootItemData data; 325 data.m_enmType = enmType; 326 data.m_fEnabled = true; 327 bootItems << data; 328 } 329 } 330 /* Gather other unique boot-items: */ 331 for (int i = 0; i < possibleBootItems.size(); ++i) 332 { 333 const KDeviceType enmType = possibleBootItems.at(i); 334 if (!usedBootItems.contains(enmType)) 335 { 336 UIBootItemData data; 337 data.m_enmType = enmType; 338 data.m_fEnabled = false; 339 bootItems << data; 340 } 341 } 342 343 /* Return boot items: */ 344 return bootItems; 345 } 346 347 void UIBootDataTools::saveBootItems(const UIBootItemDataList &bootItems, CMachine &comMachine) 348 { 349 bool fSuccess = true; 350 int iBootIndex = 0; 351 for (int i = 0; fSuccess && i < bootItems.size(); ++i) 352 { 353 if (bootItems.at(i).m_fEnabled) 354 { 355 comMachine.SetBootOrder(++iBootIndex, bootItems.at(i).m_enmType); 356 fSuccess = comMachine.isOk(); 357 } 358 } 359 for (int i = 0; fSuccess && i < bootItems.size(); ++i) 360 { 361 if (!bootItems.at(i).m_fEnabled) 362 { 363 comMachine.SetBootOrder(++iBootIndex, KDeviceType_Null); 364 fSuccess = comMachine.isOk(); 365 } 366 } 367 } 368 369 370 /********************************************************************************************************************************* 285 371 * Class UIBootOrderEditor implementation. * 286 372 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootOrderEditor.h
r79979 r79981 36 36 class UIToolBar; 37 37 class UIBootListWidget; 38 class CMachine; 38 39 39 40 … … 62 63 }; 63 64 typedef QList<UIBootItemData> UIBootItemDataList; 65 66 67 /** Boot data tools namespace. */ 68 namespace UIBootDataTools 69 { 70 /** Loads boot item list for passed @a comMachine. */ 71 SHARED_LIBRARY_STUFF UIBootItemDataList loadBootItems(const CMachine &comMachine); 72 /** Saves @a bootItems list to passed @a comMachine. */ 73 SHARED_LIBRARY_STUFF void saveBootItems(const UIBootItemDataList &bootItems, CMachine &comMachine); 74 } 75 using namespace UIBootDataTools; 64 76 65 77
Note:
See TracChangeset
for help on using the changeset viewer.