1 | /* $Id: UIWizardImportAppPageSource.h 103982 2024-03-21 11:43:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardImportAppPageSource 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_importappliance_UIWizardImportAppPageSource_h
|
---|
29 | #define FEQT_INCLUDED_SRC_wizards_importappliance_UIWizardImportAppPageSource_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UINativeWizardPage.h"
|
---|
36 |
|
---|
37 | /* Forward declarations: */
|
---|
38 | class QGridLayout;
|
---|
39 | class QLabel;
|
---|
40 | class QListWidget;
|
---|
41 | class QStackedWidget;
|
---|
42 | class QIComboBox;
|
---|
43 | class QIRichTextLabel;
|
---|
44 | class QIToolButton;
|
---|
45 | class UIEmptyFilePathSelector;
|
---|
46 | class UINotificationCenter;
|
---|
47 | class UIWizardImportApp;
|
---|
48 | class CAppliance;
|
---|
49 | class CVirtualSystemDescriptionForm;
|
---|
50 |
|
---|
51 | /** Source combo data fields. */
|
---|
52 | enum
|
---|
53 | {
|
---|
54 | SourceData_Name = Qt::UserRole + 1,
|
---|
55 | SourceData_ShortName = Qt::UserRole + 2,
|
---|
56 | SourceData_IsItCloudFormat = Qt::UserRole + 3
|
---|
57 | };
|
---|
58 |
|
---|
59 | /** Profile combo data fields. */
|
---|
60 | enum
|
---|
61 | {
|
---|
62 | ProfileData_Name = Qt::UserRole + 1
|
---|
63 | };
|
---|
64 |
|
---|
65 | /** Namespace for Source page of the Import Appliance wizard. */
|
---|
66 | namespace UIWizardImportAppSource
|
---|
67 | {
|
---|
68 | /** Populates sources. */
|
---|
69 | void populateSources(QIComboBox *pCombo,
|
---|
70 | UINotificationCenter *pCenter,
|
---|
71 | bool fImportFromOCIByDefault,
|
---|
72 | const QString &strSource);
|
---|
73 |
|
---|
74 | /** Returns current source of @a pCombo specified. */
|
---|
75 | QString source(QIComboBox *pCombo);
|
---|
76 | /** Returns whether source under certain @a iIndex is cloud one. */
|
---|
77 | bool isSourceCloudOne(QIComboBox *pCombo, int iIndex = -1);
|
---|
78 |
|
---|
79 | /** Refresh stacked widget. */
|
---|
80 | void refreshStackedWidget(QStackedWidget *pStackedWidget,
|
---|
81 | bool fIsFormatCloudOne);
|
---|
82 |
|
---|
83 | /** Refresh profile combo. */
|
---|
84 | void refreshProfileCombo(QIComboBox *pCombo,
|
---|
85 | UINotificationCenter *pCenter,
|
---|
86 | const QString &strSource,
|
---|
87 | const QString &strProfileName,
|
---|
88 | bool fIsSourceCloudOne);
|
---|
89 | /** Refresh profile instances. */
|
---|
90 | void refreshCloudProfileInstances(QListWidget *pListWidget,
|
---|
91 | UINotificationCenter *pCenter,
|
---|
92 | const QString &strSource,
|
---|
93 | const QString &strProfileName,
|
---|
94 | bool fIsSourceCloudOne);
|
---|
95 | /** Refresh cloud stuff. */
|
---|
96 | void refreshCloudStuff(CAppliance &comCloudAppliance,
|
---|
97 | CVirtualSystemDescriptionForm &comCloudVsdImportForm,
|
---|
98 | UIWizardImportApp *pWizard,
|
---|
99 | const QString &strMachineId,
|
---|
100 | const QString &strSource,
|
---|
101 | const QString &strProfileName,
|
---|
102 | bool fIsSourceCloudOne);
|
---|
103 |
|
---|
104 | /** Returns imported file path. */
|
---|
105 | QString path(UIEmptyFilePathSelector *pFileSelector);
|
---|
106 |
|
---|
107 | /** Returns profile name. */
|
---|
108 | QString profileName(QIComboBox *pCombo);
|
---|
109 | /** Returns machine ID. */
|
---|
110 | QString machineId(QListWidget *pListWidget);
|
---|
111 |
|
---|
112 | /** Updates source combo tool-tips. */
|
---|
113 | void updateSourceComboToolTip(QIComboBox *pCombo);
|
---|
114 | }
|
---|
115 |
|
---|
116 | /** UINativeWizardPage extension for Source page of the Import Appliance wizard,
|
---|
117 | * based on UIWizardImportAppSource namespace functions. */
|
---|
118 | class UIWizardImportAppPageSource : public UINativeWizardPage
|
---|
119 | {
|
---|
120 | Q_OBJECT;
|
---|
121 |
|
---|
122 | public:
|
---|
123 |
|
---|
124 | /** Constructs Source page.
|
---|
125 | * @param fImportFromOCIByDefault Brings whether we should propose import from OCI by default.
|
---|
126 | * @param strFileName Brings appliance file name. */
|
---|
127 | UIWizardImportAppPageSource(bool fImportFromOCIByDefault, const QString &strFileName);
|
---|
128 |
|
---|
129 | protected:
|
---|
130 |
|
---|
131 | /** Returns wizard this page belongs to. */
|
---|
132 | UIWizardImportApp *wizard() const;
|
---|
133 |
|
---|
134 | /** Performs page initialization. */
|
---|
135 | virtual void initializePage() RT_OVERRIDE RT_FINAL;
|
---|
136 |
|
---|
137 | /** Returns whether page is complete. */
|
---|
138 | virtual bool isComplete() const RT_OVERRIDE RT_FINAL;
|
---|
139 |
|
---|
140 | /** Performs page validation. */
|
---|
141 | virtual bool validatePage() RT_OVERRIDE RT_FINAL;
|
---|
142 |
|
---|
143 | private slots:
|
---|
144 |
|
---|
145 | /** Handles source combo change. */
|
---|
146 | void sltHandleSourceComboChange();
|
---|
147 |
|
---|
148 | /** Handles profile combo change. */
|
---|
149 | void sltHandleProfileComboChange();
|
---|
150 | /** Handles profile tool-button click. */
|
---|
151 | void sltHandleProfileButtonClick();
|
---|
152 |
|
---|
153 | /** Handles translation event. */
|
---|
154 | virtual void sltRetranslateUI() RT_OVERRIDE RT_FINAL;
|
---|
155 |
|
---|
156 | private:
|
---|
157 |
|
---|
158 | /** Update local stuff. */
|
---|
159 | void updateLocalStuff();
|
---|
160 | /** Updates cloud stuff. */
|
---|
161 | void updateCloudStuff();
|
---|
162 |
|
---|
163 | /** Holds whether default source should be Import from OCI. */
|
---|
164 | bool m_fImportFromOCIByDefault;
|
---|
165 | /** Handles the appliance file name. */
|
---|
166 | QString m_strFileName;
|
---|
167 |
|
---|
168 | /** Holds the cached source. */
|
---|
169 | QString m_strSource;
|
---|
170 | /** Holds the cached profile name. */
|
---|
171 | QString m_strProfileName;
|
---|
172 |
|
---|
173 | /** Holds the main label instance. */
|
---|
174 | QIRichTextLabel *m_pLabelMain;
|
---|
175 | /** Holds the description label instance. */
|
---|
176 | QIRichTextLabel *m_pLabelDescription;
|
---|
177 |
|
---|
178 | /** Holds the source layout instance. */
|
---|
179 | QGridLayout *m_pSourceLayout;
|
---|
180 | /** Holds the source type label instance. */
|
---|
181 | QLabel *m_pSourceLabel;
|
---|
182 | /** Holds the source type combo-box instance. */
|
---|
183 | QIComboBox *m_pSourceComboBox;
|
---|
184 |
|
---|
185 | /** Holds the settings widget 1 instance. */
|
---|
186 | QStackedWidget *m_pSettingsWidget1;
|
---|
187 |
|
---|
188 | /** Holds the local container layout instance. */
|
---|
189 | QGridLayout *m_pLocalContainerLayout;
|
---|
190 | /** Holds the file label instance. */
|
---|
191 | QLabel *m_pFileLabel;
|
---|
192 | /** Holds the file selector instance. */
|
---|
193 | UIEmptyFilePathSelector *m_pFileSelector;
|
---|
194 |
|
---|
195 | /** Holds the cloud container layout instance. */
|
---|
196 | QGridLayout *m_pCloudContainerLayout;
|
---|
197 | /** Holds the profile label instance. */
|
---|
198 | QLabel *m_pProfileLabel;
|
---|
199 | /** Holds the profile combo-box instance. */
|
---|
200 | QIComboBox *m_pProfileComboBox;
|
---|
201 | /** Holds the profile management tool-button instance. */
|
---|
202 | QIToolButton *m_pProfileToolButton;
|
---|
203 | /** Holds the profile instance label instance. */
|
---|
204 | QLabel *m_pProfileInstanceLabel;
|
---|
205 | /** Holds the profile instance list instance. */
|
---|
206 | QListWidget *m_pProfileInstanceList;
|
---|
207 | };
|
---|
208 |
|
---|
209 | #endif /* !FEQT_INCLUDED_SRC_wizards_importappliance_UIWizardImportAppPageSource_h */
|
---|