VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UIDetailsWidgetCloudNetwork.h

Last change on this file was 104358, checked in by vboxsync, 5 weeks ago

FE/Qt. bugref:10622. More refactoring around the retranslation functionality.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use