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