- Timestamp:
- Sep 26, 2023 3:37:01 PM (16 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSTypeII.cpp
r101265 r101272 133 133 } 134 134 135 ULONG UIGuestOSTypeManager::getRecommendedRAM(const QString &strTypeId) const 136 { 137 if (strTypeId.isEmpty()) 138 return 0; 139 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 140 { 141 if (type.getId() == strTypeId) 142 return type.getRecommendedRAM(); 143 } 144 return 0; 145 } 146 147 ULONG UIGuestOSTypeManager::getRecommendedCPUCount(const QString &strTypeId) const 148 { 149 if (strTypeId.isEmpty()) 150 return 0; 151 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 152 { 153 if (type.getId() == strTypeId) 154 return type.getRecommendedCPUCount(); 155 } 156 return 0; 157 } 158 159 KFirmwareType UIGuestOSTypeManager::getRecommendedFirmware(const QString &strTypeId) const 160 { 161 if (strTypeId.isEmpty()) 162 return KFirmwareType_Max; 163 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 164 { 165 if (type.getId() == strTypeId) 166 return type.getRecommendedFirmware(); 167 } 168 return KFirmwareType_Max; 169 } 170 171 QString UIGuestOSTypeManager::getDescription(const QString &strTypeId) const 172 { 173 if (strTypeId.isEmpty()) 174 return QString(); 175 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 176 { 177 if (type.getId() == strTypeId) 178 return type.getDescription(); 179 } 180 return QString(); 181 } 182 183 LONG64 UIGuestOSTypeManager::getRecommendedHDD(const QString &strTypeId) const 184 { 185 if (strTypeId.isEmpty()) 186 return 0; 187 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 188 { 189 if (type.getId() == strTypeId) 190 return type.getRecommendedHDD(); 191 } 192 return 0; 193 } 194 195 KStorageBus UIGuestOSTypeManager::getRecommendedHDStorageBus(const QString &strTypeId) const 196 { 197 if (strTypeId.isEmpty()) 198 return KStorageBus_Null; 199 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 200 { 201 if (type.getId() == strTypeId) 202 return type.getRecommendedHDStorageBus(); 203 } 204 return KStorageBus_Null; 205 } 206 207 KStorageBus UIGuestOSTypeManager::getRecommendedDVDStorageBus(const QString &strTypeId) const 208 { 209 if (strTypeId.isEmpty()) 210 return KStorageBus_Null; 211 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 212 { 213 if (type.getId() == strTypeId) 214 return type.getRecommendedDVDStorageBus(); 215 } 216 return KStorageBus_Null; 217 } 218 219 220 bool UIGuestOSTypeManager::getRecommendedFloppy(const QString &strTypeId) const 221 { 222 if (strTypeId.isEmpty()) 223 return false; 224 foreach (const UIGuestOSTypeII &type, m_guestOSTypes) 225 { 226 if (type.getId() == strTypeId) 227 return type.getRecommendedFloppy(); 228 } 229 return false; 230 } 231 135 232 UIGuestOSTypeII::UIGuestOSTypeII() 136 233 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIGuestOSTypeII.h
r101265 r101272 45 45 46 46 47 class UIGuestOSTypeManager47 class SHARED_LIBRARY_STUFF UIGuestOSTypeManager 48 48 { 49 49 … … 64 64 65 65 KGraphicsControllerType getRecommendedGraphicsController(const QString &strTypeId) const; 66 ULONG getRecommendedRAM(const QString &strTypeId) const; 67 ULONG getRecommendedCPUCount(const QString &strTypeId) const; 68 KFirmwareType getRecommendedFirmware(const QString &strTypeId) const; 69 QString getDescription(const QString &strTypeId) const; 70 LONG64 getRecommendedHDD(const QString &strTypeId) const; 71 KStorageBus getRecommendedHDStorageBus(const QString &strTypeId) const; 72 KStorageBus getRecommendedDVDStorageBus(const QString &strTypeId) const; 73 bool getRecommendedFloppy(const QString &strTypeId) const; 66 74 67 75 private: -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r101263 r101272 326 326 // } 327 327 328 UIGuestOSTypeII UINameAndSystemEditor::type() const329 {330 const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager();331 AssertReturn(pGuestOSTypeManager, UIGuestOSTypeII());332 return pGuestOSTypeManager->findGuestTypeById(m_strTypeId);333 }328 // UIGuestOSTypeII UINameAndSystemEditor::type() const 329 // { 330 // const UIGuestOSTypeManager * const pGuestOSTypeManager = uiCommon().guestOSTypeManager(); 331 // AssertReturn(pGuestOSTypeManager, UIGuestOSTypeII()); 332 // return pGuestOSTypeManager->findGuestTypeById(m_strTypeId); 333 // } 334 334 335 335 void UINameAndSystemEditor::markNameEditor(bool fError) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r101263 r101272 131 131 132 132 /** Returns the VM OS type. */ 133 UIGuestOSTypeII type() const;133 //UIGuestOSTypeII type() const; 134 134 135 135 /** Passes the @p fError to QILineEdit::mark(bool) effectively marking it for error. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r101253 r101272 32 32 /* GUI includes: */ 33 33 #include "UICommon.h" 34 #include "UIGuestOSTypeII.h" 34 35 #include "UIMedium.h" 35 36 #include "UINotificationCenter.h" … … 149 150 { 150 151 CVirtualBox vbox = uiCommon().virtualBox(); 151 QString strTypeId = m_guestOSType.getId();152 152 153 153 /* Create virtual machine: */ … … 160 160 m_strMachineBaseName, 161 161 KPlatformArchitecture_x86, 162 groups, strTypeId, QString(),162 groups, m_guestOSTypeId, QString(), 163 163 QString(), QString(), QString()); 164 164 if (!vbox.isOk()) … … 180 180 /* Correct the VRAM size since API does not take fullscreen memory requirements into account: */ 181 181 CGraphicsAdapter comGraphics = m_machine.GetGraphicsAdapter(); 182 comGraphics.SetVRAMSize(qMax(comGraphics.GetVRAMSize(), (ULONG)(UICommon::requiredVideoMemory( strTypeId) / _1M)));182 comGraphics.SetVRAMSize(qMax(comGraphics.GetVRAMSize(), (ULONG)(UICommon::requiredVideoMemory(m_guestOSTypeId) / _1M))); 183 183 /* Enabled I/O APIC explicitly in we have more than 1 VCPU: */ 184 184 if (iVPUCount > 1) … … 279 279 QUuid uMachineId = m_machine.GetId(); 280 280 CSession session = uiCommon().openSession(uMachineId); 281 if (!session.isNull()) 281 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 282 if (!session.isNull() && pManager) 282 283 { 283 284 CMachine machine = session.GetMachine(); 284 285 if (!m_virtualDisk.isNull()) 285 286 { 286 KStorageBus enmHDDBus = m_guestOSType.getRecommendedHDStorageBus();287 KStorageBus enmHDDBus = pManager->getRecommendedHDStorageBus(m_guestOSTypeId); 287 288 CStorageController comHDDController = m_machine.GetStorageControllerByInstance(enmHDDBus, 0); 288 289 if (!comHDDController.isNull()) … … 296 297 297 298 /* Attach optical drive: */ 298 KStorageBus enmDVDBus = m_guestOSType.getRecommendedDVDStorageBus();299 KStorageBus enmDVDBus = pManager->getRecommendedDVDStorageBus(m_guestOSTypeId); 299 300 CStorageController comDVDController = m_machine.GetStorageControllerByInstance(enmDVDBus, 0); 300 301 if (!comDVDController.isNull()) … … 317 318 318 319 /* Attach an empty floppy drive if recommended */ 319 if (m_guestOSType.getRecommendedFloppy()) { 320 if (pManager->getRecommendedFloppy(m_guestOSTypeId)) 321 { 320 322 CStorageController comFloppyController = m_machine.GetStorageControllerByInstance(KStorageBus_Floppy, 0); 321 323 if (!comFloppyController.isNull()) … … 523 525 } 524 526 525 const UIGuestOSTypeII &UIWizardNewVM::guestOSType() const526 { 527 return m_guestOSType ;528 } 529 530 void UIWizardNewVM::setGuestOSType (const UIGuestOSTypeII &guestOSType)531 { 532 m_guestOSType = guestOSType;527 const QString &UIWizardNewVM::guestOSTypeId() const 528 { 529 return m_guestOSTypeId; 530 } 531 532 void UIWizardNewVM::setGuestOSTypeId(const QString &guestOSTypeId) 533 { 534 m_guestOSTypeId = guestOSTypeId; 533 535 } 534 536 … … 789 791 } 790 792 return variants; 793 } 794 795 QString UIWizardNewVM::getGuestOSTypeDescription() const 796 { 797 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 798 if (!pManager) 799 return QString(); 800 return pManager->getDescription(m_guestOSTypeId); 791 801 } 792 802 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
r101253 r101272 33 33 34 34 /* GUI includes: */ 35 #include "UIGuestOSTypeII.h"36 35 #include "UINativeWizard.h" 37 36 … … 104 103 void setGuestOSFamilyId(const QString &strGuestOSFamilyId); 105 104 106 const UIGuestOSTypeII &guestOSType() const;107 void setGuestOSType (const UIGuestOSTypeII&guestOSType);105 const QString &guestOSTypeId() const; 106 void setGuestOSTypeId(const QString &guestOSType); 108 107 109 108 bool installGuestAdditions() const; … … 163 162 void setDetectedWindowsImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids); 164 163 const QVector<QString> &detectedWindowsImageNames() const; 165 const QVector<ulong> &detectedWindowsImageIndices() const;164 const QVector<ulong> &detectedWindowsImageIndices() const; 166 165 167 166 void setSelectedWindowImageIndex(ulong uIndex); … … 169 168 170 169 QVector<KMediumVariant> mediumVariants() const; 170 171 QString getGuestOSTypeDescription() const; 171 172 /** @} */ 172 173 … … 219 220 QString m_strGuestOSFamilyId; 220 221 /** Holds the VM OS type. */ 221 UIGuestOSTypeII m_guestOSType;222 QString m_guestOSTypeId; 222 223 223 224 /** True if guest additions are to be installed during unattended install. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPage.cpp
r101253 r101272 37 37 #include "QIToolButton.h" 38 38 #include "UIIconPool.h" 39 #include "UIGuestOSTypeII.h" 39 40 #include "UIMediaComboBox.h" 40 41 #include "UIMediumSelector.h" … … 47 48 /* COM includes: */ 48 49 #include "COMEnums.h" 49 #include "CGuestOSType.h"50 50 #include "CSystemProperties.h" 51 51 … … 206 206 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); 207 207 AssertReturnVoid(pWizard); 208 const UIGuestOSTypeII &OSType = pWizard->guestOSType(); 209 210 QUuid uMediumId = UIWizardNewVMDiskCommon::getWithFileOpenDialog(OSType.getId(), 208 209 QUuid uMediumId = UIWizardNewVMDiskCommon::getWithFileOpenDialog(pWizard->guestOSTypeId(), 211 210 pWizard->machineFolder(), 212 211 this, m_pActionPool); … … 266 265 267 266 LONG64 iRecommendedSize = 0; 268 const UIGuestOSType II &type = pWizard->guestOSType();269 if ( !type.isOk()&& !m_userModifiedParameters.contains("SelectedDiskSource"))270 { 271 iRecommendedSize = type.getRecommendedHDD();267 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 268 if (pManager && !m_userModifiedParameters.contains("SelectedDiskSource")) 269 { 270 iRecommendedSize = pManager->getRecommendedHDD(pWizard->guestOSTypeId()); 272 271 if (iRecommendedSize != 0) 273 272 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp
r101253 r101272 110 110 if (UIWizardNewVMNameOSTypeCommon::guessOSTypeFromName(m_pNameAndSystemEditor, strNewName)) 111 111 { 112 wizardWindow<UIWizardNewVM>()->setGuestOSType (m_pNameAndSystemEditor->type());112 wizardWindow<UIWizardNewVM>()->setGuestOSTypeId(m_pNameAndSystemEditor->typeId()); 113 113 /* Since the type `possibly` changed: */ 114 114 setOSTypeDependedValues(); … … 140 140 //m_userModifiedParameters << "GuestOSType"; 141 141 if (m_pNameAndSystemEditor) 142 wizardWindow<UIWizardNewVM>()->setGuestOSType (m_pNameAndSystemEditor->type());142 wizardWindow<UIWizardNewVM>()->setGuestOSTypeId(m_pNameAndSystemEditor->typeId()); 143 143 setOSTypeDependedValues(); 144 144 } … … 148 148 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); 149 149 AssertReturnVoid(pWizard); 150 const UIGuestOSTypeII &OSType = pWizard->guestOSType(); 151 AssertReturnVoid(!OSType.isOk()); 152 QUuid uMediumId = UIWizardNewVMDiskCommon::getWithFileOpenDialog(OSType.getId(), 150 QUuid uMediumId = UIWizardNewVMDiskCommon::getWithFileOpenDialog(pWizard->guestOSTypeId(), 153 151 pWizard->machineFolder(), 154 152 this, m_pActionPool); … … 345 343 { 346 344 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); 345 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 347 346 AssertReturnVoid(pWizard); 348 347 AssertReturnVoid(pManager); 348 349 QString strTypeId = pWizard->guestOSTypeId(); 349 350 /* Get recommended 'ram' field value: */ 350 const UIGuestOSTypeII &type = pWizard->guestOSType(); 351 ULONG recommendedRam = type.getRecommendedRAM(); 351 ULONG recommendedRam = pManager->getRecommendedRAM(strTypeId); 352 352 353 353 if (m_pHardwareWidgetContainer) … … 363 363 364 364 /* Set Firmware Type of the widget and the wizard: */ 365 KFirmwareType fwType = type.getRecommendedFirmware();365 KFirmwareType fwType = pManager->getRecommendedFirmware(strTypeId); 366 366 if (!m_userModifiedParameters.contains("EFIEnabled")) 367 367 { … … 371 371 372 372 /* Initialize CPU count:*/ 373 int iCPUCount = type.getRecommendedCPUCount();373 int iCPUCount = pManager->getRecommendedCPUCount(strTypeId); 374 374 if (!m_userModifiedParameters.contains("CPUCount")) 375 375 { … … 380 380 } 381 381 382 LONG64 iRecommendedDiskSize = type.getRecommendedHDD();382 LONG64 iRecommendedDiskSize = pManager->getRecommendedHDD(strTypeId); 383 383 /* Prepare initial disk choice: */ 384 384 if (!m_userModifiedParameters.contains("SelectedDiskSource")) … … 425 425 /* Guest OS type: */ 426 426 pWizard->setGuestOSFamilyId(m_pNameAndSystemEditor->familyId()); 427 pWizard->setGuestOSType (m_pNameAndSystemEditor->type());427 pWizard->setGuestOSTypeId(m_pNameAndSystemEditor->typeId()); 428 428 /* Vm name, folder, file path etc. will be initilized by composeMachineFilePath: */ 429 429 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePage.cpp
r101253 r101272 32 32 #include "QIRichTextLabel.h" 33 33 #include "UIBaseMemoryEditor.h" 34 #include "UIGuestOSTypeII.h" 34 35 #include "UIVirtualCPUEditor.h" 35 36 #include "UIWizardNewVM.h" … … 37 38 #include "UIWizardNewVMHardwarePage.h" 38 39 39 /* COM includes: */40 #include "CGuestOSType.h"41 40 42 41 UIWizardNewVMHardwarePage::UIWizardNewVMHardwarePage() … … 89 88 90 89 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); 91 if (pWizard && m_pHardwareWidgetContainer) 90 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 91 92 if (pManager && pWizard && m_pHardwareWidgetContainer) 92 93 { 93 const UIGuestOSTypeII &type = pWizard->guestOSType();94 const QString &strTypeId = pWizard->guestOSTypeId(); 94 95 95 96 m_pHardwareWidgetContainer->blockSignals(true); 96 97 if (!m_userModifiedParameters.contains("MemorySize")) 97 98 { 98 ULONG recommendedRam = type.getRecommendedRAM();99 ULONG recommendedRam = pManager->getRecommendedRAM(strTypeId); 99 100 m_pHardwareWidgetContainer->setMemorySize(recommendedRam); 100 101 pWizard->setMemorySize(recommendedRam); … … 102 103 if (!m_userModifiedParameters.contains("CPUCount")) 103 104 { 104 ULONG recommendedCPUs = type.getRecommendedCPUCount();105 ULONG recommendedCPUs = pManager->getRecommendedCPUCount(strTypeId); 105 106 m_pHardwareWidgetContainer->setCPUCount(recommendedCPUs); 106 107 pWizard->setCPUCount(recommendedCPUs); … … 108 109 if (!m_userModifiedParameters.contains("EFIEnabled")) 109 110 { 110 KFirmwareType fwType = type.getRecommendedFirmware();111 KFirmwareType fwType = pManager->getRecommendedFirmware(strTypeId); 111 112 m_pHardwareWidgetContainer->setEFIEnabled(fwType != KFirmwareType_BIOS); 112 113 pWizard->setEFIEnabled(fwType != KFirmwareType_BIOS); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp
r101232 r101272 480 480 if (UIWizardNewVMNameOSTypeCommon::guessOSTypeFromName(m_pNameAndSystemEditor, strNewName)) 481 481 { 482 wizardWindow<UIWizardNewVM>()->setGuestOSType (m_pNameAndSystemEditor->type());482 wizardWindow<UIWizardNewVM>()->setGuestOSTypeId(m_pNameAndSystemEditor->typeId()); 483 483 m_userModifiedParameters << "GuestOSTypeFromName"; 484 484 } … … 500 500 //m_userModifiedParameters << "GuestOSType"; 501 501 if (m_pNameAndSystemEditor) 502 wizardWindow<UIWizardNewVM>()->setGuestOSType (m_pNameAndSystemEditor->type());502 wizardWindow<UIWizardNewVM>()->setGuestOSTypeId(m_pNameAndSystemEditor->typeId()); 503 503 } 504 504 … … 591 591 { 592 592 pWizard->setGuestOSFamilyId(m_pNameAndSystemEditor->familyId()); 593 pWizard->setGuestOSType (m_pNameAndSystemEditor->type());593 pWizard->setGuestOSTypeId(m_pNameAndSystemEditor->typeId()); 594 594 /* Vm name, folder, file path etc. will be initilized by composeMachineFilePath: */ 595 595 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMSummaryPage.cpp
r101253 r101272 36 36 #include "QITreeView.h" 37 37 #include "UIIconPool.h" 38 #include "UIGuestOSTypeII.h" 38 39 #include "UIMessageCenter.h" 39 40 #include "UINotificationCenter.h" … … 354 355 pNameRoot->addChild(UIWizardNewVM::tr("Machine Folder"), pWizard->machineFolder()); 355 356 pNameRoot->addChild(UIWizardNewVM::tr("ISO Image"), pWizard->ISOFilePath()); 356 pNameRoot->addChild(UIWizardNewVM::tr("Guest OS Type"), pWizard->guestOSType().getDescription()); 357 const UIGuestOSTypeManager *pManager = uiCommon().guestOSTypeManager(); 358 if (pManager) 359 pNameRoot->addChild(UIWizardNewVM::tr("Guest OS Type"), pManager->getDescription(pWizard->guestOSTypeId())); 357 360 358 361 const QString &ISOPath = pWizard->ISOFilePath();
Note:
See TracChangeset
for help on using the changeset viewer.