In processing state logic

This commit is contained in:
Krad
2021-12-07 14:13:07 +08:00
parent a02b68acf9
commit fc228ad1eb

View File

@@ -9,6 +9,7 @@
#include <QDate>
#include <QDateTime>
#include <qdebug.h>
#include <src/appvals/AppGlobalValues.h>
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
@@ -90,6 +91,7 @@ void DeviceManager::initDevice() {
// THROW_ERROR(msg);
// return;
// };
AppGlobalValues::setInProcessing(true);
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
//ScanControl fail
qDebug() << "Request stop!";
@@ -113,6 +115,7 @@ void DeviceManager::initDevice() {
TRIGGER_EVENT(GUIEvents::GlobalBannerMessage, nullptr, (QObject *) &s);
TRIGGER_EVENT(GUIEvents::InvokeOperationEnd, nullptr, nullptr);
TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr);
AppGlobalValues::setInProcessing(false);
});
// preview
@@ -123,6 +126,7 @@ void DeviceManager::initDevice() {
qDebug() << "PreviewScan request status, status:" << getStatusString(inf.status);
if (inf.status==READY)
{
AppGlobalValues::setInProcessing(true);
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
//ScanControl
qDebug()<<"Request preview!";
@@ -217,7 +221,9 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
qDebug() << "Scan finished";
QVariant var(true);
qDebug() << "InvokeOperationEnd";
TRIGGER_EVENT(GUIEvents::InvokeOperationEnd, nullptr, (QObject *) &var);
AppGlobalValues::setInProcessing(false);
lastStatus = -1;
previewing = false;
QString s("%1 %2");
@@ -258,6 +264,7 @@ void DeviceManager::processScan(const char *json, bool empty) {
return;
}
static QString msg = "Start scan...";
AppGlobalValues::setInProcessing(true);
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, (QObject *) &msg);
qDebug() << "SetScanInfo>>>>>>>>>>>>>>>>>>>>";
int ret = SetScanInfo(json, empty ? 1 : 0);