Rabbit Remote Control 0.1.0-bate10
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
41class PLUGIN_EXPORT CBackend : public QObject
42{
43 Q_OBJECT
44public:
53 explicit CBackend(COperate *pOperate = nullptr, bool bStopSignal = true);
54 virtual ~CBackend();
55
56public:
78 virtual int Start();
86 virtual int Stop();
94 virtual int WakeUp();
95
96protected:
97 enum class OnInitReturnValue {
98 Fail = -1,
99 Success = 0,
100 UseOnProcess = Success,
101 NotUseOnProcess = 1,
102 };
103 //Q_ENUM(OnInitReturnValue)
120 [[nodiscard]] virtual OnInitReturnValue OnInit() = 0;
127 virtual int OnClean() = 0;
143 [[nodiscard]] virtual int OnProcess();
144
145protected Q_SLOTS:
159 virtual void slotTimeOut();
160
161Q_SIGNALS:
178 void sigStop();
190 void sigError(const int nError, const QString &szError = QString());
203 void sigInformation(const QString& szInfo);
219 void sigShowMessageBox(const QString& szTitle, const QString& szMessage,
220 const QMessageBox::Icon& icon = QMessageBox::Information);
221
239 void sigBlockShowMessageBox(const QString& szTitle,
240 const QString& szMessage,
241 QMessageBox::StandardButtons buttons,
242 QMessageBox::StandardButton& nRet,
243 bool &checkBox,
244 QString checkBoxContext = QString());
254 void sigBlockInputDialog(const QString& szTitle,
255 const QString& szLable,
256 const QString& szMessage,
257 QString& szText
258 );
276 void sigBlockShowWidget(const QString& className, int &nRet, void* pContext);
277
282 void sigSecurityLevel(CSecurityLevel::Levels level);
283
284private:
285 int SetConnect(COperate* pOperate);
286
289};
Backend interface.
Definition Backend.h:42
void sigInformation(const QString &szInfo)
Triggering from a background thread displays information in the main thread without blocking the back...
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...
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.
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:288
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