mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: add server notify
This commit is contained in:
@@ -8,9 +8,11 @@ DataParser::DataParser(QObject *parent) :
|
||||
}
|
||||
}
|
||||
|
||||
void DataParser::initialize(RecognizeSystem *recognizeSystem)
|
||||
void DataParser::initialize(RecognizeSystem *recognizeSystem,NotifyController *notifyController)
|
||||
{
|
||||
this->recognizeSystem = recognizeSystem;
|
||||
this->notifyController = notifyController;
|
||||
connect(this,&DataParser::sigNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);
|
||||
}
|
||||
|
||||
void DataParser::createFileDataList(QList<FileData> fileDataList,QString filename)
|
||||
@@ -402,15 +404,20 @@ void DataParser::xmlParser(QByteArray array)
|
||||
emit recognizeSystem->sigSocketDisabled();
|
||||
}
|
||||
|
||||
if(value == "BLOCKED")
|
||||
if (value == "BLOCKED")
|
||||
{
|
||||
emit recognizeSystem->sigServerBlocked();
|
||||
}
|
||||
|
||||
if(value == "HASHSENDCOMPLETE")
|
||||
if (value == "HASHSENDCOMPLETE")
|
||||
{
|
||||
emit recognizeSystem->sigStartCompare();
|
||||
}
|
||||
|
||||
if (value == "BASEDELETETRY")
|
||||
{
|
||||
emit sigNotify("Нельзя удалять базовую версию");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <Core/tools.h>
|
||||
|
||||
class RecognizeSystem;
|
||||
class NotifyController;
|
||||
|
||||
class DataParser : public QObject
|
||||
{
|
||||
@@ -22,7 +23,7 @@ class DataParser : public QObject
|
||||
|
||||
public:
|
||||
explicit DataParser(QObject *parent = 0);
|
||||
void initialize(RecognizeSystem *recognizeSystem);
|
||||
void initialize(RecognizeSystem *recognizeSystem,NotifyController *notifyController);
|
||||
~DataParser();
|
||||
ServerSettings* getServerSettings();
|
||||
void createServerSettings(ServerSettings* serverSettings);
|
||||
@@ -37,6 +38,9 @@ public:
|
||||
|
||||
void xmlParser(QByteArray array);
|
||||
void changeVersion(QString versionName);
|
||||
|
||||
signals:
|
||||
void sigNotify(QString notify);
|
||||
public slots:
|
||||
QByteArray xmlAnswer_notify(QString code);
|
||||
|
||||
@@ -46,6 +50,7 @@ private:
|
||||
const QString XMLAutoStartProperty = "AutoStart=\"";
|
||||
ClientAutorization *authPassCache;
|
||||
RecognizeSystem *recognizeSystem;
|
||||
NotifyController *notifyController;
|
||||
|
||||
};
|
||||
|
||||
|
||||
15
Core/notifycontroller.cpp
Normal file
15
Core/notifycontroller.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "notifycontroller.h"
|
||||
|
||||
NotifyController::NotifyController(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void NotifyController::showWarning(QString text)
|
||||
{
|
||||
QMessageBox warning;
|
||||
warning.setText(text);
|
||||
warning.setIcon(QMessageBox::Warning);
|
||||
warning.setWindowTitle(tr("Ошибка"));
|
||||
warning.exec();
|
||||
}
|
||||
18
Core/notifycontroller.h
Normal file
18
Core/notifycontroller.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef NOTIFYCONTROLLER_H
|
||||
#define NOTIFYCONTROLLER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMessageBox>
|
||||
|
||||
class NotifyController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NotifyController(QObject *parent = nullptr);
|
||||
|
||||
void showWarning(QString text);
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // NOTIFYCONTROLLER_H
|
||||
Reference in New Issue
Block a user