[66681] | 1 | /* $Id: UIDetailsWidgetCloudNetwork.h 104358 2024-04-18 05:33:40Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[92731] | 3 | * VBox Qt GUI - UIDetailsWidgetCloudNetwork class declaration.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
[25177] | 8 | *
|
---|
[96407] | 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
|
---|
[25177] | 26 | */
|
---|
| 27 |
|
---|
[92731] | 28 | #ifndef FEQT_INCLUDED_SRC_networkmanager_UIDetailsWidgetCloudNetwork_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_networkmanager_UIDetailsWidgetCloudNetwork_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[25177] | 33 |
|
---|
[66726] | 34 | /* Qt includes: */
|
---|
[104358] | 35 | #include <QDialog>
|
---|
[66726] | 36 |
|
---|
[66169] | 37 | /* GUI includes: */
|
---|
[67575] | 38 | #include "QIManagerDialog.h"
|
---|
[87276] | 39 | #include "UIPortForwardingTable.h"
|
---|
[25177] | 40 |
|
---|
[93328] | 41 | /* COM includes: */
|
---|
| 42 | #include "CVirtualSystemDescription.h"
|
---|
| 43 | #include "CVirtualSystemDescriptionForm.h"
|
---|
| 44 |
|
---|
[66681] | 45 | /* Forward declarations: */
|
---|
[67575] | 46 | class QAbstractButton;
|
---|
[66681] | 47 | class QCheckBox;
|
---|
[94027] | 48 | class QComboBox;
|
---|
[87622] | 49 | class QGridLayout;
|
---|
| 50 | class QGroupBox;
|
---|
[66681] | 51 | class QLabel;
|
---|
[87277] | 52 | class QLineEdit;
|
---|
[66781] | 53 | class QRadioButton;
|
---|
[67575] | 54 | class QIDialogButtonBox;
|
---|
[66681] | 55 | class QILineEdit;
|
---|
| 56 | class QITabWidget;
|
---|
[93328] | 57 | class QIToolButton;
|
---|
| 58 | class UIFormEditorWidget;
|
---|
| 59 | class UINotificationCenter;
|
---|
[25177] | 60 |
|
---|
[66681] | 61 |
|
---|
[93328] | 62 | /** QDialog subclass for subnet selection functionality. */
|
---|
[104223] | 63 | class UISubnetSelectionDialog : public QDialog
|
---|
[93328] | 64 | {
|
---|
| 65 | Q_OBJECT;
|
---|
| 66 |
|
---|
| 67 | public:
|
---|
| 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. */
|
---|
[103982] | 78 | virtual ~UISubnetSelectionDialog() RT_OVERRIDE RT_FINAL;
|
---|
[93328] | 79 |
|
---|
| 80 | /** Returns cached subnet ID. */
|
---|
| 81 | QString subnetId() const { return m_strSubnetId; }
|
---|
| 82 |
|
---|
| 83 | public slots:
|
---|
| 84 |
|
---|
| 85 | /** Accepts dialog. */
|
---|
[103982] | 86 | virtual void accept() RT_OVERRIDE RT_FINAL;
|
---|
[93328] | 87 |
|
---|
| 88 | /** Executes dialog. */
|
---|
[103982] | 89 | virtual int exec() RT_OVERRIDE RT_FINAL;
|
---|
[93328] | 90 |
|
---|
| 91 | private 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 |
|
---|
[104223] | 99 | /** Handles translation event. */
|
---|
| 100 | void sltRetranslateUI();
|
---|
| 101 |
|
---|
[93328] | 102 | private:
|
---|
| 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 |
|
---|
[92731] | 131 | /** Network Manager: Cloud network data structure. */
|
---|
| 132 | struct UIDataCloudNetwork
|
---|
[66169] | 133 | {
|
---|
| 134 | /** Constructs data. */
|
---|
[92731] | 135 | UIDataCloudNetwork()
|
---|
[87276] | 136 | : m_fExists(false)
|
---|
[92731] | 137 | , m_fEnabled(true)
|
---|
[87276] | 138 | , m_strName(QString())
|
---|
[92731] | 139 | , m_strProvider(QString())
|
---|
| 140 | , m_strProfile(QString())
|
---|
[92762] | 141 | , m_strId(QString())
|
---|
[66169] | 142 | {}
|
---|
| 143 |
|
---|
| 144 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
[92731] | 145 | bool equal(const UIDataCloudNetwork &other) const
|
---|
[66169] | 146 | {
|
---|
| 147 | return true
|
---|
[87276] | 148 | && (m_fExists == other.m_fExists)
|
---|
[92731] | 149 | && (m_fEnabled == other.m_fEnabled)
|
---|
[66169] | 150 | && (m_strName == other.m_strName)
|
---|
[92731] | 151 | && (m_strProvider == other.m_strProvider)
|
---|
| 152 | && (m_strProfile == other.m_strProfile)
|
---|
[92762] | 153 | && (m_strId == other.m_strId)
|
---|
[66169] | 154 | ;
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
[92731] | 158 | bool operator==(const UIDataCloudNetwork &other) const { return equal(other); }
|
---|
[66169] | 159 | /** Returns whether the @a other passed data is different from this one. */
|
---|
[92731] | 160 | bool operator!=(const UIDataCloudNetwork &other) const { return !equal(other); }
|
---|
[66169] | 161 |
|
---|
[87276] | 162 | /** Holds whether this network is not NULL. */
|
---|
[92731] | 163 | bool m_fExists;
|
---|
| 164 | /** Holds whether network is enabled. */
|
---|
| 165 | bool m_fEnabled;
|
---|
[87276] | 166 | /** Holds network name. */
|
---|
[92731] | 167 | QString m_strName;
|
---|
| 168 | /** Holds cloud provider name. */
|
---|
| 169 | QString m_strProvider;
|
---|
| 170 | /** Holds cloud profile name. */
|
---|
| 171 | QString m_strProfile;
|
---|
[92762] | 172 | /** Holds network id. */
|
---|
| 173 | QString m_strId;
|
---|
[66169] | 174 | };
|
---|
| 175 |
|
---|
| 176 |
|
---|
[92731] | 177 | /** Network Manager: Cloud network details-widget. */
|
---|
[104223] | 178 | class UIDetailsWidgetCloudNetwork : public QWidget
|
---|
[66169] | 179 | {
|
---|
[25177] | 180 | Q_OBJECT;
|
---|
| 181 |
|
---|
[66726] | 182 | signals:
|
---|
| 183 |
|
---|
| 184 | /** Notifies listeners about data changed and whether it @a fDiffers. */
|
---|
| 185 | void sigDataChanged(bool fDiffers);
|
---|
| 186 |
|
---|
[67575] | 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 |
|
---|
[25177] | 192 | public:
|
---|
| 193 |
|
---|
[67811] | 194 | /** Constructs medium details dialog passing @a pParent to the base-class.
|
---|
| 195 | * @param enmEmbedding Brings embedding type. */
|
---|
[92731] | 196 | UIDetailsWidgetCloudNetwork(EmbedTo enmEmbedding, QWidget *pParent = 0);
|
---|
[25177] | 197 |
|
---|
[66726] | 198 | /** Returns the host network data. */
|
---|
[92731] | 199 | const UIDataCloudNetwork &data() const { return m_newData; }
|
---|
[87295] | 200 | /** Defines the host network @a data.
|
---|
[92731] | 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());
|
---|
[66726] | 205 |
|
---|
[87305] | 206 | /** @name Change handling stuff.
|
---|
| 207 | * @{ */
|
---|
| 208 | /** Revalidates changes. */
|
---|
[87306] | 209 | bool revalidate() const;
|
---|
[87297] | 210 |
|
---|
[87305] | 211 | /** Updates button states. */
|
---|
| 212 | void updateButtonStates();
|
---|
| 213 | /** @} */
|
---|
| 214 |
|
---|
[25177] | 215 | private slots:
|
---|
| 216 |
|
---|
[66726] | 217 | /** @name Change handling stuff.
|
---|
[66915] | 218 | * @{ */
|
---|
[87276] | 219 | /** Handles network name text change. */
|
---|
| 220 | void sltNetworkNameChanged(const QString &strText);
|
---|
[92731] | 221 | /** Handles cloud provider name index change. */
|
---|
| 222 | void sltCloudProviderNameChanged(int iIndex);
|
---|
| 223 | /** Handles cloud profile name index change. */
|
---|
| 224 | void sltCloudProfileNameChanged(int iIndex);
|
---|
[92762] | 225 | /** Handles network id text change. */
|
---|
| 226 | void sltNetworkIdChanged(const QString &strText);
|
---|
[93328] | 227 | /** Handles request to list possible network ids. */
|
---|
| 228 | void sltNetworkIdListRequested();
|
---|
[25177] | 229 |
|
---|
[67575] | 230 | /** Handles button-box button click. */
|
---|
| 231 | void sltHandleButtonBoxClick(QAbstractButton *pButton);
|
---|
[66726] | 232 | /** @} */
|
---|
[48458] | 233 |
|
---|
[104223] | 234 | /** Handles translation event. */
|
---|
| 235 | void sltRetranslateUI();
|
---|
| 236 |
|
---|
[25177] | 237 | private:
|
---|
| 238 |
|
---|
[66681] | 239 | /** @name Prepare/cleanup cascade.
|
---|
[66915] | 240 | * @{ */
|
---|
[66681] | 241 | /** Prepares all. */
|
---|
| 242 | void prepare();
|
---|
| 243 | /** Prepares this. */
|
---|
| 244 | void prepareThis();
|
---|
[92731] | 245 | /** Prepares providers. */
|
---|
| 246 | void prepareProviders();
|
---|
| 247 | /** Prepares profiles. */
|
---|
| 248 | void prepareProfiles();
|
---|
[66681] | 249 | /** @} */
|
---|
[48458] | 250 |
|
---|
[66726] | 251 | /** @name Loading stuff.
|
---|
[66915] | 252 | * @{ */
|
---|
[92731] | 253 | /** Loads data. */
|
---|
| 254 | void loadData();
|
---|
[66681] | 255 | /** @} */
|
---|
[65603] | 256 |
|
---|
[66681] | 257 | /** @name General variables.
|
---|
[66915] | 258 | * @{ */
|
---|
[67575] | 259 | /** Holds the parent widget embedding type. */
|
---|
| 260 | const EmbedTo m_enmEmbedding;
|
---|
| 261 |
|
---|
[66726] | 262 | /** Holds the old data copy. */
|
---|
[92731] | 263 | UIDataCloudNetwork m_oldData;
|
---|
[66726] | 264 | /** Holds the new data copy. */
|
---|
[92731] | 265 | UIDataCloudNetwork m_newData;
|
---|
[66681] | 266 | /** @} */
|
---|
| 267 |
|
---|
[87276] | 268 | /** @name Network variables.
|
---|
[66915] | 269 | * @{ */
|
---|
[87276] | 270 | /** Holds the network name label instance. */
|
---|
[93328] | 271 | QLabel *m_pLabelNetworkName;
|
---|
[87276] | 272 | /** Holds the network name editor instance. */
|
---|
[93328] | 273 | QLineEdit *m_pEditorNetworkName;
|
---|
[92731] | 274 | /** Holds the cloud provider name label instance. */
|
---|
[93328] | 275 | QLabel *m_pLabelProviderName;
|
---|
[92731] | 276 | /** Holds the cloud provider name combo instance. */
|
---|
[94027] | 277 | QComboBox *m_pComboProviderName;
|
---|
[92731] | 278 | /** Holds the cloud profile name label instance. */
|
---|
[93328] | 279 | QLabel *m_pLabelProfileName;
|
---|
[92731] | 280 | /** Holds the cloud profile name combo instance. */
|
---|
[94027] | 281 | QComboBox *m_pComboProfileName;
|
---|
[92762] | 282 | /** Holds the network id label instance. */
|
---|
[93328] | 283 | QLabel *m_pLabelNetworkId;
|
---|
[92762] | 284 | /** Holds the network id editor instance. */
|
---|
[93328] | 285 | QLineEdit *m_pEditorNetworkId;
|
---|
| 286 | /** Holds the network id list button instance. */
|
---|
| 287 | QIToolButton *m_pButtonNetworkId;
|
---|
[92731] | 288 |
|
---|
[87276] | 289 | /** Holds the 'Options' button-box instance. */
|
---|
| 290 | QIDialogButtonBox *m_pButtonBoxOptions;
|
---|
[87312] | 291 | /** Holds the list of names busy by other
|
---|
| 292 | * NAT networks. */
|
---|
[92731] | 293 | QStringList m_busyNames;
|
---|
[66681] | 294 | /** @} */
|
---|
[25177] | 295 | };
|
---|
| 296 |
|
---|
[66681] | 297 |
|
---|
[92731] | 298 | #endif /* !FEQT_INCLUDED_SRC_networkmanager_UIDetailsWidgetCloudNetwork_h */
|
---|