VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp@ 73336

Last change on this file since 73336 was 73336, checked in by vboxsync, 7 years ago

FE/Qt: Add ReactOS to list of known OSs in new VM wizard
This minor patch adds a simple regex to match "ReactOS" in "New VM
Wizard" and set desired OS type to Windows2003, as per
https://reactos.org/wiki/VirtualBox#Running_the_ReactOS_Live_CD
Contributed by Michał Janiszewski under the MIT licence. Thank you!

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.9 KB
Line 
1/* $Id: UIWizardNewVMPageBasic1.cpp 73336 2018-07-23 19:32:14Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIWizardNewVMPageBasic1 class implementation.
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifdef VBOX_WITH_PRECOMPILED_HEADERS
19# include <precomp.h>
20#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
21
22/* Qt includes: */
23# include <QDir>
24# include <QLineEdit>
25# include <QHBoxLayout>
26# include <QVBoxLayout>
27
28/* GUI includes: */
29# include "QIRichTextLabel.h"
30# include "VBoxGlobal.h"
31# include "UIMessageCenter.h"
32# include "UINameAndSystemEditor.h"
33# include "UIWizardNewVMPageBasic1.h"
34# include "UIWizardNewVM.h"
35
36/* COM includes: */
37# include "CHost.h"
38# include "CSystemProperties.h"
39
40#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
41
42
43/* Defines some patterns to guess the right OS type. Should be in sync with
44 * VirtualBox-settings-common.xsd in Main. The list is sorted by priority. The
45 * first matching string found, will be used. */
46struct osTypePattern
47{
48 QRegExp pattern;
49 const char *pcstId;
50};
51
52static const osTypePattern gs_OSTypePattern[] =
53{
54 /* DOS: */
55 { QRegExp("DOS", Qt::CaseInsensitive), "DOS" },
56
57 /* Windows: */
58 { QRegExp( "Wi.*98", Qt::CaseInsensitive), "Windows98" },
59 { QRegExp( "Wi.*95", Qt::CaseInsensitive), "Windows95" },
60 { QRegExp( "Wi.*Me", Qt::CaseInsensitive), "WindowsMe" },
61 { QRegExp( "(Wi.*NT)|(NT[-._v]*4)", Qt::CaseInsensitive), "WindowsNT4" },
62 { QRegExp( "NT[-._v]*3[.,]*[51x]", Qt::CaseInsensitive), "WindowsNT3x" },
63 /* Note: Do not automatically set WindowsXP_64 on 64-bit hosts, as Windows XP 64-bit
64 * is extremely rare -- most users never heard of it even. So always default to 32-bit. */
65 { QRegExp("((Wi.*XP)|(XP)).*", Qt::CaseInsensitive), "WindowsXP" },
66 { QRegExp("((Wi.*2003)|(W2K3)|(Win2K3)).*64", Qt::CaseInsensitive), "Windows2003_64" },
67 { QRegExp("((Wi.*2003)|(W2K3)|(Win2K3)).*32", Qt::CaseInsensitive), "Windows2003" },
68 { QRegExp("((Wi.*Vis)|(Vista)).*64", Qt::CaseInsensitive), "WindowsVista_64" },
69 { QRegExp("((Wi.*Vis)|(Vista)).*32", Qt::CaseInsensitive), "WindowsVista" },
70 { QRegExp( "(Wi.*2016)|(W2K16)|(Win2K16)", Qt::CaseInsensitive), "Windows2016_64" },
71 { QRegExp( "(Wi.*2012)|(W2K12)|(Win2K12)", Qt::CaseInsensitive), "Windows2012_64" },
72 { QRegExp("((Wi.*2008)|(W2K8)|(Win2k8)).*64", Qt::CaseInsensitive), "Windows2008_64" },
73 { QRegExp("((Wi.*2008)|(W2K8)|(Win2K8)).*32", Qt::CaseInsensitive), "Windows2008" },
74 { QRegExp( "(Wi.*2000)|(W2K)|(Win2K)", Qt::CaseInsensitive), "Windows2000" },
75 { QRegExp( "(Wi.*7.*64)|(W7.*64)", Qt::CaseInsensitive), "Windows7_64" },
76 { QRegExp( "(Wi.*7.*32)|(W7.*32)", Qt::CaseInsensitive), "Windows7" },
77 { QRegExp( "(Wi.*8.*1.*64)|(W8.*64)", Qt::CaseInsensitive), "Windows81_64" },
78 { QRegExp( "(Wi.*8.*1.*32)|(W8.*32)", Qt::CaseInsensitive), "Windows81" },
79 { QRegExp( "(Wi.*8.*64)|(W8.*64)", Qt::CaseInsensitive), "Windows8_64" },
80 { QRegExp( "(Wi.*8.*32)|(W8.*32)", Qt::CaseInsensitive), "Windows8" },
81 { QRegExp( "(Wi.*10.*64)|(W10.*64)", Qt::CaseInsensitive), "Windows10_64" },
82 { QRegExp( "(Wi.*10.*32)|(W10.*32)", Qt::CaseInsensitive), "Windows10" },
83 { QRegExp( "Wi.*3.*1", Qt::CaseInsensitive), "Windows31" },
84 /* Set Windows 7 as default for "Windows". */
85 { QRegExp( "Wi.*64", Qt::CaseInsensitive), "Windows7_64" },
86 { QRegExp( "Wi.*32", Qt::CaseInsensitive), "Windows7" },
87 /* ReactOS wants to be considered as Windows 2003 */
88 { QRegExp( "Reac.*", Qt::CaseInsensitive), "Windows2003" },
89
90 /* Solaris: */
91 { QRegExp("Sol.*11", Qt::CaseInsensitive), "Solaris11_64" },
92 { QRegExp("((Op.*Sol)|(os20[01][0-9])|(Sol.*10)|(India)|(Neva)).*64", Qt::CaseInsensitive), "OpenSolaris_64" },
93 { QRegExp("((Op.*Sol)|(os20[01][0-9])|(Sol.*10)|(India)|(Neva)).*32", Qt::CaseInsensitive), "OpenSolaris" },
94 { QRegExp("Sol.*64", Qt::CaseInsensitive), "Solaris_64" },
95 { QRegExp("Sol.*32", Qt::CaseInsensitive), "Solaris" },
96
97 /* OS/2: */
98 { QRegExp( "OS[/|!-]{,1}2.*W.*4.?5", Qt::CaseInsensitive), "OS2Warp45" },
99 { QRegExp( "OS[/|!-]{,1}2.*W.*4", Qt::CaseInsensitive), "OS2Warp4" },
100 { QRegExp( "OS[/|!-]{,1}2.*W", Qt::CaseInsensitive), "OS2Warp3" },
101 { QRegExp("(OS[/|!-]{,1}2.*e)|(eCS.*)", Qt::CaseInsensitive), "OS2eCS" },
102 { QRegExp( "OS[/|!-]{,1}2", Qt::CaseInsensitive), "OS2" },
103 { QRegExp( "eComS.*", Qt::CaseInsensitive), "OS2eCS" },
104
105 /* Other: Must come before Ubuntu/Maverick and before Linux??? */
106 { QRegExp("QN", Qt::CaseInsensitive), "QNX" },
107
108 /* Mac OS X: Must come before Ubuntu/Maverick and before Linux: */
109 { QRegExp("((mac.*10[.,]{0,1}4)|(os.*x.*10[.,]{0,1}4)|(mac.*ti)|(os.*x.*ti)|(Tig)).64", Qt::CaseInsensitive), "MacOS_64" },
110 { QRegExp("((mac.*10[.,]{0,1}4)|(os.*x.*10[.,]{0,1}4)|(mac.*ti)|(os.*x.*ti)|(Tig)).32", Qt::CaseInsensitive), "MacOS" },
111 { QRegExp("((mac.*10[.,]{0,1}5)|(os.*x.*10[.,]{0,1}5)|(mac.*leo)|(os.*x.*leo)|(Leop)).*64", Qt::CaseInsensitive), "MacOS_64" },
112 { QRegExp("((mac.*10[.,]{0,1}5)|(os.*x.*10[.,]{0,1}5)|(mac.*leo)|(os.*x.*leo)|(Leop)).*32", Qt::CaseInsensitive), "MacOS" },
113 { QRegExp("((mac.*10[.,]{0,1}6)|(os.*x.*10[.,]{0,1}6)|(mac.*SL)|(os.*x.*SL)|(Snow L)).*64", Qt::CaseInsensitive), "MacOS106_64" },
114 { QRegExp("((mac.*10[.,]{0,1}6)|(os.*x.*10[.,]{0,1}6)|(mac.*SL)|(os.*x.*SL)|(Snow L)).*32", Qt::CaseInsensitive), "MacOS106" },
115 { QRegExp( "(mac.*10[.,]{0,1}7)|(os.*x.*10[.,]{0,1}7)|(mac.*ML)|(os.*x.*ML)|(Mount)", Qt::CaseInsensitive), "MacOS108_64" },
116 { QRegExp( "(mac.*10[.,]{0,1}8)|(os.*x.*10[.,]{0,1}8)|(Lion)", Qt::CaseInsensitive), "MacOS107_64" },
117 { QRegExp( "(mac.*10[.,]{0,1}9)|(os.*x.*10[.,]{0,1}9)|(mac.*mav)|(os.*x.*mav)|(Mavericks)", Qt::CaseInsensitive), "MacOS109_64" },
118 { QRegExp( "(mac.*yos)|(os.*x.*yos)|(Yosemite)", Qt::CaseInsensitive), "MacOS1010_64" },
119 { QRegExp( "(mac.*cap)|(os.*x.*capit)|(Capitan)", Qt::CaseInsensitive), "MacOS1011_64" },
120 { QRegExp( "(mac.*hig)|(os.*x.*high.*sierr)|(High Sierra)", Qt::CaseInsensitive), "MacOS1013_64" },
121 { QRegExp( "(mac.*sie)|(os.*x.*sierr)|(Sierra)", Qt::CaseInsensitive), "MacOS1012_64" },
122 { QRegExp("((Mac)|(Tig)|(Leop)|(Yose)|(os[ ]*x)).*64", Qt::CaseInsensitive), "MacOS_64" },
123 { QRegExp("((Mac)|(Tig)|(Leop)|(Yose)|(os[ ]*x)).*32", Qt::CaseInsensitive), "MacOS" },
124
125 /* Code names for Linux distributions: */
126 { QRegExp("((bianca)|(cassandra)|(celena)|(daryna)|(elyssa)|(felicia)|(gloria)|(helena)|(isadora)|(julia)|(katya)|(lisa)|(maya)|(nadia)|(olivia)|(petra)|(qiana)|(rebecca)|(rafaela)|(rosa)).*64", Qt::CaseInsensitive), "Ubuntu_64" },
127 { QRegExp("((bianca)|(cassandra)|(celena)|(daryna)|(elyssa)|(felicia)|(gloria)|(helena)|(isadora)|(julia)|(katya)|(lisa)|(maya)|(nadia)|(olivia)|(petra)|(qiana)|(rebecca)|(rafaela)|(rosa)).*32", Qt::CaseInsensitive), "Ubuntu" },
128 { QRegExp("((edgy)|(feisty)|(gutsy)|(hardy)|(intrepid)|(jaunty)|(karmic)|(lucid)|(maverick)|(natty)|(oneiric)|(precise)|(quantal)|(raring)|(saucy)|(trusty)|(utopic)|(vivid)|(wily)|(xenial)|(yakkety)|(zesty)).*64", Qt::CaseInsensitive), "Ubuntu_64" },
129 { QRegExp("((edgy)|(feisty)|(gutsy)|(hardy)|(intrepid)|(jaunty)|(karmic)|(lucid)|(maverick)|(natty)|(oneiric)|(precise)|(quantal)|(raring)|(saucy)|(trusty)|(utopic)|(vivid)|(wily)|(xenial)|(yakkety)|(zesty)).*32", Qt::CaseInsensitive), "Ubuntu" },
130 { QRegExp("((sarge)|(etch)|(lenny)|(squeeze)|(wheezy)|(jessie)|(stretch)|(buster)|(sid)).*64", Qt::CaseInsensitive), "Debian_64" },
131 { QRegExp("((sarge)|(etch)|(lenny)|(squeeze)|(wheezy)|(jessie)|(stretch)|(buster)|(sid)).*32", Qt::CaseInsensitive), "Debian" },
132 { QRegExp("((moonshine)|(werewolf)|(sulphur)|(cambridge)|(leonidas)|(constantine)|(goddard)|(laughlin)|(lovelock)|(verne)|(beefy)|(spherical)).*64", Qt::CaseInsensitive), "Fedora_64" },
133 { QRegExp("((moonshine)|(werewolf)|(sulphur)|(cambridge)|(leonidas)|(constantine)|(goddard)|(laughlin)|(lovelock)|(verne)|(beefy)|(spherical)).*32", Qt::CaseInsensitive), "Fedora" },
134
135 /* Regular names of Linux distributions: */
136 { QRegExp("Arc.*64", Qt::CaseInsensitive), "ArchLinux_64" },
137 { QRegExp("Arc.*32", Qt::CaseInsensitive), "ArchLinux" },
138 { QRegExp("Deb.*64", Qt::CaseInsensitive), "Debian_64" },
139 { QRegExp("Deb.*32", Qt::CaseInsensitive), "Debian" },
140 { QRegExp("((SU)|(Nov)|(SLE)).*64", Qt::CaseInsensitive), "OpenSUSE_64" },
141 { QRegExp("((SU)|(Nov)|(SLE)).*32", Qt::CaseInsensitive), "OpenSUSE" },
142 { QRegExp("Fe.*64", Qt::CaseInsensitive), "Fedora_64" },
143 { QRegExp("Fe.*32", Qt::CaseInsensitive), "Fedora" },
144 { QRegExp("((Gen)|(Sab)).*64", Qt::CaseInsensitive), "Gentoo_64" },
145 { QRegExp("((Gen)|(Sab)).*32", Qt::CaseInsensitive), "Gentoo" },
146 { QRegExp("((Man)|(Mag)).*64", Qt::CaseInsensitive), "Mandriva_64" },
147 { QRegExp("((Man)|(Mag)).*32", Qt::CaseInsensitive), "Mandriva" },
148 { QRegExp("((Red)|(rhel)|(cen)).*64", Qt::CaseInsensitive), "RedHat_64" },
149 { QRegExp("((Red)|(rhel)|(cen)).*32", Qt::CaseInsensitive), "RedHat" },
150 { QRegExp("Tur.*64", Qt::CaseInsensitive), "Turbolinux_64" },
151 { QRegExp("Tur.*32", Qt::CaseInsensitive), "Turbolinux" },
152 { QRegExp("(Ub)|(Min).*64", Qt::CaseInsensitive), "Ubuntu_64" },
153 { QRegExp("(Ub)|(Min).*32", Qt::CaseInsensitive), "Ubuntu" },
154 { QRegExp("Xa.*64", Qt::CaseInsensitive), "Xandros_64" },
155 { QRegExp("Xa.*32", Qt::CaseInsensitive), "Xandros" },
156 { QRegExp("((Or)|(oel)|(ol)).*64", Qt::CaseInsensitive), "Oracle_64" },
157 { QRegExp("((Or)|(oel)|(ol)).*32", Qt::CaseInsensitive), "Oracle" },
158 { QRegExp("Knoppix", Qt::CaseInsensitive), "Linux26" },
159 { QRegExp("Dsl", Qt::CaseInsensitive), "Linux24" },
160 { QRegExp("((Lin)|(lnx)).*2.?2", Qt::CaseInsensitive), "Linux22" },
161 { QRegExp("((Lin)|(lnx)).*2.?4.*64", Qt::CaseInsensitive), "Linux24_64" },
162 { QRegExp("((Lin)|(lnx)).*2.?4.*32", Qt::CaseInsensitive), "Linux24" },
163 { QRegExp("((((Lin)|(lnx)).*2.?6)|(LFS)).*64", Qt::CaseInsensitive), "Linux26_64" },
164 { QRegExp("((((Lin)|(lnx)).*2.?6)|(LFS)).*32", Qt::CaseInsensitive), "Linux26" },
165 { QRegExp("((Lin)|(lnx)).*64", Qt::CaseInsensitive), "Linux26_64" },
166 { QRegExp("((Lin)|(lnx)).*32", Qt::CaseInsensitive), "Linux26" },
167
168 /* Other: */
169 { QRegExp("L4", Qt::CaseInsensitive), "L4" },
170 { QRegExp("((Fr.*B)|(fbsd)).*64", Qt::CaseInsensitive), "FreeBSD_64" },
171 { QRegExp("((Fr.*B)|(fbsd)).*32", Qt::CaseInsensitive), "FreeBSD" },
172 { QRegExp("Op.*B.*64", Qt::CaseInsensitive), "OpenBSD_64" },
173 { QRegExp("Op.*B.*32", Qt::CaseInsensitive), "OpenBSD" },
174 { QRegExp("Ne.*B.*64", Qt::CaseInsensitive), "NetBSD_64" },
175 { QRegExp("Ne.*B.*32", Qt::CaseInsensitive), "NetBSD" },
176 { QRegExp("Net", Qt::CaseInsensitive), "Netware" },
177 { QRegExp("Rocki", Qt::CaseInsensitive), "JRockitVE" },
178 { QRegExp("bs[23]{0,1}-", Qt::CaseInsensitive), "VBoxBS_64" }, /* bootsector tests */
179 { QRegExp("Ot", Qt::CaseInsensitive), "Other" },
180};
181
182UIWizardNewVMPage1::UIWizardNewVMPage1(const QString &strGroup)
183 : m_pNameAndSystemEditor(0)
184 , m_strGroup(strGroup)
185
186{
187 CHost host = vboxGlobal().host();
188 m_fSupportsHWVirtEx = host.GetProcessorFeature(KProcessorFeature_HWVirtEx);
189 m_fSupportsLongMode = host.GetProcessorFeature(KProcessorFeature_LongMode);
190}
191
192void UIWizardNewVMPage1::onNameChanged(QString strNewName)
193{
194 /* Do not forget about achitecture bits, if not yet specified: */
195 if (!strNewName.contains("32") && !strNewName.contains("64"))
196 strNewName += ARCH_BITS == 64 && m_fSupportsHWVirtEx && m_fSupportsLongMode ? "64" : "32";
197
198 /* Search for a matching OS type based on the string the user typed already. */
199 for (size_t i = 0; i < RT_ELEMENTS(gs_OSTypePattern); ++i)
200 if (strNewName.contains(gs_OSTypePattern[i].pattern))
201 {
202 if (m_pNameAndSystemEditor)
203 {
204 m_pNameAndSystemEditor->blockSignals(true);
205 m_pNameAndSystemEditor->setType(vboxGlobal().vmGuestOSType(gs_OSTypePattern[i].pcstId));
206 m_pNameAndSystemEditor->blockSignals(false);
207 }
208 break;
209 }
210}
211
212void UIWizardNewVMPage1::onOsTypeChanged()
213{
214 /* If the user manually edited the OS type, we didn't want our automatic OS type guessing anymore.
215 * So simply disconnect the text-edit signal. */
216 if (m_pNameAndSystemEditor)
217 m_pNameAndSystemEditor->disconnect(SIGNAL(sigNameChanged(const QString &)), thisImp(), SLOT(sltNameChanged(const QString &)));
218}
219
220void UIWizardNewVMPage1::composeMachineFilePath()
221{
222 if (!m_pNameAndSystemEditor)
223 return;
224 if (m_pNameAndSystemEditor->name().isEmpty() || m_pNameAndSystemEditor->path().isEmpty())
225 return;
226 /* Get VBox: */
227 CVirtualBox vbox = vboxGlobal().virtualBox();
228
229 /* Compose machine filename: */
230 m_strMachineFilePath = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(),
231 m_strGroup,
232 QString(),
233 m_pNameAndSystemEditor->path());
234 /* Compose machine folder/basename: */
235 const QFileInfo fileInfo(m_strMachineFilePath);
236 m_strMachineFolder = fileInfo.absolutePath();
237 m_strMachineBaseName = fileInfo.completeBaseName();
238}
239
240bool UIWizardNewVMPage1::createMachineFolder()
241{
242 if (!m_pNameAndSystemEditor)
243 return false;
244 /* Cleanup previosly created folder if any: */
245 if (!cleanupMachineFolder())
246 {
247 msgCenter().cannotRemoveMachineFolder(m_strMachineFolder, thisImp());
248 return false;
249 }
250
251 composeMachineFilePath();
252
253
254 /* Check if the folder already exists and check if it has been created by this wizard */
255 if (QDir(m_strMachineFolder).exists())
256 {
257 /* Looks like we have already created this folder for this run of the wizard. Just return */
258 if (m_strCreatedFolder == m_strMachineFolder)
259 return true;
260 /* The folder is there but not because of this wizard. Avoid overwriting a existing machine's folder */
261 else
262 {
263 msgCenter().cannotRewriteMachineFolder(m_strMachineFolder, thisImp());
264 return false;
265 }
266 }
267
268 /* Try to create new folder (and it's predecessors): */
269 bool fMachineFolderCreated = QDir().mkpath(m_strMachineFolder);
270 if (!fMachineFolderCreated)
271 {
272 msgCenter().cannotCreateMachineFolder(m_strMachineFolder, thisImp());
273 return false;
274 }
275 m_strCreatedFolder = m_strMachineFolder;
276 return true;
277}
278
279bool UIWizardNewVMPage1::cleanupMachineFolder()
280{
281 /* Make sure folder was previosly created: */
282 if (!m_strCreatedFolder.isEmpty() && m_strCreatedFolder != m_strMachineFolder)
283 {
284 /* Try to cleanup folder (and it's predecessors): */
285 bool fMachineFolderRemoved = QDir().rmpath(m_strCreatedFolder);
286 /* Reset machine folder value: */
287 if (fMachineFolderRemoved)
288 m_strCreatedFolder = QString();
289 /* Return cleanup result: */
290 return fMachineFolderRemoved;
291 }
292 return true;
293}
294
295QString UIWizardNewVMPage1::machineFilePath() const
296{
297 return m_strMachineFilePath;
298}
299
300void UIWizardNewVMPage1::setMachineFilePath(const QString &strMachineFilePath)
301{
302 m_strMachineFilePath = strMachineFilePath;
303}
304
305QString UIWizardNewVMPage1::machineFolder() const
306{
307 return m_strMachineFolder;
308}
309
310void UIWizardNewVMPage1::setMachineFolder(const QString &strMachineFolder)
311{
312 m_strMachineFolder = strMachineFolder;
313}
314
315QString UIWizardNewVMPage1::machineBaseName() const
316{
317 return m_strMachineBaseName;
318}
319
320void UIWizardNewVMPage1::setMachineBaseName(const QString &strMachineBaseName)
321{
322 m_strMachineBaseName = strMachineBaseName;
323}
324
325UIWizardNewVMPageBasic1::UIWizardNewVMPageBasic1(const QString &strGroup)
326 : UIWizardNewVMPage1(strGroup)
327{
328 /* Create widgets: */
329 QVBoxLayout *pMainLayout = new QVBoxLayout(this);
330 {
331 m_pLabel = new QIRichTextLabel(this);
332 m_pNameAndSystemEditor = new UINameAndSystemEditor(this, true);
333 pMainLayout->addWidget(m_pLabel);
334 pMainLayout->addWidget(m_pNameAndSystemEditor);
335 pMainLayout->addStretch();
336 }
337
338 /* Setup connections: */
339 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged);
340 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged);
341 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged);
342
343 /* Register fields: */
344 registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &)));
345 registerField("type", m_pNameAndSystemEditor, "type", SIGNAL(sigOsTypeChanged()));
346 registerField("machineFilePath", this, "machineFilePath");
347 registerField("machineFolder", this, "machineFolder");
348 registerField("machineBaseName", this, "machineBaseName");
349}
350
351void UIWizardNewVMPageBasic1::sltNameChanged(const QString &strNewName)
352{
353 /* Call to base-class: */
354 onNameChanged(strNewName);
355 composeMachineFilePath();
356}
357
358void UIWizardNewVMPageBasic1::sltPathChanged(const QString &strNewPath)
359{
360 Q_UNUSED(strNewPath);
361 composeMachineFilePath();
362}
363
364void UIWizardNewVMPageBasic1::sltOsTypeChanged()
365{
366 /* Call to base-class: */
367 onOsTypeChanged();
368}
369
370void UIWizardNewVMPageBasic1::retranslateUi()
371{
372 /* Translate page: */
373 setTitle(UIWizardNewVM::tr("Name and operating system"));
374
375 /* Translate widgets: */
376 m_pLabel->setText(UIWizardNewVM::tr("Please choose a descriptive name and destination folder for the new virtual machine "
377 "and select the type of operating system you intend to install on it. "
378 "The name you choose will be used throughout VirtualBox "
379 "to identify this machine."));
380}
381
382void UIWizardNewVMPageBasic1::initializePage()
383{
384 /* Translate page: */
385 retranslateUi();
386 if (m_pNameAndSystemEditor)
387 m_pNameAndSystemEditor->setFocus();
388}
389
390void UIWizardNewVMPageBasic1::cleanupPage()
391{
392 /* Cleanup: */
393 cleanupMachineFolder();
394 /* Call to base-class: */
395 UIWizardPage::cleanupPage();
396}
397
398bool UIWizardNewVMPageBasic1::validatePage()
399{
400 /* Try to create machine folder: */
401 return createMachineFolder();
402}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette