mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-29 06:35:40 +03:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38dda10685 | ||
|
|
eb70ed9a6e | ||
|
|
4edfae5740 | ||
|
|
1d76e9785b | ||
| 715d29a1ec | |||
| 6bde215bbe | |||
| eb95db696a | |||
| a3651496b7 | |||
| 52d077fe6b | |||
|
|
918d391a68 | ||
|
|
775f5cd0a4 | ||
|
|
75a93e346b | ||
|
|
4e15a439ee | ||
|
|
9e202f8e5d | ||
|
|
c23f3d519b | ||
|
|
14c1ffb66f | ||
|
|
5b63141ddf | ||
|
|
6665f417c9 | ||
|
|
633881847b | ||
|
|
a2e64ecb68 | ||
|
|
4829647e98 | ||
|
|
b706de2961 | ||
|
|
a4d4709118 | ||
|
|
60c3d6244e | ||
|
|
c9c62d22c0 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -60,3 +60,5 @@ debug/
|
|||||||
release/
|
release/
|
||||||
saves/
|
saves/
|
||||||
build/
|
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 */
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "UpdateController.h"
|
#include "UpdateController.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
UpdateController::UpdateController(QObject *parent) :
|
UpdateController::UpdateController(QObject *parent) :
|
||||||
@@ -8,6 +9,7 @@ UpdateController::UpdateController(QObject *parent) :
|
|||||||
versionContainer(nullptr)
|
versionContainer(nullptr)
|
||||||
{
|
{
|
||||||
applicationFolderPath = QDir::currentPath() + applicationFolderName;
|
applicationFolderPath = QDir::currentPath() + applicationFolderName;
|
||||||
|
hashCalculator = new FastHashCalculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::initialize(VersionContainer *versionContainer,DataParserOutput *dataParserOut, SendSystem *sendSystem)
|
void UpdateController::initialize(VersionContainer *versionContainer,DataParserOutput *dataParserOut, SendSystem *sendSystem)
|
||||||
@@ -20,18 +22,26 @@ void UpdateController::initialize(VersionContainer *versionContainer,DataParserO
|
|||||||
void UpdateController::calculateCommonHash()
|
void UpdateController::calculateCommonHash()
|
||||||
{
|
{
|
||||||
appDataList.clear();
|
appDataList.clear();
|
||||||
appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
QElapsedTimer timer;
|
||||||
|
timer.start();
|
||||||
|
qDebug() << "Start calculate... ";
|
||||||
|
|
||||||
|
hashCalculator->calculateHashes(applicationFolderPath,"StreamingAssets");
|
||||||
|
appDataList = *hashCalculator->getHashList();
|
||||||
calculateStreamingHash();
|
calculateStreamingHash();
|
||||||
appDataList.append(streamingDataList);
|
appDataList.append(streamingDataList);
|
||||||
|
|
||||||
|
qDebug() << "Hash count: " << appDataList.count() ;
|
||||||
dataParserOut->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
dataParserOut->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
||||||
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
||||||
|
qDebug() <<"Calculate time " << timer.elapsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::calculateStreamingHash()
|
void UpdateController::calculateStreamingHash()
|
||||||
{
|
{
|
||||||
streamingDataList.clear();
|
streamingDataList.clear();
|
||||||
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
hashCalculator->calculateHashes(QDir::currentPath() + streamingAssetsPath,"");
|
||||||
std::sort(streamingDataList.begin(),streamingDataList.end());
|
streamingDataList = *hashCalculator->getHashList();
|
||||||
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +55,6 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<FileData> *hashes = new QList<FileData>;
|
QList<FileData> *hashes = new QList<FileData>;
|
||||||
QString fullSize = Tools::convertFileSize(getDirectorySize(path),false);
|
|
||||||
quint64 currentSize = 0;
|
quint64 currentSize = 0;
|
||||||
|
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
@@ -82,9 +91,9 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
|||||||
|
|
||||||
currentSize += fileInfo.size();
|
currentSize += fileInfo.size();
|
||||||
|
|
||||||
emit sigSendHashInfo(fullSize,Tools::convertFileSize(currentSize,false));
|
|
||||||
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
||||||
const quint64 bufferSize = 10240;
|
const quint64 bufferSize = 1024;
|
||||||
|
|
||||||
if(fileInfo.isHidden()) continue;
|
if(fileInfo.isHidden()) continue;
|
||||||
if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
||||||
@@ -115,26 +124,8 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
|||||||
return *hashes;
|
return *hashes;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 UpdateController::getDirectorySize(const QString& path)
|
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList)
|
||||||
{
|
{
|
||||||
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);
|
QListIterator<FileData> serverIterator(*fileSendList);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -155,8 +146,7 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculateCommonHash();
|
calculateCommonHash();
|
||||||
sendSystem->sendFinish();
|
sendSystem->sendPacketType(PacketType::RECALCULATE_DOCS);
|
||||||
|
|
||||||
emit sigUpdateComplete(true);
|
emit sigUpdateComplete(true);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -166,6 +156,11 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FastHashCalculator *UpdateController::getHashCalculator() const
|
||||||
|
{
|
||||||
|
return hashCalculator;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateController::~UpdateController()
|
UpdateController::~UpdateController()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "Core/sendsystem.h"
|
#include "Core/sendsystem.h"
|
||||||
#include "Core/versioncontainer.h"
|
#include "Core/versioncontainer.h"
|
||||||
|
#include "fasthashcalculator.h"
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QXmlStreamAttribute>
|
#include <QXmlStreamAttribute>
|
||||||
@@ -34,19 +35,21 @@ public:
|
|||||||
void updateFilesOnServer(QList<FileData> *fileSendList);
|
void updateFilesOnServer(QList<FileData> *fileSendList);
|
||||||
void checkCanUpdate();
|
void checkCanUpdate();
|
||||||
|
|
||||||
|
FastHashCalculator *getHashCalculator() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigUpdateComplete(bool flag);
|
void sigUpdateComplete(bool flag);
|
||||||
void sigSendHashInfo(QString fullSize,QString current);
|
|
||||||
private:
|
private:
|
||||||
SendSystem *sendSystem;
|
SendSystem *sendSystem;
|
||||||
DataParserOutput * dataParserOut;
|
DataParserOutput * dataParserOut;
|
||||||
|
FastHashCalculator* hashCalculator;
|
||||||
QString applicationFolderPath;
|
QString applicationFolderPath;
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
QList<FileData> appDataList;
|
QList<FileData> appDataList;
|
||||||
QList<FileData> streamingDataList;
|
QList<FileData> streamingDataList;
|
||||||
|
|
||||||
QList<FileData> calculateHash(const QString& path,const QString& ignoreName);
|
QList<FileData> calculateHash(const QString& path,const QString& ignoreName);
|
||||||
quint64 getDirectorySize(const QString &path);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
QFile file(settingsName);
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
QXmlStreamReader xmlReader(&file);
|
QXmlStreamReader xmlReader(&file);
|
||||||
@@ -95,9 +95,10 @@ ServerSettings *DataParser::getClientSettings()
|
|||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataParser::xmlParser(const QByteArray& array)
|
bool DataParser::xmlParser(const QByteArray& array)
|
||||||
{
|
{
|
||||||
QXmlStreamReader xmlReader(array);
|
QXmlStreamReader xmlReader(array);
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
|
|
||||||
@@ -134,14 +135,29 @@ void DataParser::xmlParser(const QByteArray& array)
|
|||||||
|
|
||||||
if (value == "UNCHANGEABLE")
|
if (value == "UNCHANGEABLE")
|
||||||
{
|
{
|
||||||
//версию нельзя изменять
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == "CHANGEABLE")
|
if (value == "CHANGEABLE")
|
||||||
{
|
{
|
||||||
postProcessSystem->compareFiles();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,13 +189,10 @@ void DataParser::xmlParser(const QByteArray& array)
|
|||||||
if (name == "AccessType")
|
if (name == "AccessType")
|
||||||
{
|
{
|
||||||
serverAuth->AccessType = value;
|
serverAuth->AccessType = value;
|
||||||
postProcessSystem->checkAccessType(value);
|
|
||||||
//recognizeSystem->checkAccessType(value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
postProcessSystem->saveLoginData(serverAuth);
|
postProcessSystem->saveLoginData(serverAuth);
|
||||||
//emit recognizeSystem->sigSaveLoginData(serverAuth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(xmlReader.name() == "VersionData")
|
if(xmlReader.name() == "VersionData")
|
||||||
@@ -227,7 +240,7 @@ void DataParser::xmlParser(const QByteArray& array)
|
|||||||
QString name = attr.name().toString();
|
QString name = attr.name().toString();
|
||||||
QString value = attr.value().toString();
|
QString value = attr.value().toString();
|
||||||
|
|
||||||
if(name == "Version")
|
if (name == "Version")
|
||||||
data->setName(value);
|
data->setName(value);
|
||||||
else if(name == "Created")
|
else if(name == "Created")
|
||||||
data->setCreateData(QDateTime::fromString(value));
|
data->setCreateData(QDateTime::fromString(value));
|
||||||
@@ -243,8 +256,10 @@ void DataParser::xmlParser(const QByteArray& array)
|
|||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
}
|
}
|
||||||
|
emit postProcessSystem->sigCallUpdateList();
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <Data/FileData.h>
|
|
||||||
#include <Data/Datas.h>
|
#include <Data/Datas.h>
|
||||||
#include <Data/FileData.h>
|
#include <Data/FileData.h>
|
||||||
#include <Core/tools.h>
|
#include <Core/tools.h>
|
||||||
@@ -21,8 +20,8 @@ public:
|
|||||||
~DataParser() = default;
|
~DataParser() = default;
|
||||||
|
|
||||||
void initialize(PostProcessorSystem *postProcessSystem);
|
void initialize(PostProcessorSystem *postProcessSystem);
|
||||||
ServerSettings* getClientSettings();
|
Settings* getSettings();
|
||||||
void xmlParser(const QByteArray& array);
|
bool xmlParser(const QByteArray& array);
|
||||||
private:
|
private:
|
||||||
PostProcessorSystem *postProcessSystem;
|
PostProcessorSystem *postProcessSystem;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ QByteArray DataParserOutput::xmlAnswer(const QList<SXmlAnswerTag>& listTag, cons
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,const QString& filename)
|
void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,const QString& filename)
|
||||||
{
|
{
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
@@ -94,6 +93,7 @@ void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,co
|
|||||||
|
|
||||||
xmlWriter.writeAttribute("Path",data.path);
|
xmlWriter.writeAttribute("Path",data.path);
|
||||||
xmlWriter.writeAttribute("Hash",data.hash);
|
xmlWriter.writeAttribute("Hash",data.hash);
|
||||||
|
xmlWriter.writeAttribute("LastUpdate",data.lastUpdate);
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
}
|
}
|
||||||
@@ -126,9 +126,10 @@ void DataParserOutput::createAuthMessage(ClientAutorization *auth)
|
|||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
void DataParserOutput::createServerSettings()
|
||||||
{
|
{
|
||||||
QFile file(settingsName);
|
QFile file(settingsName);
|
||||||
|
if (file.exists()) return;
|
||||||
|
|
||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
@@ -140,13 +141,43 @@ void DataParserOutput::createServerSettings(ServerSettings* serverSettings)
|
|||||||
xmlWriter.writeStartElement("ServerSettingsContainer");
|
xmlWriter.writeStartElement("ServerSettingsContainer");
|
||||||
xmlWriter.writeStartElement("ServerSettings");
|
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("Address",serverSettings->Address);
|
||||||
xmlWriter.writeAttribute("Port",serverSettings->Port);
|
xmlWriter.writeAttribute("Port",serverSettings->Port);
|
||||||
xmlWriter.writeAttribute("Language","RUS");
|
xmlWriter.writeAttribute("Language","RUS");
|
||||||
xmlWriter.writeAttribute("AutoStart",QString::number(false));
|
xmlWriter.writeAttribute("AutoStart",QString::number(false));
|
||||||
xmlWriter.writeAttribute("DestPortMath","18003");
|
|
||||||
xmlWriter.writeAttribute("LocalPortMath","18004");
|
|
||||||
xmlWriter.writeAttribute("UseMathModel",QString::number(serverSettings->mathModelUse));
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
|
|
||||||
@@ -303,6 +334,8 @@ QList<FileData>* DataParserOutput::xmlFileDataParse(const QByteArray& array,cons
|
|||||||
data.path = value;
|
data.path = value;
|
||||||
else if(name == "Hash")
|
else if(name == "Hash")
|
||||||
data.hash = value;
|
data.hash = value;
|
||||||
|
else if(name == "LastUpdate")
|
||||||
|
data.lastUpdate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.path.contains(filter))
|
if(data.path.contains(filter))
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ public:
|
|||||||
explicit DataParserOutput(QObject *parent = 0);
|
explicit DataParserOutput(QObject *parent = 0);
|
||||||
void createFileDataList(const QList<FileData>& fileDataList,const QString& filename);
|
void createFileDataList(const QList<FileData>& fileDataList,const QString& filename);
|
||||||
void createAuthMessage(ClientAutorization *auth);
|
void createAuthMessage(ClientAutorization *auth);
|
||||||
void createServerSettings(ServerSettings *serverSettings);
|
void createServerSettings();
|
||||||
|
void updateServerSettings(Settings *serverSettings);
|
||||||
void changeVersion(StreamingVersionData *versionData);
|
void changeVersion(StreamingVersionData *versionData);
|
||||||
void createAuthData(ServerAuthorization *serverAuth);
|
void createAuthData(ServerAuthorization *serverAuth);
|
||||||
void createAuthDataOffline(const QString& username,const QString& pass);
|
void createAuthDataOffline(const QString& username,const QString& pass);
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
void ExternalExecuter::callApp()
|
void ExternalExecuter::callApp()
|
||||||
{
|
{
|
||||||
QProcess *myProcess = new QProcess(this);
|
QProcess *myProcess = new QProcess(this);
|
||||||
QStringList args;
|
QStringList args = QCoreApplication::arguments();
|
||||||
args << "1";
|
args.removeFirst();
|
||||||
|
|
||||||
myProcess->start(programPath,args);
|
myProcess->start(programPath,args);
|
||||||
myProcess->waitForStarted();
|
myProcess->waitForStarted();
|
||||||
@@ -21,10 +21,11 @@ bool ExternalExecuter::findApp()
|
|||||||
|
|
||||||
if(iterator.fileInfo().fileName() == applicationEXEName){
|
if(iterator.fileInfo().fileName() == applicationEXEName){
|
||||||
programPath = iterator.fileInfo().absoluteFilePath();
|
programPath = iterator.fileInfo().absoluteFilePath();
|
||||||
|
isAvailable = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isAvailable = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,3 +38,8 @@ void ExternalExecuter::setIsAutoStart(bool value)
|
|||||||
{
|
{
|
||||||
isAutoStart = value;
|
isAutoStart = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ExternalExecuter::getIsAvailable() const
|
||||||
|
{
|
||||||
|
return isAvailable;
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,9 +23,12 @@ public:
|
|||||||
bool getIsAutoStart() const;
|
bool getIsAutoStart() const;
|
||||||
void setIsAutoStart(bool value);
|
void setIsAutoStart(bool value);
|
||||||
|
|
||||||
|
bool getIsAvailable() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString programPath;
|
QString programPath;
|
||||||
bool isAutoStart;
|
bool isAutoStart;
|
||||||
|
bool isAvailable;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EXTERNALEXECUTER_H
|
#endif // EXTERNALEXECUTER_H
|
||||||
|
|||||||
128
Core/fasthashcalculator.cpp
Normal file
128
Core/fasthashcalculator.cpp
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
#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)
|
||||||
|
{
|
||||||
|
QFileInfo fileInfo(filePath);
|
||||||
|
QByteArray hash = calculateFileHashOptimized(filePath);
|
||||||
|
QMutexLocker locker(&_mutex);
|
||||||
|
FileData currentFile;
|
||||||
|
QString hashName;
|
||||||
|
|
||||||
|
currentFile.path = Tools::createLocalPath(filePath);
|
||||||
|
currentFile.hash = hash.toHex();
|
||||||
|
currentFile.lastUpdate = fileInfo.fileTime(QFileDevice::FileModificationTime).toString("dd.MM.yyyy hh:mm:ss");
|
||||||
|
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
|
||||||
@@ -13,18 +13,29 @@ void HashComparer::initialize(VersionContainer *versionContainer,UpdateNotifyWid
|
|||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
this->updateWidget = updateWidget;
|
this->updateWidget = updateWidget;
|
||||||
filesForUpdate = new QList<FileData>;
|
filesForUpdate = new QList<FileData>;
|
||||||
|
|
||||||
|
connect(this,&HashComparer::sigAddToList,updateWidget,&UpdateNotifyWidget::addToList,Qt::QueuedConnection);
|
||||||
|
connect(this,&HashComparer::sigGetUpdateList,updateWidget,&UpdateNotifyWidget::getUpdateList,Qt::DirectConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
||||||
{
|
{
|
||||||
QList<FileData> *files = new QList<FileData>;
|
QList<FileData> *files = new QList<FileData>;
|
||||||
|
serverFiles = new QList<FileData>;
|
||||||
QMutableListIterator<FileData> iterator(localStreamingHash);
|
QMutableListIterator<FileData> iterator(localStreamingHash);
|
||||||
|
|
||||||
for (auto &item:localStreamingHash)
|
for (auto &item:localStreamingHash)
|
||||||
{
|
{
|
||||||
if(!serverStreamingHash->contains(item))
|
if(!serverStreamingHash->contains(item))
|
||||||
{
|
{
|
||||||
|
if (item.path.contains("docs.xml")) continue; //фильтр на docs
|
||||||
|
if (item.path.contains("CfiList.xml")) continue;
|
||||||
|
|
||||||
|
qint32 fileDataIndex = findIndexByPath(*serverStreamingHash, item.path);
|
||||||
|
if (fileDataIndex != -1)
|
||||||
|
{
|
||||||
|
serverFiles->append(serverStreamingHash->at(fileDataIndex));
|
||||||
|
}
|
||||||
files->append(item);
|
files->append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +44,17 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
|||||||
showDeltas();
|
showDeltas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint32 HashComparer::findIndexByPath(const QList<FileData> &serverStreamingHash,QString path)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < serverStreamingHash.size(); i++)
|
||||||
|
{
|
||||||
|
if(serverStreamingHash.at(i).path == path)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void HashComparer::showDeltas()
|
void HashComparer::showDeltas()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -41,9 +63,19 @@ void HashComparer::showDeltas()
|
|||||||
emit sigCallCheck();
|
emit sigCallCheck();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &item:*filesForUpdate)
|
|
||||||
|
for (int i = 0; i < filesForUpdate->size(); i++)
|
||||||
{
|
{
|
||||||
updateWidget->addToList(item);
|
FileData local = filesForUpdate->at(i);
|
||||||
|
FileData server = FileData();
|
||||||
|
server.lastUpdate = "нет";
|
||||||
|
|
||||||
|
if (serverFiles->size() > i)
|
||||||
|
{
|
||||||
|
server = serverFiles->at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit sigAddToList(local,server);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sigHaveDelta();
|
emit sigHaveDelta();
|
||||||
@@ -56,7 +88,7 @@ quint16 HashComparer::getFileUpdateCount() const
|
|||||||
|
|
||||||
QList<FileData> *HashComparer::getFilesForUpdate() const
|
QList<FileData> *HashComparer::getFilesForUpdate() const
|
||||||
{
|
{
|
||||||
QList<FileData> *completeList = filesForUpdate;
|
QList<FileData> *completeList = emit sigGetUpdateList();
|
||||||
|
|
||||||
for (int i = 0; i < completeList->count();i++)
|
for (int i = 0; i < completeList->count();i++)
|
||||||
{
|
{
|
||||||
@@ -69,5 +101,5 @@ QList<FileData> *HashComparer::getFilesForUpdate() const
|
|||||||
completeList->replace(i,data);
|
completeList->replace(i,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return filesForUpdate;
|
return completeList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,15 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void sigCallCheck();
|
void sigCallCheck();
|
||||||
void sigHaveDelta();
|
void sigHaveDelta();
|
||||||
|
void sigAddToList(FileData local, FileData server);
|
||||||
|
QList<FileData> *sigGetUpdateList() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UpdateNotifyWidget* updateWidget;
|
UpdateNotifyWidget* updateWidget;
|
||||||
QList<FileData> *filesForUpdate;
|
QList<FileData> *filesForUpdate;
|
||||||
|
QList<FileData> *serverFiles;
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
|
quint32 findIndexByPath(const QList<FileData> &serverStreamingHash, QString path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HASHCOMPARER_H
|
#endif // HASHCOMPARER_H
|
||||||
|
|||||||
@@ -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()
|
void PostProcessorSystem::socketDisable()
|
||||||
{
|
{
|
||||||
emit sigSocketDisabled();
|
emit sigShowError(ErrorsEnum::DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessorSystem::serverBlocked()
|
void PostProcessorSystem::serverBlocked()
|
||||||
{
|
{
|
||||||
emit sigServerBlocked();
|
emit sigShowError(ErrorsEnum::BLOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessorSystem::startCompare()
|
void PostProcessorSystem::startCompare()
|
||||||
@@ -54,14 +69,6 @@ void PostProcessorSystem::compareFiles()
|
|||||||
updateController->updateFilesOnServer(hashComparer->getFilesForUpdate());
|
updateController->updateFilesOnServer(hashComparer->getFilesForUpdate());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessorSystem::checkAccessType(const QString& type)
|
|
||||||
{
|
|
||||||
if(type == "instructor")
|
|
||||||
{
|
|
||||||
emit sigCallUpdateList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PostProcessorSystem::saveLoginData(ServerAuthorization *auth)
|
void PostProcessorSystem::saveLoginData(ServerAuthorization *auth)
|
||||||
{
|
{
|
||||||
emit sigSaveLoginData(auth);
|
emit sigSaveLoginData(auth);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "UpdateController.h"
|
#include "UpdateController.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <Data/Datas.h>
|
#include <Data/Datas.h>
|
||||||
|
#include <Data/ErrorsEnum.h>
|
||||||
|
|
||||||
class PostProcessorSystem : public QObject
|
class PostProcessorSystem : public QObject
|
||||||
{
|
{
|
||||||
@@ -20,13 +21,14 @@ public:
|
|||||||
void serverBlocked();
|
void serverBlocked();
|
||||||
void startCompare();
|
void startCompare();
|
||||||
void compareFiles();
|
void compareFiles();
|
||||||
void checkAccessType(const QString& type);
|
|
||||||
void saveLoginData(ServerAuthorization *auth);
|
void saveLoginData(ServerAuthorization *auth);
|
||||||
void setServerVersion(StreamingVersionData *serverVersion);
|
void setServerVersion(StreamingVersionData *serverVersion);
|
||||||
void calculateCommonHash();
|
void calculateCommonHash();
|
||||||
|
void userArchived();
|
||||||
|
void wrongLoginOrPass();
|
||||||
|
void alreadyLogin();
|
||||||
signals:
|
signals:
|
||||||
void sigSocketDisabled();
|
void sigShowError(ErrorsEnum error);
|
||||||
void sigServerBlocked();
|
|
||||||
void sigStartCompare(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash);
|
void sigStartCompare(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash);
|
||||||
void sigCallUpdateList();
|
void sigCallUpdateList();
|
||||||
void sigSaveLoginData(ServerAuthorization *serverAuth);
|
void sigSaveLoginData(ServerAuthorization *serverAuth);
|
||||||
|
|||||||
@@ -1,80 +1,92 @@
|
|||||||
#include "Core/recognizesystem.h"
|
#include "Core/recognizesystem.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
RecognizeSystem::RecognizeSystem(QObject *parent):
|
RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
versionContainer(nullptr),
|
versionContainer(nullptr),
|
||||||
dataParser(nullptr),
|
dataParser(nullptr),
|
||||||
postProcessorSystem(nullptr)
|
postProcessorSystem(nullptr),
|
||||||
|
client(nullptr)
|
||||||
{
|
{
|
||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
filePath.clear();
|
filePath = "";
|
||||||
fileSize = 0;
|
fileSize = 0;
|
||||||
sizeReceiveData = 0;
|
sizeReceiveData = 0;
|
||||||
tmpBlock.clear();
|
tmpBlock.clear();
|
||||||
countSend = 0;
|
countSend = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecognizeSystem::initialize(DataParser *dataParser, VersionContainer *versionContainer,PostProcessorSystem *postProcessorSystem)
|
void RecognizeSystem::initialize(DataParser *dataParser, VersionContainer *versionContainer,PostProcessorSystem *postProcessorSystem,Client *client)
|
||||||
{
|
{
|
||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
this->postProcessorSystem = postProcessorSystem;
|
|
||||||
this->dataParser = dataParser;
|
this->dataParser = dataParser;
|
||||||
|
this->postProcessorSystem = postProcessorSystem;
|
||||||
|
this->client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecognizeSystem::recognize(QTcpSocket *socket)
|
void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||||
{
|
{
|
||||||
qDebug() << "RecognizeThreadId " << QThread::currentThreadId();
|
//qDebug() << "RecognizeThreadId " << QThread::currentThreadId();
|
||||||
|
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
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.startTransaction();
|
||||||
stream >> packetType;
|
stream >> packetType;
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction())
|
||||||
emit sigSendDebugLog(Tools::getTime() + " CLIENT: packetType - FAIL commitTransaction");
|
{
|
||||||
|
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||||
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
|
||||||
emit sigSendDebugLog("ERROR: PACKET TYPE READ TIMEOUT");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug() << Tools::GetTime() << "CLIENT: type: " << packetType;
|
//qDebug() << Tools::GetTime() << "CLIENT: type: " << packetType;
|
||||||
|
if(packetType == PacketType::TYPE_FILE)
|
||||||
|
socket->waitForReadyRead(10);
|
||||||
|
else
|
||||||
|
socket->waitForReadyRead(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packetType == PacketType::TYPE_FOLDER){ //создание папок
|
|
||||||
|
switch ((int)packetType)
|
||||||
|
{
|
||||||
|
case PacketType::TYPE_FOLDER: //создание папок
|
||||||
|
{
|
||||||
stream.startTransaction();
|
stream.startTransaction();
|
||||||
stream >> filePath;
|
stream >> filePath;
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction())
|
||||||
|
{
|
||||||
|
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
||||||
|
|
||||||
QDir dir(filePath);
|
QDir dir(filePath);
|
||||||
if(!dir.exists()){
|
if(!dir.exists())
|
||||||
if(dir.mkpath(filePath)){
|
{
|
||||||
qDebug() << "Dir Created";
|
if(dir.mkpath(filePath))
|
||||||
|
{
|
||||||
|
qDebug() << "Dir Created: " << filePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packetType = PacketType::TYPE_NONE;
|
|
||||||
emit sigUpdateBytesAvailable();
|
emit sigUpdateBytesAvailable();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(packetType == PacketType::TYPE_FILE) //загрузка файлов
|
case PacketType::TYPE_FILE: //загрузка файлов
|
||||||
{
|
{
|
||||||
//ПОЛУЧЕНИЕ ПУТИ
|
//ПОЛУЧЕНИЕ ПУТИ
|
||||||
//ПОЛУЧЕНИЕ РАЗМЕРА ФАЙЛА
|
//ПОЛУЧЕНИЕ РАЗМЕРА ФАЙЛА
|
||||||
@@ -84,15 +96,11 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
stream >> filePath;
|
stream >> filePath;
|
||||||
stream >> fileSize;
|
stream >> fileSize;
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction())
|
||||||
|
{
|
||||||
emit sigSendDebugLog(Tools::getTime() + "CLIENT: filePath, fileSize - FAIL commitTransaction");
|
emit sigSendDebugLog(Tools::getTime() + "CLIENT: filePath, fileSize - FAIL commitTransaction");
|
||||||
|
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||||
if (!socket->waitForReadyRead(TCP_READ_TIMEOUT)) {
|
|
||||||
emit sigSendDebugLog(Tools::getTime() + "CLIENT: ERROR! readyRead timeout - filePath, fileSize!!!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
|
||||||
@@ -100,11 +108,10 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
emit sigSendDebugLog("CLIENT: filesize: " + QString::number(fileSize));
|
emit sigSendDebugLog("CLIENT: filesize: " + QString::number(fileSize));
|
||||||
emit sigSendDebugLog("CLIENT: filePath: " + filePath);
|
emit sigSendDebugLog("CLIENT: filePath: " + filePath);
|
||||||
|
|
||||||
socket->waitForReadyRead(100);
|
socket->waitForReadyRead(10);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//ПОЛУЧЕНИЕ САМОГО ФАЙЛА
|
//ПОЛУЧЕНИЕ САМОГО ФАЙЛА
|
||||||
emit sigSendDebugLog(Tools::getTime() + "AfterRead size and path BytesAvailable: " + socket->bytesAvailable());
|
emit sigSendDebugLog(Tools::getTime() + "AfterRead size and path BytesAvailable: " + socket->bytesAvailable());
|
||||||
|
|
||||||
@@ -115,47 +122,70 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
{
|
{
|
||||||
file.remove(); //удаление файла, если он уже есть, но необходимо обновить
|
file.remove(); //удаление файла, если он уже есть, но необходимо обновить
|
||||||
emit sigSendDebugLog(Tools::getTime() + "Delete exist file: " + filePath);
|
emit sigSendDebugLog(Tools::getTime() + "Delete exist file: " + filePath);
|
||||||
socket->waitForReadyRead(100);
|
|
||||||
|
//socket->waitForReadyRead(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmpBlock.clear();
|
||||||
|
sizeReceiveData = 0;
|
||||||
|
countSend = 0;
|
||||||
|
|
||||||
|
file.open(QFile::WriteOnly);
|
||||||
|
|
||||||
file.open(QFile::Append);
|
if(! file.isOpen())
|
||||||
|
QMessageBox::critical(nullptr, "P1", "isOpen false. File: " + file.fileName());
|
||||||
|
|
||||||
forever
|
if(! file.isWritable())
|
||||||
|
QMessageBox::critical(nullptr, "P2", "isWritable false. File: " + file.fileName());
|
||||||
|
|
||||||
|
while(true)
|
||||||
{
|
{
|
||||||
stream.startTransaction();
|
|
||||||
stream >> tmpBlock;
|
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(socket->bytesAvailable() <= 0)
|
||||||
|
{
|
||||||
if(socket->state() == QAbstractSocket::UnconnectedState){
|
socket->waitForReadyRead(10);
|
||||||
postProcessorSystem->socketDisable();
|
|
||||||
//emit sigSocketDisabled();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){
|
|
||||||
continue;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 toFile = file.write(tmpBlock);
|
sizeReceiveData += bytesReceived;
|
||||||
emit sigSendDebugLog(Tools::getTime() + "CLIENT: toFile :" + toFile);
|
|
||||||
|
|
||||||
sizeReceiveData += toFile;
|
|
||||||
countSend++;
|
countSend++;
|
||||||
|
|
||||||
|
qint64 toFile = file.write(tmpBlock);
|
||||||
|
|
||||||
|
if(toFile <= 0)
|
||||||
|
{
|
||||||
|
//emit sigUpdateBytesAvailable();
|
||||||
|
QMessageBox::critical(nullptr, "P4", "write toFile <= 0. File: " + file.fileName());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
tmpBlock.clear();
|
tmpBlock.clear();
|
||||||
|
|
||||||
if(sizeReceiveData == fileSize){
|
if(sizeReceiveData == fileSize)
|
||||||
|
{
|
||||||
emit sigSendDebugLog(Tools::getTime() + "FINAL Count send: " + QString::number(countSend));
|
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 Size received: " + QString::number(sizeReceiveData));
|
||||||
emit sigSendDebugLog(Tools::getTime() + "FINAL File size" + QString::number(fileSize));
|
emit sigSendDebugLog(Tools::getTime() + "FINAL File size" + QString::number(fileSize));
|
||||||
emit sigUpdateBytesAvailable();
|
emit sigUpdateBytesAvailable();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if(sizeReceiveData > fileSize)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(nullptr, "P5", "sizeReceiveData > fileSize");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
@@ -169,13 +199,16 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
sizeReceiveData = 0;
|
sizeReceiveData = 0;
|
||||||
countSend = 0;
|
countSend = 0;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(packetType == PacketType::TYPE_DELETE) //удаление лишних файлов (рекурсивно удаляет все содежимое)
|
case PacketType::TYPE_DELETE: //удаление лишних файлов (рекурсивно удаляет все содежимое)
|
||||||
{
|
{
|
||||||
stream.startTransaction();
|
stream.startTransaction();
|
||||||
stream >> filePath;
|
stream >> filePath;
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction())
|
||||||
|
{
|
||||||
|
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +216,6 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
|
|
||||||
QFileInfo fileInfo(filePath);
|
QFileInfo fileInfo(filePath);
|
||||||
|
|
||||||
|
|
||||||
if(fileInfo.exists())
|
if(fileInfo.exists())
|
||||||
{
|
{
|
||||||
if(fileInfo.isFile())
|
if(fileInfo.isFile())
|
||||||
@@ -192,29 +224,19 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
file.remove();
|
file.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fileInfo.isDir()){
|
if(fileInfo.isDir())
|
||||||
|
{
|
||||||
QDir dir(filePath);
|
QDir dir(filePath);
|
||||||
dir.removeRecursively();
|
dir.removeRecursively();
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << Tools::getTime() << "Deleted: " << filePath;
|
qDebug() << Tools::getTime() << "Deleted: " << filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
packetType = PacketType::TYPE_NONE;
|
|
||||||
continue;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if (packetType ==PacketType::TYPE_FINISH) //для повторного создания хэша после загрузки
|
case PacketType::TYPE_NEEDUPDATE: //нужно обновление
|
||||||
{
|
{
|
||||||
postProcessorSystem->calculateCommonHash();
|
|
||||||
|
|
||||||
emit sigLoadComplete();
|
|
||||||
packetType = PacketType::TYPE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(packetType == PacketType::TYPE_NEEDUPDATE){ //нужно обновление
|
|
||||||
|
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
quint64 size = 0;
|
quint64 size = 0;
|
||||||
quint64 fileCount = 0;
|
quint64 fileCount = 0;
|
||||||
@@ -226,48 +248,78 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
stream >> fileCount;
|
stream >> fileCount;
|
||||||
stream >> fileDelete;
|
stream >> fileDelete;
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction())
|
||||||
|
{
|
||||||
|
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sigNeedUpdate(flag,size,fileCount,fileDelete);
|
emit sigNeedUpdate(flag,size,fileCount,fileDelete);
|
||||||
packetType = PacketType::TYPE_NONE;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(packetType == PacketType::TYPE_XMLANSWER){ //ответы формата XML
|
case PacketType::TYPE_XMLANSWER: //ответы формата XML
|
||||||
|
{
|
||||||
QByteArray array;
|
QByteArray array;
|
||||||
stream.startTransaction();
|
stream.startTransaction();
|
||||||
stream >> array;
|
stream >> array;
|
||||||
|
|
||||||
if(!stream.commitTransaction()){
|
if(!stream.commitTransaction())
|
||||||
|
{
|
||||||
|
socket->waitForReadyRead(TCP_READ_TIMEOUT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataParser->xmlParser(array);
|
dataParser->xmlParser(array);
|
||||||
|
|
||||||
packetType = PacketType::TYPE_NONE;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(packetType == PacketType::HASH_READY)
|
case PacketType::HASH_READY:
|
||||||
{
|
{
|
||||||
emit sigCheckUpdate();
|
emit sigCheckUpdate();
|
||||||
//mainWindow->checkUpdate();
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(packetType == PacketType::HASH_CALCULATE_START)
|
case PacketType::RECALCULATE_HASH:
|
||||||
{
|
{
|
||||||
emit sigdRecalculateHashOnServerState();
|
emit sigdRecalculateHashOnServerState();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(packetType == PacketType::BUSY)
|
case PacketType::BUSY:
|
||||||
{
|
{
|
||||||
emit sigAnimationActivated(true);
|
emit sigAnimationActivated(true);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if(packetType == PacketType::FREE)
|
case PacketType::FREE:
|
||||||
{
|
{
|
||||||
emit sigAnimationActivated(false);
|
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!";
|
||||||
|
}
|
||||||
|
|
||||||
|
//socket->waitForReadyRead(10);
|
||||||
|
|
||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,12 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <Core\tools.h>
|
#include <Core\tools.h>
|
||||||
#include <Core\versioncontainer.h>
|
#include <Core\versioncontainer.h>
|
||||||
|
#include <Data/Client.h>
|
||||||
#include <Data\streamingversiondata.h>
|
#include <Data\streamingversiondata.h>
|
||||||
#include <Core\hashcomparer.h>
|
#include <Core\hashcomparer.h>
|
||||||
|
|
||||||
|
const int BLOCK_SIZE = 1024 * 1024; // Размер блока
|
||||||
|
|
||||||
class RecognizeSystem : public QObject
|
class RecognizeSystem : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -20,8 +23,10 @@ class RecognizeSystem : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit RecognizeSystem(QObject *parent = 0);
|
explicit RecognizeSystem(QObject *parent = 0);
|
||||||
~RecognizeSystem(){};
|
~RecognizeSystem(){};
|
||||||
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem);
|
|
||||||
|
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem,Client *client);
|
||||||
void recognize(QTcpSocket *socket);
|
void recognize(QTcpSocket *socket);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigUpdateBytesAvailable();
|
void sigUpdateBytesAvailable();
|
||||||
void sigLoadComplete();
|
void sigLoadComplete();
|
||||||
@@ -30,17 +35,22 @@ signals:
|
|||||||
void sigAnimationActivated(bool flag);
|
void sigAnimationActivated(bool flag);
|
||||||
void sigCheckUpdate();
|
void sigCheckUpdate();
|
||||||
void sigdRecalculateHashOnServerState();
|
void sigdRecalculateHashOnServerState();
|
||||||
|
void sigSendPacketType(PacketType packetType);
|
||||||
|
void sigSendPacketTypeWithDelay(PacketType packetType,int delay);
|
||||||
|
void sigSendToInlineLog(QString message);
|
||||||
|
//void sigCallUpdateList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
DataParser *dataParser;
|
DataParser *dataParser;
|
||||||
PostProcessorSystem *postProcessorSystem;
|
PostProcessorSystem *postProcessorSystem;
|
||||||
|
Client *client;
|
||||||
|
|
||||||
PacketType packetType;
|
PacketType packetType;
|
||||||
QString filePath;
|
QString filePath;
|
||||||
QByteArray tmpBlock;
|
|
||||||
|
|
||||||
qint64 sizeReceiveData;
|
|
||||||
qint64 fileSize;
|
qint64 fileSize;
|
||||||
|
qint64 sizeReceiveData;
|
||||||
|
QByteArray tmpBlock;
|
||||||
int countSend;
|
int countSend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -157,16 +157,6 @@ void SendSystem::sendXMLAnswer(const QByteArray& array)
|
|||||||
qDebug() << "Send XML answer in byte";
|
qDebug() << "Send XML answer in byte";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendSystem::sendFinish()
|
|
||||||
{
|
|
||||||
socket->waitForReadyRead(100);
|
|
||||||
QDataStream stream(socket);
|
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
|
||||||
|
|
||||||
stream << PacketType::TYPE_FINISH;
|
|
||||||
socket->waitForReadyRead(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendSystem::sendPacketType(PacketType packetType)
|
void SendSystem::sendPacketType(PacketType packetType)
|
||||||
{
|
{
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
@@ -175,12 +165,47 @@ void SendSystem::sendPacketType(PacketType packetType)
|
|||||||
stream << packetType;
|
stream << packetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendSystem::sendPacketTypeWithDelay(PacketType packetType,int delay)
|
||||||
|
{
|
||||||
|
QDataStream stream(socket);
|
||||||
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
socket->waitForReadyRead(delay);
|
||||||
|
stream << packetType;
|
||||||
|
}
|
||||||
void SendSystem::sendCheckHash()
|
void SendSystem::sendCheckHash()
|
||||||
{
|
{
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
QString fullPath = Tools::createSendFullPath(staticDataFolderName + hashFilename);
|
||||||
|
|
||||||
sendFileBlock(staticDataFolderName + hashFilename);
|
quint64 fileSize = 0;
|
||||||
|
int countSend = 0;
|
||||||
|
|
||||||
|
|
||||||
|
QFile file(fullPath); //Открываем файл для чтения
|
||||||
|
QFileInfo fileInfo(file);
|
||||||
|
|
||||||
|
fileSize = fileInfo.size();
|
||||||
|
|
||||||
|
stream << PacketType::SEND_HASH; //Отправляем тип блока
|
||||||
|
stream << fileSize;
|
||||||
|
|
||||||
|
socket->waitForReadyRead(20);
|
||||||
|
//socket->waitForBytesWritten();
|
||||||
|
|
||||||
|
if(file.open(QFile::ReadOnly)){
|
||||||
|
while(!file.atEnd()){
|
||||||
|
QByteArray data = file.read(readSize);
|
||||||
|
stream << data;
|
||||||
|
socket->waitForBytesWritten(20);
|
||||||
|
countSend++;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << Tools::getTime() << "count end Final: " << countSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
countSend = 0;
|
||||||
|
|
||||||
socket->waitForReadyRead(2000);
|
socket->waitForReadyRead(2000);
|
||||||
stream << PacketType::TYPE_CHECK_VERSION;
|
stream << PacketType::TYPE_CHECK_VERSION;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
void sendCheckHash();
|
void sendCheckHash();
|
||||||
void sendPacketType(PacketType packetType);
|
void sendPacketType(PacketType packetType);
|
||||||
~SendSystem(){};
|
~SendSystem(){};
|
||||||
|
void sendPacketTypeWithDelay(PacketType packetType, int delay);
|
||||||
signals:
|
signals:
|
||||||
void sigSend();
|
void sigSend();
|
||||||
QByteArray sigGetXmlAnswer(QString);
|
QByteArray sigGetXmlAnswer(QString);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ void TCPClient::initialize(RecognizeSystem *recognize,SendSystem *sendSystem)
|
|||||||
emit sigSendDebugLog(Tools::getTime() + " Client started");
|
emit sigSendDebugLog(Tools::getTime() + " Client started");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCPClient::setConnect(ServerSettings *serverSettings)
|
void TCPClient::setConnect(Settings *serverSettings)
|
||||||
{
|
{
|
||||||
socket = new QTcpSocket();
|
socket = new QTcpSocket();
|
||||||
qDebug() << "TCPCLient thread: " << thread();
|
qDebug() << "TCPCLient thread: " << thread();
|
||||||
@@ -47,7 +47,6 @@ void TCPClient::setConnect(ServerSettings *serverSettings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TCPClient::setDisconnect()
|
void TCPClient::setDisconnect()
|
||||||
{
|
{
|
||||||
socket->disconnect();
|
socket->disconnect();
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ class TCPClient : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit TCPClient(QObject *parent = 0);
|
explicit TCPClient(QObject *parent = 0);
|
||||||
void initialize(RecognizeSystem *recognize,SendSystem *sendSystem);
|
void initialize(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||||
void setConnect(ServerSettings *serverSettings);
|
void setConnect(Settings *serverSettings);
|
||||||
~TCPClient(){};
|
~TCPClient(){};
|
||||||
|
void setDisconnect();
|
||||||
bool getIsConnected() const;
|
bool getIsConnected() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -43,8 +43,6 @@ private:
|
|||||||
QTcpSocket *socket;
|
QTcpSocket *socket;
|
||||||
RecognizeSystem *recognizeSystem;
|
RecognizeSystem *recognizeSystem;
|
||||||
bool isConnected;
|
bool isConnected;
|
||||||
|
|
||||||
void setDisconnect();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TCPCLIENT_H
|
#endif // TCPCLIENT_H
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ QString Tools::getTime()
|
|||||||
|
|
||||||
QString Tools::createLocalPath(QString path)
|
QString Tools::createLocalPath(QString path)
|
||||||
{
|
{
|
||||||
qDebug() << "Full path: " << path;
|
//qDebug() << "Full path: " << path;
|
||||||
qint8 pos = path.indexOf("Application");
|
qint8 pos = path.indexOf("Application");
|
||||||
|
|
||||||
QString localPath = path.remove(0,--pos);
|
QString localPath = path.remove(0,--pos);
|
||||||
|
|
||||||
qDebug() << "Local path: " << localPath;
|
//qDebug() << "Local path: " << localPath;
|
||||||
return localPath;
|
return localPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
Core/tools.h
10
Core/tools.h
@@ -39,13 +39,16 @@ enum PacketType{
|
|||||||
TYPE_COMMAND = 3,
|
TYPE_COMMAND = 3,
|
||||||
TYPE_FOLDER = 4,
|
TYPE_FOLDER = 4,
|
||||||
TYPE_DELETE = 5,
|
TYPE_DELETE = 5,
|
||||||
TYPE_FINISH = 6,
|
UPDATE_FILE_COMPLETE = 6,
|
||||||
TYPE_NEEDUPDATE = 7,
|
TYPE_NEEDUPDATE = 7,
|
||||||
TYPE_XMLANSWER = 8,
|
TYPE_XMLANSWER = 8,
|
||||||
TYPE_QT = 9,
|
TYPE_QT = 9,
|
||||||
TYPE_DISABLE = 11,
|
TYPE_DISABLE = 11,
|
||||||
TYPE_UPDATE = 12,
|
TYPE_UPDATE = 12,
|
||||||
TYPE_CHECK_VERSION = 13,
|
TYPE_CHECK_VERSION = 13,
|
||||||
|
UPDATE_DOCS_COMPLETE = 22,
|
||||||
|
|
||||||
|
TYPE_XMLANSWER_DOCS_CHANGED = 132,
|
||||||
|
|
||||||
HASH_READY = 150,
|
HASH_READY = 150,
|
||||||
CHANGE_DATA_VERSION = 151,
|
CHANGE_DATA_VERSION = 151,
|
||||||
@@ -53,7 +56,10 @@ enum PacketType{
|
|||||||
DELETE_DATA_VERSION = 153,
|
DELETE_DATA_VERSION = 153,
|
||||||
BUSY = 154,
|
BUSY = 154,
|
||||||
FREE = 155,
|
FREE = 155,
|
||||||
HASH_CALCULATE_START = 156
|
RECALCULATE_HASH = 156,
|
||||||
|
RECALCULATE_DOCS = 157,
|
||||||
|
GET_DOCS = 158,
|
||||||
|
SEND_HASH = 159
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
105
Data/Client.h
Normal file
105
Data/Client.h
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#ifndef CLIENT_H
|
||||||
|
#define CLIENT_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QTcpSocket>
|
||||||
|
|
||||||
|
class Client
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
Client():
|
||||||
|
login(""),
|
||||||
|
ready(false)
|
||||||
|
{ };
|
||||||
|
~Client(){};
|
||||||
|
|
||||||
|
public:
|
||||||
|
QString getFullName()
|
||||||
|
{
|
||||||
|
return fullName;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setLogin(QString login)
|
||||||
|
{
|
||||||
|
this->login = login;
|
||||||
|
isLoggedIn = true;
|
||||||
|
fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login;
|
||||||
|
}
|
||||||
|
QString getLogin()
|
||||||
|
{
|
||||||
|
return login;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getAddress()
|
||||||
|
{
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
QString getPort()
|
||||||
|
{
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getReady()
|
||||||
|
{
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setReady(bool ready)
|
||||||
|
{
|
||||||
|
this->ready = ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator == (Client* right)
|
||||||
|
{
|
||||||
|
return this->address == right->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getIsLoggedIn()
|
||||||
|
{
|
||||||
|
return isLoggedIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setIsLoggedIn(bool value)
|
||||||
|
{
|
||||||
|
isLoggedIn = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setId(QString value)
|
||||||
|
{
|
||||||
|
id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray getClientHash()
|
||||||
|
{
|
||||||
|
return clientHash;
|
||||||
|
}
|
||||||
|
void setClientHash(const QByteArray &value)
|
||||||
|
{
|
||||||
|
clientHash = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString name;
|
||||||
|
QString address;
|
||||||
|
QString port;
|
||||||
|
QString fullName;
|
||||||
|
QString id;
|
||||||
|
|
||||||
|
QString login;
|
||||||
|
bool ready;
|
||||||
|
bool isLoggedIn;
|
||||||
|
QByteArray clientHash;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CLIENT_H
|
||||||
|
|
||||||
|
|
||||||
@@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class ServerSettings{
|
class Settings{
|
||||||
public:
|
public:
|
||||||
QString Address;
|
QString Address;
|
||||||
QString Port;
|
QString Port;
|
||||||
QString Language;
|
QString Language;
|
||||||
QString LocalVersionName;
|
QString LocalVersionName;
|
||||||
StreamingVersionData versionData;
|
StreamingVersionData versionData;
|
||||||
bool isAutoStart;
|
bool isAutoStart = false;
|
||||||
bool mathModelUse;
|
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
|
||||||
@@ -8,6 +8,7 @@ struct FileData
|
|||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
QString hash;
|
QString hash;
|
||||||
|
QString lastUpdate;
|
||||||
|
|
||||||
bool operator==(const FileData& other)const
|
bool operator==(const FileData& other)const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
QT += core gui
|
QT += core gui
|
||||||
QT += network
|
QT += network
|
||||||
QT += xml
|
QT += xml
|
||||||
|
QT += concurrent
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any Qt feature that has been marked deprecated (the exact warnings
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
@@ -19,6 +18,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
Core/dataparseroutput.cpp \
|
Core/dataparseroutput.cpp \
|
||||||
|
Core/fasthashcalculator.cpp \
|
||||||
Core/notifycontroller.cpp \
|
Core/notifycontroller.cpp \
|
||||||
Core/postprocessorsystem.cpp \
|
Core/postprocessorsystem.cpp \
|
||||||
Core/sendsystem.cpp \
|
Core/sendsystem.cpp \
|
||||||
@@ -32,6 +32,7 @@ SOURCES += \
|
|||||||
Core\tools.cpp\
|
Core\tools.cpp\
|
||||||
Core\hashcomparer.cpp \
|
Core\hashcomparer.cpp \
|
||||||
UI/resourcemanager.cpp \
|
UI/resourcemanager.cpp \
|
||||||
|
Widgets/updatefileslot.cpp \
|
||||||
Widgets/waitanimationwidget.cpp \
|
Widgets/waitanimationwidget.cpp \
|
||||||
Widgets\commonbuttongroupwidget.cpp \
|
Widgets\commonbuttongroupwidget.cpp \
|
||||||
Widgets\entrywidget.cpp \
|
Widgets\entrywidget.cpp \
|
||||||
@@ -46,6 +47,7 @@ SOURCES += \
|
|||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
Core/dataparseroutput.h \
|
Core/dataparseroutput.h \
|
||||||
|
Core/fasthashcalculator.h \
|
||||||
Core/notifycontroller.h \
|
Core/notifycontroller.h \
|
||||||
Core/postprocessorsystem.h \
|
Core/postprocessorsystem.h \
|
||||||
Core/versioncontainer.h \
|
Core/versioncontainer.h \
|
||||||
@@ -58,11 +60,14 @@ HEADERS += \
|
|||||||
Core\tcpclient.h\
|
Core\tcpclient.h\
|
||||||
Core\tools.h\
|
Core\tools.h\
|
||||||
Core\hashcomparer.h \
|
Core\hashcomparer.h \
|
||||||
|
Data/Client.h \
|
||||||
|
Data/ErrorsEnum.h \
|
||||||
Data/monitorInfo.h \
|
Data/monitorInfo.h \
|
||||||
Data/streamingversiondata.h \
|
Data/streamingversiondata.h \
|
||||||
Data\FileData.h\
|
Data\FileData.h\
|
||||||
Data\Datas.h \
|
Data\Datas.h \
|
||||||
UI/resourcemanager.h \
|
UI/resourcemanager.h \
|
||||||
|
Widgets/updatefileslot.h \
|
||||||
Widgets/waitanimationwidget.h \
|
Widgets/waitanimationwidget.h \
|
||||||
Widgets\commonbuttongroupwidget.h \
|
Widgets\commonbuttongroupwidget.h \
|
||||||
Widgets\entrywidget.h \
|
Widgets\entrywidget.h \
|
||||||
@@ -75,6 +80,7 @@ HEADERS += \
|
|||||||
widgetmanager.h
|
widgetmanager.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
Widgets/updatefileslot.ui \
|
||||||
Widgets/waitanimationwidget.ui \
|
Widgets/waitanimationwidget.ui \
|
||||||
Widgets\commonbuttongroupwidget.ui \
|
Widgets\commonbuttongroupwidget.ui \
|
||||||
Widgets\entrywidget.ui \
|
Widgets\entrywidget.ui \
|
||||||
@@ -85,11 +91,15 @@ FORMS += \
|
|||||||
TRANSLATIONS = QtLanguage_ru.ts\
|
TRANSLATIONS = QtLanguage_ru.ts\
|
||||||
QtLanguage_eng.ts
|
QtLanguage_eng.ts
|
||||||
|
|
||||||
|
#TEMPLATE = subdirs
|
||||||
|
#SUBDIRS += Unit-tests\
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
|
TARGET = ClientMPS
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc
|
resources.qrc
|
||||||
|
|
||||||
|
|||||||
2
StaticData/authData.xml
Normal file
2
StaticData/authData.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<AuthData Login="I3" Password="2be9bd7a3434f7038ca27d1918de58bd" InstructorName="Моськин В.М." ClientName="Моськин В.М." AccessType="instructor"/>
|
||||||
14328
StaticData/clientHash.xml
Normal file
14328
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;"/>
|
||||||
14305
StaticData/serverHash.xml
Normal file
14305
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 Port="6000" Address="192.168.100.83" Language="RUS" AutoStart="0"/>
|
||||||
|
<VersionData Version="customND" isChangable="1" Created="Пт мар 6 10:49:55 2026"/>
|
||||||
|
</ServerSettingsContainer>
|
||||||
14117
StaticData/streamingHash.xml
Normal file
14117
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="GETSERVERDATALIST"/>
|
||||||
@@ -15,7 +15,9 @@ void CommonButtonGroupWidget::initialize()
|
|||||||
ui->updateButton->hide();
|
ui->updateButton->hide();
|
||||||
ui->startButton->hide();
|
ui->startButton->hide();
|
||||||
ui->startButton->setEnabled(false);
|
ui->startButton->setEnabled(false);
|
||||||
|
ui->offlineStartButton->hide();
|
||||||
show();
|
show();
|
||||||
|
down = ui->downlayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonButtonGroupWidget::updateProgressBar(float value)
|
void CommonButtonGroupWidget::updateProgressBar(float value)
|
||||||
@@ -23,13 +25,19 @@ void CommonButtonGroupWidget::updateProgressBar(float value)
|
|||||||
ui->loadingProgressBar->setValue(value);
|
ui->loadingProgressBar->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QHBoxLayout *CommonButtonGroupWidget::getDown() const
|
||||||
|
{
|
||||||
|
return down;
|
||||||
|
}
|
||||||
|
|
||||||
void CommonButtonGroupWidget::loadCompleteState()
|
void CommonButtonGroupWidget::loadCompleteState()
|
||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
ui->updateButton->setEnabled(false);
|
ui->updateButton->hide();
|
||||||
ui->startButton->setEnabled(true);
|
ui->startButton->setEnabled(true);
|
||||||
ui->loadingProgressBar->setValue(100);
|
|
||||||
ui->startButton->show();
|
ui->startButton->show();
|
||||||
|
ui->offlineStartButton->show();
|
||||||
|
ui->loadingProgressBar->setValue(100);
|
||||||
ui->loadingProgressBar->hide();
|
ui->loadingProgressBar->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +47,9 @@ void CommonButtonGroupWidget::lastVerInstalledState()
|
|||||||
ui->updateButton->hide();
|
ui->updateButton->hide();
|
||||||
ui->loadingProgressBar->hide();
|
ui->loadingProgressBar->hide();
|
||||||
ui->startButton->setEnabled(true);
|
ui->startButton->setEnabled(true);
|
||||||
|
hideSpacer(true);
|
||||||
ui->startButton->show();
|
ui->startButton->show();
|
||||||
|
ui->offlineStartButton->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonButtonGroupWidget::disconnectState()
|
void CommonButtonGroupWidget::disconnectState()
|
||||||
@@ -48,16 +58,32 @@ void CommonButtonGroupWidget::disconnectState()
|
|||||||
ui->loadingProgressBar->hide();
|
ui->loadingProgressBar->hide();
|
||||||
ui->updateButton->hide();
|
ui->updateButton->hide();
|
||||||
ui->updateButton->setEnabled(false);
|
ui->updateButton->setEnabled(false);
|
||||||
|
ui->offlineStartButton->hide();
|
||||||
|
hideSpacer(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonButtonGroupWidget::startUpdateState()
|
void CommonButtonGroupWidget::startUpdateState()
|
||||||
{
|
{
|
||||||
ui->updateButton->hide();
|
ui->updateButton->hide();
|
||||||
ui->startButton->hide();
|
ui->startButton->hide();
|
||||||
|
ui->offlineStartButton->hide();
|
||||||
ui->loadingProgressBar->setValue(0);
|
ui->loadingProgressBar->setValue(0);
|
||||||
ui->loadingProgressBar->show();
|
ui->loadingProgressBar->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommonButtonGroupWidget::loginState()
|
||||||
|
{
|
||||||
|
bool isAvailable = emit sigAppAvailable();
|
||||||
|
if (isAvailable)
|
||||||
|
{
|
||||||
|
ui->offlineStartButton->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->offlineStartButton->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CommonButtonGroupWidget::showProgressBar(bool flag)
|
void CommonButtonGroupWidget::showProgressBar(bool flag)
|
||||||
{
|
{
|
||||||
if (flag) ui->loadingProgressBar->show();
|
if (flag) ui->loadingProgressBar->show();
|
||||||
@@ -66,6 +92,9 @@ void CommonButtonGroupWidget::showProgressBar(bool flag)
|
|||||||
|
|
||||||
void CommonButtonGroupWidget::needUpdateState(bool flag)
|
void CommonButtonGroupWidget::needUpdateState(bool flag)
|
||||||
{
|
{
|
||||||
|
show();
|
||||||
|
hideSpacer(true);
|
||||||
|
ui->loadingProgressBar->hide();
|
||||||
ui->startButton->hide();
|
ui->startButton->hide();
|
||||||
ui->updateButton->setEnabled(flag);
|
ui->updateButton->setEnabled(flag);
|
||||||
ui->updateButton->show();
|
ui->updateButton->show();
|
||||||
@@ -73,6 +102,9 @@ void CommonButtonGroupWidget::needUpdateState(bool flag)
|
|||||||
|
|
||||||
void CommonButtonGroupWidget::startButtonActive(bool flag)
|
void CommonButtonGroupWidget::startButtonActive(bool flag)
|
||||||
{
|
{
|
||||||
|
if(flag) ui->offlineStartButton->show();
|
||||||
|
else ui->offlineStartButton->hide();
|
||||||
|
|
||||||
ui->startButton->setEnabled(flag);
|
ui->startButton->setEnabled(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +126,13 @@ CommonButtonGroupWidget::~CommonButtonGroupWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommonButtonGroupWidget::hideSpacer(bool flag)
|
||||||
|
{
|
||||||
|
if(flag) ui->horizontalSpacer->changeSize(0,0,QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
else ui->horizontalSpacer->changeSize(40,20,QSizePolicy::Expanding,QSizePolicy::Minimum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommonButtonGroupWidget::on_offlineStartButton_clicked()
|
||||||
|
{
|
||||||
|
emit sigStartOfflineUnityClient();
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef COMMONBUTTONGROUPWIDGET_H
|
#ifndef COMMONBUTTONGROUPWIDGET_H
|
||||||
#define COMMONBUTTONGROUPWIDGET_H
|
#define COMMONBUTTONGROUPWIDGET_H
|
||||||
|
|
||||||
|
#include <QHBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <Core/tcpclient.h>
|
#include <Core/tcpclient.h>
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ public:
|
|||||||
void lastVerInstalledState();
|
void lastVerInstalledState();
|
||||||
void disconnectState();
|
void disconnectState();
|
||||||
void startUpdateState();
|
void startUpdateState();
|
||||||
|
void loginState();
|
||||||
void showProgressBar(bool flag);
|
void showProgressBar(bool flag);
|
||||||
void needUpdateState(bool flag);
|
void needUpdateState(bool flag);
|
||||||
void startButtonActive(bool flag);
|
void startButtonActive(bool flag);
|
||||||
@@ -28,16 +30,22 @@ signals:
|
|||||||
void sigSendPacket(PacketType packet);
|
void sigSendPacket(PacketType packet);
|
||||||
void sigUpdateCommonWidget();
|
void sigUpdateCommonWidget();
|
||||||
void sigStartUnityClient();
|
void sigStartUnityClient();
|
||||||
|
void sigStartOfflineUnityClient();
|
||||||
|
bool sigAppAvailable();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_updateButton_clicked();
|
void on_updateButton_clicked();
|
||||||
void on_startButton_clicked();
|
void on_startButton_clicked();
|
||||||
|
void on_offlineStartButton_clicked();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void updateProgressBar(float value);
|
void updateProgressBar(float value);
|
||||||
|
QHBoxLayout *getDown() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CommonButtonGroupWidget *ui;
|
Ui::CommonButtonGroupWidget *ui;
|
||||||
|
QHBoxLayout *down;
|
||||||
|
void hideSpacer(bool flag);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMMONBUTTONGROUPWIDGET_H
|
#endif // COMMONBUTTONGROUPWIDGET_H
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>520</width>
|
<width>763</width>
|
||||||
<height>45</height>
|
<height>45</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>520</width>
|
<width>761</width>
|
||||||
<height>45</height>
|
<height>45</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -99,14 +99,14 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>500</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>500</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -158,6 +158,47 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="offlineStartButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Запуск в автономном режиме</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
#include "entrywidget.h"
|
#include "entrywidget.h"
|
||||||
#include "ui_entrywidget.h"
|
#include "ui_entrywidget.h"
|
||||||
|
|
||||||
|
#include <bits/functional_hash.h>
|
||||||
|
|
||||||
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
EntryWidget::EntryWidget(QWidget *parent) :
|
EntryWidget::EntryWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::EntryWidget)
|
ui(new Ui::EntryWidget),
|
||||||
|
isAppAvailable(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
@@ -18,6 +23,7 @@ void EntryWidget::initialize()
|
|||||||
void EntryWidget::disconnectState()
|
void EntryWidget::disconnectState()
|
||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
|
setAppAvailable(emit sigAppAvalable());
|
||||||
ui->offlineWidget->show();
|
ui->offlineWidget->show();
|
||||||
ui->loginWidget->hide();
|
ui->loginWidget->hide();
|
||||||
}
|
}
|
||||||
@@ -34,7 +40,9 @@ ClientAutorization* EntryWidget::getAuthData()
|
|||||||
QString username = ui->loginInputField->text();
|
QString username = ui->loginInputField->text();
|
||||||
QString password = ui->passwordInputField->text();
|
QString password = ui->passwordInputField->text();
|
||||||
data->Login = username;
|
data->Login = username;
|
||||||
data->Password = password;
|
|
||||||
|
QByteArray md5Hash = QCryptographicHash::hash(password.toUtf8(), QCryptographicHash::Md5).toHex();
|
||||||
|
data->Password = QString(md5Hash);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -59,25 +67,10 @@ void EntryWidget::on_saveServerButton_clicked()
|
|||||||
emit sigSaveServerSettings();
|
emit sigSaveServerSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSettings *EntryWidget::getServerSettings()
|
void EntryWidget::fillSettings(Settings *settings)
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
ui->serverInputField->setText(settings->Address);
|
ui->serverInputField->setText(settings->Address);
|
||||||
ui->portInputField->setText(settings->Port);
|
ui->portInputField->setText(settings->Port);
|
||||||
//ui->mathModelUsecheckBox->setChecked(settings->mathModelUse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntryWidget::isActive(bool flag)
|
void EntryWidget::isActive(bool flag)
|
||||||
@@ -91,6 +84,30 @@ bool EntryWidget::getLoginWidgetIsHidden()
|
|||||||
return ui->loginWidget->isHidden();
|
return ui->loginWidget->isHidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntryWidget::setAppAvailable(bool flag)
|
||||||
|
{
|
||||||
|
isAppAvailable = flag;
|
||||||
|
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
QString text = tr("Связь с сервером не установлена! Проверьте настройки или запустите в автономном режиме");
|
||||||
|
ui->offlineNotifyLabel->setText(text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString text = tr("Связь с сервером не установлена! Проверьте настройки подключения и загрузите клиент с сервера");
|
||||||
|
ui->offlineNotifyLabel->setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString EntryWidget::getAddress(){
|
||||||
|
return ui->serverInputField->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString EntryWidget::getPort(){
|
||||||
|
return ui->portInputField->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EntryWidget::~EntryWidget()
|
EntryWidget::~EntryWidget()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,16 +20,18 @@ public:
|
|||||||
void showLoginWidget(bool flag);
|
void showLoginWidget(bool flag);
|
||||||
|
|
||||||
void disconnectState();
|
void disconnectState();
|
||||||
void fillSettings(ServerSettings *settings);
|
void fillSettings(Settings *settings);
|
||||||
void isActive(bool flag);
|
void isActive(bool flag);
|
||||||
bool getLoginWidgetIsHidden();
|
bool getLoginWidgetIsHidden();
|
||||||
|
void setAppAvailable(bool flag);
|
||||||
ServerSettings *getServerSettings();
|
|
||||||
ClientAutorization* getAuthData();
|
ClientAutorization* getAuthData();
|
||||||
|
|
||||||
|
QString getAddress();
|
||||||
|
QString getPort();
|
||||||
signals:
|
signals:
|
||||||
void sigTryLogin();
|
void sigTryLogin();
|
||||||
void sigSaveServerSettings();
|
void sigSaveServerSettings();
|
||||||
|
bool sigAppAvalable();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_loginButton_clicked();
|
void on_loginButton_clicked();
|
||||||
@@ -37,6 +39,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::EntryWidget *ui;
|
Ui::EntryWidget *ui;
|
||||||
|
bool isAppAvailable;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENTRYWIDGET_H
|
#endif // ENTRYWIDGET_H
|
||||||
|
|||||||
@@ -351,7 +351,7 @@
|
|||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Связь с сервером не установлена! Проверьте настройки или запустите в автономном режиме</string>
|
<string>тест</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="scaledContents">
|
<property name="scaledContents">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|||||||
87
Widgets/updatefileslot.cpp
Normal file
87
Widgets/updatefileslot.cpp
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#include "updatefileslot.h"
|
||||||
|
#include "ui_updatefileslot.h"
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
UpdateFileSlot::UpdateFileSlot(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::UpdateFileSlot),
|
||||||
|
needUpdate(false)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateFileSlot::fill(QString itemName, FileData serverData, FileData localData)
|
||||||
|
{
|
||||||
|
ui->Path->setText(itemName);
|
||||||
|
local = localData;
|
||||||
|
|
||||||
|
bool haveData = serverData.lastUpdate != "нет";
|
||||||
|
|
||||||
|
QString result = " Сервер: ";
|
||||||
|
|
||||||
|
QDateTime serverFileTime;
|
||||||
|
if (haveData)
|
||||||
|
{
|
||||||
|
serverFileTime = QDateTime::fromString(serverData.lastUpdate,"dd.MM.yyyy hh:mm:ss");
|
||||||
|
result.append(serverFileTime.toString("dd.MM.yyyy"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.append("НЕТ");
|
||||||
|
}
|
||||||
|
|
||||||
|
QDateTime localFileTime = QDateTime::fromString(localData.lastUpdate,"dd.MM.yyyy hh:mm:ss");
|
||||||
|
|
||||||
|
result.append(" Локально: ");
|
||||||
|
result.append(localFileTime.toString("dd.MM.yyyy"));
|
||||||
|
ui->Dates->setText(result);
|
||||||
|
|
||||||
|
bool newest = localFileTime > serverFileTime;
|
||||||
|
|
||||||
|
ui->UpdateCheckBox->setChecked(newest);
|
||||||
|
QPixmap pixmap;
|
||||||
|
if (newest)
|
||||||
|
{
|
||||||
|
pixmap.load(":/resource/Icons/new.png");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pixmap.load(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap scaled = pixmap.scaled(ui->Image->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
ui->Image->setPixmap(scaled);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateFileSlot::~UpdateFileSlot()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileData UpdateFileSlot::getLocal() const
|
||||||
|
{
|
||||||
|
return local;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UpdateFileSlot::getNeedUpdate() const
|
||||||
|
{
|
||||||
|
return needUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateFileSlot::setNeedUpdate(bool value)
|
||||||
|
{
|
||||||
|
needUpdate = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateFileSlot::on_UpdateCheckBox_stateChanged(int arg1)
|
||||||
|
{
|
||||||
|
if (ui->UpdateCheckBox->checkState() == Qt::Checked)
|
||||||
|
{
|
||||||
|
needUpdate = true;
|
||||||
|
}
|
||||||
|
else if (ui->UpdateCheckBox->checkState() == Qt::Unchecked)
|
||||||
|
{
|
||||||
|
needUpdate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Widgets/updatefileslot.h
Normal file
36
Widgets/updatefileslot.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef UPDATEFILESLOT_H
|
||||||
|
#define UPDATEFILESLOT_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <Data/FileData.h>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class UpdateFileSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateFileSlot : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit UpdateFileSlot(QWidget *parent = nullptr);
|
||||||
|
void fill(QString itemName, FileData serverData, FileData localData);
|
||||||
|
|
||||||
|
bool getNeedUpdate() const;
|
||||||
|
void setNeedUpdate(bool value);
|
||||||
|
FileData getLocal() const;
|
||||||
|
|
||||||
|
~UpdateFileSlot();
|
||||||
|
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_UpdateCheckBox_stateChanged(int arg1);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::UpdateFileSlot *ui;
|
||||||
|
FileData local;
|
||||||
|
bool needUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // UPDATEFILESLOT_H
|
||||||
79
Widgets/updatefileslot.ui
Normal file
79
Widgets/updatefileslot.ui
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>UpdateFileSlot</class>
|
||||||
|
<widget class="QWidget" name="UpdateFileSlot">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>789</width>
|
||||||
|
<height>40</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Frame</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>701</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="mainLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="Path">
|
||||||
|
<property name="text">
|
||||||
|
<string>/RUS/Scens/XXX-X-XX-XX-XX-XXXXXX-XXXX-X</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="Dates">
|
||||||
|
<property name="text">
|
||||||
|
<string>XXXXXXX XXxXXxXXX XXXXXXXXx XXxXXxXXXX</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="Image">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>735</x>
|
||||||
|
<y>-4</y>
|
||||||
|
<width>51</width>
|
||||||
|
<height>51</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../resources.qrc">:/resource/Icons/new.png</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="UpdateCheckBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>6</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>21</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../resources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "Core/tools.h"
|
#include "Core/tools.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTextDocumentFragment>
|
||||||
|
|
||||||
UpdateNotifyWidget::UpdateNotifyWidget(QWidget *) :
|
UpdateNotifyWidget::UpdateNotifyWidget(QWidget *) :
|
||||||
ui(new Ui::UpdateNotifyWidget)
|
ui(new Ui::UpdateNotifyWidget)
|
||||||
@@ -27,25 +28,35 @@ void UpdateNotifyWidget::setVersionContainer(VersionContainer *versionContainer)
|
|||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::addToList(FileData fileData)
|
void UpdateNotifyWidget::addToList(FileData localFileData,FileData serverFileData)
|
||||||
{
|
{
|
||||||
QString itemName = fileData.path;
|
QString itemName = localFileData.path;
|
||||||
itemName = itemName.remove(streamingAssetsPath);
|
itemName = itemName.remove(streamingAssetsPath);
|
||||||
ui->updateListWidget->addItem(itemName);
|
UpdateFileSlot *slot = new UpdateFileSlot();
|
||||||
|
QListWidgetItem *widgetItem = new QListWidgetItem();
|
||||||
|
|
||||||
|
widgetItem->setSizeHint(QSize(slot->width(),slot->height()));
|
||||||
|
ui->updateListWidget->addItem(widgetItem);
|
||||||
|
ui->updateListWidget->setItemWidget(widgetItem,slot);
|
||||||
|
|
||||||
|
slot->fill(itemName,serverFileData,localFileData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::showTryChangeBase()
|
void UpdateNotifyWidget::showTryChangeBase()
|
||||||
{
|
{
|
||||||
QString path = QDir::currentPath() + streamingAssetsPath;
|
QString path = QDir::currentPath() + streamingAssetsPath;
|
||||||
QString link = "<a href=\""+ path + "\"style=\"color:white;\">папку</a>";
|
QString link = "<a href=\""+ path + "\"style=\"color:lightblue; text-decoration: underline;\">папку</a>";
|
||||||
|
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("Данные изменения нельзя выгрузить на сервер, так как версия сервера не изменяема \n")));
|
ui->labelsLayout->addWidget(createLabel(tr("Данные изменения нельзя выгрузить на сервер, так как версия сервера не изменяема \n")));
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("Чтобы выгрузить на сервер нужно:")));
|
ui->labelsLayout->addWidget(createLabel(tr("Чтобы выгрузить на сервер нужно:")));
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("1. Скопировать измененные или созданные файлы в временную папку")));
|
ui->labelsLayout->addWidget(createLabel(tr("1. Скопировать измененные или созданные файлы в временную папку")));
|
||||||
QLabel *labelStorage = new QLabel;
|
QLabel *labelStorage = new QLabel;
|
||||||
QString link2 = "<a href=\""+ path + "\"style=\"color:white;\">тут</a>";
|
QString link2 = "<a href=\""+ path + "\"style=\"color:lightblue; text-decoration: underline;\">тут</a>";
|
||||||
labelStorage->setText(tr("Файлы можно найти в ") + link2 );
|
labelStorage->setText(tr("Файлы можно найти в ") + link2);
|
||||||
|
labelStorage->setTextFormat(Qt::RichText);
|
||||||
|
labelStorage->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
labelStorage->setOpenExternalLinks(true);
|
labelStorage->setOpenExternalLinks(true);
|
||||||
|
|
||||||
ui->labelsLayout->addWidget(labelStorage);
|
ui->labelsLayout->addWidget(labelStorage);
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("2. Нажать Отменить изменения и дождатся окончания операции")));
|
ui->labelsLayout->addWidget(createLabel(tr("2. Нажать Отменить изменения и дождатся окончания операции")));
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("3. Изменить версию сервера на изменяемую")));
|
ui->labelsLayout->addWidget(createLabel(tr("3. Изменить версию сервера на изменяемую")));
|
||||||
@@ -55,6 +66,8 @@ void UpdateNotifyWidget::showTryChangeBase()
|
|||||||
QLabel *linkLabel = new QLabel;
|
QLabel *linkLabel = new QLabel;
|
||||||
linkLabel->setText(tr("5. Скопировать файлы из временной папки в эту ") + link);
|
linkLabel->setText(tr("5. Скопировать файлы из временной папки в эту ") + link);
|
||||||
linkLabel->setOpenExternalLinks(true);
|
linkLabel->setOpenExternalLinks(true);
|
||||||
|
linkLabel->setTextFormat(Qt::RichText);
|
||||||
|
linkLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
|
|
||||||
ui->labelsLayout->addWidget(linkLabel);
|
ui->labelsLayout->addWidget(linkLabel);
|
||||||
ui->labelsLayout->addWidget(createLabel(tr("6.Перезапустить клиент и выгрузить изменения на сервер")));
|
ui->labelsLayout->addWidget(createLabel(tr("6.Перезапустить клиент и выгрузить изменения на сервер")));
|
||||||
@@ -66,11 +79,7 @@ void UpdateNotifyWidget::showWithFill()
|
|||||||
{
|
{
|
||||||
clearList();
|
clearList();
|
||||||
|
|
||||||
if(!versionContainer->getLocalVersionData()->getIsChangeable())
|
if(!versionContainer->getServerVersionData()->getIsChangeable())
|
||||||
{
|
|
||||||
showTryChangeBase();
|
|
||||||
}
|
|
||||||
else if(!versionContainer->getServerVersionData()->getIsChangeable())
|
|
||||||
{
|
{
|
||||||
showTryChangeBase();
|
showTryChangeBase();
|
||||||
}
|
}
|
||||||
@@ -117,6 +126,29 @@ void UpdateNotifyWidget::on_startWithCurrentChangesButton_clicked()
|
|||||||
emit sigStartUnityClient();
|
emit sigStartUnityClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateNotifyWidget::closeWindow()
|
||||||
|
{
|
||||||
|
on_closeButton_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<FileData> *UpdateNotifyWidget::getUpdateList()
|
||||||
|
{
|
||||||
|
QList<FileData> *realUpdateList = new QList<FileData>();
|
||||||
|
|
||||||
|
for (int i = 0; i < ui->updateListWidget->count(); i++) {
|
||||||
|
QListWidgetItem *item = ui->updateListWidget->item(i);
|
||||||
|
UpdateFileSlot *slot = qobject_cast<UpdateFileSlot*>(ui->updateListWidget->itemWidget(item));
|
||||||
|
|
||||||
|
if (slot && slot->getNeedUpdate())
|
||||||
|
{
|
||||||
|
realUpdateList->append(slot->getLocal());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return realUpdateList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::setUpdateState()
|
void UpdateNotifyWidget::setUpdateState()
|
||||||
{
|
{
|
||||||
ui->undoChangesButton->show();
|
ui->undoChangesButton->show();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <Data/FileData.h>
|
#include <Data/FileData.h>
|
||||||
#include <Core/versioncontainer.h>
|
#include <Core/versioncontainer.h>
|
||||||
|
#include <Widgets/updatefileslot.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class UpdateNotifyWidget;
|
class UpdateNotifyWidget;
|
||||||
@@ -21,10 +22,12 @@ public:
|
|||||||
explicit UpdateNotifyWidget(QWidget *parent = nullptr);
|
explicit UpdateNotifyWidget(QWidget *parent = nullptr);
|
||||||
~UpdateNotifyWidget();
|
~UpdateNotifyWidget();
|
||||||
void initialize(QPoint startPos);
|
void initialize(QPoint startPos);
|
||||||
void addToList(FileData fileData);
|
void addToList(FileData localFileData,FileData serverFileData);
|
||||||
void showWithFill();
|
void showWithFill();
|
||||||
void showTryChangeBase();
|
void showTryChangeBase();
|
||||||
void setVersionContainer(VersionContainer *versionContainer);
|
void setVersionContainer(VersionContainer *versionContainer);
|
||||||
|
void closeWindow();
|
||||||
|
QList<FileData> *getUpdateList();
|
||||||
signals:
|
signals:
|
||||||
void sigLoadToServerBehaviour();
|
void sigLoadToServerBehaviour();
|
||||||
void sigUndoCurrentChanges();
|
void sigUndoCurrentChanges();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Обнаружены новые файлы:</string>
|
<string>Обнаружены новые или измененные файлы:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
<property name="openExternalLinks">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ Bootstrap::Bootstrap(QObject *parent) : QObject(parent)
|
|||||||
void Bootstrap::initialize()
|
void Bootstrap::initialize()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<PacketType>("PacketType");
|
qRegisterMetaType<PacketType>("PacketType");
|
||||||
|
qRegisterMetaType<ErrorsEnum>("ErrorsEnum");
|
||||||
|
qRegisterMetaType<FileData>("FileData");
|
||||||
|
|
||||||
widgetManager->initialize();
|
widgetManager->initialize();
|
||||||
coreManager->initialize(widgetManager, workerThread);
|
coreManager->initialize(widgetManager, workerThread);
|
||||||
|
|||||||
144
coremanager.cpp
144
coremanager.cpp
@@ -4,7 +4,7 @@ CoreManager::CoreManager(QObject *parent) :
|
|||||||
QObject(parent),
|
QObject(parent),
|
||||||
isRecovery(false)
|
isRecovery(false)
|
||||||
{
|
{
|
||||||
client = new TCPClient;
|
tcpClient = new TCPClient;
|
||||||
dataParser = new DataParser;
|
dataParser = new DataParser;
|
||||||
dataParserOutput = new DataParserOutput;
|
dataParserOutput = new DataParserOutput;
|
||||||
updateController = new UpdateController;
|
updateController = new UpdateController;
|
||||||
@@ -16,14 +16,18 @@ CoreManager::CoreManager(QObject *parent) :
|
|||||||
versionContainer = new VersionContainer;
|
versionContainer = new VersionContainer;
|
||||||
resourceManager = new ResourceManager;
|
resourceManager = new ResourceManager;
|
||||||
postProcessorSystem = new PostProcessorSystem;
|
postProcessorSystem = new PostProcessorSystem;
|
||||||
|
client = new Client;
|
||||||
|
settings = new Settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
||||||
{
|
{
|
||||||
|
createNewServerSettings();
|
||||||
|
|
||||||
this->workerThread = workerThread;
|
this->workerThread = workerThread;
|
||||||
this->widgetManager = widgetManager;
|
this->widgetManager = widgetManager;
|
||||||
|
|
||||||
client->moveToThread(workerThread);
|
tcpClient->moveToThread(workerThread);
|
||||||
dataParser->moveToThread(workerThread);
|
dataParser->moveToThread(workerThread);
|
||||||
dataParserOutput->moveToThread(workerThread);
|
dataParserOutput->moveToThread(workerThread);
|
||||||
sendSystem->moveToThread(workerThread);
|
sendSystem->moveToThread(workerThread);
|
||||||
@@ -31,11 +35,8 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
|||||||
recognizeSystem->moveToThread(workerThread);
|
recognizeSystem->moveToThread(workerThread);
|
||||||
postProcessorSystem->moveToThread(workerThread);
|
postProcessorSystem->moveToThread(workerThread);
|
||||||
hashComparer->moveToThread(workerThread);
|
hashComparer->moveToThread(workerThread);
|
||||||
// versionContainer->moveToThread(workerThread); //проверить работоспособность
|
|
||||||
// resourceManager->moveToThread(workerThread); //проверить работоспособность
|
|
||||||
|
|
||||||
workerThread->start();
|
workerThread->start();
|
||||||
//workerThread->setPriority(QThread::HighestPriority);
|
|
||||||
|
|
||||||
binding();
|
binding();
|
||||||
initializeSystems();
|
initializeSystems();
|
||||||
@@ -46,40 +47,39 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
|||||||
|
|
||||||
void CoreManager::start()
|
void CoreManager::start()
|
||||||
{
|
{
|
||||||
checkAppAvailable();
|
//checkAppAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::loadStaticData()
|
void CoreManager::loadStaticData()
|
||||||
{
|
{
|
||||||
ServerSettings *currentSettings = dataParser->getClientSettings();
|
settings = dataParser->getSettings();
|
||||||
setLanguage(currentSettings->Language);
|
setLanguage(settings->Language);
|
||||||
setLocalVersion();
|
setLocalVersion();
|
||||||
externalExecuter->setIsAutoStart(currentSettings->isAutoStart);
|
externalExecuter->setIsAutoStart(settings->isAutoStart);
|
||||||
bool appAvailable = externalExecuter->findApp();
|
emit sigSetLoadSettings(settings);
|
||||||
widgetManager->setAppAvailable(appAvailable);
|
|
||||||
emit sigSetLoadSettings(currentSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::binding()
|
void CoreManager::binding()
|
||||||
{
|
{
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,widgetManager,&WidgetManager::slotActivateLoadAnimation,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,widgetManager,&WidgetManager::slotActivateLoadAnimation,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(this,&CoreManager::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
connect(this,&CoreManager::sigInitializeClient,tcpClient,&TCPClient::initialize,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSetConnect,tcpClient,&TCPClient::setConnect,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendCommand,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendCheckUpdate,sendSystem,&SendSystem::sendCheckHash,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendCheckUpdate,sendSystem,&SendSystem::sendCheckHash,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendXMLAnswer,sendSystem,&SendSystem::xmlAnswer,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendXMLAnswer,sendSystem,&SendSystem::xmlAnswer,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigSendAutorization,sendSystem,&SendSystem::sendClientAutorization);
|
connect(this,&CoreManager::sigSendAutorization,sendSystem,&SendSystem::sendClientAutorization,Qt::AutoConnection);
|
||||||
|
connect(this,&CoreManager::sigGetClientSettings,dataParser,&DataParser::getSettings,Qt::DirectConnection);
|
||||||
|
|
||||||
connect(this,&CoreManager::sigSendUpdateToServer,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSendUpdateToServer,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
|
||||||
connect(this,&CoreManager::sigGetConnected,client,&TCPClient::getIsConnected);
|
connect(this,&CoreManager::sigGetConnected,tcpClient,&TCPClient::getIsConnected);
|
||||||
connect(this,&CoreManager::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
|
connect(this,&CoreManager::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
|
||||||
|
|
||||||
connect(this,&CoreManager::sigSetLoadSettings,widgetManager,&WidgetManager::slotSetLoadSettings,Qt::AutoConnection);
|
connect(this,&CoreManager::sigSetLoadSettings,widgetManager,&WidgetManager::slotSetLoadSettings,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigSocketDisabled,this,&CoreManager::lostConnection,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigShowError,this,&CoreManager::showError,Qt::AutoConnection);
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigServerBlocked,this,&CoreManager::serverBlocked,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection);
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection); // ОПАСНОСТЬ
|
|
||||||
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&CoreManager::checkLoginResult,Qt::AutoConnection);
|
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&CoreManager::checkLoginResult,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&CoreManager::setServerVersion,Qt::AutoConnection);
|
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&CoreManager::setServerVersion,Qt::AutoConnection);
|
||||||
@@ -89,19 +89,26 @@ void CoreManager::binding()
|
|||||||
connect(recognizeSystem,&RecognizeSystem::sigNeedUpdate,this,&CoreManager::checkNeedUpdate,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigNeedUpdate,this,&CoreManager::checkNeedUpdate,Qt::AutoConnection);
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigCheckUpdate,this,&CoreManager::checkUpdate,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigCheckUpdate,this,&CoreManager::checkUpdate,Qt::AutoConnection);
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigdRecalculateHashOnServerState,this,&CoreManager::recalculateState,Qt::AutoConnection);
|
connect(recognizeSystem,&RecognizeSystem::sigdRecalculateHashOnServerState,this,&CoreManager::recalculateState,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigSendPacketType,this,&CoreManager::sendPacketType,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigSendPacketTypeWithDelay,sendSystem,&SendSystem::sendPacketTypeWithDelay,Qt::AutoConnection);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigSendToInlineLog,this,&CoreManager::setInlineDebug,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(hashComparer,&HashComparer::sigCallCheck,this,&CoreManager::checkUpdate);
|
connect(hashComparer,&HashComparer::sigCallCheck,this,&CoreManager::checkUpdate);
|
||||||
connect(hashComparer,&HashComparer::sigHaveDelta,this,&CoreManager::checkUpdateInfo);
|
connect(hashComparer,&HashComparer::sigHaveDelta,this,&CoreManager::checkUpdateInfo);
|
||||||
|
|
||||||
connect(updateController,&UpdateController::sigUpdateComplete,widgetManager,&WidgetManager::setCompeteState,Qt::AutoConnection);//ОПАСНОСТЬ
|
connect(updateController,&UpdateController::sigUpdateComplete,widgetManager,&WidgetManager::setCompeteState,Qt::AutoConnection);
|
||||||
connect(updateController,&UpdateController::sigSendHashInfo,widgetManager->getMainWindow(),&MainWindow::updateInitInformation,Qt::AutoConnection);
|
connect(updateController->getHashCalculator(),&FastHashCalculator::sigSendHashInfo,widgetManager->getMainWindow(),&MainWindow::updateInitInformation,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(client,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);//ОПАСНОСТЬ
|
connect(tcpClient,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);
|
||||||
connect(client,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);//ОПАСНОСТЬ
|
connect(tcpClient,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(sendSystem,&SendSystem::sigSend,this,&CoreManager::calcUpdateProgress,Qt::AutoConnection);
|
connect(sendSystem,&SendSystem::sigSend,this,&CoreManager::calcUpdateProgress,Qt::AutoConnection);
|
||||||
|
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);
|
||||||
|
|
||||||
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);//ОПАСНОСТЬ
|
connect(widgetManager->getEntryWidget(),&EntryWidget::sigAppAvalable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||||
|
connect(widgetManager->getMainWindow(),&MainWindow::sigAppAvailable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||||
|
connect(widgetManager->getCommonButtonGroupWidget(),&CommonButtonGroupWidget::sigAppAvailable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||||
|
connect(widgetManager,&WidgetManager::sigAppAvailable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::initializeSystems()
|
void CoreManager::initializeSystems()
|
||||||
@@ -111,7 +118,7 @@ void CoreManager::initializeSystems()
|
|||||||
hashComparer->initialize(versionContainer,widgetManager->getUpdateWidget());
|
hashComparer->initialize(versionContainer,widgetManager->getUpdateWidget());
|
||||||
postProcessorSystem->initialize(dataParserOutput,hashComparer,versionContainer,updateController);
|
postProcessorSystem->initialize(dataParserOutput,hashComparer,versionContainer,updateController);
|
||||||
dataParser->initialize(postProcessorSystem);
|
dataParser->initialize(postProcessorSystem);
|
||||||
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem);
|
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem,client);
|
||||||
resourceManager->painting();
|
resourceManager->painting();
|
||||||
|
|
||||||
emit sigCalculateHash();
|
emit sigCalculateHash();
|
||||||
@@ -119,7 +126,7 @@ void CoreManager::initializeSystems()
|
|||||||
|
|
||||||
screenChecker->check();
|
screenChecker->check();
|
||||||
|
|
||||||
emit sigSetConnect(dataParser->getClientSettings());
|
emit sigSetConnect(dataParser->getSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::initializeWidgets()
|
void CoreManager::initializeWidgets()
|
||||||
@@ -144,9 +151,10 @@ void CoreManager::initializeWidgets()
|
|||||||
|
|
||||||
connect(widgetManager->getMainWindow(),&MainWindow::sigChangeLanguage,this,&CoreManager::setLanguage,Qt::AutoConnection);
|
connect(widgetManager->getMainWindow(),&MainWindow::sigChangeLanguage,this,&CoreManager::setLanguage,Qt::AutoConnection);
|
||||||
connect(widgetManager->getMainWindow(),&MainWindow::sigShowUpdateInfo,this,&CoreManager::checkUpdateInfo,Qt::AutoConnection);
|
connect(widgetManager->getMainWindow(),&MainWindow::sigShowUpdateInfo,this,&CoreManager::checkUpdateInfo,Qt::AutoConnection);
|
||||||
connect(widgetManager->getMainWindow(),&MainWindow::sigExit,this,&CoreManager::exit,Qt::AutoConnection);
|
connect(widgetManager->getMainWindow(),&MainWindow::sigExit,this,&CoreManager::exit,Qt::DirectConnection);
|
||||||
connect(widgetManager->getMainWindow(),&MainWindow::sigTryLogin,this,&CoreManager::tryLogin,Qt::AutoConnection);
|
connect(widgetManager->getMainWindow(),&MainWindow::sigTryLogin,this,&CoreManager::tryLogin,Qt::AutoConnection);
|
||||||
connect(widgetManager->getMainWindow(),&MainWindow::sigStartOffline,this,&CoreManager::startOffline,Qt::AutoConnection);
|
connect(widgetManager->getMainWindow(),&MainWindow::sigStartOffline,this,&CoreManager::startOffline,Qt::AutoConnection);
|
||||||
|
connect(widgetManager->getCommonButtonGroupWidget(),&CommonButtonGroupWidget::sigStartOfflineUnityClient,this,&CoreManager::startOffline,Qt::AutoConnection);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,29 +168,37 @@ void CoreManager::callUpdateList()
|
|||||||
emit sigSendXMLAnswer(cmd_GetServerHash);
|
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)
|
void CoreManager::setServerVersion(StreamingVersionData *version)
|
||||||
{
|
{
|
||||||
widgetManager->getMainWindow()->setServerVersion(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()
|
void CoreManager::setLocalVersion()
|
||||||
{
|
{
|
||||||
ServerSettings *currentSettings = dataParser->getClientSettings();
|
|
||||||
StreamingVersionData *version = new StreamingVersionData;
|
StreamingVersionData *version = new StreamingVersionData;
|
||||||
version->setName(currentSettings->LocalVersionName);
|
version->setName(settings->LocalVersionName);
|
||||||
version->setIsChangeable(currentSettings->versionData.getIsChangeable());
|
version->setIsChangeable(settings->versionData.getIsChangeable());
|
||||||
|
|
||||||
versionContainer->setLocalVersionData(version);
|
versionContainer->setLocalVersionData(version);
|
||||||
|
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
||||||
@@ -192,19 +208,22 @@ void CoreManager::checkLoginResult(ServerAuthorization *auth)
|
|||||||
widgetManager->activateLoadingAnimation(true);
|
widgetManager->activateLoadingAnimation(true);
|
||||||
checkAccessType(auth->AccessType);
|
checkAccessType(auth->AccessType);
|
||||||
dataParserOutput->createAuthData(auth);
|
dataParserOutput->createAuthData(auth);
|
||||||
setLocalVersion();
|
//setLocalVersion();
|
||||||
widgetManager->setLoginSuccess();
|
widgetManager->setLoginSuccess();
|
||||||
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
||||||
|
client->setLogin(auth->ClientName);
|
||||||
|
client->setIsLoggedIn(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widgetManager->setLoginFailed();
|
widgetManager->setLoginFailed();
|
||||||
|
client->setIsLoggedIn(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::tryLogin()
|
void CoreManager::tryLogin()
|
||||||
{
|
{
|
||||||
if (!client->getIsConnected())
|
if (!tcpClient->getIsConnected())
|
||||||
{
|
{
|
||||||
widgetManager->getMainWindow()->showConnectionEmpty();
|
widgetManager->getMainWindow()->showConnectionEmpty();
|
||||||
return;
|
return;
|
||||||
@@ -220,22 +239,27 @@ void CoreManager::checkUpdate()
|
|||||||
{
|
{
|
||||||
widgetManager->activateLoadingAnimation(true);
|
widgetManager->activateLoadingAnimation(true);
|
||||||
emit sigSendCheckUpdate();
|
emit sigSendCheckUpdate();
|
||||||
widgetManager->getMainWindow()->setInlineDebug(tr("Проверка обновлений..."));
|
setInlineDebug(tr("Проверка обновлений..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::recalculateState()
|
void CoreManager::recalculateState()
|
||||||
{
|
{
|
||||||
widgetManager->activateLoadingAnimation(true);
|
widgetManager->activateLoadingAnimation(true);
|
||||||
widgetManager->getMainWindow()->setInlineDebug(tr("Пересчет хэша на сервере..."));
|
setInlineDebug(tr("Пересчет хэша на сервере..."));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoreManager::setInlineDebug(QString text)
|
||||||
|
{
|
||||||
|
widgetManager->getMainWindow()->setInlineDebug(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::checkAccessType(const QString& accessType)
|
void CoreManager::checkAccessType(const QString& accessType)
|
||||||
{
|
{
|
||||||
if (accessType == traineeTypeName)
|
if (accessType == traineeTypeName)//если обучаемый вызываем обновление
|
||||||
{
|
{
|
||||||
checkUpdate();
|
checkUpdate();
|
||||||
}
|
}
|
||||||
else
|
else //если инструктор запрашивание версионирование
|
||||||
{
|
{
|
||||||
emit sigSendXMLAnswer(cmd_CheckVersionList);
|
emit sigSendXMLAnswer(cmd_CheckVersionList);
|
||||||
}
|
}
|
||||||
@@ -307,7 +331,7 @@ void CoreManager::loadComplete()
|
|||||||
dataParserOutput->changeVersion(versionContainer->getServerVersionData());
|
dataParserOutput->changeVersion(versionContainer->getServerVersionData());
|
||||||
setLocalVersion();
|
setLocalVersion();
|
||||||
checkAutoStart();
|
checkAutoStart();
|
||||||
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
|
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getServerVersionData()->getViewName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::loadToServer()
|
void CoreManager::loadToServer()
|
||||||
@@ -322,11 +346,7 @@ void CoreManager::undoCurrentChanges()
|
|||||||
isRecovery = true;
|
isRecovery = true;
|
||||||
widgetManager->setUndoCurrentChangesState();
|
widgetManager->setUndoCurrentChangesState();
|
||||||
emit sigSendCheckUpdate();
|
emit sigSendCheckUpdate();
|
||||||
emit sigSendCommand(PacketType::TYPE_UPDATE);
|
|
||||||
//тут был таймер
|
|
||||||
isRecovery = false;
|
isRecovery = false;
|
||||||
|
|
||||||
widgetManager->activateLoadingAnimation(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::startOffline()
|
void CoreManager::startOffline()
|
||||||
@@ -338,32 +358,36 @@ void CoreManager::startOffline()
|
|||||||
startUnityClient();
|
startUnityClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CoreManager::sendPacketType(PacketType packetType)
|
||||||
|
{
|
||||||
|
emit sigSendPacketType(packetType);
|
||||||
|
}
|
||||||
|
|
||||||
void CoreManager::saveServerSettingsWithConnect()
|
void CoreManager::saveServerSettingsWithConnect()
|
||||||
{
|
{
|
||||||
widgetManager->activateLoadingAnimation(true);
|
widgetManager->activateLoadingAnimation(true);
|
||||||
EntryWidget *entryWidget = widgetManager->getEntryWidget();
|
EntryWidget *entryWidget = widgetManager->getEntryWidget();
|
||||||
|
|
||||||
entryWidget->isActive(false);
|
entryWidget->isActive(false);
|
||||||
ServerSettings *settings = entryWidget->getServerSettings();
|
settings->LocalVersionName = dataParser->getSettings()->LocalVersionName;
|
||||||
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
|
settings->Address = entryWidget->getAddress();
|
||||||
dataParserOutput->createServerSettings(settings);
|
settings->Port = entryWidget->getPort();
|
||||||
|
dataParserOutput->updateServerSettings(settings);
|
||||||
|
|
||||||
if(client->getIsConnected())
|
if(tcpClient->getIsConnected())
|
||||||
{
|
{
|
||||||
|
emit sigSendXMLAnswer(cmd_Disable);
|
||||||
|
tcpClient->setDisconnect();
|
||||||
entryWidget->showLoginWidget(true);
|
entryWidget->showLoginWidget(true);
|
||||||
widgetManager->getMainWindow()->showOfflineButton(true);
|
|
||||||
widgetManager->activateLoadingAnimation(false);
|
widgetManager->activateLoadingAnimation(false);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
emit sigSetConnect(settings);
|
emit sigSetConnect(settings);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::checkAppAvailable()
|
void CoreManager::createNewServerSettings()
|
||||||
{
|
{
|
||||||
bool isAvailable = externalExecuter->findApp();
|
dataParserOutput->createServerSettings();
|
||||||
widgetManager->setAppAvailable(isAvailable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreManager::setLanguage(const QString& language)
|
void CoreManager::setLanguage(const QString& language)
|
||||||
@@ -384,7 +408,7 @@ void CoreManager::setLanguage(const QString& language)
|
|||||||
void CoreManager::exit()
|
void CoreManager::exit()
|
||||||
{
|
{
|
||||||
emit sigSendXMLAnswer(cmd_Disable);
|
emit sigSendXMLAnswer(cmd_Disable);
|
||||||
client->disconnect();
|
tcpClient->disconnect();
|
||||||
|
|
||||||
workerThread->quit();
|
workerThread->quit();
|
||||||
workerThread->wait();
|
workerThread->wait();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <Core/hashcomparer.h>
|
#include <Core/hashcomparer.h>
|
||||||
#include <Core/versioncontainer.h>
|
#include <Core/versioncontainer.h>
|
||||||
#include <widgetmanager.h>
|
#include <widgetmanager.h>
|
||||||
|
#include <Data/Client.h>
|
||||||
|
|
||||||
#include <UI/resourcemanager.h>
|
#include <UI/resourcemanager.h>
|
||||||
|
|
||||||
@@ -39,31 +40,31 @@ public:
|
|||||||
void startUnityClient();
|
void startUnityClient();
|
||||||
void tryLogin();
|
void tryLogin();
|
||||||
void startOffline();
|
void startOffline();
|
||||||
|
void sendPacketType(PacketType packetType);
|
||||||
|
|
||||||
void saveServerSettingsWithConnect();
|
void saveServerSettingsWithConnect();
|
||||||
|
|
||||||
|
|
||||||
void checkAppAvailable();
|
|
||||||
void exit();
|
void exit();
|
||||||
void initializeWidgets();
|
void initializeWidgets();
|
||||||
|
|
||||||
void recalculateState();
|
void recalculateState();
|
||||||
signals:
|
signals:
|
||||||
void sigInitializeClient(RecognizeSystem *recognize,SendSystem *sendSystem);
|
void sigInitializeClient(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||||
void sigSendCommand(PacketType packetType);
|
void sigSendPacketType(PacketType packetType);
|
||||||
void sigSendXMLAnswer(QString answer);
|
void sigSendXMLAnswer(QString answer);
|
||||||
void sigSetConnect(ServerSettings* serverSettings);
|
void sigSetConnect(Settings* serverSettings);
|
||||||
void sigCalculateHash();
|
void sigCalculateHash();
|
||||||
void sigSendAutorization();
|
void sigSendAutorization();
|
||||||
void sigSendCheckUpdate();
|
void sigSendCheckUpdate();
|
||||||
bool sigGetConnected();
|
bool sigGetConnected();
|
||||||
void sigSendUpdateToServer();
|
void sigSendUpdateToServer();
|
||||||
|
Settings *sigGetClientSettings();
|
||||||
|
|
||||||
void sigSetLoadSettings(ServerSettings *serverSettings);
|
|
||||||
|
void sigSetLoadSettings(Settings *serverSettings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
TCPClient *client;
|
TCPClient *tcpClient;
|
||||||
DataParser *dataParser;
|
DataParser *dataParser;
|
||||||
DataParserOutput *dataParserOutput;
|
DataParserOutput *dataParserOutput;
|
||||||
UpdateController *updateController;
|
UpdateController *updateController;
|
||||||
@@ -75,6 +76,8 @@ private:
|
|||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
ResourceManager *resourceManager;
|
ResourceManager *resourceManager;
|
||||||
PostProcessorSystem *postProcessorSystem;
|
PostProcessorSystem *postProcessorSystem;
|
||||||
|
Client *client;
|
||||||
|
Settings *settings;
|
||||||
|
|
||||||
WidgetManager *widgetManager;
|
WidgetManager *widgetManager;
|
||||||
|
|
||||||
@@ -90,8 +93,7 @@ private:
|
|||||||
void binding();
|
void binding();
|
||||||
void initializeSystems();
|
void initializeSystems();
|
||||||
void callUpdateList();
|
void callUpdateList();
|
||||||
void lostConnection();
|
void showError(ErrorsEnum errorEnum);
|
||||||
void serverBlocked();
|
|
||||||
void checkLoginResult(ServerAuthorization *auth);
|
void checkLoginResult(ServerAuthorization *auth);
|
||||||
void checkAccessType(const QString &accessType);
|
void checkAccessType(const QString &accessType);
|
||||||
void setServerVersion(StreamingVersionData *version);
|
void setServerVersion(StreamingVersionData *version);
|
||||||
@@ -101,6 +103,8 @@ private:
|
|||||||
void checkNeedUpdate(bool flag, quint64 size, quint64 fileCount, quint64 deleteCount);
|
void checkNeedUpdate(bool flag, quint64 size, quint64 fileCount, quint64 deleteCount);
|
||||||
void checkUpdate();
|
void checkUpdate();
|
||||||
|
|
||||||
|
void setInlineDebug(QString text);
|
||||||
|
void createNewServerSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COREMANAGER_H
|
#endif // COREMANAGER_H
|
||||||
|
|||||||
113
mainwindow.cpp
113
mainwindow.cpp
@@ -12,8 +12,8 @@
|
|||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
bottomRightPosition(QRect(530,505,250,40)),
|
bottomRightPosition(QRect(530,506,250,40)),
|
||||||
offlinePosition(240,340,300,40)
|
offlinePosition(240,350,300,40)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
@@ -44,7 +44,8 @@ void MainWindow::initialize(ResourceManager *resourceManager)
|
|||||||
bindConnection();
|
bindConnection();
|
||||||
this->resourceManager = resourceManager;
|
this->resourceManager = resourceManager;
|
||||||
ui->LanguageWidget->hide();
|
ui->LanguageWidget->hide();
|
||||||
|
ui->offlineStartButton->setGeometry(offlinePosition);
|
||||||
|
ui->offlineStartButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setStartState()
|
void MainWindow::setStartState()
|
||||||
@@ -74,9 +75,7 @@ void MainWindow::bindConnection()
|
|||||||
void MainWindow::loadCompleteState()
|
void MainWindow::loadCompleteState()
|
||||||
{
|
{
|
||||||
ui->inlineTextDebug->setText(tr("Обновление завершено"));
|
ui->inlineTextDebug->setText(tr("Обновление завершено"));
|
||||||
ui->offlineStartButton->setEnabled(true);
|
|
||||||
ui->autostartCheckBox->hide();
|
ui->autostartCheckBox->hide();
|
||||||
ui->offlineStartButton->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::getIsAutoStart()
|
bool MainWindow::getIsAutoStart()
|
||||||
@@ -97,43 +96,45 @@ void MainWindow::setNeedUpdateState(const QString& notifyText)
|
|||||||
ui->autostartCheckBox->show();
|
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);
|
void MainWindow::showError(ErrorsEnum errorNum)
|
||||||
timer->start(3000);
|
{
|
||||||
|
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()
|
void MainWindow::setLoginSuccessState()
|
||||||
{
|
{
|
||||||
ui->settingsButton->hide();
|
ui->settingsButton->hide();
|
||||||
ui->offlineStartButton->show();
|
|
||||||
ui->versionLayoutWidget->show();
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::setClientVersionName(const QString& versionName)
|
void MainWindow::setClientVersionName(const QString& versionName)
|
||||||
{
|
{
|
||||||
ui->valueClientVersion->setText(versionName);
|
ui->valueClientVersion->setText(versionName);
|
||||||
@@ -145,9 +146,7 @@ void MainWindow::showConnectionEmpty()
|
|||||||
QPalette palette = ui->notificationLabel->palette();
|
QPalette palette = ui->notificationLabel->palette();
|
||||||
palette.setColor(ui->notificationLabel->foregroundRole(),Qt::red);
|
palette.setColor(ui->notificationLabel->foregroundRole(),Qt::red);
|
||||||
ui->notificationLabel->setText(tr("Соединение отсутсвует"));
|
ui->notificationLabel->setText(tr("Соединение отсутсвует"));
|
||||||
ui->offlineStartButton->show();
|
|
||||||
ui->offlineStartButton->setGeometry(offlinePosition);
|
|
||||||
ui->offlineStartButton->raise();
|
|
||||||
ui->settingsButton->show();
|
ui->settingsButton->show();
|
||||||
ui->unsafeChangingButton->hide();
|
ui->unsafeChangingButton->hide();
|
||||||
}
|
}
|
||||||
@@ -170,9 +169,6 @@ void MainWindow::slotConnectionState(bool flag)
|
|||||||
{
|
{
|
||||||
palette.setColor(ui->notificationLabel->foregroundRole(),Qt::green);
|
palette.setColor(ui->notificationLabel->foregroundRole(),Qt::green);
|
||||||
ui->notificationLabel->setText(tr("Соединение установлено"));
|
ui->notificationLabel->setText(tr("Соединение установлено"));
|
||||||
|
|
||||||
ui->offlineStartButton->show();
|
|
||||||
ui->offlineStartButton->setGeometry(bottomRightPosition);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -185,11 +181,19 @@ void MainWindow::slotConnectionState(bool flag)
|
|||||||
|
|
||||||
void MainWindow::slotServerDisconnect()
|
void MainWindow::slotServerDisconnect()
|
||||||
{
|
{
|
||||||
|
checkApp();
|
||||||
ui->autostartCheckBox->hide();
|
ui->autostartCheckBox->hide();
|
||||||
ui->inlineTextDebug->setText("");
|
ui->inlineTextDebug->setText("");
|
||||||
slotConnectionState(false);
|
slotConnectionState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::checkApp()
|
||||||
|
{
|
||||||
|
bool isAvailable = emit sigAppAvailable();
|
||||||
|
if (isAvailable) ui->offlineStartButton->show();
|
||||||
|
else ui->offlineStartButton->hide();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::slotDisableNotify()
|
void MainWindow::slotDisableNotify()
|
||||||
{
|
{
|
||||||
ui->notificationLabel->hide();
|
ui->notificationLabel->hide();
|
||||||
@@ -201,14 +205,6 @@ void MainWindow::slotDisableNotify()
|
|||||||
timer->stop();
|
timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showOfflineButton(bool flag)
|
|
||||||
{
|
|
||||||
if (flag)
|
|
||||||
ui->offlineStartButton->show();
|
|
||||||
else
|
|
||||||
ui->offlineStartButton->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_settingsButton_clicked()
|
void MainWindow::on_settingsButton_clicked()
|
||||||
{
|
{
|
||||||
emit sigShowSettings(true);
|
emit sigShowSettings(true);
|
||||||
@@ -225,14 +221,14 @@ void MainWindow::loadToServer()
|
|||||||
{
|
{
|
||||||
ui->mainFrame->show();
|
ui->mainFrame->show();
|
||||||
ui->inlineTextDebug->setText(tr("Отправка файлов..."));
|
ui->inlineTextDebug->setText(tr("Отправка файлов..."));
|
||||||
ui->offlineStartButton->setEnabled(false);
|
//ui->offlineStartButton->setEnabled(false);
|
||||||
ui->unsafeChangingButton->hide();
|
ui->unsafeChangingButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::undoCurrentChanges()
|
void MainWindow::undoCurrentChanges()
|
||||||
{
|
{
|
||||||
ui->mainFrame->show();
|
ui->mainFrame->show();
|
||||||
ui->offlineStartButton->setEnabled(false);
|
//ui->offlineStartButton->setEnabled(false);
|
||||||
ui->unsafeChangingButton->hide();
|
ui->unsafeChangingButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +248,8 @@ void MainWindow::on_exitButton_clicked()
|
|||||||
void MainWindow::slotShowUpdateInfo()
|
void MainWindow::slotShowUpdateInfo()
|
||||||
{
|
{
|
||||||
ui->unsafeChangingButton->show();
|
ui->unsafeChangingButton->show();
|
||||||
ui->offlineStartButton->setGeometry(bottomRightPosition);
|
//ui->offlineStartButton->setGeometry(bottomRightPosition);
|
||||||
|
//ui->offlineStartButton->setParent(ui->changeButtonGroup->widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setUpUi()
|
void MainWindow::setUpUi()
|
||||||
@@ -260,9 +257,10 @@ void MainWindow::setUpUi()
|
|||||||
ui->notificationLabel->hide();
|
ui->notificationLabel->hide();
|
||||||
ui->unsafeChangingButton->hide();
|
ui->unsafeChangingButton->hide();
|
||||||
|
|
||||||
ui->offlineStartButton->show();
|
//ui->offlineStartButton->show();
|
||||||
ui->offlineStartButton->setEnabled(false);
|
//ui->offlineStartButton->setEnabled(false);
|
||||||
ui->offlineStartButton->setGeometry(bottomRightPosition);
|
//ui->offlineStartButton->setGeometry(bottomRightPosition);
|
||||||
|
//ui->offlineStartButton->setParent(ui->changeButtonGroup->widget());
|
||||||
|
|
||||||
ui->settingsButton->setIcon(*resourceManager->getSettingsIcon());
|
ui->settingsButton->setIcon(*resourceManager->getSettingsIcon());
|
||||||
|
|
||||||
@@ -316,9 +314,14 @@ QHBoxLayout *MainWindow::getDisplayLayout() const
|
|||||||
return ui->displayLayout;
|
return ui->displayLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPushButton *MainWindow::getStartOfflineButton() const
|
||||||
|
{
|
||||||
|
return ui->offlineStartButton;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::addWidgetToChangeGroup(CommonButtonGroupWidget *commonWidgetGroup)
|
void MainWindow::addWidgetToChangeGroup(CommonButtonGroupWidget *commonWidgetGroup)
|
||||||
{
|
{
|
||||||
ui->changButtonGroup->addWidget(commonWidgetGroup);
|
ui->changeButtonGroup->addWidget(commonWidgetGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addWidgetToInteractiveGroup(EntryWidget *entryWidget)
|
void MainWindow::addWidgetToInteractiveGroup(EntryWidget *entryWidget)
|
||||||
@@ -327,7 +330,7 @@ void MainWindow::addWidgetToInteractiveGroup(EntryWidget *entryWidget)
|
|||||||
this->entryWidget = entryWidget;
|
this->entryWidget = entryWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setLoadSettings(ServerSettings *serverSettings)
|
void MainWindow::setLoadSettings(Settings *serverSettings)
|
||||||
{
|
{
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
|
|
||||||
|
|||||||
17
mainwindow.h
17
mainwindow.h
@@ -4,6 +4,7 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#include <Widgets/commonbuttongroupwidget.h>
|
#include <Widgets/commonbuttongroupwidget.h>
|
||||||
#include <Widgets/updatenotifywidget.h>
|
#include <Widgets/updatenotifywidget.h>
|
||||||
@@ -29,9 +30,8 @@ public:
|
|||||||
void initialize(ResourceManager *resourceManager);
|
void initialize(ResourceManager *resourceManager);
|
||||||
void addWidgetToChangeGroup(CommonButtonGroupWidget *commonWidgetGroup);
|
void addWidgetToChangeGroup(CommonButtonGroupWidget *commonWidgetGroup);
|
||||||
void addWidgetToInteractiveGroup(EntryWidget *entryWidget);
|
void addWidgetToInteractiveGroup(EntryWidget *entryWidget);
|
||||||
void setLoadSettings(ServerSettings *serverSettings);
|
void setLoadSettings(Settings *serverSettings);
|
||||||
void setLoginSuccessState();
|
void setLoginSuccessState();
|
||||||
void setLoginFailedState();
|
|
||||||
void setClientVersionName(const QString &versionName);
|
void setClientVersionName(const QString &versionName);
|
||||||
|
|
||||||
void loadToServer();
|
void loadToServer();
|
||||||
@@ -44,12 +44,13 @@ public:
|
|||||||
void setNeedUpdateState(const QString ¬ifyText);
|
void setNeedUpdateState(const QString ¬ifyText);
|
||||||
void setLastVersionState();
|
void setLastVersionState();
|
||||||
void showConnectionEmpty();
|
void showConnectionEmpty();
|
||||||
void showOfflineButton(bool flag);
|
|
||||||
void setStartOfflineButton(bool isAvailable);
|
|
||||||
void setStartState();
|
void setStartState();
|
||||||
void serverBlocked();
|
void serverNotifyShow(QString text, int durationMS = 3000);
|
||||||
|
void showError(ErrorsEnum errorNum);
|
||||||
QHBoxLayout *getDisplayLayout() const;
|
QHBoxLayout *getDisplayLayout() const;
|
||||||
|
void serverBlockedState();
|
||||||
|
QPushButton *getStartOfflineButton() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotShowUpdateInfo();
|
void slotShowUpdateInfo();
|
||||||
void slotConnectionState(bool flag);
|
void slotConnectionState(bool flag);
|
||||||
@@ -65,6 +66,8 @@ signals:
|
|||||||
void sigExit();
|
void sigExit();
|
||||||
void sigTryLogin();
|
void sigTryLogin();
|
||||||
void sigStartOffline();
|
void sigStartOffline();
|
||||||
|
bool sigAppAvailable();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_settingsButton_clicked();
|
void on_settingsButton_clicked();
|
||||||
@@ -83,11 +86,13 @@ private:
|
|||||||
QPixmap background;
|
QPixmap background;
|
||||||
QRect bottomRightPosition;
|
QRect bottomRightPosition;
|
||||||
QRect offlinePosition;
|
QRect offlinePosition;
|
||||||
|
QPushButton startOfflineButton;
|
||||||
void bindClient();
|
void bindClient();
|
||||||
void bindConnection();
|
void bindConnection();
|
||||||
void setUpUi();
|
void setUpUi();
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
|
void checkApp();
|
||||||
protected:
|
protected:
|
||||||
virtual void keyPressEvent(QKeyEvent *event);
|
virtual void keyPressEvent(QKeyEvent *event);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -249,9 +249,9 @@
|
|||||||
<widget class="QWidget" name="versionLayoutWidget" native="true">
|
<widget class="QWidget" name="versionLayoutWidget" native="true">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>529</x>
|
<x>540</x>
|
||||||
<y>450</y>
|
<y>450</y>
|
||||||
<width>250</width>
|
<width>241</width>
|
||||||
<height>60</height>
|
<height>60</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -420,46 +420,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="offlineStartButton">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>530</x>
|
|
||||||
<y>510</y>
|
|
||||||
<width>250</width>
|
|
||||||
<height>40</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>250</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>1500</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Запуск в автономном режиме</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="verticalLayoutWidget_2">
|
<widget class="QWidget" name="verticalLayoutWidget_2">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@@ -478,9 +438,9 @@
|
|||||||
<widget class="QWidget" name="verticalLayoutWidget_3">
|
<widget class="QWidget" name="verticalLayoutWidget_3">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>10</x>
|
||||||
<y>440</y>
|
<y>440</y>
|
||||||
<width>511</width>
|
<width>501</width>
|
||||||
<height>61</height>
|
<height>61</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -520,6 +480,46 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QPushButton" name="offlineStartButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>240</x>
|
||||||
|
<y>350</y>
|
||||||
|
<width>300</width>
|
||||||
|
<height>40</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>1500</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Запуск в автономном режиме</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="headerWidget" native="true">
|
<widget class="QWidget" name="headerWidget" native="true">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@@ -617,13 +617,13 @@
|
|||||||
<widget class="QWidget" name="verticalLayoutWidget">
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>20</x>
|
||||||
<y>550</y>
|
<y>550</y>
|
||||||
<width>531</width>
|
<width>761</width>
|
||||||
<height>41</height>
|
<height>42</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="changButtonGroup">
|
<layout class="QHBoxLayout" name="changeButtonGroup">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
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
|
||||||
BIN
resource/Icons/new.png
Normal file
BIN
resource/Icons/new.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1017 B |
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 |
@@ -17,5 +17,6 @@
|
|||||||
<file>resource/Icons/caution.png</file>
|
<file>resource/Icons/caution.png</file>
|
||||||
<file>resource/Icons/close.png</file>
|
<file>resource/Icons/close.png</file>
|
||||||
<file>resource/Icons/planeCustom.png</file>
|
<file>resource/Icons/planeCustom.png</file>
|
||||||
|
<file>resource/Icons/new.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void WidgetManager::binding()
|
|||||||
connect(commonButtonGroupWidget,&CommonButtonGroupWidget::sigUpdateCommonWidget,mainWindow,&MainWindow::slotCommonWidgetState);
|
connect(commonButtonGroupWidget,&CommonButtonGroupWidget::sigUpdateCommonWidget,mainWindow,&MainWindow::slotCommonWidgetState);
|
||||||
connect(mainWindow,&MainWindow::sigShowSettings,this,&WidgetManager::showSettings,Qt::AutoConnection);
|
connect(mainWindow,&MainWindow::sigShowSettings,this,&WidgetManager::showSettings,Qt::AutoConnection);
|
||||||
}
|
}
|
||||||
void WidgetManager::slotSetLoadSettings(ServerSettings *settings)
|
void WidgetManager::slotSetLoadSettings(Settings *settings)
|
||||||
{
|
{
|
||||||
mainWindow->setLoadSettings(settings);
|
mainWindow->setLoadSettings(settings);
|
||||||
entryWidget->fillSettings(settings);
|
entryWidget->fillSettings(settings);
|
||||||
@@ -60,7 +60,6 @@ void WidgetManager::setLoginSuccess()
|
|||||||
void WidgetManager::setLoginFailed()
|
void WidgetManager::setLoginFailed()
|
||||||
{
|
{
|
||||||
entryWidget->showLoginWidget(true);
|
entryWidget->showLoginWidget(true);
|
||||||
mainWindow->setLoginFailedState();
|
|
||||||
activateLoadingAnimation(false);
|
activateLoadingAnimation(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +105,7 @@ void WidgetManager::setNeedUpdateState(quint64 size, quint64 fileCount,quint64 d
|
|||||||
result = tr("Файлов к удалению: ") + QString::number(deleteCount);
|
result = tr("Файлов к удалению: ") + QString::number(deleteCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateWidget->closeWindow();
|
||||||
mainWindow->setNeedUpdateState(result);
|
mainWindow->setNeedUpdateState(result);
|
||||||
commonButtonGroupWidget->needUpdateState(true);
|
commonButtonGroupWidget->needUpdateState(true);
|
||||||
waitAnimationWidget->hideWithStop();
|
waitAnimationWidget->hideWithStop();
|
||||||
@@ -129,7 +129,9 @@ void WidgetManager::setConnectionState(bool isConnected)
|
|||||||
mainWindow->slotConnectionState(isConnected);
|
mainWindow->slotConnectionState(isConnected);
|
||||||
if (isConnected)
|
if (isConnected)
|
||||||
{
|
{
|
||||||
|
mainWindow->getStartOfflineButton()->hide();
|
||||||
entryWidget->showLoginWidget(true);
|
entryWidget->showLoginWidget(true);
|
||||||
|
commonButtonGroupWidget->loginState();
|
||||||
}
|
}
|
||||||
waitAnimationWidget->hideWithStop();
|
waitAnimationWidget->hideWithStop();
|
||||||
}
|
}
|
||||||
@@ -157,10 +159,11 @@ void WidgetManager::setServerDisconnectState()
|
|||||||
|
|
||||||
void WidgetManager::setUndoCurrentChangesState()
|
void WidgetManager::setUndoCurrentChangesState()
|
||||||
{
|
{
|
||||||
|
waitAnimationWidget->showWithPlay();
|
||||||
mainWindow->undoCurrentChanges();
|
mainWindow->undoCurrentChanges();
|
||||||
updateWidget->hide();
|
updateWidget->hide();
|
||||||
commonButtonGroupWidget->showProgressBar(false);
|
commonButtonGroupWidget->showProgressBar(true);
|
||||||
waitAnimationWidget->showWithPlay();
|
//waitAnimationWidget->hideWithStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetManager::showMainFrame(bool flag)
|
void WidgetManager::showMainFrame(bool flag)
|
||||||
@@ -168,12 +171,6 @@ void WidgetManager::showMainFrame(bool flag)
|
|||||||
mainWindow->showMainFrame(flag);
|
mainWindow->showMainFrame(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetManager::setAppAvailable(bool isAvailable)
|
|
||||||
{
|
|
||||||
commonButtonGroupWidget->startButtonActive(isAvailable);
|
|
||||||
mainWindow->setStartOfflineButton(isAvailable);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetManager::showSettings(bool isActive)
|
void WidgetManager::showSettings(bool isActive)
|
||||||
{
|
{
|
||||||
entryWidget->settingsState();
|
entryWidget->settingsState();
|
||||||
|
|||||||
@@ -45,13 +45,14 @@ public:
|
|||||||
|
|
||||||
void setUndoCurrentChangesState();
|
void setUndoCurrentChangesState();
|
||||||
void showMainFrame(bool flag);
|
void showMainFrame(bool flag);
|
||||||
void setAppAvailable(bool isAvailable);
|
|
||||||
void slotInlineDebug(const QString &text);
|
void slotInlineDebug(const QString &text);
|
||||||
public slots:
|
public slots:
|
||||||
void showSettings(bool isActive);
|
void showSettings(bool isActive);
|
||||||
void slotSetLoadSettings(ServerSettings *settings);
|
void slotSetLoadSettings(Settings *settings);
|
||||||
void slotActivateLoadAnimation(bool flag);
|
void slotActivateLoadAnimation(bool flag);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
bool sigAppAvailable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow *mainWindow;
|
MainWindow *mainWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user