Changeset 84869 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 18, 2020 9:33:37 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r84861 r84869 29 29 #include "UICloudProfileManager.h" 30 30 #include "UIDesktopServices.h" 31 #include "UIErrorString.h" 31 32 #include "UIExtraDataManager.h" 32 33 #include "UIHostNetworkManager.h" … … 65 66 /* COM includes: */ 66 67 #include "CSystemProperties.h" 68 #include "CUnattended.h" 69 #include "CVirtualBoxErrorInfo.h" 67 70 68 71 /* Other VBox stuff: */ … … 72 75 # include <iprt/env.h> 73 76 #endif /* VBOX_WS_X11 */ 77 78 #define checkUnattendedInstallError(comUnattendedInstaller) \ 79 do { \ 80 if (!comUnattendedInstaller.isOk()) \ 81 { \ 82 COMErrorInfo comErrorInfo = comUnattendedInstaller.errorInfo(); \ 83 QString strErrorInfo = UIErrorString::formatErrorInfo(comErrorInfo); \ 84 printf("unattended install error %s\n", qPrintable(strErrorInfo)); \ 85 return; \ 86 } \ 87 } while (0) 74 88 75 89 … … 599 613 pWizard->exec(); 600 614 615 /* Cache unattended install related info and delete the wizard before handling the unattended install stuff: */ 616 bool fUnattendedEnabled = pWizard->isUnattendedInstallEnabled(); 617 QUuid uMachineUid = pWizard->createdMachineId(); 618 QString strISOPath = pWizard->unattendedISOFilePath(); 619 bool fStartHeadless = pWizard->startHeadless(); 601 620 602 621 delete pWizard; 622 /* Handle unattended install stuff: */ 623 if (fUnattendedEnabled) 624 startUnattendedInstall(uMachineUid, strISOPath, fStartHeadless); 603 625 } 604 626 /* For cloud machine: */ … … 1849 1871 } 1850 1872 1873 void UIVirtualBoxManager::startUnattendedInstall(const QUuid &uMachineUid, const QString &strISOPath, bool fStartHeadless) 1874 { 1875 if (!QFileInfo(strISOPath).exists()) 1876 { 1877 /// @todo Show a relavant error message here 1878 return; 1879 } 1880 1881 CVirtualBox comVBox = uiCommon().virtualBox(); 1882 CUnattended comUnattendedInstaller = comVBox.CreateUnattendedInstaller(); 1883 AssertMsgReturnVoid(!comUnattendedInstaller.isNull(), ("Could not create unattended installer!\n")); 1884 CMachine comMachine = comVBox.FindMachine(uMachineUid.toString()); 1885 AssertMsgReturnVoid(!comMachine.isNull(), ("Failed to find CMachine for the uuid %u!\n", uMachineUid)); 1886 1887 comUnattendedInstaller.SetIsoPath(strISOPath); 1888 checkUnattendedInstallError(comUnattendedInstaller); 1889 comUnattendedInstaller.SetMachine(comMachine); 1890 checkUnattendedInstallError(comUnattendedInstaller); 1891 comUnattendedInstaller.Prepare(); 1892 checkUnattendedInstallError(comUnattendedInstaller); 1893 comUnattendedInstaller.ConstructMedia(); 1894 checkUnattendedInstallError(comUnattendedInstaller); 1895 comUnattendedInstaller.ReconfigureVM(); 1896 checkUnattendedInstallError(comUnattendedInstaller); 1897 1898 UICommon::LaunchMode enmLaunchMode = UICommon::LaunchMode_Default; 1899 if (fStartHeadless) 1900 enmLaunchMode = UICommon::LaunchMode_Headless; 1901 uiCommon().launchMachine(comMachine, enmLaunchMode); 1902 } 1903 1851 1904 void UIVirtualBoxManager::performStartOrShowVirtualMachines(const QList<UIVirtualMachineItem*> &items, UICommon::LaunchMode enmLaunchMode) 1852 1905 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r84558 r84869 335 335 /** Opens add machine dialog specifying initial name with @a strFileName. */ 336 336 void openAddMachineDialog(const QString &strFileName = QString()); 337 /** Creates an uattended installer and uses that to install guest os to newly created vm. */ 338 void startUnattendedInstall(const QUuid &uMachineUid, const QString &strISOPath, bool fStartHeadless); 337 339 /** @} */ 338 340 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r84861 r84869 117 117 * 1. if we don't attach any virtual hard-drive 118 118 * 2. or attach a new (empty) one. 119 * 3. and if the unattended install is not enabled 119 120 * Usually we are assigning extra-data values through UIExtraDataManager, 120 121 * but in that special case VM was not registered yet, so UIExtraDataManager is unaware of it: */ 121 if (field("virtualDiskId").toString().isNull() || !field("virtualDisk").value<CMedium>().isNull()) 122 if (!isUnattendedInstallEnabled() && 123 (field("virtualDiskId").toString().isNull() || !field("virtualDisk").value<CMedium>().isNull())) 122 124 m_machine.SetExtraData(GUI_FirstRun, "yes"); 123 125 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
r84861 r84869 59 59 /** Returns the Id of newly created VM. */ 60 60 QUuid createdMachineId() const { return m_machine.GetId(); } 61 QString unattendedISOFilePath() const; 62 bool isUnattendedInstallEnabled() const; 63 bool startHeadless() const; 61 64 62 65 protected: … … 72 75 friend class UIWizardNewVMPageBasic3; 73 76 friend class UIWizardNewVMPageExpert; 74 75 QString unattendedISOFilePath() const;76 bool isUnattendedInstallEnabled() const;77 bool startHeadless() const;78 79 77 80 78 private slots:
Note:
See TracChangeset
for help on using the changeset viewer.