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 | #ifdef Q_WS_WIN
|
---|
31 | class QTreeWidget;
|
---|
32 | class 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 | */
|
---|
39 | class VBoxVMSettingsNetwork : public QIWithRetranslateUI<QWidget>,
|
---|
40 | public Ui::VBoxVMSettingsNetwork
|
---|
41 | {
|
---|
42 | Q_OBJECT;
|
---|
43 |
|
---|
44 | public:
|
---|
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 | #ifdef Q_WS_WIN
|
---|
60 | void setInterfaceName (const QString &);
|
---|
61 | QString interfaceName() const;
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | protected:
|
---|
65 |
|
---|
66 | void retranslateUi();
|
---|
67 |
|
---|
68 | private slots:
|
---|
69 |
|
---|
70 | void adapterToggled (bool aOn);
|
---|
71 | void naTypeChanged (const QString &aString);
|
---|
72 | void genMACClicked();
|
---|
73 | #ifdef Q_WS_X11
|
---|
74 | void tapSetupClicked();
|
---|
75 | void tapTerminateClicked();
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | private:
|
---|
79 |
|
---|
80 | void prepareComboboxes();
|
---|
81 |
|
---|
82 | void setTapEnabled (bool aEnabled);
|
---|
83 | void setTapVisible (bool aVisible);
|
---|
84 |
|
---|
85 | CNetworkAdapter mAdapter;
|
---|
86 | QIWidgetValidator *mValidator;
|
---|
87 |
|
---|
88 | #ifdef Q_WS_WIN
|
---|
89 | QString mInterfaceName;
|
---|
90 | #endif
|
---|
91 | };
|
---|
92 |
|
---|
93 |
|
---|
94 | #ifdef Q_WS_WIN
|
---|
95 | /*
|
---|
96 | * QGroupBox sub-class which represents network interface list.
|
---|
97 | */
|
---|
98 | class VBoxNIList : public QIWithRetranslateUI<QWidget>
|
---|
99 | {
|
---|
100 | Q_OBJECT;
|
---|
101 |
|
---|
102 | public:
|
---|
103 |
|
---|
104 | VBoxNIList (QWidget *aParent);
|
---|
105 |
|
---|
106 | bool isWrongInterface() const;
|
---|
107 | void setCurrentInterface (const QString &aName);
|
---|
108 |
|
---|
109 | signals:
|
---|
110 |
|
---|
111 | void listChanged();
|
---|
112 | void currentInterfaceChanged (const QString &);
|
---|
113 |
|
---|
114 | private slots:
|
---|
115 |
|
---|
116 | void onCurrentItemChanged (QTreeWidgetItem *aCurrent, QTreeWidgetItem *aPrev = 0);
|
---|
117 | void addHostInterface();
|
---|
118 | void delHostInterface();
|
---|
119 |
|
---|
120 | protected:
|
---|
121 |
|
---|
122 | void retranslateUi();
|
---|
123 |
|
---|
124 | private:
|
---|
125 |
|
---|
126 | void populateInterfacesList();
|
---|
127 |
|
---|
128 | QILabelSeparator *mLbTitle;
|
---|
129 | QTreeWidget *mList;
|
---|
130 |
|
---|
131 | QAction *mAddAction;
|
---|
132 | QAction *mDelAction;
|
---|
133 | };
|
---|
134 | #endif
|
---|
135 |
|
---|
136 |
|
---|
137 | /*
|
---|
138 | * QWidget sub-class which represents network settings page itself.
|
---|
139 | */
|
---|
140 | class VBoxVMSettingsNetworkPage : public VBoxSettingsPage
|
---|
141 | {
|
---|
142 | Q_OBJECT;
|
---|
143 |
|
---|
144 | public:
|
---|
145 |
|
---|
146 | VBoxVMSettingsNetworkPage();
|
---|
147 |
|
---|
148 | protected:
|
---|
149 |
|
---|
150 | void getFrom (const CMachine &aMachine);
|
---|
151 | void putBackTo();
|
---|
152 |
|
---|
153 | void setValidator (QIWidgetValidator *aVal);
|
---|
154 | bool revalidate (QString &aWarning, QString &aTitle);
|
---|
155 |
|
---|
156 | void retranslateUi();
|
---|
157 |
|
---|
158 | private slots:
|
---|
159 |
|
---|
160 | void updateNetworksList();
|
---|
161 | #ifdef Q_WS_WIN
|
---|
162 | void onCurrentPageChanged (int);
|
---|
163 | void onCurrentInterfaceChanged (const QString &);
|
---|
164 | #endif
|
---|
165 |
|
---|
166 | private:
|
---|
167 |
|
---|
168 | void populateNetworksList();
|
---|
169 |
|
---|
170 | /* Widgets */
|
---|
171 | QTabWidget *mTwAdapters;
|
---|
172 | #ifdef Q_WS_WIN
|
---|
173 | VBoxNIList *mNIList;
|
---|
174 | #endif
|
---|
175 |
|
---|
176 | /* Widget Validator*/
|
---|
177 | QIWidgetValidator *mValidator;
|
---|
178 |
|
---|
179 | /* Lists */
|
---|
180 | QStringList mListNetworks;
|
---|
181 |
|
---|
182 | /* Flags */
|
---|
183 | bool mLockNetworkListUpdate;
|
---|
184 | };
|
---|
185 |
|
---|
186 | #endif // __VBoxVMSettingsNetwork_h__
|
---|
187 |
|
---|