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