VirtualBox

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

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

FE/Qt: bugref:9950. Adding a file selector to name/type editor.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1/* $Id: UIWizardNewVMPageBasic1.h 88101 2021-03-12 13:26:56Z 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;
38
39/** 1st page of the New Virtual Machine wizard (base part): */
40class UIWizardNewVMPage1 : public UIWizardPageBase
41{
42protected:
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
74 /** calls CVirtualBox::ComposeMachineFilename(...) and sets related member variables */
75 void composeMachineFilePath();
76
77 QWidget *createNameOSTypeWidgets();
78 /** Colors the widgets red if they cause isComplete to fail. */
79 void markWidgets() const;
80 void retranslateWidgets();
81 QString ISOFilePath() const;
82 bool determineOSType(const QString &strISOPath);
83 void setTypeByISODetectedOSType(const QString &strDetectedOSType);
84 /** Return false if ISO path is not empty but points to an missing or unreadable file. */
85 bool checkISOFile() const;
86
87 /** @name Widgets
88 * @{ */
89 UINameAndSystemEditor *m_pNameAndSystemEditor;
90 UIFilePathSelector *m_pISOFilePathSelector;
91 QLabel *m_pISOPathSelectorLabel;
92 /** @} */
93
94 QString m_strDetectedOSTypeId;
95
96private:
97
98 /** Full path (including the file name) of the machine's configuration file. */
99 QString m_strMachineFilePath;
100 /** Path of the folder hosting the machine's configuration file. Generated from m_strMachineFilePath. */
101 QString m_strMachineFolder;
102 /** Path of the folder created by this wizard page. Used to remove previously created
103 * folder. see cleanupMachineFolder();*/
104 QString m_strCreatedFolder;
105 /** Base name of the machine is generated from the m_strMachineFilePath. */
106 QString m_strMachineBaseName;
107
108 QString m_strGroup;
109 bool m_fSupportsHWVirtEx;
110 bool m_fSupportsLongMode;
111
112 friend class UIWizardNewVM;
113};
114
115/** 1st page of the New Virtual Machine wizard (basic extension). */
116class UIWizardNewVMPageBasic1 : public UIWizardPage, public UIWizardNewVMPage1
117{
118
119 Q_OBJECT;
120 Q_PROPERTY(QString machineFilePath READ machineFilePath WRITE setMachineFilePath);
121 Q_PROPERTY(QString machineFolder READ machineFolder WRITE setMachineFolder);
122 Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName);
123 Q_PROPERTY(QString guestOSFamiyId READ guestOSFamiyId);
124 Q_PROPERTY(QString ISOFilePath READ ISOFilePath);
125 Q_PROPERTY(bool isUnattendedEnabled READ isUnattendedEnabled);
126 Q_PROPERTY(QString detectedOSTypeId READ detectedOSTypeId);
127
128
129public:
130
131 /** Constructor. */
132 UIWizardNewVMPageBasic1(const QString &strGroup);
133 virtual bool isComplete() const; /* override */
134 virtual int nextId() const /* override */;
135
136protected:
137
138 /** Wrapper to access 'this' from base part. */
139 UIWizardPage* thisImp() { return this; }
140
141private slots:
142
143 /** Handlers. */
144 void sltNameChanged(const QString &strNewText);
145 void sltPathChanged(const QString &strNewPath);
146 void sltOsTypeChanged();
147 void sltISOPathChanged(const QString &strPath);
148
149private:
150
151 /** Translation stuff. */
152 void retranslateUi();
153
154 /** Prepare stuff. */
155 void prepare();
156 void createConnections();
157 void initializePage();
158 void cleanupPage();
159
160 /** Validation stuff. */
161 virtual bool validatePage() /* override */;
162
163
164 /** @name Widgets
165 * @{ */
166 QIRichTextLabel *m_pNameOSTypeLabel;
167 QIRichTextLabel *m_pUnattendedLabel;
168 /** @} */
169};
170
171#endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic1_h */
Note: See TracBrowser for help on using the repository browser.

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