mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
ref: draft
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -59,3 +59,4 @@ compile_commands.json
|
|||||||
debug/
|
debug/
|
||||||
release/
|
release/
|
||||||
saves/
|
saves/
|
||||||
|
build/
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
#include "UpdateController.h"
|
#include "UpdateController.h"
|
||||||
|
|
||||||
UpdateController::UpdateController(DataParser *parser,SendSystem *sendSystem, QObject *parent) :
|
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
UpdateController::UpdateController(DataParserOutput *dataParserOut, SendSystem *sendSystem, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
this->dataParser = parser;
|
|
||||||
this->sendSystem = sendSystem;
|
this->sendSystem = sendSystem;
|
||||||
|
this->dataParserOut = dataParserOut;
|
||||||
applicationFolderPath = QDir::currentPath() + applicationFolderName;
|
applicationFolderPath = QDir::currentPath() + applicationFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::initialize(MainWindow *mainWindow,VersionContainer *versionContainer)
|
void UpdateController::initialize(VersionContainer *versionContainer)
|
||||||
{
|
{
|
||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
connect(this,&UpdateController::sigUpdateComplete,mainWindow,&MainWindow::showCompleteDialogBox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::calculateCommonHash()
|
void UpdateController::calculateCommonHash()
|
||||||
@@ -20,7 +22,7 @@ void UpdateController::calculateCommonHash()
|
|||||||
appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
||||||
calculateStreamingHash();
|
calculateStreamingHash();
|
||||||
appDataList.append(streamingDataList);
|
appDataList.append(streamingDataList);
|
||||||
dataParser->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
dataParserOut->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
||||||
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +31,7 @@ void UpdateController::calculateStreamingHash()
|
|||||||
streamingDataList.clear();
|
streamingDataList.clear();
|
||||||
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
||||||
std::sort(streamingDataList.begin(),streamingDataList.end());
|
std::sort(streamingDataList.begin(),streamingDataList.end());
|
||||||
dataParser->createFileDataList(streamingDataList,streamingHashFilename);
|
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<FileData> UpdateController::calculateHash(QString path,QString ignoreName)
|
QList<FileData> UpdateController::calculateHash(QString path,QString ignoreName)
|
||||||
@@ -107,12 +109,6 @@ QList<FileData> UpdateController::calculateHash(QString path,QString ignoreName)
|
|||||||
return *hashes;
|
return *hashes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::checkCanUpdate()
|
|
||||||
{
|
|
||||||
QByteArray checkUpdate = dataParser->xmlAnswer_notify("CANCHANGE");
|
|
||||||
sendSystem->sendXMLAnswer(checkUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
||||||
|
|
||||||
QListIterator<FileData> serverIterator(*fileSendList);
|
QListIterator<FileData> serverIterator(*fileSendList);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef UPDATECONTROLLER_H
|
#ifndef UPDATECONTROLLER_H
|
||||||
#define UPDATECONTROLLER_H
|
#define UPDATECONTROLLER_H
|
||||||
|
|
||||||
|
#include "Core/sendsystem.h"
|
||||||
|
#include "Core/versioncontainer.h"
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QXmlStreamAttribute>
|
#include <QXmlStreamAttribute>
|
||||||
@@ -15,14 +17,8 @@
|
|||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
|
||||||
#include <Data\FileData.h>
|
#include <Data\FileData.h>
|
||||||
#include <Core\dataparser.h>
|
|
||||||
#include <Core\tcpclient.h>
|
|
||||||
#include <Data\streamingversiondata.h>
|
#include <Data\streamingversiondata.h>
|
||||||
|
#include <Core\dataparseroutput.h>
|
||||||
class SendSystem;
|
|
||||||
class MainWindow;
|
|
||||||
class DataParser;
|
|
||||||
class VersionContainer;
|
|
||||||
|
|
||||||
class UpdateController : public QObject
|
class UpdateController : public QObject
|
||||||
{
|
{
|
||||||
@@ -30,11 +26,10 @@ class UpdateController : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit UpdateController(DataParser *parser,
|
explicit UpdateController(DataParserOutput *dataParser, SendSystem *sendSystem,
|
||||||
SendSystem *sendSystem,
|
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
void initialize(MainWindow *mainWindow,VersionContainer *versionContainer);
|
void initialize(VersionContainer *versionContainer);
|
||||||
void calculateCommonHash();
|
void calculateCommonHash();
|
||||||
void calculateStreamingHash();
|
void calculateStreamingHash();
|
||||||
~UpdateController();
|
~UpdateController();
|
||||||
@@ -45,8 +40,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void sigUpdateComplete(bool flag);
|
void sigUpdateComplete(bool flag);
|
||||||
private:
|
private:
|
||||||
DataParser *dataParser;
|
|
||||||
SendSystem *sendSystem;
|
SendSystem *sendSystem;
|
||||||
|
DataParserOutput * dataParserOut;
|
||||||
QString applicationFolderPath;
|
QString applicationFolderPath;
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
QList<FileData> appDataList;
|
QList<FileData> appDataList;
|
||||||
|
|||||||
@@ -8,211 +8,11 @@ DataParser::DataParser(QObject *parent) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataParser::initialize(RecognizeSystem *recognizeSystem,
|
void DataParser::initialize()
|
||||||
NotifyController *notifyController,
|
|
||||||
UpdateController *updateController,
|
|
||||||
HashComparer *hashComparer)
|
|
||||||
{
|
{
|
||||||
this->recognizeSystem = recognizeSystem;
|
|
||||||
this->notifyController = notifyController;
|
|
||||||
this->hashComparer = hashComparer;
|
|
||||||
|
|
||||||
connect(this,&DataParser::sigNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);
|
|
||||||
connect(this,&DataParser::sigUpdateFilesOnServer,updateController,&UpdateController::updateFilesOnServer,Qt::AutoConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataParser::createFileDataList(QList<FileData> fileDataList,QString filename)
|
|
||||||
{
|
|
||||||
|
|
||||||
QFile file(filename);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartDocument();
|
|
||||||
xmlWriter.writeStartElement("FileDataList");
|
|
||||||
|
|
||||||
foreach (FileData data,fileDataList)
|
|
||||||
{
|
|
||||||
xmlWriter.writeStartElement("FileData");
|
|
||||||
|
|
||||||
xmlWriter.writeAttribute("Path",data.path);
|
|
||||||
xmlWriter.writeAttribute("Hash",data.hash);
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
xmlWriter.writeEndDocument();
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataParser::createAuthMessage(ClientAutorization *auth)
|
|
||||||
{
|
|
||||||
authPassCache = auth; //кэширование даных авторизации, для сохранения при успешном заходе
|
|
||||||
|
|
||||||
QFile file(tempName);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartDocument();
|
|
||||||
xmlWriter.writeStartElement("ClientAutorization");
|
|
||||||
|
|
||||||
xmlWriter.writeAttribute("Login",auth->Login);
|
|
||||||
xmlWriter.writeAttribute("Password",auth->Password);
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
xmlWriter.writeEndDocument();
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataParser::createServerSettings(ServerSettings* serverSettings)
|
|
||||||
{
|
|
||||||
QFile file(settingsName);
|
|
||||||
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartDocument();
|
|
||||||
|
|
||||||
xmlWriter.writeStartElement("ServerSettingsContainer");
|
|
||||||
xmlWriter.writeStartElement("ServerSettings");
|
|
||||||
|
|
||||||
xmlWriter.writeAttribute("Address",serverSettings->Address);
|
|
||||||
xmlWriter.writeAttribute("Port",serverSettings->Port);
|
|
||||||
xmlWriter.writeAttribute("Language","RUS");
|
|
||||||
xmlWriter.writeAttribute("AutoStart",QString::number(false));
|
|
||||||
xmlWriter.writeAttribute("DestPortMath","18003");
|
|
||||||
xmlWriter.writeAttribute("LocalPortMath","18004");
|
|
||||||
xmlWriter.writeAttribute("UseMathModel",QString::number(serverSettings->mathModelUse));
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
|
|
||||||
if(serverSettings->LocalVersionName == "")
|
|
||||||
{
|
|
||||||
xmlWriter.writeStartElement("VersionData");
|
|
||||||
xmlWriter.writeAttribute("Version","NONE");
|
|
||||||
xmlWriter.writeAttribute("isChangable","0");
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xmlWriter.writeStartElement("VersionData");
|
|
||||||
xmlWriter.writeAttribute("Version",serverSettings->versionData.getViewName());
|
|
||||||
xmlWriter.writeAttribute("isChangable",QString::number(serverSettings->versionData.getIsChangeable()));
|
|
||||||
}
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
|
|
||||||
xmlWriter.writeEndDocument();
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataParser::changeVersion(StreamingVersionData *versionData)
|
|
||||||
{
|
|
||||||
QFile file(settingsName);
|
|
||||||
|
|
||||||
file.open(QIODevice::ReadWrite);
|
|
||||||
QByteArray xmlData(file.readAll());
|
|
||||||
|
|
||||||
QDomDocument doc;
|
|
||||||
doc.setContent(xmlData);
|
|
||||||
QDomElement containerElement = doc.firstChildElement("ServerSettingsContainer");
|
|
||||||
QDomElement verDataElement = containerElement.firstChildElement("VersionData");
|
|
||||||
verDataElement.setAttribute("Version",versionData->getViewName());
|
|
||||||
verDataElement.setAttribute("Created",versionData->getCreateData().toString());
|
|
||||||
verDataElement.setAttribute("isChangable",versionData->getIsChangeable());
|
|
||||||
|
|
||||||
file.resize(0);
|
|
||||||
QTextStream out(&file);
|
|
||||||
doc.save(out,4);
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataParser::createAuthData(ServerAuthorization *serverAuth)
|
|
||||||
{
|
|
||||||
QFile file(authTempName);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartDocument();
|
|
||||||
xmlWriter.writeStartElement("AuthData");
|
|
||||||
xmlWriter.writeAttribute("Login",authPassCache->Login);
|
|
||||||
xmlWriter.writeAttribute("Password",authPassCache->Password);
|
|
||||||
xmlWriter.writeAttribute("InstructorName",serverAuth->InstructorName);
|
|
||||||
xmlWriter.writeAttribute("ClientName",serverAuth->ClientName);
|
|
||||||
xmlWriter.writeAttribute("AccessType",serverAuth->AccessType);
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataParser::createAuthDataOffline(QString username, QString pass)
|
|
||||||
{
|
|
||||||
QFile file(authTempName);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartDocument();
|
|
||||||
xmlWriter.writeStartElement("AuthData");
|
|
||||||
xmlWriter.writeAttribute("Login",username);
|
|
||||||
xmlWriter.writeAttribute("Password",pass);
|
|
||||||
xmlWriter.writeAttribute("InstructorName","empty");
|
|
||||||
xmlWriter.writeAttribute("ClientName","Offline");
|
|
||||||
xmlWriter.writeAttribute("AccessType","Offline");
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray DataParser::xmlAnswer_notify(QString code)
|
|
||||||
{
|
|
||||||
|
|
||||||
QList<SXmlAnswerTag> listTag;
|
|
||||||
|
|
||||||
SAttribute attribute1 = {"Code", code};
|
|
||||||
QList<SAttribute> listAttr = {attribute1};
|
|
||||||
SXmlAnswerTag tag = {"ClientNotify", listAttr};
|
|
||||||
|
|
||||||
listTag.append(tag);
|
|
||||||
|
|
||||||
return xmlAnswer(listTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataParser::addRunData(QList<int> displays)
|
|
||||||
{
|
|
||||||
QFile file(displayTemp);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
QString data;
|
|
||||||
|
|
||||||
for(int i = 0; i < displays.count(); i++)
|
|
||||||
{
|
|
||||||
data.append(QString::number(displays[i]) + ";");
|
|
||||||
}
|
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartElement("DisplayInfo");
|
|
||||||
xmlWriter.writeAttribute("DisplaysID",data);
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerSettings *DataParser::getClientSettings()
|
ServerSettings *DataParser::getClientSettings()
|
||||||
{
|
{
|
||||||
@@ -294,127 +94,6 @@ ServerSettings *DataParser::getClientSettings()
|
|||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataParser::saveClientSettrings(QString language, bool isAutoStart)
|
|
||||||
{
|
|
||||||
QFile file(settingsName);
|
|
||||||
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
||||||
|
|
||||||
QString settings = file.readAll();
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
file.remove();
|
|
||||||
|
|
||||||
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
|
||||||
|
|
||||||
auto languagePos = settings.indexOf(XMLLanguageProperty) + XMLLanguageProperty.length();
|
|
||||||
settings = settings.replace(languagePos,language.size(),language);
|
|
||||||
|
|
||||||
auto autoStartPos = settings.indexOf(XMLAutoStartProperty) + XMLAutoStartProperty.length();
|
|
||||||
settings = settings.replace(autoStartPos,1,QString::number(isAutoStart));
|
|
||||||
|
|
||||||
file.write(settings.toUtf8());
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<FileData>* DataParser::xmlFileDataParse(QByteArray array, QString filter = "")
|
|
||||||
{
|
|
||||||
QXmlStreamReader xmlReader(array);
|
|
||||||
QList<FileData> *datas = new QList<FileData>;
|
|
||||||
xmlReader.readNext(); // Переходим к первому элементу в файле
|
|
||||||
|
|
||||||
//Крутимся в цикле до тех пор, пока не достигнем конца документа
|
|
||||||
while(!xmlReader.atEnd())
|
|
||||||
{
|
|
||||||
//Проверяем, является ли элемент началом тега
|
|
||||||
if(xmlReader.isStartElement())
|
|
||||||
{
|
|
||||||
if(xmlReader.name() == "FileData")
|
|
||||||
{
|
|
||||||
FileData data;
|
|
||||||
|
|
||||||
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
|
|
||||||
{
|
|
||||||
QString name = attr.name().toString();
|
|
||||||
QString value = attr.value().toString();
|
|
||||||
|
|
||||||
if(name == "Path")
|
|
||||||
data.path = value;
|
|
||||||
else if(name == "Hash")
|
|
||||||
data.hash = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(data.path.contains(filter))
|
|
||||||
|
|
||||||
datas->append(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xmlReader.readNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
return datas;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray DataParser::xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1, QString elemUp2)
|
|
||||||
{
|
|
||||||
/* Открываем файл для Записи*/
|
|
||||||
QFile file(tempName);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
/* Создаем объект, с помощью которого осуществляется запись в файл */
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
|
|
||||||
xmlWriter.setAutoFormatting(true); // Устанавливаем автоформатирование текста
|
|
||||||
|
|
||||||
xmlWriter.writeStartDocument(); // Запускаем запись в документ
|
|
||||||
|
|
||||||
if(elemUp1 != "")
|
|
||||||
xmlWriter.writeStartElement(elemUp1); // Записываем тег
|
|
||||||
|
|
||||||
if(elemUp2 != "")
|
|
||||||
xmlWriter.writeStartElement(elemUp2); // Записываем тег
|
|
||||||
|
|
||||||
//Записываем все элементы
|
|
||||||
foreach(SXmlAnswerTag tag, listTag)
|
|
||||||
{
|
|
||||||
xmlWriter.writeStartElement(tag.elementName); // Записываем тег
|
|
||||||
|
|
||||||
// Записываем атрибуты
|
|
||||||
foreach(SAttribute attr, tag.attr)
|
|
||||||
xmlWriter.writeAttribute(attr.name, attr.value);
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement(); // Закрываем тег
|
|
||||||
}
|
|
||||||
|
|
||||||
if(elemUp1 != "")
|
|
||||||
xmlWriter.writeEndElement(); // Закрываем тег
|
|
||||||
|
|
||||||
if(elemUp1 != "")
|
|
||||||
xmlWriter.writeEndElement(); // Закрываем тег
|
|
||||||
|
|
||||||
/* Завершаем запись в документ*/
|
|
||||||
xmlWriter.writeEndDocument();
|
|
||||||
|
|
||||||
file.close(); // Закрываем файл
|
|
||||||
|
|
||||||
QByteArray array;
|
|
||||||
|
|
||||||
/* Открываем файл для Чтения*/
|
|
||||||
QFile fileR(tempName);
|
|
||||||
if (!fileR.open(QFile::ReadOnly | QFile::Text))
|
|
||||||
{
|
|
||||||
QString str = "Не удалось открыть файл";
|
|
||||||
qDebug() << "xmlAnswer: " << str;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
array = fileR.readAll();
|
|
||||||
fileR.close(); // Закрываем файл
|
|
||||||
}
|
|
||||||
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataParser::xmlParser(QByteArray array)
|
void DataParser::xmlParser(QByteArray array)
|
||||||
{
|
{
|
||||||
QXmlStreamReader xmlReader(array);
|
QXmlStreamReader xmlReader(array);
|
||||||
@@ -439,17 +118,17 @@ void DataParser::xmlParser(QByteArray array)
|
|||||||
{
|
{
|
||||||
if (value == "END")
|
if (value == "END")
|
||||||
{
|
{
|
||||||
emit recognizeSystem->sigSocketDisabled();
|
postProcessorSystem->socketDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == "BLOCKED")
|
if (value == "BLOCKED")
|
||||||
{
|
{
|
||||||
emit recognizeSystem->sigServerBlocked();
|
postProcessorSystem->serverBlocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == "HASHSENDCOMPLETE")
|
if (value == "HASHSENDCOMPLETE")
|
||||||
{
|
{
|
||||||
emit recognizeSystem->sigStartCompare();
|
postProcessorSystem->startCompare();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == "BASEDELETETRY")
|
if (value == "BASEDELETETRY")
|
||||||
@@ -470,12 +149,14 @@ void DataParser::xmlParser(QByteArray array)
|
|||||||
if (value == "UNCHANGEABLE")
|
if (value == "UNCHANGEABLE")
|
||||||
{
|
{
|
||||||
emit sigNotify(tr("Нельзя выгружать в базовую версию"));
|
emit sigNotify(tr("Нельзя выгружать в базовую версию"));
|
||||||
emit recognizeSystem->sigShowUpdateList();
|
postProcessorSystem->showUpdateList();
|
||||||
|
//emit recognizeSystem->sigShowUpdateList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == "CHANGEABLE")
|
if (value == "CHANGEABLE")
|
||||||
{
|
{
|
||||||
emit sigUpdateFilesOnServer(hashComparer->getFilesForUpdate());
|
postProcessorSystem->compareFiles();
|
||||||
|
//emit sigUpdateFilesOnServer(hashComparer->getFilesForUpdate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -504,11 +185,13 @@ void DataParser::xmlParser(QByteArray array)
|
|||||||
|
|
||||||
if (name == "AccessType"){
|
if (name == "AccessType"){
|
||||||
serverAuth->AccessType = value;
|
serverAuth->AccessType = value;
|
||||||
recognizeSystem->checkAccessType(value);
|
postProcessorSystem->checkAccessType(value);
|
||||||
|
//recognizeSystem->checkAccessType(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit recognizeSystem->sigSaveLoginData(serverAuth);
|
postProcessorSystem->saveLoginData(serverAuth);
|
||||||
|
//emit recognizeSystem->sigSaveLoginData(serverAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(xmlReader.name() == "VersionData")
|
if(xmlReader.name() == "VersionData")
|
||||||
@@ -535,7 +218,8 @@ void DataParser::xmlParser(QByteArray array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
recognizeSystem->setServerVersion(serverVersion);
|
postProcessorSystem->setServerVersion(serverVersion);
|
||||||
|
//recognizeSystem->setServerVersion(serverVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(xmlReader.name() == "VersionList")
|
if(xmlReader.name() == "VersionList")
|
||||||
@@ -572,7 +256,7 @@ void DataParser::xmlParser(QByteArray array)
|
|||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
}
|
}
|
||||||
recognizeSystem->showServerDataList(serverStreamingVersionDataList);
|
postProcessorSystem->showServerDataList(serverStreamingVersionDataList);
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef DATAPARSER_H
|
#ifndef DATAPARSER_H
|
||||||
#define DATAPARSER_H
|
#define DATAPARSER_H
|
||||||
|
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -10,13 +9,10 @@
|
|||||||
#include <Data/FileData.h>
|
#include <Data/FileData.h>
|
||||||
#include <Data/Datas.h>
|
#include <Data/Datas.h>
|
||||||
#include <Data/FileData.h>
|
#include <Data/FileData.h>
|
||||||
#include <Core/recognizesystem.h>
|
|
||||||
#include <Core/tools.h>
|
#include <Core/tools.h>
|
||||||
|
#include "Core/postprocessorsystem.h"
|
||||||
|
|
||||||
class RecognizeSystem;
|
|
||||||
class NotifyController;
|
class NotifyController;
|
||||||
class UpdateController;
|
|
||||||
class HashComparer;
|
|
||||||
|
|
||||||
class DataParser : public QObject
|
class DataParser : public QObject
|
||||||
{
|
{
|
||||||
@@ -25,41 +21,19 @@ class DataParser : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DataParser(QObject *parent = 0);
|
explicit DataParser(QObject *parent = 0);
|
||||||
void initialize(RecognizeSystem *recognizeSystem,
|
void initialize();
|
||||||
NotifyController *notifyController,
|
|
||||||
UpdateController *updateController,
|
|
||||||
HashComparer *hashComparer);
|
|
||||||
|
|
||||||
~DataParser();
|
~DataParser();
|
||||||
ServerSettings* getClientSettings();
|
ServerSettings* getClientSettings();
|
||||||
void createServerSettings(ServerSettings* serverSettings);
|
|
||||||
void saveClientSettrings(QString language,bool isAutoStart);
|
|
||||||
void createFileDataList(QList<FileData> fileDataList,QString filename);
|
|
||||||
void createAuthMessage(ClientAutorization *auth);
|
|
||||||
void createAuthData(ServerAuthorization *serverAuth);
|
|
||||||
void createAuthDataOffline(QString username,QString pass);
|
|
||||||
void addRunData(QList<int> displays);
|
|
||||||
QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1 = "", QString elemUp2 = "");
|
|
||||||
QList<FileData>* xmlFileDataParse(QByteArray array,QString filter);
|
|
||||||
|
|
||||||
void xmlParser(QByteArray array);
|
void xmlParser(QByteArray array);
|
||||||
void changeVersion(StreamingVersionData *versionData);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigNotify(QString notify);
|
void sigNotify(QString notify);
|
||||||
void sigUpdateFilesOnServer(QList<FileData> *fileSendList);
|
void sigUpdateFilesOnServer(QList<FileData> *fileSendList);
|
||||||
public slots:
|
|
||||||
QByteArray xmlAnswer_notify(QString code);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString XMLLanguageProperty = "Language=\"";
|
|
||||||
const QString XMLAutoStartProperty = "AutoStart=\"";
|
|
||||||
ClientAutorization *authPassCache;
|
ClientAutorization *authPassCache;
|
||||||
RecognizeSystem *recognizeSystem;
|
PostProcessorSystem *postProcessorSystem;
|
||||||
NotifyController *notifyController;
|
|
||||||
HashComparer *hashComparer;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATAPARSER_H
|
#endif // DATAPARSER_H
|
||||||
|
|||||||
3
Core/dataparserouput.cpp
Normal file
3
Core/dataparserouput.cpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#include "dataparserouput.h"
|
||||||
|
|
||||||
|
dataParserOuput::dataParserOuput() {}
|
||||||
13
Core/dataparserouput.h
Normal file
13
Core/dataparserouput.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef DATAPARSEROUPUT_H
|
||||||
|
#define DATAPARSEROUPUT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class dataParserOuput
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
dataParserOuput();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DATAPARSEROUPUT_H
|
||||||
317
Core/dataparseroutput.cpp
Normal file
317
Core/dataparseroutput.cpp
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
#include "dataparseroutput.h"
|
||||||
|
|
||||||
|
DataParserOutput::DataParserOutput() {}
|
||||||
|
|
||||||
|
QByteArray DataParserOutput::xmlAnswer_notify(QString code)
|
||||||
|
{
|
||||||
|
|
||||||
|
QList<SXmlAnswerTag> listTag;
|
||||||
|
|
||||||
|
SAttribute attribute1 = {"Code", code};
|
||||||
|
QList<SAttribute> listAttr = {attribute1};
|
||||||
|
SXmlAnswerTag tag = {"ClientNotify", listAttr};
|
||||||
|
|
||||||
|
listTag.append(tag);
|
||||||
|
|
||||||
|
return xmlAnswer(listTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray DataParserOutput::xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1, QString elemUp2)
|
||||||
|
{
|
||||||
|
/* Открываем файл для Записи*/
|
||||||
|
QFile file(tempName);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
/* Создаем объект, с помощью которого осуществляется запись в файл */
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
|
||||||
|
xmlWriter.setAutoFormatting(true); // Устанавливаем автоформатирование текста
|
||||||
|
|
||||||
|
xmlWriter.writeStartDocument(); // Запускаем запись в документ
|
||||||
|
|
||||||
|
if(elemUp1 != "")
|
||||||
|
xmlWriter.writeStartElement(elemUp1); // Записываем тег
|
||||||
|
|
||||||
|
if(elemUp2 != "")
|
||||||
|
xmlWriter.writeStartElement(elemUp2); // Записываем тег
|
||||||
|
|
||||||
|
//Записываем все элементы
|
||||||
|
foreach(SXmlAnswerTag tag, listTag)
|
||||||
|
{
|
||||||
|
xmlWriter.writeStartElement(tag.elementName); // Записываем тег
|
||||||
|
|
||||||
|
// Записываем атрибуты
|
||||||
|
foreach(SAttribute attr, tag.attr)
|
||||||
|
xmlWriter.writeAttribute(attr.name, attr.value);
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement(); // Закрываем тег
|
||||||
|
}
|
||||||
|
|
||||||
|
if(elemUp1 != "")
|
||||||
|
xmlWriter.writeEndElement(); // Закрываем тег
|
||||||
|
|
||||||
|
if(elemUp1 != "")
|
||||||
|
xmlWriter.writeEndElement(); // Закрываем тег
|
||||||
|
|
||||||
|
/* Завершаем запись в документ*/
|
||||||
|
xmlWriter.writeEndDocument();
|
||||||
|
|
||||||
|
file.close(); // Закрываем файл
|
||||||
|
|
||||||
|
QByteArray array;
|
||||||
|
|
||||||
|
/* Открываем файл для Чтения*/
|
||||||
|
QFile fileR(tempName);
|
||||||
|
if (!fileR.open(QFile::ReadOnly | QFile::Text))
|
||||||
|
{
|
||||||
|
QString str = "Не удалось открыть файл";
|
||||||
|
qDebug() << "xmlAnswer: " << str;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
array = fileR.readAll();
|
||||||
|
fileR.close(); // Закрываем файл
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DataParserOutput::createFileDataList(QList<FileData> fileDataList,QString filename)
|
||||||
|
{
|
||||||
|
QFile file(filename);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartDocument();
|
||||||
|
xmlWriter.writeStartElement("FileDataList");
|
||||||
|
|
||||||
|
foreach (FileData data,fileDataList)
|
||||||
|
{
|
||||||
|
xmlWriter.writeStartElement("FileData");
|
||||||
|
|
||||||
|
xmlWriter.writeAttribute("Path",data.path);
|
||||||
|
xmlWriter.writeAttribute("Hash",data.hash);
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
xmlWriter.writeEndDocument();
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataParserOutput::createAuthMessage(ClientAutorization *auth)
|
||||||
|
{
|
||||||
|
authPassCache = auth; //кэширование даных авторизации, для сохранения при успешном заходе
|
||||||
|
|
||||||
|
QFile file(tempName);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartDocument();
|
||||||
|
xmlWriter.writeStartElement("ClientAutorization");
|
||||||
|
|
||||||
|
xmlWriter.writeAttribute("Login",auth->Login);
|
||||||
|
xmlWriter.writeAttribute("Password",auth->Password);
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
xmlWriter.writeEndDocument();
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
||||||
|
{
|
||||||
|
QFile file(settingsName);
|
||||||
|
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartDocument();
|
||||||
|
|
||||||
|
xmlWriter.writeStartElement("ServerSettingsContainer");
|
||||||
|
xmlWriter.writeStartElement("ServerSettings");
|
||||||
|
|
||||||
|
xmlWriter.writeAttribute("Address",serverSettings->Address);
|
||||||
|
xmlWriter.writeAttribute("Port",serverSettings->Port);
|
||||||
|
xmlWriter.writeAttribute("Language","RUS");
|
||||||
|
xmlWriter.writeAttribute("AutoStart",QString::number(false));
|
||||||
|
xmlWriter.writeAttribute("DestPortMath","18003");
|
||||||
|
xmlWriter.writeAttribute("LocalPortMath","18004");
|
||||||
|
xmlWriter.writeAttribute("UseMathModel",QString::number(serverSettings->mathModelUse));
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
|
||||||
|
if(serverSettings->LocalVersionName == "")
|
||||||
|
{
|
||||||
|
xmlWriter.writeStartElement("VersionData");
|
||||||
|
xmlWriter.writeAttribute("Version","NONE");
|
||||||
|
xmlWriter.writeAttribute("isChangable","0");
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xmlWriter.writeStartElement("VersionData");
|
||||||
|
xmlWriter.writeAttribute("Version",serverSettings->versionData.getViewName());
|
||||||
|
xmlWriter.writeAttribute("isChangable",QString::number(serverSettings->versionData.getIsChangeable()));
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
|
||||||
|
xmlWriter.writeEndDocument();
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataParserOutput::changeVersion(StreamingVersionData *versionData)
|
||||||
|
{
|
||||||
|
QFile file(settingsName);
|
||||||
|
|
||||||
|
file.open(QIODevice::ReadWrite);
|
||||||
|
QByteArray xmlData(file.readAll());
|
||||||
|
|
||||||
|
QDomDocument doc;
|
||||||
|
doc.setContent(xmlData);
|
||||||
|
QDomElement containerElement = doc.firstChildElement("ServerSettingsContainer");
|
||||||
|
QDomElement verDataElement = containerElement.firstChildElement("VersionData");
|
||||||
|
verDataElement.setAttribute("Version",versionData->getViewName());
|
||||||
|
verDataElement.setAttribute("Created",versionData->getCreateData().toString());
|
||||||
|
verDataElement.setAttribute("isChangable",versionData->getIsChangeable());
|
||||||
|
|
||||||
|
file.resize(0);
|
||||||
|
QTextStream out(&file);
|
||||||
|
doc.save(out,4);
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataParserOutput::createAuthData(ServerAuthorization *serverAuth)
|
||||||
|
{
|
||||||
|
QFile file(authTempName);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartDocument();
|
||||||
|
xmlWriter.writeStartElement("AuthData");
|
||||||
|
xmlWriter.writeAttribute("Login",authPassCache->Login);
|
||||||
|
xmlWriter.writeAttribute("Password",authPassCache->Password);
|
||||||
|
xmlWriter.writeAttribute("InstructorName",serverAuth->InstructorName);
|
||||||
|
xmlWriter.writeAttribute("ClientName",serverAuth->ClientName);
|
||||||
|
xmlWriter.writeAttribute("AccessType",serverAuth->AccessType);
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataParserOutput::createAuthDataOffline(QString username, QString pass)
|
||||||
|
{
|
||||||
|
QFile file(authTempName);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartDocument();
|
||||||
|
xmlWriter.writeStartElement("AuthData");
|
||||||
|
xmlWriter.writeAttribute("Login",username);
|
||||||
|
xmlWriter.writeAttribute("Password",pass);
|
||||||
|
xmlWriter.writeAttribute("InstructorName","empty");
|
||||||
|
xmlWriter.writeAttribute("ClientName","Offline");
|
||||||
|
xmlWriter.writeAttribute("AccessType","Offline");
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataParserOutput::addRunData(QList<int> displays)
|
||||||
|
{
|
||||||
|
QFile file(displayTemp);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
QString data;
|
||||||
|
|
||||||
|
for(int i = 0; i < displays.count(); i++)
|
||||||
|
{
|
||||||
|
data.append(QString::number(displays[i]) + ";");
|
||||||
|
}
|
||||||
|
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartElement("DisplayInfo");
|
||||||
|
xmlWriter.writeAttribute("DisplaysID",data);
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataParserOutput::saveClientSettrings(QString language, bool isAutoStart)
|
||||||
|
{
|
||||||
|
QFile file(settingsName);
|
||||||
|
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
|
|
||||||
|
QString settings = file.readAll();
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
file.remove();
|
||||||
|
|
||||||
|
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
|
||||||
|
auto languagePos = settings.indexOf(XMLLanguageProperty) + XMLLanguageProperty.length();
|
||||||
|
settings = settings.replace(languagePos,language.size(),language);
|
||||||
|
|
||||||
|
auto autoStartPos = settings.indexOf(XMLAutoStartProperty) + XMLAutoStartProperty.length();
|
||||||
|
settings = settings.replace(autoStartPos,1,QString::number(isAutoStart));
|
||||||
|
|
||||||
|
file.write(settings.toUtf8());
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<FileData>* DataParserOutput::xmlFileDataParse(QByteArray array, QString filter = "")
|
||||||
|
{
|
||||||
|
QXmlStreamReader xmlReader(array);
|
||||||
|
QList<FileData> *datas = new QList<FileData>;
|
||||||
|
xmlReader.readNext(); // Переходим к первому элементу в файле
|
||||||
|
|
||||||
|
//Крутимся в цикле до тех пор, пока не достигнем конца документа
|
||||||
|
while(!xmlReader.atEnd())
|
||||||
|
{
|
||||||
|
//Проверяем, является ли элемент началом тега
|
||||||
|
if(xmlReader.isStartElement())
|
||||||
|
{
|
||||||
|
if(xmlReader.name() == "FileData")
|
||||||
|
{
|
||||||
|
FileData data;
|
||||||
|
|
||||||
|
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
|
||||||
|
{
|
||||||
|
QString name = attr.name().toString();
|
||||||
|
QString value = attr.value().toString();
|
||||||
|
|
||||||
|
if(name == "Path")
|
||||||
|
data.path = value;
|
||||||
|
else if(name == "Hash")
|
||||||
|
data.hash = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.path.contains(filter))
|
||||||
|
|
||||||
|
datas->append(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlReader.readNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
return datas;
|
||||||
|
}
|
||||||
35
Core/dataparseroutput.h
Normal file
35
Core/dataparseroutput.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef DATAPARSEROUTPUT_H
|
||||||
|
#define DATAPARSEROUTPUT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <Data/FileData.h>
|
||||||
|
#include <Data/Datas.h>
|
||||||
|
#include <Core/tools.h>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QXmlStreamWriter>
|
||||||
|
#include <QDomDocument>
|
||||||
|
|
||||||
|
|
||||||
|
class DataParserOutput : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DataParserOutput();
|
||||||
|
void createFileDataList(QList<FileData> fileDataList, QString filename);
|
||||||
|
void createAuthMessage(ClientAutorization *auth);
|
||||||
|
void createServerSettings(ServerSettings *serverSettings);
|
||||||
|
void changeVersion(StreamingVersionData *versionData);
|
||||||
|
void createAuthData(ServerAuthorization *serverAuth);
|
||||||
|
void createAuthDataOffline(QString username, QString pass);
|
||||||
|
void addRunData(QList<int> displays);
|
||||||
|
void saveClientSettrings(QString language, bool isAutoStart);
|
||||||
|
QList<FileData> *xmlFileDataParse(QByteArray array, QString filter);
|
||||||
|
QByteArray xmlAnswer_notify(QString code);
|
||||||
|
QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1 ="", QString elemUp2 ="");
|
||||||
|
private:
|
||||||
|
const QString XMLLanguageProperty = "Language=\"";
|
||||||
|
const QString XMLAutoStartProperty = "AutoStart=\"";
|
||||||
|
ClientAutorization *authPassCache;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DATAPARSEROUTPUT_H
|
||||||
@@ -1,38 +1,25 @@
|
|||||||
#include "hashcomparer.h"
|
#include "hashcomparer.h"
|
||||||
|
|
||||||
HashComparer::HashComparer(DataParser *dataParser,QObject *)
|
HashComparer::HashComparer(QObject *)
|
||||||
{
|
{
|
||||||
this->dataParser = dataParser;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HashComparer::initialize(MainWindow* mainWindow,VersionContainer *versionContainer)
|
void HashComparer::initialize(VersionContainer *versionContainer)
|
||||||
{
|
{
|
||||||
connect(this,&HashComparer::sigCallCheck,mainWindow,&MainWindow::checkUpdate);
|
|
||||||
connect(this,&HashComparer::sigHaveDelta,mainWindow,&MainWindow::showUpdateInfo);
|
|
||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HashComparer::CompareDeltas()
|
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
||||||
{
|
{
|
||||||
QList<FileData> *serverStreamingHash = new QList<FileData>;
|
// QList<FileData> *serverStreamingHash = new QList<FileData>;
|
||||||
QList<FileData> *localStreamingHash = new QList<FileData>;
|
// QList<FileData> *localStreamingHash = new QList<FileData>;
|
||||||
QList<FileData> *files = new QList<FileData>;
|
QList<FileData> *files = new QList<FileData>;
|
||||||
|
|
||||||
QFile file(serverHash);
|
QMutableListIterator<FileData> iterator(localStreamingHash);
|
||||||
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
||||||
|
|
||||||
serverStreamingHash = dataParser->xmlFileDataParse(file.readAll(),"StreamingAssets");
|
for (auto &item:localStreamingHash)
|
||||||
file.close();
|
|
||||||
|
|
||||||
QFile file2(streamingHashFilename);
|
|
||||||
file2.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
||||||
|
|
||||||
localStreamingHash = dataParser->xmlFileDataParse(file2.readAll(),"StreamingAssets");
|
|
||||||
file2.close();
|
|
||||||
|
|
||||||
QMutableListIterator<FileData> iterator(*localStreamingHash);
|
|
||||||
|
|
||||||
for (auto &item:*localStreamingHash)
|
|
||||||
{
|
{
|
||||||
if(!serverStreamingHash->contains(item))
|
if(!serverStreamingHash->contains(item))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,20 +5,19 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <Data/FileData.h>
|
#include <Data/FileData.h>
|
||||||
#include <Core/dataparser.h>
|
|
||||||
#include <Core/tools.h>
|
#include <Core/tools.h>
|
||||||
#include <Widgets/updatenotifywidget.h>
|
#include <Widgets/updatenotifywidget.h>
|
||||||
#include <Widgets/updatenotifywidget.h>
|
|
||||||
|
|
||||||
class UpdateNotifyWidget;
|
class UpdateNotifyWidget;
|
||||||
class VersionContainer;
|
class VersionContainer;
|
||||||
|
|
||||||
class HashComparer :public QObject
|
class HashComparer :public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit HashComparer(DataParser *dataParser,QObject *parent = nullptr);
|
explicit HashComparer(QObject *parent = nullptr);
|
||||||
void initialize(MainWindow* mainWindow,VersionContainer *versionContainer);
|
void initialize(VersionContainer *versionContainer);
|
||||||
void CompareDeltas();
|
void CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash);
|
||||||
~HashComparer();
|
~HashComparer();
|
||||||
|
|
||||||
void showDeltas();
|
void showDeltas();
|
||||||
@@ -31,7 +30,6 @@ signals:
|
|||||||
private:
|
private:
|
||||||
UpdateNotifyWidget* updateWidget;
|
UpdateNotifyWidget* updateWidget;
|
||||||
QList<FileData> *filesForUpdate;
|
QList<FileData> *filesForUpdate;
|
||||||
DataParser *dataParser;
|
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
89
Core/postprocessorsystem.cpp
Normal file
89
Core/postprocessorsystem.cpp
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#include "postprocessorsystem.h"
|
||||||
|
|
||||||
|
PostProcessorSystem::PostProcessorSystem() {}
|
||||||
|
|
||||||
|
void PostProcessorSystem::initialize(DataParserOutput *dataParserOutput,
|
||||||
|
HashComparer *hashComparer,
|
||||||
|
VersionContainer* versionContainer,
|
||||||
|
UpdateController* updateController)
|
||||||
|
{
|
||||||
|
this->hashComparer = hashComparer;
|
||||||
|
this->versionContainer = versionContainer;
|
||||||
|
this->updateController = updateController;
|
||||||
|
this->dataParserOutput = dataParserOutput;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::socketDisable()
|
||||||
|
{
|
||||||
|
emit sigSocketDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::serverBlocked()
|
||||||
|
{
|
||||||
|
emit sigServerBlocked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::startCompare()
|
||||||
|
{
|
||||||
|
QList<FileData> *serverStreamingHash = new QList<FileData>;
|
||||||
|
QList<FileData> *localStreamingHash = new QList<FileData>;
|
||||||
|
|
||||||
|
QFile file(serverHash);
|
||||||
|
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
|
|
||||||
|
serverStreamingHash = dataParserOutput->xmlFileDataParse(file.readAll(),"StreamingAssets");
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QFile file2(streamingHashFilename);
|
||||||
|
file2.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
|
|
||||||
|
localStreamingHash = dataParserOutput->xmlFileDataParse(file2.readAll(),"StreamingAssets");
|
||||||
|
file2.close();
|
||||||
|
|
||||||
|
emit sigStartCompare(serverStreamingHash,*localStreamingHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::showUpdateList()
|
||||||
|
{
|
||||||
|
emit sigShowUpdateList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::compareFiles()
|
||||||
|
{
|
||||||
|
//emit sigCompareFiles()
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::checkAccessType(QString type)
|
||||||
|
{
|
||||||
|
if(type == "instructor")
|
||||||
|
{
|
||||||
|
emit sigCallUpdateList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::saveLoginData(ServerAuthorization *auth)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::setServerVersion(StreamingVersionData *serverVersion)
|
||||||
|
{
|
||||||
|
versionContainer->setServerVersionData(serverVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::showServerDataList(QList<StreamingVersionData *> *versionList)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessorSystem::calculateCommonHash()
|
||||||
|
{
|
||||||
|
updateController->calculateCommonHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateController::checkCanUpdate()
|
||||||
|
{
|
||||||
|
QByteArray checkUpdate = dataParserOut->xmlAnswer_notify("CANCHANGE");
|
||||||
|
sendSystem->sendXMLAnswer(checkUpdate);
|
||||||
|
}
|
||||||
46
Core/postprocessorsystem.h
Normal file
46
Core/postprocessorsystem.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#ifndef POSTPROCESSORSYSTEM_H
|
||||||
|
#define POSTPROCESSORSYSTEM_H
|
||||||
|
|
||||||
|
#include "Core/hashcomparer.h"
|
||||||
|
#include "UpdateController.h"
|
||||||
|
#include <QObject>
|
||||||
|
#include <Data/Datas.h>
|
||||||
|
|
||||||
|
class PostProcessorSystem : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PostProcessorSystem();
|
||||||
|
void initialize(DataParserOutput *dataParserOutput,
|
||||||
|
HashComparer *hashComparer,
|
||||||
|
VersionContainer* versionContainer,
|
||||||
|
UpdateController* updateContorller);
|
||||||
|
void socketDisable();
|
||||||
|
void serverBlocked();
|
||||||
|
void startCompare();
|
||||||
|
void showUpdateList();
|
||||||
|
void compareFiles();
|
||||||
|
void checkAccessType(QString type);
|
||||||
|
void saveLoginData(ServerAuthorization *auth);
|
||||||
|
void setServerVersion(StreamingVersionData *serverVersion);
|
||||||
|
void showServerDataList(QList<StreamingVersionData*> *versionList);
|
||||||
|
|
||||||
|
void calculateCommonHash();
|
||||||
|
signals:
|
||||||
|
void sigSocketDisabled();
|
||||||
|
void sigServerBlocked();
|
||||||
|
void sigStartCompare(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash);
|
||||||
|
void sigShowUpdateList();
|
||||||
|
void sigCallUpdateList();
|
||||||
|
void sigShowServerList(QList<StreamingVersionData *> *serverData);
|
||||||
|
void sigSaveLoginData(ServerAuthorization *serverAuth);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
HashComparer *hashComparer;
|
||||||
|
VersionContainer *versionContainer;
|
||||||
|
UpdateController * updateController;
|
||||||
|
DataParserOutput *dataParserOutput;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // POSTPROCESSORSYSTEM_H
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "Core/recognizesystem.h"
|
#include "Core/recognizesystem.h"
|
||||||
|
|
||||||
|
|
||||||
RecognizeSystem::RecognizeSystem(QObject *parent):
|
RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
@@ -18,30 +19,10 @@ RecognizeSystem::~RecognizeSystem()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecognizeSystem::initialize(UpdateController *updateController,
|
void RecognizeSystem::initialize(VersionContainer *versionContainer,PostProcessorSystem *postProcessorSystem)
|
||||||
DataParser *dataParser,
|
|
||||||
MainWindow *mainWindow,
|
|
||||||
HashComparer *hashComparer,
|
|
||||||
TCPClient *client,
|
|
||||||
VersionContainer* versionContainer)
|
|
||||||
{
|
{
|
||||||
this->updateController = updateController;
|
|
||||||
this->dataParser = dataParser;
|
|
||||||
this->mainWindow = mainWindow;
|
|
||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
|
this->postProcessorSystem = postProcessorSystem;
|
||||||
connect(this,&RecognizeSystem::sigSaveLoginData,dataParser,&DataParser::createAuthData);
|
|
||||||
connect(this,&RecognizeSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas);
|
|
||||||
connect(this,&RecognizeSystem::sigUpdateBytesAvailable,mainWindow,&MainWindow::updateProgress,Qt::AutoConnection); //todo autoConnection?
|
|
||||||
connect(this,&RecognizeSystem::sigLoadComplete,mainWindow,&MainWindow::loadComplete);
|
|
||||||
connect(this,&RecognizeSystem::sigNeedUpdate,mainWindow,&MainWindow::setNeedUpdate);
|
|
||||||
connect(this,&RecognizeSystem::sigSocketDisabled,mainWindow,&MainWindow::lostConnection);
|
|
||||||
connect(this,&RecognizeSystem::sigSaveLoginData,mainWindow,&MainWindow::checkLoginResult); //TODO: прибратся! 2 бинда на 1 сигнал
|
|
||||||
connect(this,&RecognizeSystem::sigSocketWaitForReadyRead,client,&TCPClient::waitRead,Qt::DirectConnection);
|
|
||||||
connect(this,&RecognizeSystem::sigServerBlocked,mainWindow,&MainWindow::serverBlocked);
|
|
||||||
connect(this,&RecognizeSystem::sigShowServerList,mainWindow,&MainWindow::showServerListWidget);
|
|
||||||
connect(this,&RecognizeSystem::sigAnimationActivated,mainWindow,&MainWindow::activateLoadingAnimation,Qt::AutoConnection);
|
|
||||||
connect(this,&RecognizeSystem::sigShowUpdateList,mainWindow,&MainWindow::showUpdateInfo,Qt::AutoConnection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecognizeSystem::recognize(QTcpSocket *socket)
|
void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||||
@@ -153,7 +134,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction()){
|
||||||
|
|
||||||
if(socket->state() == QAbstractSocket::UnconnectedState){
|
if(socket->state() == QAbstractSocket::UnconnectedState){
|
||||||
emit sigSocketDisabled();
|
postProcessorSystem->socketDisable();
|
||||||
|
//emit sigSocketDisabled();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
||||||
@@ -229,7 +211,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
|
|
||||||
if (packetType ==PacketType::TYPE_FINISH) //для повторного создания хэша после загрузки
|
if (packetType ==PacketType::TYPE_FINISH) //для повторного создания хэша после загрузки
|
||||||
{
|
{
|
||||||
updateController->calculateCommonHash();
|
postProcessorSystem->calculateCommonHash();
|
||||||
|
|
||||||
emit sigLoadComplete();
|
emit sigLoadComplete();
|
||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
}
|
}
|
||||||
@@ -271,12 +254,14 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
|
|
||||||
if(packetType == PacketType::HASH_READY)
|
if(packetType == PacketType::HASH_READY)
|
||||||
{
|
{
|
||||||
mainWindow->checkUpdate();
|
emit sigCheckUpdate();
|
||||||
|
//mainWindow->checkUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packetType == PacketType::HASH_CALCULATE_START)
|
if(packetType == PacketType::HASH_CALCULATE_START)
|
||||||
{
|
{
|
||||||
mainWindow->setInlineDebug(tr("Пересчет хэша на сервере..."));
|
emit sigSetInineDebug(tr("Пересчет хэша на сервере..."));
|
||||||
|
//mainWindow->setInlineDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packetType == PacketType::BUSY)
|
if(packetType == PacketType::BUSY)
|
||||||
@@ -292,21 +277,3 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecognizeSystem::checkAccessType(QString type)
|
|
||||||
{
|
|
||||||
if(type == "instructor")
|
|
||||||
{
|
|
||||||
mainWindow->callUpdateList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RecognizeSystem::setServerVersion(StreamingVersionData *serverVersion)
|
|
||||||
{
|
|
||||||
versionContainer->setServerVersionData(serverVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RecognizeSystem::showServerDataList(QList<StreamingVersionData*> *showServerDataList)
|
|
||||||
{
|
|
||||||
//emit sigShowServerList(showServerDataList);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
#ifndef RECOGNIZESYSTEM_H
|
#ifndef RECOGNIZESYSTEM_H
|
||||||
#define RECOGNIZESYSTEM_H
|
#define RECOGNIZESYSTEM_H
|
||||||
|
|
||||||
|
#include "Core/dataparser.h"
|
||||||
|
#include "Core/postprocessorsystem.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <mainwindow.h>
|
|
||||||
#include <Core\tools.h>
|
|
||||||
#include <Core\UpdateController.h>
|
|
||||||
#include <Data\streamingversiondata.h>
|
|
||||||
#include <Widgets\updatenotifywidget.h>
|
|
||||||
|
|
||||||
class UpdateController;
|
#include <QThread>
|
||||||
class MainWindow;
|
#include <Core\tools.h>
|
||||||
class HashComparer;
|
#include <Core\versioncontainer.h>
|
||||||
class TCPClient;
|
#include <Data\streamingversiondata.h>
|
||||||
|
#include <Core\hashcomparer.h>
|
||||||
|
|
||||||
class ServerAuthorization;
|
class ServerAuthorization;
|
||||||
|
|
||||||
class RecognizeSystem : public QObject
|
class RecognizeSystem : public QObject
|
||||||
@@ -24,16 +23,9 @@ class RecognizeSystem : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit RecognizeSystem(QObject *parent = 0);
|
explicit RecognizeSystem(QObject *parent = 0);
|
||||||
~RecognizeSystem();
|
~RecognizeSystem();
|
||||||
void initialize(UpdateController* updateController,
|
void initialize(VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem);
|
||||||
DataParser *dataParser,
|
|
||||||
MainWindow *mainWindow,
|
|
||||||
HashComparer *hashComparer,
|
|
||||||
TCPClient *client,
|
|
||||||
VersionContainer* versionContainer);
|
|
||||||
|
|
||||||
void recognize(QTcpSocket *socket);
|
void recognize(QTcpSocket *socket);
|
||||||
void checkAccessType(QString type);
|
|
||||||
void setServerVersion(StreamingVersionData *serverVersion);
|
|
||||||
void showServerDataList(QList<StreamingVersionData*> *showServerDataList);
|
void showServerDataList(QList<StreamingVersionData*> *showServerDataList);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -41,21 +33,16 @@ signals:
|
|||||||
void sigLoadComplete();
|
void sigLoadComplete();
|
||||||
void sigNeedUpdate(bool flag,qint64 size,quint64 fileCount,quint64 fileDelete);
|
void sigNeedUpdate(bool flag,qint64 size,quint64 fileCount,quint64 fileDelete);
|
||||||
void sigSendDebugLog(QString message);
|
void sigSendDebugLog(QString message);
|
||||||
void sigSocketDisabled();
|
|
||||||
void sigServerBlocked();
|
|
||||||
void sigSaveLoginData(ServerAuthorization *serverAuth);
|
|
||||||
void sigSocketWaitForReadyRead(int waitTime);
|
void sigSocketWaitForReadyRead(int waitTime);
|
||||||
void sigStartCompare();
|
|
||||||
void sigShowServerList(QList<StreamingVersionData*> *serverDatas);
|
|
||||||
void sigAnimationActivated(bool flag);
|
void sigAnimationActivated(bool flag);
|
||||||
void sigShowUpdateList();
|
void sigCheckUpdate();
|
||||||
|
void sigSetInineDebug(QString message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QString> *folderList;
|
QList<QString> *folderList;
|
||||||
MainWindow *mainWindow;
|
|
||||||
UpdateController *updateController;
|
|
||||||
DataParser *dataParser;
|
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
|
DataParser *dataParser;
|
||||||
|
PostProcessorSystem *postProcessorSystem;
|
||||||
PacketType packetType;
|
PacketType packetType;
|
||||||
QString message;
|
QString message;
|
||||||
QString filePath;
|
QString filePath;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "screenchecker.h"
|
#include "screenchecker.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
ScreenChecker::ScreenChecker(QWidget *mainWidget,DataParser *dataParser, QHBoxLayout *layout, QObject *parent) :
|
ScreenChecker::ScreenChecker(QWidget *mainWidget,DataParserOutput *dataParserOut, QHBoxLayout *layout, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
screenCount = 0;
|
screenCount = 0;
|
||||||
this->mainWidget = mainWidget;
|
this->mainWidget = mainWidget;
|
||||||
this->layout = layout;
|
this->layout = layout;
|
||||||
this->dataParser = dataParser;
|
this->dataParserOutput = dataParserOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenChecker::check()
|
void ScreenChecker::check()
|
||||||
@@ -121,7 +121,7 @@ void ScreenChecker::updateDisplayData()
|
|||||||
if (displaysIndexList->at(0) != 0)
|
if (displaysIndexList->at(0) != 0)
|
||||||
displaysIndexList->replace(0,0);
|
displaysIndexList->replace(0,0);
|
||||||
|
|
||||||
dataParser->addRunData(*displaysIndexList);
|
dataParserOutput->addRunData(*displaysIndexList);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ScreenChecker::getScreenCount() const
|
QString ScreenChecker::getScreenCount() const
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#ifndef SCREENCHECKER_H
|
#ifndef SCREENCHECKER_H
|
||||||
#define SCREENCHECKER_H
|
#define SCREENCHECKER_H
|
||||||
|
|
||||||
#include "dataparser.h"
|
#include "Core/dataparseroutput.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
@@ -23,7 +22,7 @@ class ScreenChecker : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ScreenChecker(QWidget *widget,DataParser *dataParser, QHBoxLayout *layout,QObject *parent = nullptr);
|
explicit ScreenChecker(QWidget *widget,DataParserOutput *dataParserOutput, QHBoxLayout *layout,QObject *parent = nullptr);
|
||||||
~ScreenChecker();
|
~ScreenChecker();
|
||||||
void check();
|
void check();
|
||||||
QString getScreenCount() const;
|
QString getScreenCount() const;
|
||||||
@@ -31,8 +30,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *mainWidget;
|
QWidget *mainWidget;
|
||||||
DataParser *dataParser;
|
|
||||||
QWidget *widget;
|
QWidget *widget;
|
||||||
|
DataParserOutput *dataParserOutput;
|
||||||
QHBoxLayout *layout;
|
QHBoxLayout *layout;
|
||||||
qint64 screenCount;
|
qint64 screenCount;
|
||||||
QList<QScreen *> screens;
|
QList<QScreen *> screens;
|
||||||
|
|||||||
@@ -2,13 +2,6 @@
|
|||||||
|
|
||||||
SendSystem::SendSystem(QObject *) {}
|
SendSystem::SendSystem(QObject *) {}
|
||||||
|
|
||||||
void SendSystem::initialize(MainWindow *mainWindow,DataParser *dataParser)
|
|
||||||
{
|
|
||||||
this->mainWindow = mainWindow;
|
|
||||||
connect(this,&SendSystem::sigSend,mainWindow,&MainWindow::updateProgress);
|
|
||||||
connect(this,&SendSystem::sigGetXmlAnswer,dataParser,&DataParser::xmlAnswer_notify,Qt::DirectConnection); //МОЖЕТ ДАТУ ПАРСЕР В ВТОРОСТЕПЕННЫЙ ПОТОК?
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendSystem::setSocket(QTcpSocket *socket)
|
void SendSystem::setSocket(QTcpSocket *socket)
|
||||||
{
|
{
|
||||||
this->socket = socket;
|
this->socket = socket;
|
||||||
|
|||||||
@@ -7,19 +7,13 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <mainwindow.h>
|
|
||||||
#include <Core/tools.h>
|
#include <Core/tools.h>
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
class DataParser;
|
|
||||||
class Tools;
|
|
||||||
|
|
||||||
class SendSystem :public QObject
|
class SendSystem :public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SendSystem(QObject* parent = nullptr);
|
explicit SendSystem(QObject* parent = nullptr);
|
||||||
void initialize(MainWindow *mainWindow,DataParser *dataParser);
|
|
||||||
void setSocket(QTcpSocket *socket);
|
void setSocket(QTcpSocket *socket);
|
||||||
void sendClientAutorization();
|
void sendClientAutorization();
|
||||||
void sendDisable();
|
void sendDisable();
|
||||||
@@ -44,7 +38,6 @@ public slots:
|
|||||||
void xmlAnswer(QString message);
|
void xmlAnswer(QString message);
|
||||||
private:
|
private:
|
||||||
QTcpSocket *socket;
|
QTcpSocket *socket;
|
||||||
MainWindow *mainWindow;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,14 @@ TCPClient::TCPClient(QObject *parent) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCPClient::initialize(MainWindow *mainWindow,RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem)
|
void TCPClient::initialize(RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem)
|
||||||
{
|
{
|
||||||
this->recognizeSystem = recognize;
|
this->recognizeSystem = recognize;
|
||||||
this->externalExecuter = externalExecuter;
|
this->externalExecuter = externalExecuter;
|
||||||
this->sendSystem = sendSystem;
|
this->sendSystem = sendSystem;
|
||||||
isConnected = false;
|
isConnected = false;
|
||||||
|
|
||||||
connect(this,&TCPClient::sigConnectionState,mainWindow,&MainWindow::slotConnectionState,Qt::AutoConnection);
|
connect(recognize,&RecognizeSystem::sigSocketWaitForReadyRead,this,&TCPClient::waitRead,Qt::DirectConnection);
|
||||||
connect(this,&TCPClient::sigServerDisconnect,mainWindow,&MainWindow::slotServerDisconnect);
|
|
||||||
|
|
||||||
emit sigSendDebugLog(Tools::getTime() + " Client started");
|
emit sigSendDebugLog(Tools::getTime() + " Client started");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef TCPCLIENT_H
|
#ifndef TCPCLIENT_H
|
||||||
#define TCPCLIENT_H
|
#define TCPCLIENT_H
|
||||||
|
|
||||||
|
#include "Core/sendsystem.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
@@ -11,14 +12,11 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <Core\recognizesystem.h>
|
#include <Core\recognizesystem.h>
|
||||||
#include <Core\tools.h>
|
#include <Core\tools.h>
|
||||||
#include <Core\UpdateController.h>
|
|
||||||
#include <Core\externalexecuter.h>
|
#include <Core\externalexecuter.h>
|
||||||
|
|
||||||
|
|
||||||
class UpdateController;
|
class UpdateController;
|
||||||
class RecognizeSystem;
|
class RecognizeSystem;
|
||||||
class SendSystem;
|
|
||||||
class MainWindow;
|
|
||||||
class ServerSettings;
|
class ServerSettings;
|
||||||
|
|
||||||
class TCPClient : public QObject
|
class TCPClient : public QObject
|
||||||
@@ -28,7 +26,7 @@ class TCPClient : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TCPClient(QObject *parent = 0);
|
explicit TCPClient(QObject *parent = 0);
|
||||||
void initialize(MainWindow *mainWindow,RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem);
|
void initialize(RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem);
|
||||||
void setConnect(ServerSettings *serverSettings);
|
void setConnect(ServerSettings *serverSettings);
|
||||||
|
|
||||||
void waitRead(int time);
|
void waitRead(int time);
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public:
|
|||||||
QString getServerVersion() const;
|
QString getServerVersion() const;
|
||||||
QString getLocalVersion() const;
|
QString getLocalVersion() const;
|
||||||
|
|
||||||
|
|
||||||
StreamingVersionData *getLocalVersionData() const;
|
StreamingVersionData *getLocalVersionData() const;
|
||||||
void setLocalVersionData(StreamingVersionData *value);
|
void setLocalVersionData(StreamingVersionData *value);
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
Core/dataparseroutput.cpp \
|
||||||
Core/notifycontroller.cpp \
|
Core/notifycontroller.cpp \
|
||||||
|
Core/postprocessorsystem.cpp \
|
||||||
Core/sendsystem.cpp \
|
Core/sendsystem.cpp \
|
||||||
Core/versioncontainer.cpp \
|
Core/versioncontainer.cpp \
|
||||||
Core\updatecontroller.cpp \
|
Core\updatecontroller.cpp \
|
||||||
@@ -42,7 +44,9 @@ SOURCES += \
|
|||||||
Widgets\versionselectwidget.cpp \
|
Widgets\versionselectwidget.cpp \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
Core/dataparseroutput.h \
|
||||||
Core/notifycontroller.h \
|
Core/notifycontroller.h \
|
||||||
|
Core/postprocessorsystem.h \
|
||||||
Core/versioncontainer.h \
|
Core/versioncontainer.h \
|
||||||
Core\sendsystem.h \
|
Core\sendsystem.h \
|
||||||
Core\updatecontroller.h \
|
Core\updatecontroller.h \
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ CommonButtonGroupWidget::CommonButtonGroupWidget(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonButtonGroupWidget::initialize(MainWindow *mainWindow,ExternalExecuter *extExec,SendSystem *sendSystem,TCPClient *client)
|
void CommonButtonGroupWidget::initialize(ExternalExecuter *extExec,SendSystem *sendSystem,TCPClient *client)
|
||||||
{
|
{
|
||||||
externalExecuter = extExec;
|
externalExecuter = extExec;
|
||||||
this->sendSystem = sendSystem;
|
this->sendSystem = sendSystem;
|
||||||
this->mainWindow = mainWindow;
|
|
||||||
ui->loadingProgressBar->setValue(0);
|
ui->loadingProgressBar->setValue(0);
|
||||||
ui->loadingProgressBar->hide();
|
ui->loadingProgressBar->hide();
|
||||||
ui->updateButton->hide();
|
ui->updateButton->hide();
|
||||||
@@ -84,8 +83,8 @@ void CommonButtonGroupWidget::on_updateButton_clicked()
|
|||||||
{
|
{
|
||||||
emit sigSendPacket(PacketType::TYPE_UPDATE);
|
emit sigSendPacket(PacketType::TYPE_UPDATE);
|
||||||
startUpdateState();
|
startUpdateState();
|
||||||
mainWindow->disableUnsaveButton(true);
|
emit sigUpdateCommonWidget();
|
||||||
mainWindow->setInlineDebug(tr("Загрузка..."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonButtonGroupWidget::on_startButton_clicked()
|
void CommonButtonGroupWidget::on_startButton_clicked()
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class CommonButtonGroupWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CommonButtonGroupWidget(QWidget *parent = nullptr);
|
explicit CommonButtonGroupWidget(QWidget *parent = nullptr);
|
||||||
void initialize(MainWindow *mainWindow,ExternalExecuter *extExec,SendSystem *sendSystem,TCPClient *client);
|
void initialize(ExternalExecuter *extExec,SendSystem *sendSystem,TCPClient *client);
|
||||||
void loadCompleteState();
|
void loadCompleteState();
|
||||||
void lastVerInstalledState();
|
void lastVerInstalledState();
|
||||||
void disconnectState();
|
void disconnectState();
|
||||||
@@ -31,6 +31,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void sigSendPacket(PacketType packet);
|
void sigSendPacket(PacketType packet);
|
||||||
void sigSendXMLAnswer(QString answer);
|
void sigSendXMLAnswer(QString answer);
|
||||||
|
void sigUpdateCommonWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_updateButton_clicked();
|
void on_updateButton_clicked();
|
||||||
@@ -41,7 +42,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CommonButtonGroupWidget *ui;
|
Ui::CommonButtonGroupWidget *ui;
|
||||||
MainWindow *mainWindow;
|
|
||||||
ExternalExecuter *externalExecuter;
|
ExternalExecuter *externalExecuter;
|
||||||
SendSystem *sendSystem;
|
SendSystem *sendSystem;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,13 +8,11 @@ EntryWidget::EntryWidget(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntryWidget::initialize(MainWindow *mainWindow)
|
void EntryWidget::initialize()
|
||||||
{
|
{
|
||||||
ui->offlineWidget->hide();
|
ui->offlineWidget->hide();
|
||||||
ui->loginWidget->hide();
|
ui->loginWidget->hide();
|
||||||
ui->settingsWidget->hide();
|
ui->settingsWidget->hide();
|
||||||
this->mainWindow = mainWindow;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntryWidget::connectionEmptyState()
|
void EntryWidget::connectionEmptyState()
|
||||||
@@ -58,12 +56,12 @@ void EntryWidget::loginIsActive(bool flag)
|
|||||||
|
|
||||||
void EntryWidget::on_loginButton_clicked()
|
void EntryWidget::on_loginButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->login();
|
emit sigTryLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntryWidget::on_saveServerButton_clicked()
|
void EntryWidget::on_saveServerButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->saveServerSettingsWithConnect();
|
emit sigSaveServerSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSettings *EntryWidget::getServerSettings()
|
ServerSettings *EntryWidget::getServerSettings()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef ENTRYWIDGET_H
|
#ifndef ENTRYWIDGET_H
|
||||||
#define ENTRYWIDGET_H
|
#define ENTRYWIDGET_H
|
||||||
|
|
||||||
#include "mainwindow.h"
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <Data/Datas.h>
|
#include <Data/Datas.h>
|
||||||
|
|
||||||
@@ -15,7 +14,7 @@ class EntryWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryWidget(QWidget *parent = nullptr);
|
explicit EntryWidget(QWidget *parent = nullptr);
|
||||||
void initialize(MainWindow *mainWindow);
|
void initialize();
|
||||||
void AconnectionEmptyState();
|
void AconnectionEmptyState();
|
||||||
void settingsState();
|
void settingsState();
|
||||||
bool isLoginFieldsFill();
|
bool isLoginFieldsFill();
|
||||||
@@ -27,14 +26,17 @@ public:
|
|||||||
void fillSettings(ServerSettings *settings);
|
void fillSettings(ServerSettings *settings);
|
||||||
ServerSettings *getServerSettings();
|
ServerSettings *getServerSettings();
|
||||||
void isActive(bool flag);
|
void isActive(bool flag);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigTryLogin();
|
||||||
|
void sigSaveServerSettings();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_loginButton_clicked();
|
void on_loginButton_clicked();
|
||||||
|
|
||||||
void on_saveServerButton_clicked();
|
void on_saveServerButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::EntryWidget *ui;
|
Ui::EntryWidget *ui;
|
||||||
MainWindow *mainWindow;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENTRYWIDGET_H
|
#endif // ENTRYWIDGET_H
|
||||||
|
|||||||
@@ -10,29 +10,26 @@ InstructorButtonGroupWidget::InstructorButtonGroupWidget(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstructorButtonGroupWidget::initialize(MainWindow *mainWindow)
|
void InstructorButtonGroupWidget::initialize()
|
||||||
{
|
{
|
||||||
this->mainWindow = mainWindow;
|
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstructorButtonGroupWidget::on_loadToServerButton_clicked()
|
void InstructorButtonGroupWidget::on_loadToServerButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->loadToServer();
|
emit sigLoadToServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstructorButtonGroupWidget::on_undoChangesButton_clicked()
|
void InstructorButtonGroupWidget::on_undoChangesButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->undoCurrentChanges();
|
emit sigUndoCurrentChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstructorButtonGroupWidget::on_startWithCurrentChangesButton_clicked()
|
void InstructorButtonGroupWidget::on_startWithCurrentChangesButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->startUnityClient();
|
emit sigStartUnityClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
InstructorButtonGroupWidget::~InstructorButtonGroupWidget()
|
InstructorButtonGroupWidget::~InstructorButtonGroupWidget()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|||||||
@@ -2,33 +2,31 @@
|
|||||||
#define INSTRUCTORBUTTONGROUPWIDGET_H
|
#define INSTRUCTORBUTTONGROUPWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class InstructorButtonGroupWidget;
|
class InstructorButtonGroupWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
class InstructorButtonGroupWidget : public QWidget
|
class InstructorButtonGroupWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit InstructorButtonGroupWidget(QWidget *parent = nullptr);
|
explicit InstructorButtonGroupWidget(QWidget *parent = nullptr);
|
||||||
void initialize(MainWindow *mainWindow);
|
void initialize();
|
||||||
|
|
||||||
~InstructorButtonGroupWidget();
|
~InstructorButtonGroupWidget();
|
||||||
|
signals:
|
||||||
|
void sigLoadToServer();
|
||||||
|
void sigUndoCurrentChanges();
|
||||||
|
void sigStartUnityClient();
|
||||||
private slots:
|
private slots:
|
||||||
void on_loadToServerButton_clicked();
|
void on_loadToServerButton_clicked();
|
||||||
|
|
||||||
void on_undoChangesButton_clicked();
|
void on_undoChangesButton_clicked();
|
||||||
|
|
||||||
void on_startWithCurrentChangesButton_clicked();
|
void on_startWithCurrentChangesButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::InstructorButtonGroupWidget *ui;
|
Ui::InstructorButtonGroupWidget *ui;
|
||||||
MainWindow *mainWindow;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INSTRUCTORBUTTONGROUPWIDGET_H
|
#endif // INSTRUCTORBUTTONGROUPWIDGET_H
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ NewVersionWidget::NewVersionWidget(QWidget *parent) :
|
|||||||
setAttribute(Qt::WA_ShowModal,true);
|
setAttribute(Qt::WA_ShowModal,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewVersionWidget::initialize(VersionSelectWidget *versionSelectWidget, QString prevName)
|
void NewVersionWidget::initialize(QString prevName)
|
||||||
{
|
{
|
||||||
this->versionSelectWidget = versionSelectWidget;
|
|
||||||
ui->prevVerValue->setText(prevName);
|
ui->prevVerValue->setText(prevName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@ void NewVersionWidget::on_createButton_clicked()
|
|||||||
{
|
{
|
||||||
if(ui->lineEdit->text() != "")
|
if(ui->lineEdit->text() != "")
|
||||||
{
|
{
|
||||||
versionSelectWidget->sendCopyEmit(ui->lineEdit->text());
|
emit sigSendCopy(ui->lineEdit->text());
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
#ifndef NEWVERSIONWIDGET_H
|
#ifndef NEWVERSIONWIDGET_H
|
||||||
#define NEWVERSIONWIDGET_H
|
#define NEWVERSIONWIDGET_H
|
||||||
|
|
||||||
#include <Widgets/versionselectwidget.h>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class NewVersionWidget;
|
class NewVersionWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VersionSelectWidget;
|
|
||||||
class NewVersionWidget : public QWidget
|
class NewVersionWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NewVersionWidget(QWidget *parent = nullptr);
|
explicit NewVersionWidget(QWidget *parent = nullptr);
|
||||||
void initialize(VersionSelectWidget *versionSelectWidget,QString prevName);
|
void initialize(QString prevName);
|
||||||
~NewVersionWidget();
|
~NewVersionWidget();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigSendCopy(QString copyName);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_createButton_clicked();
|
void on_createButton_clicked();
|
||||||
|
|
||||||
@@ -25,7 +26,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::NewVersionWidget *ui;
|
Ui::NewVersionWidget *ui;
|
||||||
VersionSelectWidget *versionSelectWidget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NEWVERSIONWIDGET_H
|
#endif // NEWVERSIONWIDGET_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "updatenotifywidget.h"
|
#include "updatenotifywidget.h"
|
||||||
#include "ui_updatenotifywidget.h"
|
#include "ui_updatenotifywidget.h"
|
||||||
#include "mainwindow.h"
|
#include "Core/tools.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
@@ -12,14 +12,13 @@ UpdateNotifyWidget::UpdateNotifyWidget(QWidget *) :
|
|||||||
// setAttribute(Qt::WA_ShowModal,true);
|
// setAttribute(Qt::WA_ShowModal,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::initialize(MainWindow *mainWindow,VersionContainer *verContainer)
|
void UpdateNotifyWidget::initialize(VersionContainer *verContainer,QPoint startPos)
|
||||||
{
|
{
|
||||||
this->mainWindow = mainWindow;
|
|
||||||
this->versionContainer = verContainer;
|
this->versionContainer = verContainer;
|
||||||
currentLoadingCount = 0;
|
currentLoadingCount = 0;
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
auto pos = mainWindow->pos();
|
QPoint pos = startPos;
|
||||||
pos.setY(pos.y() + 40);
|
pos.setY(pos.y() + 40);
|
||||||
move(pos);
|
move(pos);
|
||||||
}
|
}
|
||||||
@@ -101,17 +100,17 @@ QLabel* UpdateNotifyWidget::createLabel(QString text)
|
|||||||
}
|
}
|
||||||
void UpdateNotifyWidget::on_loadToServerButton_clicked()
|
void UpdateNotifyWidget::on_loadToServerButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->loadToServer();
|
emit sigLoadToServerBehaviour();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::on_undoChangesButton_clicked()
|
void UpdateNotifyWidget::on_undoChangesButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->undoCurrentChanges();
|
emit sigUndoCurrentChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::on_startWithCurrentChangesButton_clicked()
|
void UpdateNotifyWidget::on_startWithCurrentChangesButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->startUnityClient();
|
emit sigStartUnityClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::setUpdateState()
|
void UpdateNotifyWidget::setUpdateState()
|
||||||
@@ -136,11 +135,6 @@ UpdateNotifyWidget::~UpdateNotifyWidget()
|
|||||||
|
|
||||||
void UpdateNotifyWidget::on_closeButton_clicked()
|
void UpdateNotifyWidget::on_closeButton_clicked()
|
||||||
{
|
{
|
||||||
mainWindow->showMainFrame(true);
|
emit sigShowMainFrame(true);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::on_updateActionListLabel_linkActivated(const QString &link)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
#ifndef UPDATENOTIFYWIDGET_H
|
#ifndef UPDATENOTIFYWIDGET_H
|
||||||
#define UPDATENOTIFYWIDGET_H
|
#define UPDATENOTIFYWIDGET_H
|
||||||
|
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
#include <Data/FileData.h>
|
#include <Data/FileData.h>
|
||||||
|
#include <Core/versioncontainer.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class UpdateNotifyWidget;
|
class UpdateNotifyWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
class UpdateController;
|
|
||||||
class InstructorButtonGroupWidget;
|
class InstructorButtonGroupWidget;
|
||||||
class VersionContainer;
|
|
||||||
|
|
||||||
class UpdateNotifyWidget : public QWidget
|
class UpdateNotifyWidget : public QWidget
|
||||||
{
|
{
|
||||||
@@ -24,7 +19,7 @@ class UpdateNotifyWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit UpdateNotifyWidget(QWidget *parent = nullptr);
|
explicit UpdateNotifyWidget(QWidget *parent = nullptr);
|
||||||
void initialize(MainWindow *mainWindow,VersionContainer *versionContainer);
|
void initialize(VersionContainer *versionContainer,QPoint startPos);
|
||||||
void addToList(FileData fileData);
|
void addToList(FileData fileData);
|
||||||
void showWithFill();
|
void showWithFill();
|
||||||
|
|
||||||
@@ -32,17 +27,20 @@ public:
|
|||||||
|
|
||||||
void showTryChangeBase();
|
void showTryChangeBase();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigLoadToServerBehaviour();
|
||||||
|
void sigUndoCurrentChanges();
|
||||||
|
void sigStartUnityClient();
|
||||||
|
void sigShowMainFrame(bool flag);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_closeButton_clicked();
|
void on_closeButton_clicked();
|
||||||
void on_loadToServerButton_clicked();
|
void on_loadToServerButton_clicked();
|
||||||
void on_undoChangesButton_clicked();
|
void on_undoChangesButton_clicked();
|
||||||
void on_startWithCurrentChangesButton_clicked();
|
void on_startWithCurrentChangesButton_clicked();
|
||||||
|
|
||||||
void on_updateActionListLabel_linkActivated(const QString &link);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::UpdateNotifyWidget *ui;
|
Ui::UpdateNotifyWidget *ui;
|
||||||
MainWindow *mainWindow;
|
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
int currentLoadingCount;
|
int currentLoadingCount;
|
||||||
QLabel* createLabel(QString text);
|
QLabel* createLabel(QString text);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "versionselectwidget.h"
|
#include "versionselectwidget.h"
|
||||||
#include "ui_versionselectwidget.h"
|
#include "ui_versionselectwidget.h"
|
||||||
#include "ui_versionselectwidget.h"
|
#include "Widgets/newversionwidget.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
@@ -49,12 +49,13 @@ void VersionSelectWidget::on_verListView_itemDoubleClicked(QListWidgetItem *item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void VersionSelectWidget::on_createDuplicateButton_clicked()
|
void VersionSelectWidget::on_createDuplicateButton_clicked()
|
||||||
{
|
{
|
||||||
NewVersionWidget *newVersionWidget = new NewVersionWidget;
|
NewVersionWidget *newVersionWidget = new NewVersionWidget;
|
||||||
newVersionWidget->initialize(this,selectedVersion->getViewName());
|
newVersionWidget->initialize(selectedVersion->getViewName());
|
||||||
newVersionWidget->show();
|
newVersionWidget->show();
|
||||||
|
|
||||||
|
connect(newVersionWidget,&NewVersionWidget::sigSendCopy,this,&VersionSelectWidget::sendCopyEmit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VersionSelectWidget::sendCopyEmit(QString newName)
|
void VersionSelectWidget::sendCopyEmit(QString newName)
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <Core/notifycontroller.h>
|
||||||
#include <Core/sendsystem.h>
|
#include <Core/sendsystem.h>
|
||||||
|
#include <Core/versioncontainer.h>
|
||||||
#include <Data/streamingversiondata.h>
|
#include <Data/streamingversiondata.h>
|
||||||
#include <Widgets/newversionwidget.h>
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class VersionSelectWidget;
|
class VersionSelectWidget;
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,6 @@ public:
|
|||||||
|
|
||||||
void initialize(SendSystem *sendSystem,VersionContainer *versionContainer,NotifyController *notifyController);
|
void initialize(SendSystem *sendSystem,VersionContainer *versionContainer,NotifyController *notifyController);
|
||||||
void fillView(QList<StreamingVersionData*> *serverData);
|
void fillView(QList<StreamingVersionData*> *serverData);
|
||||||
void sendCopyEmit(QString newName);
|
|
||||||
|
|
||||||
~VersionSelectWidget();
|
~VersionSelectWidget();
|
||||||
private slots:
|
private slots:
|
||||||
@@ -29,6 +28,7 @@ private slots:
|
|||||||
void on_createDuplicateButton_clicked();
|
void on_createDuplicateButton_clicked();
|
||||||
void on_DeleteVersionButton_clicked();
|
void on_DeleteVersionButton_clicked();
|
||||||
void on_switchServerVersionButton_clicked();
|
void on_switchServerVersionButton_clicked();
|
||||||
|
void sendCopyEmit(QString newName);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigSendDeleteVersion(StreamingVersionData *streaming);
|
void sigSendDeleteVersion(StreamingVersionData *streaming);
|
||||||
|
|||||||
@@ -51,16 +51,22 @@ void MainWindow::createObjects()
|
|||||||
dataParser = new DataParser;
|
dataParser = new DataParser;
|
||||||
dataParser->moveToThread(workerThread);
|
dataParser->moveToThread(workerThread);
|
||||||
|
|
||||||
|
dataParserOutput = new DataParserOutput;
|
||||||
|
dataParser->moveToThread(workerThread);
|
||||||
|
|
||||||
sendSystem = new SendSystem;
|
sendSystem = new SendSystem;
|
||||||
sendSystem->moveToThread(workerThread);
|
sendSystem->moveToThread(workerThread);
|
||||||
|
|
||||||
updateController = new UpdateController(dataParser,sendSystem);
|
updateController = new UpdateController(dataParserOutput,sendSystem);
|
||||||
updateController->moveToThread(workerThread);
|
updateController->moveToThread(workerThread);
|
||||||
|
|
||||||
recognizeSystem = new RecognizeSystem;
|
recognizeSystem = new RecognizeSystem;
|
||||||
recognizeSystem->moveToThread(workerThread);
|
recognizeSystem->moveToThread(workerThread);
|
||||||
|
|
||||||
screenChecker = new ScreenChecker(this,dataParser,ui->displayLayout);
|
postProcessorSystem = new PostProcessorSystem;
|
||||||
|
postProcessorSystem->moveToThread(workerThread);
|
||||||
|
|
||||||
|
screenChecker = new ScreenChecker(this,dataParserOutput,ui->displayLayout);
|
||||||
externalExecuter = new ExternalExecuter;
|
externalExecuter = new ExternalExecuter;
|
||||||
|
|
||||||
hashComparer = new HashComparer(dataParser);
|
hashComparer = new HashComparer(dataParser);
|
||||||
@@ -73,8 +79,6 @@ void MainWindow::createObjects()
|
|||||||
workerThread->setPriority(QThread::HighestPriority);
|
workerThread->setPriority(QThread::HighestPriority);
|
||||||
|
|
||||||
timer = new QTimer;
|
timer = new QTimer;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::paintEvent(QPaintEvent* event) {
|
void MainWindow::paintEvent(QPaintEvent* event) {
|
||||||
@@ -99,16 +103,15 @@ void MainWindow::initialize()
|
|||||||
loadStaticData();
|
loadStaticData();
|
||||||
bindConnection();
|
bindConnection();
|
||||||
|
|
||||||
updateWidget->initialize(this,versionContainer);
|
updateWidget->initialize(versionContainer,pos());
|
||||||
entryWidget->initialize(this);
|
entryWidget->initialize();
|
||||||
versionSelectWidget->initialize(sendSystem,versionContainer,notifyController);
|
versionSelectWidget->initialize(sendSystem,versionContainer,notifyController);
|
||||||
hashComparer->initialize(this,versionContainer);
|
hashComparer->initialize(versionContainer);
|
||||||
updateController->initialize(this,versionContainer);
|
updateController->initialize(versionContainer);
|
||||||
sendSystem->initialize(this,dataParser);
|
dataParser->initialize();
|
||||||
dataParser->initialize(recognizeSystem,notifyController,updateController,hashComparer);
|
recognizeSystem->initialize(versionContainer,postProcessorSystem);
|
||||||
recognizeSystem->initialize(updateController,dataParser,this,hashComparer,client,versionContainer);
|
|
||||||
resourceManager->painting();
|
resourceManager->painting();
|
||||||
commonButtonGroupWidget->initialize(this,externalExecuter,sendSystem,client);
|
commonButtonGroupWidget->initialize(externalExecuter,sendSystem,client);
|
||||||
commonButtonGroupWidget->show();
|
commonButtonGroupWidget->show();
|
||||||
ui->LanguageWidget->hide();
|
ui->LanguageWidget->hide();
|
||||||
|
|
||||||
@@ -116,7 +119,7 @@ void MainWindow::initialize()
|
|||||||
|
|
||||||
setInlineDebug(tr("Инициализация..."));
|
setInlineDebug(tr("Инициализация..."));
|
||||||
emit sigCalculateHash();
|
emit sigCalculateHash();
|
||||||
emit sigInitializeClient(this,recognizeSystem,externalExecuter,sendSystem,workerThread);
|
emit sigInitializeClient(recognizeSystem,externalExecuter,sendSystem);
|
||||||
|
|
||||||
screenChecker->check();
|
screenChecker->check();
|
||||||
|
|
||||||
@@ -144,7 +147,53 @@ void MainWindow::bindConnection()
|
|||||||
connect(this,&MainWindow::sigSendCheckUpdate,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
|
connect(this,&MainWindow::sigSendCheckUpdate,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
|
||||||
connect(this,&MainWindow::sigGetConnected,client,&TCPClient::getIsConnected);
|
connect(this,&MainWindow::sigGetConnected,client,&TCPClient::getIsConnected);
|
||||||
connect(this,&MainWindow::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
|
connect(this,&MainWindow::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
|
||||||
|
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&MainWindow::callUpdateList,Qt::AutoConnection);
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigSocketDisabled,this,&MainWindow::lostConnection,Qt::AutoConnection);
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigServerBlocked,this,&MainWindow::serverBlocked,Qt::AutoConnection);
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection); // ОПАСНОСТЬ
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&MainWindow::checkLoginResult,Qt::AutoConnection);
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,dataParserOutput,&DataParserOutput::createAuthData,Qt::AutoConnection);
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigShowServerList,this,&MainWindow::showServerListWidget);
|
||||||
|
connect(postProcessorSystem,&PostProcessorSystem::sigShowUpdateList,this,&MainWindow::showUpdateInfo,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&MainWindow::setServerVersion);
|
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&MainWindow::setServerVersion);
|
||||||
|
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigUpdateBytesAvailable,this,&MainWindow::updateProgress,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigLoadComplete,this,&MainWindow::loadComplete);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigNeedUpdate,this,&MainWindow::setNeedUpdate);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigCheckUpdate,this,&MainWindow::checkUpdate,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigSetInineDebug,this,&MainWindow::setInlineDebug,Qt::AutoConnection);
|
||||||
|
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,this,&MainWindow::activateLoadingAnimation,Qt::AutoConnection);
|
||||||
|
|
||||||
|
connect(updateWidget,&UpdateNotifyWidget::sigLoadToServerBehaviour,this,&MainWindow::loadToServer,Qt::AutoConnection);
|
||||||
|
connect(updateWidget,&UpdateNotifyWidget::sigUndoCurrentChanges,this,&MainWindow::undoCurrentChanges,Qt::AutoConnection);
|
||||||
|
connect(updateWidget,&UpdateNotifyWidget::sigStartUnityClient,this,&MainWindow::startUnityClient,Qt::AutoConnection);
|
||||||
|
connect(updateWidget,&UpdateNotifyWidget::sigShowMainFrame,this,&MainWindow::showMainFrame,Qt::AutoConnection);
|
||||||
|
|
||||||
|
connect(hashComparer,&HashComparer::sigCallCheck,this,&MainWindow::checkUpdate);
|
||||||
|
connect(hashComparer,&HashComparer::sigHaveDelta,this,&MainWindow::showUpdateInfo);
|
||||||
|
|
||||||
|
connect(updateController,&UpdateController::sigUpdateComplete,this,&MainWindow::showCompleteDialogBox);
|
||||||
|
|
||||||
|
connect(client,&TCPClient::sigConnectionState,this,&MainWindow::slotConnectionState,Qt::AutoConnection);
|
||||||
|
connect(client,&TCPClient::sigServerDisconnect,this,&MainWindow::slotServerDisconnect);
|
||||||
|
|
||||||
|
connect(sendSystem,&SendSystem::sigSend,this,&MainWindow::updateProgress);
|
||||||
|
|
||||||
|
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);//ОПАСНОСТЬ
|
||||||
|
|
||||||
|
connect(commonButtonGroupWidget,&CommonButtonGroupWidget::sigUpdateCommonWidget,this,&MainWindow::commonWidgetState);
|
||||||
|
connect(entryWidget,&EntryWidget::sigTryLogin,this,&MainWindow::login,Qt::AutoConnection);
|
||||||
|
connect(entryWidget,&EntryWidget::sigSaveServerSettings,this,&MainWindow::saveServerSettingsWithConnect,Qt::AutoConnection);
|
||||||
|
|
||||||
|
connect(instructorButtonGroup,&InstructorButtonGroupWidget::sigLoadToServer,this,&MainWindow::loadToServer, Qt::AutoConnection);
|
||||||
|
connect(instructorButtonGroup,&InstructorButtonGroupWidget::sigUndoCurrentChanges,this,&MainWindow::undoCurrentChanges, Qt::AutoConnection);
|
||||||
|
connect(instructorButtonGroup,&InstructorButtonGroupWidget::sigStartUnityClient,this,&MainWindow::startUnityClient, Qt::AutoConnection);
|
||||||
|
|
||||||
|
connect(dataParser,&DataParser::sigNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);//ОПАСНОСТЬ
|
||||||
|
connect(dataParser,&DataParser::sigUpdateFilesOnServer,updateController,&UpdateController::updateFilesOnServer,Qt::AutoConnection);//ОПАСНОСТЬ
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateProgress()
|
void MainWindow::updateProgress()
|
||||||
@@ -164,7 +213,7 @@ void MainWindow::loadComplete()
|
|||||||
ui->autostartCheckBox->hide();
|
ui->autostartCheckBox->hide();
|
||||||
ui->offlineStartButton->show();
|
ui->offlineStartButton->show();
|
||||||
|
|
||||||
dataParser->changeVersion(versionContainer->getServerVersionData());
|
dataParserOutput->changeVersion(versionContainer->getServerVersionData());
|
||||||
setTitle();
|
setTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +255,7 @@ void MainWindow::setNeedUpdate(bool flag,quint64 size, quint64 fileCount,quint64
|
|||||||
commonButtonGroupWidget->lastVerInstalledState();
|
commonButtonGroupWidget->lastVerInstalledState();
|
||||||
ui->unsafeChangingButton->hide();
|
ui->unsafeChangingButton->hide();
|
||||||
ui->offlineStartButton->setEnabled(true);
|
ui->offlineStartButton->setEnabled(true);
|
||||||
dataParser->changeVersion(versionContainer->getServerVersionData());
|
dataParserOutput->changeVersion(versionContainer->getServerVersionData());
|
||||||
activateLoadingAnimation(false);
|
activateLoadingAnimation(false);
|
||||||
setTitle();
|
setTitle();
|
||||||
}
|
}
|
||||||
@@ -251,7 +300,7 @@ void MainWindow::checkLoginResult(ServerAuthorization *serverAuth)
|
|||||||
emit sigSendXMLAnswer(cmd_CheckVersionList);
|
emit sigSendXMLAnswer(cmd_CheckVersionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataParser->createAuthData(serverAuth);
|
dataParserOutput->createAuthData(serverAuth);
|
||||||
entryWidget->loginIsActive(false);
|
entryWidget->loginIsActive(false);
|
||||||
//ui->LanguageWidget->hide();
|
//ui->LanguageWidget->hide();
|
||||||
ui->settingsButton->hide();
|
ui->settingsButton->hide();
|
||||||
@@ -411,7 +460,7 @@ void MainWindow::login()
|
|||||||
|
|
||||||
entryWidget->loginIsActive(false);
|
entryWidget->loginIsActive(false);
|
||||||
ClientAutorization *autorization = entryWidget->getAuthData();
|
ClientAutorization *autorization = entryWidget->getAuthData();
|
||||||
dataParser->createAuthMessage(autorization);
|
dataParserOutput->createAuthMessage(autorization);
|
||||||
emit sigSendAutorization();
|
emit sigSendAutorization();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -422,7 +471,7 @@ void MainWindow::saveServerSettingsWithConnect()
|
|||||||
entryWidget->isActive(false);
|
entryWidget->isActive(false);
|
||||||
ServerSettings *settings = entryWidget->getServerSettings();
|
ServerSettings *settings = entryWidget->getServerSettings();
|
||||||
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
|
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
|
||||||
dataParser->createServerSettings(settings);
|
dataParserOutput->createServerSettings(settings);
|
||||||
|
|
||||||
if(client->getIsConnected())
|
if(client->getIsConnected())
|
||||||
{
|
{
|
||||||
@@ -449,7 +498,7 @@ void MainWindow::on_settingsButton_clicked()
|
|||||||
void MainWindow::on_languageComboBox_activated(const QString &arg1)
|
void MainWindow::on_languageComboBox_activated(const QString &arg1)
|
||||||
{
|
{
|
||||||
qDebug() << arg1;
|
qDebug() << arg1;
|
||||||
dataParser->saveClientSettrings(arg1,ui->autostartCheckBox->isChecked());
|
dataParserOutput->saveClientSettrings(arg1,ui->autostartCheckBox->isChecked());
|
||||||
checkLanguage(arg1);
|
checkLanguage(arg1);
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
@@ -577,6 +626,12 @@ void MainWindow::setUpUi()
|
|||||||
activateLoadingAnimation(true);
|
activateLoadingAnimation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::commonWidgetState()
|
||||||
|
{
|
||||||
|
disableUnsaveButton(true);
|
||||||
|
setInlineDebug(tr("Загрузка..."));
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::keyPressEvent(QKeyEvent *event)
|
void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
|
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
|
||||||
@@ -630,7 +685,7 @@ void MainWindow::on_offlineStartButton_clicked()
|
|||||||
QString username = "offlineUser";
|
QString username = "offlineUser";
|
||||||
QString password = "000000";
|
QString password = "000000";
|
||||||
|
|
||||||
dataParser->createAuthDataOffline(username,password);
|
dataParserOutput->createAuthDataOffline(username,password);
|
||||||
startUnityClient();
|
startUnityClient();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
mainwindow.h
21
mainwindow.h
@@ -27,18 +27,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class TCPClient;
|
|
||||||
class UpdateController;
|
|
||||||
class RecognizeSystem;
|
|
||||||
class ExternalExecuter;
|
|
||||||
class UpdateNotifyWidget;
|
|
||||||
class SettingsWidget;
|
|
||||||
class HashComparer;
|
|
||||||
class CommonButtonGroupWidget;
|
|
||||||
class InstructorButtonGroupWidget;
|
|
||||||
class VersionSelectWidget;
|
|
||||||
class EntryWidget;
|
|
||||||
class ScreenChecker;
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
@@ -65,11 +53,7 @@ public:
|
|||||||
void showWarning(QString text);
|
void showWarning(QString text);
|
||||||
void setInlineDebug(QString value);
|
void setInlineDebug(QString value);
|
||||||
signals:
|
signals:
|
||||||
void sigInitializeClient(MainWindow* mainWindow,
|
void sigInitializeClient(RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem);
|
||||||
RecognizeSystem *recognizeSystem,
|
|
||||||
ExternalExecuter *externalExecuter,
|
|
||||||
SendSystem *sendSystem,
|
|
||||||
QThread *thread);
|
|
||||||
void sigRecognize(UpdateController* updateController,
|
void sigRecognize(UpdateController* updateController,
|
||||||
DataParser* dataParser,
|
DataParser* dataParser,
|
||||||
MainWindow* mainWindow,
|
MainWindow* mainWindow,
|
||||||
@@ -121,6 +105,7 @@ private:
|
|||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
TCPClient *client;
|
TCPClient *client;
|
||||||
DataParser *dataParser;
|
DataParser *dataParser;
|
||||||
|
DataParserOutput *dataParserOutput;
|
||||||
UpdateController *updateController;
|
UpdateController *updateController;
|
||||||
RecognizeSystem *recognizeSystem;
|
RecognizeSystem *recognizeSystem;
|
||||||
ScreenChecker *screenChecker;
|
ScreenChecker *screenChecker;
|
||||||
@@ -130,6 +115,7 @@ private:
|
|||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
ResourceManager *resourceManager;
|
ResourceManager *resourceManager;
|
||||||
NotifyController *notifyController;
|
NotifyController *notifyController;
|
||||||
|
PostProcessorSystem *postProcessorSystem;
|
||||||
|
|
||||||
QThread *workerThread;
|
QThread *workerThread;
|
||||||
QThread *animationThread;
|
QThread *animationThread;
|
||||||
@@ -152,6 +138,7 @@ private:
|
|||||||
void showConnectionEmpty();
|
void showConnectionEmpty();
|
||||||
void setTitle();
|
void setTitle();
|
||||||
void setUpUi();
|
void setUpUi();
|
||||||
|
void commonWidgetState();
|
||||||
|
|
||||||
void setServerVersion(StreamingVersionData *version);
|
void setServerVersion(StreamingVersionData *version);
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
|
|||||||
Reference in New Issue
Block a user