mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Merge branch 'add-versionController' into merge-task-and-verController
# Conflicts: # InstructorsAndTrainees/CMakeLists.txt # InstructorsAndTrainees/connectorToServer/Core/recognizesystem.h # InstructorsAndTrainees/instructorsandtraineeswidget.cpp # ServerLMS/Systems/updatecontroller.cpp # ServerLMS/Systems/updatecontroller.h
This commit is contained in:
@@ -6,18 +6,19 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## backLog
|
## backLog
|
||||||
|
|
||||||
- [ ] выписать все варианты взаимодействия между всеми клиентами и сервером
|
- [ ] окошко с выбором перенести в GUI
|
||||||
- [ ] sendSystem::sendXmlAnswer новый вариант отпарвки XML пакетов
|
- [ ] Клиент НЕ СМОЖЕТ ВЫБИРАТЬ ВЕРСИИ
|
||||||
|
|
||||||
|
|
||||||
## bugs
|
## bugs
|
||||||
|
|
||||||
|
- [ ] При старт стопе не сканится шэред дата
|
||||||
|
|
||||||
|
|
||||||
## feature client Unity
|
## feature client Unity
|
||||||
|
|
||||||
- [ ] отправлять сигнал на пересчет хэша с саб частью
|
|
||||||
- [ ] Добавить обновление инструктора, если он перелогинился
|
- [ ] Добавить обновление инструктора, если он перелогинился
|
||||||
|
- [ ] убрать функционал смены версии с клиента
|
||||||
|
|
||||||
|
|
||||||
## feature client QT
|
## feature client QT
|
||||||
@@ -25,23 +26,32 @@ kanban-plugin: board
|
|||||||
- [ ] Иерархия проекта - папка application, папка updater и линк на основной экзешник
|
- [ ] Иерархия проекта - папка application, папка updater и линк на основной экзешник
|
||||||
- [ ] на старте все мониторы должны быть активны
|
- [ ] на старте все мониторы должны быть активны
|
||||||
- [ ] Нужен ли дополнительный выбор для загрузки с мат моделью или нет?
|
- [ ] Нужен ли дополнительный выбор для загрузки с мат моделью или нет?
|
||||||
- [ ] при создании копии переключение сервера и переключения клиента
|
|
||||||
|
|
||||||
|
|
||||||
## feature server
|
## feature server
|
||||||
|
|
||||||
- [ ] Прибраться в Server
|
|
||||||
- [ ] рефакторинг
|
|
||||||
- [ ] добавить генерацию пустых файлов, если shared не найден
|
- [ ] добавить генерацию пустых файлов, если shared не найден
|
||||||
|
- [ ] добавить подключение без DB
|
||||||
|
- [ ] ПЕРЕВЕСТИ все действия под операции и формировать процент из них
|
||||||
|
- [ ] блокировать выгрузку под инструктором, если режим версия base
|
||||||
|
|
||||||
|
|
||||||
## NOW
|
## NOW
|
||||||
|
|
||||||
- [ ] добавить автоматическое выключение после создания копии
|
- [ ] добавить информацию Авторе и изменяемая версия или нет
|
||||||
|
|
||||||
|
|
||||||
## Complete
|
## Complete
|
||||||
|
|
||||||
|
- [ ] отправлять сигнал на пересчет хэша с саб частью
|
||||||
|
- [ ] GUI server: при неподключенном сервере, отключать попытку изменить версию
|
||||||
|
- [ ] добавить автоматическое выключение после создания копии
|
||||||
|
- [ ] sendSystem::sendXmlAnswer новый вариант отпарвки XML пакетов
|
||||||
|
- [ ] выписать все варианты взаимодействия между всеми клиентами и сервером
|
||||||
|
- [ ] QT клиента: Не показывает блокировка, если версия удаляется
|
||||||
|
- [ ] рефакторинг
|
||||||
|
- [ ] Прибраться в Server
|
||||||
|
- [ ] не работает восстановление файлов
|
||||||
- [ ] запрет на удаление base
|
- [ ] запрет на удаление base
|
||||||
- [ ] None hash
|
- [ ] None hash
|
||||||
- [ ] сверстать окно создания новой версии
|
- [ ] сверстать окно создания новой версии
|
||||||
@@ -265,6 +275,12 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## BUGFIX Complete
|
## BUGFIX Complete
|
||||||
|
|
||||||
|
- [ ] при создании копии переключение сервера и переключения клиента
|
||||||
|
- [ ] QT сервер Найти причину двойного вызова проверки при логине инструктором
|
||||||
|
- [ ] QT клиент: device not open после прерывания загрузки
|
||||||
|
- [ ] QT сервер При изменении версии правильный списке с файлами прилетает со второго раза
|
||||||
|
- [ ] QT клиент, если обновление в режиме инструктора доступно, кнопку запуск отключать
|
||||||
|
- [ ] QT сервер замерзает после выхода пользователя во время скачивания
|
||||||
- [ ] Клиент QT выводить инфу если клиент не подключен
|
- [ ] Клиент QT выводить инфу если клиент не подключен
|
||||||
- [ ] Клиент QT не подключатся повторно, если соединение уже установлено
|
- [ ] Клиент QT не подключатся повторно, если соединение уже установлено
|
||||||
- [ ] Клиент QT Неправильное отображение количества загруженных файлов
|
- [ ] Клиент QT Неправильное отображение количества загруженных файлов
|
||||||
|
|||||||
@@ -29,4 +29,14 @@
|
|||||||
5. Обновление с клиента на сервер - ЕСТЬ
|
5. Обновление с клиента на сервер - ЕСТЬ
|
||||||
6. Проверка с перезапуском клиента - ХЭШ КОРРЕКТНЫЙ
|
6. Проверка с перезапуском клиента - ХЭШ КОРРЕКТНЫЙ
|
||||||
7. Восстановление версии с сервера на клиент
|
7. Восстановление версии с сервера на клиент
|
||||||
8. Проверка с перезапуском клиента
|
8. Проверка с перезапуском клиента
|
||||||
|
|
||||||
|
Работа с версиями
|
||||||
|
1. QT клиент: Копирование версии
|
||||||
|
2. QT клиент: Копирование версии с указанием существующего имени -> ошибка
|
||||||
|
3. QT клиент: Удаление версии
|
||||||
|
4. QT клиент: Удаление базовой версии -> ошибка
|
||||||
|
5. QT клиент: Удаление версии которая выбрана -> ошибка
|
||||||
|
6. QT клиент: переключении версии
|
||||||
|
7. Unity: отправка в базовую версию
|
||||||
|
8.
|
||||||
@@ -55,8 +55,12 @@ add_library(InstructorsAndTrainees SHARED
|
|||||||
connectorToServer/Core/tools.cpp
|
connectorToServer/Core/tools.cpp
|
||||||
connectorToServer/Core/tools.h
|
connectorToServer/Core/tools.h
|
||||||
connectorToServer/Core/FileData.h
|
connectorToServer/Core/FileData.h
|
||||||
|
connectorToServer/Core/notifycontroller.cpp
|
||||||
|
connectorToServer/Core/notifycontroller.h
|
||||||
|
connectorToServer/Core/versioncontainer.cpp
|
||||||
|
connectorToServer/Core/versioncontainer.h
|
||||||
connectorToServer/Datas.h
|
connectorToServer/Datas.h
|
||||||
|
connectorToServer/streamingversiondata.h
|
||||||
messanger/messangerwidget.cpp
|
messanger/messangerwidget.cpp
|
||||||
messanger/messangerwidget.h
|
messanger/messangerwidget.h
|
||||||
messanger/messangerwidget.ui
|
messanger/messangerwidget.ui
|
||||||
@@ -76,6 +80,15 @@ add_library(InstructorsAndTrainees SHARED
|
|||||||
tasks/fimtaskswidget.ui
|
tasks/fimtaskswidget.ui
|
||||||
tasks/tasksAmmFim.cpp
|
tasks/tasksAmmFim.cpp
|
||||||
tasks/tasksAmmFim.h
|
tasks/tasksAmmFim.h
|
||||||
|
widgets/newversionwidget.cpp
|
||||||
|
widgets/newversionwidget.h
|
||||||
|
widgets/newversionwidget.ui
|
||||||
|
widgets/versionselectwidget.cpp
|
||||||
|
widgets/versionselectwidget.h
|
||||||
|
widgets/versionselectwidget.ui
|
||||||
|
widgets/waitanimationwidget.cpp
|
||||||
|
widgets/waitanimationwidget.h
|
||||||
|
widgets/waitanimationwidget.ui
|
||||||
|
|
||||||
resources.qrc
|
resources.qrc
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "instructor.h"
|
#include "instructor.h"
|
||||||
#include "trainee.h"
|
#include "trainee.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
#include "streamingversiondata.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
@@ -327,7 +328,8 @@ ServerSettings *DataParser::getServerSettings()
|
|||||||
|
|
||||||
if(xmlReader.isStartElement()){
|
if(xmlReader.isStartElement()){
|
||||||
|
|
||||||
if(xmlReader.name() == "ServerSettings"){
|
if(xmlReader.name() == "ServerSettings")
|
||||||
|
{
|
||||||
|
|
||||||
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes()){
|
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes()){
|
||||||
QString name = attr.name().toString();
|
QString name = attr.name().toString();
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include "notifycontroller.h"
|
||||||
|
|
||||||
|
NotifyController::NotifyController(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotifyController::showWarning(QString text)
|
||||||
|
{
|
||||||
|
QMessageBox warning;
|
||||||
|
warning.setText(text);
|
||||||
|
|
||||||
|
warning.setIcon(QMessageBox::Warning);
|
||||||
|
warning.setWindowTitle(tr("Ошибка"));
|
||||||
|
warning.exec();
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef NOTIFYCONTROLLER_H
|
||||||
|
#define NOTIFYCONTROLLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
class NotifyController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit NotifyController(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
void showWarning(QString text);
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NOTIFYCONTROLLER_H
|
||||||
@@ -254,6 +254,17 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
|||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(packetType == PacketType::BUSY)
|
||||||
|
{
|
||||||
|
emit sigAnimationActivated(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(packetType == PacketType::FREE)
|
||||||
|
{
|
||||||
|
emit sigAnimationActivated(false);
|
||||||
|
}
|
||||||
|
|
||||||
//xml-ответы на запросы к БД
|
//xml-ответы на запросы к БД
|
||||||
switch(packetType)
|
switch(packetType)
|
||||||
{
|
{
|
||||||
@@ -350,6 +361,21 @@ void RecognizeSystem::xmlParser(QByteArray array)
|
|||||||
{
|
{
|
||||||
emit sigStartCompare();
|
emit sigStartCompare();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value == "BASEDELETETRY")
|
||||||
|
{
|
||||||
|
emit sigNotify(tr("Нельзя удалять базовую версию"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == "TRYACTIVEDELETE")
|
||||||
|
{
|
||||||
|
emit sigNotify(tr("Нельзя удалять активную версию"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == "DUPLICATEVERNAME")
|
||||||
|
{
|
||||||
|
emit sigNotify(tr("Такое имя уже существет"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,6 +453,75 @@ void RecognizeSystem::xmlParser(QByteArray array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit sigDeAuth(serverDeAuth);
|
emit sigDeAuth(serverDeAuth);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(xmlReader.name() == "VersionList")
|
||||||
|
{
|
||||||
|
QList<StreamingVersionData*> *serverStreamingVersionDataList = new QList<StreamingVersionData*>;
|
||||||
|
xmlReader.readNext();
|
||||||
|
|
||||||
|
while (!xmlReader.atEnd())
|
||||||
|
{
|
||||||
|
if(xmlReader.isStartElement())
|
||||||
|
{
|
||||||
|
if(xmlReader.name() == "VersionData")
|
||||||
|
{
|
||||||
|
StreamingVersionData *data = new StreamingVersionData;
|
||||||
|
|
||||||
|
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
|
||||||
|
{
|
||||||
|
QString name = attr.name().toString();
|
||||||
|
QString value = attr.value().toString();
|
||||||
|
|
||||||
|
if(name == "Version")
|
||||||
|
data->setName(value);
|
||||||
|
else if(name == "Created")
|
||||||
|
data->setCreateData(QDateTime::fromString(value));
|
||||||
|
else if(name == "isChangeable")
|
||||||
|
data->setIsChangeable(value.toInt());
|
||||||
|
else if(name == "author")
|
||||||
|
data->setAuthor(value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
serverStreamingVersionDataList->append(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlReader.readNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
emit sigShowServerDataList(serverStreamingVersionDataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xmlReader.name() == "VersionData")
|
||||||
|
{
|
||||||
|
StreamingVersionData *serverVersion = new StreamingVersionData;
|
||||||
|
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
|
||||||
|
{
|
||||||
|
QString name = attr.name().toString();
|
||||||
|
QString value = attr.value().toString();
|
||||||
|
|
||||||
|
if (name == "Version")
|
||||||
|
{
|
||||||
|
serverVersion->setName(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "Created")
|
||||||
|
{
|
||||||
|
serverVersion->setCreateData(QDateTime::fromString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "isChangeable")
|
||||||
|
{
|
||||||
|
serverVersion->setIsChangeable(value.toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
emit sigSetVersion(serverVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
|
#include <streamingVersionData.h>
|
||||||
//#include <mainwindow.h>
|
//#include <mainwindow.h>
|
||||||
#include <Core\tools.h>
|
#include <Core\tools.h>
|
||||||
#include "dataparser.h"
|
#include "dataparser.h"
|
||||||
@@ -48,9 +49,12 @@ signals:
|
|||||||
void sigAnswerQueryToDB_ListComputers(QList<Computer> listComputers);
|
void sigAnswerQueryToDB_ListComputers(QList<Computer> listComputers);
|
||||||
void sigAnswerQueryToDB_ListClassrooms(QList<Classroom> listClassrooms);
|
void sigAnswerQueryToDB_ListClassrooms(QList<Classroom> listClassrooms);
|
||||||
void sigAnswerQueryToDB_ListTasks(QList<Task> listTasks);
|
void sigAnswerQueryToDB_ListTasks(QList<Task> listTasks);
|
||||||
|
|
||||||
void sigAnswerQueryTasksXML_FIM(QByteArray array);
|
void sigAnswerQueryTasksXML_FIM(QByteArray array);
|
||||||
void sigAnswerQueryTasksXML_AMM(QByteArray array);
|
void sigAnswerQueryTasksXML_AMM(QByteArray array);
|
||||||
|
void sigShowServerDataList(QList<StreamingVersionData*> *versions);
|
||||||
|
void sigSetVersion(StreamingVersionData* serverVersion);
|
||||||
|
void sigNotify(QString text);
|
||||||
|
void sigAnimationActivated(bool flag);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QString> *folderList;
|
QList<QString> *folderList;
|
||||||
|
|||||||
@@ -129,6 +129,43 @@ void SendSystem::sendFinish()
|
|||||||
socket->waitForReadyRead(100);
|
socket->waitForReadyRead(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendSystem::sendChangeVersion(StreamingVersionData *streamingVersion)
|
||||||
|
{
|
||||||
|
QDataStream stream(socket);
|
||||||
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
stream << PacketType::CHANGE_DATA_VERSION;
|
||||||
|
stream << streamingVersion->getViewName();
|
||||||
|
|
||||||
|
socket->waitForReadyRead(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendSystem::sendDeleteVersion(StreamingVersionData *streamingVersion)
|
||||||
|
{
|
||||||
|
QDataStream stream(socket);
|
||||||
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
stream << PacketType::DELETE_DATA_VERSION;
|
||||||
|
stream << streamingVersion->getViewName();
|
||||||
|
|
||||||
|
socket->waitForReadyRead(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendSystem::sendCopyVersion(QString versionName)
|
||||||
|
{
|
||||||
|
QDataStream stream(socket);
|
||||||
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
stream << PacketType::COPY_VERSION;
|
||||||
|
|
||||||
|
stream << versionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendSystem::sendPacketType(PacketType packetType)
|
||||||
|
{
|
||||||
|
QDataStream stream(socket);
|
||||||
|
QByteArray data;
|
||||||
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
|
||||||
|
stream << packetType;
|
||||||
|
}
|
||||||
SendSystem::~SendSystem()
|
SendSystem::~SendSystem()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
|
||||||
|
#include <streamingVersionData.h>
|
||||||
|
#include "Core/tools.h"
|
||||||
|
|
||||||
class SendSystem :public QObject
|
class SendSystem :public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -19,6 +22,10 @@ public:
|
|||||||
void sendXMLAnswer(QByteArray array);
|
void sendXMLAnswer(QByteArray array);
|
||||||
~SendSystem();
|
~SendSystem();
|
||||||
void sendFinish();
|
void sendFinish();
|
||||||
|
void sendChangeVersion(StreamingVersionData *streamingVersion);
|
||||||
|
void sendDeleteVersion(StreamingVersionData *streamingVersion);
|
||||||
|
void sendCopyVersion(QString versionName);
|
||||||
|
void sendPacketType(PacketType packetType);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigSend();
|
void sigSend();
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ static QString displayTemp = staticDataFolderName + "/displayData.xml";
|
|||||||
static QString streamingHashFilename = staticDataFolderName + "/streamingHash.xml";
|
static QString streamingHashFilename = staticDataFolderName + "/streamingHash.xml";
|
||||||
static QString serverHash = staticDataFolderName + "/serverHash.xml";
|
static QString serverHash = staticDataFolderName + "/serverHash.xml";
|
||||||
|
|
||||||
|
static QString cmd_CheckVersionList = "CHECKVERSIONLIST";
|
||||||
|
|
||||||
enum PacketType{
|
enum PacketType{
|
||||||
TYPE_NONE = 0,
|
TYPE_NONE = 0,
|
||||||
TYPE_UNITY = 1,
|
TYPE_UNITY = 1,
|
||||||
@@ -31,6 +33,7 @@ enum PacketType{
|
|||||||
TYPE_XMLANSWER = 8,
|
TYPE_XMLANSWER = 8,
|
||||||
TYPE_QT = 9,
|
TYPE_QT = 9,
|
||||||
TYPE_DISABLE = 11,
|
TYPE_DISABLE = 11,
|
||||||
|
TYPE_CHECKVERSION = 13,
|
||||||
|
|
||||||
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
||||||
|
|
||||||
@@ -44,7 +47,14 @@ enum PacketType{
|
|||||||
|
|
||||||
//xml-ответы на запросы AdditionalFiles
|
//xml-ответы на запросы AdditionalFiles
|
||||||
TYPE_XMLANSWER_QUERY_TASKS_XML_FIM = 130,
|
TYPE_XMLANSWER_QUERY_TASKS_XML_FIM = 130,
|
||||||
TYPE_XMLANSWER_QUERY_TASKS_XML_AMM = 131
|
TYPE_XMLANSWER_QUERY_TASKS_XML_AMM = 131,
|
||||||
|
|
||||||
|
HASH_READY = 150,
|
||||||
|
CHANGE_DATA_VERSION = 151,
|
||||||
|
COPY_VERSION = 152,
|
||||||
|
DELETE_DATA_VERSION = 153,
|
||||||
|
BUSY = 154,
|
||||||
|
FREE = 155
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(PacketType)
|
Q_DECLARE_METATYPE(PacketType)
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#include "versioncontainer.h"
|
||||||
|
|
||||||
|
VersionContainer::VersionContainer(QObject *parent) :
|
||||||
|
QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VersionContainer::~VersionContainer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VersionContainer::getServerVersion() const
|
||||||
|
{
|
||||||
|
return serverVersionData->getViewName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VersionContainer::getLocalVersion() const
|
||||||
|
{
|
||||||
|
return localVersionData->getViewName();
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingVersionData *VersionContainer::getLocalVersionData() const
|
||||||
|
{
|
||||||
|
return localVersionData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionContainer::setLocalVersionData(StreamingVersionData *value)
|
||||||
|
{
|
||||||
|
localVersionData = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingVersionData *VersionContainer::getServerVersionData() const
|
||||||
|
{
|
||||||
|
return serverVersionData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionContainer::setServerVersionData(StreamingVersionData *value)
|
||||||
|
{
|
||||||
|
serverVersionData = value;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef VERSIONCONTAINER_H
|
||||||
|
#define VERSIONCONTAINER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "connectorToServer/streamingversiondata.h"
|
||||||
|
|
||||||
|
class VersionContainer : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit VersionContainer(QObject *parent = nullptr);
|
||||||
|
~VersionContainer();
|
||||||
|
|
||||||
|
QString getServerVersion() const;
|
||||||
|
QString getLocalVersion() const;
|
||||||
|
|
||||||
|
|
||||||
|
StreamingVersionData *getLocalVersionData() const;
|
||||||
|
void setLocalVersionData(StreamingVersionData *value);
|
||||||
|
|
||||||
|
StreamingVersionData *getServerVersionData() const;
|
||||||
|
void setServerVersionData(StreamingVersionData *value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
StreamingVersionData *localVersionData;
|
||||||
|
StreamingVersionData *serverVersionData;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VERSIONCONTAINER_H
|
||||||
@@ -7,7 +7,11 @@ ConnectorToServer::ConnectorToServer(QObject *parent) :
|
|||||||
client(nullptr),
|
client(nullptr),
|
||||||
dataParser(nullptr),
|
dataParser(nullptr),
|
||||||
sendSystem(nullptr),
|
sendSystem(nullptr),
|
||||||
recognizeSystem(nullptr)
|
recognizeSystem(nullptr),
|
||||||
|
versionSelectWidget(nullptr),
|
||||||
|
versionContainer(nullptr),
|
||||||
|
notifyController(nullptr),
|
||||||
|
waitAnimationWidget(nullptr)
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
@@ -93,9 +97,15 @@ bool ConnectorToServer::sendQueryTasksXML(QString type)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnectorToServer::setLoginName(QString name)
|
||||||
|
{
|
||||||
|
versionSelectWidget->setAuthor(name);
|
||||||
|
}
|
||||||
|
|
||||||
void ConnectorToServer::SetConnectToServer()
|
void ConnectorToServer::SetConnectToServer()
|
||||||
{
|
{
|
||||||
emit sigSetConnect(dataParser->getServerSettings(),connectionThread);
|
emit sigSetConnect(dataParser->getServerSettings(),connectionThread);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray ConnectorToServer::getListTaskFimArray()
|
QByteArray ConnectorToServer::getListTaskFimArray()
|
||||||
@@ -249,6 +259,12 @@ int ConnectorToServer::getIdTraineeByLogin(QString login)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnectorToServer::showVersionSelect()
|
||||||
|
{
|
||||||
|
QByteArray answer = dataParser->xmlAnswer_notify(cmd_CheckVersionList);
|
||||||
|
emit sigSendAnswerToServer(answer);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void ConnectorToServer::slot_AnswerQueryToDB(QList<Instructor>* listInstructors,
|
void ConnectorToServer::slot_AnswerQueryToDB(QList<Instructor>* listInstructors,
|
||||||
QList<Trainee>* listTrainees,
|
QList<Trainee>* listTrainees,
|
||||||
@@ -316,6 +332,11 @@ void ConnectorToServer::slot_msgToClientReady(QString login, QString text)
|
|||||||
sendMessageForClient(id, login, text);
|
sendMessageForClient(id, login, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnectorToServer::showServerList(QList<StreamingVersionData *> *serverList)
|
||||||
|
{
|
||||||
|
versionSelectWidget->fillView(serverList);
|
||||||
|
}
|
||||||
|
|
||||||
void ConnectorToServer::initialize()
|
void ConnectorToServer::initialize()
|
||||||
{
|
{
|
||||||
createObjects();
|
createObjects();
|
||||||
@@ -325,6 +346,22 @@ void ConnectorToServer::initialize()
|
|||||||
emit sigInitializeClient(recognizeSystem,sendSystem,connectionThread);
|
emit sigInitializeClient(recognizeSystem,sendSystem,connectionThread);
|
||||||
|
|
||||||
emit sigSetConnect(dataParser->getServerSettings(),connectionThread);
|
emit sigSetConnect(dataParser->getServerSettings(),connectionThread);
|
||||||
|
|
||||||
|
// QByteArray answer = dataParser->xmlAnswer_notify()
|
||||||
|
// sendSystem->sendXMLAnswer()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectorToServer::activateLoadAnimation(bool flag)
|
||||||
|
{
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
waitAnimationWidget->showWithPlay();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
waitAnimationWidget->hideWithStop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectorToServer::bindConnection()
|
void ConnectorToServer::bindConnection()
|
||||||
@@ -332,10 +369,13 @@ void ConnectorToServer::bindConnection()
|
|||||||
connect(this,&ConnectorToServer::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
connect(this,&ConnectorToServer::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
||||||
connect(this,&ConnectorToServer::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
connect(this,&ConnectorToServer::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
||||||
connect(this,&ConnectorToServer::signal_sendXMLmsgGUItoServer,sendSystem,&SendSystem::sendXMLmsgGUItoServer);
|
connect(this,&ConnectorToServer::signal_sendXMLmsgGUItoServer,sendSystem,&SendSystem::sendXMLmsgGUItoServer);
|
||||||
|
connect(this,&ConnectorToServer::sigSendAnswerToServer,sendSystem,&SendSystem::sendXMLAnswer,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigAuth,this,&ConnectorToServer::sigLoginResult);
|
connect(recognizeSystem,&RecognizeSystem::sigAuth,this,&ConnectorToServer::sigLoginResult);
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigDeAuth,this,&ConnectorToServer::sigDeLoginResult);
|
connect(recognizeSystem,&RecognizeSystem::sigDeAuth,this,&ConnectorToServer::sigDeLoginResult);
|
||||||
connect(recognizeSystem,&RecognizeSystem::signal_MessageForGUI,this,&ConnectorToServer::signal_msgFromClientReady);
|
connect(recognizeSystem,&RecognizeSystem::signal_MessageForGUI,this,&ConnectorToServer::signal_msgFromClientReady);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigShowServerDataList,this,&ConnectorToServer::showServerList);
|
||||||
|
connect (recognizeSystem,&RecognizeSystem::sigSetVersion,versionContainer,&VersionContainer::setServerVersionData);
|
||||||
//connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB,this,&ConnectorToServer::slot_AnswerQueryToDB);
|
//connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB,this,&ConnectorToServer::slot_AnswerQueryToDB);
|
||||||
|
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListInstructors,this,&ConnectorToServer::slot_AnswerQueryToDB_ListInstructors);
|
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListInstructors,this,&ConnectorToServer::slot_AnswerQueryToDB_ListInstructors);
|
||||||
@@ -347,8 +387,11 @@ void ConnectorToServer::bindConnection()
|
|||||||
|
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryTasksXML_FIM,this,&ConnectorToServer::slot_AnswerQueryTasksXML_FIM);
|
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryTasksXML_FIM,this,&ConnectorToServer::slot_AnswerQueryTasksXML_FIM);
|
||||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryTasksXML_AMM,this,&ConnectorToServer::slot_AnswerQueryTasksXML_AMM);
|
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryTasksXML_AMM,this,&ConnectorToServer::slot_AnswerQueryTasksXML_AMM);
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,this,&ConnectorToServer::activateLoadAnimation,Qt::AutoConnection);
|
||||||
|
|
||||||
connect(client,&TCPClient::signal_ConnectedToServer,this,&ConnectorToServer::signal_ConnectedToServer);
|
connect(client,&TCPClient::signal_ConnectedToServer,this,&ConnectorToServer::signal_ConnectedToServer,Qt::AutoConnection);
|
||||||
|
|
||||||
|
connect(recognizeSystem,&RecognizeSystem::sigNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectorToServer::createObjects()
|
void ConnectorToServer::createObjects()
|
||||||
@@ -360,12 +403,25 @@ void ConnectorToServer::createObjects()
|
|||||||
|
|
||||||
dataParser = new DataParser;
|
dataParser = new DataParser;
|
||||||
|
|
||||||
|
waitAnimationWidget = new WaitAnimationWidget;
|
||||||
|
|
||||||
sendSystem = new SendSystem;
|
sendSystem = new SendSystem;
|
||||||
sendSystem->moveToThread(connectionThread);
|
sendSystem->moveToThread(connectionThread);
|
||||||
|
|
||||||
recognizeSystem = new RecognizeSystem;
|
recognizeSystem = new RecognizeSystem;
|
||||||
recognizeSystem->moveToThread(connectionThread);
|
recognizeSystem->moveToThread(connectionThread);
|
||||||
|
|
||||||
|
notifyController = new NotifyController;
|
||||||
|
versionContainer = new VersionContainer;
|
||||||
|
versionSelectWidget = new VersionSelectWidget;
|
||||||
|
versionSelectWidget->initialize(sendSystem,versionContainer,notifyController);
|
||||||
|
|
||||||
|
QMovie *movie = new QMovie(":/resources/icons/762.gif");
|
||||||
|
|
||||||
|
waitAnimationWidget->setParent(versionSelectWidget);
|
||||||
|
waitAnimationWidget->initialize(movie,versionSelectWidget);
|
||||||
|
waitAnimationWidget->moveToThread(connectionThread);
|
||||||
|
|
||||||
connectionThread->start();
|
connectionThread->start();
|
||||||
connectionThread->setPriority(QThread::HighestPriority);
|
connectionThread->setPriority(QThread::HighestPriority);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#define CONNECTORTOSERVER_H
|
#define CONNECTORTOSERVER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <widgets/versionselectwidget.h>
|
||||||
|
#include <widgets/waitanimationwidget.h>
|
||||||
#include "Core\tcpclient.h"
|
#include "Core\tcpclient.h"
|
||||||
#include "Core\dataparser.h"
|
#include "Core\dataparser.h"
|
||||||
#include "Core\sendsystem.h"
|
#include "Core\sendsystem.h"
|
||||||
@@ -12,6 +14,7 @@
|
|||||||
#include "computer.h"
|
#include "computer.h"
|
||||||
#include "classroom.h"
|
#include "classroom.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
#include "streamingversiondata.h"
|
||||||
|
|
||||||
class ConnectorToServer : public QObject
|
class ConnectorToServer : public QObject
|
||||||
{
|
{
|
||||||
@@ -54,7 +57,10 @@ public:
|
|||||||
Group getGroup(int id);
|
Group getGroup(int id);
|
||||||
|
|
||||||
int getIdTraineeByLogin(QString login);
|
int getIdTraineeByLogin(QString login);
|
||||||
|
void showVersionSelect();
|
||||||
|
|
||||||
|
void activateLoadAnimation(bool flag);
|
||||||
|
void setLoginName(QString name);
|
||||||
public slots:
|
public slots:
|
||||||
/*void slot_AnswerQueryToDB(QList<Instructor>* listInstructors,
|
/*void slot_AnswerQueryToDB(QList<Instructor>* listInstructors,
|
||||||
QList<Trainee>* listTrainees,
|
QList<Trainee>* listTrainees,
|
||||||
@@ -71,6 +77,7 @@ public slots:
|
|||||||
void slot_AnswerQueryTasksXML_AMM(QByteArray array);
|
void slot_AnswerQueryTasksXML_AMM(QByteArray array);
|
||||||
|
|
||||||
void slot_msgToClientReady(QString login, QString text);
|
void slot_msgToClientReady(QString login, QString text);
|
||||||
|
void showServerList(QList<StreamingVersionData*> *serverList);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
|
void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
|
||||||
@@ -93,6 +100,7 @@ signals:
|
|||||||
void signal_InitMessanger(QList<Trainee> listTrainees);
|
void signal_InitMessanger(QList<Trainee> listTrainees);
|
||||||
|
|
||||||
void signal_msgFromClientReady(QString login, QString text);
|
void signal_msgFromClientReady(QString login, QString text);
|
||||||
|
void sigSendAnswerToServer(QByteArray array);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -106,6 +114,10 @@ private:
|
|||||||
DataParser *dataParser;
|
DataParser *dataParser;
|
||||||
SendSystem *sendSystem;
|
SendSystem *sendSystem;
|
||||||
RecognizeSystem *recognizeSystem;
|
RecognizeSystem *recognizeSystem;
|
||||||
|
VersionSelectWidget *versionSelectWidget;
|
||||||
|
VersionContainer *versionContainer;
|
||||||
|
NotifyController *notifyController;
|
||||||
|
WaitAnimationWidget *waitAnimationWidget;
|
||||||
|
|
||||||
//Списочная модель БД СУО
|
//Списочная модель БД СУО
|
||||||
QList<Instructor> listInstructors;
|
QList<Instructor> listInstructors;
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
#ifndef STREAMINGVERSIONDATA_H
|
||||||
|
#define STREAMINGVERSIONDATA_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <qdatetime.h>
|
||||||
|
|
||||||
|
class StreamingVersionData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
StreamingVersionData(){}
|
||||||
|
|
||||||
|
StreamingVersionData(QString absoltePath,QString viewName,QDateTime data,qint32 size)
|
||||||
|
{
|
||||||
|
this->absolutePath = absoltePath;
|
||||||
|
this->viewName = viewName;
|
||||||
|
this->createData = data;
|
||||||
|
this->size = size;
|
||||||
|
this->author = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void setName(QString viewName)
|
||||||
|
{
|
||||||
|
this->viewName = viewName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCreateData(QDateTime data)
|
||||||
|
{
|
||||||
|
this->createData = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
~StreamingVersionData();
|
||||||
|
|
||||||
|
QString getAbsolutPath() const
|
||||||
|
{
|
||||||
|
return absolutePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getViewName() const
|
||||||
|
{
|
||||||
|
return viewName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDateTime getCreateData() const
|
||||||
|
{
|
||||||
|
return createData;
|
||||||
|
}
|
||||||
|
|
||||||
|
qint32 getSize() const
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getIsChangeable() const
|
||||||
|
{
|
||||||
|
return isChangeable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setIsChangeable(bool value)
|
||||||
|
{
|
||||||
|
isChangeable = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getAuthor() const
|
||||||
|
{
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAuthor(const QString &value)
|
||||||
|
{
|
||||||
|
author = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString absolutePath;
|
||||||
|
QString viewName;
|
||||||
|
QString author;
|
||||||
|
QDateTime createData;
|
||||||
|
bool isChangeable;
|
||||||
|
qint32 size;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STREAMINGVERSIONDATA_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
|||||||
ui->verticalLayout_1->addWidget(viewerInstructors);
|
ui->verticalLayout_1->addWidget(viewerInstructors);
|
||||||
ui->verticalLayout_2->addWidget(ammTasksWidget);
|
ui->verticalLayout_2->addWidget(ammTasksWidget);
|
||||||
ui->verticalLayout_2->addWidget(fimTasksWidget);
|
ui->verticalLayout_2->addWidget(fimTasksWidget);
|
||||||
|
ui->btnSetVersion->hide();
|
||||||
viewerTrainees->setMinimumHeight(800);
|
viewerTrainees->setMinimumHeight(800);
|
||||||
viewerInstructors->setMinimumSize(1800, 300);
|
viewerInstructors->setMinimumSize(1800, 300);
|
||||||
messangerWidget->setMinimumSize(500, 600);
|
messangerWidget->setMinimumSize(500, 600);
|
||||||
@@ -166,11 +166,11 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA
|
|||||||
viewerTrainees->setAuthComplited(true);
|
viewerTrainees->setAuthComplited(true);
|
||||||
|
|
||||||
Q_EMIT signal_NeedUpdateUI(true, true);
|
Q_EMIT signal_NeedUpdateUI(true, true);
|
||||||
|
ui->btnSetVersion->show();
|
||||||
ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor"));
|
ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor"));
|
||||||
|
|
||||||
updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName);
|
updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName);
|
||||||
|
connectorToServer->setLoginName(loginInstructorLoggedInLocal);
|
||||||
QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!"));
|
QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -196,7 +196,6 @@ void InstructorsAndTraineesWidget::checkDeLoginResult(ServerDeAuthorization *ser
|
|||||||
Q_EMIT signal_NeedUpdateUI(true, false);
|
Q_EMIT signal_NeedUpdateUI(true, false);
|
||||||
|
|
||||||
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
|
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
|
||||||
|
|
||||||
updateLabelLoggedInInstructor("","");
|
updateLabelLoggedInInstructor("","");
|
||||||
|
|
||||||
QMessageBox::information(this, tr("Instructor deauthorization"), tr("Successfully!"));
|
QMessageBox::information(this, tr("Instructor deauthorization"), tr("Successfully!"));
|
||||||
@@ -221,7 +220,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
|
|||||||
{//Сервер отключен
|
{//Сервер отключен
|
||||||
ui->btnConnectionToServer->setEnabled(true);
|
ui->btnConnectionToServer->setEnabled(true);
|
||||||
ui->btnAuthorizationInstructor->setEnabled(false);
|
ui->btnAuthorizationInstructor->setEnabled(false);
|
||||||
|
ui->btnSetVersion->hide();
|
||||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,3 +320,8 @@ void InstructorsAndTraineesWidget::on_btnUpdateStyleSheet_clicked()
|
|||||||
{
|
{
|
||||||
updateMyStyleSheet();
|
updateMyStyleSheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InstructorsAndTraineesWidget::on_btnSetVersion_clicked()
|
||||||
|
{
|
||||||
|
connectorToServer->showVersionSelect();
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ private Q_SLOTS:
|
|||||||
void on_btnAuthorizationInstructor_clicked();
|
void on_btnAuthorizationInstructor_clicked();
|
||||||
void on_btnUpdateStyleSheet_clicked();
|
void on_btnUpdateStyleSheet_clicked();
|
||||||
|
|
||||||
|
void on_btnSetVersion_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//Авторизация инструктора локальная
|
//Авторизация инструктора локальная
|
||||||
bool authorizationInstructorDialog(QWidget* parent = nullptr);
|
bool authorizationInstructorDialog(QWidget* parent = nullptr);
|
||||||
|
|||||||
@@ -203,6 +203,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnSetVersion">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>58</width>
|
||||||
|
<height>58</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>ChangeVersion</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="btnUpdateStyleSheet">
|
<widget class="QToolButton" name="btnUpdateStyleSheet">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
|||||||
@@ -40,5 +40,6 @@
|
|||||||
<file>resources/icons/task.png</file>
|
<file>resources/icons/task.png</file>
|
||||||
<file>resources/icons/procedure.png</file>
|
<file>resources/icons/procedure.png</file>
|
||||||
<file>resources/icons/malfunction.png</file>
|
<file>resources/icons/malfunction.png</file>
|
||||||
|
<file>resources/icons/762.gif</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
BIN
InstructorsAndTrainees/resources/icons/762.gif
Normal file
BIN
InstructorsAndTrainees/resources/icons/762.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
37
InstructorsAndTrainees/widgets/newversionwidget.cpp
Normal file
37
InstructorsAndTrainees/widgets/newversionwidget.cpp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include "newversionwidget.h"
|
||||||
|
#include "ui_newversionwidget.h"
|
||||||
|
|
||||||
|
NewVersionWidget::NewVersionWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::NewVersionWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowFlags(Qt::SubWindow);
|
||||||
|
setAttribute(Qt::WA_ShowModal,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewVersionWidget::initialize(VersionSelectWidget *versionSelectWidget, QString prevName)
|
||||||
|
{
|
||||||
|
this->versionSelectWidget = versionSelectWidget;
|
||||||
|
ui->prevVerValue->setText(prevName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NewVersionWidget::on_createButton_clicked()
|
||||||
|
{
|
||||||
|
if(ui->lineEdit->text() != "")
|
||||||
|
{
|
||||||
|
versionSelectWidget->sendCopyEmit(ui->lineEdit->text());
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewVersionWidget::on_cancelButton_clicked()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
NewVersionWidget::~NewVersionWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
31
InstructorsAndTrainees/widgets/newversionwidget.h
Normal file
31
InstructorsAndTrainees/widgets/newversionwidget.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef NEWVERSIONWIDGET_H
|
||||||
|
#define NEWVERSIONWIDGET_H
|
||||||
|
|
||||||
|
#include <Widgets/versionselectwidget.h>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class NewVersionWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VersionSelectWidget;
|
||||||
|
class NewVersionWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit NewVersionWidget(QWidget *parent = nullptr);
|
||||||
|
void initialize(VersionSelectWidget *versionSelectWidget,QString prevName);
|
||||||
|
~NewVersionWidget();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_createButton_clicked();
|
||||||
|
|
||||||
|
void on_cancelButton_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::NewVersionWidget *ui;
|
||||||
|
VersionSelectWidget *versionSelectWidget;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NEWVERSIONWIDGET_H
|
||||||
219
InstructorsAndTrainees/widgets/newversionwidget.ui
Normal file
219
InstructorsAndTrainees/widgets/newversionwidget.ui
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>NewVersionWidget</class>
|
||||||
|
<widget class="QWidget" name="NewVersionWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>325</width>
|
||||||
|
<height>200</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Создать копию...</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="NewVerBackground">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="baseVerLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="prevVerTitle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Базовая версия:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="prevVerValue">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="newNameLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="newNameVersionTitle">
|
||||||
|
<property name="text">
|
||||||
|
<string>Новое название:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="createButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Создать</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cancelButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Отмена</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
118
InstructorsAndTrainees/widgets/versionselectwidget.cpp
Normal file
118
InstructorsAndTrainees/widgets/versionselectwidget.cpp
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
#include "versionselectwidget.h"
|
||||||
|
#include "ui_versionselectwidget.h"
|
||||||
|
#include "ui_versionselectwidget.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
VersionSelectWidget::VersionSelectWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::VersionSelectWidget),
|
||||||
|
selectedVersion(nullptr)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
||||||
|
setAttribute(Qt::WA_ShowModal,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionSelectWidget::initialize(SendSystem *sendSystem,VersionContainer *versionContainer,NotifyController *notifyController)
|
||||||
|
{
|
||||||
|
connect(this,&VersionSelectWidget::sigSendSwitchVersion,sendSystem,&SendSystem::sendChangeVersion,Qt::AutoConnection);
|
||||||
|
connect(this,&VersionSelectWidget::sigSendCopyVersion,sendSystem,&SendSystem::sendCopyVersion,Qt::AutoConnection);
|
||||||
|
connect(this,&VersionSelectWidget::sigSendDeleteVersion,sendSystem,&SendSystem::sendDeleteVersion,Qt::AutoConnection);
|
||||||
|
connect(this,&VersionSelectWidget::sigSendNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);
|
||||||
|
this->versionContainer = versionContainer;
|
||||||
|
hide();
|
||||||
|
setWindowTitle(tr("Управление версиями"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionSelectWidget::fillView(QList<StreamingVersionData *> *serverData)
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
ui->verListView->clear();
|
||||||
|
serverDataList = serverData;
|
||||||
|
ui->verValue->setText(versionContainer->getServerVersionData()->getViewName());
|
||||||
|
|
||||||
|
foreach(StreamingVersionData *data,*serverData)
|
||||||
|
{
|
||||||
|
ui->verListView->addItem(data->getViewName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionSelectWidget::on_verListView_itemDoubleClicked(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
foreach(StreamingVersionData *data,*serverDataList)
|
||||||
|
{
|
||||||
|
if(data->getViewName() == item->text())
|
||||||
|
{
|
||||||
|
QString info = "Имя версии: " + data->getViewName() + "\n";
|
||||||
|
info.append("Создан: " + data->getCreateData().toString() + "\n");
|
||||||
|
info.append("Изменяемый: " + changableText(data->getIsChangeable()) + "\n");
|
||||||
|
info.append("Автор: " + data->getAuthor());
|
||||||
|
ui->infoValue->setText(info);
|
||||||
|
selectedVersion = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString VersionSelectWidget::changableText(bool flag)
|
||||||
|
{
|
||||||
|
if(flag) return tr("Да");
|
||||||
|
else return tr("Нет");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VersionSelectWidget::on_createDuplicateButton_clicked()
|
||||||
|
{
|
||||||
|
NewVersionWidget *newVersionWidget = new NewVersionWidget;
|
||||||
|
newVersionWidget->initialize(this,selectedVersion->getViewName());
|
||||||
|
newVersionWidget->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionSelectWidget::sendCopyEmit(QString newName)
|
||||||
|
{
|
||||||
|
QString result = selectedVersion->getViewName() + ";" + newName + ";" + authorName;
|
||||||
|
|
||||||
|
if (selectedVersion == nullptr)
|
||||||
|
{
|
||||||
|
sigSendNotify(tr("Версия не выбрана"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//versionContainer->setLocalVersionData(selectedVersion);
|
||||||
|
emit sigSendCopyVersion(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionSelectWidget::on_DeleteVersionButton_clicked()
|
||||||
|
{
|
||||||
|
if (selectedVersion == nullptr)
|
||||||
|
{
|
||||||
|
sigSendNotify(tr("Версия не выбрана"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit sigSendDeleteVersion(selectedVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionSelectWidget::on_switchServerVersionButton_clicked()
|
||||||
|
{
|
||||||
|
if (selectedVersion == nullptr)
|
||||||
|
{
|
||||||
|
sigSendNotify(tr("Версия не выбрана"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
versionContainer->setServerVersionData(selectedVersion);
|
||||||
|
ui->verValue->setText(selectedVersion->getViewName());
|
||||||
|
emit sigSendSwitchVersion(selectedVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionSelectWidget::setAuthor(QString name)
|
||||||
|
{
|
||||||
|
authorName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
VersionSelectWidget::~VersionSelectWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
54
InstructorsAndTrainees/widgets/versionselectwidget.h
Normal file
54
InstructorsAndTrainees/widgets/versionselectwidget.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#ifndef VERSIONSELECTWIDGET_H
|
||||||
|
#define VERSIONSELECTWIDGET_H
|
||||||
|
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <Core/sendsystem.h>
|
||||||
|
#include <Core/versioncontainer.h>
|
||||||
|
#include <Core/notifycontroller.h>
|
||||||
|
#include <streamingversiondata.h>
|
||||||
|
#include <Widgets/newversionwidget.h>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class VersionSelectWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VersionSelectWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit VersionSelectWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
void initialize(SendSystem *sendSystem,VersionContainer *versionContainer,NotifyController *notifyController);
|
||||||
|
void fillView(QList<StreamingVersionData*> *serverData);
|
||||||
|
void sendCopyEmit(QString newName);
|
||||||
|
void setAuthor(QString name);
|
||||||
|
|
||||||
|
~VersionSelectWidget();
|
||||||
|
private slots:
|
||||||
|
void on_verListView_itemDoubleClicked(QListWidgetItem *item);
|
||||||
|
void on_createDuplicateButton_clicked();
|
||||||
|
void on_DeleteVersionButton_clicked();
|
||||||
|
void on_switchServerVersionButton_clicked();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigSendDeleteVersion(StreamingVersionData *streaming);
|
||||||
|
void sigSendSwitchVersion(StreamingVersionData *selectVersion);
|
||||||
|
void sigSendCopyVersion(QString versionPair);
|
||||||
|
void sigSendNotify(QString message);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::VersionSelectWidget *ui;
|
||||||
|
SendSystem *sendSystem;
|
||||||
|
QList<StreamingVersionData*> *serverDataList;
|
||||||
|
VersionContainer *versionContainer;
|
||||||
|
NotifyController *notifyController;
|
||||||
|
StreamingVersionData *selectedVersion;
|
||||||
|
|
||||||
|
QString authorName;
|
||||||
|
QString changableText(bool flag);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VERSIONSELECTWIDGET_H
|
||||||
239
InstructorsAndTrainees/widgets/versionselectwidget.ui
Normal file
239
InstructorsAndTrainees/widgets/versionselectwidget.ui
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>VersionSelectWidget</class>
|
||||||
|
<widget class="QWidget" name="VersionSelectWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>606</width>
|
||||||
|
<height>229</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>301</width>
|
||||||
|
<height>171</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="actualServerListLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="verListTitle">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::PreventContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Доступные версии на сервере</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="verListView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>601</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="ButtonLayout" stretch="0,0">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="createDuplicateButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Создать копию</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="DeleteVersionButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Удалить</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="switchServerVersionButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Переключить версию сервера</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>310</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>291</width>
|
||||||
|
<height>131</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="infoViewTitle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Информация:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="infoValue">
|
||||||
|
<property name="text">
|
||||||
|
<string>Тут будет информация о версии...</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>310</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>291</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="ServerInfoLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="verTitle">
|
||||||
|
<property name="text">
|
||||||
|
<string>Текущая версия сервера:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="verValue">
|
||||||
|
<property name="text">
|
||||||
|
<string>none</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
35
InstructorsAndTrainees/widgets/waitanimationwidget.cpp
Normal file
35
InstructorsAndTrainees/widgets/waitanimationwidget.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#include "waitanimationwidget.h"
|
||||||
|
#include "ui_waitanimationwidget.h"
|
||||||
|
|
||||||
|
WaitAnimationWidget::WaitAnimationWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::WaitAnimationWidget),
|
||||||
|
loadingMovie(nullptr)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaitAnimationWidget::initialize(QMovie *movie,QWidget *parent)
|
||||||
|
{
|
||||||
|
ui->MovieLabel->setMovie(movie);
|
||||||
|
loadingMovie = movie;
|
||||||
|
setFixedSize(parent->width(),parent->height());
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaitAnimationWidget::showWithPlay()
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
loadingMovie->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaitAnimationWidget::hideWithStop()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
loadingMovie->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
WaitAnimationWidget::~WaitAnimationWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
27
InstructorsAndTrainees/widgets/waitanimationwidget.h
Normal file
27
InstructorsAndTrainees/widgets/waitanimationwidget.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef WAITANIMATIONWIDGET_H
|
||||||
|
#define WAITANIMATIONWIDGET_H
|
||||||
|
|
||||||
|
#include <QMovie>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class WaitAnimationWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class WaitAnimationWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit WaitAnimationWidget(QWidget *parent = nullptr);
|
||||||
|
void initialize(QMovie *movie,QWidget *parent);
|
||||||
|
void showWithPlay();
|
||||||
|
void hideWithStop();
|
||||||
|
~WaitAnimationWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::WaitAnimationWidget *ui;
|
||||||
|
QMovie *loadingMovie;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WAITANIMATIONWIDGET_H
|
||||||
73
InstructorsAndTrainees/widgets/waitanimationwidget.ui
Normal file
73
InstructorsAndTrainees/widgets/waitanimationwidget.ui
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>WaitAnimationWidget</class>
|
||||||
|
<widget class="QWidget" name="WaitAnimationWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>635</width>
|
||||||
|
<height>293</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color:rgba(0,0,0,50%);</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="mainLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="MovieLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color:rgba(0,0,0,50%)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../resources.qrc">:/resources/icons/762.gif</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../resources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -14,6 +14,8 @@ enum PacketType
|
|||||||
TYPE_XMLANSWER = 8,
|
TYPE_XMLANSWER = 8,
|
||||||
TYPE_QT = 9,
|
TYPE_QT = 9,
|
||||||
TYPE_DISABLE = 11,
|
TYPE_DISABLE = 11,
|
||||||
|
TYPE_UPDATE = 12,
|
||||||
|
TYPE_CHECK_VERSION = 13,
|
||||||
TYPE_FILESIZE = 20,
|
TYPE_FILESIZE = 20,
|
||||||
|
|
||||||
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ public:
|
|||||||
this->viewName = viewName;
|
this->viewName = viewName;
|
||||||
this->createData = data;
|
this->createData = data;
|
||||||
this->size = size;
|
this->size = size;
|
||||||
|
this->isChangeable = true;
|
||||||
|
this->author = "";
|
||||||
}
|
}
|
||||||
|
StreamingVersionData(){};
|
||||||
|
|
||||||
~StreamingVersionData();
|
~StreamingVersionData();
|
||||||
|
|
||||||
QString getAbsolutPath() const
|
QString getAbsolutPath() const
|
||||||
@@ -36,11 +40,55 @@ public:
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getIsChangeable() const
|
||||||
|
{
|
||||||
|
return isChangeable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setIsChangeable(bool value)
|
||||||
|
{
|
||||||
|
isChangeable = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getAuthor() const
|
||||||
|
{
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAuthor(const QString &value)
|
||||||
|
{
|
||||||
|
author = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setViewName(const QString &value)
|
||||||
|
{
|
||||||
|
viewName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCreateData(const QDateTime &value)
|
||||||
|
{
|
||||||
|
createData = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAbsolutePath(const QString &value)
|
||||||
|
{
|
||||||
|
absolutePath = value;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString absolutePath;
|
QString absolutePath;
|
||||||
QString viewName;
|
QString viewName;
|
||||||
|
QString author;
|
||||||
QDateTime createData;
|
QDateTime createData;
|
||||||
|
bool isChangeable;
|
||||||
qint32 size;
|
qint32 size;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STREAMINGVERSIONDATA_H
|
#endif // STREAMINGVERSIONDATA_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ void ProcessParser::clientMessage(QXmlStreamReader &xmlReader,ClientHandler *cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
processingSystem->processingFromClientMessage(client, clientMessage);
|
processingSystem->processingFromClientMessage(client, clientMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessParser::clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client)
|
void ProcessParser::clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client)
|
||||||
@@ -278,6 +279,8 @@ void ProcessParser::clientNotify(QXmlStreamReader &xmlReader,ClientHandler *clie
|
|||||||
clientNotify.Code = value;
|
clientNotify.Code = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
processingSystem->processingClientNotify(client, clientNotify);
|
processingSystem->processingClientNotify(client, clientNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,76 @@ AssetsManager::AssetsManager(QObject *parent) : QObject(parent)
|
|||||||
void AssetsManager::initialize(UpdateController* updateContoller,DataParser *dataParser)
|
void AssetsManager::initialize(UpdateController* updateContoller,DataParser *dataParser)
|
||||||
{
|
{
|
||||||
this->updateController = updateContoller;
|
this->updateController = updateContoller;
|
||||||
connect(this,&AssetsManager::sigSaveVersion,updateContoller,&UpdateController::saveVersionToFile);
|
//connect(this,&AssetsManager::sigSaveVersion,updateContoller,&UpdateController::saveVersionToFile);
|
||||||
datas = new QList<StreamingVersionData*>;
|
datas = new QList<StreamingVersionData*>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AssetsManager::fillDatas()
|
||||||
|
{
|
||||||
|
QByteArray array;
|
||||||
|
QFile file(versionListFile);
|
||||||
|
|
||||||
|
if(!file.exists())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
datas->clear();
|
||||||
|
|
||||||
|
file.open(QIODevice::ReadOnly);
|
||||||
|
array = file.readAll();
|
||||||
|
file.close();
|
||||||
|
QXmlStreamReader xmlReader(array);
|
||||||
|
|
||||||
|
xmlReader.readNext();
|
||||||
|
QString name = xmlReader.name().toString();
|
||||||
|
|
||||||
|
while(!xmlReader.atEnd())
|
||||||
|
{
|
||||||
|
name = xmlReader.name().toString();
|
||||||
|
|
||||||
|
if(!xmlReader.isStartElement()) {
|
||||||
|
xmlReader.readNext();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xmlReader.name() == "VersionList")
|
||||||
|
{
|
||||||
|
xmlReader.readNext();
|
||||||
|
|
||||||
|
while (!xmlReader.atEnd())
|
||||||
|
{
|
||||||
|
if(xmlReader.isStartElement())
|
||||||
|
{
|
||||||
|
if(xmlReader.name() == "VersionData")
|
||||||
|
{
|
||||||
|
StreamingVersionData *data = new StreamingVersionData();
|
||||||
|
|
||||||
|
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
|
||||||
|
{
|
||||||
|
QString name = attr.name().toString();
|
||||||
|
QString value = attr.value().toString();
|
||||||
|
|
||||||
|
if(name == "Version")
|
||||||
|
data->setViewName(value);
|
||||||
|
else if(name == "Created")
|
||||||
|
data->setCreateData(QDateTime::fromString(value));
|
||||||
|
else if(name == "isChangeable")
|
||||||
|
data->setIsChangeable(value.toInt());
|
||||||
|
else if(name == "author")
|
||||||
|
data->setAuthor(value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
datas->append(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlReader.readNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
void AssetsManager::setVersionList(QList<StreamingVersionData*> *streamingVersion)
|
void AssetsManager::setVersionList(QList<StreamingVersionData*> *streamingVersion)
|
||||||
{
|
{
|
||||||
datas->clear();
|
datas->clear();
|
||||||
@@ -41,7 +107,7 @@ QString AssetsManager::setVersion(QString versionName)
|
|||||||
if (version->getViewName() == versionName)
|
if (version->getViewName() == versionName)
|
||||||
{
|
{
|
||||||
currentVersionData = version;
|
currentVersionData = version;
|
||||||
emit sigSaveVersion(currentVersionData);
|
saveVersionToFile(currentVersionData);
|
||||||
|
|
||||||
return version->getAbsolutPath();
|
return version->getAbsolutPath();
|
||||||
}
|
}
|
||||||
@@ -101,11 +167,11 @@ void AssetsManager::addVersion(StreamingVersionData *data)
|
|||||||
datas->push_back(data);
|
datas->push_back(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetsManager::createCopyVersion(QString versionName,QString newVersionName)
|
void AssetsManager::createCopyVersion(QString versionName,QString newVersionName,QString author)
|
||||||
{
|
{
|
||||||
qDebug() << "assetManager thread ID " << QThread::currentThreadId();
|
qDebug() << "assetManager thread ID " << QThread::currentThreadId();
|
||||||
QListIterator<StreamingVersionData*> iterator(*datas);
|
QListIterator<StreamingVersionData*> iterator(*datas);
|
||||||
StreamingVersionData* data;
|
StreamingVersionData* data = new StreamingVersionData;
|
||||||
|
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
@@ -113,10 +179,15 @@ void AssetsManager::createCopyVersion(QString versionName,QString newVersionName
|
|||||||
|
|
||||||
if (version->getViewName() == versionName)
|
if (version->getViewName() == versionName)
|
||||||
{
|
{
|
||||||
data = version;
|
data->setAbsolutePath(version->getAbsolutPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->setAuthor(author);
|
||||||
|
data->setIsChangeable(true);
|
||||||
|
data->setViewName(newVersionName);
|
||||||
|
datas->append(data);
|
||||||
|
|
||||||
qDebug() << "Version for copy " << versionName;
|
qDebug() << "Version for copy " << versionName;
|
||||||
qDebug() << "New version name " << newVersionName;
|
qDebug() << "New version name " << newVersionName;
|
||||||
|
|
||||||
@@ -208,6 +279,113 @@ void AssetsManager::copyAllRecurse(QString source,QString destination)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AssetsManager::writeVersionsToFile(QList<StreamingVersionData*> version,bool isFirst)
|
||||||
|
{
|
||||||
|
QList<SXmlAnswerTag> listTag;
|
||||||
|
|
||||||
|
QFile file(versionListFile);
|
||||||
|
|
||||||
|
foreach(StreamingVersionData* ver,version)
|
||||||
|
{
|
||||||
|
SAttribute attribute1 = {"Version", ver->getViewName()};
|
||||||
|
SAttribute attribute2 = {"Created", ver->getCreateData().toString()};
|
||||||
|
SAttribute attribute3;
|
||||||
|
SAttribute attribute4;
|
||||||
|
|
||||||
|
if(isFirst)
|
||||||
|
{
|
||||||
|
attribute3 = {"isChangeable",QString::number(false)};
|
||||||
|
attribute4 = {"author",tr("Константа-дизайн")};
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
attribute3 ={"isChangeable",QString::number(ver->getIsChangeable())};
|
||||||
|
attribute4 = {"author",ver->getAuthor()};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<SAttribute> listAttr = {attribute1, attribute2,attribute3,attribute4};
|
||||||
|
SXmlAnswerTag tag = {"VersionData", listAttr};
|
||||||
|
|
||||||
|
listTag.append(tag);
|
||||||
|
datas->append(ver);
|
||||||
|
}
|
||||||
|
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartDocument();
|
||||||
|
xmlWriter.writeStartElement("VersionList");
|
||||||
|
|
||||||
|
foreach(SXmlAnswerTag tag,listTag)
|
||||||
|
{
|
||||||
|
xmlWriter.writeStartElement(tag.elementName);
|
||||||
|
|
||||||
|
foreach(SAttribute attribute,tag.attr)
|
||||||
|
{
|
||||||
|
xmlWriter.writeAttribute(attribute.name,attribute.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
xmlWriter.writeEndDocument();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssetsManager::createFirstVersionListXML(QList<StreamingVersionData*> version) //TODO: переименовать и перебросить в AssetManager
|
||||||
|
{
|
||||||
|
QFile file(versionListFile);
|
||||||
|
|
||||||
|
if(!file.exists())
|
||||||
|
{
|
||||||
|
writeVersionsToFile(version,true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if(datas->count() == 0) fillDatas();
|
||||||
|
|
||||||
|
foreach(StreamingVersionData* ver,version)
|
||||||
|
{
|
||||||
|
foreach(StreamingVersionData* data,*datas)
|
||||||
|
{
|
||||||
|
if(ver->getViewName() == data->getViewName())
|
||||||
|
{
|
||||||
|
data->setAbsolutePath(ver->getAbsolutPath());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeVersionsToFile(*datas,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssetsManager::saveVersionToFile(StreamingVersionData *streamingVersion) //TODO: переименовать и перебросить в AssetManager
|
||||||
|
{
|
||||||
|
QFile file(version);
|
||||||
|
file.open(QFile::WriteOnly);
|
||||||
|
|
||||||
|
QXmlStreamWriter xmlWriter(&file);
|
||||||
|
xmlWriter.setAutoFormatting(true);
|
||||||
|
xmlWriter.writeStartDocument();
|
||||||
|
|
||||||
|
xmlWriter.writeStartElement("VersionData");
|
||||||
|
xmlWriter.writeAttribute("Version",streamingVersion->getViewName());
|
||||||
|
xmlWriter.writeAttribute("Created",streamingVersion->getCreateData().toString());
|
||||||
|
xmlWriter.writeAttribute("isChangeable",QString::number(streamingVersion->getIsChangeable()));
|
||||||
|
xmlWriter.writeAttribute("author",streamingVersion->getAuthor());
|
||||||
|
|
||||||
|
xmlWriter.writeEndElement();
|
||||||
|
xmlWriter.writeEndDocument();
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
AssetsManager::~AssetsManager()
|
AssetsManager::~AssetsManager()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ public:
|
|||||||
explicit AssetsManager(QObject *parent = nullptr);
|
explicit AssetsManager(QObject *parent = nullptr);
|
||||||
void initialize(UpdateController* updateContoller,DataParser *dataParser);
|
void initialize(UpdateController* updateContoller,DataParser *dataParser);
|
||||||
void addVersion(StreamingVersionData *data);
|
void addVersion(StreamingVersionData *data);
|
||||||
void createCopyVersion(QString versionName,QString newName);
|
void createCopyVersion(QString versionName,QString newName,QString author);
|
||||||
void deleteVersion(QString version);
|
void deleteVersion(QString version);
|
||||||
void setVersionList(QList<StreamingVersionData *> *streamingVersion);
|
void setVersionList(QList<StreamingVersionData *> *streamingVersion);
|
||||||
bool findDuplicate(QString name);
|
bool findDuplicate(QString name);
|
||||||
|
void createFirstVersionListXML(QList<StreamingVersionData*> assets);
|
||||||
QString setVersion(QString versionName);
|
QString setVersion(QString versionName);
|
||||||
|
|
||||||
QList<FileData> *prepareLocalPathList(QList<FileData>*fileData);
|
QList<FileData> *prepareLocalPathList(QList<FileData>*fileData);
|
||||||
@@ -27,6 +28,9 @@ public:
|
|||||||
|
|
||||||
StreamingVersionData *getCurrentVersionData() const;
|
StreamingVersionData *getCurrentVersionData() const;
|
||||||
|
|
||||||
|
void saveVersionToFile(StreamingVersionData *streamingVersion);
|
||||||
|
void writeVersionsToFile(QList<StreamingVersionData*> version,bool isFirst);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigSaveVersion(StreamingVersionData *versionData);
|
void sigSaveVersion(StreamingVersionData *versionData);
|
||||||
|
|
||||||
@@ -36,6 +40,7 @@ private:
|
|||||||
StreamingVersionData* currentVersionData;
|
StreamingVersionData* currentVersionData;
|
||||||
|
|
||||||
void copyAllRecurse(QString source, QString destination);
|
void copyAllRecurse(QString source, QString destination);
|
||||||
|
void fillDatas();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ASSETSMANAGER_H
|
#endif // ASSETSMANAGER_H
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ void CommonClientHandler::initialize(QMap<int, ClientHandler *> *clientsMap, Pro
|
|||||||
this->processingSystem = processingSystem;
|
this->processingSystem = processingSystem;
|
||||||
this->dataParser = dataParser;
|
this->dataParser = dataParser;
|
||||||
this->logger = logger;
|
this->logger = logger;
|
||||||
|
|
||||||
|
connect(this,&CommonClientHandler::sigSendToLogger,logger,&Logger::addTextToLogger,Qt::AutoConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonClientHandler::sendNewVersionListToAllClient()
|
void CommonClientHandler::sendNewVersionListToAllClient()
|
||||||
@@ -85,7 +87,8 @@ void CommonClientHandler::slot_msgToClientFromGUI(QString login, QString text)
|
|||||||
|
|
||||||
QString str = "Msg To Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
QString str = "Msg To Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
||||||
|
|
||||||
logger->addTextToLogger(str);
|
emit sigSendToLogger(str);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +114,7 @@ void CommonClientHandler::slot_msgToGUIfromClient(QString login, QString text)
|
|||||||
|
|
||||||
QString str = "Msg From Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
QString str = "Msg From Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
||||||
|
|
||||||
logger->addTextToLogger(str);
|
emit sigSendToLogger(str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +137,7 @@ void CommonClientHandler::slot_sendTaskToClient(QString fullNameClient,QString t
|
|||||||
QString peerPort = QString::number(handler->getSocket()->peerPort());
|
QString peerPort = QString::number(handler->getSocket()->peerPort());
|
||||||
|
|
||||||
QString str = "Task To Client [" + peerAddress + ":" + peerPort + "] : " + textTask;
|
QString str = "Task To Client [" + peerAddress + ":" + peerPort + "] : " + textTask;
|
||||||
logger->addTextToLogger(str);
|
emit sigSendToLogger(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
void slot_msgToGUIfromClient(QString login, QString text);
|
void slot_msgToGUIfromClient(QString login, QString text);
|
||||||
void slot_sendTaskToClient(QString fullNameClient, QString textTask);
|
void slot_sendTaskToClient(QString fullNameClient, QString textTask);
|
||||||
signals:
|
signals:
|
||||||
|
void sigSendToLogger(QString text);
|
||||||
private:
|
private:
|
||||||
QMap<int, ClientHandler*> *clientsMap;
|
QMap<int, ClientHandler*> *clientsMap;
|
||||||
ProcessingSystem *processingSystem;
|
ProcessingSystem *processingSystem;
|
||||||
|
|||||||
@@ -11,11 +11,16 @@ ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateControlle
|
|||||||
this->updateController = updateController;
|
this->updateController = updateController;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessingSystem::initialize(ServerLMSWidget *server, DataParser *dataParser, CommonClientHandler *commonClientHandler,Logger *logger)
|
void ProcessingSystem::initialize(ServerLMSWidget *server,
|
||||||
|
DataParser *dataParser,
|
||||||
|
CommonClientHandler *commonClientHandler,
|
||||||
|
Logger *logger,
|
||||||
|
UpdateController *updateController)
|
||||||
{
|
{
|
||||||
this->commonClientServer = commonClientHandler;
|
this->commonClientServer = commonClientHandler;
|
||||||
this->dataParser = dataParser;
|
this->dataParser = dataParser;
|
||||||
this->server = server;
|
this->server = server;
|
||||||
|
this->updateController = updateController;
|
||||||
|
|
||||||
connect(this,&ProcessingSystem::sigAuthChanged,commonClientHandler, &CommonClientHandler::slot_AuthChanged,Qt::AutoConnection);
|
connect(this,&ProcessingSystem::sigAuthChanged,commonClientHandler, &CommonClientHandler::slot_AuthChanged,Qt::AutoConnection);
|
||||||
connect(this,&ProcessingSystem::sigUpdateListClients,server, &ServerLMSWidget::slotUpdateListClients,Qt::AutoConnection);
|
connect(this,&ProcessingSystem::sigUpdateListClients,server, &ServerLMSWidget::slotUpdateListClients,Qt::AutoConnection);
|
||||||
@@ -303,6 +308,18 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif
|
|||||||
{
|
{
|
||||||
client->sendVersionList();
|
client->sendVersionList();
|
||||||
}
|
}
|
||||||
|
else if(clientNotify.Code == commandCanChangeVersion)
|
||||||
|
{
|
||||||
|
if (updateController->getCurrentVersion()->getIsChangeable())
|
||||||
|
{
|
||||||
|
client->sigSendNotify(commandChangable);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client->sigSendNotify(commandUnchangable);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,12 @@ class ProcessingSystem : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, QObject *parent = nullptr);
|
explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, QObject *parent = nullptr);
|
||||||
|
|
||||||
void initialize(ServerLMSWidget *server,DataParser* dataParser,CommonClientHandler *commonClientServer,Logger *logger);
|
void initialize(ServerLMSWidget *server,
|
||||||
|
DataParser* dataParser,
|
||||||
|
CommonClientHandler *commonClientServer,
|
||||||
|
Logger *logger,
|
||||||
|
UpdateController *updateComtroller);
|
||||||
|
|
||||||
void processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization);
|
void processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization);
|
||||||
void processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization);
|
void processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization);
|
||||||
void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0, void* data = nullptr);
|
void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0, void* data = nullptr);
|
||||||
@@ -45,9 +50,8 @@ private:
|
|||||||
CommonClientHandler *commonClientServer;
|
CommonClientHandler *commonClientServer;
|
||||||
ServerLMSWidget *server;
|
ServerLMSWidget *server;
|
||||||
DataParser *dataParser;
|
DataParser *dataParser;
|
||||||
//InstructorsAndTraineesWidget *pInstructorsAndTrainees;
|
UpdateController *updateController;
|
||||||
ProviderDBLMS* providerDBLMS;
|
ProviderDBLMS* providerDBLMS;
|
||||||
UpdateController* updateController;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROCESSINGSYSTEM_H
|
#endif // PROCESSINGSYSTEM_H
|
||||||
|
|||||||
@@ -87,14 +87,22 @@ void RecognizeSystem::recognize()
|
|||||||
if (!stream.commitTransaction()) continue;
|
if (!stream.commitTransaction()) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command == commandUpdateFilesClient) //запускает процесс оновления
|
if (packetType == PacketType::TYPE_UPDATE)
|
||||||
{
|
{
|
||||||
|
|
||||||
sendSystem->updateFiles(updateController->getFileSendList(),
|
sendSystem->updateFiles(updateController->getFileSendList(),
|
||||||
updateController->getClientDataList());
|
updateController->getFileDeleteList());
|
||||||
|
|
||||||
qDebug()<< "Call update";
|
qDebug()<< "Call update";
|
||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
command = "";
|
}
|
||||||
|
|
||||||
|
if(packetType == PacketType::TYPE_CHECK_VERSION)
|
||||||
|
{
|
||||||
|
QFile checkFile(clientHash);
|
||||||
|
checkFile.open(QIODevice::ReadOnly);
|
||||||
|
updateController->compareFiles(clientHandler,checkFile.readAll());
|
||||||
|
checkFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetType == PacketType::TYPE_XMLANSWER)
|
if (packetType == PacketType::TYPE_XMLANSWER)
|
||||||
@@ -160,6 +168,16 @@ void RecognizeSystem::recognize()
|
|||||||
|
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
|
|
||||||
|
// //ПРОВЕРКА НА ИЗМЕНЕНИЕ БАЗОВОЙ ВЕРСИИ
|
||||||
|
// bool check = checkIsChangeable();
|
||||||
|
// bool check2 = checkNonStaticData(filePath);
|
||||||
|
// if(!check && check2)
|
||||||
|
// {
|
||||||
|
// packetType = PacketType::TYPE_NONE;
|
||||||
|
// sendSystem->sendNotify(commandTryBaseChange);
|
||||||
|
// mutex->unlock();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
@@ -231,6 +249,17 @@ void RecognizeSystem::recognize()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //ПРОВЕРКА НА ИЗМЕНЕНИЕ БАЗОВОЙ ВЕРСИИ
|
||||||
|
// bool check = checkIsChangeable();
|
||||||
|
// bool check2 = checkNonStaticData(filePath);
|
||||||
|
// if(!check && check2)
|
||||||
|
// {
|
||||||
|
// sendSystem->sendNotify(commandTryBaseChange);
|
||||||
|
// packetType = PacketType::TYPE_NONE;
|
||||||
|
// mutex->unlock();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
QFileInfo fileInfo(file);
|
QFileInfo fileInfo(file);
|
||||||
|
|
||||||
@@ -280,14 +309,6 @@ void RecognizeSystem::recognize()
|
|||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
if(command == "check")
|
|
||||||
{
|
|
||||||
QFile checkFile(filePath);
|
|
||||||
checkFile.open(QIODevice::ReadOnly);
|
|
||||||
updateController->compareFiles(clientHandler,checkFile.readAll());
|
|
||||||
checkFile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
filePath.clear();
|
filePath.clear();
|
||||||
fileSize = 0;
|
fileSize = 0;
|
||||||
tmpBlock.clear();
|
tmpBlock.clear();
|
||||||
@@ -345,7 +366,7 @@ void RecognizeSystem::recognize()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sigCopyVersion(result[0],result[1]);
|
emit sigCopyVersion(result[0],result[1],result[2]);
|
||||||
sendSystem->sendPacketType(PacketType::BUSY);
|
sendSystem->sendPacketType(PacketType::BUSY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,6 +433,18 @@ QString RecognizeSystem::createFullPath(QString path)
|
|||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RecognizeSystem::checkIsChangeable()
|
||||||
|
{
|
||||||
|
return updateController->getCurrentVersion()->getIsChangeable();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RecognizeSystem::checkNonStaticData(QString path)
|
||||||
|
{
|
||||||
|
if(path.contains(sharedDataFolderName)) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
RecognizeSystem::~RecognizeSystem()
|
RecognizeSystem::~RecognizeSystem()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ signals:
|
|||||||
void sigXmlParser(ClientHandler *clientHandler,QByteArray data);
|
void sigXmlParser(ClientHandler *clientHandler,QByteArray data);
|
||||||
void sigChangeVersion(QString versionName);
|
void sigChangeVersion(QString versionName);
|
||||||
void sigDeleteVersion(QString versionName);
|
void sigDeleteVersion(QString versionName);
|
||||||
void sigCopyVersion(QString versionName,QString newVersionName);
|
void sigCopyVersion(QString versionName,QString newVersionName,QString author);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UpdateController *updateController;
|
UpdateController *updateController;
|
||||||
@@ -61,5 +61,7 @@ private:
|
|||||||
void packetTypeInit(PacketType packet,Client *client);
|
void packetTypeInit(PacketType packet,Client *client);
|
||||||
void packetTypeInit(PacketType type);
|
void packetTypeInit(PacketType type);
|
||||||
QString createFullPath(QString path);
|
QString createFullPath(QString path);
|
||||||
|
bool checkIsChangeable();
|
||||||
|
bool checkNonStaticData(QString path);
|
||||||
};
|
};
|
||||||
#endif // RECOGNIZESYSTEM_H
|
#endif // RECOGNIZESYSTEM_H
|
||||||
|
|||||||
@@ -35,14 +35,22 @@ void SendSystem::sendMessageBlock(QString message)
|
|||||||
|
|
||||||
void SendSystem::sendFileBlock(QString path)
|
void SendSystem::sendFileBlock(QString path)
|
||||||
{
|
{
|
||||||
|
|
||||||
qDebug() << "sendFileBlock thread: " << QThread::currentThreadId();
|
qDebug() << "sendFileBlock thread: " << QThread::currentThreadId();
|
||||||
|
|
||||||
|
QFile file(path);
|
||||||
|
QFileInfo fileInfo(file);
|
||||||
|
|
||||||
|
if(isSendStopped)
|
||||||
|
{ //Поведение на случай отключения клиента
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
|
||||||
QFile file(path);
|
|
||||||
QFileInfo fileInfo(file);
|
|
||||||
fileSize = fileInfo.size();
|
fileSize = fileInfo.size();
|
||||||
|
|
||||||
if(fileSize == 0){
|
if(fileSize == 0){
|
||||||
@@ -55,20 +63,19 @@ void SendSystem::sendFileBlock(QString path)
|
|||||||
|
|
||||||
stream << path << fileSize;
|
stream << path << fileSize;
|
||||||
|
|
||||||
if(isSendStopped) { //Поведение на случай отключения клиента
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
socket->waitForBytesWritten();
|
socket->waitForBytesWritten(10);
|
||||||
|
|
||||||
if(file.open(QFile::ReadOnly)){
|
if(file.open(QFile::ReadOnly))
|
||||||
while(!file.atEnd()){
|
{
|
||||||
|
while(!file.atEnd())
|
||||||
|
{
|
||||||
QByteArray data = file.read(1025*250);
|
QByteArray data = file.read(1025*250);
|
||||||
stream << data;
|
stream << data;
|
||||||
socket->waitForBytesWritten();
|
socket->waitForBytesWritten(10);
|
||||||
|
|
||||||
|
if(socket->state() == QAbstractSocket::UnconnectedState) break;
|
||||||
countSend++;
|
countSend++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +84,7 @@ void SendSystem::sendFileBlock(QString path)
|
|||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
countSend = 0;
|
countSend = 0;
|
||||||
socket->waitForBytesWritten();
|
socket->waitForBytesWritten(10);
|
||||||
socket->waitForReadyRead(100);
|
socket->waitForReadyRead(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,11 +244,9 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
|
|||||||
socket->waitForReadyRead(100);
|
socket->waitForReadyRead(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getIsSendStopped()) return;
|
if(isSendStopped) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
emit sigLoadHash();
|
emit sigLoadHash();
|
||||||
|
|
||||||
sendPacketType(PacketType::TYPE_FINISH);
|
sendPacketType(PacketType::TYPE_FINISH);
|
||||||
|
|||||||
@@ -15,8 +15,9 @@
|
|||||||
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 additionalFilesFolderName = "AdditionalFiles";
|
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 tempFile = staticDataFolderName + "/save.xml";
|
static const QString tempFile = staticDataFolderName + "/save.xml";
|
||||||
static const QString version = staticDataFolderName + "/version.xml";
|
static const QString version = staticDataFolderName + "/version.xml";
|
||||||
static const QString versionListFile = staticDataFolderName + "/versionList.xml";
|
static const QString versionListFile = staticDataFolderName + "/versionList.xml";
|
||||||
@@ -25,10 +26,12 @@ static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
|||||||
static const QString buildDataPath = "/Application/RRJLoader/RRJ_Data/";
|
static const QString buildDataPath = "/Application/RRJLoader/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 baseNameVersion = "base";//может вынести комманды куда нибудь?
|
static const QString baseNameVersion = "base";//может вынести комманды куда нибудь?
|
||||||
|
|
||||||
static const QString commandTryBaseDelete = "BASEDELETETRY";
|
static const QString commandTryBaseDelete = "BASEDELETETRY";
|
||||||
|
static const QString commandTryBaseChange = "TRYBASECHANGE";
|
||||||
static const QString commandTryActiveDelete = "TRYACTIVEDELETE";
|
static const QString commandTryActiveDelete = "TRYACTIVEDELETE";
|
||||||
static const QString commandTryCopyWithSameNames = "SAMENAMES";
|
static const QString commandTryCopyWithSameNames = "SAMENAMES";
|
||||||
static const QString commandGetServerDataList = "GETSERVERDATALIST";
|
static const QString commandGetServerDataList = "GETSERVERDATALIST";
|
||||||
@@ -37,6 +40,9 @@ static const QString commandReadyClient = "READY";
|
|||||||
static const QString commandDisableClient = "DISABLE";
|
static const QString commandDisableClient = "DISABLE";
|
||||||
static const QString commandDuplicateVerName = "DUPLICATEVERNAME";
|
static const QString commandDuplicateVerName = "DUPLICATEVERNAME";
|
||||||
static const QString commandHashCompleteClient = "HASHSENDCOMPLETE";
|
static const QString commandHashCompleteClient = "HASHSENDCOMPLETE";
|
||||||
|
static const QString commandCanChangeVersion = "CANCHANGE";
|
||||||
|
static const QString commandChangable = "CHANGEABLE";
|
||||||
|
static const QString commandUnchangable = "UNCHANGEABLE";
|
||||||
static const QString commandUpdateFilesClient = "update";
|
static const QString commandUpdateFilesClient = "update";
|
||||||
|
|
||||||
class Tools {
|
class Tools {
|
||||||
|
|||||||
@@ -41,16 +41,18 @@ void UpdateController::changeAssetVersion(QString versionName)
|
|||||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::createCopyVersion(QString versionName,QString newVersionName)
|
void UpdateController::createCopyVersion(QString versionName,QString newVersionName,QString author)
|
||||||
{
|
{
|
||||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
|
||||||
assetManager->createCopyVersion(versionName,newVersionName);
|
assetManager->createCopyVersion(versionName,newVersionName,author);
|
||||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::deleteAssetVersion(QString versionName)
|
void UpdateController::deleteAssetVersion(QString versionName)
|
||||||
{
|
{
|
||||||
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
|
||||||
assetManager->deleteVersion(versionName);
|
assetManager->deleteVersion(versionName);
|
||||||
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
|
void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
|
||||||
@@ -59,7 +61,6 @@ void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
|
|||||||
loadHash();
|
loadHash();
|
||||||
clientDataList.clear();
|
clientDataList.clear();
|
||||||
xmlFileDataParse(array);
|
xmlFileDataParse(array);
|
||||||
clientDataList.append(*datas);
|
|
||||||
checkNeedUpdate(handler);
|
checkNeedUpdate(handler);
|
||||||
mutex->unlock();
|
mutex->unlock();
|
||||||
}
|
}
|
||||||
@@ -182,8 +183,6 @@ QString UpdateController::getCommands()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UpdateController::setUpCurrentServerHash()
|
void UpdateController::setUpCurrentServerHash()
|
||||||
{
|
{
|
||||||
QList<FileData> *fileList = new QList<FileData>;
|
QList<FileData> *fileList = new QList<FileData>;
|
||||||
@@ -296,61 +295,69 @@ QList<FileData>* UpdateController::calculateHash(QString path)
|
|||||||
{
|
{
|
||||||
serverDataList.clear();
|
serverDataList.clear();
|
||||||
|
|
||||||
QDirIterator iterator(path,QDirIterator::Subdirectories);
|
|
||||||
if(!QDir(path).exists()){
|
if(!QDir(path).exists()){
|
||||||
QDir().mkdir(path);
|
QDir().mkdir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir dir(path);
|
|
||||||
dir.setFilter(QDir::NoDotAndDotDot);
|
|
||||||
QString hashString;
|
QString hashString;
|
||||||
|
QStringList filter;
|
||||||
|
filter << "*";
|
||||||
QList<FileData> *files = new QList<FileData>;
|
QList<FileData> *files = new QList<FileData>;
|
||||||
|
|
||||||
while (iterator.hasNext())
|
QDirIterator dirIterator(path,filter, QDir::AllEntries | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
|
while (dirIterator.hasNext())
|
||||||
{
|
{
|
||||||
iterator.next();
|
QFileInfo fileInfo(dirIterator.next());
|
||||||
QFileInfo fileInfo = iterator.fileInfo();
|
|
||||||
FileData currentFile;
|
FileData currentFile;
|
||||||
QFile file(fileInfo.absoluteFilePath());
|
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != "RRJLoader")
|
||||||
|
|
||||||
quint64 fileSize = file.size();
|
|
||||||
const quint64 bufferSize = 10240;
|
|
||||||
|
|
||||||
if (fileInfo.isHidden()) continue;
|
|
||||||
|
|
||||||
if(fileInfo.isFile() && file.open(QIODevice::ReadOnly) && !fileInfo.fileName().contains(".meta"))
|
|
||||||
{
|
{
|
||||||
char buffer[bufferSize];
|
|
||||||
int bytesRead;
|
|
||||||
int readSize = qMin(fileSize,bufferSize);
|
|
||||||
|
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
|
||||||
while(readSize > 0 && (bytesRead = file.read(buffer,readSize)) > 0){
|
|
||||||
fileSize -= bytesRead;
|
|
||||||
hash.addData(buffer,bytesRead);
|
|
||||||
readSize = qMin(fileSize,bufferSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
hashString = QString(hash.result().toHex());
|
|
||||||
currentFile.hash = hashString;
|
|
||||||
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||||
|
|
||||||
files->push_back(currentFile);
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
else if(fileInfo.isDir() && fileInfo.fileName() != ".." && !fileInfo.isRoot())
|
|
||||||
{
|
|
||||||
currentFile.hash = "FOLDER";
|
currentFile.hash = "FOLDER";
|
||||||
currentFile.path = Tools::createLocalPath(fileInfo.path());
|
|
||||||
|
|
||||||
if(!files->contains(currentFile)){
|
if(!files->contains(currentFile))
|
||||||
|
{
|
||||||
files->push_back(currentFile);
|
files->push_back(currentFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(files->begin(),files->end());
|
QDirIterator fileIterator(path,filter,QDir::Files | QDir::NoDotAndDotDot,QDirIterator::Subdirectories);
|
||||||
|
|
||||||
|
while (fileIterator.hasNext())
|
||||||
|
{
|
||||||
|
fileIterator.next();
|
||||||
|
QFileInfo fileInfo = fileIterator.fileInfo();
|
||||||
|
FileData currentFile;
|
||||||
|
QFile file(fileInfo.absoluteFilePath());
|
||||||
|
|
||||||
|
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
||||||
|
const quint64 bufferSize = 10240;
|
||||||
|
|
||||||
|
if(fileInfo.isHidden()) continue;
|
||||||
|
|
||||||
|
if(fileInfo.isFile() && file.open(QIODevice::ReadOnly) && !fileInfo.fileName().contains(".meta"))
|
||||||
|
{
|
||||||
|
char buffer[bufferSize];
|
||||||
|
int bytesRead;
|
||||||
|
int readSize = qMin(fileSize,bufferSize);
|
||||||
|
|
||||||
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
|
|
||||||
|
while(readSize > 0 && (bytesRead = file.read(buffer,readSize)) > 0)
|
||||||
|
{
|
||||||
|
fileSize -= bytesRead;
|
||||||
|
hash.addData(buffer,bytesRead);
|
||||||
|
readSize = qMin(fileSize,bufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
hashString = QString(hash.result().toHex());
|
||||||
|
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||||
|
currentFile.hash = hashString;
|
||||||
|
files->push_back(currentFile);
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
serverDataList.append(*files);
|
serverDataList.append(*files);
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
@@ -404,6 +411,12 @@ void UpdateController::CalculateSizeToSend(QList<FileData> diffList)
|
|||||||
void UpdateController::calculateSharedHash()
|
void UpdateController::calculateSharedHash()
|
||||||
{
|
{
|
||||||
QDir sharedDir(sharedDataPath);
|
QDir sharedDir(sharedDataPath);
|
||||||
|
|
||||||
|
if(!QDir(sharedDataPath).exists())
|
||||||
|
{
|
||||||
|
QDir().mkdir(sharedDataPath);
|
||||||
|
}
|
||||||
|
|
||||||
QDirIterator dirIterator(sharedDir);
|
QDirIterator dirIterator(sharedDir);
|
||||||
QList<FileData> *fileList = new QList<FileData>;
|
QList<FileData> *fileList = new QList<FileData>;
|
||||||
QList<StreamingVersionData*> *versionList = new QList<StreamingVersionData*>;
|
QList<StreamingVersionData*> *versionList = new QList<StreamingVersionData*>;
|
||||||
@@ -424,74 +437,24 @@ void UpdateController::calculateSharedHash()
|
|||||||
fileInfo.absoluteFilePath(),fileInfo.fileName(),
|
fileInfo.absoluteFilePath(),fileInfo.fileName(),
|
||||||
fileInfo.birthTime(),fileInfo.size());
|
fileInfo.birthTime(),fileInfo.size());
|
||||||
|
|
||||||
|
// if(fileInfo.fileName() == baseNameVersion)
|
||||||
|
// {
|
||||||
|
// version->setIsChangeable(false);
|
||||||
|
// version->setAuthor(tr("Константа-дизайн"));
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// version->setIsChangeable(true);
|
||||||
|
// }
|
||||||
|
|
||||||
versionList->append(version);
|
versionList->append(version);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createVersionListXmlAnswer(*versionList);
|
assetManager->createFirstVersionListXML(*versionList);
|
||||||
assetManager->setVersionList(versionList);
|
//assetManager->setVersionList(versionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::createVersionListXmlAnswer(QList<StreamingVersionData *> version) //TODO: переименовать и перебросить в AssetManager
|
|
||||||
{
|
|
||||||
QList<SXmlAnswerTag> listTag;
|
|
||||||
|
|
||||||
foreach(StreamingVersionData* ver,version)
|
|
||||||
{
|
|
||||||
SAttribute attribute1 = {"Version", ver->getViewName()};
|
|
||||||
SAttribute attribute2 = {"Created", ver->getCreateData().toString()};
|
|
||||||
|
|
||||||
QList<SAttribute> listAttr = {attribute1, attribute2};
|
|
||||||
SXmlAnswerTag tag = {"VersionData", listAttr};
|
|
||||||
|
|
||||||
listTag.append(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QFile file(versionListFile);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartDocument();
|
|
||||||
xmlWriter.writeStartElement("VersionList");
|
|
||||||
|
|
||||||
foreach(SXmlAnswerTag tag,listTag)
|
|
||||||
{
|
|
||||||
xmlWriter.writeStartElement(tag.elementName);
|
|
||||||
|
|
||||||
foreach(SAttribute attribute,tag.attr)
|
|
||||||
{
|
|
||||||
xmlWriter.writeAttribute(attribute.name,attribute.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
xmlWriter.writeEndDocument();
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
void UpdateController::saveVersionToFile(StreamingVersionData *streamingVersion) //TODO: переименовать и перебросить в AssetManager
|
|
||||||
{
|
|
||||||
QFile file(version);
|
|
||||||
file.open(QFile::WriteOnly);
|
|
||||||
|
|
||||||
QXmlStreamWriter xmlWriter(&file);
|
|
||||||
xmlWriter.setAutoFormatting(true);
|
|
||||||
xmlWriter.writeStartDocument();
|
|
||||||
|
|
||||||
xmlWriter.writeStartElement("VersionData");
|
|
||||||
xmlWriter.writeAttribute("Version",streamingVersion->getViewName());
|
|
||||||
xmlWriter.writeAttribute("Created",streamingVersion->getCreateData().toString());
|
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
|
||||||
xmlWriter.writeEndDocument();
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpdateController::sendNewVersionList()
|
void UpdateController::sendNewVersionList()
|
||||||
{
|
{
|
||||||
commonClientHandler->sendNewVersionListToAllClient();
|
commonClientHandler->sendNewVersionListToAllClient();
|
||||||
@@ -505,7 +468,6 @@ bool UpdateController::checkDuplicate(QString versionName)
|
|||||||
void UpdateController::xmlFileDataParse(QByteArray array)
|
void UpdateController::xmlFileDataParse(QByteArray array)
|
||||||
{
|
{
|
||||||
QXmlStreamReader xmlReader(array);
|
QXmlStreamReader xmlReader(array);
|
||||||
datas = new QList<FileData>;
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
|
|
||||||
//Крутимся в цикле до тех пор, пока не достигнем конца документа
|
//Крутимся в цикле до тех пор, пока не достигнем конца документа
|
||||||
@@ -529,7 +491,7 @@ void UpdateController::xmlFileDataParse(QByteArray array)
|
|||||||
data.hash = value;
|
data.hash = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
datas->append(data);
|
clientDataList.append(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,6 +499,11 @@ void UpdateController::xmlFileDataParse(QByteArray array)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StreamingVersionData* UpdateController::getCurrentVersion()
|
||||||
|
{
|
||||||
|
return assetManager->getCurrentVersionData();
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateController::printFileList(QList<FileData> fileData)
|
void UpdateController::printFileList(QList<FileData> fileData)
|
||||||
{
|
{
|
||||||
QListIterator<FileData> iterator(fileData);
|
QListIterator<FileData> iterator(fileData);
|
||||||
@@ -571,11 +538,6 @@ DataInfo *UpdateController::getCurrentDataInfo()
|
|||||||
return dataInfo;
|
return dataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<FileData> *UpdateController::getDatas() const
|
|
||||||
{
|
|
||||||
return datas;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateController::clearCurrentDataInfo()
|
void UpdateController::clearCurrentDataInfo()
|
||||||
{
|
{
|
||||||
delete dataInfo;
|
delete dataInfo;
|
||||||
|
|||||||
@@ -51,16 +51,13 @@ public:
|
|||||||
|
|
||||||
DataInfo *getCurrentDataInfo();
|
DataInfo *getCurrentDataInfo();
|
||||||
void clearCurrentDataInfo();
|
void clearCurrentDataInfo();
|
||||||
QList<FileData> *getDatas() const;
|
|
||||||
void createVersionListXmlAnswer(QList<StreamingVersionData *> version);
|
|
||||||
void saveVersionToFile(StreamingVersionData *streamingVersion);
|
|
||||||
void xmlFileDataParse(QByteArray array);
|
void xmlFileDataParse(QByteArray array);
|
||||||
|
|
||||||
QString getPathAdditionalFile(QString name);
|
QString getPathAdditionalFile(QString name);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void changeAssetVersion(QString versionName);
|
void changeAssetVersion(QString versionName);
|
||||||
void createCopyVersion(QString versionName,QString newVersionName);
|
void createCopyVersion(QString versionName,QString newVersionName,QString author);
|
||||||
void deleteAssetVersion(QString versionName);
|
void deleteAssetVersion(QString versionName);
|
||||||
void setUpCurrentServerHash();
|
void setUpCurrentServerHash();
|
||||||
|
|
||||||
@@ -74,7 +71,6 @@ private:
|
|||||||
QList<FileData> fileSendList;
|
QList<FileData> fileSendList;
|
||||||
QList<FileData> fileDeleteList;
|
QList<FileData> fileDeleteList;
|
||||||
|
|
||||||
QList<FileData> *datas;
|
|
||||||
DataInfo *dataInfo;
|
DataInfo *dataInfo;
|
||||||
|
|
||||||
QString buildPath;
|
QString buildPath;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget,
|
|||||||
connect(this,&ClientHandler::sigSocketClose,sendSystem,&SendSystem::socketClose,Qt::AutoConnection);
|
connect(this,&ClientHandler::sigSocketClose,sendSystem,&SendSystem::socketClose,Qt::AutoConnection);
|
||||||
connect(this,&ClientHandler::sigSocketFlush,sendSystem,&SendSystem::socketFlush,Qt::AutoConnection);
|
connect(this,&ClientHandler::sigSocketFlush,sendSystem,&SendSystem::socketFlush,Qt::AutoConnection);
|
||||||
connect(this,&ClientHandler::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
connect(this,&ClientHandler::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
||||||
|
connect(this,&ClientHandler::sigSendStop,sendSystem,&SendSystem::sendStop,Qt::DirectConnection);
|
||||||
|
|
||||||
connect(socket,&QTcpSocket::readyRead,recognizeSystem,&RecognizeSystem::recognize,Qt::AutoConnection);
|
connect(socket,&QTcpSocket::readyRead,recognizeSystem,&RecognizeSystem::recognize,Qt::AutoConnection);
|
||||||
connect(socket, &QTcpSocket::disconnected, this, &ClientHandler::sendDisable,Qt::AutoConnection);
|
connect(socket, &QTcpSocket::disconnected, this, &ClientHandler::sendDisable,Qt::AutoConnection);
|
||||||
@@ -134,8 +135,10 @@ void ClientHandler::sendNeedUpdate(bool flag, quint64 size, quint64 fileCount,qu
|
|||||||
|
|
||||||
void ClientHandler::sendDisable()
|
void ClientHandler::sendDisable()
|
||||||
{
|
{
|
||||||
thread->exit();
|
// thread->exit();
|
||||||
thread->wait();
|
// thread->wait();
|
||||||
|
thread->quit();
|
||||||
|
emit sigSendStop();
|
||||||
emit sigClientDisconnected(client->getAddress(),client->getPort());
|
emit sigClientDisconnected(client->getAddress(),client->getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ signals:
|
|||||||
bool sigSocketFlush();
|
bool sigSocketFlush();
|
||||||
void sigSendVersion();
|
void sigSendVersion();
|
||||||
void sigSendPacketType(PacketType packetType);
|
void sigSendPacketType(PacketType packetType);
|
||||||
|
void sigSendStop();
|
||||||
|
|
||||||
public :
|
public :
|
||||||
QThread *thread;
|
QThread *thread;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ MultiThreadServer::MultiThreadServer(ServerLMSWidget *widget,UpdateController *u
|
|||||||
dataParser(dataParser),
|
dataParser(dataParser),
|
||||||
logger(logger)
|
logger(logger)
|
||||||
{
|
{
|
||||||
|
connect(this,&MultiThreadServer::sigSendToLogger,logger,&Logger::addTextToLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
|
void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
|
||||||
@@ -16,14 +16,14 @@ void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
|
|||||||
ClientHandler* newClient = new ClientHandler;
|
ClientHandler* newClient = new ClientHandler;
|
||||||
|
|
||||||
connect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize,Qt::AutoConnection);
|
connect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize,Qt::AutoConnection);
|
||||||
connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::QueuedConnection);
|
connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::AutoConnection);
|
||||||
|
|
||||||
emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser,logger);
|
emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser,logger);
|
||||||
disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize);
|
disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize);
|
||||||
|
|
||||||
serverLmsWidget->addClient(socketDesriptor,newClient);
|
serverLmsWidget->addClient(socketDesriptor,newClient);
|
||||||
|
|
||||||
logger->addTextToLogger("To Client: " + QString(SERVER_HELLO));
|
emit sigSendToLogger("To Client: " + QString(SERVER_HELLO));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPort)
|
void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPort)
|
||||||
@@ -53,8 +53,7 @@ void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPo
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit signalStopSendFile();
|
emit signalStopSendFile();
|
||||||
|
emit sigSendToLogger("SERVER: Client " + login + " disconnected");
|
||||||
logger->addTextToLogger("SERVER: Client " + login + " disconnected");
|
|
||||||
|
|
||||||
serverLmsWidget->slotUpdateListClients();
|
serverLmsWidget->slotUpdateListClients();
|
||||||
serverLmsWidget->autorizationHandler(login);
|
serverLmsWidget->autorizationHandler(login);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ signals:
|
|||||||
void sigInitClient(int descriptor, ServerLMSWidget *serverWidget,
|
void sigInitClient(int descriptor, ServerLMSWidget *serverWidget,
|
||||||
UpdateController *updateController, DataParser *dataParser,Logger *logger);
|
UpdateController *updateController, DataParser *dataParser,Logger *logger);
|
||||||
void signalStopSendFile();
|
void signalStopSendFile();
|
||||||
|
void sigSendToLogger(QString text);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotDisconnectClient(QString peerAddress, QString peerPort);
|
void slotDisconnectClient(QString peerAddress, QString peerPort);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
tcpServer(nullptr),
|
tcpServer(nullptr),
|
||||||
hostPort(6000),
|
hostPort(6000),
|
||||||
stateServer(stoped),
|
stateServer(stoped),
|
||||||
stateBlockAutorization(blocked),
|
stateBlockAutorization(unblocked),
|
||||||
updateThread(nullptr),
|
updateThread(nullptr),
|
||||||
loggerThread(nullptr),
|
loggerThread(nullptr),
|
||||||
dataParser(nullptr),
|
dataParser(nullptr),
|
||||||
@@ -44,11 +44,13 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
loggerThread = new QThread;
|
loggerThread = new QThread;
|
||||||
|
|
||||||
providerDBLMS = new ProviderDBLMS(this);
|
providerDBLMS = new ProviderDBLMS(this);
|
||||||
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
|
||||||
providerDBLMS->ConnectionToDB();
|
providerDBLMS->ConnectionToDB();
|
||||||
|
|
||||||
logger = new Logger(ui->listWidgetLogger);
|
logger = new Logger(ui->listWidgetLogger);
|
||||||
connect(logger,&Logger::sigSendTextToLogger,this,&ServerLMSWidget::slotAddToLog,Qt::QueuedConnection);
|
|
||||||
|
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
||||||
|
connect(logger,&Logger::sigSendTextToLogger,this,&ServerLMSWidget::slotAddToLog,Qt::AutoConnection);
|
||||||
|
|
||||||
logger->moveToThread(loggerThread);
|
logger->moveToThread(loggerThread);
|
||||||
|
|
||||||
assetsManager = new AssetsManager;
|
assetsManager = new AssetsManager;
|
||||||
@@ -68,7 +70,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
updateThread->start();
|
updateThread->start();
|
||||||
|
|
||||||
commonClientHandler->initialize(&clientsMap,processingSystem,dataParser,logger);
|
commonClientHandler->initialize(&clientsMap,processingSystem,dataParser,logger);
|
||||||
processingSystem->initialize(this,dataParser,commonClientHandler,logger);
|
processingSystem->initialize(this,dataParser,commonClientHandler,logger,updateController);
|
||||||
|
|
||||||
logger->setTypeLog("widget");
|
logger->setTypeLog("widget");
|
||||||
|
|
||||||
@@ -194,7 +196,7 @@ void ServerLMSWidget::slotUpdateListClients()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int countClients = clientsMap.count();
|
int countClients = clientsMap.count();
|
||||||
logger->addTextToLogger("SERVER: countClients = " + QString::number(countClients));
|
emit sigLog("SERVER: countClients = " + QString::number(countClients));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||||
@@ -244,7 +246,6 @@ void ServerLMSWidget::on_btnStartServer_clicked()
|
|||||||
if(startServer())
|
if(startServer())
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
emit sigCalculateFullHash();
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
ui->btnStartServer->setEnabled(false);
|
ui->btnStartServer->setEnabled(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user