mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Merge branch 'DEV' into CFI-Update
# Conflicts: # LibServer/serverlmswidget.cpp
This commit is contained in:
@@ -58,6 +58,12 @@ add_library(Server SHARED
|
|||||||
Systems/docsupdater.h
|
Systems/docsupdater.h
|
||||||
providerdblms/providerdblms.cpp
|
providerdblms/providerdblms.cpp
|
||||||
providerdblms/providerdblms.h
|
providerdblms/providerdblms.h
|
||||||
|
cficontroller/cficontroller.cpp
|
||||||
|
cficontroller/cficontroller.h
|
||||||
|
cficontroller/cfiobject.cpp
|
||||||
|
cficontroller/cfiobject.h
|
||||||
|
cficontroller/vectordouble.cpp
|
||||||
|
cficontroller/vectordouble.h
|
||||||
Server.qrc
|
Server.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,6 +80,7 @@ target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/settings)
|
|||||||
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data)
|
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data)
|
||||||
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Systems)
|
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Systems)
|
||||||
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Systems/Parsers)
|
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Systems/Parsers)
|
||||||
|
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cficontroller)
|
||||||
|
|
||||||
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibDataBaseInterface)
|
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibDataBaseInterface)
|
||||||
if(PROJECT_TYPE_DEBUG)
|
if(PROJECT_TYPE_DEBUG)
|
||||||
|
|||||||
@@ -18,5 +18,6 @@
|
|||||||
<file>resources/icons/reparation.png</file>
|
<file>resources/icons/reparation.png</file>
|
||||||
<file>resources/icons/save.png</file>
|
<file>resources/icons/save.png</file>
|
||||||
<file>resources/icons/stoped.png</file>
|
<file>resources/icons/stoped.png</file>
|
||||||
|
<file>resources/blankXML/ListCFI.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ void DBAnswerParser::initialize(DataParser *dataParser)
|
|||||||
QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listInstructors)
|
QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listInstructors)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListInstructors.xml", &commonDOM))
|
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListInstructors.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListInstructors");
|
QDomNode listNode = commonDOM.namedItem("ListInstructors");
|
||||||
@@ -34,7 +34,7 @@ QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listI
|
|||||||
instructorNode.toElement().setAttribute("logged_in", instructor.getLoggedIn());
|
instructorNode.toElement().setAttribute("logged_in", instructor.getLoggedIn());
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools::saveDOMtoXML("ListInstructors.xml", &commonDOM);
|
Tools::saveDOMtoFileXML("ListInstructors.xml", &commonDOM);
|
||||||
|
|
||||||
return commonDOM.toByteArray();
|
return commonDOM.toByteArray();
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listI
|
|||||||
QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
|
QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListGroups.xml", &commonDOM))
|
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListGroups.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListGroups");
|
QDomNode listNode = commonDOM.namedItem("ListGroups");
|
||||||
@@ -56,7 +56,7 @@ QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
|
|||||||
groupNode.toElement().setAttribute("name", group.getName());
|
groupNode.toElement().setAttribute("name", group.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools::saveDOMtoXML("ListGroups.xml", &commonDOM);
|
Tools::saveDOMtoFileXML("ListGroups.xml", &commonDOM);
|
||||||
|
|
||||||
return commonDOM.toByteArray();
|
return commonDOM.toByteArray();
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
|
|||||||
QByteArray DBAnswerParser::listTrainees(bool result, QList<Trainee> *listTrainees)
|
QByteArray DBAnswerParser::listTrainees(bool result, QList<Trainee> *listTrainees)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListTrainees.xml", &commonDOM))
|
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListTrainees.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListTrainees");
|
QDomNode listNode = commonDOM.namedItem("ListTrainees");
|
||||||
@@ -95,7 +95,7 @@ QByteArray DBAnswerParser::listTrainees(bool result, QList<Trainee> *listTrainee
|
|||||||
timingNode.toElement().setAttribute("operatingTime", timing.getOperatingTimeS());
|
timingNode.toElement().setAttribute("operatingTime", timing.getOperatingTimeS());
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools::saveDOMtoXML("ListTrainees.xml", &commonDOM);
|
Tools::saveDOMtoFileXML("ListTrainees.xml", &commonDOM);
|
||||||
|
|
||||||
return commonDOM.toByteArray();
|
return commonDOM.toByteArray();
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ QByteArray DBAnswerParser::listContacts(bool result, QList<ContactModel> *listCo
|
|||||||
QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListTasksAMM.xml", &commonDOM))
|
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListTasksAMM.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListTasksAMM");
|
QDomNode listNode = commonDOM.namedItem("ListTasksAMM");
|
||||||
@@ -173,7 +173,7 @@ QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools::saveDOMtoXML("ListTasksAMM.xml", &commonDOM);
|
Tools::saveDOMtoFileXML("ListTasksAMM.xml", &commonDOM);
|
||||||
|
|
||||||
return commonDOM.toByteArray();
|
return commonDOM.toByteArray();
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim>
|
|||||||
QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListTasksFIM.xml", &commonDOM))
|
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListTasksFIM.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListTasksFIM");
|
QDomNode listNode = commonDOM.namedItem("ListTasksFIM");
|
||||||
@@ -257,7 +257,7 @@ QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools::saveDOMtoXML("ListTasksFIM.xml", &commonDOM);
|
Tools::saveDOMtoFileXML("ListTasksFIM.xml", &commonDOM);
|
||||||
|
|
||||||
return commonDOM.toByteArray();
|
return commonDOM.toByteArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ DocsAnswerParser::DocsAnswerParser(QObject *parent) : QObject(parent)
|
|||||||
QByteArray DocsAnswerParser::listSubProc(QList<SubProc> list, QString dmCode)
|
QByteArray DocsAnswerParser::listSubProc(QList<SubProc> list, QString dmCode)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListSubProc.xml", &commonDOM))
|
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListSubProc.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListSubProc");
|
QDomNode listNode = commonDOM.namedItem("ListSubProc");
|
||||||
@@ -24,7 +24,7 @@ QByteArray DocsAnswerParser::listSubProc(QList<SubProc> list, QString dmCode)
|
|||||||
subProcNode.toElement().setAttribute("canplay", subProc.getModeListStr());
|
subProcNode.toElement().setAttribute("canplay", subProc.getModeListStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools::saveDOMtoXML("ListSubProc.xml", &commonDOM);
|
Tools::saveDOMtoFileXML("ListSubProc.xml", &commonDOM);
|
||||||
|
|
||||||
return commonDOM.toByteArray();
|
return commonDOM.toByteArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,17 +105,26 @@ void CommonClientHandler::slot_StatusTasksFIMofTraineeChanged(int trainee_id)
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType)
|
void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType, bool flOnlyGUI)
|
||||||
{
|
{
|
||||||
foreach(int idSocket, clientsMap->keys())
|
foreach(int idSocket, clientsMap->keys())
|
||||||
{
|
{
|
||||||
ClientHandler *handler = clientsMap->value(idSocket);
|
ClientHandler *handler = clientsMap->value(idSocket);
|
||||||
|
|
||||||
|
if(flOnlyGUI)
|
||||||
|
{
|
||||||
|
if(handler->getClient()->getTypeClient() != TypeClientAutorization::TYPE_GUI)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//if(packetType != PacketType::BUSY && packetType != PacketType::FREE)
|
//if(packetType != PacketType::BUSY && packetType != PacketType::FREE)
|
||||||
if (!handler->getClient()->getIsLoggedIn()) continue;
|
if (!handler->getClient()->getIsLoggedIn()) continue;
|
||||||
|
|
||||||
handler->sendPacketType(packetType);
|
handler->sendPacketType(packetType);
|
||||||
Logger::instance().log("AllSending " + handler->getClient()->getLogin() + " " + enumToString(packetType));
|
if(flOnlyGUI)
|
||||||
|
Logger::instance().log("All GUI Sending " + handler->getClient()->getLogin() + " " + enumToString(packetType), LogLevel::DEBUG);
|
||||||
|
else
|
||||||
|
Logger::instance().log("All Sending " + handler->getClient()->getLogin() + " " + enumToString(packetType), LogLevel::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
//emit sigSetServerState(packetType);
|
//emit sigSetServerState(packetType);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
void slot_DocsChanged();
|
void slot_DocsChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slot_sendPacketToAllClients(PacketType packetType);
|
void slot_sendPacketToAllClients(PacketType packetType, bool flOnlyGUI);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//void sigSetServerState(PacketType packetType);
|
//void sigSetServerState(PacketType packetType);
|
||||||
|
|||||||
@@ -41,11 +41,10 @@ bool DocsUpdater::updateDocsXML()
|
|||||||
{
|
{
|
||||||
QMutexLocker locker(&mtxAccess);
|
QMutexLocker locker(&mtxAccess);
|
||||||
|
|
||||||
QString nameDocsFile = tasksAMMfileName; //кручу верчу запутать хочу!
|
QString pathDocsFile = updateController->getPathAdditionalFile(tasksAMMfileName);
|
||||||
QString pathDocsFile = updateController->getPathAdditionalFile(nameDocsFile);
|
|
||||||
|
|
||||||
QDomDocument docTasksDOM;
|
QDomDocument docTasksDOM;
|
||||||
if(! Tools::loadXMLtoDOM(pathDocsFile, &docTasksDOM))
|
if(! Tools::loadFileXMLtoDOM(pathDocsFile, &docTasksDOM))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QDomElement manifestElement = docTasksDOM.firstChildElement("manifest");
|
QDomElement manifestElement = docTasksDOM.firstChildElement("manifest");
|
||||||
@@ -60,7 +59,7 @@ bool DocsUpdater::updateDocsXML()
|
|||||||
|
|
||||||
domElementParserAMM(manifestElement, nullptr);
|
domElementParserAMM(manifestElement, nullptr);
|
||||||
|
|
||||||
if(! Tools::saveDOMtoXML(pathDocsFile, &docTasksDOM))
|
if(! Tools::saveDOMtoFileXML(pathDocsFile, &docTasksDOM))
|
||||||
{
|
{
|
||||||
deleteAllModulsAMM();
|
deleteAllModulsAMM();
|
||||||
listTasksAMM.clear();
|
listTasksAMM.clear();
|
||||||
@@ -272,7 +271,7 @@ bool DocsUpdater::processingScenXML(const QString dmCode, QString &canplay, QLis
|
|||||||
|
|
||||||
|
|
||||||
QDomDocument docScenDOM;
|
QDomDocument docScenDOM;
|
||||||
if(! Tools::loadXMLtoDOM(pathScenXMLFile, &docScenDOM))
|
if(! Tools::loadFileXMLtoDOM(pathScenXMLFile, &docScenDOM))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QDomElement scenarioElement = docScenDOM.firstChildElement("scenario");
|
QDomElement scenarioElement = docScenDOM.firstChildElement("scenario");
|
||||||
|
|||||||
@@ -3,15 +3,17 @@
|
|||||||
|
|
||||||
#include <clienthandler.h>
|
#include <clienthandler.h>
|
||||||
|
|
||||||
ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, DocsUpdater* docsUpdater, QObject *parent):
|
ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, DocsUpdater* docsUpdater, CfiController* cfiController, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
updateController(nullptr),
|
updateController(nullptr),
|
||||||
docsUpdater(nullptr),
|
docsUpdater(nullptr),
|
||||||
|
cfiController(nullptr),
|
||||||
providerDBLMS(nullptr)
|
providerDBLMS(nullptr)
|
||||||
{
|
{
|
||||||
this->providerDBLMS = providerDBLMS;
|
this->providerDBLMS = providerDBLMS;
|
||||||
this->updateController = updateController;
|
this->updateController = updateController;
|
||||||
this->docsUpdater = docsUpdater;
|
this->docsUpdater = docsUpdater;
|
||||||
|
this->cfiController = cfiController;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessingSystem::initialize(MultiThreadServer *server, DataParser *dataParser,
|
void ProcessingSystem::initialize(MultiThreadServer *server, DataParser *dataParser,
|
||||||
@@ -97,12 +99,12 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
|||||||
client->sendVersion();
|
client->sendVersion();
|
||||||
|
|
||||||
//Отправляем состояние блокировки
|
//Отправляем состояние блокировки
|
||||||
/**/
|
/*
|
||||||
if(server->getStateBlockAutorization() == EStateBlockAutorization::blocked)
|
if(server->getStateBlockAutorization() == EStateBlockAutorization::blocked)
|
||||||
client->sendPacketType(PacketType::BUSY);
|
client->sendPacketType(PacketType::BUSY);
|
||||||
else
|
else
|
||||||
client->sendPacketType(PacketType::FREE);
|
client->sendPacketType(PacketType::FREE);
|
||||||
|
*/
|
||||||
|
|
||||||
//client->sendPacketType(PacketType::BUSY);
|
//client->sendPacketType(PacketType::BUSY);
|
||||||
//client->sendPacketType(PacketType::FREE);
|
//client->sendPacketType(PacketType::FREE);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "chatsystem.h"
|
#include "chatsystem.h"
|
||||||
#include "providerdblms.h"
|
#include "providerdblms.h"
|
||||||
#include "docsupdater.h"
|
#include "docsupdater.h"
|
||||||
|
#include "cficontroller.h"
|
||||||
|
|
||||||
class SendSystem;
|
class SendSystem;
|
||||||
class ServerLMSWidget;
|
class ServerLMSWidget;
|
||||||
@@ -20,12 +21,13 @@ class DataParser;
|
|||||||
class ClientHandler;
|
class ClientHandler;
|
||||||
class CommonClientHandler;
|
class CommonClientHandler;
|
||||||
class MultiThreadServer;
|
class MultiThreadServer;
|
||||||
|
class CfiController;
|
||||||
|
|
||||||
class ProcessingSystem : public QObject
|
class ProcessingSystem : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, DocsUpdater* docsUpdater, QObject *parent = nullptr);
|
explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, DocsUpdater* docsUpdater, CfiController* cfiController, QObject *parent = nullptr);
|
||||||
|
|
||||||
void initialize(MultiThreadServer *server,
|
void initialize(MultiThreadServer *server,
|
||||||
DataParser* dataParser,
|
DataParser* dataParser,
|
||||||
@@ -75,6 +77,7 @@ private:
|
|||||||
DataParser *dataParser;
|
DataParser *dataParser;
|
||||||
UpdateController *updateController;
|
UpdateController *updateController;
|
||||||
DocsUpdater* docsUpdater;
|
DocsUpdater* docsUpdater;
|
||||||
|
CfiController* cfiController;
|
||||||
ProviderDBLMS* providerDBLMS;
|
ProviderDBLMS* providerDBLMS;
|
||||||
ChatSystem *chatSystem;
|
ChatSystem *chatSystem;
|
||||||
void sendTaskListToUnity(ClientHandler *client);
|
void sendTaskListToUnity(ClientHandler *client);
|
||||||
|
|||||||
@@ -105,9 +105,15 @@ bool Tools::checkNonStaticData(QString path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Tools::loadByteArrayXMLtoDOM(const QByteArray &array, QDomDocument *commonDOM)
|
||||||
|
{
|
||||||
|
commonDOM->setContent(array);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Tools::loadXMLtoDOM(QString pathNameFile, QDomDocument *commonDOM)
|
|
||||||
|
bool Tools::loadFileXMLtoDOM(QString pathNameFile, QDomDocument *commonDOM)
|
||||||
{
|
{
|
||||||
QFile xmlInFile(pathNameFile);
|
QFile xmlInFile(pathNameFile);
|
||||||
|
|
||||||
@@ -122,7 +128,23 @@ bool Tools::loadXMLtoDOM(QString pathNameFile, QDomDocument *commonDOM)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tools::saveDOMtoXML(QString pathNameFile, QDomDocument *commonDOM)
|
bool Tools::loadFileXMLtoByteArray(QString pathNameFile, QByteArray &array)
|
||||||
|
{
|
||||||
|
QFile xmlInFile(pathNameFile);
|
||||||
|
|
||||||
|
if (! xmlInFile.open(QFile::ReadOnly | QFile::Text)) {
|
||||||
|
qDebug() << "loadXMLtoDOM: Couldn't read the file: " + pathNameFile;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
array = xmlInFile.readAll();
|
||||||
|
|
||||||
|
xmlInFile.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Tools::saveDOMtoFileXML(QString pathNameFile, QDomDocument *commonDOM)
|
||||||
{
|
{
|
||||||
QFile xmlOutFile(pathNameFile);
|
QFile xmlOutFile(pathNameFile);
|
||||||
if (!xmlOutFile.open(QFile::WriteOnly | QFile::Text))
|
if (!xmlOutFile.open(QFile::WriteOnly | QFile::Text))
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
|||||||
static const QString buildDataPath = "/Application/" + projectFolderName + "/RRJ_Data/";
|
static const QString buildDataPath = "/Application/" + projectFolderName + "/RRJ_Data/";
|
||||||
static const QString tasksAMMfileName = "/docs.xml"; //"/tasksAmm.xml";
|
static const QString tasksAMMfileName = "/docs.xml"; //"/tasksAmm.xml";
|
||||||
static const QString tasksFIMfileName = "/tasksFIM.xml";
|
static const QString tasksFIMfileName = "/tasksFIM.xml";
|
||||||
|
static const QString cfiListFileName = "/CfiList.xml";
|
||||||
//static const QString clientHash = staticDataFolderName + "/clientHash.xml";
|
//static const QString clientHash = staticDataFolderName + "/clientHash.xml";
|
||||||
static const QString logFolderPath = "log";
|
static const QString logFolderPath = "log";
|
||||||
|
|
||||||
@@ -75,8 +76,10 @@ public:
|
|||||||
static QString createFullPath(QString path);
|
static QString createFullPath(QString path);
|
||||||
static bool checkNonStaticData(QString path);
|
static bool checkNonStaticData(QString path);
|
||||||
|
|
||||||
static bool loadXMLtoDOM(QString pathNameFile, QDomDocument* commonDOM);
|
static bool loadByteArrayXMLtoDOM(const QByteArray& array, QDomDocument* commonDOM);
|
||||||
static bool saveDOMtoXML(QString pathNameFile, QDomDocument* commonDOM);
|
static bool loadFileXMLtoDOM(QString pathNameFile, QDomDocument* commonDOM);
|
||||||
|
static bool loadFileXMLtoByteArray(QString pathNameFile, QByteArray& array);
|
||||||
|
static bool saveDOMtoFileXML(QString pathNameFile, QDomDocument* commonDOM);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void UpdateController::changeAssetVersion(QString versionName)
|
|||||||
currentStreamingPath = assetManager->setVersion(versionName);
|
currentStreamingPath = assetManager->setVersion(versionName);
|
||||||
setUpCurrentServerHash();
|
setUpCurrentServerHash();
|
||||||
emit sigUpdateDocs();
|
emit sigUpdateDocs();
|
||||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY);
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY, false);
|
||||||
commonClientHandler->sendCurrentVersionToAllClient();
|
commonClientHandler->sendCurrentVersionToAllClient();
|
||||||
|
|
||||||
//commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
//commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
||||||
@@ -118,10 +118,10 @@ void UpdateController::calculateFullHash()
|
|||||||
void UpdateController::calculateFullHashWithSetup()
|
void UpdateController::calculateFullHashWithSetup()
|
||||||
{
|
{
|
||||||
bool res = emit signal_BlockAutorization(true, "SERVER", "CalculateFullHashWithSetup");
|
bool res = emit signal_BlockAutorization(true, "SERVER", "CalculateFullHashWithSetup");
|
||||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::RECALCULATE_HASH);
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::RECALCULATE_HASH, false);
|
||||||
calculateCurrentSharedHash();
|
calculateCurrentSharedHash();
|
||||||
setUpCurrentServerHash();
|
setUpCurrentServerHash();
|
||||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY);
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY, false);
|
||||||
res = emit signal_BlockAutorization(false, "SERVER", "CalculateFullHashWithSetup");
|
res = emit signal_BlockAutorization(false, "SERVER", "CalculateFullHashWithSetup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
255
LibServer/cficontroller/cficontroller.cpp
Normal file
255
LibServer/cficontroller/cficontroller.cpp
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
#include "cficontroller.h"
|
||||||
|
|
||||||
|
CfiController::CfiController(UpdateController* updateController, QObject *parent) :
|
||||||
|
QObject(parent),
|
||||||
|
updateController(updateController),
|
||||||
|
germanLocale(nullptr)
|
||||||
|
{
|
||||||
|
germanLocale = new QLocale(QLocale::German);
|
||||||
|
}
|
||||||
|
|
||||||
|
CfiController::~CfiController()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiController::lockAccessToCfiXML()
|
||||||
|
{
|
||||||
|
mtxAccess.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiController::unLockAccessToCfiXML()
|
||||||
|
{
|
||||||
|
mtxAccess.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CfiController::parsingCfiXML(QMap<int, CfiObject>& mapCfiObjects)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mtxAccess);
|
||||||
|
|
||||||
|
if(!updateController)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QString pathCfiListFile = updateController->getPathAdditionalFile(cfiListFileName);
|
||||||
|
|
||||||
|
QDomDocument docCfiListDOM_Orig;
|
||||||
|
if(! Tools::loadFileXMLtoDOM(pathCfiListFile, &docCfiListDOM_Orig))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!parsingCfiXML_DOM(docCfiListDOM_Orig, mapCfiObjects))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CfiController::updateCfiXML(const QByteArray &array)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mtxAccess);
|
||||||
|
|
||||||
|
if(!updateController)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Исходный файл (на Сервере)
|
||||||
|
QString pathCfiListFile = updateController->getPathAdditionalFile(cfiListFileName);
|
||||||
|
QDomDocument docCfiListDOM_Orig;
|
||||||
|
if(! Tools::loadFileXMLtoDOM(pathCfiListFile, &docCfiListDOM_Orig))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Новый файл с изменениями (поступивший от клиента) в формате массива
|
||||||
|
QDomDocument docCfiListDOM_New;
|
||||||
|
if(! Tools::loadByteArrayXMLtoDOM(array, &docCfiListDOM_New))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QMap<int, CfiObject> mapCfiObjects_Orig;
|
||||||
|
QMap<int, CfiObject> mapCfiObjects_New;
|
||||||
|
|
||||||
|
if(!parsingCfiXML_DOM(docCfiListDOM_Orig, mapCfiObjects_Orig))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!parsingCfiXML_DOM(docCfiListDOM_New, mapCfiObjects_New))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!merge2map(mapCfiObjects_Orig, mapCfiObjects_New))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return saveNewCfiListFile(mapCfiObjects_Orig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void CfiController::test()
|
||||||
|
{
|
||||||
|
QString pathCfiListFile = updateController->getPathAdditionalFile("/new_CfiList.xml");
|
||||||
|
QByteArray array;
|
||||||
|
Tools::loadFileXMLtoByteArray(pathCfiListFile, array);
|
||||||
|
updateCfiXML(array);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Vector3dDouble CfiController::getXYZfromElement(QDomElement element)
|
||||||
|
{
|
||||||
|
Vector3dDouble vector3D;
|
||||||
|
QDomNamedNodeMap nodeMap = element.attributes();
|
||||||
|
vector3D.setX(germanLocale->toDouble(nodeMap.namedItem("x").nodeValue()));
|
||||||
|
vector3D.setY(germanLocale->toDouble(nodeMap.namedItem("y").nodeValue()));
|
||||||
|
vector3D.setZ(germanLocale->toDouble(nodeMap.namedItem("z").nodeValue()));
|
||||||
|
return vector3D;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2dDouble CfiController::getXYfromElement(QDomElement element)
|
||||||
|
{
|
||||||
|
Vector2dDouble vector2D;
|
||||||
|
QDomNamedNodeMap nodeMap = element.attributes();
|
||||||
|
vector2D.setX(germanLocale->toDouble(nodeMap.namedItem("x").nodeValue()));
|
||||||
|
vector2D.setY(germanLocale->toDouble(nodeMap.namedItem("y").nodeValue()));
|
||||||
|
return vector2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
double CfiController::roundDoubleVal(double value, int cntNumAfterPoint)
|
||||||
|
{
|
||||||
|
return round(value * pow(10, cntNumAfterPoint)) / pow(10, cntNumAfterPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CfiController::parsingCfiXML_DOM(QDomDocument &domDoc, QMap<int, CfiObject>& mapCfiObjects)
|
||||||
|
{
|
||||||
|
QDomElement CFIObjectsElement = domDoc.firstChildElement("CFIObjects");
|
||||||
|
if(CFIObjectsElement.isNull())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
mapCfiObjects.clear();
|
||||||
|
|
||||||
|
//Parsing
|
||||||
|
QDomElement oneCFIObjectElement = CFIObjectsElement.firstChildElement();
|
||||||
|
if(oneCFIObjectElement.isNull())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
name = oneCFIObjectElement.nodeName();
|
||||||
|
|
||||||
|
if(name == "CFIObject")
|
||||||
|
{
|
||||||
|
CfiObject cfiObj;
|
||||||
|
|
||||||
|
cfiObj.setDomElement(oneCFIObjectElement);
|
||||||
|
|
||||||
|
//атрибуты CFIObject
|
||||||
|
QDomNamedNodeMap nodeMapOneCFIObject = oneCFIObjectElement.attributes();
|
||||||
|
cfiObj.setId(nodeMapOneCFIObject.namedItem("id").nodeValue().toInt());
|
||||||
|
cfiObj.setIsChanged(nodeMapOneCFIObject.namedItem("isChanged").nodeValue() == "True" ? true : false);
|
||||||
|
|
||||||
|
//childs CFIObject
|
||||||
|
QDomElement cfiName_Element = oneCFIObjectElement.elementsByTagName("cfiName").at(0).toElement();
|
||||||
|
cfiObj.setCfiName(cfiName_Element.text());
|
||||||
|
QDomElement cfi_Element = oneCFIObjectElement.elementsByTagName("cfi").at(0).toElement();
|
||||||
|
cfiObj.setCfi(cfi_Element.text());
|
||||||
|
QDomElement zoneName_Element = oneCFIObjectElement.elementsByTagName("zoneName").at(0).toElement();
|
||||||
|
cfiObj.setZoneName(zoneName_Element.text());
|
||||||
|
QDomElement goName_Element = oneCFIObjectElement.elementsByTagName("goName").at(0).toElement();
|
||||||
|
cfiObj.setGoName(goName_Element.text());
|
||||||
|
|
||||||
|
//child CFIObject : SetCameraPos
|
||||||
|
SetCameraPos setCamPos;
|
||||||
|
QDomElement setcamerapos_Element = oneCFIObjectElement.elementsByTagName("setcamerapos").at(0).toElement();
|
||||||
|
//атрибуты setcamerapos
|
||||||
|
QDomNamedNodeMap nodeMapSetcamerapos = setcamerapos_Element.attributes();
|
||||||
|
setCamPos.set = nodeMapSetcamerapos.namedItem("set").nodeValue() == "True" ? true : false;
|
||||||
|
setCamPos.fast = nodeMapSetcamerapos.namedItem("fast").nodeValue() == "True" ? true : false;
|
||||||
|
setCamPos.specialPanel = nodeMapSetcamerapos.namedItem("specialPanel").nodeValue() == "True" ? true : false;
|
||||||
|
|
||||||
|
setCamPos.cameraMode = nodeMapSetcamerapos.namedItem("cameraMode").nodeValue();
|
||||||
|
setCamPos.state = nodeMapSetcamerapos.namedItem("state").nodeValue();
|
||||||
|
setCamPos.panelName = nodeMapSetcamerapos.namedItem("panelName").nodeValue();
|
||||||
|
|
||||||
|
setCamPos.prevCamOffsetMARposY = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("prevCamOffsetMARposY").nodeValue());
|
||||||
|
setCamPos.camOffsetMARposY = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("camOffsetMARposY").nodeValue());
|
||||||
|
setCamPos.prevCharControlerHeight = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("prevCharControlerHeight").nodeValue());
|
||||||
|
setCamPos.charControlerHeight = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("charControlerHeight").nodeValue());
|
||||||
|
setCamPos.FOV = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("FOV").nodeValue());
|
||||||
|
setCamPos.moveSpeed = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("moveSpeed").nodeValue());
|
||||||
|
setCamPos.projectionSize = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("projectionSize").nodeValue());
|
||||||
|
setCamPos.offset = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("offset").nodeValue());
|
||||||
|
setCamPos.prevPlayerRot = germanLocale->toDouble(nodeMapSetcamerapos.namedItem("prevPlayerRot").nodeValue());
|
||||||
|
|
||||||
|
//childs setcamerapos
|
||||||
|
QDomElement loc_Element;
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("axesClamp").at(0).toElement();
|
||||||
|
setCamPos.axesClamp = getXYfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("prevPlayerPos").at(0).toElement();
|
||||||
|
setCamPos.prevPlayerPos = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("playerPos").at(0).toElement();
|
||||||
|
setCamPos.playerPos = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("playerRot").at(0).toElement();
|
||||||
|
setCamPos.playerRot = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("prevCamRot").at(0).toElement();
|
||||||
|
setCamPos.prevCamRot = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("camRot").at(0).toElement();
|
||||||
|
setCamPos.camRot = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("goCenter").at(0).toElement();
|
||||||
|
setCamPos.goCenter = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("playerMARpos").at(0).toElement();
|
||||||
|
setCamPos.playerMARpos = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("playerMARrot").at(0).toElement();
|
||||||
|
setCamPos.playerMARrot = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("camMARrot").at(0).toElement();
|
||||||
|
setCamPos.camMARrot = getXYZfromElement(loc_Element);
|
||||||
|
loc_Element = setcamerapos_Element.elementsByTagName("playerPosRelativeToThePanel").at(0).toElement();
|
||||||
|
setCamPos.playerPosRelativeToThePanel = getXYZfromElement(loc_Element);
|
||||||
|
|
||||||
|
cfiObj.setSetCameraPos(setCamPos);
|
||||||
|
|
||||||
|
mapCfiObjects.insert(cfiObj.getId(), cfiObj);
|
||||||
|
}
|
||||||
|
}while (! (oneCFIObjectElement = oneCFIObjectElement.nextSiblingElement()).isNull());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CfiController::merge2map(QMap<int, CfiObject> &mapCfiObjects_orig, QMap<int, CfiObject> &mapCfiObjects_new)
|
||||||
|
{
|
||||||
|
for(CfiObject cfiObj : mapCfiObjects_new)
|
||||||
|
{
|
||||||
|
int id = cfiObj.getId();
|
||||||
|
|
||||||
|
if(mapCfiObjects_orig.contains(id))
|
||||||
|
{//Такой есть
|
||||||
|
if(cfiObj.getIsChanged())
|
||||||
|
{//Заменяем
|
||||||
|
mapCfiObjects_orig.take(id);
|
||||||
|
|
||||||
|
cfiObj.setIsChanged(false);
|
||||||
|
cfiObj.resetIsChangedInDomElement();
|
||||||
|
mapCfiObjects_orig.insert(id, cfiObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//Добавляем
|
||||||
|
cfiObj.setIsChanged(false);
|
||||||
|
cfiObj.resetIsChangedInDomElement();
|
||||||
|
mapCfiObjects_orig.insert(id, cfiObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CfiController::saveNewCfiListFile(QMap<int, CfiObject> &mapCfiObjects)
|
||||||
|
{
|
||||||
|
QDomDocument commonDOM;
|
||||||
|
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListCFI.xml", &commonDOM))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QDomNode listNode = commonDOM.namedItem("CFIObjects");
|
||||||
|
|
||||||
|
for(CfiObject cfiObj : mapCfiObjects)
|
||||||
|
{
|
||||||
|
listNode.appendChild(cfiObj.getDomElement());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString pathCfiListFile = updateController->getPathAdditionalFile(cfiListFileName);
|
||||||
|
|
||||||
|
return Tools::saveDOMtoFileXML(pathCfiListFile, &commonDOM);
|
||||||
|
}
|
||||||
53
LibServer/cficontroller/cficontroller.h
Normal file
53
LibServer/cficontroller/cficontroller.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#ifndef CFICONTROLLER_H
|
||||||
|
#define CFICONTROLLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QLocale>
|
||||||
|
#include "updatecontroller.h"
|
||||||
|
#include "cfiobject.h"
|
||||||
|
|
||||||
|
class CfiController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CfiController(UpdateController* updateController, QObject *parent = nullptr);
|
||||||
|
~CfiController();
|
||||||
|
public:
|
||||||
|
void lockAccessToCfiXML();
|
||||||
|
void unLockAccessToCfiXML();
|
||||||
|
|
||||||
|
//Распарсивание файла CfiList.xml
|
||||||
|
bool parsingCfiXML(QMap<int, CfiObject>& mapCfiObjects);
|
||||||
|
|
||||||
|
//Слияние (обновление) с новыми данными
|
||||||
|
bool updateCfiXML(const QByteArray& array);
|
||||||
|
|
||||||
|
//Для теста
|
||||||
|
//void test();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vector3dDouble getXYZfromElement(QDomElement element);
|
||||||
|
Vector2dDouble getXYfromElement(QDomElement element);
|
||||||
|
|
||||||
|
double roundDoubleVal(double value, int cntNumAfterPoint);
|
||||||
|
|
||||||
|
bool parsingCfiXML_DOM(QDomDocument& domDoc, QMap<int, CfiObject>& mapCfiObjects);
|
||||||
|
|
||||||
|
bool merge2map(QMap<int, CfiObject>& mapCfiObjects_orig, QMap<int, CfiObject>& mapCfiObjects_new);
|
||||||
|
|
||||||
|
bool saveNewCfiListFile(QMap<int, CfiObject>& mapCfiObjects);
|
||||||
|
|
||||||
|
private:
|
||||||
|
UpdateController* updateController;
|
||||||
|
|
||||||
|
QMutex mtxAccess;
|
||||||
|
|
||||||
|
//QList<CfiObject> listCfiObjects;
|
||||||
|
|
||||||
|
QLocale* germanLocale;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFICONTROLLER_H
|
||||||
91
LibServer/cficontroller/cfiobject.cpp
Normal file
91
LibServer/cficontroller/cfiobject.cpp
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#include "cfiobject.h"
|
||||||
|
|
||||||
|
CfiObject::CfiObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CfiObject::getId() const
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setId(int value)
|
||||||
|
{
|
||||||
|
id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CfiObject::getCfiName() const
|
||||||
|
{
|
||||||
|
return cfiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setCfiName(const QString &value)
|
||||||
|
{
|
||||||
|
cfiName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CfiObject::getCfi() const
|
||||||
|
{
|
||||||
|
return cfi;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setCfi(const QString &value)
|
||||||
|
{
|
||||||
|
cfi = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CfiObject::getZoneName() const
|
||||||
|
{
|
||||||
|
return zoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setZoneName(const QString &value)
|
||||||
|
{
|
||||||
|
zoneName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CfiObject::getGoName() const
|
||||||
|
{
|
||||||
|
return goName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setGoName(const QString &value)
|
||||||
|
{
|
||||||
|
goName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCameraPos CfiObject::getSetCameraPos() const
|
||||||
|
{
|
||||||
|
return setCameraPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setSetCameraPos(const SetCameraPos &value)
|
||||||
|
{
|
||||||
|
setCameraPos = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CfiObject::getIsChanged() const
|
||||||
|
{
|
||||||
|
return isChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setIsChanged(bool value)
|
||||||
|
{
|
||||||
|
isChanged = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement CfiObject::getDomElement() const
|
||||||
|
{
|
||||||
|
return domElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::setDomElement(const QDomElement &value)
|
||||||
|
{
|
||||||
|
domElement = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CfiObject::resetIsChangedInDomElement()
|
||||||
|
{
|
||||||
|
domElement.setAttribute("isChanged", "False");
|
||||||
|
}
|
||||||
84
LibServer/cficontroller/cfiobject.h
Normal file
84
LibServer/cficontroller/cfiobject.h
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
#ifndef CFIOBJECT_H
|
||||||
|
#define CFIOBJECT_H
|
||||||
|
|
||||||
|
#include "vectordouble.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <QDomElement>
|
||||||
|
|
||||||
|
struct SetCameraPos
|
||||||
|
{
|
||||||
|
bool set;
|
||||||
|
bool fast;
|
||||||
|
bool specialPanel;
|
||||||
|
QString cameraMode;
|
||||||
|
QString state;
|
||||||
|
QString panelName;
|
||||||
|
float prevCamOffsetMARposY;
|
||||||
|
float camOffsetMARposY;
|
||||||
|
float prevCharControlerHeight;
|
||||||
|
float charControlerHeight;
|
||||||
|
float FOV;
|
||||||
|
float moveSpeed;
|
||||||
|
float projectionSize;
|
||||||
|
float offset;
|
||||||
|
float prevPlayerRot;
|
||||||
|
|
||||||
|
Vector2dDouble axesClamp;
|
||||||
|
|
||||||
|
Vector3dDouble prevPlayerPos;
|
||||||
|
Vector3dDouble playerPos;
|
||||||
|
Vector3dDouble playerRot;
|
||||||
|
Vector3dDouble prevCamRot;
|
||||||
|
Vector3dDouble camRot;
|
||||||
|
Vector3dDouble goCenter;
|
||||||
|
Vector3dDouble playerMARpos;
|
||||||
|
Vector3dDouble playerMARrot;
|
||||||
|
Vector3dDouble camMARrot;
|
||||||
|
Vector3dDouble playerPosRelativeToThePanel;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CfiObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CfiObject();
|
||||||
|
|
||||||
|
int getId() const;
|
||||||
|
void setId(int value);
|
||||||
|
|
||||||
|
QString getCfiName() const;
|
||||||
|
void setCfiName(const QString &value);
|
||||||
|
|
||||||
|
QString getCfi() const;
|
||||||
|
void setCfi(const QString &value);
|
||||||
|
|
||||||
|
QString getZoneName() const;
|
||||||
|
void setZoneName(const QString &value);
|
||||||
|
|
||||||
|
QString getGoName() const;
|
||||||
|
void setGoName(const QString &value);
|
||||||
|
|
||||||
|
SetCameraPos getSetCameraPos() const;
|
||||||
|
void setSetCameraPos(const SetCameraPos &value);
|
||||||
|
|
||||||
|
bool getIsChanged() const;
|
||||||
|
void setIsChanged(bool value);
|
||||||
|
|
||||||
|
QDomElement getDomElement() const;
|
||||||
|
void setDomElement(const QDomElement &value);
|
||||||
|
|
||||||
|
void resetIsChangedInDomElement();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int id;
|
||||||
|
bool isChanged;
|
||||||
|
QString cfiName;
|
||||||
|
QString cfi;
|
||||||
|
QString zoneName;
|
||||||
|
QString goName;
|
||||||
|
|
||||||
|
SetCameraPos setCameraPos;
|
||||||
|
|
||||||
|
QDomElement domElement;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CFIOBJECT_H
|
||||||
66
LibServer/cficontroller/vectordouble.cpp
Normal file
66
LibServer/cficontroller/vectordouble.cpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#include "vectordouble.h"
|
||||||
|
|
||||||
|
Vector2dDouble::Vector2dDouble() :
|
||||||
|
x(0.0),
|
||||||
|
y(0.0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector2dDouble::getX() const
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vector2dDouble::setX(double value)
|
||||||
|
{
|
||||||
|
x = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector2dDouble::getY() const
|
||||||
|
{
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vector2dDouble::setY(double value)
|
||||||
|
{
|
||||||
|
y = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3dDouble::Vector3dDouble() :
|
||||||
|
x(0.0),
|
||||||
|
y(0.0),
|
||||||
|
z(0.0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector3dDouble::getX() const
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vector3dDouble::setX(double value)
|
||||||
|
{
|
||||||
|
x = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector3dDouble::getY() const
|
||||||
|
{
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vector3dDouble::setY(double value)
|
||||||
|
{
|
||||||
|
y = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector3dDouble::getZ() const
|
||||||
|
{
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vector3dDouble::setZ(double value)
|
||||||
|
{
|
||||||
|
z = value;
|
||||||
|
}
|
||||||
42
LibServer/cficontroller/vectordouble.h
Normal file
42
LibServer/cficontroller/vectordouble.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#ifndef VECTORDOUBLE_H
|
||||||
|
#define VECTORDOUBLE_H
|
||||||
|
|
||||||
|
|
||||||
|
class Vector2dDouble
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Vector2dDouble();
|
||||||
|
|
||||||
|
double getX() const;
|
||||||
|
void setX(double value);
|
||||||
|
|
||||||
|
double getY() const;
|
||||||
|
void setY(double value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Vector3dDouble
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Vector3dDouble();
|
||||||
|
|
||||||
|
double getX() const;
|
||||||
|
void setX(double value);
|
||||||
|
|
||||||
|
double getY() const;
|
||||||
|
void setY(double value);
|
||||||
|
|
||||||
|
double getZ() const;
|
||||||
|
void setZ(double value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
double z;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VECTORDOUBLE_H
|
||||||
@@ -239,10 +239,12 @@ bool MultiThreadServer::slot_BlockAutorization(bool block, QString whoFullName,
|
|||||||
|
|
||||||
if(res)
|
if(res)
|
||||||
{
|
{
|
||||||
|
/**/
|
||||||
if(blockRes)
|
if(blockRes)
|
||||||
emit signal_sendPacketToAllClients(PacketType::BUSY);
|
emit signal_sendPacketToAllClients(PacketType::BUSY, true);
|
||||||
else
|
else
|
||||||
emit signal_sendPacketToAllClients(PacketType::FREE);
|
emit signal_sendPacketToAllClients(PacketType::FREE, true);
|
||||||
|
|
||||||
|
|
||||||
for(QString keyLocal : blockersMap.keys())
|
for(QString keyLocal : blockersMap.keys())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ signals:
|
|||||||
void signalStopSendFile();
|
void signalStopSendFile();
|
||||||
|
|
||||||
void signal_BlockAutorizationIndicate(bool block, QString blocker, QString types);
|
void signal_BlockAutorizationIndicate(bool block, QString blocker, QString types);
|
||||||
void signal_sendPacketToAllClients(PacketType packetType);
|
void signal_sendPacketToAllClients(PacketType packetType, bool flOnlyGUI);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotDisconnectClient(QString peerAddress, QString peerPort);
|
void slotDisconnectClient(QString peerAddress, QString peerPort);
|
||||||
|
|||||||
3
LibServer/resources/blankXML/ListCFI.xml
Normal file
3
LibServer/resources/blankXML/ListCFI.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CFIObjects>
|
||||||
|
</CFIObjects>
|
||||||
@@ -28,7 +28,8 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
commonClientHandler(nullptr),
|
commonClientHandler(nullptr),
|
||||||
chatSystem(nullptr),
|
chatSystem(nullptr),
|
||||||
docsUpdater(nullptr),
|
docsUpdater(nullptr),
|
||||||
providerDBLMS(nullptr),
|
cfiController(nullptr),
|
||||||
|
providerDBLMS(nullptr),
|
||||||
first (true),
|
first (true),
|
||||||
language(languageENG),
|
language(languageENG),
|
||||||
errorCode(0),
|
errorCode(0),
|
||||||
@@ -75,6 +76,7 @@ ServerLMSWidget::~ServerLMSWidget()
|
|||||||
delete dataParser;
|
delete dataParser;
|
||||||
delete processingSystem;
|
delete processingSystem;
|
||||||
delete updateController;
|
delete updateController;
|
||||||
|
delete cfiController;
|
||||||
delete docsUpdater;
|
delete docsUpdater;
|
||||||
delete assetsManager;
|
delete assetsManager;
|
||||||
delete chatSystem;
|
delete chatSystem;
|
||||||
@@ -151,6 +153,9 @@ void ServerLMSWidget::slot_UpdateDocs()
|
|||||||
emit signal_DocsChanged();
|
emit signal_DocsChanged();
|
||||||
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
|
//TODO для теста
|
||||||
|
//cfiController->test();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLMSWidget::slot_startInitialization_step1()
|
void ServerLMSWidget::slot_startInitialization_step1()
|
||||||
@@ -374,7 +379,10 @@ void ServerLMSWidget::startInitialization_step0()
|
|||||||
docsUpdater = new DocsUpdater(updateController/*, this*/);
|
docsUpdater = new DocsUpdater(updateController/*, this*/);
|
||||||
docsUpdater->moveToThread(updateThread);
|
docsUpdater->moveToThread(updateThread);
|
||||||
|
|
||||||
processingSystem = new ProcessingSystem(providerDBLMS, updateController, docsUpdater);
|
cfiController = new CfiController(updateController/*, this*/);
|
||||||
|
cfiController->moveToThread(updateThread);
|
||||||
|
|
||||||
|
processingSystem = new ProcessingSystem(providerDBLMS, updateController, docsUpdater, cfiController);
|
||||||
|
|
||||||
dataParser = new DataParser(assetsManager, processingSystem);
|
dataParser = new DataParser(assetsManager, processingSystem);
|
||||||
|
|
||||||
@@ -384,8 +392,8 @@ void ServerLMSWidget::startInitialization_step0()
|
|||||||
|
|
||||||
server = new MultiThreadServer(this, updateController, processingSystem, dataParser, 6000);
|
server = new MultiThreadServer(this, updateController, processingSystem, dataParser, 6000);
|
||||||
connect(server, &MultiThreadServer::signal_BlockAutorizationIndicate, this, &ServerLMSWidget::slot_BlockAutorizationIndicate);
|
connect(server, &MultiThreadServer::signal_BlockAutorizationIndicate, this, &ServerLMSWidget::slot_BlockAutorizationIndicate);
|
||||||
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, server, &MultiThreadServer::slot_BlockAutorization, Qt::AutoConnection);
|
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, server, &MultiThreadServer::slot_BlockAutorization/*, Qt::DirectConnection*/);
|
||||||
connect(updateController, &UpdateController::signal_BlockAutorization, server, &MultiThreadServer::slot_BlockAutorization, Qt::AutoConnection);
|
connect(updateController, &UpdateController::signal_BlockAutorization, server, &MultiThreadServer::slot_BlockAutorization/*, Qt::DirectConnection*/);
|
||||||
connect(server, &MultiThreadServer::signal_sendPacketToAllClients, commonClientHandler, &CommonClientHandler::slot_sendPacketToAllClients);
|
connect(server, &MultiThreadServer::signal_sendPacketToAllClients, commonClientHandler, &CommonClientHandler::slot_sendPacketToAllClients);
|
||||||
|
|
||||||
loggerThread->start();
|
loggerThread->start();
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include "waitanimationwidget.h"
|
#include "waitanimationwidget.h"
|
||||||
#include "specialmessagebox.h"
|
#include "specialmessagebox.h"
|
||||||
|
|
||||||
|
#include "cficontroller.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ServerLMSWidget;
|
class ServerLMSWidget;
|
||||||
@@ -47,6 +49,7 @@ class MultiThreadServer;
|
|||||||
class AssetsManager;
|
class AssetsManager;
|
||||||
class ChatSystem;
|
class ChatSystem;
|
||||||
class DocsUpdater;
|
class DocsUpdater;
|
||||||
|
class CfiController;
|
||||||
|
|
||||||
class SERVERLMS_EXPORT ServerLMSWidget : public QWidget
|
class SERVERLMS_EXPORT ServerLMSWidget : public QWidget
|
||||||
{
|
{
|
||||||
@@ -176,7 +179,8 @@ private:
|
|||||||
ChatSystem *chatSystem;
|
ChatSystem *chatSystem;
|
||||||
|
|
||||||
DocsUpdater* docsUpdater;
|
DocsUpdater* docsUpdater;
|
||||||
ProviderDBLMS* providerDBLMS;
|
CfiController* cfiController;
|
||||||
|
ProviderDBLMS* providerDBLMS;
|
||||||
|
|
||||||
bool first = true; // для тестов Unity
|
bool first = true; // для тестов Unity
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibSe
|
|||||||
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibServer/multithreadserver)
|
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibServer/multithreadserver)
|
||||||
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibServer/providerdblms)
|
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibServer/providerdblms)
|
||||||
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibServer/Systems)
|
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibServer/Systems)
|
||||||
|
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibServer/cficontroller)
|
||||||
if(PROJECT_TYPE_DEBUG)
|
if(PROJECT_TYPE_DEBUG)
|
||||||
target_link_directories(ServerMTD PUBLIC ${REPO_PATH}/BUILDS/Debug64/LibServer)
|
target_link_directories(ServerMTD PUBLIC ${REPO_PATH}/BUILDS/Debug64/LibServer)
|
||||||
else()
|
else()
|
||||||
|
|||||||
Reference in New Issue
Block a user