mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
918d391a68 | ||
|
|
775f5cd0a4 | ||
|
|
75a93e346b | ||
|
|
4e15a439ee | ||
|
|
9e202f8e5d | ||
|
|
c23f3d519b | ||
|
|
14c1ffb66f | ||
|
|
5b63141ddf | ||
|
|
6665f417c9 | ||
|
|
633881847b | ||
|
|
a2e64ecb68 | ||
|
|
4829647e98 | ||
|
|
b706de2961 | ||
|
|
a4d4709118 | ||
|
|
60c3d6244e | ||
|
|
c9c62d22c0 |
37
ClientMPS_resource.rc
Normal file
37
ClientMPS_resource.rc
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <windows.h>
|
||||
|
||||
IDI_ICON1 ICON DISCARDABLE "D:\\QT\\Projects\\RRJClient\\resource\\Icons\\planeCustomIco.ico"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,0,0,0
|
||||
PRODUCTVERSION 0,0,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "\0"
|
||||
VALUE "FileVersion", "0.0.0.0\0"
|
||||
VALUE "LegalCopyright", "\0"
|
||||
VALUE "OriginalFilename", "ClientMPS.exe\0"
|
||||
VALUE "ProductName", "ClientMPS\0"
|
||||
VALUE "ProductVersion", "0.0.0.0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 1200
|
||||
END
|
||||
END
|
||||
/* End of Version info */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "UpdateController.h"
|
||||
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QThread>
|
||||
|
||||
UpdateController::UpdateController(QObject *parent) :
|
||||
@@ -8,6 +9,7 @@ UpdateController::UpdateController(QObject *parent) :
|
||||
versionContainer(nullptr)
|
||||
{
|
||||
applicationFolderPath = QDir::currentPath() + applicationFolderName;
|
||||
hashCalculator = new FastHashCalculator;
|
||||
}
|
||||
|
||||
void UpdateController::initialize(VersionContainer *versionContainer,DataParserOutput *dataParserOut, SendSystem *sendSystem)
|
||||
@@ -20,18 +22,26 @@ void UpdateController::initialize(VersionContainer *versionContainer,DataParserO
|
||||
void UpdateController::calculateCommonHash()
|
||||
{
|
||||
appDataList.clear();
|
||||
appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
qDebug() << "Start calculate... ";
|
||||
|
||||
hashCalculator->calculateHashes(applicationFolderPath,"StreamingAssets");
|
||||
appDataList = *hashCalculator->getHashList();
|
||||
calculateStreamingHash();
|
||||
appDataList.append(streamingDataList);
|
||||
|
||||
qDebug() << "Hash count: " << appDataList.count() ;
|
||||
dataParserOut->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
||||
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
||||
qDebug() <<"Calculate time " << timer.elapsed();
|
||||
}
|
||||
|
||||
void UpdateController::calculateStreamingHash()
|
||||
{
|
||||
streamingDataList.clear();
|
||||
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
||||
std::sort(streamingDataList.begin(),streamingDataList.end());
|
||||
hashCalculator->calculateHashes(QDir::currentPath() + streamingAssetsPath,"");
|
||||
streamingDataList = *hashCalculator->getHashList();
|
||||
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
||||
}
|
||||
|
||||
@@ -45,7 +55,6 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
||||
}
|
||||
|
||||
QList<FileData> *hashes = new QList<FileData>;
|
||||
QString fullSize = Tools::convertFileSize(getDirectorySize(path),false);
|
||||
quint64 currentSize = 0;
|
||||
|
||||
QStringList filter;
|
||||
@@ -82,9 +91,9 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
||||
|
||||
currentSize += fileInfo.size();
|
||||
|
||||
emit sigSendHashInfo(fullSize,Tools::convertFileSize(currentSize,false));
|
||||
|
||||
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
||||
const quint64 bufferSize = 10240;
|
||||
const quint64 bufferSize = 1024;
|
||||
|
||||
if(fileInfo.isHidden()) continue;
|
||||
if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
||||
@@ -115,24 +124,6 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
||||
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){
|
||||
|
||||
QListIterator<FileData> serverIterator(*fileSendList);
|
||||
@@ -155,8 +146,7 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
||||
}
|
||||
|
||||
calculateCommonHash();
|
||||
sendSystem->sendFinish();
|
||||
|
||||
sendSystem->sendPacketType(PacketType::RECALCULATE_DOCS);
|
||||
emit sigUpdateComplete(true);
|
||||
}
|
||||
catch (...)
|
||||
@@ -166,6 +156,11 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
||||
|
||||
}
|
||||
|
||||
FastHashCalculator *UpdateController::getHashCalculator() const
|
||||
{
|
||||
return hashCalculator;
|
||||
}
|
||||
|
||||
|
||||
UpdateController::~UpdateController()
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Core/sendsystem.h"
|
||||
#include "Core/versioncontainer.h"
|
||||
#include "fasthashcalculator.h"
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamAttribute>
|
||||
@@ -34,19 +35,21 @@ public:
|
||||
void updateFilesOnServer(QList<FileData> *fileSendList);
|
||||
void checkCanUpdate();
|
||||
|
||||
FastHashCalculator *getHashCalculator() const;
|
||||
|
||||
signals:
|
||||
void sigUpdateComplete(bool flag);
|
||||
void sigSendHashInfo(QString fullSize,QString current);
|
||||
|
||||
private:
|
||||
SendSystem *sendSystem;
|
||||
DataParserOutput * dataParserOut;
|
||||
FastHashCalculator* hashCalculator;
|
||||
QString applicationFolderPath;
|
||||
VersionContainer *versionContainer;
|
||||
QList<FileData> appDataList;
|
||||
QList<FileData> streamingDataList;
|
||||
|
||||
QList<FileData> calculateHash(const QString& path,const QString& ignoreName);
|
||||
quint64 getDirectorySize(const QString &path);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ void DataParser::initialize(PostProcessorSystem *postProcessSystem)
|
||||
}
|
||||
|
||||
|
||||
ServerSettings *DataParser::getClientSettings()
|
||||
Settings *DataParser::getSettings()
|
||||
{
|
||||
ServerSettings *settings = new ServerSettings;
|
||||
Settings *settings = new Settings;
|
||||
QFile file(settingsName);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QXmlStreamReader xmlReader(&file);
|
||||
@@ -95,9 +95,10 @@ ServerSettings *DataParser::getClientSettings()
|
||||
return settings;
|
||||
}
|
||||
|
||||
void DataParser::xmlParser(const QByteArray& array)
|
||||
bool DataParser::xmlParser(const QByteArray& array)
|
||||
{
|
||||
QXmlStreamReader xmlReader(array);
|
||||
bool result = false;
|
||||
|
||||
xmlReader.readNext();
|
||||
|
||||
@@ -134,14 +135,29 @@ void DataParser::xmlParser(const QByteArray& array)
|
||||
|
||||
if (value == "UNCHANGEABLE")
|
||||
{
|
||||
//версию нельзя изменять
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (value == "CHANGEABLE")
|
||||
{
|
||||
postProcessSystem->compareFiles();
|
||||
//emit sigUpdateFilesOnServer(hashComparer->getFilesForUpdate());
|
||||
}
|
||||
|
||||
if (value == "ERROR_AUTH_ARCHIVED")
|
||||
{
|
||||
postProcessSystem->userArchived();
|
||||
}
|
||||
|
||||
if (value == "ERROR_AUTH_LOGINORPASSWORD")
|
||||
{
|
||||
postProcessSystem->wrongLoginOrPass();
|
||||
}
|
||||
|
||||
if (value == "ERROR_AUTH_ALREADYLOGIN")
|
||||
{
|
||||
postProcessSystem->alreadyLogin();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +243,7 @@ void DataParser::xmlParser(const QByteArray& array)
|
||||
QString name = attr.name().toString();
|
||||
QString value = attr.value().toString();
|
||||
|
||||
if(name == "Version")
|
||||
if (name == "Version")
|
||||
data->setName(value);
|
||||
else if(name == "Created")
|
||||
data->setCreateData(QDateTime::fromString(value));
|
||||
@@ -247,4 +263,5 @@ void DataParser::xmlParser(const QByteArray& array)
|
||||
|
||||
xmlReader.readNext();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <QObject>
|
||||
#include <QDomDocument>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <Data/FileData.h>
|
||||
#include <Data/Datas.h>
|
||||
#include <Data/FileData.h>
|
||||
#include <Core/tools.h>
|
||||
@@ -21,8 +20,8 @@ public:
|
||||
~DataParser() = default;
|
||||
|
||||
void initialize(PostProcessorSystem *postProcessSystem);
|
||||
ServerSettings* getClientSettings();
|
||||
void xmlParser(const QByteArray& array);
|
||||
Settings* getSettings();
|
||||
bool xmlParser(const QByteArray& array);
|
||||
private:
|
||||
PostProcessorSystem *postProcessSystem;
|
||||
};
|
||||
|
||||
@@ -77,7 +77,6 @@ QByteArray DataParserOutput::xmlAnswer(const QList<SXmlAnswerTag>& listTag, cons
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,const QString& filename)
|
||||
{
|
||||
QFile file(filename);
|
||||
@@ -126,9 +125,10 @@ void DataParserOutput::createAuthMessage(ClientAutorization *auth)
|
||||
file.close();
|
||||
}
|
||||
|
||||
void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
||||
void DataParserOutput::createServerSettings()
|
||||
{
|
||||
QFile file(settingsName);
|
||||
if (file.exists()) return;
|
||||
|
||||
file.open(QIODevice::WriteOnly);
|
||||
|
||||
@@ -140,13 +140,43 @@ void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
||||
xmlWriter.writeStartElement("ServerSettingsContainer");
|
||||
xmlWriter.writeStartElement("ServerSettings");
|
||||
|
||||
xmlWriter.writeAttribute("Address","");
|
||||
xmlWriter.writeAttribute("Port","");
|
||||
xmlWriter.writeAttribute("Language","RUS");
|
||||
xmlWriter.writeAttribute("AutoStart",QString::number(false));
|
||||
|
||||
xmlWriter.writeEndElement();
|
||||
|
||||
xmlWriter.writeStartElement("VersionData");
|
||||
xmlWriter.writeAttribute("Version","-----");
|
||||
xmlWriter.writeAttribute("isChangable","0");
|
||||
xmlWriter.writeEndElement();
|
||||
|
||||
xmlWriter.writeEndElement();
|
||||
|
||||
xmlWriter.writeEndDocument();
|
||||
|
||||
file.close();
|
||||
|
||||
}
|
||||
|
||||
void DataParserOutput::updateServerSettings(Settings* 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();
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ public:
|
||||
explicit DataParserOutput(QObject *parent = 0);
|
||||
void createFileDataList(const QList<FileData>& fileDataList,const QString& filename);
|
||||
void createAuthMessage(ClientAutorization *auth);
|
||||
void createServerSettings(ServerSettings *serverSettings);
|
||||
void createServerSettings();
|
||||
void updateServerSettings(Settings *serverSettings);
|
||||
void changeVersion(StreamingVersionData *versionData);
|
||||
void createAuthData(ServerAuthorization *serverAuth);
|
||||
void createAuthDataOffline(const QString& username,const QString& pass);
|
||||
|
||||
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 (item.path.contains("docs.xml")) continue; //фильтр на docs
|
||||
files->append(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,29 @@ void PostProcessorSystem::initialize(DataParserOutput *dataParserOutput,
|
||||
|
||||
}
|
||||
|
||||
void PostProcessorSystem::userArchived()
|
||||
{
|
||||
emit sigShowError(ErrorsEnum::ARCHIVED);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::wrongLoginOrPass()
|
||||
{
|
||||
emit sigShowError(ErrorsEnum::LOGIN_OR_PASS);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::alreadyLogin()
|
||||
{
|
||||
emit sigShowError(ErrorsEnum::ALREADYLOGIN);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::socketDisable()
|
||||
{
|
||||
emit sigSocketDisabled();
|
||||
emit sigShowError(ErrorsEnum::DISABLE);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::serverBlocked()
|
||||
{
|
||||
emit sigServerBlocked();
|
||||
emit sigShowError(ErrorsEnum::BLOCKED);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::startCompare()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "UpdateController.h"
|
||||
#include <QObject>
|
||||
#include <Data/Datas.h>
|
||||
#include <Data/ErrorsEnum.h>
|
||||
|
||||
class PostProcessorSystem : public QObject
|
||||
{
|
||||
@@ -24,9 +25,11 @@ public:
|
||||
void saveLoginData(ServerAuthorization *auth);
|
||||
void setServerVersion(StreamingVersionData *serverVersion);
|
||||
void calculateCommonHash();
|
||||
void userArchived();
|
||||
void wrongLoginOrPass();
|
||||
void alreadyLogin();
|
||||
signals:
|
||||
void sigSocketDisabled();
|
||||
void sigServerBlocked();
|
||||
void sigShowError(ErrorsEnum error);
|
||||
void sigStartCompare(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash);
|
||||
void sigCallUpdateList();
|
||||
void sigSaveLoginData(ServerAuthorization *serverAuth);
|
||||
|
||||
@@ -14,11 +14,12 @@ RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||
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->postProcessorSystem = postProcessorSystem;
|
||||
this->dataParser = dataParser;
|
||||
this->client = client;
|
||||
}
|
||||
|
||||
void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
@@ -38,7 +39,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
stream.startTransaction();
|
||||
stream >> packetType;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
if(!stream.commitTransaction())
|
||||
{
|
||||
emit sigSendDebugLog(Tools::getTime() + " CLIENT: packetType - FAIL commitTransaction");
|
||||
|
||||
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
||||
@@ -205,15 +207,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
|
||||
}
|
||||
|
||||
if (packetType ==PacketType::TYPE_FINISH) //для повторного создания хэша после загрузки
|
||||
{
|
||||
postProcessorSystem->calculateCommonHash();
|
||||
|
||||
emit sigLoadComplete();
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_NEEDUPDATE){ //нужно обновление
|
||||
if(packetType == PacketType::TYPE_NEEDUPDATE)
|
||||
{ //нужно обновление
|
||||
|
||||
bool flag = false;
|
||||
quint64 size = 0;
|
||||
@@ -251,10 +246,9 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
if(packetType == PacketType::HASH_READY)
|
||||
{
|
||||
emit sigCheckUpdate();
|
||||
//mainWindow->checkUpdate();
|
||||
}
|
||||
|
||||
if(packetType == PacketType::HASH_CALCULATE_START)
|
||||
if(packetType == PacketType::RECALCULATE_HASH)
|
||||
{
|
||||
emit sigdRecalculateHashOnServerState();
|
||||
}
|
||||
@@ -269,6 +263,22 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QThread>
|
||||
#include <Core\tools.h>
|
||||
#include <Core\versioncontainer.h>
|
||||
#include <Data/Client.h>
|
||||
#include <Data\streamingversiondata.h>
|
||||
#include <Core\hashcomparer.h>
|
||||
|
||||
@@ -20,7 +21,7 @@ class RecognizeSystem : public QObject
|
||||
public:
|
||||
explicit RecognizeSystem(QObject *parent = 0);
|
||||
~RecognizeSystem(){};
|
||||
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem);
|
||||
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem,Client *client);
|
||||
void recognize(QTcpSocket *socket);
|
||||
signals:
|
||||
void sigUpdateBytesAvailable();
|
||||
@@ -30,6 +31,10 @@ signals:
|
||||
void sigAnimationActivated(bool flag);
|
||||
void sigCheckUpdate();
|
||||
void sigdRecalculateHashOnServerState();
|
||||
void sigSendPacketType(PacketType packetType);
|
||||
void sigSendPacketTypeWithDelay(PacketType packetType,int delay);
|
||||
void sigSendToInlineLog(QString message);
|
||||
void sigCallUpdateList();
|
||||
|
||||
private:
|
||||
VersionContainer *versionContainer;
|
||||
@@ -38,6 +43,7 @@ private:
|
||||
PacketType packetType;
|
||||
QString filePath;
|
||||
QByteArray tmpBlock;
|
||||
Client *client;
|
||||
|
||||
qint64 sizeReceiveData;
|
||||
qint64 fileSize;
|
||||
|
||||
@@ -157,16 +157,6 @@ void SendSystem::sendXMLAnswer(const QByteArray& array)
|
||||
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)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
@@ -175,12 +165,47 @@ void SendSystem::sendPacketType(PacketType 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()
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
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);
|
||||
stream << PacketType::TYPE_CHECK_VERSION;
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
void sendCheckHash();
|
||||
void sendPacketType(PacketType packetType);
|
||||
~SendSystem(){};
|
||||
void sendPacketTypeWithDelay(PacketType packetType, int delay);
|
||||
signals:
|
||||
void sigSend();
|
||||
QByteArray sigGetXmlAnswer(QString);
|
||||
|
||||
@@ -17,7 +17,7 @@ void TCPClient::initialize(RecognizeSystem *recognize,SendSystem *sendSystem)
|
||||
emit sigSendDebugLog(Tools::getTime() + " Client started");
|
||||
}
|
||||
|
||||
void TCPClient::setConnect(ServerSettings *serverSettings)
|
||||
void TCPClient::setConnect(Settings *serverSettings)
|
||||
{
|
||||
socket = new QTcpSocket();
|
||||
qDebug() << "TCPCLient thread: " << thread();
|
||||
@@ -47,7 +47,6 @@ void TCPClient::setConnect(ServerSettings *serverSettings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TCPClient::setDisconnect()
|
||||
{
|
||||
socket->disconnect();
|
||||
|
||||
@@ -21,9 +21,9 @@ class TCPClient : public QObject
|
||||
public:
|
||||
explicit TCPClient(QObject *parent = 0);
|
||||
void initialize(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||
void setConnect(ServerSettings *serverSettings);
|
||||
void setConnect(Settings *serverSettings);
|
||||
~TCPClient(){};
|
||||
|
||||
void setDisconnect();
|
||||
bool getIsConnected() const;
|
||||
|
||||
signals:
|
||||
@@ -43,8 +43,6 @@ private:
|
||||
QTcpSocket *socket;
|
||||
RecognizeSystem *recognizeSystem;
|
||||
bool isConnected;
|
||||
|
||||
void setDisconnect();
|
||||
};
|
||||
|
||||
#endif // TCPCLIENT_H
|
||||
|
||||
@@ -12,12 +12,12 @@ QString Tools::getTime()
|
||||
|
||||
QString Tools::createLocalPath(QString path)
|
||||
{
|
||||
qDebug() << "Full path: " << path;
|
||||
//qDebug() << "Full path: " << path;
|
||||
qint8 pos = path.indexOf("Application");
|
||||
|
||||
QString localPath = path.remove(0,--pos);
|
||||
|
||||
qDebug() << "Local path: " << localPath;
|
||||
//qDebug() << "Local path: " << localPath;
|
||||
return localPath;
|
||||
}
|
||||
|
||||
|
||||
10
Core/tools.h
10
Core/tools.h
@@ -39,13 +39,16 @@ enum PacketType{
|
||||
TYPE_COMMAND = 3,
|
||||
TYPE_FOLDER = 4,
|
||||
TYPE_DELETE = 5,
|
||||
TYPE_FINISH = 6,
|
||||
UPDATE_FILE_COMPLETE = 6,
|
||||
TYPE_NEEDUPDATE = 7,
|
||||
TYPE_XMLANSWER = 8,
|
||||
TYPE_QT = 9,
|
||||
TYPE_DISABLE = 11,
|
||||
TYPE_UPDATE = 12,
|
||||
TYPE_CHECK_VERSION = 13,
|
||||
UPDATE_DOCS_COMPLETE = 22,
|
||||
|
||||
TYPE_XMLANSWER_DOCS_CHANGED = 132,
|
||||
|
||||
HASH_READY = 150,
|
||||
CHANGE_DATA_VERSION = 151,
|
||||
@@ -53,7 +56,10 @@ enum PacketType{
|
||||
DELETE_DATA_VERSION = 153,
|
||||
BUSY = 154,
|
||||
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
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
class ServerSettings{
|
||||
class Settings{
|
||||
public:
|
||||
QString Address;
|
||||
QString Port;
|
||||
QString Language;
|
||||
QString LocalVersionName;
|
||||
StreamingVersionData versionData;
|
||||
bool isAutoStart;
|
||||
bool isAutoStart = false;
|
||||
bool mathModelUse;
|
||||
};
|
||||
|
||||
|
||||
13
Data/ErrorsEnum.h
Normal file
13
Data/ErrorsEnum.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef ERRORSENUM_H
|
||||
#define ERRORSENUM_H
|
||||
|
||||
enum ErrorsEnum
|
||||
{
|
||||
BLOCKED,
|
||||
ARCHIVED,
|
||||
LOGIN_OR_PASS,
|
||||
ALREADYLOGIN,
|
||||
DISABLE
|
||||
};
|
||||
|
||||
#endif // ERRORSENUM_H
|
||||
@@ -1,11 +1,10 @@
|
||||
QT += core gui
|
||||
QT += network
|
||||
QT += xml
|
||||
QT += concurrent
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
@@ -19,6 +18,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += \
|
||||
Core/dataparseroutput.cpp \
|
||||
Core/fasthashcalculator.cpp \
|
||||
Core/notifycontroller.cpp \
|
||||
Core/postprocessorsystem.cpp \
|
||||
Core/sendsystem.cpp \
|
||||
@@ -46,6 +46,7 @@ SOURCES += \
|
||||
|
||||
HEADERS += \
|
||||
Core/dataparseroutput.h \
|
||||
Core/fasthashcalculator.h \
|
||||
Core/notifycontroller.h \
|
||||
Core/postprocessorsystem.h \
|
||||
Core/versioncontainer.h \
|
||||
@@ -58,6 +59,8 @@ HEADERS += \
|
||||
Core\tcpclient.h\
|
||||
Core\tools.h\
|
||||
Core\hashcomparer.h \
|
||||
Data/Client.h \
|
||||
Data/ErrorsEnum.h \
|
||||
Data/monitorInfo.h \
|
||||
Data/streamingversiondata.h \
|
||||
Data\FileData.h\
|
||||
@@ -85,11 +88,15 @@ FORMS += \
|
||||
TRANSLATIONS = QtLanguage_ru.ts\
|
||||
QtLanguage_eng.ts
|
||||
|
||||
#TEMPLATE = subdirs
|
||||
#SUBDIRS += Unit-tests\
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
TARGET = ClientMPS
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
||||
|
||||
9980
StaticData/clientHash.xml
Normal file
9980
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;"/>
|
||||
9960
StaticData/serverHash.xml
Normal file
9960
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 AutoStart="0" Port="6000" Address="192.168.100.134" Language="RUS"/>
|
||||
<VersionData Created="Пн дек 22 15:46:11 2025" isChangable="1" Version="max2"/>
|
||||
</ServerSettingsContainer>
|
||||
9774
StaticData/streamingHash.xml
Normal file
9774
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()
|
||||
{
|
||||
show();
|
||||
ui->updateButton->setEnabled(false);
|
||||
ui->updateButton->hide();
|
||||
ui->startButton->setEnabled(true);
|
||||
ui->loadingProgressBar->setValue(100);
|
||||
ui->startButton->show();
|
||||
@@ -66,6 +66,8 @@ void CommonButtonGroupWidget::showProgressBar(bool flag)
|
||||
|
||||
void CommonButtonGroupWidget::needUpdateState(bool flag)
|
||||
{
|
||||
show();
|
||||
ui->loadingProgressBar->hide();
|
||||
ui->startButton->hide();
|
||||
ui->updateButton->setEnabled(flag);
|
||||
ui->updateButton->show();
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include "entrywidget.h"
|
||||
#include "ui_entrywidget.h"
|
||||
|
||||
#include <bits/functional_hash.h>
|
||||
|
||||
#include <QCryptographicHash>
|
||||
|
||||
EntryWidget::EntryWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::EntryWidget)
|
||||
@@ -34,7 +38,9 @@ ClientAutorization* EntryWidget::getAuthData()
|
||||
QString username = ui->loginInputField->text();
|
||||
QString password = ui->passwordInputField->text();
|
||||
data->Login = username;
|
||||
data->Password = password;
|
||||
|
||||
QByteArray md5Hash = QCryptographicHash::hash(password.toUtf8(), QCryptographicHash::Md5).toHex();
|
||||
data->Password = QString(md5Hash);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -59,21 +65,7 @@ void EntryWidget::on_saveServerButton_clicked()
|
||||
emit sigSaveServerSettings();
|
||||
}
|
||||
|
||||
ServerSettings *EntryWidget::getServerSettings()
|
||||
{
|
||||
ServerSettings *data = new ServerSettings;
|
||||
QString server = ui->serverInputField->text();
|
||||
QString port = ui->portInputField->text();
|
||||
//bool checked = ui->mathModelUsecheckBox->isChecked();
|
||||
|
||||
data->Address = server;
|
||||
data->Port = port;
|
||||
data->mathModelUse = true;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void EntryWidget::fillSettings(ServerSettings *settings)
|
||||
void EntryWidget::fillSettings(Settings *settings)
|
||||
{
|
||||
ui->serverInputField->setText(settings->Address);
|
||||
ui->portInputField->setText(settings->Port);
|
||||
@@ -91,6 +83,14 @@ bool EntryWidget::getLoginWidgetIsHidden()
|
||||
return ui->loginWidget->isHidden();
|
||||
}
|
||||
|
||||
QString EntryWidget::getAddress(){
|
||||
return ui->serverInputField->text();
|
||||
}
|
||||
|
||||
QString EntryWidget::getPort(){
|
||||
return ui->portInputField->text();
|
||||
}
|
||||
|
||||
|
||||
EntryWidget::~EntryWidget()
|
||||
{
|
||||
|
||||
@@ -20,13 +20,13 @@ public:
|
||||
void showLoginWidget(bool flag);
|
||||
|
||||
void disconnectState();
|
||||
void fillSettings(ServerSettings *settings);
|
||||
void fillSettings(Settings *settings);
|
||||
void isActive(bool flag);
|
||||
bool getLoginWidgetIsHidden();
|
||||
|
||||
ServerSettings *getServerSettings();
|
||||
ClientAutorization* getAuthData();
|
||||
|
||||
QString getAddress();
|
||||
QString getPort();
|
||||
signals:
|
||||
void sigTryLogin();
|
||||
void sigSaveServerSettings();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Core/tools.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
UpdateNotifyWidget::UpdateNotifyWidget(QWidget *) :
|
||||
ui(new Ui::UpdateNotifyWidget)
|
||||
@@ -37,15 +38,18 @@ void UpdateNotifyWidget::addToList(FileData fileData)
|
||||
void UpdateNotifyWidget::showTryChangeBase()
|
||||
{
|
||||
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("Чтобы выгрузить на сервер нужно:")));
|
||||
ui->labelsLayout->addWidget(createLabel(tr("1. Скопировать измененные или созданные файлы в временную папку")));
|
||||
QLabel *labelStorage = new QLabel;
|
||||
QString link2 = "<a href=\""+ path + "\"style=\"color:white;\">тут</a>";
|
||||
labelStorage->setText(tr("Файлы можно найти в ") + link2 );
|
||||
QString link2 = "<a href=\""+ path + "\"style=\"color:lightblue; text-decoration: underline;\">тут</a>";
|
||||
labelStorage->setText(tr("Файлы можно найти в ") + link2);
|
||||
labelStorage->setTextFormat(Qt::RichText);
|
||||
labelStorage->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
labelStorage->setOpenExternalLinks(true);
|
||||
|
||||
ui->labelsLayout->addWidget(labelStorage);
|
||||
ui->labelsLayout->addWidget(createLabel(tr("2. Нажать Отменить изменения и дождатся окончания операции")));
|
||||
ui->labelsLayout->addWidget(createLabel(tr("3. Изменить версию сервера на изменяемую")));
|
||||
@@ -55,6 +59,8 @@ void UpdateNotifyWidget::showTryChangeBase()
|
||||
QLabel *linkLabel = new QLabel;
|
||||
linkLabel->setText(tr("5. Скопировать файлы из временной папки в эту ") + link);
|
||||
linkLabel->setOpenExternalLinks(true);
|
||||
linkLabel->setTextFormat(Qt::RichText);
|
||||
linkLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
|
||||
ui->labelsLayout->addWidget(linkLabel);
|
||||
ui->labelsLayout->addWidget(createLabel(tr("6.Перезапустить клиент и выгрузить изменения на сервер")));
|
||||
@@ -66,11 +72,7 @@ void UpdateNotifyWidget::showWithFill()
|
||||
{
|
||||
clearList();
|
||||
|
||||
if(!versionContainer->getLocalVersionData()->getIsChangeable())
|
||||
{
|
||||
showTryChangeBase();
|
||||
}
|
||||
else if(!versionContainer->getServerVersionData()->getIsChangeable())
|
||||
if(!versionContainer->getServerVersionData()->getIsChangeable())
|
||||
{
|
||||
showTryChangeBase();
|
||||
}
|
||||
@@ -117,6 +119,11 @@ void UpdateNotifyWidget::on_startWithCurrentChangesButton_clicked()
|
||||
emit sigStartUnityClient();
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::closeWindow()
|
||||
{
|
||||
on_closeButton_clicked();
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::setUpdateState()
|
||||
{
|
||||
ui->undoChangesButton->show();
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
void showWithFill();
|
||||
void showTryChangeBase();
|
||||
void setVersionContainer(VersionContainer *versionContainer);
|
||||
void closeWindow();
|
||||
signals:
|
||||
void sigLoadToServerBehaviour();
|
||||
void sigUndoCurrentChanges();
|
||||
|
||||
@@ -11,6 +11,7 @@ Bootstrap::Bootstrap(QObject *parent) : QObject(parent)
|
||||
void Bootstrap::initialize()
|
||||
{
|
||||
qRegisterMetaType<PacketType>("PacketType");
|
||||
qRegisterMetaType<ErrorsEnum>("ErrorsEnum");
|
||||
|
||||
widgetManager->initialize();
|
||||
coreManager->initialize(widgetManager, workerThread);
|
||||
|
||||
132
coremanager.cpp
132
coremanager.cpp
@@ -4,7 +4,7 @@ CoreManager::CoreManager(QObject *parent) :
|
||||
QObject(parent),
|
||||
isRecovery(false)
|
||||
{
|
||||
client = new TCPClient;
|
||||
tcpClient = new TCPClient;
|
||||
dataParser = new DataParser;
|
||||
dataParserOutput = new DataParserOutput;
|
||||
updateController = new UpdateController;
|
||||
@@ -16,14 +16,18 @@ CoreManager::CoreManager(QObject *parent) :
|
||||
versionContainer = new VersionContainer;
|
||||
resourceManager = new ResourceManager;
|
||||
postProcessorSystem = new PostProcessorSystem;
|
||||
client = new Client;
|
||||
settings = new Settings;
|
||||
}
|
||||
|
||||
void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
||||
{
|
||||
createNewServerSettings();
|
||||
|
||||
this->workerThread = workerThread;
|
||||
this->widgetManager = widgetManager;
|
||||
|
||||
client->moveToThread(workerThread);
|
||||
tcpClient->moveToThread(workerThread);
|
||||
dataParser->moveToThread(workerThread);
|
||||
dataParserOutput->moveToThread(workerThread);
|
||||
sendSystem->moveToThread(workerThread);
|
||||
@@ -31,11 +35,8 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
||||
recognizeSystem->moveToThread(workerThread);
|
||||
postProcessorSystem->moveToThread(workerThread);
|
||||
hashComparer->moveToThread(workerThread);
|
||||
// versionContainer->moveToThread(workerThread); //проверить работоспособность
|
||||
// resourceManager->moveToThread(workerThread); //проверить работоспособность
|
||||
|
||||
workerThread->start();
|
||||
//workerThread->setPriority(QThread::HighestPriority);
|
||||
|
||||
binding();
|
||||
initializeSystems();
|
||||
@@ -51,35 +52,36 @@ void CoreManager::start()
|
||||
|
||||
void CoreManager::loadStaticData()
|
||||
{
|
||||
ServerSettings *currentSettings = dataParser->getClientSettings();
|
||||
setLanguage(currentSettings->Language);
|
||||
settings = dataParser->getSettings();
|
||||
setLanguage(settings->Language);
|
||||
setLocalVersion();
|
||||
externalExecuter->setIsAutoStart(currentSettings->isAutoStart);
|
||||
externalExecuter->setIsAutoStart(settings->isAutoStart);
|
||||
bool appAvailable = externalExecuter->findApp();
|
||||
widgetManager->setAppAvailable(appAvailable);
|
||||
emit sigSetLoadSettings(currentSettings);
|
||||
emit sigSetLoadSettings(settings);
|
||||
}
|
||||
|
||||
void CoreManager::binding()
|
||||
{
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,widgetManager,&WidgetManager::slotActivateLoadAnimation,Qt::AutoConnection);
|
||||
|
||||
connect(this,&CoreManager::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
||||
connect(this,&CoreManager::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
||||
connect(this,&CoreManager::sigSendCommand,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
||||
connect(this,&CoreManager::sigInitializeClient,tcpClient,&TCPClient::initialize,Qt::AutoConnection);
|
||||
connect(this,&CoreManager::sigSetConnect,tcpClient,&TCPClient::setConnect,Qt::AutoConnection);
|
||||
connect(this,&CoreManager::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
||||
connect(this,&CoreManager::sigSendCheckUpdate,sendSystem,&SendSystem::sendCheckHash,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,Qt::AutoConnection);
|
||||
connect(this,&CoreManager::sigGetClientSettings,dataParser,&DataParser::getSettings,Qt::DirectConnection);
|
||||
|
||||
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::sigSetLoadSettings,widgetManager,&WidgetManager::slotSetLoadSettings,Qt::AutoConnection);
|
||||
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigSocketDisabled,this,&CoreManager::lostConnection,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigServerBlocked,this,&CoreManager::serverBlocked,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection); // ОПАСНОСТЬ
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigShowError,this,&CoreManager::showError,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&CoreManager::checkLoginResult,Qt::AutoConnection);
|
||||
|
||||
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&CoreManager::setServerVersion,Qt::AutoConnection);
|
||||
@@ -89,19 +91,24 @@ void CoreManager::binding()
|
||||
connect(recognizeSystem,&RecognizeSystem::sigNeedUpdate,this,&CoreManager::checkNeedUpdate,Qt::AutoConnection);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigCheckUpdate,this,&CoreManager::checkUpdate,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::sigHaveDelta,this,&CoreManager::checkUpdateInfo);
|
||||
|
||||
connect(updateController,&UpdateController::sigUpdateComplete,widgetManager,&WidgetManager::setCompeteState,Qt::AutoConnection);//ОПАСНОСТЬ
|
||||
connect(updateController,&UpdateController::sigSendHashInfo,widgetManager->getMainWindow(),&MainWindow::updateInitInformation,Qt::AutoConnection);
|
||||
connect(updateController,&UpdateController::sigUpdateComplete,widgetManager,&WidgetManager::setCompeteState,Qt::AutoConnection);
|
||||
connect(updateController->getHashCalculator(),&FastHashCalculator::sigSendHashInfo,widgetManager->getMainWindow(),&MainWindow::updateInitInformation,Qt::AutoConnection);
|
||||
|
||||
connect(client,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);//ОПАСНОСТЬ
|
||||
connect(client,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);//ОПАСНОСТЬ
|
||||
connect(tcpClient,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);
|
||||
connect(tcpClient,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,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()
|
||||
@@ -111,7 +118,7 @@ void CoreManager::initializeSystems()
|
||||
hashComparer->initialize(versionContainer,widgetManager->getUpdateWidget());
|
||||
postProcessorSystem->initialize(dataParserOutput,hashComparer,versionContainer,updateController);
|
||||
dataParser->initialize(postProcessorSystem);
|
||||
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem);
|
||||
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem,client);
|
||||
resourceManager->painting();
|
||||
|
||||
emit sigCalculateHash();
|
||||
@@ -119,7 +126,7 @@ void CoreManager::initializeSystems()
|
||||
|
||||
screenChecker->check();
|
||||
|
||||
emit sigSetConnect(dataParser->getClientSettings());
|
||||
emit sigSetConnect(dataParser->getSettings());
|
||||
}
|
||||
|
||||
void CoreManager::initializeWidgets()
|
||||
@@ -160,29 +167,37 @@ void CoreManager::callUpdateList()
|
||||
emit sigSendXMLAnswer(cmd_GetServerHash);
|
||||
}
|
||||
|
||||
void CoreManager::lostConnection()
|
||||
void CoreManager::showError(ErrorsEnum errorEnum)
|
||||
{
|
||||
widgetManager->setLostConnectionState();
|
||||
widgetManager->getMainWindow()->showError(errorEnum);
|
||||
|
||||
if (errorEnum == ErrorsEnum::BLOCKED)
|
||||
{
|
||||
widgetManager->getEntryWidget()->showLoginWidget(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CoreManager::serverBlocked()
|
||||
{
|
||||
widgetManager->getMainWindow()->serverBlocked();
|
||||
}
|
||||
|
||||
void CoreManager::setServerVersion(StreamingVersionData *version)
|
||||
{
|
||||
widgetManager->getMainWindow()->setServerVersion(version);
|
||||
|
||||
if (version->getViewName() == settings->versionData.getViewName())
|
||||
{
|
||||
settings->versionData.setIsChangeable(version->getIsChangeable());
|
||||
versionContainer->getLocalVersionData()->setIsChangeable(version->getIsChangeable());
|
||||
dataParserOutput->updateServerSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
void CoreManager::setLocalVersion()
|
||||
{
|
||||
ServerSettings *currentSettings = dataParser->getClientSettings();
|
||||
StreamingVersionData *version = new StreamingVersionData;
|
||||
version->setName(currentSettings->LocalVersionName);
|
||||
version->setIsChangeable(currentSettings->versionData.getIsChangeable());
|
||||
version->setName(settings->LocalVersionName);
|
||||
version->setIsChangeable(settings->versionData.getIsChangeable());
|
||||
|
||||
versionContainer->setLocalVersionData(version);
|
||||
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
||||
}
|
||||
|
||||
void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
||||
@@ -192,19 +207,22 @@ void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
||||
widgetManager->activateLoadingAnimation(true);
|
||||
checkAccessType(auth->AccessType);
|
||||
dataParserOutput->createAuthData(auth);
|
||||
setLocalVersion();
|
||||
//setLocalVersion();
|
||||
widgetManager->setLoginSuccess();
|
||||
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
||||
client->setLogin(auth->ClientName);
|
||||
client->setIsLoggedIn(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
widgetManager->setLoginFailed();
|
||||
client->setIsLoggedIn(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CoreManager::tryLogin()
|
||||
{
|
||||
if (!client->getIsConnected())
|
||||
if (!tcpClient->getIsConnected())
|
||||
{
|
||||
widgetManager->getMainWindow()->showConnectionEmpty();
|
||||
return;
|
||||
@@ -220,13 +238,18 @@ void CoreManager::checkUpdate()
|
||||
{
|
||||
widgetManager->activateLoadingAnimation(true);
|
||||
emit sigSendCheckUpdate();
|
||||
widgetManager->getMainWindow()->setInlineDebug(tr("Проверка обновлений..."));
|
||||
setInlineDebug(tr("Проверка обновлений..."));
|
||||
}
|
||||
|
||||
void CoreManager::recalculateState()
|
||||
{
|
||||
widgetManager->activateLoadingAnimation(true);
|
||||
widgetManager->getMainWindow()->setInlineDebug(tr("Пересчет хэша на сервере..."));
|
||||
setInlineDebug(tr("Пересчет хэша на сервере..."));
|
||||
}
|
||||
|
||||
void CoreManager::setInlineDebug(QString text)
|
||||
{
|
||||
widgetManager->getMainWindow()->setInlineDebug(text);
|
||||
}
|
||||
|
||||
void CoreManager::checkAccessType(const QString& accessType)
|
||||
@@ -307,7 +330,7 @@ void CoreManager::loadComplete()
|
||||
dataParserOutput->changeVersion(versionContainer->getServerVersionData());
|
||||
setLocalVersion();
|
||||
checkAutoStart();
|
||||
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
||||
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getServerVersionData()->getViewName());
|
||||
}
|
||||
|
||||
void CoreManager::loadToServer()
|
||||
@@ -322,11 +345,9 @@ void CoreManager::undoCurrentChanges()
|
||||
isRecovery = true;
|
||||
widgetManager->setUndoCurrentChangesState();
|
||||
emit sigSendCheckUpdate();
|
||||
emit sigSendCommand(PacketType::TYPE_UPDATE);
|
||||
//emit sigSendPacketType(PacketType::TYPE_UPDATE);
|
||||
//тут был таймер
|
||||
isRecovery = false;
|
||||
|
||||
widgetManager->activateLoadingAnimation(false);
|
||||
}
|
||||
|
||||
void CoreManager::startOffline()
|
||||
@@ -338,26 +359,37 @@ void CoreManager::startOffline()
|
||||
startUnityClient();
|
||||
}
|
||||
|
||||
void CoreManager::sendPacketType(PacketType packetType)
|
||||
{
|
||||
emit sigSendPacketType(packetType);
|
||||
}
|
||||
|
||||
void CoreManager::saveServerSettingsWithConnect()
|
||||
{
|
||||
widgetManager->activateLoadingAnimation(true);
|
||||
EntryWidget *entryWidget = widgetManager->getEntryWidget();
|
||||
|
||||
entryWidget->isActive(false);
|
||||
ServerSettings *settings = entryWidget->getServerSettings();
|
||||
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
|
||||
dataParserOutput->createServerSettings(settings);
|
||||
settings->LocalVersionName = dataParser->getSettings()->LocalVersionName;
|
||||
settings->Address = entryWidget->getAddress();
|
||||
settings->Port = entryWidget->getPort();
|
||||
dataParserOutput->updateServerSettings(settings);
|
||||
|
||||
if(client->getIsConnected())
|
||||
if(tcpClient->getIsConnected())
|
||||
{
|
||||
emit sigSendXMLAnswer(cmd_Disable);
|
||||
tcpClient->setDisconnect();
|
||||
entryWidget->showLoginWidget(true);
|
||||
widgetManager->getMainWindow()->showOfflineButton(true);
|
||||
widgetManager->activateLoadingAnimation(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit sigSetConnect(settings);
|
||||
}
|
||||
|
||||
emit sigSetConnect(settings);
|
||||
}
|
||||
|
||||
void CoreManager::createNewServerSettings()
|
||||
{
|
||||
dataParserOutput->createServerSettings();
|
||||
}
|
||||
|
||||
void CoreManager::checkAppAvailable()
|
||||
@@ -384,7 +416,7 @@ void CoreManager::setLanguage(const QString& language)
|
||||
void CoreManager::exit()
|
||||
{
|
||||
emit sigSendXMLAnswer(cmd_Disable);
|
||||
client->disconnect();
|
||||
tcpClient->disconnect();
|
||||
|
||||
workerThread->quit();
|
||||
workerThread->wait();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <Core/hashcomparer.h>
|
||||
#include <Core/versioncontainer.h>
|
||||
#include <widgetmanager.h>
|
||||
#include <Data/Client.h>
|
||||
|
||||
#include <UI/resourcemanager.h>
|
||||
|
||||
@@ -39,6 +40,7 @@ public:
|
||||
void startUnityClient();
|
||||
void tryLogin();
|
||||
void startOffline();
|
||||
void sendPacketType(PacketType packetType);
|
||||
|
||||
void saveServerSettingsWithConnect();
|
||||
|
||||
@@ -50,20 +52,22 @@ public:
|
||||
void recalculateState();
|
||||
signals:
|
||||
void sigInitializeClient(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||
void sigSendCommand(PacketType packetType);
|
||||
void sigSendPacketType(PacketType packetType);
|
||||
void sigSendXMLAnswer(QString answer);
|
||||
void sigSetConnect(ServerSettings* serverSettings);
|
||||
void sigSetConnect(Settings* serverSettings);
|
||||
void sigCalculateHash();
|
||||
void sigSendAutorization();
|
||||
void sigSendCheckUpdate();
|
||||
bool sigGetConnected();
|
||||
void sigSendUpdateToServer();
|
||||
Settings *sigGetClientSettings();
|
||||
|
||||
void sigSetLoadSettings(ServerSettings *serverSettings);
|
||||
|
||||
void sigSetLoadSettings(Settings *serverSettings);
|
||||
|
||||
private:
|
||||
QTranslator translator;
|
||||
TCPClient *client;
|
||||
TCPClient *tcpClient;
|
||||
DataParser *dataParser;
|
||||
DataParserOutput *dataParserOutput;
|
||||
UpdateController *updateController;
|
||||
@@ -75,6 +79,8 @@ private:
|
||||
VersionContainer *versionContainer;
|
||||
ResourceManager *resourceManager;
|
||||
PostProcessorSystem *postProcessorSystem;
|
||||
Client *client;
|
||||
Settings *settings;
|
||||
|
||||
WidgetManager *widgetManager;
|
||||
|
||||
@@ -90,8 +96,7 @@ private:
|
||||
void binding();
|
||||
void initializeSystems();
|
||||
void callUpdateList();
|
||||
void lostConnection();
|
||||
void serverBlocked();
|
||||
void showError(ErrorsEnum errorEnum);
|
||||
void checkLoginResult(ServerAuthorization *auth);
|
||||
void checkAccessType(const QString &accessType);
|
||||
void setServerVersion(StreamingVersionData *version);
|
||||
@@ -101,6 +106,8 @@ private:
|
||||
void checkNeedUpdate(bool flag, quint64 size, quint64 fileCount, quint64 deleteCount);
|
||||
void checkUpdate();
|
||||
|
||||
void setInlineDebug(QString text);
|
||||
void createNewServerSettings();
|
||||
};
|
||||
|
||||
#endif // COREMANAGER_H
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
bottomRightPosition(QRect(530,505,250,40)),
|
||||
bottomRightPosition(QRect(530,506,250,40)),
|
||||
offlinePosition(240,340,300,40)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -97,16 +97,37 @@ void MainWindow::setNeedUpdateState(const QString& notifyText)
|
||||
ui->autostartCheckBox->show();
|
||||
}
|
||||
|
||||
void MainWindow::serverBlocked()
|
||||
{
|
||||
ui->notificationLabel->show();
|
||||
QPalette palette = ui->notificationLabel->palette();
|
||||
QColor orangeColor(255,165,0);
|
||||
palette.setColor(ui->notificationLabel->foregroundRole(),orangeColor);
|
||||
ui->notificationLabel->setText(tr("Сервер заблокирован"));
|
||||
|
||||
ui->notificationLabel->setPalette(palette);
|
||||
timer->start(3000);
|
||||
void MainWindow::showError(ErrorsEnum errorNum)
|
||||
{
|
||||
if (errorNum == ErrorsEnum::BLOCKED)
|
||||
{
|
||||
serverNotifyShow(tr("Сервер заблокирован"));
|
||||
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::DISABLE)
|
||||
{
|
||||
showConnectionEmpty();
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::LOGIN_OR_PASS)
|
||||
{
|
||||
serverNotifyShow(tr("Неверный логин/пароль"));
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::ARCHIVED)
|
||||
{
|
||||
serverNotifyShow(tr("Пользователь в архиве"));
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::ALREADYLOGIN)
|
||||
{
|
||||
serverNotifyShow(tr("Пользователь уже в сети"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::serverNotifyShow(QString text, int durationMS)
|
||||
{
|
||||
ui->notificationLabel->setText(text);
|
||||
ui->notificationLabel->show();
|
||||
timer->start(durationMS);
|
||||
}
|
||||
|
||||
void MainWindow::setLoginSuccessState()
|
||||
@@ -116,19 +137,6 @@ void MainWindow::setLoginSuccessState()
|
||||
ui->versionLayoutWidget->show();
|
||||
}
|
||||
|
||||
void MainWindow::setLoginFailedState()
|
||||
{
|
||||
ui->notificationLabel->setText(tr("Неверный логин/пароль"));
|
||||
timer->setInterval(3000);
|
||||
timer->start();
|
||||
|
||||
QPalette palette = ui->notificationLabel->palette();
|
||||
palette.setColor(ui->notificationLabel->foregroundRole(), Qt::red);
|
||||
|
||||
ui->notificationLabel->setPalette(palette);
|
||||
ui->notificationLabel->show();
|
||||
}
|
||||
|
||||
void MainWindow::setStartOfflineButton(bool isAvailable)
|
||||
{
|
||||
ui->offlineStartButton->setEnabled(isAvailable);
|
||||
@@ -327,7 +335,7 @@ void MainWindow::addWidgetToInteractiveGroup(EntryWidget *entryWidget)
|
||||
this->entryWidget = entryWidget;
|
||||
}
|
||||
|
||||
void MainWindow::setLoadSettings(ServerSettings *serverSettings)
|
||||
void MainWindow::setLoadSettings(Settings *serverSettings)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
|
||||
|
||||
@@ -29,9 +29,8 @@ public:
|
||||
void initialize(ResourceManager *resourceManager);
|
||||
void addWidgetToChangeGroup(CommonButtonGroupWidget *commonWidgetGroup);
|
||||
void addWidgetToInteractiveGroup(EntryWidget *entryWidget);
|
||||
void setLoadSettings(ServerSettings *serverSettings);
|
||||
void setLoadSettings(Settings *serverSettings);
|
||||
void setLoginSuccessState();
|
||||
void setLoginFailedState();
|
||||
void setClientVersionName(const QString &versionName);
|
||||
|
||||
void loadToServer();
|
||||
@@ -47,9 +46,11 @@ public:
|
||||
void showOfflineButton(bool flag);
|
||||
void setStartOfflineButton(bool isAvailable);
|
||||
void setStartState();
|
||||
void serverBlocked();
|
||||
void serverNotifyShow(QString text, int durationMS = 3000);
|
||||
void showError(ErrorsEnum errorNum);
|
||||
|
||||
QHBoxLayout *getDisplayLayout() const;
|
||||
void serverBlockedState();
|
||||
public slots:
|
||||
void slotShowUpdateInfo();
|
||||
void slotConnectionState(bool flag);
|
||||
|
||||
@@ -427,7 +427,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>510</y>
|
||||
<y>511</y>
|
||||
<width>250</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
||||
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
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 16 KiB |
@@ -35,7 +35,7 @@ void WidgetManager::binding()
|
||||
connect(commonButtonGroupWidget,&CommonButtonGroupWidget::sigUpdateCommonWidget,mainWindow,&MainWindow::slotCommonWidgetState);
|
||||
connect(mainWindow,&MainWindow::sigShowSettings,this,&WidgetManager::showSettings,Qt::AutoConnection);
|
||||
}
|
||||
void WidgetManager::slotSetLoadSettings(ServerSettings *settings)
|
||||
void WidgetManager::slotSetLoadSettings(Settings *settings)
|
||||
{
|
||||
mainWindow->setLoadSettings(settings);
|
||||
entryWidget->fillSettings(settings);
|
||||
@@ -60,7 +60,6 @@ void WidgetManager::setLoginSuccess()
|
||||
void WidgetManager::setLoginFailed()
|
||||
{
|
||||
entryWidget->showLoginWidget(true);
|
||||
mainWindow->setLoginFailedState();
|
||||
activateLoadingAnimation(false);
|
||||
}
|
||||
|
||||
@@ -106,6 +105,7 @@ void WidgetManager::setNeedUpdateState(quint64 size, quint64 fileCount,quint64 d
|
||||
result = tr("Файлов к удалению: ") + QString::number(deleteCount);
|
||||
}
|
||||
|
||||
updateWidget->closeWindow();
|
||||
mainWindow->setNeedUpdateState(result);
|
||||
commonButtonGroupWidget->needUpdateState(true);
|
||||
waitAnimationWidget->hideWithStop();
|
||||
@@ -157,10 +157,11 @@ void WidgetManager::setServerDisconnectState()
|
||||
|
||||
void WidgetManager::setUndoCurrentChangesState()
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
mainWindow->undoCurrentChanges();
|
||||
updateWidget->hide();
|
||||
commonButtonGroupWidget->showProgressBar(false);
|
||||
waitAnimationWidget->showWithPlay();
|
||||
commonButtonGroupWidget->showProgressBar(true);
|
||||
//waitAnimationWidget->hideWithStop();
|
||||
}
|
||||
|
||||
void WidgetManager::showMainFrame(bool flag)
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void slotInlineDebug(const QString &text);
|
||||
public slots:
|
||||
void showSettings(bool isActive);
|
||||
void slotSetLoadSettings(ServerSettings *settings);
|
||||
void slotSetLoadSettings(Settings *settings);
|
||||
void slotActivateLoadAnimation(bool flag);
|
||||
signals:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user