1 | /* $Id: UIWizardNewVMPageBasic1.h 88150 2021-03-17 11:41:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardNewVMPageBasic1 class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 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 | #ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic1_h
|
---|
19 | #define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic1_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Local includes: */
|
---|
25 | #include "UIWizardPage.h"
|
---|
26 | #include "UIExtraDataDefs.h"
|
---|
27 |
|
---|
28 | /* Forward declarations: */
|
---|
29 | class QBoxLayout;
|
---|
30 | class QCheckBox;
|
---|
31 | class QFrame;
|
---|
32 | class QLabel;
|
---|
33 | class QRadioButton;
|
---|
34 | class QGridLayout;
|
---|
35 | class QIRichTextLabel;
|
---|
36 | class UIFilePathSelector;
|
---|
37 | class UINameAndSystemEditor;
|
---|
38 |
|
---|
39 | /** 1st page of the New Virtual Machine wizard (base part): */
|
---|
40 | class UIWizardNewVMPage1 : public UIWizardPageBase
|
---|
41 | {
|
---|
42 | protected:
|
---|
43 |
|
---|
44 | /** Constructor. */
|
---|
45 | UIWizardNewVMPage1(const QString &strGroup);
|
---|
46 |
|
---|
47 | /** Handlers. */
|
---|
48 | void onNameChanged(QString strNewName);
|
---|
49 | void onOsTypeChanged();
|
---|
50 |
|
---|
51 | bool createMachineFolder();
|
---|
52 | /** Removes a previously created folder (if exists) before creating a new one.
|
---|
53 | * used during page cleanup and new folder creation. Called upon page Next/Back and
|
---|
54 | * wizard cancel */
|
---|
55 | bool cleanupMachineFolder(bool fWizardCancel = false);
|
---|
56 |
|
---|
57 | /** @name Property getters/setters
|
---|
58 | * @{ */
|
---|
59 | QString machineFilePath() const;
|
---|
60 | void setMachineFilePath(const QString &strMachineFilePath);
|
---|
61 |
|
---|
62 | QString machineFolder() const;
|
---|
63 | void setMachineFolder(const QString &strMachineFolder);
|
---|
64 |
|
---|
65 | QString machineBaseName() const;
|
---|
66 | void setMachineBaseName(const QString &strMachineBaseName);
|
---|
67 |
|
---|
68 | QString guestOSFamiyId() const;
|
---|
69 |
|
---|
70 | bool isUnattendedEnabled() const;
|
---|
71 | const QString &detectedOSTypeId() const;
|
---|
72 |
|
---|
73 | bool skipUnattendedInstall() const;
|
---|
74 | /** @} */
|
---|
75 |
|
---|
76 | /** calls CVirtualBox::ComposeMachineFilename(...) and sets related member variables */
|
---|
77 | void composeMachineFilePath();
|
---|
78 |
|
---|
79 | QWidget *createNameOSTypeWidgets();
|
---|
80 | /** Colors the widgets red if they cause isComplete to fail. */
|
---|
81 | void markWidgets() const;
|
---|
82 | void retranslateWidgets();
|
---|
83 | QString ISOFilePath() const;
|
---|
84 | bool determineOSType(const QString &strISOPath);
|
---|
85 | void setTypeByISODetectedOSType(const QString &strDetectedOSType);
|
---|
86 | /** Return false if ISO path is not empty but points to an missing or unreadable file. */
|
---|
87 | bool checkISOFile() const;
|
---|
88 | void setSkipCheckBoxEnable();
|
---|
89 | /** @name Widgets
|
---|
90 | * @{ */
|
---|
91 | QGridLayout *m_pNameAndSystemLayout;
|
---|
92 | UINameAndSystemEditor *m_pNameAndSystemEditor;
|
---|
93 | QCheckBox *m_pSkipUnattendedCheckBox;
|
---|
94 | /** @} */
|
---|
95 |
|
---|
96 | QString m_strDetectedOSTypeId;
|
---|
97 |
|
---|
98 | private:
|
---|
99 |
|
---|
100 | /** Full path (including the file name) of the machine's configuration file. */
|
---|
101 | QString m_strMachineFilePath;
|
---|
102 | /** Path of the folder hosting the machine's configuration file. Generated from m_strMachineFilePath. */
|
---|
103 | QString m_strMachineFolder;
|
---|
104 | /** Path of the folder created by this wizard page. Used to remove previously created
|
---|
105 | * folder. see cleanupMachineFolder();*/
|
---|
106 | QString m_strCreatedFolder;
|
---|
107 | /** Base name of the machine is generated from the m_strMachineFilePath. */
|
---|
108 | QString m_strMachineBaseName;
|
---|
109 |
|
---|
110 | QString m_strGroup;
|
---|
111 | bool m_fSupportsHWVirtEx;
|
---|
112 | bool m_fSupportsLongMode;
|
---|
113 |
|
---|
114 | friend class UIWizardNewVM;
|
---|
115 | };
|
---|
116 |
|
---|
117 | /** 1st page of the New Virtual Machine wizard (basic extension). */
|
---|
118 | class UIWizardNewVMPageBasic1 : public UIWizardPage, public UIWizardNewVMPage1
|
---|
119 | {
|
---|
120 |
|
---|
121 | Q_OBJECT;
|
---|
122 | Q_PROPERTY(QString machineFilePath READ machineFilePath WRITE setMachineFilePath);
|
---|
123 | Q_PROPERTY(QString machineFolder READ machineFolder WRITE setMachineFolder);
|
---|
124 | Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName);
|
---|
125 | Q_PROPERTY(QString guestOSFamiyId READ guestOSFamiyId);
|
---|
126 | Q_PROPERTY(QString ISOFilePath READ ISOFilePath);
|
---|
127 | Q_PROPERTY(bool isUnattendedEnabled READ isUnattendedEnabled);
|
---|
128 | Q_PROPERTY(QString detectedOSTypeId READ detectedOSTypeId);
|
---|
129 |
|
---|
130 | public:
|
---|
131 |
|
---|
132 | /** Constructor. */
|
---|
133 | UIWizardNewVMPageBasic1(const QString &strGroup);
|
---|
134 | virtual bool isComplete() const; /* override */
|
---|
135 | virtual int nextId() const /* override */;
|
---|
136 |
|
---|
137 | protected:
|
---|
138 |
|
---|
139 | /** Wrapper to access 'this' from base part. */
|
---|
140 | UIWizardPage* thisImp() { return this; }
|
---|
141 |
|
---|
142 | private slots:
|
---|
143 |
|
---|
144 | /** Handlers. */
|
---|
145 | void sltNameChanged(const QString &strNewText);
|
---|
146 | void sltPathChanged(const QString &strNewPath);
|
---|
147 | void sltOsTypeChanged();
|
---|
148 | void sltISOPathChanged(const QString &strPath);
|
---|
149 |
|
---|
150 | private:
|
---|
151 |
|
---|
152 | /** Translation stuff. */
|
---|
153 | void retranslateUi();
|
---|
154 |
|
---|
155 | /** Prepare stuff. */
|
---|
156 | void prepare();
|
---|
157 | void createConnections();
|
---|
158 | void initializePage();
|
---|
159 | void cleanupPage();
|
---|
160 |
|
---|
161 | /** Validation stuff. */
|
---|
162 | virtual bool validatePage() /* override */;
|
---|
163 |
|
---|
164 |
|
---|
165 | /** @name Widgets
|
---|
166 | * @{ */
|
---|
167 | QIRichTextLabel *m_pNameOSTypeLabel;
|
---|
168 | /** @} */
|
---|
169 | };
|
---|
170 |
|
---|
171 | #endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic1_h */
|
---|