1#include "ParameterProxyUI.h"
5CParameterProxyUI::CParameterProxyUI(QWidget *parent)
11 setLayout(
new QBoxLayout(QBoxLayout::TopToBottom,
this));
12 QHBoxLayout* pType =
new QHBoxLayout(
this);
13 layout()->addItem(pType);
16 layout()->addWidget(m_uiSockesV5);
19 layout()->addWidget(m_uiSSH);
21 m_lbType =
new QLabel(
this);
22 m_lbType->setText(tr(
"Type:"));
23 pType->addWidget(m_lbType);
25 m_cbType =
new QComboBox(
this);
26 pType->addWidget(m_cbType);
27 bCheck = connect(m_cbType, SIGNAL(currentIndexChanged(
int)),
28 this, SLOT(slotTypeChanged(
int)));
30 m_cbType->addItem(tr(
"None"), (
int)CParameterProxy::TYPE::None);
31 m_cbType->addItem(tr(
"Default"), (
int)CParameterProxy::TYPE::Default);
32 m_cbType->addItem(tr(
"SockesV5"), (
int)CParameterProxy::TYPE::SockesV5);
33 m_cbType->addItem(tr(
"SSH Tunnel"), (
int)CParameterProxy::TYPE::SSHTunnel);
35 layout()->addItem(
new QSpacerItem(0, 0,
36 QSizePolicy::Preferred,
37 QSizePolicy::Expanding));
40void CParameterProxyUI::slotTypeChanged(
int nIndex)
43 int type = m_cbType->currentData().toInt();
45 m_uiSockesV5->setVisible(type == (
int)CParameterProxy::TYPE::SockesV5);
48 m_uiSSH->setVisible(type == (
int)CParameterProxy::TYPE::SSHTunnel);
54 m_Proxy = qobject_cast<CParameterProxy*>(pParameter);
61 foreach(
auto t, m_Proxy->GetType())
63 m_cbType->addItem(m_Proxy->ConvertTypeToName(t), (
int)t);
66 int index = m_cbType->findData((
int)m_Proxy->GetUsedType());
67 m_cbType->setCurrentIndex(index);
74 int type = m_cbType->currentData().toInt();
77 case (
int)CParameterProxy::TYPE::SockesV5: {
79 if(!bRet)
return bRet;
82 case (
int)CParameterProxy::TYPE::SSHTunnel: {
84 if(!bRet)
return bRet;
97 int type = m_cbType->currentData().toInt();
100 case (
int)CParameterProxy::TYPE::SockesV5: {
101 nRet = m_uiSockesV5->
Accept();
102 if(nRet)
return nRet;
105 case (
int)CParameterProxy::TYPE::SSHTunnel: {
107 if(nRet)
return nRet;
114 m_Proxy->SetUsedType((CParameterProxy::TYPE)type);
int Accept()
Accept parameters.
bool CheckValidity(bool validity=false)
[Set Parameter]
int SetParameter(CParameter *pParameter)
[Parameter commone functions]
int SetParameter(CParameter *pParameter)
Set the parameters and initialize the user interface.
bool CheckValidity(bool validity=false)
Check parameters validity.
int Accept()
Accept parameters.
The parameter UI interface.