6#include "IceSignalQxmpp.h"
8#include "FrmParameterICE.h"
9#include "RabbitCommonDir.h"
11#include <QCoreApplication>
20 QString szTranslatorFile = RabbitCommon::CDir::Instance()->GetDirTranslations()
21 +
"/Channel_" + QLocale::system().name() +
".qm";
22 if(!m_Translator.load(szTranslatorFile))
23 qCritical(m_Log) <<
"Open translator file fail:" << szTranslatorFile;
24 qApp->installTranslator(&m_Translator);
30 check = connect(m_Signal.data(), SIGNAL(sigConnected()),
31 this, SLOT(slotConnected()));
33 check = connect(m_Signal.data(), SIGNAL(sigDisconnected()),
34 this, SLOT(slotDisconnected()));
36 check = connect(m_Signal.data(), SIGNAL(sigError(
int,
const QString&)),
37 this, SLOT(slotError(
int,
const QString&)));
43 check = connect(GetParameter(), SIGNAL(sigIceDebugChanged(
bool)),
44 &g_LogCallback, SLOT(slotEnable(
bool)));
46 g_LogCallback.slotEnable(GetParameter()->GetIceDebug());
52 qApp->removeTranslator(&m_Translator);
57 static CICE* p =
nullptr;
58 if(!p) p =
new CICE();
62QSharedPointer<CIceSignal> CICE::GetSignal()
72QWidget* CICE::GetParameterWidget(QWidget *parent)
77void CICE::slotIceChanged()
79 QSharedPointer<CIceSignal> signal = GetSignal();
81 if(signal->IsConnected())
86 signal->Open(pPara->getSignalServer(), pPara->getSignalPort(),
87 pPara->getSignalUser(), pPara->getSignalPassword());
93 QSharedPointer<CIceSignal> signal = GetSignal();
96 qCritical(m_Log) <<
"The signal is null";
99 if(signal->IsConnected())
104 signal->Open(pPara->getSignalServer(), pPara->getSignalPort(),
105 pPara->getSignalUser(), pPara->getSignalPassword());
111 QSharedPointer<CIceSignal> signal = GetSignal();
117void CICE::slotConnected()
120 qInfo(m_Log) <<
"User" << pPara->getSignalUser()
121 <<
"is connected to signal server:"
122 << pPara->getSignalServer() <<
":" << pPara->getSignalPort();
125void CICE::slotDisconnected()
128 qInfo(m_Log) <<
"User" << pPara->getSignalUser()
129 <<
"is disconnected to signal server:"
130 << pPara->getSignalServer() <<
":" << pPara->getSignalPort();
133void CICE::slotError(
int nError,
const QString& szError)
136 qInfo(m_Log) <<
"User" << pPara->getSignalUser()
138 << pPara->getSignalServer() <<
":" << pPara->getSignalPort()
139 <<
"] error:" << nError << szError;
Provides a singleton object for management and access to ICE.
static CICE * Instance()
Single instance.
CICE(QObject *parent=nullptr)
QXMPP implements ICE signaling class.
ICE parameter helper class.