diff --git a/DOCS/Алексей/Board.md b/DOCS/Алексей/Board.md index 9378343..e19c175 100644 --- a/DOCS/Алексей/Board.md +++ b/DOCS/Алексей/Board.md @@ -12,13 +12,12 @@ kanban-plugin: board ## bugs -- [ ] При старт стопе не сканится шэред дата ## feature client Unity - [ ] Добавить обновление инструктора, если он перелогинился -- [ ] убрать функционал смены версии с клиента +- [ ] При нажатии на кнопку обновить, менять надпись на Загрузка ## feature client QT @@ -38,11 +37,16 @@ kanban-plugin: board ## NOW -- [ ] добавить информацию Авторе и изменяемая версия или нет ## Complete +- [ ] Уведомление о том, что версия сервера неизменяемая и инструкция, что нужно переключить версию сервера, подтянуть изменяемую версию и перекинуть файлы + путь +- [ ] Qt ClientЖ отключать виджет версии при разьединении +- [ ] Отображать версию на сервере +- [ ] При удалении с клиента не удаляется папка на сервере +- [ ] убрать функционал смены версии с клиента +- [ ] добавить информацию Авторе и изменяемая версия или нет - [ ] отправлять сигнал на пересчет хэша с саб частью - [ ] GUI server: при неподключенном сервере, отключать попытку изменить версию - [ ] добавить автоматическое выключение после создания копии @@ -304,6 +308,7 @@ kanban-plugin: board ## Cancel +- [ ] При старт стопе не сканится шэред дата - [ ] разделения на серверное и GUI приложение - [ ] gui thread должен жить один - [ ] подготовить фасад для ui сервера diff --git a/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp b/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp index 7c09e24..86d4ca6 100644 --- a/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp +++ b/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp @@ -11,6 +11,6 @@ void NotifyController::showWarning(QString text) warning.setText(text); warning.setIcon(QMessageBox::Warning); - warning.setWindowTitle(tr("Ошибка")); + warning.setWindowTitle(tr("Error")); warning.exec(); } diff --git a/InstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp b/InstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp index 42c71ac..166eb7e 100644 --- a/InstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp +++ b/InstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp @@ -364,17 +364,17 @@ void RecognizeSystem::xmlParser(QByteArray array) if (value == "BASEDELETETRY") { - emit sigNotify(tr("Нельзя удалять базовую версию")); + emit sigNotify(tr("You cannot delete the basic version!")); } if (value == "TRYACTIVEDELETE") { - emit sigNotify(tr("Нельзя удалять активную версию")); + emit sigNotify(tr("You cannot delete the active version")); } if (value == "DUPLICATEVERNAME") { - emit sigNotify(tr("Такое имя уже существет")); + emit sigNotify(tr("This name already exists")); } } } diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp index 0046ee3..6f6a4c2 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -171,7 +171,7 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor")); updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName); - connectorToServer->setLoginName(loginInstructorLoggedInLocal); + connectorToServer->setLoginName(nameInstructorLoggedInLocal); QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!")); } else diff --git a/InstructorsAndTrainees/widgets/newversionwidget.ui b/InstructorsAndTrainees/widgets/newversionwidget.ui index 9ba102e..b5d4795 100644 --- a/InstructorsAndTrainees/widgets/newversionwidget.ui +++ b/InstructorsAndTrainees/widgets/newversionwidget.ui @@ -6,7 +6,7 @@ 0 0 - 325 + 344 200 @@ -61,18 +61,24 @@ - + 0 0 - Базовая версия: + Basic version: + + + 150 + 30 + + TextLabel @@ -92,15 +98,27 @@ 5 - 20 + 5 5 + + + 99 + 40 + + + + + 0 + 0 + + - Новое название: + New name version: @@ -108,8 +126,8 @@ - 0 - 0 + 150 + 30 @@ -126,6 +144,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -158,7 +189,7 @@ - Создать + Create @@ -187,7 +218,7 @@ - Отмена + Cancel diff --git a/InstructorsAndTrainees/widgets/versionselectwidget.cpp b/InstructorsAndTrainees/widgets/versionselectwidget.cpp index 60c15be..22b1b31 100644 --- a/InstructorsAndTrainees/widgets/versionselectwidget.cpp +++ b/InstructorsAndTrainees/widgets/versionselectwidget.cpp @@ -22,7 +22,7 @@ void VersionSelectWidget::initialize(SendSystem *sendSystem,VersionContainer *ve connect(this,&VersionSelectWidget::sigSendNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection); this->versionContainer = versionContainer; hide(); - setWindowTitle(tr("Управление версиями")); + setWindowTitle(tr("Version control")); } void VersionSelectWidget::fillView(QList *serverData) @@ -44,10 +44,10 @@ void VersionSelectWidget::on_verListView_itemDoubleClicked(QListWidgetItem *item { 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()); + QString info = tr("Version name: ") + data->getViewName() + "\n"; + info.append(tr("Created: ") + data->getCreateData().toString() + "\n"); + info.append(tr("Changeable: ") + changableText(data->getIsChangeable()) + "\n"); + info.append(tr("Author: ") + data->getAuthor()); ui->infoValue->setText(info); selectedVersion = data; } @@ -56,8 +56,8 @@ void VersionSelectWidget::on_verListView_itemDoubleClicked(QListWidgetItem *item QString VersionSelectWidget::changableText(bool flag) { - if(flag) return tr("Да"); - else return tr("Нет"); + if(flag) return tr("Yes"); + else return tr("No"); } @@ -74,7 +74,7 @@ void VersionSelectWidget::sendCopyEmit(QString newName) if (selectedVersion == nullptr) { - sigSendNotify(tr("Версия не выбрана")); + sigSendNotify(tr("Version not selected")); return; } @@ -86,7 +86,7 @@ void VersionSelectWidget::on_DeleteVersionButton_clicked() { if (selectedVersion == nullptr) { - sigSendNotify(tr("Версия не выбрана")); + sigSendNotify(tr("Version not selected")); return; } @@ -97,7 +97,7 @@ void VersionSelectWidget::on_switchServerVersionButton_clicked() { if (selectedVersion == nullptr) { - sigSendNotify(tr("Версия не выбрана")); + sigSendNotify(tr("Version not selected")); return; } diff --git a/InstructorsAndTrainees/widgets/versionselectwidget.ui b/InstructorsAndTrainees/widgets/versionselectwidget.ui index 6dbca69..af13a94 100644 --- a/InstructorsAndTrainees/widgets/versionselectwidget.ui +++ b/InstructorsAndTrainees/widgets/versionselectwidget.ui @@ -48,15 +48,15 @@ - Calibri - 12 + MS Shell Dlg 2 + 8 Qt::PreventContextMenu - Доступные версии на сервере + Available versions on the server: @@ -103,7 +103,7 @@ - Создать копию + Create copy @@ -127,7 +127,7 @@ - Удалить + Delete @@ -147,7 +147,7 @@ - Переключить версию сервера + Change server version @@ -175,7 +175,7 @@ - Информация: + Info: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -185,7 +185,7 @@ - Тут будет информация о версии... + Double click on the version to see information... Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -220,7 +220,7 @@ - Текущая версия сервера: + Current server version: diff --git a/ServerLMS/Data/StreamingVersionData.h b/ServerLMS/Data/StreamingVersionData.h index 752aecc..20c19c9 100644 --- a/ServerLMS/Data/StreamingVersionData.h +++ b/ServerLMS/Data/StreamingVersionData.h @@ -13,13 +13,21 @@ public: this->viewName = viewName; this->createData = data; this->size = size; - this->isChangeable = true; - this->author = ""; + this->isChangeable = false; } StreamingVersionData(){}; ~StreamingVersionData(); + void fill(StreamingVersionData* data) + { + this->absolutePath = data->getAbsolutPath(); + this->viewName = data->getViewName(); + this->createData = data->getCreateData(); + this->size = data->getSize(); + this->isChangeable = data->getIsChangeable(); + this->author = data->getAuthor(); + } QString getAbsolutPath() const { return absolutePath; diff --git a/ServerLMS/Systems/Parsers/processparser.cpp b/ServerLMS/Systems/Parsers/processparser.cpp index 083ea51..aa91cc2 100644 --- a/ServerLMS/Systems/Parsers/processparser.cpp +++ b/ServerLMS/Systems/Parsers/processparser.cpp @@ -59,6 +59,10 @@ void ProcessParser::read(ClientHandler *client, QByteArray array) clientNotify(xmlReader,client); } + else if(xmlReader.name() == "DataInfo") + { + clientDataInfo(xmlReader,client); + } else { emit sigLogMessage("XmlParser: unrecognized tag"); @@ -69,6 +73,25 @@ void ProcessParser::read(ClientHandler *client, QByteArray array) }//while(!xmlReader.atEnd()) } +void ProcessParser::clientDataInfo(QXmlStreamReader &xmlReader,ClientHandler *client) +{ + DataInfo *dataInfo = new DataInfo; + + foreach(const QXmlStreamAttribute &attr, xmlReader.attributes()) + { + QString name = attr.name().toString(); + QString value = attr.value().toString(); + + if(name == "path") + dataInfo->path= value.toUtf8(); + + if(name == "size") + dataInfo->size = value.toLong(); + } + + processingSystem->setCurrentDataInfo(dataInfo); + +} void ProcessParser::clientAuth(QXmlStreamReader &xmlReader,ClientHandler *client) { ClientAutorization clientAutorization; diff --git a/ServerLMS/Systems/Parsers/processparser.h b/ServerLMS/Systems/Parsers/processparser.h index fc8dc05..cf6f8f8 100644 --- a/ServerLMS/Systems/Parsers/processparser.h +++ b/ServerLMS/Systems/Parsers/processparser.h @@ -2,9 +2,9 @@ #define PROCESSPARSER_H #include -#include #include #include +#include "Data/typesDataServerClient.h" class ProcessParser : public QObject { @@ -26,6 +26,7 @@ private: void queryTasksXML(QXmlStreamReader &xmlReader,ClientHandler *client); void clientMessage(QXmlStreamReader &xmlReader,ClientHandler *client); void clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client); + void clientDataInfo(QXmlStreamReader &xmlReader, ClientHandler *client); }; #endif // PROCESSPARSER_H diff --git a/ServerLMS/Systems/assetsmanager.cpp b/ServerLMS/Systems/assetsmanager.cpp index 4f75ebb..b707f58 100644 --- a/ServerLMS/Systems/assetsmanager.cpp +++ b/ServerLMS/Systems/assetsmanager.cpp @@ -170,22 +170,13 @@ void AssetsManager::addVersion(StreamingVersionData *data) void AssetsManager::createCopyVersion(QString versionName,QString newVersionName,QString author) { qDebug() << "assetManager thread ID " << QThread::currentThreadId(); - QListIterator iterator(*datas); StreamingVersionData* data = new StreamingVersionData; - while (iterator.hasNext()) - { - StreamingVersionData *version = iterator.next(); - - if (version->getViewName() == versionName) - { - data->setAbsolutePath(version->getAbsolutPath()); - } - } - + data->setAbsolutePath(Tools::createSharedPath("/" + newVersionName)); data->setAuthor(author); data->setIsChangeable(true); data->setViewName(newVersionName); + data->setCreateData(QDateTime::currentDateTime()); datas->append(data); qDebug() << "Version for copy " << versionName; @@ -282,7 +273,7 @@ void AssetsManager::copyAllRecurse(QString source,QString destination) void AssetsManager::writeVersionsToFile(QList version,bool isFirst) { QList listTag; - + datas->clear(); QFile file(versionListFile); foreach(StreamingVersionData* ver,version) @@ -295,7 +286,9 @@ void AssetsManager::writeVersionsToFile(QList version,boo if(isFirst) { attribute3 = {"isChangeable",QString::number(false)}; - attribute4 = {"author",tr("Константа-дизайн")}; + QString author = tr("Константа-дизайн"); + attribute4 = {"author",author}; + ver->setAuthor(author); }else { attribute3 ={"isChangeable",QString::number(ver->getIsChangeable())}; @@ -337,10 +330,10 @@ void AssetsManager::writeVersionsToFile(QList version,boo void AssetsManager::createFirstVersionListXML(QList version) //TODO: переименовать и перебросить в AssetManager { QFile file(versionListFile); - + QList *temp = new QList(); if(!file.exists()) { - writeVersionsToFile(version,true); + writeVersionsToFile(version,true); } else { @@ -353,16 +346,20 @@ void AssetsManager::createFirstVersionListXML(QList versi { if(ver->getViewName() == data->getViewName()) { - data->setAbsolutePath(ver->getAbsolutPath()); + StreamingVersionData *tempData = new StreamingVersionData; + + tempData->fill(data); + tempData->setAbsolutePath(ver->getAbsolutPath()); + temp->append(tempData); + break; } } } - writeVersionsToFile(*datas,false); + writeVersionsToFile(*temp,false); } - } void AssetsManager::saveVersionToFile(StreamingVersionData *streamingVersion) //TODO: переименовать и перебросить в AssetManager diff --git a/ServerLMS/Systems/processingsystem.cpp b/ServerLMS/Systems/processingsystem.cpp index 7312f02..0adbfae 100644 --- a/ServerLMS/Systems/processingsystem.cpp +++ b/ServerLMS/Systems/processingsystem.cpp @@ -24,6 +24,7 @@ void ProcessingSystem::initialize(ServerLMSWidget *server, connect(this,&ProcessingSystem::sigAuthChanged,commonClientHandler, &CommonClientHandler::slot_AuthChanged,Qt::AutoConnection); connect(this,&ProcessingSystem::sigUpdateListClients,server, &ServerLMSWidget::slotUpdateListClients,Qt::AutoConnection); + connect(this,&ProcessingSystem::sigSetData,updateController,&UpdateController::setDataInfo,Qt::AutoConnection); connect(this,&ProcessingSystem::signal_msgToClientReady,commonClientHandler, &CommonClientHandler::slot_msgToClientFromGUI); connect(this,&ProcessingSystem::signal_msgFromClientReady,commonClientHandler, &CommonClientHandler::slot_msgToGUIfromClient); connect(this,&ProcessingSystem::sigLogMessage,logger,&Logger::addTextToLogger,Qt::QueuedConnection); @@ -335,5 +336,10 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif } } +void ProcessingSystem::setCurrentDataInfo(DataInfo *dataInfo) +{ + emit sigSetData(dataInfo); +} + diff --git a/ServerLMS/Systems/processingsystem.h b/ServerLMS/Systems/processingsystem.h index d412e7a..ca75dfa 100644 --- a/ServerLMS/Systems/processingsystem.h +++ b/ServerLMS/Systems/processingsystem.h @@ -38,6 +38,7 @@ public: void processingFromClientMessage(ClientHandler *client, ClientMessage clientMessage); void processingClientNotify(ClientHandler *client, ClientNotify clientNotify); + void setCurrentDataInfo(DataInfo *dataInfo); signals: void sigUpdateListClients(); void sigAuthChanged(); @@ -45,6 +46,7 @@ signals: void sigAddToMessanger(QString login,QString text); void signal_msgToClientReady(QString login, QString text); void signal_msgFromClientReady(QString login, QString text); + void sigSetData(DataInfo *dataInfo); private: CommonClientHandler *commonClientServer; diff --git a/ServerLMS/Systems/tools.cpp b/ServerLMS/Systems/tools.cpp index 68de94f..70e2093 100644 --- a/ServerLMS/Systems/tools.cpp +++ b/ServerLMS/Systems/tools.cpp @@ -66,6 +66,11 @@ QString Tools::createStreamingToRealPath(QString path,StreamingVersionData* stre } +QString Tools::createVersionHashFilepath(QString fileName) +{ + return staticDataFolderName + "/" + fileName + "Hash.xml"; +} + QString Tools::createUpdateFilePath(QString path) { //qDebug() << "Full path: " << path; diff --git a/ServerLMS/Systems/tools.h b/ServerLMS/Systems/tools.h index cf5fd3e..cd8840f 100644 --- a/ServerLMS/Systems/tools.h +++ b/ServerLMS/Systems/tools.h @@ -56,6 +56,7 @@ public: static QString createSharedPath(QString path); static QString createRealPath(QString path,StreamingVersionData* currentVersionData); static QString createStreamingToRealPath(QString path, StreamingVersionData *streamingVersionData); + static QString createVersionHashFilepath(QString fileName); }; diff --git a/ServerLMS/Systems/updatecontroller.cpp b/ServerLMS/Systems/updatecontroller.cpp index 2c55a2e..52264ec 100644 --- a/ServerLMS/Systems/updatecontroller.cpp +++ b/ServerLMS/Systems/updatecontroller.cpp @@ -193,6 +193,11 @@ void UpdateController::setUpCurrentServerHash() saveHash(hashFileName,fileList); } +void UpdateController::setDataInfo(DataInfo *value) +{ + dataInfo = value; +} + QString UpdateController::getCurrentStreamingPath() const { return currentStreamingPath; @@ -428,7 +433,7 @@ void UpdateController::calculateSharedHash() if (fileInfo.fileName() == "." || fileInfo.fileName() == "..") continue; - QString fileName = staticDataFolderName + "/" + fileInfo.fileName() + "Hash.xml"; + QString fileName = Tools::createVersionHashFilepath(fileInfo.fileName()); fileList = calculateHash(fileInfo.absoluteFilePath()); saveHash(fileName,fileList); diff --git a/ServerLMS/Systems/updatecontroller.h b/ServerLMS/Systems/updatecontroller.h index 1104ce8..0abbbdd 100644 --- a/ServerLMS/Systems/updatecontroller.h +++ b/ServerLMS/Systems/updatecontroller.h @@ -56,6 +56,8 @@ public: QString getPathAdditionalFile(QString name); StreamingVersionData *getCurrentVersion(); + void setDataInfo(DataInfo *value); + public slots: void changeAssetVersion(QString versionName); void createCopyVersion(QString versionName,QString newVersionName,QString author);