4#include <QLoggingCategory>
8static Q_LOGGING_CATEGORY(log,
"Operate")
13 qDebug(log) << Q_FUNC_INFO;
19 qDebug(log) << Q_FUNC_INFO;
22int CBackend::SetConnect(
COperate *pOperate)
24 qDebug(log) << Q_FUNC_INFO;
25 if(!pOperate)
return -1;
34 check = connect(
this, SIGNAL(
sigStop()),
37 check = connect(
this, SIGNAL(
sigError(
const int,
const QString&)),
38 pOperate, SIGNAL(
sigError(
const int,
const QString&)));
45 const QMessageBox::Icon&)),
47 const QMessageBox::Icon&)));
50 const QString&,
const QString&,
51 QMessageBox::StandardButtons,
52 QMessageBox::StandardButton&,
54 pOperate, SLOT(slotBlockShowMessageBox(
55 const QString&,
const QString&,
56 QMessageBox::StandardButtons,
57 QMessageBox::StandardButton&,
59 Qt::BlockingQueuedConnection);
65 pOperate, SLOT(slotBlockInputDialog(
const QString&,
69 Qt::BlockingQueuedConnection);
74 pOperate, SLOT(slotBlockShowWidget(
const QString&,
int&,
void*)),
75 Qt::BlockingQueuedConnection);
82 qDebug(log) << Q_FUNC_INFO;
84 nRet =
static_cast<int>(
OnInit());
85 if(nRet < 0)
return nRet;
94 qDebug(log) << Q_FUNC_INFO;
115 QTimer::singleShot(nTime,
this, SLOT(
slotTimeOut()));
118 qDebug(log) <<
"Process fail(< -1) or stop(= -1):" << nTime;
120 qCritical(log) <<
"Process fail:" << nTime;
121 emit
sigError(nTime,
"Process fail or stop");
123 }
catch(std::exception e) {
124 qCritical(log) <<
"Process fail:" << e.what();
127 qCritical(log) <<
"Process fail";
137 qWarning(log) <<
"Need to implement CConnect::OnProcess()";
void sigInformation(const QString &szInfo)
Triggering from a background thread displays information in the main thread without blocking the back...
virtual int WakeUp()
Wake up.
virtual int OnProcess()
Specific operation processing of plug-in.
void sigStop()
Notify the user to stop.
virtual OnInitReturnValue OnInit()=0
Initialization.
virtual int OnClean()=0
Clean.
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...
virtual int Start()
Start.
void sigError(const int nError, const QString &szError=QString())
Triggered when an error is generated.
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 sigRunning()
Emitted when the plugin is successfully started.
void sigFinished()
Successful stopped signal.
virtual void slotTimeOut()
a non-Qt event loop (that is, normal loop processing), It call OnProcess(), and start timer.
void sigBlockShowWidget(const QString &className, int &nRet, void *pContext)
Blocks the background thread and displays the window in the foreground thread.
void sigBlockInputDialog(const QString &szTitle, const QString &szLable, const QString &szMessage, QString &szText)
Block background threads and display input dialogs in foreground threads (QInputDialog)