VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetwork.h@ 16955

Last change on this file since 16955 was 16927, checked in by vboxsync, 16 years ago

NetAdp/win: enabled add/remove tap if UI, make the proper adapters to be displayed in the list

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.5 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt4 GUI ("VirtualBox"):
4 * VBoxVMSettingsNetwork class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __VBoxVMSettingsNetwork_h__
24#define __VBoxVMSettingsNetwork_h__
25
26#include "VBoxSettingsPage.h"
27#include "VBoxVMSettingsNetwork.gen.h"
28#include "COMDefs.h"
29
30#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
31class QTreeWidget;
32class QTreeWidgetItem;
33#endif
34
35/*
36 * QWidget sub-class which represents one tab-page per each network adapter.
37 * It has generated UI part.
38 */
39class VBoxVMSettingsNetwork : public QIWithRetranslateUI<QWidget>,
40 public Ui::VBoxVMSettingsNetwork
41{
42 Q_OBJECT;
43
44public:
45
46 VBoxVMSettingsNetwork();
47
48 void getFromAdapter (const CNetworkAdapter &aAdapter);
49 void putBackToAdapter();
50
51 QString pageTitle() const;
52
53 void setValidator (QIWidgetValidator *aValidator);
54
55 QWidget* setOrderAfter (QWidget *aAfter);
56
57 void setNetworksList (const QStringList &aList);
58
59#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
60 void setInterfaceName (const QString &);
61 QString interfaceName() const;
62#endif
63
64protected:
65
66 void retranslateUi();
67
68private slots:
69
70 void adapterToggled (bool aOn);
71 void naTypeChanged (const QString &aString);
72 void genMACClicked();
73#if defined (Q_WS_X11) && !defined (VBOX_WITH_NETFLT)
74 void tapSetupClicked();
75 void tapTerminateClicked();
76#endif
77
78private:
79
80 void prepareComboboxes();
81
82 void setTapEnabled (bool aEnabled);
83 void setTapVisible (bool aVisible);
84
85 CNetworkAdapter mAdapter;
86 QIWidgetValidator *mValidator;
87
88#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
89 QString mInterfaceName;
90#endif
91};
92
93
94#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
95/*
96 * QGroupBox sub-class which represents network interface list.
97 */
98class VBoxNIList : public QIWithRetranslateUI<QWidget>
99{
100 Q_OBJECT;
101
102public:
103
104 VBoxNIList (QWidget *aParent);
105
106 bool isWrongInterface() const;
107 void setCurrentInterface (const QString &aName);
108#if defined (Q_WS_WIN) && defined(VBOX_WITH_NETFLT)
109 void updateInterfacesList(KNetworkAttachmentType enmAttachmentType);
110#endif
111signals:
112
113 void listChanged();
114 void currentInterfaceChanged (const QString &);
115
116private slots:
117
118 void onCurrentItemChanged (QTreeWidgetItem *aCurrent, QTreeWidgetItem *aPrev = 0);
119 void addHostInterface();
120 void delHostInterface();
121
122protected:
123
124 void retranslateUi();
125
126private:
127#if defined (Q_WS_WIN) && defined(VBOX_WITH_NETFLT)
128 void populateInterfacesList(KNetworkAttachmentType enmAttachmentType);
129#else
130 void populateInterfacesList();
131#endif
132 QILabelSeparator *mLbTitle;
133 QTreeWidget *mList;
134
135# if defined (Q_WS_WIN)
136 QAction *mAddAction;
137 QAction *mDelAction;
138# ifdef VBOX_WITH_NETFLT
139 KNetworkAttachmentType mEnmAttachmentType;
140# endif
141# endif
142};
143#endif /* Q_WS_WIN || VBOX_WITH_NETFLT */
144
145
146/*
147 * QWidget sub-class which represents network settings page itself.
148 */
149class VBoxVMSettingsNetworkPage : public VBoxSettingsPage
150{
151 Q_OBJECT;
152
153public:
154
155 VBoxVMSettingsNetworkPage();
156
157protected:
158
159 void getFrom (const CMachine &aMachine);
160 void putBackTo();
161
162 void setValidator (QIWidgetValidator *aVal);
163 bool revalidate (QString &aWarning, QString &aTitle);
164
165 void retranslateUi();
166
167private slots:
168
169 void updateNetworksList();
170#if defined (VBOX_WITH_NETFLT)
171 void updateInterfaceList();
172#endif
173#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
174 void onCurrentPageChanged (int);
175 void onCurrentInterfaceChanged (const QString &);
176#endif
177
178private:
179
180 void populateNetworksList();
181
182 /* Widgets */
183 QTabWidget *mTwAdapters;
184#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
185 VBoxNIList *mNIList;
186#endif
187
188 /* Widget Validator*/
189 QIWidgetValidator *mValidator;
190
191 /* Lists */
192 QStringList mListNetworks;
193
194 /* Flags */
195 bool mLockNetworkListUpdate;
196};
197
198#endif // __VBoxVMSettingsNetwork_h__
199
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