diff --git a/InstructorsAndTrainees/settings/dialogsettings.ui b/InstructorsAndTrainees/settings/dialogsettings.ui index bb28e7e..1115f5c 100644 --- a/InstructorsAndTrainees/settings/dialogsettings.ui +++ b/InstructorsAndTrainees/settings/dialogsettings.ui @@ -26,7 +26,7 @@ Settings - + :/resources/icons/lms.png:/resources/icons/lms.png @@ -242,7 +242,7 @@ Save - + :/resources/icons/circleGreen.png:/resources/icons/circleGreen.png @@ -301,7 +301,7 @@ Version - + :/resources/icons/updateVersion.png:/resources/icons/updateVersion.png @@ -333,7 +333,7 @@ Style - + :/resources/icons/style.png:/resources/icons/style.png @@ -370,7 +370,7 @@ - + diff --git a/ServerLMS/ServerLMS.qrc b/ServerLMS/ServerLMS.qrc index 42b4a34..70fc525 100644 --- a/ServerLMS/ServerLMS.qrc +++ b/ServerLMS/ServerLMS.qrc @@ -19,5 +19,6 @@ resources/icons/checkDB.png resources/icons/editorDB.png resources/icons/procedure.png + resources/icons/exchange.png diff --git a/ServerLMS/Systems/docsupdater.cpp b/ServerLMS/Systems/docsupdater.cpp index 5b1e334..26befc6 100644 --- a/ServerLMS/Systems/docsupdater.cpp +++ b/ServerLMS/Systems/docsupdater.cpp @@ -3,9 +3,9 @@ #include "tools.h" -DocsUpdater::DocsUpdater(UpdateController* updateController, QWidget *parentWidget): +DocsUpdater::DocsUpdater(UpdateController* updateController, QObject *parent): + QObject(parent), updateController(updateController), - parentWidget(parentWidget), flagStop(false) { @@ -16,7 +16,7 @@ DocsUpdater::~DocsUpdater() } -bool DocsUpdater::update() +bool DocsUpdater::slot_update() { QMutexLocker locker(&mtxAccess); diff --git a/ServerLMS/Systems/docsupdater.h b/ServerLMS/Systems/docsupdater.h index 2ae0377..efa3074 100644 --- a/ServerLMS/Systems/docsupdater.h +++ b/ServerLMS/Systems/docsupdater.h @@ -1,17 +1,21 @@ #ifndef DOCSUPDATER_H #define DOCSUPDATER_H +#include #include "updatecontroller.h" #include "module.h" -class DocsUpdater +class DocsUpdater : public QObject { + Q_OBJECT + public: - DocsUpdater(UpdateController* updateController, QWidget *parentWidget); + DocsUpdater(UpdateController* updateController, QObject *parent = nullptr); ~DocsUpdater(); - bool update(); +public slots: + bool slot_update(); private: void domElementParserAMM(QDomElement element, Module* moduleParent); @@ -21,7 +25,6 @@ private: private: UpdateController* updateController; - QWidget *parentWidget; QMutex mtxAccess; bool flagStop; QList listAllModulesAMM; //? diff --git a/ServerLMS/resources/icons/exchange.png b/ServerLMS/resources/icons/exchange.png new file mode 100644 index 0000000..5293068 Binary files /dev/null and b/ServerLMS/resources/icons/exchange.png differ diff --git a/ServerLMS/serverlmswidget.cpp b/ServerLMS/serverlmswidget.cpp index 4f951a8..2761921 100644 --- a/ServerLMS/serverlmswidget.cpp +++ b/ServerLMS/serverlmswidget.cpp @@ -59,6 +59,7 @@ ServerLMSWidget::~ServerLMSWidget() delete dataParser; delete processingSystem; delete updateController; + delete docsUpdater; delete assetsManager; delete chatSystem; @@ -114,6 +115,13 @@ void ServerLMSWidget::slot_ErrorPostgreSQL(QString text) QMessageBox::critical(this, tr("Error PostgreSQL!"),text); } +void ServerLMSWidget::slot_UpdateDocs() +{ + QApplication::setOverrideCursor(Qt::WaitCursor); + emit signal_DocsUpdaterUpdate(); + QApplication::restoreOverrideCursor(); +} + void ServerLMSWidget::start() { startInitialization(); @@ -190,6 +198,8 @@ void ServerLMSWidget::on_btnSettings_clicked() connect(&dlg, &DialogSettingsTray::signal_LanguageChanged, this, &ServerLMSWidget::slot_LanguageChanged); //connect(&dlg, &DialogSettingsTray::signal_UpdateStyleSheet, this, &ServerLMSWidget::slot_UpdateStyleSheet); + connect(&dlg, &DialogSettingsTray::signal_UpdateDocs, this, &ServerLMSWidget::slot_UpdateDocs); + switch( dlg.exec() ) { @@ -271,6 +281,8 @@ QString ServerLMSWidget::loadStyleSheet() void ServerLMSWidget::startInitialization() { + QApplication::setOverrideCursor(Qt::WaitCursor); + providerDBLMS = new ProviderDBLMS(this); connect(providerDBLMS, &ProviderDBLMS::signal_ErrorPostgreSQL, this, &ServerLMSWidget::slot_ErrorPostgreSQL); connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization); @@ -315,7 +327,9 @@ void ServerLMSWidget::startInitialization() emit sigUpdateController(commonClientHandler,dataParser,assetsManager); docsUpdater = new DocsUpdater(updateController, this); - docsUpdater->update(); + connect(this, &ServerLMSWidget::signal_DocsUpdaterUpdate, docsUpdater, &DocsUpdater::slot_update,Qt::DirectConnection); + docsUpdater->moveToThread(updateThread); + slot_UpdateDocs(); ui->btnStopServer->setEnabled(false); ui->btnStartServer->setEnabled(true); @@ -323,6 +337,8 @@ void ServerLMSWidget::startInitialization() flStartInitialization = true; updateStateServer(); + + QApplication::restoreOverrideCursor(); } void ServerLMSWidget::tryConnectionToDB() diff --git a/ServerLMS/serverlmswidget.h b/ServerLMS/serverlmswidget.h index ad9dc97..151a7da 100644 --- a/ServerLMS/serverlmswidget.h +++ b/ServerLMS/serverlmswidget.h @@ -78,6 +78,8 @@ signals: void sigUpdateController(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager); QTcpSocket* sigGetSocket(); + void signal_DocsUpdaterUpdate(); + public slots: void slot_LanguageChanged(QString language); void slot_UpdateListClients(); @@ -86,6 +88,8 @@ public slots: void slot_ErrorPostgreSQL(QString text); + void slot_UpdateDocs(); + public: QString getLanguage() { diff --git a/ServerLMS/settings/dialogsettingstray.cpp b/ServerLMS/settings/dialogsettingstray.cpp index 6e5951c..93c636f 100644 --- a/ServerLMS/settings/dialogsettingstray.cpp +++ b/ServerLMS/settings/dialogsettingstray.cpp @@ -17,6 +17,7 @@ DialogSettingsTray::DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *pa ui->btnSave->setObjectName("btnSave"); ui->btnCheckDB->setObjectName("btnCheckDB"); + ui->btnUpdateDocs->setObjectName("btnUpdateDocs"); /* Создаем строку для регулярного выражения */ QString ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"; @@ -349,3 +350,8 @@ void DialogSettingsTray::on_btnCheckDB_clicked() return; } } + +void DialogSettingsTray::on_btnUpdateDocs_clicked() +{ + emit signal_UpdateDocs(); +} diff --git a/ServerLMS/settings/dialogsettingstray.h b/ServerLMS/settings/dialogsettingstray.h index 183579c..92d03b2 100644 --- a/ServerLMS/settings/dialogsettingstray.h +++ b/ServerLMS/settings/dialogsettingstray.h @@ -38,6 +38,7 @@ public: signals: //сигнал об изменении языка интерфейса void signal_LanguageChanged(QString language); + void signal_UpdateDocs(); private slots: void on_btnSave_clicked(); @@ -60,6 +61,8 @@ private slots: void on_checkLocalhost_stateChanged(int arg1); + void on_btnUpdateDocs_clicked(); + private: bool saveSettings(); diff --git a/ServerLMS/settings/dialogsettingstray.ui b/ServerLMS/settings/dialogsettingstray.ui index 068919b..83bf914 100644 --- a/ServerLMS/settings/dialogsettingstray.ui +++ b/ServerLMS/settings/dialogsettingstray.ui @@ -6,7 +6,7 @@ 0 0 - 450 + 550 400 @@ -245,7 +245,7 @@ Check&&Repare - + :/resources/icons/checkDB.png:/resources/icons/checkDB.png @@ -293,7 +293,7 @@ Save - + :/resources/icons/circleGreen.png:/resources/icons/circleGreen.png @@ -314,13 +314,65 @@ + + + + Additional + + + + + + + + + 80 + 58 + + + + Update Docs + + + + :/resources/icons/exchange.png:/resources/icons/exchange.png + + + + 32 + 32 + + + + Qt::ToolButtonTextUnderIcon + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + - - + +