VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h@ 87602

Last change on this file since 87602 was 87602, checked in by vboxsync, 4 years ago

FE/Qt: bugref:9515. Refactoring

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