玉兔远程控制
0.1.0-bate11
Toggle main menu visibility
载入中...
搜索中...
未找到
Src
Backend.h
1
// Author: Kang Lin <kl222@126.com>
2
3
#pragma once
4
5
#include <QObject>
6
#include "Operate.h"
7
51
class
PLUGIN_EXPORT
CBackend
:
public
QObject
52
{
53
Q_OBJECT
54
public
:
63
explicit
CBackend
(
COperate
*pOperate =
nullptr
,
bool
bStopSignal =
true
);
64
virtual
~CBackend
();
65
66
public
:
88
virtual
int
Start
();
96
virtual
int
Stop
();
104
virtual
int
WakeUp
() = 0;
105
106
protected
:
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
155
protected
Q_SLOTS:
169
virtual
void
slotTimeOut
();
170
171
Q_SIGNALS:
178
void
sigRunning
();
188
void
sigStop
();
195
void
sigFinished
();
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
294
private
:
295
int
SetConnect(
COperate
* pOperate);
296
298
bool
m_bStopSignal
;
299
};
CBackend::sigInformation
void sigInformation(const QString &szInfo)
从后台线程中触发在主线程中显示信息,不阻塞后台线程
CBackend::Stop
virtual int Stop()
停止
定义
Backend.cpp:103
CBackend::WakeUp
virtual int WakeUp()=0
唤醒后台线程。
CBackend::OnProcess
virtual int OnProcess()
具体操作处理
定义
Backend.cpp:143
CBackend::sigStop
void sigStop()
需要通知用户停止时触发。仅由插件触发。 当从插件中需要停止时触发。例如:对端断开连接、重置连接或者连接出错。
CBackend::OnInit
virtual OnInitReturnValue OnInit()=0
初始化
CBackend::OnClean
virtual int OnClean()=0
清理
CBackend::sigShowMessageBox
void sigShowMessageBox(const QString &szTitle, const QString &szMessage, const QMessageBox::Icon &icon=QMessageBox::Information)
从后台线程中触发在主线程中显示消息对话框(QMessageBox),不阻塞后台线程
CBackend::Start
virtual int Start()
开始。根据 OnInit() 返回值来决定是否开始定时器来支持非 qt 事件
定义
Backend.cpp:84
CBackend::sigError
void sigError(const int nError, const QString &szError=QString())
当有错误产生时触发
CBackend::sigBlockShowMessageBox
void sigBlockShowMessageBox(const QString &szTitle, const QString &szMessage, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton &nRet, bool &checkBox, QString checkBoxContext=QString())
阻塞后台线程,并在前台线程中显示消息对话框(QMessageBox)
CBackend::sigRunning
void sigRunning()
当插件开始成功后触发。仅由插件触发
CBackend::sigFinished
void sigFinished()
停止成功信号。仅由插件触发
CBackend::slotTimeOut
virtual void slotTimeOut()
一个非 Qt 事件处理,它调用 OnProcess(),并根据其返回值开始新的定时器。 如果是不是一个非 Qt 事件循环(就是普通的循环处理), 可以重载它,或者 OnInit() 返回值 OnInit...
定义
Backend.cpp:111
CBackend::sigSecurityLevel
void sigSecurityLevel(CSecurityLevel::Levels level)
当安全级别改变时触发
CBackend::sigBlockShowWidget
void sigBlockShowWidget(const QString &className, int &nRet, void *pContext)
阻塞后台线程,并在前台线程中显示窗口。
CBackend::m_bStopSignal
bool m_bStopSignal
When an error occurs, emit a COperate::sigStop() signal
定义
Backend.h:298
CBackend::sigBlockInputDialog
void sigBlockInputDialog(const QString &szTitle, const QString &szLable, const QString &szMessage, QString &szText)
阻塞后台线程,并在前台线程中显示输入对话框 (QInputDialog)
CBackend::CBackend
CBackend(COperate *pOperate=nullptr, bool bStopSignal=true)
CBackend
COperate
操作接口。
定义
Operate.h:51
作者:康林 (kl222@126.com)
版权所有(c) 康林工作室 保留所有权力