VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.h@ 37126

Last change on this file since 37126 was 36928, checked in by vboxsync, 13 years ago

FE/Qt: 4989: UISettingsCache template integrated into Network page.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.0 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt4 GUI ("VirtualBox"):
4 * UIMachineSettingsPortForwardingDlg class declaration
5 */
6
7/*
8 * Copyright (C) 2010 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 __UIMachineSettingsPortForwardingDlg_h__
20#define __UIMachineSettingsPortForwardingDlg_h__
21
22/* Local includes */
23#include "QIWithRetranslateUI.h"
24#include "QIDialog.h"
25#include "COMDefs.h"
26
27/* Forward declarations: */
28class QITableView;
29class UIToolBar;
30class QIDialogButtonBox;
31class UIPortForwardingModel;
32
33/* Name data: */
34class NameData : public QString
35{
36public:
37
38 NameData() : QString() {}
39 NameData(const QString &ruleName) : QString(ruleName) {}
40};
41Q_DECLARE_METATYPE(NameData);
42
43/* Ip data: */
44class IpData : public QString
45{
46public:
47
48 IpData() : QString() {}
49 IpData(const QString &ipAddress) : QString(ipAddress) {}
50};
51Q_DECLARE_METATYPE(IpData);
52
53/* Port data: */
54class PortData
55{
56public:
57
58 PortData() : m_uValue(0) {}
59 PortData(ushort uValue) : m_uValue(uValue) {}
60 PortData(const PortData &other) : m_uValue(other.value()) {}
61 bool operator==(const PortData &other) { return m_uValue == other.m_uValue; }
62 ushort value() const { return m_uValue; }
63
64private:
65
66 ushort m_uValue;
67};
68Q_DECLARE_METATYPE(PortData);
69
70/* Port forwarding data: */
71struct UIPortForwardingData
72{
73 UIPortForwardingData(const NameData &strName, KNATProtocol eProtocol,
74 const IpData &strHostIp, PortData uHostPort,
75 const IpData &strGuestIp, PortData uGuestPort)
76 : name(strName), protocol(eProtocol)
77 , hostIp(strHostIp), hostPort(uHostPort)
78 , guestIp(strGuestIp), guestPort(uGuestPort) {}
79 bool operator==(const UIPortForwardingData &other)
80 {
81 return name == other.name &&
82 protocol == other.protocol &&
83 hostIp == other.hostIp &&
84 hostPort == other.hostPort &&
85 guestIp == other.guestIp &&
86 guestPort == other.guestPort;
87 }
88 NameData name;
89 KNATProtocol protocol;
90 IpData hostIp;
91 PortData hostPort;
92 IpData guestIp;
93 PortData guestPort;
94};
95
96/* Port forwarding data list: */
97typedef QList<UIPortForwardingData> UIPortForwardingDataList;
98
99/* Port forwarding dialog: */
100class UIMachineSettingsPortForwardingDlg : public QIWithRetranslateUI<QIDialog>
101{
102 Q_OBJECT;
103
104public:
105
106 /* Port forwarding dialog constructor: */
107 UIMachineSettingsPortForwardingDlg(QWidget *pParent = 0,
108 const UIPortForwardingDataList &rules = UIPortForwardingDataList());
109 /* Port forwarding dialog destructor: */
110 ~UIMachineSettingsPortForwardingDlg();
111
112 /* The list of chosen rules: */
113 const UIPortForwardingDataList& rules() const;
114
115private slots:
116
117 /* Action's slots: */
118 void sltAddRule();
119 void sltCopyRule();
120 void sltDelRule();
121
122 /* Table slots: */
123 void sltTableDataChanged();
124 void sltCurrentChanged();
125 void sltShowTableContexMenu(const QPoint &position);
126 void sltAdjustTable();
127
128 /* Dialog slots: */
129 void accept();
130 void reject();
131
132private:
133
134 /* UI Translator: */
135 void retranslateUi();
136
137 /* Event filter: */
138 bool eventFilter(QObject *pObj, QEvent *pEvent);
139
140 /* Flags: */
141 bool fIsTableDataChanged;
142
143 /* Widgets: */
144 QITableView *m_pTableView;
145 UIToolBar *m_pToolBar;
146 QIDialogButtonBox *m_pButtonBox;
147
148 /* Model: */
149 UIPortForwardingModel *m_pModel;
150
151 /* Actions: */
152 QAction *m_pAddAction;
153 QAction *m_pCopyAction;
154 QAction *m_pDelAction;
155};
156
157#endif // __UIMachineSettingsPortForwardingDlg_h__
158
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use