1 | /* $Id: UIWizardNewVM.h 103982 2024-03-21 11:43:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardNewVM class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVM_h
|
---|
29 | #define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVM_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UINativeWizard.h"
|
---|
36 |
|
---|
37 | /* COM includes: */
|
---|
38 | #include "CMachine.h"
|
---|
39 | #include "CMedium.h"
|
---|
40 | #include "CMediumFormat.h"
|
---|
41 | #include "CUnattended.h"
|
---|
42 |
|
---|
43 | /* Forward declarations: */
|
---|
44 | class UIActionPool;
|
---|
45 |
|
---|
46 | enum SelectedDiskSource
|
---|
47 | {
|
---|
48 | SelectedDiskSource_Empty = 0,
|
---|
49 | SelectedDiskSource_New,
|
---|
50 | SelectedDiskSource_Existing,
|
---|
51 | SelectedDiskSource_Max
|
---|
52 | };
|
---|
53 |
|
---|
54 | /** New Virtual Machine wizard: */
|
---|
55 | class UIWizardNewVM : public UINativeWizard
|
---|
56 | {
|
---|
57 | Q_OBJECT;
|
---|
58 |
|
---|
59 | public:
|
---|
60 |
|
---|
61 | UIWizardNewVM(QWidget *pParent,
|
---|
62 | UIActionPool *pActionPool,
|
---|
63 | const QString &strMachineGroup,
|
---|
64 | const QString &strISOFilePath = QString());
|
---|
65 |
|
---|
66 | bool isUnattendedEnabled() const;
|
---|
67 | bool isUnattendedInstallSupported() const;
|
---|
68 | bool isGuestOSTypeWindows() const;
|
---|
69 |
|
---|
70 | bool createVM();
|
---|
71 | bool createVirtualDisk();
|
---|
72 |
|
---|
73 | CMedium &virtualDisk();
|
---|
74 | void setVirtualDisk(const CMedium &medium);
|
---|
75 | void setVirtualDisk(const QUuid &mediumId);
|
---|
76 |
|
---|
77 | const QString &machineGroup() const;
|
---|
78 | QUuid createdMachineId() const;
|
---|
79 |
|
---|
80 | CUnattended installer() const { return m_comUnattended; }
|
---|
81 |
|
---|
82 | /** @name Setter/getters for vm parameters
|
---|
83 | * @{ */
|
---|
84 | const QString &machineFilePath() const;
|
---|
85 | void setMachineFilePath(const QString &strMachineFilePath);
|
---|
86 |
|
---|
87 | /* The name of the .vbox file. Obtained from machineFilePath(). Unlike machine base name it cannot have characters like / etc. */
|
---|
88 | QString machineFileName() const;
|
---|
89 |
|
---|
90 | const QString &machineFolder() const;
|
---|
91 | void setMachineFolder(const QString &strMachineFolder);
|
---|
92 |
|
---|
93 | const QString &machineBaseName() const;
|
---|
94 | void setMachineBaseName(const QString &strMachineBaseName);
|
---|
95 |
|
---|
96 | const QString &createdMachineFolder() const;
|
---|
97 | void setCreatedMachineFolder(const QString &strCreatedMachineFolder);
|
---|
98 |
|
---|
99 | QString detectedOSTypeId() const;
|
---|
100 |
|
---|
101 | const QString &guestOSFamilyId() const;
|
---|
102 | void setGuestOSFamilyId(const QString &strGuestOSFamilyId);
|
---|
103 |
|
---|
104 | const QString &guestOSTypeId() const;
|
---|
105 | void setGuestOSTypeId(const QString &guestOSType);
|
---|
106 |
|
---|
107 | bool installGuestAdditions() const;
|
---|
108 | void setInstallGuestAdditions(bool fInstallGA);
|
---|
109 |
|
---|
110 | bool startHeadless() const;
|
---|
111 | void setStartHeadless(bool fStartHeadless);
|
---|
112 |
|
---|
113 | bool skipUnattendedInstall() const;
|
---|
114 | void setSkipUnattendedInstall(bool fSkipUnattendedInstall);
|
---|
115 |
|
---|
116 | bool EFIEnabled() const;
|
---|
117 | void setEFIEnabled(bool fEnabled);
|
---|
118 |
|
---|
119 | QString ISOFilePath() const;
|
---|
120 | void setISOFilePath(const QString &strISOFilePath);
|
---|
121 |
|
---|
122 | QString userName() const;
|
---|
123 | void setUserName(const QString &strUserName);
|
---|
124 |
|
---|
125 | QString password() const;
|
---|
126 | void setPassword(const QString &strPassword);
|
---|
127 |
|
---|
128 | QString guestAdditionsISOPath() const;
|
---|
129 | void setGuestAdditionsISOPath(const QString &strGAISOPath);
|
---|
130 |
|
---|
131 | QString hostnameDomainName() const;
|
---|
132 | void setHostnameDomainName(const QString &strHostnameDomainName);
|
---|
133 |
|
---|
134 | QString productKey() const;
|
---|
135 | void setProductKey(const QString &productKey);
|
---|
136 |
|
---|
137 | int CPUCount() const;
|
---|
138 | void setCPUCount(int iCPUCount);
|
---|
139 |
|
---|
140 | int memorySize() const;
|
---|
141 | void setMemorySize(int iMemory);
|
---|
142 |
|
---|
143 | qulonglong mediumVariant() const;
|
---|
144 | void setMediumVariant(qulonglong uMediumVariant);
|
---|
145 |
|
---|
146 | const CMediumFormat &mediumFormat();
|
---|
147 | void setMediumFormat(const CMediumFormat &mediumFormat);
|
---|
148 |
|
---|
149 | const QString &mediumPath() const;
|
---|
150 | void setMediumPath(const QString &strMediumPath);
|
---|
151 |
|
---|
152 | qulonglong mediumSize() const;
|
---|
153 | void setMediumSize(qulonglong mediumSize);
|
---|
154 |
|
---|
155 | SelectedDiskSource diskSource() const;
|
---|
156 | void setDiskSource(SelectedDiskSource enmDiskSource);
|
---|
157 |
|
---|
158 | bool emptyDiskRecommended() const;
|
---|
159 | void setEmptyDiskRecommended(bool fEmptyDiskRecommended);
|
---|
160 |
|
---|
161 | void setDetectedWindowsImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids);
|
---|
162 | const QVector<QString> &detectedWindowsImageNames() const;
|
---|
163 | const QVector<ulong> &detectedWindowsImageIndices() const;
|
---|
164 |
|
---|
165 | void setSelectedWindowImageIndex(ulong uIndex);
|
---|
166 | ulong selectedWindowImageIndex() const;
|
---|
167 |
|
---|
168 | QVector<KMediumVariant> mediumVariants() const;
|
---|
169 |
|
---|
170 | QString getGuestOSTypeDescription() const;
|
---|
171 | /** @} */
|
---|
172 |
|
---|
173 | protected:
|
---|
174 |
|
---|
175 | /** Populates pages. */
|
---|
176 | virtual void populatePages() RT_OVERRIDE RT_FINAL;
|
---|
177 | virtual void cleanWizard() RT_OVERRIDE RT_FINAL;
|
---|
178 | bool attachDefaultDevices();
|
---|
179 |
|
---|
180 | private slots:
|
---|
181 |
|
---|
182 | void sltHandleWizardCancel();
|
---|
183 | virtual void sltRetranslateUI() RT_OVERRIDE RT_FINAL;
|
---|
184 |
|
---|
185 | private:
|
---|
186 |
|
---|
187 | QString getNextControllerName(KStorageBus type);
|
---|
188 | void setUnattendedPageVisible(bool fVisible);
|
---|
189 | void deleteVirtualDisk();
|
---|
190 | bool checkUnattendedInstallError(const CUnattended &comUnattended) const;
|
---|
191 | /** @name Variables
|
---|
192 | * @{ */
|
---|
193 | CMedium m_virtualDisk;
|
---|
194 | CMachine m_machine;
|
---|
195 | QString m_strMachineGroup;
|
---|
196 | int m_iIDECount;
|
---|
197 | int m_iSATACount;
|
---|
198 | int m_iSCSICount;
|
---|
199 | int m_iFloppyCount;
|
---|
200 | int m_iSASCount;
|
---|
201 | int m_iUSBCount;
|
---|
202 |
|
---|
203 | /** Path of the folder created by this wizard page. Used to remove previously created
|
---|
204 | * folder. see cleanupMachineFolder();*/
|
---|
205 | QString m_strCreatedFolder;
|
---|
206 |
|
---|
207 | /** Full path (including the file name) of the machine's configuration file. */
|
---|
208 | QString m_strMachineFilePath;
|
---|
209 | /** Path of the folder hosting the machine's configuration file. Generated from m_strMachineFilePath. */
|
---|
210 | QString m_strMachineFolder;
|
---|
211 | /** Base name of the machine. Can include characters / or \. */
|
---|
212 | QString m_strMachineBaseName;
|
---|
213 |
|
---|
214 | /* Name and index lists of the images detected from an ISO. Currently only for Windows ISOs. */
|
---|
215 | QVector<QString> m_detectedWindowsImageNames;
|
---|
216 | QVector<ulong> m_detectedWindowsImageIndices;
|
---|
217 |
|
---|
218 | /** Holds the VM OS family ID. */
|
---|
219 | QString m_strGuestOSFamilyId;
|
---|
220 | /** Holds the VM OS type. */
|
---|
221 | QString m_guestOSTypeId;
|
---|
222 |
|
---|
223 | /** True if guest additions are to be installed during unattended install. */
|
---|
224 | bool m_fInstallGuestAdditions;
|
---|
225 | bool m_fSkipUnattendedInstall;
|
---|
226 | bool m_fEFIEnabled;
|
---|
227 |
|
---|
228 | int m_iCPUCount;
|
---|
229 | int m_iMemorySize;
|
---|
230 | int m_iUnattendedInstallPageIndex;
|
---|
231 |
|
---|
232 | qulonglong m_uMediumVariant;
|
---|
233 | CMediumFormat m_comMediumFormat;
|
---|
234 | QString m_strMediumPath;
|
---|
235 | qulonglong m_uMediumSize;
|
---|
236 | SelectedDiskSource m_enmDiskSource;
|
---|
237 | bool m_fEmptyDiskRecommended;
|
---|
238 | QVector<KMediumVariant> m_mediumVariants;
|
---|
239 | UIActionPool *m_pActionPool;
|
---|
240 | CUnattended m_comUnattended;
|
---|
241 | bool m_fStartHeadless;
|
---|
242 | QString m_strInitialISOFilePath;
|
---|
243 | /** @} */
|
---|
244 | };
|
---|
245 |
|
---|
246 | typedef QPointer<UIWizardNewVM> UISafePointerWizardNewVM;
|
---|
247 |
|
---|
248 | #endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVM_h */
|
---|