mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 715d29a1ec | |||
| 6bde215bbe | |||
| eb95db696a | |||
| a3651496b7 | |||
| 52d077fe6b | |||
|
|
918d391a68 | ||
|
|
775f5cd0a4 | ||
|
|
75a93e346b | ||
|
|
4e15a439ee | ||
|
|
9e202f8e5d | ||
|
|
c23f3d519b |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -60,3 +60,5 @@ debug/
|
||||
release/
|
||||
saves/
|
||||
build/
|
||||
|
||||
BUILDS/
|
||||
|
||||
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 */
|
||||
|
||||
@@ -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);
|
||||
@@ -135,15 +135,29 @@ bool 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
~DataParser() = default;
|
||||
|
||||
void initialize(PostProcessorSystem *postProcessSystem);
|
||||
ServerSettings* getClientSettings();
|
||||
Settings* getSettings();
|
||||
bool xmlParser(const QByteArray& array);
|
||||
private:
|
||||
PostProcessorSystem *postProcessSystem;
|
||||
|
||||
@@ -125,7 +125,42 @@ 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);
|
||||
|
||||
QXmlStreamWriter xmlWriter(&file);
|
||||
|
||||
xmlWriter.setAutoFormatting(true);
|
||||
xmlWriter.writeStartDocument();
|
||||
|
||||
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);
|
||||
@@ -142,9 +177,6 @@ void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#include "Core/recognizesystem.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||
QObject(parent),
|
||||
versionContainer(nullptr),
|
||||
dataParser(nullptr),
|
||||
postProcessorSystem(nullptr)
|
||||
postProcessorSystem(nullptr),
|
||||
client(nullptr)
|
||||
{
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
filePath.clear();
|
||||
filePath = "";
|
||||
fileSize = 0;
|
||||
sizeReceiveData = 0;
|
||||
tmpBlock.clear();
|
||||
@@ -16,268 +18,308 @@ RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||
|
||||
void RecognizeSystem::initialize(DataParser *dataParser, VersionContainer *versionContainer,PostProcessorSystem *postProcessorSystem,Client *client)
|
||||
{
|
||||
this->versionContainer = versionContainer;
|
||||
this->postProcessorSystem = postProcessorSystem;
|
||||
this->versionContainer = versionContainer;
|
||||
this->dataParser = dataParser;
|
||||
this->postProcessorSystem = postProcessorSystem;
|
||||
this->client = client;
|
||||
}
|
||||
|
||||
void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
{
|
||||
qDebug() << "RecognizeThreadId " << QThread::currentThreadId();
|
||||
//qDebug() << "RecognizeThreadId " << QThread::currentThreadId();
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
while(socket->bytesAvailable())
|
||||
int cntBytesAvl = 0;
|
||||
while((cntBytesAvl = socket->bytesAvailable()) > 0)
|
||||
{
|
||||
if (socket->state() != QTcpSocket::ConnectedState)
|
||||
{
|
||||
qDebug() << "RecognizeSystem::recognize socket->state() != QTcpSocket::ConnectedState";
|
||||
return;
|
||||
}
|
||||
|
||||
if (socket->state() != QTcpSocket::ConnectedState) return;
|
||||
|
||||
if(packetType == PacketType::TYPE_NONE){ //определение первичного пакета
|
||||
|
||||
if(packetType == PacketType::TYPE_NONE) //определение первичного пакета
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> packetType;
|
||||
|
||||
if(!stream.commitTransaction())
|
||||
{
|
||||
emit sigSendDebugLog(Tools::getTime() + " CLIENT: packetType - FAIL commitTransaction");
|
||||
|
||||
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
||||
emit sigSendDebugLog("ERROR: PACKET TYPE READ TIMEOUT");
|
||||
return;
|
||||
}
|
||||
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
//qDebug() << Tools::GetTime() << "CLIENT: type: " << packetType;
|
||||
if(packetType == PacketType::TYPE_FILE)
|
||||
socket->waitForReadyRead(10);
|
||||
else
|
||||
socket->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_FOLDER){ //создание папок
|
||||
stream.startTransaction();
|
||||
stream >> filePath;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
continue;
|
||||
}
|
||||
|
||||
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
||||
|
||||
QDir dir(filePath);
|
||||
if(!dir.exists()){
|
||||
if(dir.mkpath(filePath)){
|
||||
qDebug() << "Dir Created";
|
||||
}
|
||||
}
|
||||
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
emit sigUpdateBytesAvailable();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_FILE) //загрузка файлов
|
||||
switch ((int)packetType)
|
||||
{
|
||||
//ПОЛУЧЕНИЕ ПУТИ
|
||||
//ПОЛУЧЕНИЕ РАЗМЕРА ФАЙЛА
|
||||
forever
|
||||
case PacketType::TYPE_FOLDER: //создание папок
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> filePath;
|
||||
stream >> fileSize;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
emit sigSendDebugLog(Tools::getTime() + "CLIENT: filePath, fileSize - FAIL commitTransaction");
|
||||
|
||||
if (!socket->waitForReadyRead(TCP_READ_TIMEOUT)) {
|
||||
emit sigSendDebugLog(Tools::getTime() + "CLIENT: ERROR! readyRead timeout - filePath, fileSize!!!");
|
||||
return;
|
||||
}
|
||||
if(!stream.commitTransaction())
|
||||
{
|
||||
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
||||
|
||||
emit sigSendDebugLog("CLIENT: filesize: " + QString::number(fileSize));
|
||||
emit sigSendDebugLog("CLIENT: filePath: " + filePath);
|
||||
|
||||
socket->waitForReadyRead(100);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//ПОЛУЧЕНИЕ САМОГО ФАЙЛА
|
||||
emit sigSendDebugLog(Tools::getTime() + "AfterRead size and path BytesAvailable: " + socket->bytesAvailable());
|
||||
|
||||
//УКАЗАНИЕ ПУТИ ФАЙЛА
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.exists())
|
||||
{
|
||||
file.remove(); //удаление файла, если он уже есть, но необходимо обновить
|
||||
emit sigSendDebugLog(Tools::getTime() + "Delete exist file: " + filePath);
|
||||
socket->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
file.open(QFile::Append);
|
||||
|
||||
forever
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> tmpBlock;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
|
||||
if(socket->state() == QAbstractSocket::UnconnectedState){
|
||||
postProcessorSystem->socketDisable();
|
||||
//emit sigSocketDisabled();
|
||||
return;
|
||||
QDir dir(filePath);
|
||||
if(!dir.exists())
|
||||
{
|
||||
if(dir.mkpath(filePath))
|
||||
{
|
||||
qDebug() << "Dir Created: " << filePath;
|
||||
}
|
||||
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
||||
}
|
||||
|
||||
emit sigUpdateBytesAvailable();
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::TYPE_FILE: //загрузка файлов
|
||||
{
|
||||
//ПОЛУЧЕНИЕ ПУТИ
|
||||
//ПОЛУЧЕНИЕ РАЗМЕРА ФАЙЛА
|
||||
forever
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> filePath;
|
||||
stream >> fileSize;
|
||||
|
||||
if(!stream.commitTransaction())
|
||||
{
|
||||
emit sigSendDebugLog(Tools::getTime() + "CLIENT: filePath, fileSize - FAIL commitTransaction");
|
||||
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
|
||||
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
||||
|
||||
emit sigSendDebugLog("CLIENT: filesize: " + QString::number(fileSize));
|
||||
emit sigSendDebugLog("CLIENT: filePath: " + filePath);
|
||||
|
||||
socket->waitForReadyRead(10);
|
||||
break;
|
||||
}
|
||||
|
||||
//ПОЛУЧЕНИЕ САМОГО ФАЙЛА
|
||||
emit sigSendDebugLog(Tools::getTime() + "AfterRead size and path BytesAvailable: " + socket->bytesAvailable());
|
||||
|
||||
//УКАЗАНИЕ ПУТИ ФАЙЛА
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.exists())
|
||||
{
|
||||
file.remove(); //удаление файла, если он уже есть, но необходимо обновить
|
||||
emit sigSendDebugLog(Tools::getTime() + "Delete exist file: " + filePath);
|
||||
|
||||
//socket->waitForReadyRead(10);
|
||||
}
|
||||
|
||||
tmpBlock.clear();
|
||||
sizeReceiveData = 0;
|
||||
countSend = 0;
|
||||
|
||||
file.open(QFile::WriteOnly);
|
||||
|
||||
if(! file.isOpen())
|
||||
QMessageBox::critical(nullptr, "P1", "isOpen false. File: " + file.fileName());
|
||||
|
||||
if(! file.isWritable())
|
||||
QMessageBox::critical(nullptr, "P2", "isWritable false. File: " + file.fileName());
|
||||
|
||||
while(true)
|
||||
{
|
||||
|
||||
if(socket->bytesAvailable() <= 0)
|
||||
{
|
||||
socket->waitForReadyRead(10);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(fileSize - sizeReceiveData >= BLOCK_SIZE)
|
||||
tmpBlock = socket->read(BLOCK_SIZE);
|
||||
else
|
||||
tmpBlock = socket->read(fileSize - sizeReceiveData);
|
||||
|
||||
qint64 bytesReceived = tmpBlock.length();
|
||||
|
||||
if(bytesReceived <= 0)
|
||||
{
|
||||
//QMessageBox::critical(nullptr, "P3", "bytesReceived <= 0. File: " + file.fileName());
|
||||
continue;
|
||||
}
|
||||
|
||||
sizeReceiveData += bytesReceived;
|
||||
countSend++;
|
||||
|
||||
qint64 toFile = file.write(tmpBlock);
|
||||
|
||||
if(toFile <= 0)
|
||||
{
|
||||
//emit sigUpdateBytesAvailable();
|
||||
QMessageBox::critical(nullptr, "P4", "write toFile <= 0. File: " + file.fileName());
|
||||
continue;
|
||||
}
|
||||
|
||||
tmpBlock.clear();
|
||||
|
||||
if(sizeReceiveData == fileSize)
|
||||
{
|
||||
emit sigSendDebugLog(Tools::getTime() + "FINAL Count send: " + QString::number(countSend));
|
||||
emit sigSendDebugLog(Tools::getTime() + "FINAL Size received: " + QString::number(sizeReceiveData));
|
||||
emit sigSendDebugLog(Tools::getTime() + "FINAL File size" + QString::number(fileSize));
|
||||
emit sigUpdateBytesAvailable();
|
||||
break;
|
||||
}
|
||||
else if(sizeReceiveData > fileSize)
|
||||
{
|
||||
QMessageBox::critical(nullptr, "P5", "sizeReceiveData > fileSize");
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
emit sigSendDebugLog(Tools::getTime() + "File loaded");
|
||||
|
||||
//ОЧИСТКА ПОСЛЕ ПЕРЕДАЧИ
|
||||
|
||||
filePath.clear();
|
||||
fileSize = 0;
|
||||
tmpBlock.clear();
|
||||
sizeReceiveData = 0;
|
||||
countSend = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::TYPE_DELETE: //удаление лишних файлов (рекурсивно удаляет все содежимое)
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> filePath;
|
||||
|
||||
if(!stream.commitTransaction())
|
||||
{
|
||||
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
|
||||
quint64 toFile = file.write(tmpBlock);
|
||||
emit sigSendDebugLog(Tools::getTime() + "CLIENT: toFile :" + toFile);
|
||||
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
||||
|
||||
sizeReceiveData += toFile;
|
||||
countSend++;
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
||||
tmpBlock.clear();
|
||||
|
||||
if(sizeReceiveData == fileSize){
|
||||
emit sigSendDebugLog(Tools::getTime() + "FINAL Count send: " + QString::number(countSend));
|
||||
emit sigSendDebugLog(Tools::getTime() + "FINAL Size received: " + QString::number(sizeReceiveData));
|
||||
emit sigSendDebugLog(Tools::getTime() + "FINAL File size" + QString::number(fileSize));
|
||||
emit sigUpdateBytesAvailable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
emit sigSendDebugLog(Tools::getTime() + "File loaded");
|
||||
|
||||
//ОЧИСТКА ПОСЛЕ ПЕРЕДАЧИ
|
||||
|
||||
filePath.clear();
|
||||
fileSize = 0;
|
||||
tmpBlock.clear();
|
||||
sizeReceiveData = 0;
|
||||
countSend = 0;
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_DELETE) //удаление лишних файлов (рекурсивно удаляет все содежимое)
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> filePath;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
continue;
|
||||
}
|
||||
|
||||
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
||||
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
||||
|
||||
if(fileInfo.exists())
|
||||
{
|
||||
if(fileInfo.isFile())
|
||||
if(fileInfo.exists())
|
||||
{
|
||||
QFile file(filePath);
|
||||
file.remove();
|
||||
if(fileInfo.isFile())
|
||||
{
|
||||
QFile file(filePath);
|
||||
file.remove();
|
||||
}
|
||||
|
||||
if(fileInfo.isDir())
|
||||
{
|
||||
QDir dir(filePath);
|
||||
dir.removeRecursively();
|
||||
}
|
||||
|
||||
qDebug() << Tools::getTime() << "Deleted: " << filePath;
|
||||
}
|
||||
|
||||
if(fileInfo.isDir()){
|
||||
QDir dir(filePath);
|
||||
dir.removeRecursively();
|
||||
}
|
||||
|
||||
qDebug() << Tools::getTime() << "Deleted: " << filePath;
|
||||
}
|
||||
break;
|
||||
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_NEEDUPDATE)
|
||||
{ //нужно обновление
|
||||
|
||||
bool flag = false;
|
||||
quint64 size = 0;
|
||||
quint64 fileCount = 0;
|
||||
quint64 fileDelete = 0;
|
||||
|
||||
stream.startTransaction();
|
||||
stream >> flag;
|
||||
stream >> size;
|
||||
stream >> fileCount;
|
||||
stream >> fileDelete;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
continue;
|
||||
}
|
||||
|
||||
emit sigNeedUpdate(flag,size,fileCount,fileDelete);
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_XMLANSWER){ //ответы формата XML
|
||||
QByteArray array;
|
||||
stream.startTransaction();
|
||||
stream >> array;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
continue;
|
||||
}
|
||||
|
||||
dataParser->xmlParser(array);
|
||||
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
|
||||
if(packetType == PacketType::HASH_READY)
|
||||
{
|
||||
emit sigCheckUpdate();
|
||||
}
|
||||
|
||||
if(packetType == PacketType::RECALCULATE_HASH)
|
||||
{
|
||||
emit sigdRecalculateHashOnServerState();
|
||||
}
|
||||
|
||||
if(packetType == PacketType::BUSY)
|
||||
{
|
||||
emit sigAnimationActivated(true);
|
||||
}
|
||||
|
||||
if(packetType == PacketType::FREE)
|
||||
{
|
||||
emit sigAnimationActivated(false);
|
||||
}
|
||||
|
||||
if (packetType == PacketType::TYPE_XMLANSWER_DOCS_CHANGED) //на случай общего обновления
|
||||
{
|
||||
if (client->getIsLoggedIn())
|
||||
case PacketType::TYPE_NEEDUPDATE: //нужно обновление
|
||||
{
|
||||
bool flag = false;
|
||||
quint64 size = 0;
|
||||
quint64 fileCount = 0;
|
||||
quint64 fileDelete = 0;
|
||||
|
||||
stream.startTransaction();
|
||||
stream >> flag;
|
||||
stream >> size;
|
||||
stream >> fileCount;
|
||||
stream >> fileDelete;
|
||||
|
||||
if(!stream.commitTransaction())
|
||||
{
|
||||
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
|
||||
emit sigNeedUpdate(flag,size,fileCount,fileDelete);
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::TYPE_XMLANSWER: //ответы формата XML
|
||||
{
|
||||
QByteArray array;
|
||||
stream.startTransaction();
|
||||
stream >> array;
|
||||
|
||||
if(!stream.commitTransaction())
|
||||
{
|
||||
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
|
||||
dataParser->xmlParser(array);
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::HASH_READY:
|
||||
{
|
||||
emit sigCheckUpdate();
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::RECALCULATE_HASH:
|
||||
{
|
||||
emit sigdRecalculateHashOnServerState();
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::BUSY:
|
||||
{
|
||||
emit sigAnimationActivated(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::FREE:
|
||||
{
|
||||
emit sigAnimationActivated(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::TYPE_XMLANSWER_DOCS_CHANGED: //на случай общего обновления
|
||||
{
|
||||
if (client->getIsLoggedIn())
|
||||
{
|
||||
emit sigSendPacketType(PacketType::GET_DOCS);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PacketType::UPDATE_FILE_COMPLETE:
|
||||
{
|
||||
postProcessorSystem->calculateCommonHash();
|
||||
emit sigLoadComplete();
|
||||
emit sigSendPacketType(PacketType::GET_DOCS);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
qCritical() << "RecognizeSystem::recognize packetType unknown!";
|
||||
}
|
||||
|
||||
if (packetType == PacketType::UPDATE_FILE_COMPLETE)
|
||||
{
|
||||
postProcessorSystem->calculateCommonHash();
|
||||
emit sigLoadComplete();
|
||||
emit sigSendPacketType(PacketType::GET_DOCS);
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
//socket->waitForReadyRead(10);
|
||||
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <Data\streamingversiondata.h>
|
||||
#include <Core\hashcomparer.h>
|
||||
|
||||
const int BLOCK_SIZE = 1024 * 1024; // Размер блока
|
||||
|
||||
class RecognizeSystem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -21,8 +23,10 @@ class RecognizeSystem : public QObject
|
||||
public:
|
||||
explicit RecognizeSystem(QObject *parent = 0);
|
||||
~RecognizeSystem(){};
|
||||
|
||||
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem,Client *client);
|
||||
void recognize(QTcpSocket *socket);
|
||||
|
||||
signals:
|
||||
void sigUpdateBytesAvailable();
|
||||
void sigLoadComplete();
|
||||
@@ -40,13 +44,13 @@ private:
|
||||
VersionContainer *versionContainer;
|
||||
DataParser *dataParser;
|
||||
PostProcessorSystem *postProcessorSystem;
|
||||
PacketType packetType;
|
||||
QString filePath;
|
||||
QByteArray tmpBlock;
|
||||
Client *client;
|
||||
|
||||
qint64 sizeReceiveData;
|
||||
PacketType packetType;
|
||||
QString filePath;
|
||||
qint64 fileSize;
|
||||
qint64 sizeReceiveData;
|
||||
QByteArray tmpBlock;
|
||||
int countSend;
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -21,7 +21,7 @@ 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;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
class ServerSettings{
|
||||
class Settings{
|
||||
public:
|
||||
QString Address;
|
||||
QString Port;
|
||||
|
||||
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
|
||||
@@ -60,6 +60,7 @@ HEADERS += \
|
||||
Core\tools.h\
|
||||
Core\hashcomparer.h \
|
||||
Data/Client.h \
|
||||
Data/ErrorsEnum.h \
|
||||
Data/monitorInfo.h \
|
||||
Data/streamingversiondata.h \
|
||||
Data\FileData.h\
|
||||
@@ -95,6 +96,7 @@ qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
TARGET = ClientMPS
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?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"/>
|
||||
<ServerSettings AutoStart="0" Port="6000" Address="192.168.100.134" Language="RUS"/>
|
||||
<VersionData Created="Пн дек 22 15:46:11 2025" isChangable="1" Version="max2"/>
|
||||
</ServerSettingsContainer>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -65,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);
|
||||
@@ -97,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();
|
||||
|
||||
@@ -72,11 +72,7 @@ void UpdateNotifyWidget::showWithFill()
|
||||
{
|
||||
clearList();
|
||||
|
||||
if(!versionContainer->getLocalVersionData()->getIsChangeable())
|
||||
{
|
||||
showTryChangeBase();
|
||||
}
|
||||
else if(!versionContainer->getServerVersionData()->getIsChangeable())
|
||||
if(!versionContainer->getServerVersionData()->getIsChangeable())
|
||||
{
|
||||
showTryChangeBase();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -17,10 +17,13 @@ CoreManager::CoreManager(QObject *parent) :
|
||||
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;
|
||||
|
||||
@@ -44,19 +47,18 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
||||
|
||||
void CoreManager::start()
|
||||
{
|
||||
saveServerSettingsWithConnect();
|
||||
checkAppAvailable();
|
||||
}
|
||||
|
||||
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()
|
||||
@@ -68,7 +70,8 @@ void CoreManager::binding()
|
||||
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,tcpClient,&TCPClient::getIsConnected);
|
||||
@@ -77,8 +80,7 @@ void CoreManager::binding()
|
||||
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::sigShowError,this,&CoreManager::showError,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&CoreManager::checkLoginResult,Qt::AutoConnection);
|
||||
|
||||
@@ -106,6 +108,7 @@ void CoreManager::binding()
|
||||
connect(sendSystem,&SendSystem::sigSend,this,&CoreManager::calcUpdateProgress,Qt::AutoConnection);
|
||||
|
||||
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);
|
||||
|
||||
}
|
||||
|
||||
void CoreManager::initializeSystems()
|
||||
@@ -123,7 +126,7 @@ void CoreManager::initializeSystems()
|
||||
|
||||
screenChecker->check();
|
||||
|
||||
emit sigSetConnect(dataParser->getClientSettings());
|
||||
emit sigSetConnect(dataParser->getSettings());
|
||||
}
|
||||
|
||||
void CoreManager::initializeWidgets()
|
||||
@@ -164,28 +167,34 @@ void CoreManager::callUpdateList()
|
||||
emit sigSendXMLAnswer(cmd_GetServerHash);
|
||||
}
|
||||
|
||||
void CoreManager::lostConnection()
|
||||
void CoreManager::showError(ErrorsEnum errorEnum)
|
||||
{
|
||||
widgetManager->setLostConnectionState();
|
||||
client->setIsLoggedIn(false);
|
||||
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());
|
||||
@@ -198,7 +207,7 @@ 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);
|
||||
@@ -321,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()
|
||||
@@ -336,7 +345,7 @@ void CoreManager::undoCurrentChanges()
|
||||
isRecovery = true;
|
||||
widgetManager->setUndoCurrentChangesState();
|
||||
emit sigSendCheckUpdate();
|
||||
emit sigSendPacketType(PacketType::TYPE_UPDATE);
|
||||
//emit sigSendPacketType(PacketType::TYPE_UPDATE);
|
||||
//тут был таймер
|
||||
isRecovery = false;
|
||||
}
|
||||
@@ -361,9 +370,10 @@ void CoreManager::saveServerSettingsWithConnect()
|
||||
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(tcpClient->getIsConnected())
|
||||
{
|
||||
@@ -377,6 +387,11 @@ void CoreManager::saveServerSettingsWithConnect()
|
||||
emit sigSetConnect(settings);
|
||||
}
|
||||
|
||||
void CoreManager::createNewServerSettings()
|
||||
{
|
||||
dataParserOutput->createServerSettings();
|
||||
}
|
||||
|
||||
void CoreManager::checkAppAvailable()
|
||||
{
|
||||
bool isAvailable = externalExecuter->findApp();
|
||||
|
||||
@@ -54,15 +54,16 @@ signals:
|
||||
void sigInitializeClient(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||
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;
|
||||
@@ -79,6 +80,7 @@ private:
|
||||
ResourceManager *resourceManager;
|
||||
PostProcessorSystem *postProcessorSystem;
|
||||
Client *client;
|
||||
Settings *settings;
|
||||
|
||||
WidgetManager *widgetManager;
|
||||
|
||||
@@ -94,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);
|
||||
@@ -106,6 +107,7 @@ private:
|
||||
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>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -161,7 +160,7 @@ void WidgetManager::setUndoCurrentChangesState()
|
||||
waitAnimationWidget->showWithPlay();
|
||||
mainWindow->undoCurrentChanges();
|
||||
updateWidget->hide();
|
||||
commonButtonGroupWidget->showProgressBar(false);
|
||||
commonButtonGroupWidget->showProgressBar(true);
|
||||
//waitAnimationWidget->hideWithStop();
|
||||
}
|
||||
|
||||
|
||||
@@ -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