1 | /* $Id: UINetworkSettingsEditor.h 104313 2024-04-12 13:10:30Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UINetworkSettingsEditor class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2019-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_editors_UINetworkSettingsEditor_h
|
---|
29 | #define FEQT_INCLUDED_SRC_settings_editors_UINetworkSettingsEditor_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UIEditor.h"
|
---|
36 | #include "UIPortForwardingTable.h"
|
---|
37 |
|
---|
38 | /* COM includes: */
|
---|
39 | #include "KNetworkAdapterType.h"
|
---|
40 | #include "KNetworkAttachmentType.h"
|
---|
41 | #include "KNetworkAdapterPromiscModePolicy.h"
|
---|
42 |
|
---|
43 |
|
---|
44 | /* Forward declarations: */
|
---|
45 | class QCheckBox;
|
---|
46 | class UINetworkAttachmentEditor;
|
---|
47 | class UINetworkFeaturesEditor;
|
---|
48 |
|
---|
49 | /** UIEditor sub-class used as a network settings editor. */
|
---|
50 | class SHARED_LIBRARY_STUFF UINetworkSettingsEditor : public UIEditor
|
---|
51 | {
|
---|
52 | Q_OBJECT;
|
---|
53 |
|
---|
54 | signals:
|
---|
55 |
|
---|
56 | /** @name Attachment editor stuff
|
---|
57 | * @{ */
|
---|
58 | /** Notifies about feature state changed. */
|
---|
59 | void sigFeatureStateChanged();
|
---|
60 | /** Notifies about attachment type changed. */
|
---|
61 | void sigAttachmentTypeChanged();
|
---|
62 | /** Notifies about alternative name changed. */
|
---|
63 | void sigAlternativeNameChanged();
|
---|
64 | /** @} */
|
---|
65 |
|
---|
66 | /** @name Features editor stuff
|
---|
67 | * @{ */
|
---|
68 | /** Notifies about MAC address changed. */
|
---|
69 | void sigMACAddressChanged();
|
---|
70 | /** @} */
|
---|
71 |
|
---|
72 | public:
|
---|
73 |
|
---|
74 | /** Constructs editor passing @a pParent to the base-class. */
|
---|
75 | UINetworkSettingsEditor(QWidget *pParent = 0);
|
---|
76 |
|
---|
77 | /** @name General stuff
|
---|
78 | * @{ */
|
---|
79 | /** Defines whether feature is @a fEnabled. */
|
---|
80 | void setFeatureEnabled(bool fEnabled);
|
---|
81 | /** Returns whether feature is enabled. */
|
---|
82 | bool isFeatureEnabled() const;
|
---|
83 |
|
---|
84 | /** Defines whether feature @a fAvailable. */
|
---|
85 | void setFeatureAvailable(bool fAvailable);
|
---|
86 | /** @} */
|
---|
87 |
|
---|
88 | /** @name Attachment editor stuff
|
---|
89 | * @{ */
|
---|
90 | /** Defines value @a enmType. */
|
---|
91 | void setValueType(KNetworkAttachmentType enmType);
|
---|
92 | /** Returns value type. */
|
---|
93 | KNetworkAttachmentType valueType() const;
|
---|
94 |
|
---|
95 | /** Defines value @a names for specified @a enmType. */
|
---|
96 | void setValueNames(KNetworkAttachmentType enmType, const QStringList &names);
|
---|
97 | /** Defines value @a strName for specified @a enmType. */
|
---|
98 | void setValueName(KNetworkAttachmentType enmType, const QString &strName);
|
---|
99 | /** Returns current name for specified @a enmType. */
|
---|
100 | QString valueName(KNetworkAttachmentType enmType) const;
|
---|
101 |
|
---|
102 | /** Defines whether attachment options @a fAvailable. */
|
---|
103 | void setAttachmentOptionsAvailable(bool fAvailable);
|
---|
104 | /** @} */
|
---|
105 |
|
---|
106 | /** @name Features editor stuff
|
---|
107 | * @{ */
|
---|
108 | /** Defines adapter @a enmType. */
|
---|
109 | void setAdapterType(const KNetworkAdapterType &enmType);
|
---|
110 | /** Returns adapter type. */
|
---|
111 | KNetworkAdapterType adapterType() const;
|
---|
112 |
|
---|
113 | /** Defines promiscuous @a enmMode. */
|
---|
114 | void setPromiscuousMode(const KNetworkAdapterPromiscModePolicy &enmMode);
|
---|
115 | /** Returns promiscuous mode. */
|
---|
116 | KNetworkAdapterPromiscModePolicy promiscuousMode() const;
|
---|
117 |
|
---|
118 | /** Defines MAC @a strAddress. */
|
---|
119 | void setMACAddress(const QString &strAddress);
|
---|
120 | /** Returns MAC address. */
|
---|
121 | QString macAddress() const;
|
---|
122 |
|
---|
123 | /** Defines generic @a strProperties. */
|
---|
124 | void setGenericProperties(const QString &strProperties);
|
---|
125 | /** Returns generic properties. */
|
---|
126 | QString genericProperties() const;
|
---|
127 |
|
---|
128 | /** Defines whether cable is @a fConnected. */
|
---|
129 | void setCableConnected(bool fConnected);
|
---|
130 | /** Returns whether cable is connected. */
|
---|
131 | bool cableConnected() const;
|
---|
132 |
|
---|
133 | /** Defines list of port forwarding @a rules. */
|
---|
134 | void setPortForwardingRules(const UIPortForwardingDataList &rules);
|
---|
135 | /** Returns list of port forwarding rules. */
|
---|
136 | UIPortForwardingDataList portForwardingRules() const;
|
---|
137 |
|
---|
138 | /** Defines whether adapter options @a fAvailable. */
|
---|
139 | void setAdapterOptionsAvailable(bool fAvailable);
|
---|
140 | /** Defines whether promiscuous options @a fAvailable. */
|
---|
141 | void setPromiscuousOptionsAvailable(bool fAvailable);
|
---|
142 | /** Defines whether MAC options @a fAvailable. */
|
---|
143 | void setMACOptionsAvailable(bool fAvailable);
|
---|
144 | /** Defines whether generic properties @a fAvailable. */
|
---|
145 | void setGenericPropertiesAvailable(bool fAvailable);
|
---|
146 | /** Defines whether cable options @a fAvailable. */
|
---|
147 | void setCableOptionsAvailable(bool fAvailable);
|
---|
148 | /** Defines whether forwarding options @a fAvailable. */
|
---|
149 | void setForwardingOptionsAvailable(bool fAvailable);
|
---|
150 | /** @} */
|
---|
151 |
|
---|
152 | protected:
|
---|
153 |
|
---|
154 | /** Handles filter change. */
|
---|
155 | virtual void handleFilterChange() RT_OVERRIDE;
|
---|
156 |
|
---|
157 | private slots:
|
---|
158 |
|
---|
159 | /** Handles translation event. */
|
---|
160 | virtual void sltRetranslateUI() RT_OVERRIDE RT_FINAL;
|
---|
161 | /** Handles feature toggling. */
|
---|
162 | void sltHandleFeatureToggled();
|
---|
163 | /** Handles adapter attachment type change. */
|
---|
164 | void sltHandleAttachmentTypeChange();
|
---|
165 |
|
---|
166 | private:
|
---|
167 |
|
---|
168 | /** Prepares all. */
|
---|
169 | void prepare();
|
---|
170 | /** Prepares widgets. */
|
---|
171 | void prepareWidgets();
|
---|
172 | /** Prepares connections. */
|
---|
173 | void prepareConnections();
|
---|
174 |
|
---|
175 | /** Updates feature availability. */
|
---|
176 | void updateFeatureAvailability();
|
---|
177 | /** Updates minimum layout hint. */
|
---|
178 | void updateMinimumLayoutHint();
|
---|
179 |
|
---|
180 | /** @name Values
|
---|
181 | * @{ */
|
---|
182 | /** Holds whether feature is enabled. */
|
---|
183 | bool m_fFeatureEnabled;
|
---|
184 | /** @} */
|
---|
185 |
|
---|
186 | /** @name Widgets
|
---|
187 | * @{ */
|
---|
188 | /** Holds the feature check-box instance. */
|
---|
189 | QCheckBox *m_pCheckboxFeature;
|
---|
190 | /** Holds the settings widget instance. */
|
---|
191 | QWidget *m_pWidgetSettings;
|
---|
192 | /** Holds the network attachment editor instance. */
|
---|
193 | UINetworkAttachmentEditor *m_pEditorNetworkAttachment;
|
---|
194 | /** Holds the network features editor instance. */
|
---|
195 | UINetworkFeaturesEditor *m_pEditorNetworkFeatures;
|
---|
196 | /** @} */
|
---|
197 | };
|
---|
198 |
|
---|
199 | #endif /* !FEQT_INCLUDED_SRC_settings_editors_UINetworkSettingsEditor_h */
|
---|