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 "VBoxVMSettingsNetwork.gen.h"
|
---|
27 | #include "QIWithRetranslateUI.h"
|
---|
28 | #include "COMDefs.h"
|
---|
29 |
|
---|
30 | class QIWidgetValidator;
|
---|
31 | class VBoxVMSettingsDlg;
|
---|
32 | #ifdef Q_WS_WIN
|
---|
33 | class QTreeWidget;
|
---|
34 | class QTreeWidgetItem;
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | /*
|
---|
38 | * QWidget sub-class which represents one tab-page per each network adapter.
|
---|
39 | * It has generated UI part.
|
---|
40 | */
|
---|
41 | class VBoxVMSettingsNetwork : public QIWithRetranslateUI<QWidget>,
|
---|
42 | public Ui::VBoxVMSettingsNetwork
|
---|
43 | {
|
---|
44 | Q_OBJECT;
|
---|
45 |
|
---|
46 | public:
|
---|
47 |
|
---|
48 | VBoxVMSettingsNetwork();
|
---|
49 |
|
---|
50 | void getFromAdapter (const CNetworkAdapter &aAdapter);
|
---|
51 | void putBackToAdapter();
|
---|
52 |
|
---|
53 | QString pageTitle() const;
|
---|
54 |
|
---|
55 | void setValidator (QIWidgetValidator *aValidator);
|
---|
56 | void setNetworksList (const QStringList &aList);
|
---|
57 |
|
---|
58 | #ifdef Q_WS_WIN
|
---|
59 | void setInterfaceName (const QString &);
|
---|
60 | QString interfaceName() const;
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | protected:
|
---|
64 |
|
---|
65 | void retranslateUi();
|
---|
66 |
|
---|
67 | private slots:
|
---|
68 |
|
---|
69 | void adapterToggled (bool aOn);
|
---|
70 | void naTypeChanged (const QString &aString);
|
---|
71 | void genMACClicked();
|
---|
72 | #ifdef Q_WS_X11
|
---|
73 | void tapSetupClicked();
|
---|
74 | void tapTerminateClicked();
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | private:
|
---|
78 |
|
---|
79 | void prepareComboboxes();
|
---|
80 |
|
---|
81 | CNetworkAdapter mAdapter;
|
---|
82 | QIWidgetValidator *mValidator;
|
---|
83 |
|
---|
84 | #ifdef Q_WS_WIN
|
---|
85 | QString mInterfaceName;
|
---|
86 | #endif
|
---|
87 | };
|
---|
88 |
|
---|
89 |
|
---|
90 | #ifdef Q_WS_WIN
|
---|
91 | /*
|
---|
92 | * QGroupBox sub-class which represents network interface list.
|
---|
93 | */
|
---|
94 | class VBoxNIList : public QIWithRetranslateUI<QGroupBox>
|
---|
95 | {
|
---|
96 | Q_OBJECT;
|
---|
97 |
|
---|
98 | public:
|
---|
99 |
|
---|
100 | VBoxNIList (QWidget *aParent);
|
---|
101 |
|
---|
102 | bool isWrongInterface() const;
|
---|
103 | void setCurrentInterface (const QString &aName);
|
---|
104 |
|
---|
105 | signals:
|
---|
106 |
|
---|
107 | void listChanged();
|
---|
108 | void currentInterfaceChanged (const QString &);
|
---|
109 |
|
---|
110 | private slots:
|
---|
111 |
|
---|
112 | void onCurrentItemChanged (QTreeWidgetItem *aCurrent, QTreeWidgetItem *aPrev = 0);
|
---|
113 | void addHostInterface();
|
---|
114 | void delHostInterface();
|
---|
115 |
|
---|
116 | protected:
|
---|
117 |
|
---|
118 | void retranslateUi();
|
---|
119 |
|
---|
120 | private:
|
---|
121 |
|
---|
122 | void populateInterfacesList();
|
---|
123 |
|
---|
124 | QTreeWidget *mList;
|
---|
125 |
|
---|
126 | QAction *mAddAction;
|
---|
127 | QAction *mDelAction;
|
---|
128 | };
|
---|
129 | #endif
|
---|
130 |
|
---|
131 |
|
---|
132 | /*
|
---|
133 | * QWidget sub-class which represents network settings page itself.
|
---|
134 | */
|
---|
135 | class VBoxVMSettingsNetworkPage : public QIWithRetranslateUI<QWidget>
|
---|
136 | {
|
---|
137 | Q_OBJECT;
|
---|
138 |
|
---|
139 | public:
|
---|
140 |
|
---|
141 | static void getFromMachine (const CMachine &aMachine,
|
---|
142 | QWidget *aPage,
|
---|
143 | VBoxVMSettingsDlg *aDlg,
|
---|
144 | const QString &aPath);
|
---|
145 | static void putBackToMachine();
|
---|
146 | static bool revalidate (QString &aWarning, QString &aTitle);
|
---|
147 |
|
---|
148 | protected slots:
|
---|
149 |
|
---|
150 | void updateNetworksList();
|
---|
151 | #ifdef Q_WS_WIN
|
---|
152 | void onCurrentPageChanged (int);
|
---|
153 | void onCurrentInterfaceChanged (const QString &);
|
---|
154 | #endif
|
---|
155 |
|
---|
156 | protected:
|
---|
157 |
|
---|
158 | VBoxVMSettingsNetworkPage (QWidget *aParent);
|
---|
159 |
|
---|
160 | void getFrom (const CMachine &aMachine,
|
---|
161 | VBoxVMSettingsDlg *aDlg,
|
---|
162 | const QString &aPath);
|
---|
163 | void putBackTo();
|
---|
164 | bool validate (QString &aWarning, QString &aTitle);
|
---|
165 |
|
---|
166 | void retranslateUi();
|
---|
167 |
|
---|
168 | void populateNetworksList();
|
---|
169 |
|
---|
170 | static VBoxVMSettingsNetworkPage *mSettings;
|
---|
171 |
|
---|
172 | /* Widgets */
|
---|
173 | QTabWidget *mTwAdapters;
|
---|
174 | #ifdef Q_WS_WIN
|
---|
175 | VBoxNIList *mNIList;
|
---|
176 | #endif
|
---|
177 |
|
---|
178 | /* Lists */
|
---|
179 | QStringList mListNetworks;
|
---|
180 |
|
---|
181 | /* Flags */
|
---|
182 | bool mLockNetworkListUpdate;
|
---|
183 | };
|
---|
184 |
|
---|
185 | #endif // __VBoxVMSettingsNetwork_h__
|
---|
186 |
|
---|