mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c1ffb66f | ||
|
|
5b63141ddf | ||
|
|
6665f417c9 | ||
|
|
633881847b | ||
|
|
a2e64ecb68 | ||
|
|
4829647e98 | ||
|
|
b706de2961 | ||
|
|
a4d4709118 | ||
|
|
60c3d6244e | ||
|
|
c9c62d22c0 |
@@ -1,6 +1,7 @@
|
|||||||
#include "UpdateController.h"
|
#include "UpdateController.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
UpdateController::UpdateController(QObject *parent) :
|
UpdateController::UpdateController(QObject *parent) :
|
||||||
@@ -8,6 +9,7 @@ UpdateController::UpdateController(QObject *parent) :
|
|||||||
versionContainer(nullptr)
|
versionContainer(nullptr)
|
||||||
{
|
{
|
||||||
applicationFolderPath = QDir::currentPath() + applicationFolderName;
|
applicationFolderPath = QDir::currentPath() + applicationFolderName;
|
||||||
|
hashCalculator = new FastHashCalculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::initialize(VersionContainer *versionContainer,DataParserOutput *dataParserOut, SendSystem *sendSystem)
|
void UpdateController::initialize(VersionContainer *versionContainer,DataParserOutput *dataParserOut, SendSystem *sendSystem)
|
||||||
@@ -20,18 +22,26 @@ void UpdateController::initialize(VersionContainer *versionContainer,DataParserO
|
|||||||
void UpdateController::calculateCommonHash()
|
void UpdateController::calculateCommonHash()
|
||||||
{
|
{
|
||||||
appDataList.clear();
|
appDataList.clear();
|
||||||
appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
QElapsedTimer timer;
|
||||||
|
timer.start();
|
||||||
|
qDebug() << "Start calculate... ";
|
||||||
|
|
||||||
|
hashCalculator->calculateHashes(applicationFolderPath,"StreamingAssets");
|
||||||
|
appDataList = *hashCalculator->getHashList();
|
||||||
calculateStreamingHash();
|
calculateStreamingHash();
|
||||||
appDataList.append(streamingDataList);
|
appDataList.append(streamingDataList);
|
||||||
|
|
||||||
|
qDebug() << "Hash count: " << appDataList.count() ;
|
||||||
dataParserOut->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
dataParserOut->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
||||||
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
||||||
|
qDebug() <<"Calculate time " << timer.elapsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::calculateStreamingHash()
|
void UpdateController::calculateStreamingHash()
|
||||||
{
|
{
|
||||||
streamingDataList.clear();
|
streamingDataList.clear();
|
||||||
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
hashCalculator->calculateHashes(QDir::currentPath() + streamingAssetsPath,"");
|
||||||
std::sort(streamingDataList.begin(),streamingDataList.end());
|
streamingDataList = *hashCalculator->getHashList();
|
||||||
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +55,6 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<FileData> *hashes = new QList<FileData>;
|
QList<FileData> *hashes = new QList<FileData>;
|
||||||
QString fullSize = Tools::convertFileSize(getDirectorySize(path),false);
|
|
||||||
quint64 currentSize = 0;
|
quint64 currentSize = 0;
|
||||||
|
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
@@ -82,9 +91,9 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
|||||||
|
|
||||||
currentSize += fileInfo.size();
|
currentSize += fileInfo.size();
|
||||||
|
|
||||||
emit sigSendHashInfo(fullSize,Tools::convertFileSize(currentSize,false));
|
|
||||||
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
||||||
const quint64 bufferSize = 10240;
|
const quint64 bufferSize = 1024;
|
||||||
|
|
||||||
if(fileInfo.isHidden()) continue;
|
if(fileInfo.isHidden()) continue;
|
||||||
if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
||||||
@@ -115,24 +124,6 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
|||||||
return *hashes;
|
return *hashes;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 UpdateController::getDirectorySize(const QString& path)
|
|
||||||
{
|
|
||||||
quint64 totalSize = 0;
|
|
||||||
QDirIterator iterator(path, QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
|
||||||
|
|
||||||
while (iterator.hasNext())
|
|
||||||
{
|
|
||||||
iterator.next();
|
|
||||||
QFileInfo fileInfo = iterator.fileInfo();
|
|
||||||
if (fileInfo.isFile())
|
|
||||||
{
|
|
||||||
totalSize += fileInfo.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
||||||
|
|
||||||
QListIterator<FileData> serverIterator(*fileSendList);
|
QListIterator<FileData> serverIterator(*fileSendList);
|
||||||
@@ -155,8 +146,7 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculateCommonHash();
|
calculateCommonHash();
|
||||||
sendSystem->sendFinish();
|
sendSystem->sendPacketType(PacketType::RECALCULATE_DOCS);
|
||||||
|
|
||||||
emit sigUpdateComplete(true);
|
emit sigUpdateComplete(true);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -166,6 +156,11 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FastHashCalculator *UpdateController::getHashCalculator() const
|
||||||
|
{
|
||||||
|
return hashCalculator;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateController::~UpdateController()
|
UpdateController::~UpdateController()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "Core/sendsystem.h"
|
#include "Core/sendsystem.h"
|
||||||
#include "Core/versioncontainer.h"
|
#include "Core/versioncontainer.h"
|
||||||
|
#include "fasthashcalculator.h"
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QXmlStreamAttribute>
|
#include <QXmlStreamAttribute>
|
||||||
@@ -34,19 +35,21 @@ public:
|
|||||||
void updateFilesOnServer(QList<FileData> *fileSendList);
|
void updateFilesOnServer(QList<FileData> *fileSendList);
|
||||||
void checkCanUpdate();
|
void checkCanUpdate();
|
||||||
|
|
||||||
|
FastHashCalculator *getHashCalculator() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigUpdateComplete(bool flag);
|
void sigUpdateComplete(bool flag);
|
||||||
void sigSendHashInfo(QString fullSize,QString current);
|
|
||||||
private:
|
private:
|
||||||
SendSystem *sendSystem;
|
SendSystem *sendSystem;
|
||||||
DataParserOutput * dataParserOut;
|
DataParserOutput * dataParserOut;
|
||||||
|
FastHashCalculator* hashCalculator;
|
||||||
QString applicationFolderPath;
|
QString applicationFolderPath;
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
QList<FileData> appDataList;
|
QList<FileData> appDataList;
|
||||||
QList<FileData> streamingDataList;
|
QList<FileData> streamingDataList;
|
||||||
|
|
||||||
QList<FileData> calculateHash(const QString& path,const QString& ignoreName);
|
QList<FileData> calculateHash(const QString& path,const QString& ignoreName);
|
||||||
quint64 getDirectorySize(const QString &path);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -95,9 +95,10 @@ ServerSettings *DataParser::getClientSettings()
|
|||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataParser::xmlParser(const QByteArray& array)
|
bool DataParser::xmlParser(const QByteArray& array)
|
||||||
{
|
{
|
||||||
QXmlStreamReader xmlReader(array);
|
QXmlStreamReader xmlReader(array);
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
|
|
||||||
@@ -135,6 +136,7 @@ void DataParser::xmlParser(const QByteArray& array)
|
|||||||
if (value == "UNCHANGEABLE")
|
if (value == "UNCHANGEABLE")
|
||||||
{
|
{
|
||||||
//версию нельзя изменять
|
//версию нельзя изменять
|
||||||
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == "CHANGEABLE")
|
if (value == "CHANGEABLE")
|
||||||
@@ -247,4 +249,5 @@ void DataParser::xmlParser(const QByteArray& array)
|
|||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <Data/FileData.h>
|
|
||||||
#include <Data/Datas.h>
|
#include <Data/Datas.h>
|
||||||
#include <Data/FileData.h>
|
#include <Data/FileData.h>
|
||||||
#include <Core/tools.h>
|
#include <Core/tools.h>
|
||||||
@@ -22,7 +21,7 @@ public:
|
|||||||
|
|
||||||
void initialize(PostProcessorSystem *postProcessSystem);
|
void initialize(PostProcessorSystem *postProcessSystem);
|
||||||
ServerSettings* getClientSettings();
|
ServerSettings* getClientSettings();
|
||||||
void xmlParser(const QByteArray& array);
|
bool xmlParser(const QByteArray& array);
|
||||||
private:
|
private:
|
||||||
PostProcessorSystem *postProcessSystem;
|
PostProcessorSystem *postProcessSystem;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ QByteArray DataParserOutput::xmlAnswer(const QList<SXmlAnswerTag>& listTag, cons
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,const QString& filename)
|
void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,const QString& filename)
|
||||||
{
|
{
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
@@ -129,7 +128,6 @@ void DataParserOutput::createAuthMessage(ClientAutorization *auth)
|
|||||||
void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
||||||
{
|
{
|
||||||
QFile file(settingsName);
|
QFile file(settingsName);
|
||||||
|
|
||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
@@ -144,9 +142,9 @@ void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
|||||||
xmlWriter.writeAttribute("Port",serverSettings->Port);
|
xmlWriter.writeAttribute("Port",serverSettings->Port);
|
||||||
xmlWriter.writeAttribute("Language","RUS");
|
xmlWriter.writeAttribute("Language","RUS");
|
||||||
xmlWriter.writeAttribute("AutoStart",QString::number(false));
|
xmlWriter.writeAttribute("AutoStart",QString::number(false));
|
||||||
xmlWriter.writeAttribute("DestPortMath","18003");
|
//xmlWriter.writeAttribute("DestPortMath","18003");
|
||||||
xmlWriter.writeAttribute("LocalPortMath","18004");
|
//xmlWriter.writeAttribute("LocalPortMath","18004");
|
||||||
xmlWriter.writeAttribute("UseMathModel",QString::number(serverSettings->mathModelUse));
|
//xmlWriter.writeAttribute("UseMathModel",QString::number(serverSettings->mathModelUse));
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
|
|
||||||
|
|||||||
127
Core/fasthashcalculator.cpp
Normal file
127
Core/fasthashcalculator.cpp
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
#include "fasthashcalculator.h"
|
||||||
|
#include <QtConcurrent>
|
||||||
|
|
||||||
|
|
||||||
|
FastHashCalculator::FastHashCalculator(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
hashList = new QList<FileData>();
|
||||||
|
}
|
||||||
|
void FastHashCalculator::calculateHashes(const QString& path, const QString& ignoreName)
|
||||||
|
{
|
||||||
|
hashList->clear();
|
||||||
|
currentSize = 0;
|
||||||
|
if(!QDir(path).exists()){
|
||||||
|
QDir().mkdir(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString hashString;
|
||||||
|
QStringList filter;
|
||||||
|
filter << "*";
|
||||||
|
QList<FileData> *folders = new QList<FileData>;
|
||||||
|
fullSize = Tools::convertFileSize(getDirectorySize(path),false);
|
||||||
|
|
||||||
|
//только папки
|
||||||
|
QDirIterator dirIterator(path,filter, QDir::AllEntries, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
|
while (dirIterator.hasNext())
|
||||||
|
{
|
||||||
|
QFileInfo fileInfo(dirIterator.next());
|
||||||
|
FileData currentFolder;
|
||||||
|
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != "RRJLoader")
|
||||||
|
{
|
||||||
|
currentFolder.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||||
|
currentFolder.hash = "FOLDER";
|
||||||
|
|
||||||
|
if(!folders->contains(currentFolder))
|
||||||
|
{
|
||||||
|
folders->push_back(currentFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//только файлы
|
||||||
|
QDirIterator fileIterator(path,filter,QDir::Files | QDir::NoDotAndDotDot,QDirIterator::Subdirectories);
|
||||||
|
|
||||||
|
QList<QString> files;
|
||||||
|
files.clear();
|
||||||
|
|
||||||
|
while(fileIterator.hasNext())
|
||||||
|
{
|
||||||
|
fileIterator.next();
|
||||||
|
QFileInfo fileInfo = fileIterator.fileInfo();
|
||||||
|
QString path = fileInfo.absoluteFilePath();
|
||||||
|
|
||||||
|
if (fileInfo.isHidden()) continue;
|
||||||
|
if (!fileInfo.isFile()) continue;
|
||||||
|
if (fileInfo.fileName().contains(".meta")) continue;
|
||||||
|
if (ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
||||||
|
|
||||||
|
files.append(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
QtConcurrent::map(files, [this](const QString &filePath)
|
||||||
|
{
|
||||||
|
QByteArray hash = calculateFileHashOptimized(filePath);
|
||||||
|
QMutexLocker locker(&_mutex);
|
||||||
|
FileData currentFile;
|
||||||
|
QString hashName;
|
||||||
|
|
||||||
|
currentFile.path = Tools::createLocalPath(filePath);
|
||||||
|
currentFile.hash = hash.toHex();
|
||||||
|
|
||||||
|
hashList->append(currentFile);
|
||||||
|
}).waitForFinished();
|
||||||
|
|
||||||
|
hashList->append(*folders);
|
||||||
|
emit finished();
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray FastHashCalculator::calculateFileHashOptimized(const QString &filePath)
|
||||||
|
{
|
||||||
|
QFile file(filePath);
|
||||||
|
if (!file.open(QIODevice::ReadOnly)) return QByteArray();
|
||||||
|
|
||||||
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
|
const qint64 bufferSize = 2048; // 2MB
|
||||||
|
quint64 completeBytes = 0;
|
||||||
|
QByteArray buffer;
|
||||||
|
buffer.resize(bufferSize);
|
||||||
|
|
||||||
|
while (!file.atEnd()) {
|
||||||
|
qint64 bytesRead = file.read(buffer.data(), bufferSize);
|
||||||
|
hash.addData(buffer.constData(), bytesRead);
|
||||||
|
completeBytes += bytesRead;
|
||||||
|
}
|
||||||
|
|
||||||
|
hashCounterDisplay(completeBytes);
|
||||||
|
return hash.result();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FastHashCalculator::hashCounterDisplay(quint64 size)
|
||||||
|
{
|
||||||
|
currentSize += size;
|
||||||
|
emit sigSendHashInfo(fullSize,Tools::convertFileSize(currentSize,false));
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 FastHashCalculator::getDirectorySize(const QString& path)
|
||||||
|
{
|
||||||
|
quint64 totalSize = 0;
|
||||||
|
QDirIterator iterator(path, QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
iterator.next();
|
||||||
|
QFileInfo fileInfo = iterator.fileInfo();
|
||||||
|
if (fileInfo.isFile())
|
||||||
|
{
|
||||||
|
totalSize += fileInfo.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<FileData> *FastHashCalculator::getHashList() const
|
||||||
|
{
|
||||||
|
return hashList;
|
||||||
|
}
|
||||||
38
Core/fasthashcalculator.h
Normal file
38
Core/fasthashcalculator.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#ifndef FASTHASHCALCULATOR_H
|
||||||
|
#define FASTHASHCALCULATOR_H
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QDirIterator>
|
||||||
|
#include <Data/FileData.h>
|
||||||
|
#include "tools.h"
|
||||||
|
|
||||||
|
|
||||||
|
class FastHashCalculator : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit FastHashCalculator(QObject *parent = nullptr);
|
||||||
|
void calculateHashes(const QString& path, const QString& ignoreName);
|
||||||
|
QList<FileData> *getHashList() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigSendHashInfo(QString fullSize,QString current);
|
||||||
|
void finished();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QByteArray calculateFileHashOptimized(const QString &filePath);
|
||||||
|
void calculateSingleHash(const QString &filePath);
|
||||||
|
|
||||||
|
QList<FileData>* hashList;
|
||||||
|
QMutex _mutex;
|
||||||
|
QString fullSize;
|
||||||
|
quint64 currentSize;
|
||||||
|
|
||||||
|
quint64 getDirectorySize(const QString &path);
|
||||||
|
void hashCounterDisplay(quint64 size);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FASTHASHCALCULATOR_H
|
||||||
@@ -25,6 +25,7 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
|||||||
{
|
{
|
||||||
if(!serverStreamingHash->contains(item))
|
if(!serverStreamingHash->contains(item))
|
||||||
{
|
{
|
||||||
|
if (item.path.contains("docs.xml")) continue; //фильтр на docs
|
||||||
files->append(item);
|
files->append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ RecognizeSystem::RecognizeSystem(QObject *parent):
|
|||||||
countSend = 0;
|
countSend = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecognizeSystem::initialize(DataParser *dataParser, VersionContainer *versionContainer,PostProcessorSystem *postProcessorSystem)
|
void RecognizeSystem::initialize(DataParser *dataParser, VersionContainer *versionContainer,PostProcessorSystem *postProcessorSystem,Client *client)
|
||||||
{
|
{
|
||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
this->postProcessorSystem = postProcessorSystem;
|
this->postProcessorSystem = postProcessorSystem;
|
||||||
this->dataParser = dataParser;
|
this->dataParser = dataParser;
|
||||||
|
this->client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecognizeSystem::recognize(QTcpSocket *socket)
|
void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||||
@@ -38,7 +39,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
stream.startTransaction();
|
stream.startTransaction();
|
||||||
stream >> packetType;
|
stream >> packetType;
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction())
|
||||||
|
{
|
||||||
emit sigSendDebugLog(Tools::getTime() + " CLIENT: packetType - FAIL commitTransaction");
|
emit sigSendDebugLog(Tools::getTime() + " CLIENT: packetType - FAIL commitTransaction");
|
||||||
|
|
||||||
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
||||||
@@ -205,15 +207,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetType ==PacketType::TYPE_FINISH) //для повторного создания хэша после загрузки
|
if(packetType == PacketType::TYPE_NEEDUPDATE)
|
||||||
{
|
{ //нужно обновление
|
||||||
postProcessorSystem->calculateCommonHash();
|
|
||||||
|
|
||||||
emit sigLoadComplete();
|
|
||||||
packetType = PacketType::TYPE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(packetType == PacketType::TYPE_NEEDUPDATE){ //нужно обновление
|
|
||||||
|
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
quint64 size = 0;
|
quint64 size = 0;
|
||||||
@@ -251,10 +246,9 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
if(packetType == PacketType::HASH_READY)
|
if(packetType == PacketType::HASH_READY)
|
||||||
{
|
{
|
||||||
emit sigCheckUpdate();
|
emit sigCheckUpdate();
|
||||||
//mainWindow->checkUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packetType == PacketType::HASH_CALCULATE_START)
|
if(packetType == PacketType::RECALCULATE_HASH)
|
||||||
{
|
{
|
||||||
emit sigdRecalculateHashOnServerState();
|
emit sigdRecalculateHashOnServerState();
|
||||||
}
|
}
|
||||||
@@ -269,6 +263,22 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
emit sigAnimationActivated(false);
|
emit sigAnimationActivated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packetType == PacketType::TYPE_XMLANSWER_DOCS_CHANGED) //на случай общего обновления
|
||||||
|
{
|
||||||
|
if (client->getIsLoggedIn())
|
||||||
|
{
|
||||||
|
emit sigSendPacketType(PacketType::GET_DOCS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packetType == PacketType::UPDATE_FILE_COMPLETE)
|
||||||
|
{
|
||||||
|
postProcessorSystem->calculateCommonHash();
|
||||||
|
emit sigLoadComplete();
|
||||||
|
emit sigSendPacketType(PacketType::GET_DOCS);
|
||||||
|
packetType = PacketType::TYPE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <Core\tools.h>
|
#include <Core\tools.h>
|
||||||
#include <Core\versioncontainer.h>
|
#include <Core\versioncontainer.h>
|
||||||
|
#include <Data/Client.h>
|
||||||
#include <Data\streamingversiondata.h>
|
#include <Data\streamingversiondata.h>
|
||||||
#include <Core\hashcomparer.h>
|
#include <Core\hashcomparer.h>
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ class RecognizeSystem : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit RecognizeSystem(QObject *parent = 0);
|
explicit RecognizeSystem(QObject *parent = 0);
|
||||||
~RecognizeSystem(){};
|
~RecognizeSystem(){};
|
||||||
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem);
|
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem,Client *client);
|
||||||
void recognize(QTcpSocket *socket);
|
void recognize(QTcpSocket *socket);
|
||||||
signals:
|
signals:
|
||||||
void sigUpdateBytesAvailable();
|
void sigUpdateBytesAvailable();
|
||||||
@@ -30,6 +31,10 @@ signals:
|
|||||||
void sigAnimationActivated(bool flag);
|
void sigAnimationActivated(bool flag);
|
||||||
void sigCheckUpdate();
|
void sigCheckUpdate();
|
||||||
void sigdRecalculateHashOnServerState();
|
void sigdRecalculateHashOnServerState();
|
||||||
|
void sigSendPacketType(PacketType packetType);
|
||||||
|
void sigSendPacketTypeWithDelay(PacketType packetType,int delay);
|
||||||
|
void sigSendToInlineLog(QString message);
|
||||||
|
void sigCallUpdateList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
@@ -38,6 +43,7 @@ private:
|
|||||||
PacketType packetType;
|
PacketType packetType;
|
||||||
QString filePath;
|
QString filePath;
|
||||||
QByteArray tmpBlock;
|
QByteArray tmpBlock;
|
||||||
|
Client *client;
|
||||||
|
|
||||||
qint64 sizeReceiveData;
|
qint64 sizeReceiveData;
|
||||||
qint64 fileSize;
|
qint64 fileSize;
|
||||||
|
|||||||
@@ -157,16 +157,6 @@ void SendSystem::sendXMLAnswer(const QByteArray& array)
|
|||||||
qDebug() << "Send XML answer in byte";
|
qDebug() << "Send XML answer in byte";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendSystem::sendFinish()
|
|
||||||
{
|
|
||||||
socket->waitForReadyRead(100);
|
|
||||||
QDataStream stream(socket);
|
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
|
||||||
|
|
||||||
stream << PacketType::TYPE_FINISH;
|
|
||||||
socket->waitForReadyRead(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendSystem::sendPacketType(PacketType packetType)
|
void SendSystem::sendPacketType(PacketType packetType)
|
||||||
{
|
{
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
@@ -175,12 +165,47 @@ void SendSystem::sendPacketType(PacketType packetType)
|
|||||||
stream << packetType;
|
stream << packetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendSystem::sendPacketTypeWithDelay(PacketType packetType,int delay)
|
||||||
|
{
|
||||||
|
QDataStream stream(socket);
|
||||||
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
socket->waitForReadyRead(delay);
|
||||||
|
stream << packetType;
|
||||||
|
}
|
||||||
void SendSystem::sendCheckHash()
|
void SendSystem::sendCheckHash()
|
||||||
{
|
{
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
QString fullPath = Tools::createSendFullPath(staticDataFolderName + hashFilename);
|
||||||
|
|
||||||
sendFileBlock(staticDataFolderName + hashFilename);
|
quint64 fileSize = 0;
|
||||||
|
int countSend = 0;
|
||||||
|
|
||||||
|
|
||||||
|
QFile file(fullPath); //Открываем файл для чтения
|
||||||
|
QFileInfo fileInfo(file);
|
||||||
|
|
||||||
|
fileSize = fileInfo.size();
|
||||||
|
|
||||||
|
stream << PacketType::SEND_HASH; //Отправляем тип блока
|
||||||
|
stream << fileSize;
|
||||||
|
|
||||||
|
socket->waitForReadyRead(20);
|
||||||
|
//socket->waitForBytesWritten();
|
||||||
|
|
||||||
|
if(file.open(QFile::ReadOnly)){
|
||||||
|
while(!file.atEnd()){
|
||||||
|
QByteArray data = file.read(readSize);
|
||||||
|
stream << data;
|
||||||
|
socket->waitForBytesWritten(20);
|
||||||
|
countSend++;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << Tools::getTime() << "count end Final: " << countSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
countSend = 0;
|
||||||
|
|
||||||
socket->waitForReadyRead(2000);
|
socket->waitForReadyRead(2000);
|
||||||
stream << PacketType::TYPE_CHECK_VERSION;
|
stream << PacketType::TYPE_CHECK_VERSION;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
void sendCheckHash();
|
void sendCheckHash();
|
||||||
void sendPacketType(PacketType packetType);
|
void sendPacketType(PacketType packetType);
|
||||||
~SendSystem(){};
|
~SendSystem(){};
|
||||||
|
void sendPacketTypeWithDelay(PacketType packetType, int delay);
|
||||||
signals:
|
signals:
|
||||||
void sigSend();
|
void sigSend();
|
||||||
QByteArray sigGetXmlAnswer(QString);
|
QByteArray sigGetXmlAnswer(QString);
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ void TCPClient::setConnect(ServerSettings *serverSettings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TCPClient::setDisconnect()
|
void TCPClient::setDisconnect()
|
||||||
{
|
{
|
||||||
socket->disconnect();
|
socket->disconnect();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
void initialize(RecognizeSystem *recognize,SendSystem *sendSystem);
|
void initialize(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||||
void setConnect(ServerSettings *serverSettings);
|
void setConnect(ServerSettings *serverSettings);
|
||||||
~TCPClient(){};
|
~TCPClient(){};
|
||||||
|
void setDisconnect();
|
||||||
bool getIsConnected() const;
|
bool getIsConnected() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -43,8 +43,6 @@ private:
|
|||||||
QTcpSocket *socket;
|
QTcpSocket *socket;
|
||||||
RecognizeSystem *recognizeSystem;
|
RecognizeSystem *recognizeSystem;
|
||||||
bool isConnected;
|
bool isConnected;
|
||||||
|
|
||||||
void setDisconnect();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TCPCLIENT_H
|
#endif // TCPCLIENT_H
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ QString Tools::getTime()
|
|||||||
|
|
||||||
QString Tools::createLocalPath(QString path)
|
QString Tools::createLocalPath(QString path)
|
||||||
{
|
{
|
||||||
qDebug() << "Full path: " << path;
|
//qDebug() << "Full path: " << path;
|
||||||
qint8 pos = path.indexOf("Application");
|
qint8 pos = path.indexOf("Application");
|
||||||
|
|
||||||
QString localPath = path.remove(0,--pos);
|
QString localPath = path.remove(0,--pos);
|
||||||
|
|
||||||
qDebug() << "Local path: " << localPath;
|
//qDebug() << "Local path: " << localPath;
|
||||||
return localPath;
|
return localPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
Core/tools.h
10
Core/tools.h
@@ -39,13 +39,16 @@ enum PacketType{
|
|||||||
TYPE_COMMAND = 3,
|
TYPE_COMMAND = 3,
|
||||||
TYPE_FOLDER = 4,
|
TYPE_FOLDER = 4,
|
||||||
TYPE_DELETE = 5,
|
TYPE_DELETE = 5,
|
||||||
TYPE_FINISH = 6,
|
UPDATE_FILE_COMPLETE = 6,
|
||||||
TYPE_NEEDUPDATE = 7,
|
TYPE_NEEDUPDATE = 7,
|
||||||
TYPE_XMLANSWER = 8,
|
TYPE_XMLANSWER = 8,
|
||||||
TYPE_QT = 9,
|
TYPE_QT = 9,
|
||||||
TYPE_DISABLE = 11,
|
TYPE_DISABLE = 11,
|
||||||
TYPE_UPDATE = 12,
|
TYPE_UPDATE = 12,
|
||||||
TYPE_CHECK_VERSION = 13,
|
TYPE_CHECK_VERSION = 13,
|
||||||
|
UPDATE_DOCS_COMPLETE = 22,
|
||||||
|
|
||||||
|
TYPE_XMLANSWER_DOCS_CHANGED = 132,
|
||||||
|
|
||||||
HASH_READY = 150,
|
HASH_READY = 150,
|
||||||
CHANGE_DATA_VERSION = 151,
|
CHANGE_DATA_VERSION = 151,
|
||||||
@@ -53,7 +56,10 @@ enum PacketType{
|
|||||||
DELETE_DATA_VERSION = 153,
|
DELETE_DATA_VERSION = 153,
|
||||||
BUSY = 154,
|
BUSY = 154,
|
||||||
FREE = 155,
|
FREE = 155,
|
||||||
HASH_CALCULATE_START = 156
|
RECALCULATE_HASH = 156,
|
||||||
|
RECALCULATE_DOCS = 157,
|
||||||
|
GET_DOCS = 158,
|
||||||
|
SEND_HASH = 159
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
105
Data/Client.h
Normal file
105
Data/Client.h
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#ifndef CLIENT_H
|
||||||
|
#define CLIENT_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QTcpSocket>
|
||||||
|
|
||||||
|
class Client
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
Client():
|
||||||
|
login(""),
|
||||||
|
ready(false)
|
||||||
|
{ };
|
||||||
|
~Client(){};
|
||||||
|
|
||||||
|
public:
|
||||||
|
QString getFullName()
|
||||||
|
{
|
||||||
|
return fullName;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setLogin(QString login)
|
||||||
|
{
|
||||||
|
this->login = login;
|
||||||
|
isLoggedIn = true;
|
||||||
|
fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login;
|
||||||
|
}
|
||||||
|
QString getLogin()
|
||||||
|
{
|
||||||
|
return login;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getAddress()
|
||||||
|
{
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
QString getPort()
|
||||||
|
{
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getReady()
|
||||||
|
{
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setReady(bool ready)
|
||||||
|
{
|
||||||
|
this->ready = ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator == (Client* right)
|
||||||
|
{
|
||||||
|
return this->address == right->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getIsLoggedIn()
|
||||||
|
{
|
||||||
|
return isLoggedIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setIsLoggedIn(bool value)
|
||||||
|
{
|
||||||
|
isLoggedIn = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setId(QString value)
|
||||||
|
{
|
||||||
|
id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray getClientHash()
|
||||||
|
{
|
||||||
|
return clientHash;
|
||||||
|
}
|
||||||
|
void setClientHash(const QByteArray &value)
|
||||||
|
{
|
||||||
|
clientHash = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString name;
|
||||||
|
QString address;
|
||||||
|
QString port;
|
||||||
|
QString fullName;
|
||||||
|
QString id;
|
||||||
|
|
||||||
|
QString login;
|
||||||
|
bool ready;
|
||||||
|
bool isLoggedIn;
|
||||||
|
QByteArray clientHash;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CLIENT_H
|
||||||
|
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ public:
|
|||||||
QString Language;
|
QString Language;
|
||||||
QString LocalVersionName;
|
QString LocalVersionName;
|
||||||
StreamingVersionData versionData;
|
StreamingVersionData versionData;
|
||||||
bool isAutoStart;
|
bool isAutoStart = false;
|
||||||
bool mathModelUse;
|
bool mathModelUse;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
QT += core gui
|
QT += core gui
|
||||||
QT += network
|
QT += network
|
||||||
QT += xml
|
QT += xml
|
||||||
|
QT += concurrent
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any Qt feature that has been marked deprecated (the exact warnings
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
@@ -19,6 +18,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
Core/dataparseroutput.cpp \
|
Core/dataparseroutput.cpp \
|
||||||
|
Core/fasthashcalculator.cpp \
|
||||||
Core/notifycontroller.cpp \
|
Core/notifycontroller.cpp \
|
||||||
Core/postprocessorsystem.cpp \
|
Core/postprocessorsystem.cpp \
|
||||||
Core/sendsystem.cpp \
|
Core/sendsystem.cpp \
|
||||||
@@ -46,6 +46,7 @@ SOURCES += \
|
|||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
Core/dataparseroutput.h \
|
Core/dataparseroutput.h \
|
||||||
|
Core/fasthashcalculator.h \
|
||||||
Core/notifycontroller.h \
|
Core/notifycontroller.h \
|
||||||
Core/postprocessorsystem.h \
|
Core/postprocessorsystem.h \
|
||||||
Core/versioncontainer.h \
|
Core/versioncontainer.h \
|
||||||
@@ -58,6 +59,7 @@ HEADERS += \
|
|||||||
Core\tcpclient.h\
|
Core\tcpclient.h\
|
||||||
Core\tools.h\
|
Core\tools.h\
|
||||||
Core\hashcomparer.h \
|
Core\hashcomparer.h \
|
||||||
|
Data/Client.h \
|
||||||
Data/monitorInfo.h \
|
Data/monitorInfo.h \
|
||||||
Data/streamingversiondata.h \
|
Data/streamingversiondata.h \
|
||||||
Data\FileData.h\
|
Data\FileData.h\
|
||||||
@@ -85,6 +87,9 @@ FORMS += \
|
|||||||
TRANSLATIONS = QtLanguage_ru.ts\
|
TRANSLATIONS = QtLanguage_ru.ts\
|
||||||
QtLanguage_eng.ts
|
QtLanguage_eng.ts
|
||||||
|
|
||||||
|
#TEMPLATE = subdirs
|
||||||
|
#SUBDIRS += Unit-tests\
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
|||||||
8935
StaticData/clientHash.xml
Normal file
8935
StaticData/clientHash.xml
Normal file
File diff suppressed because it is too large
Load Diff
2
StaticData/displayData.xml
Normal file
2
StaticData/displayData.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
<DisplayInfo DisplaysID="0;"/>
|
||||||
8915
StaticData/serverHash.xml
Normal file
8915
StaticData/serverHash.xml
Normal file
File diff suppressed because it is too large
Load Diff
5
StaticData/settings.xml
Normal file
5
StaticData/settings.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ServerSettingsContainer>
|
||||||
|
<ServerSettings Address="192.168.100.83" Port="6000" Language="RUS" AutoStart="0"/>
|
||||||
|
<VersionData Version="base" isChangable="96"/>
|
||||||
|
</ServerSettingsContainer>
|
||||||
8730
StaticData/streamingHash.xml
Normal file
8730
StaticData/streamingHash.xml
Normal file
File diff suppressed because it is too large
Load Diff
2
StaticData/temp.xml
Normal file
2
StaticData/temp.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ClientNotify Code="DISABLE"/>
|
||||||
@@ -26,7 +26,7 @@ void CommonButtonGroupWidget::updateProgressBar(float value)
|
|||||||
void CommonButtonGroupWidget::loadCompleteState()
|
void CommonButtonGroupWidget::loadCompleteState()
|
||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
ui->updateButton->setEnabled(false);
|
ui->updateButton->hide();
|
||||||
ui->startButton->setEnabled(true);
|
ui->startButton->setEnabled(true);
|
||||||
ui->loadingProgressBar->setValue(100);
|
ui->loadingProgressBar->setValue(100);
|
||||||
ui->startButton->show();
|
ui->startButton->show();
|
||||||
@@ -66,6 +66,8 @@ void CommonButtonGroupWidget::showProgressBar(bool flag)
|
|||||||
|
|
||||||
void CommonButtonGroupWidget::needUpdateState(bool flag)
|
void CommonButtonGroupWidget::needUpdateState(bool flag)
|
||||||
{
|
{
|
||||||
|
show();
|
||||||
|
ui->loadingProgressBar->hide();
|
||||||
ui->startButton->hide();
|
ui->startButton->hide();
|
||||||
ui->updateButton->setEnabled(flag);
|
ui->updateButton->setEnabled(flag);
|
||||||
ui->updateButton->show();
|
ui->updateButton->show();
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#include "entrywidget.h"
|
#include "entrywidget.h"
|
||||||
#include "ui_entrywidget.h"
|
#include "ui_entrywidget.h"
|
||||||
|
|
||||||
|
#include <bits/functional_hash.h>
|
||||||
|
|
||||||
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
EntryWidget::EntryWidget(QWidget *parent) :
|
EntryWidget::EntryWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::EntryWidget)
|
ui(new Ui::EntryWidget)
|
||||||
@@ -34,7 +38,9 @@ ClientAutorization* EntryWidget::getAuthData()
|
|||||||
QString username = ui->loginInputField->text();
|
QString username = ui->loginInputField->text();
|
||||||
QString password = ui->passwordInputField->text();
|
QString password = ui->passwordInputField->text();
|
||||||
data->Login = username;
|
data->Login = username;
|
||||||
data->Password = password;
|
|
||||||
|
QByteArray md5Hash = QCryptographicHash::hash(password.toUtf8(), QCryptographicHash::Md5).toHex();
|
||||||
|
data->Password = QString(md5Hash);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "Core/tools.h"
|
#include "Core/tools.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTextDocumentFragment>
|
||||||
|
|
||||||
UpdateNotifyWidget::UpdateNotifyWidget(QWidget *) :
|
UpdateNotifyWidget::UpdateNotifyWidget(QWidget *) :
|
||||||
ui(new Ui::UpdateNotifyWidget)
|
ui(new Ui::UpdateNotifyWidget)
|
||||||
@@ -37,15 +38,18 @@ void UpdateNotifyWidget::addToList(FileData fileData)
|
|||||||
void UpdateNotifyWidget::showTryChangeBase()
|
void UpdateNotifyWidget::showTryChangeBase()
|
||||||
{
|
{
|
||||||
QString path = QDir::currentPath() + streamingAssetsPath;
|
QString path = QDir::currentPath() + streamingAssetsPath;
|
||||||
QString link = "<a href=\""+ path + "\"style=\"color:white;\">папку</a>";
|
QString link = "<a href=\""+ path + "\"style=\"color:lightblue; text-decoration: underline;\">папку</a>";
|
||||||
|
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("Данные изменения нельзя выгрузить на сервер, так как версия сервера не изменяема \n")));
|
ui->labelsLayout->addWidget(createLabel(tr("Данные изменения нельзя выгрузить на сервер, так как версия сервера не изменяема \n")));
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("Чтобы выгрузить на сервер нужно:")));
|
ui->labelsLayout->addWidget(createLabel(tr("Чтобы выгрузить на сервер нужно:")));
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("1. Скопировать измененные или созданные файлы в временную папку")));
|
ui->labelsLayout->addWidget(createLabel(tr("1. Скопировать измененные или созданные файлы в временную папку")));
|
||||||
QLabel *labelStorage = new QLabel;
|
QLabel *labelStorage = new QLabel;
|
||||||
QString link2 = "<a href=\""+ path + "\"style=\"color:white;\">тут</a>";
|
QString link2 = "<a href=\""+ path + "\"style=\"color:lightblue; text-decoration: underline;\">тут</a>";
|
||||||
labelStorage->setText(tr("Файлы можно найти в ") + link2);
|
labelStorage->setText(tr("Файлы можно найти в ") + link2);
|
||||||
|
labelStorage->setTextFormat(Qt::RichText);
|
||||||
|
labelStorage->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
labelStorage->setOpenExternalLinks(true);
|
labelStorage->setOpenExternalLinks(true);
|
||||||
|
|
||||||
ui->labelsLayout->addWidget(labelStorage);
|
ui->labelsLayout->addWidget(labelStorage);
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("2. Нажать Отменить изменения и дождатся окончания операции")));
|
ui->labelsLayout->addWidget(createLabel(tr("2. Нажать Отменить изменения и дождатся окончания операции")));
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("3. Изменить версию сервера на изменяемую")));
|
ui->labelsLayout->addWidget(createLabel(tr("3. Изменить версию сервера на изменяемую")));
|
||||||
@@ -55,6 +59,8 @@ void UpdateNotifyWidget::showTryChangeBase()
|
|||||||
QLabel *linkLabel = new QLabel;
|
QLabel *linkLabel = new QLabel;
|
||||||
linkLabel->setText(tr("5. Скопировать файлы из временной папки в эту ") + link);
|
linkLabel->setText(tr("5. Скопировать файлы из временной папки в эту ") + link);
|
||||||
linkLabel->setOpenExternalLinks(true);
|
linkLabel->setOpenExternalLinks(true);
|
||||||
|
linkLabel->setTextFormat(Qt::RichText);
|
||||||
|
linkLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
|
|
||||||
ui->labelsLayout->addWidget(linkLabel);
|
ui->labelsLayout->addWidget(linkLabel);
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("6.Перезапустить клиент и выгрузить изменения на сервер")));
|
ui->labelsLayout->addWidget(createLabel(tr("6.Перезапустить клиент и выгрузить изменения на сервер")));
|
||||||
@@ -117,6 +123,11 @@ void UpdateNotifyWidget::on_startWithCurrentChangesButton_clicked()
|
|||||||
emit sigStartUnityClient();
|
emit sigStartUnityClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateNotifyWidget::closeWindow()
|
||||||
|
{
|
||||||
|
on_closeButton_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::setUpdateState()
|
void UpdateNotifyWidget::setUpdateState()
|
||||||
{
|
{
|
||||||
ui->undoChangesButton->show();
|
ui->undoChangesButton->show();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
void showWithFill();
|
void showWithFill();
|
||||||
void showTryChangeBase();
|
void showTryChangeBase();
|
||||||
void setVersionContainer(VersionContainer *versionContainer);
|
void setVersionContainer(VersionContainer *versionContainer);
|
||||||
|
void closeWindow();
|
||||||
signals:
|
signals:
|
||||||
void sigLoadToServerBehaviour();
|
void sigLoadToServerBehaviour();
|
||||||
void sigUndoCurrentChanges();
|
void sigUndoCurrentChanges();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ CoreManager::CoreManager(QObject *parent) :
|
|||||||
QObject(parent),
|
QObject(parent),
|
||||||
isRecovery(false)
|
isRecovery(false)
|
||||||
{
|
{
|
||||||
client = new TCPClient;
|
tcpClient = new TCPClient;
|
||||||
dataParser = new DataParser;
|
dataParser = new DataParser;
|
||||||
dataParserOutput = new DataParserOutput;
|
dataParserOutput = new DataParserOutput;
|
||||||
updateController = new UpdateController;
|
updateController = new UpdateController;
|
||||||
@@ -16,6 +16,7 @@ CoreManager::CoreManager(QObject *parent) :
|
|||||||
versionContainer = new VersionContainer;
|
versionContainer = new VersionContainer;
|
||||||
resourceManager = new ResourceManager;
|
resourceManager = new ResourceManager;
|
||||||
postProcessorSystem = new PostProcessorSystem;
|
postProcessorSystem = new PostProcessorSystem;
|
||||||
|
client = new Client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
||||||
@@ -23,7 +24,7 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
|||||||
this->workerThread = workerThread;
|
this->workerThread = workerThread;
|
||||||
this->widgetManager = widgetManager;
|
this->widgetManager = widgetManager;
|
||||||
|
|
||||||
client->moveToThread(workerThread);
|
tcpClient->moveToThread(workerThread);
|
||||||
dataParser->moveToThread(workerThread);
|
dataParser->moveToThread(workerThread);
|
||||||
dataParserOutput->moveToThread(workerThread);
|
dataParserOutput->moveToThread(workerThread);
|
||||||
sendSystem->moveToThread(workerThread);
|
sendSystem->moveToThread(workerThread);
|
||||||
@@ -31,11 +32,8 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
|||||||
recognizeSystem->moveToThread(workerThread);
|
recognizeSystem->moveToThread(workerThread);
|
||||||
postProcessorSystem->moveToThread(workerThread);
|
postProcessorSystem->moveToThread(workerThread);
|
||||||
hashComparer->moveToThread(workerThread);
|
hashComparer->moveToThread(workerThread);
|
||||||
// versionContainer->moveToThread(workerThread); //проверить работоспособность
|
|
||||||
// resourceManager->moveToThread(workerThread); //проверить работоспособность
|
|
||||||
|
|
||||||
workerThread->start();
|
workerThread->start();
|
||||||
//workerThread->setPriority(QThread::HighestPriority);
|
|
||||||
|
|
||||||
binding();
|
binding();
|
||||||
initializeSystems();
|
initializeSystems();
|
||||||
@@ -46,6 +44,7 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
|||||||
|
|
||||||
void CoreManager::start()
|
void CoreManager::start()
|
||||||
{
|
{
|
||||||
|
saveServerSettingsWithConnect();
|
||||||
checkAppAvailable();
|
checkAppAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,14 +63,15 @@ void CoreManager::binding()
|
|||||||
{
|
{
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,widgetManager,&WidgetManager::slotActivateLoadAnimation,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,widgetManager,&WidgetManager::slotActivateLoadAnimation,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(this,&CoreManager::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
connect(this,&CoreManager::sigInitializeClient,tcpClient,&TCPClient::initialize,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSetConnect,tcpClient,&TCPClient::setConnect,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendCommand,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendCheckUpdate,sendSystem,&SendSystem::sendCheckHash,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendCheckUpdate,sendSystem,&SendSystem::sendCheckHash,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendXMLAnswer,sendSystem,&SendSystem::xmlAnswer,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendXMLAnswer,sendSystem,&SendSystem::xmlAnswer,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendAutorization,sendSystem,&SendSystem::sendClientAutorization);
|
connect(this,&CoreManager::sigSendAutorization,sendSystem,&SendSystem::sendClientAutorization);
|
||||||
|
|
||||||
connect(this,&CoreManager::sigSendUpdateToServer,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendUpdateToServer,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigGetConnected,client,&TCPClient::getIsConnected);
|
connect(this,&CoreManager::sigGetConnected,tcpClient,&TCPClient::getIsConnected);
|
||||||
connect(this,&CoreManager::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
|
connect(this,&CoreManager::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
|
||||||
|
|
||||||
connect(this,&CoreManager::sigSetLoadSettings,widgetManager,&WidgetManager::slotSetLoadSettings,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSetLoadSettings,widgetManager,&WidgetManager::slotSetLoadSettings,Qt::AutoConnection);
|
||||||
@@ -79,7 +79,7 @@ void CoreManager::binding()
|
|||||||
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigSocketDisabled,this,&CoreManager::lostConnection,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigSocketDisabled,this,&CoreManager::lostConnection,Qt::AutoConnection);
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigServerBlocked,this,&CoreManager::serverBlocked,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigServerBlocked,this,&CoreManager::serverBlocked,Qt::AutoConnection);
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection); // ОПАСНОСТЬ
|
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection);
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&CoreManager::checkLoginResult,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&CoreManager::checkLoginResult,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&CoreManager::setServerVersion,Qt::AutoConnection);
|
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&CoreManager::setServerVersion,Qt::AutoConnection);
|
||||||
@@ -89,19 +89,23 @@ void CoreManager::binding()
|
|||||||
connect(recognizeSystem,&RecognizeSystem::sigNeedUpdate,this,&CoreManager::checkNeedUpdate,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigNeedUpdate,this,&CoreManager::checkNeedUpdate,Qt::AutoConnection);
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigCheckUpdate,this,&CoreManager::checkUpdate,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigCheckUpdate,this,&CoreManager::checkUpdate,Qt::AutoConnection);
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigdRecalculateHashOnServerState,this,&CoreManager::recalculateState,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigdRecalculateHashOnServerState,this,&CoreManager::recalculateState,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigSendPacketType,this,&CoreManager::sendPacketType,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigSendPacketTypeWithDelay,sendSystem,&SendSystem::sendPacketTypeWithDelay,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigSendToInlineLog,this,&CoreManager::setInlineDebug,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(hashComparer,&HashComparer::sigCallCheck,this,&CoreManager::checkUpdate);
|
connect(hashComparer,&HashComparer::sigCallCheck,this,&CoreManager::checkUpdate);
|
||||||
connect(hashComparer,&HashComparer::sigHaveDelta,this,&CoreManager::checkUpdateInfo);
|
connect(hashComparer,&HashComparer::sigHaveDelta,this,&CoreManager::checkUpdateInfo);
|
||||||
|
|
||||||
connect(updateController,&UpdateController::sigUpdateComplete,widgetManager,&WidgetManager::setCompeteState,Qt::AutoConnection);//ОПАСНОСТЬ
|
connect(updateController,&UpdateController::sigUpdateComplete,widgetManager,&WidgetManager::setCompeteState,Qt::AutoConnection);
|
||||||
connect(updateController,&UpdateController::sigSendHashInfo,widgetManager->getMainWindow(),&MainWindow::updateInitInformation,Qt::AutoConnection);
|
connect(updateController->getHashCalculator(),&FastHashCalculator::sigSendHashInfo,widgetManager->getMainWindow(),&MainWindow::updateInitInformation,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(client,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);//ОПАСНОСТЬ
|
connect(tcpClient,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);
|
||||||
connect(client,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);//ОПАСНОСТЬ
|
connect(tcpClient,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(sendSystem,&SendSystem::sigSend,this,&CoreManager::calcUpdateProgress,Qt::AutoConnection);
|
connect(sendSystem,&SendSystem::sigSend,this,&CoreManager::calcUpdateProgress,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);//ОПАСНОСТЬ
|
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::initializeSystems()
|
void CoreManager::initializeSystems()
|
||||||
@@ -111,7 +115,7 @@ void CoreManager::initializeSystems()
|
|||||||
hashComparer->initialize(versionContainer,widgetManager->getUpdateWidget());
|
hashComparer->initialize(versionContainer,widgetManager->getUpdateWidget());
|
||||||
postProcessorSystem->initialize(dataParserOutput,hashComparer,versionContainer,updateController);
|
postProcessorSystem->initialize(dataParserOutput,hashComparer,versionContainer,updateController);
|
||||||
dataParser->initialize(postProcessorSystem);
|
dataParser->initialize(postProcessorSystem);
|
||||||
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem);
|
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem,client);
|
||||||
resourceManager->painting();
|
resourceManager->painting();
|
||||||
|
|
||||||
emit sigCalculateHash();
|
emit sigCalculateHash();
|
||||||
@@ -163,6 +167,7 @@ void CoreManager::callUpdateList()
|
|||||||
void CoreManager::lostConnection()
|
void CoreManager::lostConnection()
|
||||||
{
|
{
|
||||||
widgetManager->setLostConnectionState();
|
widgetManager->setLostConnectionState();
|
||||||
|
client->setIsLoggedIn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::serverBlocked()
|
void CoreManager::serverBlocked()
|
||||||
@@ -183,6 +188,7 @@ void CoreManager::setLocalVersion()
|
|||||||
version->setIsChangeable(currentSettings->versionData.getIsChangeable());
|
version->setIsChangeable(currentSettings->versionData.getIsChangeable());
|
||||||
|
|
||||||
versionContainer->setLocalVersionData(version);
|
versionContainer->setLocalVersionData(version);
|
||||||
|
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
||||||
@@ -195,16 +201,19 @@ void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
|||||||
setLocalVersion();
|
setLocalVersion();
|
||||||
widgetManager->setLoginSuccess();
|
widgetManager->setLoginSuccess();
|
||||||
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
||||||
|
client->setLogin(auth->ClientName);
|
||||||
|
client->setIsLoggedIn(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widgetManager->setLoginFailed();
|
widgetManager->setLoginFailed();
|
||||||
|
client->setIsLoggedIn(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::tryLogin()
|
void CoreManager::tryLogin()
|
||||||
{
|
{
|
||||||
if (!client->getIsConnected())
|
if (!tcpClient->getIsConnected())
|
||||||
{
|
{
|
||||||
widgetManager->getMainWindow()->showConnectionEmpty();
|
widgetManager->getMainWindow()->showConnectionEmpty();
|
||||||
return;
|
return;
|
||||||
@@ -220,13 +229,18 @@ void CoreManager::checkUpdate()
|
|||||||
{
|
{
|
||||||
widgetManager->activateLoadingAnimation(true);
|
widgetManager->activateLoadingAnimation(true);
|
||||||
emit sigSendCheckUpdate();
|
emit sigSendCheckUpdate();
|
||||||
widgetManager->getMainWindow()->setInlineDebug(tr("Проверка обновлений..."));
|
setInlineDebug(tr("Проверка обновлений..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::recalculateState()
|
void CoreManager::recalculateState()
|
||||||
{
|
{
|
||||||
widgetManager->activateLoadingAnimation(true);
|
widgetManager->activateLoadingAnimation(true);
|
||||||
widgetManager->getMainWindow()->setInlineDebug(tr("Пересчет хэша на сервере..."));
|
setInlineDebug(tr("Пересчет хэша на сервере..."));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoreManager::setInlineDebug(QString text)
|
||||||
|
{
|
||||||
|
widgetManager->getMainWindow()->setInlineDebug(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::checkAccessType(const QString& accessType)
|
void CoreManager::checkAccessType(const QString& accessType)
|
||||||
@@ -322,11 +336,9 @@ void CoreManager::undoCurrentChanges()
|
|||||||
isRecovery = true;
|
isRecovery = true;
|
||||||
widgetManager->setUndoCurrentChangesState();
|
widgetManager->setUndoCurrentChangesState();
|
||||||
emit sigSendCheckUpdate();
|
emit sigSendCheckUpdate();
|
||||||
emit sigSendCommand(PacketType::TYPE_UPDATE);
|
emit sigSendPacketType(PacketType::TYPE_UPDATE);
|
||||||
//тут был таймер
|
//тут был таймер
|
||||||
isRecovery = false;
|
isRecovery = false;
|
||||||
|
|
||||||
widgetManager->activateLoadingAnimation(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::startOffline()
|
void CoreManager::startOffline()
|
||||||
@@ -338,6 +350,11 @@ void CoreManager::startOffline()
|
|||||||
startUnityClient();
|
startUnityClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CoreManager::sendPacketType(PacketType packetType)
|
||||||
|
{
|
||||||
|
emit sigSendPacketType(packetType);
|
||||||
|
}
|
||||||
|
|
||||||
void CoreManager::saveServerSettingsWithConnect()
|
void CoreManager::saveServerSettingsWithConnect()
|
||||||
{
|
{
|
||||||
widgetManager->activateLoadingAnimation(true);
|
widgetManager->activateLoadingAnimation(true);
|
||||||
@@ -348,17 +365,17 @@ void CoreManager::saveServerSettingsWithConnect()
|
|||||||
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
|
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
|
||||||
dataParserOutput->createServerSettings(settings);
|
dataParserOutput->createServerSettings(settings);
|
||||||
|
|
||||||
if(client->getIsConnected())
|
if(tcpClient->getIsConnected())
|
||||||
{
|
{
|
||||||
|
emit sigSendXMLAnswer(cmd_Disable);
|
||||||
|
tcpClient->setDisconnect();
|
||||||
entryWidget->showLoginWidget(true);
|
entryWidget->showLoginWidget(true);
|
||||||
widgetManager->getMainWindow()->showOfflineButton(true);
|
widgetManager->getMainWindow()->showOfflineButton(true);
|
||||||
widgetManager->activateLoadingAnimation(false);
|
widgetManager->activateLoadingAnimation(false);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
emit sigSetConnect(settings);
|
emit sigSetConnect(settings);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void CoreManager::checkAppAvailable()
|
void CoreManager::checkAppAvailable()
|
||||||
{
|
{
|
||||||
@@ -384,7 +401,7 @@ void CoreManager::setLanguage(const QString& language)
|
|||||||
void CoreManager::exit()
|
void CoreManager::exit()
|
||||||
{
|
{
|
||||||
emit sigSendXMLAnswer(cmd_Disable);
|
emit sigSendXMLAnswer(cmd_Disable);
|
||||||
client->disconnect();
|
tcpClient->disconnect();
|
||||||
|
|
||||||
workerThread->quit();
|
workerThread->quit();
|
||||||
workerThread->wait();
|
workerThread->wait();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <Core/hashcomparer.h>
|
#include <Core/hashcomparer.h>
|
||||||
#include <Core/versioncontainer.h>
|
#include <Core/versioncontainer.h>
|
||||||
#include <widgetmanager.h>
|
#include <widgetmanager.h>
|
||||||
|
#include <Data/Client.h>
|
||||||
|
|
||||||
#include <UI/resourcemanager.h>
|
#include <UI/resourcemanager.h>
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ public:
|
|||||||
void startUnityClient();
|
void startUnityClient();
|
||||||
void tryLogin();
|
void tryLogin();
|
||||||
void startOffline();
|
void startOffline();
|
||||||
|
void sendPacketType(PacketType packetType);
|
||||||
|
|
||||||
void saveServerSettingsWithConnect();
|
void saveServerSettingsWithConnect();
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ public:
|
|||||||
void recalculateState();
|
void recalculateState();
|
||||||
signals:
|
signals:
|
||||||
void sigInitializeClient(RecognizeSystem *recognize,SendSystem *sendSystem);
|
void sigInitializeClient(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||||
void sigSendCommand(PacketType packetType);
|
void sigSendPacketType(PacketType packetType);
|
||||||
void sigSendXMLAnswer(QString answer);
|
void sigSendXMLAnswer(QString answer);
|
||||||
void sigSetConnect(ServerSettings* serverSettings);
|
void sigSetConnect(ServerSettings* serverSettings);
|
||||||
void sigCalculateHash();
|
void sigCalculateHash();
|
||||||
@@ -59,11 +61,12 @@ signals:
|
|||||||
bool sigGetConnected();
|
bool sigGetConnected();
|
||||||
void sigSendUpdateToServer();
|
void sigSendUpdateToServer();
|
||||||
|
|
||||||
|
|
||||||
void sigSetLoadSettings(ServerSettings *serverSettings);
|
void sigSetLoadSettings(ServerSettings *serverSettings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
TCPClient *client;
|
TCPClient *tcpClient;
|
||||||
DataParser *dataParser;
|
DataParser *dataParser;
|
||||||
DataParserOutput *dataParserOutput;
|
DataParserOutput *dataParserOutput;
|
||||||
UpdateController *updateController;
|
UpdateController *updateController;
|
||||||
@@ -75,6 +78,7 @@ private:
|
|||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
ResourceManager *resourceManager;
|
ResourceManager *resourceManager;
|
||||||
PostProcessorSystem *postProcessorSystem;
|
PostProcessorSystem *postProcessorSystem;
|
||||||
|
Client *client;
|
||||||
|
|
||||||
WidgetManager *widgetManager;
|
WidgetManager *widgetManager;
|
||||||
|
|
||||||
@@ -101,6 +105,7 @@ private:
|
|||||||
void checkNeedUpdate(bool flag, quint64 size, quint64 fileCount, quint64 deleteCount);
|
void checkNeedUpdate(bool flag, quint64 size, quint64 fileCount, quint64 deleteCount);
|
||||||
void checkUpdate();
|
void checkUpdate();
|
||||||
|
|
||||||
|
void setInlineDebug(QString text);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COREMANAGER_H
|
#endif // COREMANAGER_H
|
||||||
|
|||||||
2
mathModelConfig.xml
Normal file
2
mathModelConfig.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<MathModelSettings SendIP="10.100.7.255" SendPortMath="18004" ListenIP="10.100.7.9" LocalPortMath="18003" />
|
||||||
2
path.txt
Normal file
2
path.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
D:/QT/Projects/RRJClient/path.txt
|
||||||
|
D:/QT/Projects/RRJClient/Application/RRJLoader/RRJ_Data/StreamingAssets
|
||||||
@@ -106,6 +106,7 @@ void WidgetManager::setNeedUpdateState(quint64 size, quint64 fileCount,quint64 d
|
|||||||
result = tr("Файлов к удалению: ") + QString::number(deleteCount);
|
result = tr("Файлов к удалению: ") + QString::number(deleteCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateWidget->closeWindow();
|
||||||
mainWindow->setNeedUpdateState(result);
|
mainWindow->setNeedUpdateState(result);
|
||||||
commonButtonGroupWidget->needUpdateState(true);
|
commonButtonGroupWidget->needUpdateState(true);
|
||||||
waitAnimationWidget->hideWithStop();
|
waitAnimationWidget->hideWithStop();
|
||||||
@@ -157,10 +158,11 @@ void WidgetManager::setServerDisconnectState()
|
|||||||
|
|
||||||
void WidgetManager::setUndoCurrentChangesState()
|
void WidgetManager::setUndoCurrentChangesState()
|
||||||
{
|
{
|
||||||
|
waitAnimationWidget->showWithPlay();
|
||||||
mainWindow->undoCurrentChanges();
|
mainWindow->undoCurrentChanges();
|
||||||
updateWidget->hide();
|
updateWidget->hide();
|
||||||
commonButtonGroupWidget->showProgressBar(false);
|
commonButtonGroupWidget->showProgressBar(false);
|
||||||
waitAnimationWidget->showWithPlay();
|
//waitAnimationWidget->hideWithStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetManager::showMainFrame(bool flag)
|
void WidgetManager::showMainFrame(bool flag)
|
||||||
|
|||||||
Reference in New Issue
Block a user