VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.h@ 82781

Last change on this file since 82781 was 76581, checked in by vboxsync, 5 years ago

Fe/QT: scm header guard alignment.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1/* $Id: UIHostNetworkManager.h 76581 2019-01-01 06:24:57Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIHostNetworkManager class declaration.
4 */
5
6/*
7 * Copyright (C) 2009-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef FEQT_INCLUDED_SRC_hostnetwork_UIHostNetworkManager_h
19#define FEQT_INCLUDED_SRC_hostnetwork_UIHostNetworkManager_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* Qt includes: */
25#include <QMainWindow>
26
27/* GUI includes: */
28#include "QIManagerDialog.h"
29#include "QIWithRetranslateUI.h"
30
31/* Forward declarations: */
32class CHostNetworkInterface;
33class QAbstractButton;
34class QTreeWidgetItem;
35class QIDialogButtonBox;
36class QITreeWidget;
37class UIActionPool;
38class UIHostNetworkDetailsWidget;
39class UIItemHostNetwork;
40class UIToolBar;
41struct UIDataHostNetwork;
42
43
44/** QWidget extension providing GUI with the pane to control host network related functionality. */
45class UIHostNetworkManagerWidget : public QIWithRetranslateUI<QWidget>
46{
47 Q_OBJECT;
48
49signals:
50
51 /** Notifies listeners about host network details-widget @a fVisible. */
52 void sigHostNetworkDetailsVisibilityChanged(bool fVisible);
53 /** Notifies listeners about host network details data @a fDiffers. */
54 void sigHostNetworkDetailsDataChanged(bool fDiffers);
55
56public:
57
58 /** Constructs Host Network Manager widget.
59 * @param enmEmbedding Brings the type of widget embedding.
60 * @param pActionPool Brings the action-pool reference.
61 * @param fShowToolbar Brings whether we should create/show toolbar. */
62 UIHostNetworkManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
63 bool fShowToolbar = true, QWidget *pParent = 0);
64
65 /** Returns the menu. */
66 QMenu *menu() const;
67
68#ifdef VBOX_WS_MAC
69 /** Returns the toolbar. */
70 UIToolBar *toolbar() const { return m_pToolBar; }
71#endif
72
73protected:
74
75 /** @name Event-handling stuff.
76 * @{ */
77 /** Handles translation event. */
78 virtual void retranslateUi() /* override */;
79
80 /** Handles resize @a pEvent. */
81 virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
82
83 /** Handles show @a pEvent. */
84 virtual void showEvent(QShowEvent *pEvent) /* override */;
85 /** @} */
86
87public slots:
88
89 /** @name Details-widget stuff.
90 * @{ */
91 /** Handles command to reset host network details changes. */
92 void sltResetHostNetworkDetailsChanges();
93 /** Handles command to apply host network details changes. */
94 void sltApplyHostNetworkDetailsChanges();
95 /** @} */
96
97private slots:
98
99 /** @name Menu/action stuff.
100 * @{ */
101 /** Handles command to create host network. */
102 void sltCreateHostNetwork();
103 /** Handles command to remove host network. */
104 void sltRemoveHostNetwork();
105 /** Handles command to make host network details @a fVisible. */
106 void sltToggleHostNetworkDetailsVisibility(bool fVisible);
107 /** Handles command to refresh host networks. */
108 void sltRefreshHostNetworks();
109 /** @} */
110
111 /** @name Tree-widget stuff.
112 * @{ */
113 /** Handles command to adjust tree-widget. */
114 void sltAdjustTreeWidget();
115
116 /** Handles tree-widget @a pItem change. */
117 void sltHandleItemChange(QTreeWidgetItem *pItem);
118 /** Handles tree-widget current item change. */
119 void sltHandleCurrentItemChange();
120 /** Handles context menu request for tree-widget @a position. */
121 void sltHandleContextMenuRequest(const QPoint &position);
122 /** @} */
123
124private:
125
126 /** @name Prepare/cleanup cascade.
127 * @{ */
128 /** Prepares all. */
129 void prepare();
130 /** Prepares actions. */
131 void prepareActions();
132 /** Prepares widgets. */
133 void prepareWidgets();
134 /** Prepares toolbar. */
135 void prepareToolBar();
136 /** Prepares tree-widget. */
137 void prepareTreeWidget();
138 /** Prepares details-widget. */
139 void prepareDetailsWidget();
140 /** Load settings: */
141 void loadSettings();
142 /** @} */
143
144 /** @name Loading stuff.
145 * @{ */
146 /** Loads host networks. */
147 void loadHostNetworks();
148 /** Loads host @a comInterface data to passed @a data container. */
149 void loadHostNetwork(const CHostNetworkInterface &comInterface, UIDataHostNetwork &data);
150 /** @} */
151
152 /** @name Tree-widget stuff.
153 * @{ */
154 /** Creates a new tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
155 void createItemForNetworkHost(const UIDataHostNetwork &data, bool fChooseItem);
156 /** Updates the passed tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
157 void updateItemForNetworkHost(const UIDataHostNetwork &data, bool fChooseItem, UIItemHostNetwork *pItem);
158 /** @} */
159
160 /** @name General variables.
161 * @{ */
162 /** Holds the widget embedding type. */
163 const EmbedTo m_enmEmbedding;
164 /** Holds the action-pool reference. */
165 UIActionPool *m_pActionPool;
166 /** Holds whether we should create/show toolbar. */
167 const bool m_fShowToolbar;
168 /** @} */
169
170 /** @name Toolbar and menu variables.
171 * @{ */
172 /** Holds the toolbar instance. */
173 UIToolBar *m_pToolBar;
174 /** @} */
175
176 /** @name Splitter variables.
177 * @{ */
178 /** Holds the tree-widget instance. */
179 QITreeWidget *m_pTreeWidget;
180 /** Holds the details-widget instance. */
181 UIHostNetworkDetailsWidget *m_pDetailsWidget;
182 /** @} */
183};
184
185
186/** QIManagerDialogFactory extension used as a factory for Host Network Manager dialog. */
187class UIHostNetworkManagerFactory : public QIManagerDialogFactory
188{
189public:
190
191 /** Constructs Media Manager factory acquiring additional arguments.
192 * @param pActionPool Brings the action-pool reference. */
193 UIHostNetworkManagerFactory(UIActionPool *pActionPool = 0);
194
195protected:
196
197 /** Creates derived @a pDialog instance.
198 * @param pCenterWidget Brings the widget reference to center according to. */
199 virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) /* override */;
200
201 /** Holds the action-pool reference. */
202 UIActionPool *m_pActionPool;
203};
204
205
206/** QIManagerDialog extension providing GUI with the dialog to control host network related functionality. */
207class UIHostNetworkManager : public QIWithRetranslateUI<QIManagerDialog>
208{
209 Q_OBJECT;
210
211signals:
212
213 /** Notifies listeners about data change rejected and should be reseted. */
214 void sigDataChangeRejected();
215 /** Notifies listeners about data change accepted and should be applied. */
216 void sigDataChangeAccepted();
217
218private slots:
219
220 /** @name Button-box stuff.
221 * @{ */
222 /** Handles button-box button click. */
223 void sltHandleButtonBoxClick(QAbstractButton *pButton);
224 /** @} */
225
226private:
227
228 /** Constructs Host Network Manager dialog.
229 * @param pCenterWidget Brings the widget reference to center according to.
230 * @param pActionPool Brings the action-pool reference. */
231 UIHostNetworkManager(QWidget *pCenterWidget, UIActionPool *pActionPool);
232
233 /** @name Event-handling stuff.
234 * @{ */
235 /** Handles translation event. */
236 virtual void retranslateUi() /* override */;
237 /** @} */
238
239 /** @name Prepare/cleanup cascade.
240 * @{ */
241 /** Configures all. */
242 virtual void configure() /* override */;
243 /** Configures central-widget. */
244 virtual void configureCentralWidget() /* override */;
245 /** Configures button-box. */
246 virtual void configureButtonBox() /* override */;
247 /** Perform final preparations. */
248 virtual void finalize() /* override */;
249 /** @} */
250
251 /** @name Widget stuff.
252 * @{ */
253 /** Returns the widget. */
254 virtual UIHostNetworkManagerWidget *widget() /* override */;
255 /** @} */
256
257 /** @name Action related variables.
258 * @{ */
259 /** Holds the action-pool reference. */
260 UIActionPool *m_pActionPool;
261 /** @} */
262
263 /** Allow factory access to private/protected members: */
264 friend class UIHostNetworkManagerFactory;
265};
266
267#endif /* !FEQT_INCLUDED_SRC_hostnetwork_UIHostNetworkManager_h */
268
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use