VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h@ 104158

Last change on this file since 104158 was 101717, checked in by vboxsync, 16 months ago

FE/Qt: bugref:10513: UIEditor and sub-classes: Simplify filterOut stuff; No need to pass everything through whole the hierarchy, enough to handle optional method only.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.1 KB
Line 
1/* $Id: UIMachineSettingsNetwork.h 101717 2023-11-02 12:22:25Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMachineSettingsNetwork class declaration.
4 */
5
6/*
7 * Copyright (C) 2008-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_settings_machine_UIMachineSettingsNetwork_h
29#define FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsNetwork_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "UISettingsPage.h"
36#include "UIMachineSettingsPortForwardingDlg.h"
37
38/* Forward declarations: */
39class QITabWidget;
40class UINetworkSettingsEditor;
41struct UIDataSettingsMachineNetwork;
42struct UIDataSettingsMachineNetworkAdapter;
43typedef UISettingsCache<UIDataPortForwardingRule> UISettingsCachePortForwardingRule;
44typedef UISettingsCachePool<UIDataSettingsMachineNetworkAdapter, UISettingsCachePortForwardingRule> UISettingsCacheMachineNetworkAdapter;
45typedef UISettingsCachePool<UIDataSettingsMachineNetwork, UISettingsCacheMachineNetworkAdapter> UISettingsCacheMachineNetwork;
46
47/** Machine settings: Network page. */
48class SHARED_LIBRARY_STUFF UIMachineSettingsNetwork : public UISettingsPageMachine
49{
50 Q_OBJECT;
51
52public:
53
54 /** Constructs Network settings page. */
55 UIMachineSettingsNetwork();
56 /** Destructs Network settings page. */
57 virtual ~UIMachineSettingsNetwork() RT_OVERRIDE;
58
59 /** Returns the bridged adapter list. */
60 const QStringList &bridgedAdapterList() const { return m_bridgedAdapterList; }
61 /** Returns the internal network list. */
62 const QStringList &internalNetworkList() const { return m_internalNetworkList; }
63 /** Returns the host-only interface list. */
64 const QStringList &hostInterfaceList() const { return m_hostInterfaceList; }
65 /** Returns the generic driver list. */
66 const QStringList &genericDriverList() const { return m_genericDriverList; }
67 /** Returns the NAT network list. */
68 const QStringList &natNetworkList() const { return m_natNetworkList; }
69#ifdef VBOX_WITH_CLOUD_NET
70 /** Returns the cloud network list. */
71 const QStringList &cloudNetworkList() const { return m_cloudNetworkList; }
72#endif
73#ifdef VBOX_WITH_VMNET
74 /** Returns the host-only network list. */
75 const QStringList &hostOnlyNetworkList() const { return m_hostOnlyNetworkList; }
76#endif
77
78protected:
79
80 /** Returns whether the page content was changed. */
81 virtual bool changed() const RT_OVERRIDE;
82
83 /** Loads settings from external object(s) packed inside @a data to cache.
84 * @note This task WILL be performed in other than the GUI thread, no widget interactions! */
85 virtual void loadToCacheFrom(QVariant &data) RT_OVERRIDE;
86 /** Loads data from cache to corresponding widgets.
87 * @note This task WILL be performed in the GUI thread only, all widget interactions here! */
88 virtual void getFromCache() RT_OVERRIDE;
89
90 /** Saves data from corresponding widgets to cache.
91 * @note This task WILL be performed in the GUI thread only, all widget interactions here! */
92 virtual void putToCache() RT_OVERRIDE;
93 /** Saves settings from cache to external object(s) packed inside @a data.
94 * @note This task WILL be performed in other than the GUI thread, no widget interactions! */
95 virtual void saveFromCacheTo(QVariant &data) RT_OVERRIDE;
96
97 /** Performs validation, updates @a messages list if something is wrong. */
98 virtual bool validate(QList<UIValidationMessage> &messages) RT_OVERRIDE;
99
100 /** Handles translation event. */
101 virtual void retranslateUi() RT_OVERRIDE;
102
103 /** Handles filter change. */
104 virtual void handleFilterChange() RT_OVERRIDE;
105
106 /** Performs final page polishing. */
107 virtual void polishPage() RT_OVERRIDE;
108
109private slots:
110
111 /** Handles adapter alternative name change. */
112 void sltHandleAlternativeNameChange();
113
114private:
115
116 /** Prepares all. */
117 void prepare();
118 /** Prepares widgets. */
119 void prepareWidgets();
120 /** Prepare tab. */
121 void prepareTab();
122 /** Prepares connections. */
123 void prepareConnections(UINetworkSettingsEditor *pTabEditor);
124 /** Cleanups all. */
125 void cleanup();
126
127 /** Performs tab polishing for specified @a iSlot. */
128 void polishTab(int iSlot);
129
130 /** Loads adapter data for specified @a iSlot from @a adapterCache to corresponding widgets. */
131 void getFromCache(int iSlot, const UISettingsCacheMachineNetworkAdapter &adapterCache);
132 /** Saves adapter data for specified @a iSlot from corresponding widgets to @a adapterCache. */
133 void putToCache(int iSlot, UISettingsCacheMachineNetworkAdapter &adapterCache);
134
135 /** Reloads tab alternatives for specified @a iSlot. */
136 void reloadAlternatives(int iSlot);
137
138 /** Returns tab attachment type for specified @a iSlot. */
139 KNetworkAttachmentType attachmentType(int iSlot) const;
140 /** Returne tab alternative name for specified @a iSlot and @a enmType. */
141 QString alternativeName(int iSlot, KNetworkAttachmentType enmType = KNetworkAttachmentType_Null) const;
142
143 /** Performs validation for specified @a iSlot, updates @a messages list if something is wrong. */
144 bool validate(int iSlot, QList<UIValidationMessage> &messages);
145
146 /** Repopulates bridged adapter list. */
147 void refreshBridgedAdapterList();
148 /** Repopulates internal network list. */
149 void refreshInternalNetworkList(bool fFullRefresh = false);
150 /** Repopulates host-only interface list. */
151 void refreshHostInterfaceList();
152 /** Repopulates generic driver list. */
153 void refreshGenericDriverList(bool fFullRefresh = false);
154 /** Repopulates NAT network list. */
155 void refreshNATNetworkList();
156#ifdef VBOX_WITH_CLOUD_NET
157 /** Repopulates cloud network list. */
158 void refreshCloudNetworkList();
159#endif
160#ifdef VBOX_WITH_VMNET
161 /** Repopulates host-only network list. */
162 void refreshHostOnlyNetworkList();
163#endif
164
165 /** Returns tab title for specified @a iSlot. */
166 static QString tabTitle(int iSlot);
167
168 /** Loads generic properties from passed @a adapter. */
169 static QString loadGenericProperties(const CNetworkAdapter &adapter);
170 /** Saves generic @a strProperties to passed @a adapter. */
171 static bool saveGenericProperties(CNetworkAdapter &comAdapter, const QString &strProperties);
172
173 /** Saves existing data from cache. */
174 bool saveData();
175 /** Saves existing adapter data from cache. */
176 bool saveAdapterData(int iSlot);
177
178 /** Holds the bridged adapter list. */
179 QStringList m_bridgedAdapterList;
180 /** Holds the internal network list. */
181 QStringList m_internalNetworkList;
182 /** Holds the saved internal network list. */
183 QStringList m_internalNetworkListSaved;
184 /** Holds the host-only interface list. */
185 QStringList m_hostInterfaceList;
186 /** Holds the generic driver list. */
187 QStringList m_genericDriverList;
188 /** Holds the saved generic driver list. */
189 QStringList m_genericDriverListSaved;
190 /** Holds the NAT network list. */
191 QStringList m_natNetworkList;
192#ifdef VBOX_WITH_CLOUD_NET
193 /** Holds the cloud network list. */
194 QStringList m_cloudNetworkList;
195#endif
196#ifdef VBOX_WITH_VMNET
197 /** Holds the host-only network list. */
198 QStringList m_hostOnlyNetworkList;
199#endif
200
201 /** Holds the page data cache instance. */
202 UISettingsCacheMachineNetwork *m_pCache;
203
204 /** Holds the tab-widget instance. */
205 QITabWidget *m_pTabWidget;
206
207 /** Holds the list of tab-editors. */
208 QList<UINetworkSettingsEditor*> m_tabEditors;
209};
210
211#endif /* !FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsNetwork_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette