1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * VBoxGLSettingsNetwork class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 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 __VBoxGLSettingsNetwork_h__
|
---|
24 | #define __VBoxGLSettingsNetwork_h__
|
---|
25 |
|
---|
26 | #include "VBoxSettingsPage.h"
|
---|
27 | #include "VBoxGLSettingsNetwork.gen.h"
|
---|
28 |
|
---|
29 | class NetworkItem : public QTreeWidgetItem
|
---|
30 | {
|
---|
31 | public:
|
---|
32 |
|
---|
33 | NetworkItem();
|
---|
34 |
|
---|
35 | void getFromInterface (const CHostNetworkInterface &aInterface);
|
---|
36 | void putBackToInterface();
|
---|
37 |
|
---|
38 | bool revalidate (QString &aWarning, QString &aTitle);
|
---|
39 |
|
---|
40 | QString updateInfo();
|
---|
41 |
|
---|
42 | /* Common getters */
|
---|
43 | bool isChanged() const { return mChanged; }
|
---|
44 |
|
---|
45 | /* Common setters */
|
---|
46 | void setChanged (bool aChanged) { mChanged = aChanged; }
|
---|
47 |
|
---|
48 | /* Page getters */
|
---|
49 | QString name() const { return mName; }
|
---|
50 | bool isDhcpClientEnabled() const { return mDhcpClientEnabled; }
|
---|
51 | QString interfaceAddress() const { return mInterfaceAddress; }
|
---|
52 | QString interfaceMask() const { return mInterfaceMask; }
|
---|
53 | bool isIpv6Supported() const { return mIpv6Supported; }
|
---|
54 | QString interfaceAddress6() const { return mInterfaceAddress6; }
|
---|
55 | QString interfaceMaskLength6() const { return mInterfaceMaskLength6; }
|
---|
56 |
|
---|
57 | bool isDhcpServerEnabled() const { return mDhcpServerEnabled; }
|
---|
58 | QString dhcpServerAddress() const { return mDhcpServerAddress; }
|
---|
59 | QString dhcpServerMask() const { return mDhcpServerMask; }
|
---|
60 | QString dhcpLowerAddress() const { return mDhcpLowerAddress; }
|
---|
61 | QString dhcpUpperAddress() const { return mDhcpUpperAddress; }
|
---|
62 |
|
---|
63 | /* Page setters */
|
---|
64 | void setDhcpClientEnabled (bool aEnabled) { mDhcpClientEnabled = aEnabled; }
|
---|
65 | void setInterfaceAddress (const QString &aValue) { mInterfaceAddress = aValue; }
|
---|
66 | void setInterfaceMask (const QString &aValue) { mInterfaceMask = aValue; }
|
---|
67 | void setIp6Supported (bool aSupported) { mIpv6Supported = aSupported; }
|
---|
68 | void setInterfaceAddress6 (const QString &aValue) { mInterfaceAddress6 = aValue; }
|
---|
69 | void setInterfaceMaskLength6 (const QString &aValue) { mInterfaceMaskLength6 = aValue; }
|
---|
70 |
|
---|
71 | void setDhcpServerEnabled (bool aEnabled) { mDhcpServerEnabled = aEnabled; }
|
---|
72 | void setDhcpServerAddress (const QString &aValue) { mDhcpServerAddress = aValue; }
|
---|
73 | void setDhcpServerMask (const QString &aValue) { mDhcpServerMask = aValue; }
|
---|
74 | void setDhcpLowerAddress (const QString &aValue) { mDhcpLowerAddress = aValue; }
|
---|
75 | void setDhcpUpperAddress (const QString &aValue) { mDhcpUpperAddress = aValue; }
|
---|
76 |
|
---|
77 | private:
|
---|
78 |
|
---|
79 | /* Common */
|
---|
80 | CHostNetworkInterface mInterface;
|
---|
81 | bool mChanged;
|
---|
82 |
|
---|
83 | /* Host-only Interface */
|
---|
84 | QString mName;
|
---|
85 | bool mDhcpClientEnabled;
|
---|
86 | QString mInterfaceAddress;
|
---|
87 | QString mInterfaceMask;
|
---|
88 | bool mIpv6Supported;
|
---|
89 | QString mInterfaceAddress6;
|
---|
90 | QString mInterfaceMaskLength6;
|
---|
91 |
|
---|
92 | /* DHCP Server */
|
---|
93 | bool mDhcpServerEnabled;
|
---|
94 | QString mDhcpServerAddress;
|
---|
95 | QString mDhcpServerMask;
|
---|
96 | QString mDhcpLowerAddress;
|
---|
97 | QString mDhcpUpperAddress;
|
---|
98 | };
|
---|
99 |
|
---|
100 | class VBoxGLSettingsNetwork : public VBoxSettingsPage,
|
---|
101 | public Ui::VBoxGLSettingsNetwork
|
---|
102 | {
|
---|
103 | Q_OBJECT;
|
---|
104 |
|
---|
105 | public:
|
---|
106 |
|
---|
107 | VBoxGLSettingsNetwork();
|
---|
108 |
|
---|
109 | protected:
|
---|
110 |
|
---|
111 | void getFrom (const CSystemProperties &aProps,
|
---|
112 | const VBoxGlobalSettings &aGs);
|
---|
113 | void putBackTo (CSystemProperties &aProps,
|
---|
114 | VBoxGlobalSettings &aGs);
|
---|
115 |
|
---|
116 | void setValidator (QIWidgetValidator *aVal);
|
---|
117 | bool revalidate (QString &aWarning, QString &aTitle);
|
---|
118 |
|
---|
119 | void setOrderAfter (QWidget *aWidget);
|
---|
120 |
|
---|
121 | void retranslateUi();
|
---|
122 |
|
---|
123 | private slots:
|
---|
124 |
|
---|
125 | void addInterface();
|
---|
126 | void remInterface();
|
---|
127 | void editInterface();
|
---|
128 | void updateCurrentItem();
|
---|
129 | void showContextMenu (const QPoint &aPos);
|
---|
130 |
|
---|
131 | private:
|
---|
132 |
|
---|
133 | QAction *mAddInterface;
|
---|
134 | QAction *mRemInterface;
|
---|
135 | QAction *mEditInterface;
|
---|
136 |
|
---|
137 | QIWidgetValidator *mValidator;
|
---|
138 | };
|
---|
139 |
|
---|
140 | #endif // __VBoxGLSettingsNetwork_h__
|
---|
141 |
|
---|