mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
bugfix: add behaviour on empty build and shared data
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
static const QString staticDataFolderName = "StaticData";
|
static const QString staticDataFolderName = "StaticData";
|
||||||
static const QString applicationFolderName = "Application";
|
static const QString applicationFolderName = "Application";
|
||||||
static const QString sharedDataFolderName = "SharedData";
|
static const QString sharedDataFolderName = "SharedData";
|
||||||
|
static const QString projectFolderName = "RRJLoader";
|
||||||
static const QString additionalFilesFolderName = "RRJ-95NEW-100";
|
static const QString additionalFilesFolderName = "RRJ-95NEW-100";
|
||||||
static const QString streamingAssetsFolderName = "StreamingAssets";
|
static const QString streamingAssetsFolderName = "StreamingAssets";
|
||||||
static const QString versionFolderName = "StreamingVersion";
|
static const QString versionFolderName = "StreamingVersion";
|
||||||
@@ -23,7 +24,7 @@ static const QString version = staticDataFolderName + "/version.xml";
|
|||||||
static const QString versionListFile = staticDataFolderName + "/versionList.xml";
|
static const QString versionListFile = staticDataFolderName + "/versionList.xml";
|
||||||
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
|
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
|
||||||
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
||||||
static const QString buildDataPath = "/Application/RRJLoader/RRJ_Data/";
|
static const QString buildDataPath = "/Application/" + projectFolderName + "/RRJ_Data/";
|
||||||
static const QString tasksAMMfileName = "/tasksAmm.xml";
|
static const QString tasksAMMfileName = "/tasksAmm.xml";
|
||||||
static const QString tasksFIMfileName = "/tasksFIM.xml";
|
static const QString tasksFIMfileName = "/tasksFIM.xml";
|
||||||
static const QString clientHash = staticDataFolderName + "/clientHash.xml";
|
static const QString clientHash = staticDataFolderName + "/clientHash.xml";
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "updatecontroller.h"
|
#include "updatecontroller.h"
|
||||||
|
|
||||||
|
|
||||||
UpdateController::UpdateController(QObject *parent) :
|
UpdateController::UpdateController(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
commonClientHandler(nullptr)
|
commonClientHandler(nullptr)
|
||||||
@@ -19,6 +20,12 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
|
|||||||
sizeToSend = 0;
|
sizeToSend = 0;
|
||||||
assetManager->initialize(this,dataParser);
|
assetManager->initialize(this,dataParser);
|
||||||
|
|
||||||
|
if (!checkRequiredFolder())
|
||||||
|
{
|
||||||
|
emit sigErrorRequired(100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
connect(this,&UpdateController::sigLogMessage,logger,&Logger::addTextToLogger,Qt::AutoConnection);
|
connect(this,&UpdateController::sigLogMessage,logger,&Logger::addTextToLogger,Qt::AutoConnection);
|
||||||
|
|
||||||
calculateFullHash();
|
calculateFullHash();
|
||||||
@@ -319,7 +326,7 @@ QList<FileData>* UpdateController::calculateHash(QString path)
|
|||||||
{
|
{
|
||||||
QFileInfo fileInfo(dirIterator.next());
|
QFileInfo fileInfo(dirIterator.next());
|
||||||
FileData currentFile;
|
FileData currentFile;
|
||||||
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != "RRJLoader")
|
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != projectFolderName)
|
||||||
{
|
{
|
||||||
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||||
currentFile.hash = "FOLDER";
|
currentFile.hash = "FOLDER";
|
||||||
@@ -536,7 +543,6 @@ QList<FileData> UpdateController::getFileSendList()
|
|||||||
return sendList;
|
return sendList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<FileData> UpdateController::getClientDataList() const
|
QList<FileData> UpdateController::getClientDataList() const
|
||||||
{
|
{
|
||||||
return clientDataList;
|
return clientDataList;
|
||||||
@@ -552,6 +558,17 @@ void UpdateController::clearCurrentDataInfo()
|
|||||||
delete dataInfo;
|
delete dataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UpdateController::checkRequiredFolder()
|
||||||
|
{
|
||||||
|
bool required = true;
|
||||||
|
QDir buildDir(buildPath + "/" + projectFolderName);
|
||||||
|
if (!buildDir.exists()) required = false;
|
||||||
|
|
||||||
|
QDir baseSharedDir(sharedDataPath + "/" + baseNameVersion);
|
||||||
|
if (!baseSharedDir.exists()) required = false;
|
||||||
|
|
||||||
|
return required;
|
||||||
|
}
|
||||||
UpdateController::~UpdateController()
|
UpdateController::~UpdateController()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include <Systems/Parsers/dataparser.h>
|
#include <Systems/Parsers/dataparser.h>
|
||||||
#include <Data/typesDataServerClient.h>
|
#include <Data/typesDataServerClient.h>
|
||||||
@@ -66,6 +68,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigLogMessage(QString message);
|
void sigLogMessage(QString message);
|
||||||
|
void sigErrorRequired(int code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<FileData> clientDataList;
|
QList<FileData> clientDataList;
|
||||||
@@ -94,6 +97,7 @@ private:
|
|||||||
void saveHash(QString fileName,QList<FileData> *fileList);
|
void saveHash(QString fileName,QList<FileData> *fileList);
|
||||||
void loadHash();
|
void loadHash();
|
||||||
void CalculateSizeToSend(QList<FileData> diffList);
|
void CalculateSizeToSend(QList<FileData> diffList);
|
||||||
|
bool checkRequiredFolder();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UPDATECONTROLLER_H
|
#endif // UPDATECONTROLLER_H
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QErrorMessage>
|
||||||
#include "serverlmswidget.h"
|
#include "serverlmswidget.h"
|
||||||
#include "ui_serverlmswidget.h"
|
#include "ui_serverlmswidget.h"
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qRegisterMetaType<PacketType>("PacketType");
|
qRegisterMetaType<PacketType>("PacketType");
|
||||||
|
errorCode = 0;
|
||||||
|
|
||||||
ui->btnStopServer->setEnabled(false);
|
ui->btnStopServer->setEnabled(false);
|
||||||
ui->btnStartServer->setEnabled(true);
|
ui->btnStartServer->setEnabled(true);
|
||||||
@@ -68,13 +70,12 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
processingSystem->initialize(this,dataParser,commonClientHandler,logger,updateController);
|
processingSystem->initialize(this,dataParser,commonClientHandler,logger,updateController);
|
||||||
|
|
||||||
logger->setTypeLog("widget");
|
logger->setTypeLog("widget");
|
||||||
|
|
||||||
|
|
||||||
connect(dataParser,&DataParser::sigLogMessage,logger,&Logger::addTextToLogger);
|
connect(dataParser,&DataParser::sigLogMessage,logger,&Logger::addTextToLogger);
|
||||||
|
|
||||||
connect(this,&ServerLMSWidget::sigUpdateController,updateController,&UpdateController::initialize,Qt::DirectConnection);
|
connect(this,&ServerLMSWidget::sigUpdateController,updateController,&UpdateController::initialize,Qt::DirectConnection);
|
||||||
connect(this,&ServerLMSWidget::sigLog,logger,&Logger::addTextToLogger,Qt::AutoConnection);
|
connect(this,&ServerLMSWidget::sigLog,logger,&Logger::addTextToLogger,Qt::AutoConnection);
|
||||||
connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection);
|
connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection);
|
||||||
|
connect(updateController,&UpdateController::sigErrorRequired,this,&ServerLMSWidget::setError);
|
||||||
|
|
||||||
emit sigUpdateController(commonClientHandler,dataParser,assetsManager,logger);
|
emit sigUpdateController(commonClientHandler,dataParser,assetsManager,logger);
|
||||||
on_btnStartServer_clicked();
|
on_btnStartServer_clicked();
|
||||||
@@ -97,6 +98,11 @@ void ServerLMSWidget::autorizationHandler(QString login)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerLMSWidget::setError(int code)
|
||||||
|
{
|
||||||
|
errorCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
ServerLMSWidget::~ServerLMSWidget()
|
ServerLMSWidget::~ServerLMSWidget()
|
||||||
{
|
{
|
||||||
stopServer();
|
stopServer();
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public:
|
|||||||
~ServerLMSWidget();
|
~ServerLMSWidget();
|
||||||
|
|
||||||
void autorizationHandler(QString login);
|
void autorizationHandler(QString login);
|
||||||
|
void setError(int code);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -81,6 +82,10 @@ public:
|
|||||||
{
|
{
|
||||||
stateBlockAutorization = unblocked;
|
stateBlockAutorization = unblocked;
|
||||||
}
|
}
|
||||||
|
int hasError() const
|
||||||
|
{
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
EStateBlockAutorization getStateBlockAutorization() const
|
EStateBlockAutorization getStateBlockAutorization() const
|
||||||
{
|
{
|
||||||
return stateBlockAutorization;
|
return stateBlockAutorization;
|
||||||
@@ -128,6 +133,7 @@ private:
|
|||||||
bool first = true; // для тестов Unity
|
bool first = true; // для тестов Unity
|
||||||
|
|
||||||
QTranslator qtLanguageTranslator;
|
QTranslator qtLanguageTranslator;
|
||||||
|
int errorCode;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTimer>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "./ui_mainwindow.h"
|
#include "./ui_mainwindow.h"
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
@@ -21,9 +21,16 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
this->move(0, 0);
|
this->move(0, 0);
|
||||||
this->showNormal();
|
this->showNormal();
|
||||||
|
|
||||||
|
errorCheck();
|
||||||
//this->showMaximized();
|
//this->showMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::exit()
|
||||||
|
{
|
||||||
|
QApplication::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
delete m_serverLMSWidget;
|
delete m_serverLMSWidget;
|
||||||
@@ -53,3 +60,26 @@ void MainWindow::on_cmbLanguage_currentIndexChanged(const QString &arg1)
|
|||||||
|
|
||||||
emit signal_LanguageChanged(language);
|
emit signal_LanguageChanged(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::errorCheck()
|
||||||
|
{
|
||||||
|
if(m_serverLMSWidget->hasError() == 100)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
|
||||||
|
msgBox.setWindowTitle("Ошибка");
|
||||||
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
|
msgBox.setText(tr("Не найдены файлы клиента"));
|
||||||
|
msgBox.setInformativeText(tr("* проверьте Application на наличие папки с билдом \n"
|
||||||
|
"* проверьте SharedData на наличие папки с базовой версией и именем base"));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Close);
|
||||||
|
msgBox.show();
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
|
||||||
|
if (ret == QMessageBox::Close)
|
||||||
|
{
|
||||||
|
//выключение с задержкой, так как eventLoop инициализируется позже
|
||||||
|
QTimer::singleShot(1000,this,&MainWindow::exit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,5 +36,7 @@ private:
|
|||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
ServerLMSWidget* m_serverLMSWidget;
|
ServerLMSWidget* m_serverLMSWidget;
|
||||||
QTranslator qtLanguageTranslator;
|
QTranslator qtLanguageTranslator;
|
||||||
|
void exit();
|
||||||
|
void errorCheck();
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user