mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
ref: link argument
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
#include <QThread>
|
||||
|
||||
UpdateController::UpdateController(DataParserOutput *dataParserOut, SendSystem *sendSystem, QObject *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
versionContainer(nullptr)
|
||||
{
|
||||
this->sendSystem = sendSystem;
|
||||
this->dataParserOut = dataParserOut;
|
||||
@@ -34,7 +35,7 @@ void UpdateController::calculateStreamingHash()
|
||||
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
||||
}
|
||||
|
||||
QList<FileData> UpdateController::calculateHash(QString path,QString ignoreName)
|
||||
QList<FileData> UpdateController::calculateHash(const QString& path,const QString& ignoreName)
|
||||
{
|
||||
qDebug() << "Try calculate";
|
||||
|
||||
@@ -56,7 +57,7 @@ QList<FileData> UpdateController::calculateHash(QString path,QString ignoreName)
|
||||
QFileInfo fileInfo(dirIterator.next());
|
||||
FileData currentFile;
|
||||
QString fileName = fileInfo.fileName();
|
||||
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != "RRJLoader")
|
||||
if(fileInfo.isDir() && !fileName.startsWith(".") && fileName != "RRJLoader")
|
||||
{
|
||||
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||
currentFile.hash = "FOLDER";
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
QList<FileData> appDataList;
|
||||
QList<FileData> streamingDataList;
|
||||
|
||||
QList<FileData> calculateHash(QString path,QString ignoreName);
|
||||
QList<FileData> calculateHash(const QString& path,const QString& ignoreName);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "Core/dataparser.h"
|
||||
|
||||
DataParser::DataParser(QObject *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
postProcessSystem(nullptr)
|
||||
{
|
||||
if(!QDir(fullStaticDataFolderName).exists()){
|
||||
QDir().mkdir(fullStaticDataFolderName);
|
||||
@@ -94,7 +95,7 @@ ServerSettings *DataParser::getClientSettings()
|
||||
return settings;
|
||||
}
|
||||
|
||||
void DataParser::xmlParser(QByteArray array)
|
||||
void DataParser::xmlParser(const QByteArray& array)
|
||||
{
|
||||
QXmlStreamReader xmlReader(array);
|
||||
|
||||
@@ -171,19 +172,23 @@ void DataParser::xmlParser(QByteArray array)
|
||||
QString name = attr.name().toString();
|
||||
QString value = attr.value().toString();
|
||||
|
||||
if (name == "Result"){
|
||||
if (name == "Result")
|
||||
{
|
||||
serverAuth->Result = value == "true" ? true : false;
|
||||
}
|
||||
|
||||
if (name == "InstructorName"){
|
||||
if (name == "InstructorName")
|
||||
{
|
||||
serverAuth->InstructorName = value;
|
||||
}
|
||||
|
||||
if (name == "ClientName"){
|
||||
if (name == "ClientName")
|
||||
{
|
||||
serverAuth->ClientName = value;
|
||||
}
|
||||
|
||||
if (name == "AccessType"){
|
||||
if (name == "AccessType")
|
||||
{
|
||||
serverAuth->AccessType = value;
|
||||
postProcessSystem->checkAccessType(value);
|
||||
//recognizeSystem->checkAccessType(value);
|
||||
@@ -260,8 +265,3 @@ void DataParser::xmlParser(QByteArray array)
|
||||
xmlReader.readNext();
|
||||
}
|
||||
}
|
||||
|
||||
DataParser::~DataParser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -12,27 +12,22 @@
|
||||
#include <Core/tools.h>
|
||||
#include "Core/postprocessorsystem.h"
|
||||
|
||||
class NotifyController;
|
||||
|
||||
class DataParser : public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DataParser(QObject *parent = 0);
|
||||
~DataParser() = default;
|
||||
void initialize(PostProcessorSystem *postProcessSystem);
|
||||
|
||||
~DataParser();
|
||||
ServerSettings* getClientSettings();
|
||||
void xmlParser(QByteArray array);
|
||||
void xmlParser(const QByteArray& array);
|
||||
|
||||
signals:
|
||||
void sigNotify(QString notify);
|
||||
void sigUpdateFilesOnServer(QList<FileData> *fileSendList);
|
||||
|
||||
private:
|
||||
ClientAutorization *authPassCache;
|
||||
PostProcessorSystem *postProcessSystem;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "dataparseroutput.h"
|
||||
|
||||
DataParserOutput::DataParserOutput() {}
|
||||
DataParserOutput::DataParserOutput(QObject *parent) :
|
||||
QObject(parent),
|
||||
authPassCache(nullptr){}
|
||||
|
||||
QByteArray DataParserOutput::xmlAnswer_notify(QString code)
|
||||
QByteArray DataParserOutput::xmlAnswer_notify(const QString& code)
|
||||
{
|
||||
|
||||
QList<SXmlAnswerTag> listTag;
|
||||
|
||||
SAttribute attribute1 = {"Code", code};
|
||||
@@ -16,7 +17,7 @@ QByteArray DataParserOutput::xmlAnswer_notify(QString code)
|
||||
return xmlAnswer(listTag);
|
||||
}
|
||||
|
||||
QByteArray DataParserOutput::xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1, QString elemUp2)
|
||||
QByteArray DataParserOutput::xmlAnswer(const QList<SXmlAnswerTag>& listTag, const QString& elemUp1, const QString& elemUp2)
|
||||
{
|
||||
/* Открываем файл для Записи*/
|
||||
QFile file(tempName);
|
||||
@@ -77,7 +78,7 @@ QByteArray DataParserOutput::xmlAnswer(QList<SXmlAnswerTag> listTag, QString ele
|
||||
}
|
||||
|
||||
|
||||
void DataParserOutput::createFileDataList(QList<FileData> fileDataList,QString filename)
|
||||
void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,const QString& filename)
|
||||
{
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
@@ -215,7 +216,7 @@ void DataParserOutput::createAuthData(ServerAuthorization *serverAuth)
|
||||
|
||||
}
|
||||
|
||||
void DataParserOutput::createAuthDataOffline(QString username, QString pass)
|
||||
void DataParserOutput::createAuthDataOffline(const QString& username,const QString& pass)
|
||||
{
|
||||
QFile file(authTempName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
@@ -255,7 +256,7 @@ void DataParserOutput::addRunData(QList<int> displays)
|
||||
|
||||
}
|
||||
|
||||
void DataParserOutput::saveClientSettrings(QString language, bool isAutoStart)
|
||||
void DataParserOutput::saveClientSettrings(const QString& language, bool isAutoStart)
|
||||
{
|
||||
QFile file(settingsName);
|
||||
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
@@ -277,7 +278,7 @@ void DataParserOutput::saveClientSettrings(QString language, bool isAutoStart)
|
||||
file.close();
|
||||
}
|
||||
|
||||
QList<FileData>* DataParserOutput::xmlFileDataParse(QByteArray array, QString filter = "")
|
||||
QList<FileData>* DataParserOutput::xmlFileDataParse(const QByteArray& array,const QString& filter)
|
||||
{
|
||||
QXmlStreamReader xmlReader(array);
|
||||
QList<FileData> *datas = new QList<FileData>;
|
||||
|
||||
@@ -14,18 +14,18 @@ class DataParserOutput : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataParserOutput();
|
||||
void createFileDataList(QList<FileData> fileDataList, QString filename);
|
||||
explicit DataParserOutput(QObject *parent = 0);
|
||||
void createFileDataList(const QList<FileData>& fileDataList,const QString& filename);
|
||||
void createAuthMessage(ClientAutorization *auth);
|
||||
void createServerSettings(ServerSettings *serverSettings);
|
||||
void changeVersion(StreamingVersionData *versionData);
|
||||
void createAuthData(ServerAuthorization *serverAuth);
|
||||
void createAuthDataOffline(QString username, QString pass);
|
||||
void createAuthDataOffline(const QString& username,const QString& pass);
|
||||
void addRunData(QList<int> displays);
|
||||
void saveClientSettrings(QString language, bool isAutoStart);
|
||||
QList<FileData> *xmlFileDataParse(QByteArray array, QString filter);
|
||||
QByteArray xmlAnswer_notify(QString code);
|
||||
QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1 ="", QString elemUp2 ="");
|
||||
void saveClientSettrings(const QString& language, bool isAutoStart);
|
||||
QList<FileData> *xmlFileDataParse(const QByteArray& array,const QString& filter = "");
|
||||
QByteArray xmlAnswer_notify(const QString& code);
|
||||
QByteArray xmlAnswer(const QList<SXmlAnswerTag>& listTag, const QString& elemUp1 = "", const QString& elemUp2 = "");
|
||||
private:
|
||||
const QString XMLLanguageProperty = "Language=\"";
|
||||
const QString XMLAutoStartProperty = "AutoStart=\"";
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
#include "externalexecuter.h"
|
||||
|
||||
ExternalExecuter::ExternalExecuter() {}
|
||||
|
||||
ExternalExecuter::~ExternalExecuter() {}
|
||||
|
||||
void ExternalExecuter::callApp()
|
||||
{
|
||||
QProcess *myProcess = new QProcess(this);
|
||||
|
||||
@@ -15,10 +15,10 @@ class ExternalExecuter : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExternalExecuter();
|
||||
ExternalExecuter() {};
|
||||
~ExternalExecuter() {};
|
||||
void callApp();
|
||||
bool findApp();
|
||||
~ExternalExecuter();
|
||||
|
||||
private:
|
||||
QString programPath;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#include "hashcomparer.h"
|
||||
|
||||
HashComparer::HashComparer(QObject *)
|
||||
HashComparer::HashComparer(QObject *) :
|
||||
updateWidget(nullptr),
|
||||
filesForUpdate(nullptr),
|
||||
versionContainer(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HashComparer::initialize(VersionContainer *versionContainer)
|
||||
{
|
||||
|
||||
this->versionContainer = versionContainer;
|
||||
}
|
||||
|
||||
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
||||
{
|
||||
// QList<FileData> *serverStreamingHash = new QList<FileData>;
|
||||
// QList<FileData> *localStreamingHash = new QList<FileData>;
|
||||
QList<FileData> *files = new QList<FileData>;
|
||||
|
||||
QMutableListIterator<FileData> iterator(localStreamingHash);
|
||||
@@ -74,8 +74,3 @@ QList<FileData> *HashComparer::getFilesForUpdate() const
|
||||
|
||||
return filesForUpdate;
|
||||
}
|
||||
|
||||
HashComparer::~HashComparer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
#include <Core/tools.h>
|
||||
#include <Widgets/updatenotifywidget.h>
|
||||
|
||||
class UpdateNotifyWidget;
|
||||
class VersionContainer;
|
||||
|
||||
class HashComparer :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -18,7 +15,7 @@ public:
|
||||
explicit HashComparer(QObject *parent = nullptr);
|
||||
void initialize(VersionContainer *versionContainer);
|
||||
void CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash);
|
||||
~HashComparer();
|
||||
~HashComparer() = default;
|
||||
|
||||
void showDeltas();
|
||||
void setWidget(UpdateNotifyWidget *updateWidget);
|
||||
|
||||
@@ -5,7 +5,7 @@ NotifyController::NotifyController(QObject *parent) : QObject(parent)
|
||||
|
||||
}
|
||||
|
||||
void NotifyController::showWarning(QString text)
|
||||
void NotifyController::showWarning(const QString& text)
|
||||
{
|
||||
QMessageBox warning;
|
||||
warning.setText(text);
|
||||
|
||||
@@ -9,10 +9,7 @@ class NotifyController : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NotifyController(QObject *parent = nullptr);
|
||||
|
||||
void showWarning(QString text);
|
||||
signals:
|
||||
|
||||
void showWarning(const QString& text);
|
||||
};
|
||||
|
||||
#endif // NOTIFYCONTROLLER_H
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#include "postprocessorsystem.h"
|
||||
|
||||
PostProcessorSystem::PostProcessorSystem(QObject *parent) : QObject(parent){}
|
||||
PostProcessorSystem::PostProcessorSystem(QObject *parent) :
|
||||
QObject(parent),
|
||||
hashComparer(nullptr),
|
||||
versionContainer(nullptr),
|
||||
updateController(nullptr),
|
||||
dataParserOutput(nullptr){}
|
||||
|
||||
void PostProcessorSystem::initialize(DataParserOutput *dataParserOutput,
|
||||
HashComparer *hashComparer,
|
||||
@@ -54,7 +59,7 @@ void PostProcessorSystem::compareFiles()
|
||||
updateController->updateFilesOnServer(hashComparer->getFilesForUpdate());
|
||||
}
|
||||
|
||||
void PostProcessorSystem::checkAccessType(QString type)
|
||||
void PostProcessorSystem::checkAccessType(const QString& type)
|
||||
{
|
||||
if(type == "instructor")
|
||||
{
|
||||
|
||||
@@ -14,13 +14,14 @@ public:
|
||||
void initialize(DataParserOutput *dataParserOutput,
|
||||
HashComparer *hashComparer,
|
||||
VersionContainer* versionContainer,
|
||||
UpdateController* updateContorller);
|
||||
UpdateController* updateController);
|
||||
|
||||
void socketDisable();
|
||||
void serverBlocked();
|
||||
void startCompare();
|
||||
void showUpdateList();
|
||||
void compareFiles();
|
||||
void checkAccessType(QString type);
|
||||
void checkAccessType(const QString& type);
|
||||
void saveLoginData(ServerAuthorization *auth);
|
||||
void setServerVersion(StreamingVersionData *serverVersion);
|
||||
void showServerDataList(QList<StreamingVersionData*> *versionList);
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
|
||||
RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
versionContainer(nullptr),
|
||||
dataParser(nullptr),
|
||||
postProcessorSystem(nullptr)
|
||||
{
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
filePath.clear();
|
||||
@@ -14,11 +17,6 @@ RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||
folderList = new QList<QString>;
|
||||
}
|
||||
|
||||
RecognizeSystem::~RecognizeSystem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RecognizeSystem::initialize(DataParser *dataParser, VersionContainer *versionContainer,PostProcessorSystem *postProcessorSystem)
|
||||
{
|
||||
this->versionContainer = versionContainer;
|
||||
|
||||
@@ -22,7 +22,7 @@ class RecognizeSystem : public QObject
|
||||
|
||||
public:
|
||||
explicit RecognizeSystem(QObject *parent = 0);
|
||||
~RecognizeSystem();
|
||||
~RecognizeSystem(){};
|
||||
void initialize(DataParser *dataParser, VersionContainer* versionContainer,PostProcessorSystem *postProcessorSystem);
|
||||
|
||||
void recognize(QTcpSocket *socket);
|
||||
|
||||
@@ -28,8 +28,8 @@ void ScreenChecker::check()
|
||||
QIcon checkedIcon;
|
||||
checkedIcon.addPixmap(checkedPixmap,QIcon::Disabled,QIcon::On);
|
||||
|
||||
qint8 sizeVertical = 90;
|
||||
quint16 sizeHorizontal = 150;
|
||||
float sizeVertical = 90;
|
||||
float sizeHorizontal = 150;
|
||||
|
||||
if(screens.length() > 3)
|
||||
{
|
||||
@@ -43,9 +43,9 @@ void ScreenChecker::check()
|
||||
(a->geometry().x() == b->geometry().x() && a->geometry().y() < b->geometry().y()); //выше
|
||||
});
|
||||
|
||||
for (int i = 0; i < screens.length() ;i++)
|
||||
//int i = 0; i < screens.length() ;i++
|
||||
for (auto display : screens)
|
||||
{
|
||||
QScreen *display = screens[i];
|
||||
screenCount++;
|
||||
|
||||
QString sizeText = QString::number(display->size().width()) + "x" + QString::number(display->size().height());
|
||||
@@ -131,8 +131,8 @@ QString ScreenChecker::getScreenCount() const
|
||||
|
||||
ScreenChecker::~ScreenChecker()
|
||||
{
|
||||
for (int i = 0; i < buttons.size(); i++)
|
||||
for (auto & button : buttons)
|
||||
{
|
||||
delete buttons[i];
|
||||
delete button;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ScreenChecker : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScreenChecker(QWidget *widget,DataParserOutput *dataParserOutput, QHBoxLayout *layout,QObject *parent = nullptr);
|
||||
explicit ScreenChecker(QWidget *mainWidget,DataParserOutput *dataParserOutput, QHBoxLayout *layout,QObject *parent = nullptr);
|
||||
~ScreenChecker();
|
||||
void check();
|
||||
QString getScreenCount() const;
|
||||
@@ -30,7 +30,6 @@ public:
|
||||
|
||||
private:
|
||||
QWidget *mainWidget;
|
||||
QWidget *widget;
|
||||
DataParserOutput *dataParserOutput;
|
||||
QHBoxLayout *layout;
|
||||
qint64 screenCount;
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#include "sendsystem.h"
|
||||
|
||||
SendSystem::SendSystem(QObject *) {}
|
||||
SendSystem::SendSystem(QObject *parent) :
|
||||
QObject(parent),
|
||||
socket(nullptr),
|
||||
readSize(1025*250){}
|
||||
|
||||
void SendSystem::setSocket(QTcpSocket *socket)
|
||||
{
|
||||
this->socket = socket;
|
||||
}
|
||||
|
||||
void SendSystem::xmlAnswer(QString message)
|
||||
void SendSystem::xmlAnswer(const QString& message)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
@@ -40,7 +43,7 @@ void SendSystem::sendClientAutorization()
|
||||
file.close();
|
||||
}
|
||||
|
||||
void SendSystem::sendFileBlock(QString path)
|
||||
void SendSystem::sendFileBlock(const QString& path)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
@@ -62,7 +65,7 @@ void SendSystem::sendFileBlock(QString path)
|
||||
|
||||
if(file.open(QFile::ReadOnly)){
|
||||
while(!file.atEnd()){
|
||||
QByteArray data = file.read(1025*250);
|
||||
QByteArray data = file.read(readSize);
|
||||
stream << data;
|
||||
socket->waitForBytesWritten(20);
|
||||
countSend++;
|
||||
@@ -74,13 +77,11 @@ void SendSystem::sendFileBlock(QString path)
|
||||
file.close();
|
||||
|
||||
emit sigSend();
|
||||
//qDebug() << "Transaction after send file: " << socket->isTransactionStarted();
|
||||
countSend = 0;
|
||||
//socket->waitForBytesWritten();
|
||||
socket->waitForReadyRead(20);
|
||||
}
|
||||
|
||||
void SendSystem::sendFolderBlock(QString path)
|
||||
void SendSystem::sendFolderBlock(const QString& path)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
@@ -91,11 +92,10 @@ void SendSystem::sendFolderBlock(QString path)
|
||||
socket->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
void SendSystem::sendFileBlockWithVersion(QString localPath,QString serverPath)
|
||||
void SendSystem::sendFileBlockWithVersion(const QString& localPath,const QString& serverPath)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
//QString fullPath = Tools::createLocalPath(localPath);
|
||||
quint64 fileSize = 0;
|
||||
int countSend = 0;
|
||||
|
||||
@@ -109,11 +109,10 @@ void SendSystem::sendFileBlockWithVersion(QString localPath,QString serverPath)
|
||||
stream << serverPath << fileSize;
|
||||
|
||||
socket->waitForReadyRead(20);
|
||||
//socket->waitForBytesWritten();
|
||||
|
||||
if(file.open(QFile::ReadOnly)){
|
||||
while(!file.atEnd()){
|
||||
QByteArray data = file.read(1025*250);
|
||||
QByteArray data = file.read(readSize);
|
||||
stream << data;
|
||||
socket->waitForBytesWritten(10);
|
||||
countSend++;
|
||||
@@ -133,8 +132,7 @@ void SendSystem::sendFileBlockWithVersion(QString localPath,QString serverPath)
|
||||
|
||||
void SendSystem::sendQTConnect()
|
||||
{
|
||||
//QString value = QString::number(PacketType::TYPE_QT);
|
||||
QByteArray container;
|
||||
QByteArray container; //TODO найти более компактное решение
|
||||
int numPackage = (int)PacketType::TYPE_QT;
|
||||
container.append(numPackage & 0x000000ff);
|
||||
container.append((numPackage >> 8) & 0x000000ff);
|
||||
@@ -145,7 +143,7 @@ void SendSystem::sendQTConnect()
|
||||
socket->waitForBytesWritten();
|
||||
}
|
||||
|
||||
void SendSystem::sendXMLAnswer(QByteArray array)
|
||||
void SendSystem::sendXMLAnswer(const QByteArray& array)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
@@ -189,19 +187,18 @@ void SendSystem::sendDeleteVersion(StreamingVersionData *streamingVersion)
|
||||
socket->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
void SendSystem::sendCopyVersion(QString streamingVersion)
|
||||
void SendSystem::sendCopyVersion(const QString& versionName)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
stream << PacketType::COPY_VERSION;
|
||||
|
||||
stream << streamingVersion;
|
||||
stream << versionName;
|
||||
}
|
||||
|
||||
void SendSystem::sendPacketType(PacketType packetType)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
QByteArray data;
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
stream << packetType;
|
||||
@@ -210,7 +207,6 @@ void SendSystem::sendPacketType(PacketType packetType)
|
||||
void SendSystem::sendCheckHash()
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
QByteArray data;
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
sendFileBlock(staticDataFolderName + hashFilename);
|
||||
@@ -218,8 +214,3 @@ void SendSystem::sendCheckHash()
|
||||
socket->waitForReadyRead(2000);
|
||||
stream << PacketType::TYPE_CHECK_VERSION;
|
||||
}
|
||||
|
||||
SendSystem::~SendSystem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -17,27 +17,28 @@ public:
|
||||
void setSocket(QTcpSocket *socket);
|
||||
void sendClientAutorization();
|
||||
void sendDisable();
|
||||
void sendFileBlock(QString path);
|
||||
void sendFolderBlock(QString path);
|
||||
void sendFileBlockWithVersion(QString localPath, QString serverPath);
|
||||
void sendFileBlock(const QString& path);
|
||||
void sendFolderBlock(const QString& path);
|
||||
void sendFileBlockWithVersion(const QString& localPath,const QString& serverPath);
|
||||
void sendQTConnect();
|
||||
void sendXMLAnswer(QByteArray array);
|
||||
void sendXMLAnswer(const QByteArray& array);
|
||||
void sendFinish();
|
||||
void sendChangeVersion(StreamingVersionData *streamingVersion);
|
||||
void sendDeleteVersion(StreamingVersionData *streamingVersion);
|
||||
void sendCopyVersion(QString versionName);
|
||||
void sendCopyVersion(const QString& versionName);
|
||||
void sendCheckHash();
|
||||
void sendPacketType(PacketType packetType);
|
||||
|
||||
~SendSystem();
|
||||
~SendSystem(){};
|
||||
signals:
|
||||
void sigSend();
|
||||
QByteArray sigGetXmlAnswer(QString);
|
||||
|
||||
public slots:
|
||||
void xmlAnswer(QString message);
|
||||
void xmlAnswer(const QString& message);
|
||||
private:
|
||||
QTcpSocket *socket;
|
||||
int readSize;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
#include "tcpclient.h"
|
||||
|
||||
TCPClient::TCPClient(QObject *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
sendSystem(nullptr),
|
||||
socket(nullptr),
|
||||
recognizeSystem(nullptr),
|
||||
isConnected(false)
|
||||
{
|
||||
}
|
||||
|
||||
void TCPClient::initialize(RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem)
|
||||
void TCPClient::initialize(RecognizeSystem *recognize,SendSystem *sendSystem)
|
||||
{
|
||||
this->recognizeSystem = recognize;
|
||||
this->externalExecuter = externalExecuter;
|
||||
this->sendSystem = sendSystem;
|
||||
isConnected = false;
|
||||
|
||||
@@ -21,7 +24,7 @@ void TCPClient::setConnect(ServerSettings *serverSettings)
|
||||
{
|
||||
socket = new QTcpSocket();
|
||||
qDebug() << "TCPCLient thread: " << thread();
|
||||
if (socket != NULL && socket->state() == QTcpSocket::ConnectedState)
|
||||
if (socket != nullptr && socket->state() == QTcpSocket::ConnectedState)
|
||||
{
|
||||
emit sigSendDebugLog("already connected");
|
||||
return;
|
||||
@@ -74,7 +77,6 @@ void TCPClient::slotConnectNotify()
|
||||
isConnected = false;
|
||||
emit sigSendDebugLog("Connect invalid");
|
||||
emit sigConnectionState(false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -99,8 +101,3 @@ bool TCPClient::getIsConnected() const
|
||||
{
|
||||
return isConnected;
|
||||
}
|
||||
|
||||
TCPClient::~TCPClient()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ class TCPClient : public QObject
|
||||
|
||||
public:
|
||||
explicit TCPClient(QObject *parent = 0);
|
||||
void initialize(RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem);
|
||||
void initialize(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||
void setConnect(ServerSettings *serverSettings);
|
||||
|
||||
void waitRead(int time);
|
||||
QTcpSocket* getSocket();
|
||||
~TCPClient();
|
||||
~TCPClient(){};
|
||||
|
||||
bool getIsConnected() const;
|
||||
|
||||
@@ -51,7 +51,6 @@ private:
|
||||
SendSystem *sendSystem;
|
||||
QTcpSocket *socket;
|
||||
RecognizeSystem *recognizeSystem;
|
||||
ExternalExecuter * externalExecuter;
|
||||
bool isConnected;
|
||||
|
||||
void setDisconnect();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<ServerSettingsContainer>
|
||||
<ServerSettings DestPortMath="18003" AutoStart="0" Language="RUS" UseMathModel="1" Port="6000" LocalPortMath="18004" Address="192.168.100.83"/>
|
||||
<VersionData Version="base" Created="Пт авг 8 13:27:27 2025" isChangable="0"/>
|
||||
<ServerSettings Language="RUS" Port="6000" Address="192.168.100.83" AutoStart="0" UseMathModel="1" DestPortMath="18003" LocalPortMath="18004"/>
|
||||
<VersionData Version="base" isChangable="0" Created="Пт авг 8 13:27:27 2025"/>
|
||||
</ServerSettingsContainer>
|
||||
|
||||
@@ -8,7 +8,7 @@ CommonButtonGroupWidget::CommonButtonGroupWidget(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::initialize(ExternalExecuter *extExec,SendSystem *sendSystem,TCPClient *client)
|
||||
void CommonButtonGroupWidget::initialize(ExternalExecuter *extExec,SendSystem *sendSystem)
|
||||
{
|
||||
externalExecuter = extExec;
|
||||
this->sendSystem = sendSystem;
|
||||
@@ -70,7 +70,6 @@ void CommonButtonGroupWidget::needUpdateState(bool flag)
|
||||
{
|
||||
ui->startButton->hide();
|
||||
ui->updateButton->setEnabled(flag);
|
||||
//ui->startButton->setEnabled(externalExecuter->findApp());
|
||||
ui->updateButton->show();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class CommonButtonGroupWidget : public QWidget
|
||||
|
||||
public:
|
||||
explicit CommonButtonGroupWidget(QWidget *parent = nullptr);
|
||||
void initialize(ExternalExecuter *extExec,SendSystem *sendSystem,TCPClient *client);
|
||||
void initialize(ExternalExecuter *extExec,SendSystem *sendSystem);
|
||||
void loadCompleteState();
|
||||
void lastVerInstalledState();
|
||||
void disconnectState();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QFontDatabase>
|
||||
#include <QMessageBox>
|
||||
#include <QMovie>
|
||||
#include <QMutexLocker>
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
@@ -25,10 +26,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
void MainWindow::createObjects()
|
||||
{
|
||||
qRegisterMetaType<PacketType>("PacketType");
|
||||
|
||||
|
||||
updateWidget = new UpdateNotifyWidget;
|
||||
|
||||
QMutex *mutex = new QMutex;
|
||||
QMutexLocker locker(mutex);
|
||||
|
||||
updateWidget->setParent(this);
|
||||
commonButtonGroupWidget = new CommonButtonGroupWidget;
|
||||
instructorButtonGroup = new InstructorButtonGroupWidget;
|
||||
@@ -83,7 +85,7 @@ void MainWindow::createObjects()
|
||||
timer = new QTimer;
|
||||
}
|
||||
|
||||
void MainWindow::paintEvent(QPaintEvent* event) {
|
||||
void MainWindow::paintEvent(QPaintEvent*) {
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
@@ -114,7 +116,7 @@ void MainWindow::initialize()
|
||||
dataParser->initialize(postProcessorSystem);
|
||||
recognizeSystem->initialize(dataParser, versionContainer, postProcessorSystem);
|
||||
resourceManager->painting();
|
||||
commonButtonGroupWidget->initialize(externalExecuter,sendSystem,client);
|
||||
commonButtonGroupWidget->initialize(externalExecuter,sendSystem);
|
||||
commonButtonGroupWidget->show();
|
||||
ui->LanguageWidget->hide();
|
||||
|
||||
@@ -122,7 +124,7 @@ void MainWindow::initialize()
|
||||
|
||||
setInlineDebug(tr("Инициализация..."));
|
||||
emit sigCalculateHash();
|
||||
emit sigInitializeClient(recognizeSystem,externalExecuter,sendSystem);
|
||||
emit sigInitializeClient(recognizeSystem,sendSystem);
|
||||
|
||||
screenChecker->check();
|
||||
|
||||
@@ -135,8 +137,6 @@ void MainWindow::initialize()
|
||||
ui->versionLayoutWidget->hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::bindConnection()
|
||||
{
|
||||
connect(timer,&QTimer::timeout,this,&MainWindow::slotDisableNotify);
|
||||
@@ -555,6 +555,8 @@ void MainWindow::on_exitButton_clicked()
|
||||
client->disconnect();
|
||||
|
||||
workerThread->quit();
|
||||
workerThread->wait();
|
||||
|
||||
delete workerThread;
|
||||
delete ui;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
void showWarning(QString text);
|
||||
void setInlineDebug(QString value);
|
||||
signals:
|
||||
void sigInitializeClient(RecognizeSystem *recognize,ExternalExecuter *externalExecuter,SendSystem *sendSystem);
|
||||
void sigInitializeClient(RecognizeSystem *recognize,SendSystem *sendSystem);
|
||||
void sigRecognize(UpdateController* updateController,
|
||||
DataParser* dataParser,
|
||||
MainWindow* mainWindow,
|
||||
|
||||
Reference in New Issue
Block a user