Rabbit Remote Control 0.1.0-bate14
Loading...
Searching...
No Matches
Backend.h
1// Author: Kang Lin <kl222@126.com>
2
3#pragma once
4
5#include <QObject>
6#include "Operate.h"
7
51class PLUGIN_EXPORT CBackend : public QObject
52{
53 Q_OBJECT
54public:
63 explicit CBackend(COperate *pOperate = nullptr, bool bStopSignal = true);
64 virtual ~CBackend();
65
66public:
88 virtual int Start();
96 virtual int Stop();
104 virtual int WakeUp() = 0;
105
106protected:
107 enum class OnInitReturnValue {
108 Fail = -1,
109 Success = 0,
110 UseOnProcess = Success,
111 NotUseOnProcess = 1,
112 };
113 //Q_ENUM(OnInitReturnValue)
130 [[nodiscard]] virtual OnInitReturnValue OnInit() = 0;
137 virtual int OnClean() = 0;
153 [[nodiscard]] virtual int OnProcess();
154
155protected Q_SLOTS:
169 virtual void slotTimeOut();
170
171Q_SIGNALS:
188 void sigStop();
200 void sigError(const int nError, const QString &szError = QString());
213 void sigInformation(const QString& szInfo);
229 void sigShowMessageBox(const QString& szTitle, const QString& szMessage,
230 const QMessageBox::Icon& icon = QMessageBox::Information);
231
249 void sigBlockShowMessageBox(const QString& szTitle,
250 const QString& szMessage,
251 QMessageBox::StandardButtons buttons,
252 QMessageBox::StandardButton& nRet,
253 bool &checkBox,
254 QString checkBoxContext = QString());
264 void sigBlockInputDialog(const QString& szTitle,
265 const QString& szLable,
266 const QString& szMessage,
267 QString& szText
268 );
286 void sigBlockShowWidget(const QString& className, int &nRet, void* pContext);
287
292 void sigSecurityLevel(CSecurityLevel::Levels level);
293
294private:
295 int SetConnect(COperate* pOperate);
296
299};
void sigInformation(const QString &szInfo)
Triggering from a background thread displays information in the main thread without blocking the back...
virtual int Stop()
Stop.
Definition Backend.cpp:103
virtual int WakeUp()=0
Wake up backend thread(background thread).
virtual int OnProcess()
Specific operation processing of plug-in.
Definition Backend.cpp:143
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.
Definition Backend.cpp:84
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.
Definition Backend.cpp:111
void sigSecurityLevel(CSecurityLevel::Levels level)
Triggered when the security level changes.
void sigBlockShowWidget(const QString &className, int &nRet, void *pContext)
Blocks the background thread and displays the window in the foreground thread.
bool m_bStopSignal
When an error occurs, emit a COperate::sigStop() signal.
Definition Backend.h:298
void sigBlockInputDialog(const QString &szTitle, const QString &szLable, const QString &szMessage, QString &szText)
Block background threads and display input dialogs in foreground threads (QInputDialog).
CBackend(COperate *pOperate=nullptr, bool bStopSignal=true)
CBackend.
Operate interface.
Definition Operate.h:51