3#include "FrmParameterICE.h"
4#include "ui_FrmParameterICE.h"
8 #include "QXmppUtils.h"
25 SetConnectButton(signal->IsConnected());
26 check = connect(signal.data(), SIGNAL(sigConnected()),
29 check = connect(signal.data(), SIGNAL(sigDisconnected()),
30 this, SLOT(slotDisconnected()));
32 check = connect(signal.data(), SIGNAL(sigError(
int,
const QString&)),
33 this, SLOT(slotError(
int,
const QString&)));
40CFrmParameterICE::~CFrmParameterICE()
43 qDebug() <<
"CFrmParameterICE::~CFrmParameterICE()";
48 m_pParameters->setIce(ui->cbEnableICE->isChecked());
49 m_pParameters->SetIceDebug(ui->cbEnableIceDebug->isChecked());
50 m_pParameters->setSignalServer(ui->leSignalServer->text());
51 m_pParameters->setSignalPort(ui->sbSignalPort->value());
52 m_pParameters->setSignalUser(ui->leSignalName->text());
53 m_pParameters->setSignalPassword(ui->leSignalPassword->text());
55 m_pParameters->setStunServer(ui->leStunServer->text());
56 m_pParameters->setStunPort(ui->sbStunPort->value());
58 m_pParameters->setTurnServer(ui->leTurnServer->text());
59 m_pParameters->setTurnPassword(ui->leTrunPassword->text());
60 m_pParameters->setTurnUser(ui->leTurnUser->text());
61 m_pParameters->setTurnPassword(ui->leTrunPassword->text());
64void CFrmParameterICE::Init()
66 ui->cbEnableICE->setChecked(m_pParameters->getIce());
67 on_cbEnableICE_stateChanged(ui->cbEnableICE->isChecked());
68 ui->cbEnableIceDebug->setChecked(m_pParameters->GetIceDebug());
70 ui->leSignalServer->setText(m_pParameters->getSignalServer());
71 ui->sbSignalPort->setValue(m_pParameters->getSignalPort());
72 ui->leSignalName->setText(m_pParameters->getSignalUser());
73 ui->leSignalPassword->setText(m_pParameters->getSignalPassword());
75 ui->leStunServer->setText(m_pParameters->getStunServer());
76 ui->sbStunPort->setValue(m_pParameters->getStunPort());
78 ui->leTurnServer->setText(m_pParameters->getTurnServer());
79 ui->sbTurnPort->setValue(m_pParameters->getTurnPort());
80 ui->leTurnUser->setText(m_pParameters->getTurnUser());
81 ui->leTrunPassword->setText(m_pParameters->getTurnPassword());
84void CFrmParameterICE::on_cbEnableICE_stateChanged(
int arg1)
89void CFrmParameterICE::EnableCompone(
bool bEnable)
91 ui->pbConnect->setEnabled(bEnable);
92 ui->leSignalServer->setEnabled(bEnable);
93 ui->sbSignalPort->setEnabled(bEnable);
94 ui->leSignalName->setEnabled(bEnable);
95 ui->leSignalPassword->setEnabled(bEnable);
97 ui->leStunServer->setEnabled(bEnable);
98 ui->sbStunPort->setEnabled(bEnable);
100 ui->leTurnServer->setEnabled(bEnable);
101 ui->sbTurnPort->setEnabled(bEnable);
102 ui->leTurnUser->setEnabled(bEnable);
103 ui->leTrunPassword->setEnabled(bEnable);
106void CFrmParameterICE::on_pbConnect_clicked(
bool checked)
108 SetConnectButton(!checked);
115void CFrmParameterICE::on_leSignalName_editingFinished()
118 QString user = ui->leSignalName->text();
119 if(QXmppUtils::jidToDomain(user).isEmpty()
120 || QXmppUtils::jidToResource(user).isEmpty())
122 QString szMsg = tr(
"The user name format is error. please use format: user@domain/resource");
123 QMessageBox::critical(
this, tr(
"Error"), szMsg);
130 QSharedPointer<CIceSignal> signal =
CICE::Instance()->GetSignal();
132 SetConnectButton(signal->IsConnected());
135void CFrmParameterICE::slotDisconnected()
137 QSharedPointer<CIceSignal> signal =
CICE::Instance()->GetSignal();
139 SetConnectButton(signal->IsConnected());
142void CFrmParameterICE::slotError(
int nError,
const QString& szError)
144 QSharedPointer<CIceSignal> signal =
CICE::Instance()->GetSignal();
146 SetConnectButton(signal->IsConnected());
149void CFrmParameterICE::SetConnectButton(
bool bConnected)
153 ui->pbConnect->setChecked(
true);
154 ui->pbConnect->setText(tr(
"Disconnect"));
155 ui->pbConnect->setIcon(QIcon::fromTheme(
"network-wireless"));
157 ui->pbConnect->setChecked(
false);
158 ui->pbConnect->setText(tr(
"Connect"));
159 ui->pbConnect->setIcon(QIcon::fromTheme(
"network-wired"));
void slotConnected()
[Accept parameters]
CFrmParameterICE(CParameterICE *para=nullptr, QWidget *parent=nullptr)
void slotAccept()
[Accept parameters]
static CICE * Instance()
Single instance.
ICE parameter helper class.