VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsNetwork.h@ 10631

Last change on this file since 10631 was 10167, checked in by vboxsync, 16 years ago

Fe/Qt4: New VM&Global settings api based on one default class (+ui).
One interface for both Settings dialog & one interface for settings pages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 3.7 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#ifdef Q_WS_WIN
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#ifdef Q_WS_WIN
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#ifdef Q_WS_X11
74 void tapSetupClicked();
75 void tapTerminateClicked();
76#endif
77
78private:
79
80 void prepareComboboxes();
81
82 CNetworkAdapter mAdapter;
83 QIWidgetValidator *mValidator;
84
85#ifdef Q_WS_WIN
86 QString mInterfaceName;
87#endif
88};
89
90
91#ifdef Q_WS_WIN
92/*
93 * QGroupBox sub-class which represents network interface list.
94 */
95class VBoxNIList : public QIWithRetranslateUI<QGroupBox>
96{
97 Q_OBJECT;
98
99public:
100
101 VBoxNIList (QWidget *aParent);
102
103 bool isWrongInterface() const;
104 void setCurrentInterface (const QString &aName);
105
106signals:
107
108 void listChanged();
109 void currentInterfaceChanged (const QString &);
110
111private slots:
112
113 void onCurrentItemChanged (QTreeWidgetItem *aCurrent, QTreeWidgetItem *aPrev = 0);
114 void addHostInterface();
115 void delHostInterface();
116
117protected:
118
119 void retranslateUi();
120
121private:
122
123 void populateInterfacesList();
124
125 QTreeWidget *mList;
126
127 QAction *mAddAction;
128 QAction *mDelAction;
129};
130#endif
131
132
133/*
134 * QWidget sub-class which represents network settings page itself.
135 */
136class VBoxVMSettingsNetworkPage : public VBoxSettingsPage
137{
138 Q_OBJECT;
139
140public:
141
142 VBoxVMSettingsNetworkPage();
143
144protected:
145
146 void getFrom (const CMachine &aMachine);
147 void putBackTo();
148
149 void setValidator (QIWidgetValidator *aVal);
150 bool revalidate (QString &aWarning, QString &aTitle);
151
152 void retranslateUi();
153
154private slots:
155
156 void updateNetworksList();
157#ifdef Q_WS_WIN
158 void onCurrentPageChanged (int);
159 void onCurrentInterfaceChanged (const QString &);
160#endif
161
162private:
163
164 void populateNetworksList();
165
166 /* Widgets */
167 QTabWidget *mTwAdapters;
168#ifdef Q_WS_WIN
169 VBoxNIList *mNIList;
170#endif
171
172 /* Widget Validator*/
173 QIWidgetValidator *mValidator;
174
175 /* Lists */
176 QStringList mListNetworks;
177
178 /* Flags */
179 bool mLockNetworkListUpdate;
180};
181
182#endif // __VBoxVMSettingsNetwork_h__
183
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