Rabbit Remote Control 0.1.0-bate6
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();
90 virtual int WakeUp();
91
92protected:
93 enum class OnInitReturnValue {
94 Fail = -1,
95 Success = 0,
96 UseOnProcess = Success,
97 NotUseOnProcess = 1,
98 };
115 [[nodiscard]] virtual OnInitReturnValue OnInit() = 0;
122 virtual int OnClean() = 0;
138 [[nodiscard]] virtual int OnProcess();
139
140protected Q_SLOTS:
154 virtual void slotTimeOut();
155
156Q_SIGNALS:
173 void sigStop();
185 void sigError(const int nError, const QString &szError = QString());
198 void sigInformation(const QString& szInfo);
214 void sigShowMessageBox(const QString& szTitle, const QString& szMessage,
215 const QMessageBox::Icon& icon = QMessageBox::Information);
216
234 void sigBlockShowMessageBox(const QString& szTitle,
235 const QString& szMessage,
236 QMessageBox::StandardButtons buttons,
237 QMessageBox::StandardButton& nRet,
238 bool &checkBox,
239 QString checkBoxContext = QString());
249 void sigBlockInputDialog(const QString& szTitle,
250 const QString& szLable,
251 const QString& szMessage,
252 QString& szText
253 );
271 void sigBlockShowWidget(const QString& className, int &nRet, void* pContext);
272
273private:
274 int SetConnect(COperate* pOperate);
275
278};
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 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:277
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