1 | /* $Id: UIWizardExportAppPageFormat.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardExportAppPageFormat class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_wizards_exportappliance_UIWizardExportAppPageFormat_h
|
---|
29 | #define FEQT_INCLUDED_SRC_wizards_exportappliance_UIWizardExportAppPageFormat_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UINativeWizardPage.h"
|
---|
36 | #include "UIWizardExportApp.h"
|
---|
37 |
|
---|
38 | /* COM includes: */
|
---|
39 | #include "COMEnums.h"
|
---|
40 | #include "CAppliance.h"
|
---|
41 | #include "CCloudClient.h"
|
---|
42 | #include "CCloudProfile.h"
|
---|
43 | #include "CVirtualSystemDescription.h"
|
---|
44 | #include "CVirtualSystemDescriptionForm.h"
|
---|
45 |
|
---|
46 | /* Forward declarations: */
|
---|
47 | class QAbstractButton;
|
---|
48 | class QButtonGroup;
|
---|
49 | class QCheckBox;
|
---|
50 | class QGridLayout;
|
---|
51 | class QLabel;
|
---|
52 | class QStackedWidget;
|
---|
53 | class QIComboBox;
|
---|
54 | class QIRichTextLabel;
|
---|
55 | class QIToolButton;
|
---|
56 | class UIEmptyFilePathSelector;
|
---|
57 | class UINotificationCenter;
|
---|
58 |
|
---|
59 | /** Format combo data fields. */
|
---|
60 | enum
|
---|
61 | {
|
---|
62 | FormatData_Name = Qt::UserRole + 1,
|
---|
63 | FormatData_ShortName = Qt::UserRole + 2,
|
---|
64 | FormatData_IsItCloudFormat = Qt::UserRole + 3
|
---|
65 | };
|
---|
66 |
|
---|
67 | /** Profile combo data fields. */
|
---|
68 | enum
|
---|
69 | {
|
---|
70 | ProfileData_Name = Qt::UserRole + 1
|
---|
71 | };
|
---|
72 |
|
---|
73 | /** Namespace for Format page of the Export Appliance wizard. */
|
---|
74 | namespace UIWizardExportAppFormat
|
---|
75 | {
|
---|
76 | /** Populates formats. */
|
---|
77 | void populateFormats(QIComboBox *pCombo, UINotificationCenter *pCenter, bool fExportToOCIByDefault);
|
---|
78 | /** Populates MAC address policies. */
|
---|
79 | void populateMACAddressPolicies(QIComboBox *pCombo);
|
---|
80 |
|
---|
81 | /** Returns current format of @a pCombo specified. */
|
---|
82 | QString format(QIComboBox *pCombo);
|
---|
83 | /** Returns whether format under certain @a iIndex is cloud one. */
|
---|
84 | bool isFormatCloudOne(QIComboBox *pCombo, int iIndex = -1);
|
---|
85 |
|
---|
86 | /** Refresh stacked widget. */
|
---|
87 | void refreshStackedWidget(QStackedWidget *pStackedWidget,
|
---|
88 | bool fIsFormatCloudOne);
|
---|
89 |
|
---|
90 | /** Refresh file selector name. */
|
---|
91 | void refreshFileSelectorName(QString &strFileSelectorName,
|
---|
92 | const QStringList &machineNames,
|
---|
93 | const QString &strDefaultApplianceName,
|
---|
94 | bool fIsFormatCloudOne);
|
---|
95 | /** Refresh file selector extension. */
|
---|
96 | void refreshFileSelectorExtension(QString &strFileSelectorExt,
|
---|
97 | UIEmptyFilePathSelector *pFileSelector,
|
---|
98 | bool fIsFormatCloudOne);
|
---|
99 | /** Refresh file selector path. */
|
---|
100 | void refreshFileSelectorPath(UIEmptyFilePathSelector *pFileSelector,
|
---|
101 | const QString &strFileSelectorName,
|
---|
102 | const QString &strFileSelectorExt,
|
---|
103 | bool fIsFormatCloudOne);
|
---|
104 | /** Refresh Manifest check-box access. */
|
---|
105 | void refreshManifestCheckBoxAccess(QCheckBox *pCheckBox,
|
---|
106 | bool fIsFormatCloudOne);
|
---|
107 | /** Refresh Include ISOs check-box access. */
|
---|
108 | void refreshIncludeISOsCheckBoxAccess(QCheckBox *pCheckBox,
|
---|
109 | bool fIsFormatCloudOne);
|
---|
110 | /** Refresh local stuff. */
|
---|
111 | void refreshLocalStuff(CAppliance &comLocalAppliance,
|
---|
112 | UIWizardExportApp *pWizard,
|
---|
113 | const QList<QUuid> &machineIDs,
|
---|
114 | const QString &strUri);
|
---|
115 |
|
---|
116 | /** Refresh profile combo. */
|
---|
117 | void refreshProfileCombo(QIComboBox *pCombo,
|
---|
118 | UINotificationCenter *pCenter,
|
---|
119 | const QString &strFormat,
|
---|
120 | bool fIsFormatCloudOne);
|
---|
121 | /** Refresh cloud profile. */
|
---|
122 | void refreshCloudProfile(CCloudProfile &comCloudProfile,
|
---|
123 | UINotificationCenter *pCenter,
|
---|
124 | const QString &strShortProviderName,
|
---|
125 | const QString &strProfileName,
|
---|
126 | bool fIsFormatCloudOne);
|
---|
127 | /** Refresh cloud export mode. */
|
---|
128 | void refreshCloudExportMode(const QMap<CloudExportMode, QAbstractButton*> &radios,
|
---|
129 | bool fIsFormatCloudOne);
|
---|
130 | /** Refresh cloud stuff. */
|
---|
131 | void refreshCloudStuff(CAppliance &comCloudAppliance,
|
---|
132 | CCloudClient &comCloudClient,
|
---|
133 | CVirtualSystemDescription &comCloudVsd,
|
---|
134 | CVirtualSystemDescriptionForm &comCloudVsdExportForm,
|
---|
135 | UIWizardExportApp *pWizard,
|
---|
136 | const CCloudProfile &comCloudProfile,
|
---|
137 | const QList<QUuid> &machineIDs,
|
---|
138 | const QString &strUri,
|
---|
139 | const CloudExportMode enmCloudExportMode);
|
---|
140 |
|
---|
141 | /** Returns current profile name of @a pCombo specified. */
|
---|
142 | QString profileName(QIComboBox *pCombo);
|
---|
143 | /** Returns current cloud export mode chosen in @a radioButtons specified. */
|
---|
144 | CloudExportMode cloudExportMode(const QMap<CloudExportMode, QAbstractButton*> &radioButtons);
|
---|
145 |
|
---|
146 | /** Updates format combo tool-tips. */
|
---|
147 | void updateFormatComboToolTip(QIComboBox *pCombo);
|
---|
148 | /** Updates MAC address export policy combo tool-tips. */
|
---|
149 | void updateMACAddressExportPolicyComboToolTip(QIComboBox *pCombo);
|
---|
150 | }
|
---|
151 |
|
---|
152 | /** UINativeWizardPage extension for Format page of the Export Appliance wizard,
|
---|
153 | * based on UIWizardExportAppFormat namespace functions. */
|
---|
154 | class UIWizardExportAppPageFormat : public UINativeWizardPage
|
---|
155 | {
|
---|
156 | Q_OBJECT;
|
---|
157 |
|
---|
158 | public:
|
---|
159 |
|
---|
160 | /** Constructs Format page. */
|
---|
161 | UIWizardExportAppPageFormat(bool fExportToOCIByDefault);
|
---|
162 |
|
---|
163 | protected:
|
---|
164 |
|
---|
165 | /** Returns wizard this page belongs to. */
|
---|
166 | UIWizardExportApp *wizard() const;
|
---|
167 |
|
---|
168 | /** Handles translation event. */
|
---|
169 | virtual void retranslateUi() /* override final */;
|
---|
170 |
|
---|
171 | /** Performs page initialization. */
|
---|
172 | virtual void initializePage() /* override final */;
|
---|
173 |
|
---|
174 | /** Returns whether page is complete. */
|
---|
175 | virtual bool isComplete() const /* override final */;
|
---|
176 |
|
---|
177 | /** Performs page validation. */
|
---|
178 | virtual bool validatePage() /* override final */;
|
---|
179 |
|
---|
180 | private slots:
|
---|
181 |
|
---|
182 | /** Handles change in format combo-box. */
|
---|
183 | void sltHandleFormatComboChange();
|
---|
184 |
|
---|
185 | /** Handles change in file-name selector. */
|
---|
186 | void sltHandleFileSelectorChange();
|
---|
187 |
|
---|
188 | /** Handles change in MAC address export policy combo-box. */
|
---|
189 | void sltHandleMACAddressExportPolicyComboChange();
|
---|
190 |
|
---|
191 | /** Handles change in manifest check-box. */
|
---|
192 | void sltHandleManifestCheckBoxChange();
|
---|
193 |
|
---|
194 | /** Handles change in include ISOs check-box. */
|
---|
195 | void sltHandleIncludeISOsCheckBoxChange();
|
---|
196 |
|
---|
197 | /** Handles change in profile combo-box. */
|
---|
198 | void sltHandleProfileComboChange();
|
---|
199 |
|
---|
200 | /** Handles cloud export radio-button clicked. */
|
---|
201 | void sltHandleRadioButtonToggled(QAbstractButton *pButton, bool fToggled);
|
---|
202 |
|
---|
203 | /** Handles profile tool-button click. */
|
---|
204 | void sltHandleProfileButtonClick();
|
---|
205 |
|
---|
206 | private:
|
---|
207 |
|
---|
208 | /** Update local stuff. */
|
---|
209 | void updateLocalStuff();
|
---|
210 |
|
---|
211 | /** Updates cloud stuff. */
|
---|
212 | void updateCloudStuff();
|
---|
213 |
|
---|
214 | /** Holds whether default format should be Export to OCI. */
|
---|
215 | bool m_fExportToOCIByDefault;
|
---|
216 |
|
---|
217 | /** Holds the default appliance name. */
|
---|
218 | QString m_strDefaultApplianceName;
|
---|
219 | /** Holds the file selector name. */
|
---|
220 | QString m_strFileSelectorName;
|
---|
221 | /** Holds the file selector ext. */
|
---|
222 | QString m_strFileSelectorExt;
|
---|
223 |
|
---|
224 | /** Holds the Cloud Profile object instance. */
|
---|
225 | CCloudProfile m_comCloudProfile;
|
---|
226 |
|
---|
227 |
|
---|
228 | /** Holds the format label instance. */
|
---|
229 | QIRichTextLabel *m_pLabelFormat;
|
---|
230 | /** Holds the settings label instance. */
|
---|
231 | QIRichTextLabel *m_pLabelSettings;
|
---|
232 |
|
---|
233 | /** Holds the format layout. */
|
---|
234 | QGridLayout *m_pFormatLayout;
|
---|
235 | /** Holds the format combo-box label instance. */
|
---|
236 | QLabel *m_pFormatComboBoxLabel;
|
---|
237 | /** Holds the format combo-box instance. */
|
---|
238 | QIComboBox *m_pFormatComboBox;
|
---|
239 |
|
---|
240 | /** Holds the settings widget 1 instance. */
|
---|
241 | QStackedWidget *m_pSettingsWidget1;
|
---|
242 |
|
---|
243 | /** Holds the settings layout 1. */
|
---|
244 | QGridLayout *m_pSettingsLayout1;
|
---|
245 | /** Holds the file selector label instance. */
|
---|
246 | QLabel *m_pFileSelectorLabel;
|
---|
247 | /** Holds the file selector instance. */
|
---|
248 | UIEmptyFilePathSelector *m_pFileSelector;
|
---|
249 | /** Holds the MAC address policy combo-box label instance. */
|
---|
250 | QLabel *m_pMACComboBoxLabel;
|
---|
251 | /** Holds the MAC address policy check-box instance. */
|
---|
252 | QIComboBox *m_pMACComboBox;
|
---|
253 | /** Holds the additional label instance. */
|
---|
254 | QLabel *m_pAdditionalLabel;
|
---|
255 | /** Holds the manifest check-box instance. */
|
---|
256 | QCheckBox *m_pManifestCheckbox;
|
---|
257 | /** Holds the include ISOs check-box instance. */
|
---|
258 | QCheckBox *m_pIncludeISOsCheckbox;
|
---|
259 |
|
---|
260 | /** Holds the settings layout 2. */
|
---|
261 | QGridLayout *m_pSettingsLayout2;
|
---|
262 | /** Holds the profile label instance. */
|
---|
263 | QLabel *m_pProfileLabel;
|
---|
264 | /** Holds the profile combo-box instance. */
|
---|
265 | QIComboBox *m_pProfileComboBox;
|
---|
266 | /** Holds the profile management tool-button instance. */
|
---|
267 | QIToolButton *m_pProfileToolButton;
|
---|
268 |
|
---|
269 | /** Holds the export mode label instance. */
|
---|
270 | QLabel *m_pExportModeLabel;
|
---|
271 | /** Holds the export mode button group instance. */
|
---|
272 | QButtonGroup *m_pExportModeButtonGroup;
|
---|
273 | /** Holds the map of export mode button instances. */
|
---|
274 | QMap<CloudExportMode, QAbstractButton*> m_exportModeButtons;
|
---|
275 | };
|
---|
276 |
|
---|
277 | #endif /* !FEQT_INCLUDED_SRC_wizards_exportappliance_UIWizardExportAppPageFormat_h */
|
---|