1 | /* $Id: UIDetailsWidgetCloudNetwork.h 103982 2024-03-21 11:43:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIDetailsWidgetCloudNetwork 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_networkmanager_UIDetailsWidgetCloudNetwork_h
|
---|
29 | #define FEQT_INCLUDED_SRC_networkmanager_UIDetailsWidgetCloudNetwork_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QWidget>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "QIManagerDialog.h"
|
---|
39 | #include "QIWithRetranslateUI.h"
|
---|
40 | #include "UIPortForwardingTable.h"
|
---|
41 |
|
---|
42 | /* COM includes: */
|
---|
43 | #include "CVirtualSystemDescription.h"
|
---|
44 | #include "CVirtualSystemDescriptionForm.h"
|
---|
45 |
|
---|
46 | /* Forward declarations: */
|
---|
47 | class QAbstractButton;
|
---|
48 | class QCheckBox;
|
---|
49 | class QComboBox;
|
---|
50 | class QGridLayout;
|
---|
51 | class QGroupBox;
|
---|
52 | class QLabel;
|
---|
53 | class QLineEdit;
|
---|
54 | class QRadioButton;
|
---|
55 | class QIDialogButtonBox;
|
---|
56 | class QILineEdit;
|
---|
57 | class QITabWidget;
|
---|
58 | class QIToolButton;
|
---|
59 | class UIFormEditorWidget;
|
---|
60 | class UINotificationCenter;
|
---|
61 |
|
---|
62 |
|
---|
63 | /** QDialog subclass for subnet selection functionality. */
|
---|
64 | class UISubnetSelectionDialog : public QIWithRetranslateUI<QDialog>
|
---|
65 | {
|
---|
66 | Q_OBJECT;
|
---|
67 |
|
---|
68 | public:
|
---|
69 |
|
---|
70 | /** Constructs dialog passing @a pParent to the base-class.
|
---|
71 | * @param strProviderShortName Brings the short provider name for cloud client being created.
|
---|
72 | * @param strProfileName Brings the profile name for cloud client being created.
|
---|
73 | * @param strSubnetId Brings the initial subnet ID to be cached. */
|
---|
74 | UISubnetSelectionDialog(QWidget *pParent,
|
---|
75 | const QString &strProviderShortName,
|
---|
76 | const QString &strProfileName,
|
---|
77 | const QString &strSubnetId);
|
---|
78 | /** Destructs dialog. */
|
---|
79 | virtual ~UISubnetSelectionDialog() RT_OVERRIDE RT_FINAL;
|
---|
80 |
|
---|
81 | /** Returns cached subnet ID. */
|
---|
82 | QString subnetId() const { return m_strSubnetId; }
|
---|
83 |
|
---|
84 | public slots:
|
---|
85 |
|
---|
86 | /** Accepts dialog. */
|
---|
87 | virtual void accept() RT_OVERRIDE RT_FINAL;
|
---|
88 |
|
---|
89 | /** Executes dialog. */
|
---|
90 | virtual int exec() RT_OVERRIDE RT_FINAL;
|
---|
91 |
|
---|
92 | protected:
|
---|
93 |
|
---|
94 | /** Handles translation event. */
|
---|
95 | virtual void retranslateUi() RT_OVERRIDE RT_FINAL;
|
---|
96 |
|
---|
97 | private slots:
|
---|
98 |
|
---|
99 | /** Performs dialog initialization. */
|
---|
100 | void sltInit();
|
---|
101 |
|
---|
102 | /** Handles notification about subnet selection @a comForm being created. */
|
---|
103 | void sltHandleVSDFormCreated(const CVirtualSystemDescriptionForm &comForm);
|
---|
104 |
|
---|
105 | private:
|
---|
106 |
|
---|
107 | /** Prepares all. */
|
---|
108 | void prepare();
|
---|
109 | /** Cleanups all. */
|
---|
110 | void cleanup();
|
---|
111 |
|
---|
112 | /** Holds the short provider name for cloud client being created. */
|
---|
113 | QString m_strProviderShortName;
|
---|
114 | /** Holds the profile name for cloud client being created. */
|
---|
115 | QString m_strProfileName;
|
---|
116 | /** Holds the cached subnet ID. */
|
---|
117 | QString m_strSubnetId;
|
---|
118 |
|
---|
119 | /** Holds the virtual system description container. */
|
---|
120 | CVirtualSystemDescription m_comDescription;
|
---|
121 | /** Holds the virtual system description form. */
|
---|
122 | CVirtualSystemDescriptionForm m_comForm;
|
---|
123 |
|
---|
124 | /** Holds the form editor instance. */
|
---|
125 | UIFormEditorWidget *m_pFormEditor;
|
---|
126 | /** Holds the button-box instance. */
|
---|
127 | QIDialogButtonBox *m_pButtonBox;
|
---|
128 |
|
---|
129 | /** Holds the notification-center instance. */
|
---|
130 | UINotificationCenter *m_pNotificationCenter;
|
---|
131 | };
|
---|
132 |
|
---|
133 |
|
---|
134 | /** Network Manager: Cloud network data structure. */
|
---|
135 | struct UIDataCloudNetwork
|
---|
136 | {
|
---|
137 | /** Constructs data. */
|
---|
138 | UIDataCloudNetwork()
|
---|
139 | : m_fExists(false)
|
---|
140 | , m_fEnabled(true)
|
---|
141 | , m_strName(QString())
|
---|
142 | , m_strProvider(QString())
|
---|
143 | , m_strProfile(QString())
|
---|
144 | , m_strId(QString())
|
---|
145 | {}
|
---|
146 |
|
---|
147 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
148 | bool equal(const UIDataCloudNetwork &other) const
|
---|
149 | {
|
---|
150 | return true
|
---|
151 | && (m_fExists == other.m_fExists)
|
---|
152 | && (m_fEnabled == other.m_fEnabled)
|
---|
153 | && (m_strName == other.m_strName)
|
---|
154 | && (m_strProvider == other.m_strProvider)
|
---|
155 | && (m_strProfile == other.m_strProfile)
|
---|
156 | && (m_strId == other.m_strId)
|
---|
157 | ;
|
---|
158 | }
|
---|
159 |
|
---|
160 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
161 | bool operator==(const UIDataCloudNetwork &other) const { return equal(other); }
|
---|
162 | /** Returns whether the @a other passed data is different from this one. */
|
---|
163 | bool operator!=(const UIDataCloudNetwork &other) const { return !equal(other); }
|
---|
164 |
|
---|
165 | /** Holds whether this network is not NULL. */
|
---|
166 | bool m_fExists;
|
---|
167 | /** Holds whether network is enabled. */
|
---|
168 | bool m_fEnabled;
|
---|
169 | /** Holds network name. */
|
---|
170 | QString m_strName;
|
---|
171 | /** Holds cloud provider name. */
|
---|
172 | QString m_strProvider;
|
---|
173 | /** Holds cloud profile name. */
|
---|
174 | QString m_strProfile;
|
---|
175 | /** Holds network id. */
|
---|
176 | QString m_strId;
|
---|
177 | };
|
---|
178 |
|
---|
179 |
|
---|
180 | /** Network Manager: Cloud network details-widget. */
|
---|
181 | class UIDetailsWidgetCloudNetwork : public QIWithRetranslateUI<QWidget>
|
---|
182 | {
|
---|
183 | Q_OBJECT;
|
---|
184 |
|
---|
185 | signals:
|
---|
186 |
|
---|
187 | /** Notifies listeners about data changed and whether it @a fDiffers. */
|
---|
188 | void sigDataChanged(bool fDiffers);
|
---|
189 |
|
---|
190 | /** Notifies listeners about data change rejected and should be reseted. */
|
---|
191 | void sigDataChangeRejected();
|
---|
192 | /** Notifies listeners about data change accepted and should be applied. */
|
---|
193 | void sigDataChangeAccepted();
|
---|
194 |
|
---|
195 | public:
|
---|
196 |
|
---|
197 | /** Constructs medium details dialog passing @a pParent to the base-class.
|
---|
198 | * @param enmEmbedding Brings embedding type. */
|
---|
199 | UIDetailsWidgetCloudNetwork(EmbedTo enmEmbedding, QWidget *pParent = 0);
|
---|
200 |
|
---|
201 | /** Returns the host network data. */
|
---|
202 | const UIDataCloudNetwork &data() const { return m_newData; }
|
---|
203 | /** Defines the host network @a data.
|
---|
204 | * @param busyNames Holds the list of names busy by other
|
---|
205 | * Cloud networks. */
|
---|
206 | void setData(const UIDataCloudNetwork &data,
|
---|
207 | const QStringList &busyNames = QStringList());
|
---|
208 |
|
---|
209 | /** @name Change handling stuff.
|
---|
210 | * @{ */
|
---|
211 | /** Revalidates changes. */
|
---|
212 | bool revalidate() const;
|
---|
213 |
|
---|
214 | /** Updates button states. */
|
---|
215 | void updateButtonStates();
|
---|
216 | /** @} */
|
---|
217 |
|
---|
218 | protected:
|
---|
219 |
|
---|
220 | /** Handles translation event. */
|
---|
221 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
222 |
|
---|
223 | private slots:
|
---|
224 |
|
---|
225 | /** @name Change handling stuff.
|
---|
226 | * @{ */
|
---|
227 | /** Handles network name text change. */
|
---|
228 | void sltNetworkNameChanged(const QString &strText);
|
---|
229 | /** Handles cloud provider name index change. */
|
---|
230 | void sltCloudProviderNameChanged(int iIndex);
|
---|
231 | /** Handles cloud profile name index change. */
|
---|
232 | void sltCloudProfileNameChanged(int iIndex);
|
---|
233 | /** Handles network id text change. */
|
---|
234 | void sltNetworkIdChanged(const QString &strText);
|
---|
235 | /** Handles request to list possible network ids. */
|
---|
236 | void sltNetworkIdListRequested();
|
---|
237 |
|
---|
238 | /** Handles button-box button click. */
|
---|
239 | void sltHandleButtonBoxClick(QAbstractButton *pButton);
|
---|
240 | /** @} */
|
---|
241 |
|
---|
242 | private:
|
---|
243 |
|
---|
244 | /** @name Prepare/cleanup cascade.
|
---|
245 | * @{ */
|
---|
246 | /** Prepares all. */
|
---|
247 | void prepare();
|
---|
248 | /** Prepares this. */
|
---|
249 | void prepareThis();
|
---|
250 | /** Prepares providers. */
|
---|
251 | void prepareProviders();
|
---|
252 | /** Prepares profiles. */
|
---|
253 | void prepareProfiles();
|
---|
254 | /** @} */
|
---|
255 |
|
---|
256 | /** @name Loading stuff.
|
---|
257 | * @{ */
|
---|
258 | /** Loads data. */
|
---|
259 | void loadData();
|
---|
260 | /** @} */
|
---|
261 |
|
---|
262 | /** @name General variables.
|
---|
263 | * @{ */
|
---|
264 | /** Holds the parent widget embedding type. */
|
---|
265 | const EmbedTo m_enmEmbedding;
|
---|
266 |
|
---|
267 | /** Holds the old data copy. */
|
---|
268 | UIDataCloudNetwork m_oldData;
|
---|
269 | /** Holds the new data copy. */
|
---|
270 | UIDataCloudNetwork m_newData;
|
---|
271 | /** @} */
|
---|
272 |
|
---|
273 | /** @name Network variables.
|
---|
274 | * @{ */
|
---|
275 | /** Holds the network name label instance. */
|
---|
276 | QLabel *m_pLabelNetworkName;
|
---|
277 | /** Holds the network name editor instance. */
|
---|
278 | QLineEdit *m_pEditorNetworkName;
|
---|
279 | /** Holds the cloud provider name label instance. */
|
---|
280 | QLabel *m_pLabelProviderName;
|
---|
281 | /** Holds the cloud provider name combo instance. */
|
---|
282 | QComboBox *m_pComboProviderName;
|
---|
283 | /** Holds the cloud profile name label instance. */
|
---|
284 | QLabel *m_pLabelProfileName;
|
---|
285 | /** Holds the cloud profile name combo instance. */
|
---|
286 | QComboBox *m_pComboProfileName;
|
---|
287 | /** Holds the network id label instance. */
|
---|
288 | QLabel *m_pLabelNetworkId;
|
---|
289 | /** Holds the network id editor instance. */
|
---|
290 | QLineEdit *m_pEditorNetworkId;
|
---|
291 | /** Holds the network id list button instance. */
|
---|
292 | QIToolButton *m_pButtonNetworkId;
|
---|
293 |
|
---|
294 | /** Holds the 'Options' button-box instance. */
|
---|
295 | QIDialogButtonBox *m_pButtonBoxOptions;
|
---|
296 | /** Holds the list of names busy by other
|
---|
297 | * NAT networks. */
|
---|
298 | QStringList m_busyNames;
|
---|
299 | /** @} */
|
---|
300 | };
|
---|
301 |
|
---|
302 |
|
---|
303 | #endif /* !FEQT_INCLUDED_SRC_networkmanager_UIDetailsWidgetCloudNetwork_h */
|
---|