3#include <QLoggingCategory>
7static Q_LOGGING_CATEGORY(log,
"Client.Connect")
11 SetConnecter(pConnecter);
16 qDebug(log) <<
"CConnect::~CConnect()";
19int CConnect::SetConnecter(
CConnecter* pConnecter)
21 qDebug(log) <<
"CConnect::SetConnecter" << pConnecter;
22 if(!pConnecter)
return -1;
34 check = connect(
this, SIGNAL(
sigError(
const int,
const QString&)),
35 pConnecter, SIGNAL(
sigError(
const int,
const QString&)));
42 const QMessageBox::Icon&)),
44 const QMessageBox::Icon&)));
47 const QString&,
const QString&,
48 QMessageBox::StandardButtons,
49 QMessageBox::StandardButton&,
51 pConnecter, SLOT(slotBlockShowMessageBox(
52 const QString&,
const QString&,
53 QMessageBox::StandardButtons,
54 QMessageBox::StandardButton&,
56 Qt::BlockingQueuedConnection);
62 pConnecter, SLOT(slotBlockInputDialog(
const QString&,
66 Qt::BlockingQueuedConnection);
71 pConnecter, SLOT(slotBlockShowWidget(
const QString&,
int&,
void*)),
72 Qt::BlockingQueuedConnection);
79 qDebug(log) <<
"CConnect::Connect()";
81 nRet =
static_cast<int>(
OnInit());
82 if(nRet < 0)
return nRet;
91 qDebug(log) <<
"CConnect::Disconnect()";
107 QTimer::singleShot(nTime,
this, SLOT(
slotTimeOut()));
110 qDebug(log) <<
"Process fail(< -1) or stop(= -1):" << nTime;
112 qCritical(log) <<
"Process fail:" << nTime;
113 emit
sigError(nTime,
"Process fail or stop");
115 }
catch(std::exception e) {
116 qCritical(log) <<
"Process fail:" << e.what();
119 qCritical(log) <<
"Process fail";
129 qWarning(log) <<
"Need to implement CConnect::OnProcess()";
void sigError(const int nError, const QString &szError=QString())
Triggered when an error is generated.
void sigInformation(const QString &szInfo)
Triggering from a background thread displays information in the main thread without blocking the back...
void sigBlockShowMessageBox(const QString &szTitle, const QString &szMessage, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton &nRet, bool &checkBox, QString checkBoxContext=QString())
Block background threads and display message dialogs in foreground threads (QMessageBox)
void sigShowMessageBox(const QString &szTitle, const QString &szMessage, const QMessageBox::Icon &icon=QMessageBox::Information)
Trigger the display of a message dialog (QMessageBox) in the main thread from a background thread wit...
void sigBlockInputDialog(const QString &szTitle, const QString &szLable, const QString &szMessage, QString &szText)
Block background threads and display input dialogs in foreground threads (QInputDialog)
void sigConnected()
Emitted when the plugin is successfully connected.
void sigDisconnect()
Notify the user to call disconnect.
virtual int Disconnect()
Disconnect.
virtual int OnProcess()
Specific operation processing of plug-in connection.
virtual OnInitReturnValue OnInit()=0
Specific plug-in realizes connection initialization.
virtual void slotTimeOut()
a non-Qt event loop (that is, normal loop processing), It call OnProcess(), and start timer.
virtual int Connect()
Start connect.
virtual int OnClean()=0
Clean.
void sigDisconnected()
Successful disconnection signal.
void sigBlockShowWidget(const QString &className, int &nRet, void *pContext)
Blocks the background thread and displays the window in the foreground thread.