diff --git a/LibInstructorsAndTrainees/tasks/fimtaskswidget.ui b/LibInstructorsAndTrainees/tasks/fimtaskswidget.ui index 8a3fbed..2ccac45 100644 --- a/LibInstructorsAndTrainees/tasks/fimtaskswidget.ui +++ b/LibInstructorsAndTrainees/tasks/fimtaskswidget.ui @@ -54,7 +54,7 @@ Assign - + :/resources/icons/assignTask.png:/resources/icons/assignTask.png @@ -80,7 +80,7 @@ Check - + :/resources/icons/check.png:/resources/icons/check.png @@ -106,7 +106,7 @@ Delete - + :/resources/icons/delete.png:/resources/icons/delete.png @@ -129,7 +129,7 @@ - + diff --git a/LibServer/serverlmswidget.cpp b/LibServer/serverlmswidget.cpp index 95f63eb..51c9c17 100644 --- a/LibServer/serverlmswidget.cpp +++ b/LibServer/serverlmswidget.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include "serverlmswidget.h" @@ -141,7 +140,7 @@ void ServerLMSWidget::slot_AddMessageToLog(QString message) void ServerLMSWidget::slot_ErrorPostgreSQL(QString text) { emit signal_Menu_ShowWindow(); - SpecMsgBox::CriticalClose(this, tr("Error PostgreSQL!")); + SpecMsgBox::CriticalClose(this, tr("Error PostgreSQL!") + "\n" + text); } void ServerLMSWidget::slot_UpdateDocs() @@ -183,13 +182,13 @@ void ServerLMSWidget::slot_startInitialization_step1() void ServerLMSWidget::slot_setVersion(QString versionStr) { this->versionStr = versionStr; + Logger::instance().log("Set Version: " + versionStr); updateStateOnlyVersion(); } void ServerLMSWidget::start() { startInitialization_step0(); - } void ServerLMSWidget::slot_BlockAutorization(bool block) @@ -197,41 +196,14 @@ void ServerLMSWidget::slot_BlockAutorization(bool block) if(block) { server->blockAutorization(); - //ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png"))); - //emit signal_Tray_ShowMessage(tr("Authorization blocked!")); + Logger::instance().log("Autorization is blocked"); } else { server->unBlockAutorization(); - //ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png"))); - //emit signal_Tray_ShowMessage(tr("Authorization unblocked!")); - } - //updateStateServer(); - //emit signal_updateStateServer(server->getStateServer(), server->getStateBlockAutorization()); - - if(server) - { - if(server->getStateServer() == EStateServer::started) - { - if(server->getStateBlockAutorization() == EStateBlockAutorization::unblocked) - { - ui->lblOnOffText->setText(tr("started")); - ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png"))); - } - else - { - ui->lblOnOffText->setText(tr("started") + ", " + tr("locked")); - ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png"))); - } - } - else - { - ui->lblOnOffText->setText(tr("stoped")); - ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/stop.png"))); - } - - emit signal_updateStateServer(server->getStateServer(), server->getStateBlockAutorization()); + Logger::instance().log("Autorization is unblocked"); } + updateStateOnlyServer(); } void ServerLMSWidget::slot_LanguageChanged(QString language) @@ -247,7 +219,6 @@ void ServerLMSWidget::on_btnStartServer_clicked() if(server->startServer()) { QApplication::setOverrideCursor(Qt::WaitCursor); - QApplication::restoreOverrideCursor(); ui->btnStartServer->setEnabled(false); ui->btnStopServer->setEnabled(true); @@ -256,6 +227,8 @@ void ServerLMSWidget::on_btnStartServer_clicked() updateStateOnlyServer(); emit signal_Tray_ShowMessage(tr("Server is started!")); + + QApplication::restoreOverrideCursor(); } } @@ -263,6 +236,8 @@ void ServerLMSWidget::on_btnStopServer_clicked() { if(server->stopServer()) { + QApplication::setOverrideCursor(Qt::WaitCursor); + ui->btnStopServer->setEnabled(false); ui->btnStartServer->setEnabled(true); slot_BlockAutorization(true); @@ -270,6 +245,8 @@ void ServerLMSWidget::on_btnStopServer_clicked() updateStateOnlyServer(); emit signal_Tray_ShowMessage(tr("Server is stoped!")); + + QApplication::restoreOverrideCursor(); } } @@ -409,41 +386,43 @@ void ServerLMSWidget::startInitialization_step0() processingSystem = new ProcessingSystem(providerDBLMS, updateController, docsUpdater); - dataParser = new DataParser(assetsManager,processingSystem); + dataParser = new DataParser(assetsManager, processingSystem); commonClientHandler = new CommonClientHandler; - connect(this,&ServerLMSWidget::signal_DocsChanged,commonClientHandler, &CommonClientHandler::slot_DocsChanged); - connect(commonClientHandler,&CommonClientHandler::sigSetServerState,this,&ServerLMSWidget::slot_trySetServerState); + connect(this, &ServerLMSWidget::signal_DocsChanged, commonClientHandler, &CommonClientHandler::slot_DocsChanged); + connect(commonClientHandler, &CommonClientHandler::sigSetServerState, this, &ServerLMSWidget::slot_trySetServerState); - server = new MultiThreadServer(this,updateController,processingSystem,dataParser,6000); + server = new MultiThreadServer(this, updateController, processingSystem, dataParser, 6000); loggerThread->start(); updateThread->start(); - commonClientHandler->initialize(server->getClientsMap(),processingSystem,dataParser); - processingSystem->initialize(server,dataParser,commonClientHandler,updateController,chatSystem); - chatSystem->initialize(commonClientHandler,dataParser,server->getClientsMap()); + commonClientHandler->initialize(server->getClientsMap(), processingSystem, dataParser); + processingSystem->initialize(server, dataParser, commonClientHandler, updateController, chatSystem); + chatSystem->initialize(commonClientHandler, dataParser, server->getClientsMap()); Logger::instance().moveToThread(loggerThread); Logger::instance().setLoggingType(LoggingType::WIDGET); Logger::instance().setLogToFile(true); - connect(this,&ServerLMSWidget::sigUpdateControllerInitialize,updateController,&UpdateController::initialize/*,Qt::DirectConnection*/); - connect(updateController,&UpdateController::sigInitializeFinished, this,&ServerLMSWidget::slot_startInitialization_step1/*,Qt::DirectConnection*/); - connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection); - connect(updateController,&UpdateController::sigErrorRequired,this,&ServerLMSWidget::setError); - connect(updateController,&UpdateController::sigUpdateDocs,this,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection); - connect(&Logger::instance(),&Logger::sigLogToWidget,this, &ServerLMSWidget::slot_AddMessageToLog,Qt::QueuedConnection); + connect(this, &ServerLMSWidget::sigUpdateControllerInitialize, updateController, &UpdateController::initialize); + connect(updateController, &UpdateController::sigInitializeFinished, this, &ServerLMSWidget::slot_startInitialization_step1); + connect(this, &ServerLMSWidget::sigCalculateFullHash, updateController, &UpdateController::calculateFullHash, Qt::AutoConnection); + connect(updateController, &UpdateController::sigErrorRequired, this, &ServerLMSWidget::setError); + connect(updateController, &UpdateController::sigUpdateDocs, this, &ServerLMSWidget::slot_UpdateDocs, Qt::AutoConnection); + connect(&Logger::instance(), &Logger::sigLogToWidget, this, &ServerLMSWidget::slot_AddMessageToLog, Qt::QueuedConnection); - connect(assetsManager,&AssetsManager::signal_setVersion, this, &ServerLMSWidget::slot_setVersion); + connect(assetsManager, &AssetsManager::signal_setVersion, this, &ServerLMSWidget::slot_setVersion); - emit sigUpdateControllerInitialize(commonClientHandler,dataParser,assetsManager); + emit sigUpdateControllerInitialize(commonClientHandler, dataParser, assetsManager); } void ServerLMSWidget::tryConnectionToDB() { if(! providerDBLMS->ConnectionToDB()) { + Logger::instance().log("Database connection error!"); + emit signal_Tray_ShowMessage(tr("Database connection error!"), QSystemTrayIcon::Critical); emit signal_Menu_ShowWindow(); diff --git a/LibServer/serverlmswidget.h b/LibServer/serverlmswidget.h index 8c1d26d..aa5a93f 100644 --- a/LibServer/serverlmswidget.h +++ b/LibServer/serverlmswidget.h @@ -82,7 +82,6 @@ signals: void sigRecognize(); void sigCalculateFullHash(); void sigUpdateControllerInitialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager); - QTcpSocket* sigGetSocket(); void signal_DocsChanged(); void signal_hasError(int code); @@ -103,6 +102,8 @@ public slots: void slot_setVersion(QString versionStr); + void slot_trySetServerState(PacketType packetType); + public: QString getLanguage() { @@ -143,8 +144,7 @@ public: private slots: void on_btnStartServer_clicked(); void on_btnStopServer_clicked(); - void on_btnSettings_clicked(); - void slot_trySetServerState(PacketType packetType); + void on_btnSettings_clicked(); private: void setLanguageInterfase(); diff --git a/ProgramAWSinstructorMPS/ProgramAWSinstructorMPS.qrc b/ProgramAWSinstructorMPS/ProgramAWSinstructorMPS.qrc index 491b03b..0b99e1b 100644 --- a/ProgramAWSinstructorMPS/ProgramAWSinstructorMPS.qrc +++ b/ProgramAWSinstructorMPS/ProgramAWSinstructorMPS.qrc @@ -1,6 +1,6 @@ - resources/IcoGUIRRJ.ico resources/PngGUIRRJ.png + resources/IcoGUIRRJ.ico diff --git a/ProgramServerMPS/mainwindow.cpp b/ProgramServerMPS/mainwindow.cpp index 0b34228..9f2c547 100644 --- a/ProgramServerMPS/mainwindow.cpp +++ b/ProgramServerMPS/mainwindow.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -68,7 +67,7 @@ MainWindow::MainWindow(QWidget *parent) : slot_Tray_ShowMessage(tr("Starting the server...")); - QTimer::singleShot(1000,this,&MainWindow::slot_LazyInitialization); + QTimer::singleShot(1000, this, &MainWindow::slot_LazyInitialization); } MainWindow::~MainWindow() @@ -153,11 +152,6 @@ void MainWindow::slot_TrayMenu_HideWindow() this->hide(); action_ShowWindow->setEnabled(true); action_HideWindow->setEnabled(false); - - /* - slot_Tray_ShowMessage(tr("The application is minimized to the tray.\n" - "To maximize the application window, click the application icon in the tray.")); - */ } void MainWindow::slot_TrayMenu_Exit() @@ -169,9 +163,7 @@ void MainWindow::slot_TrayMenu_Exit() void MainWindow::slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg) { QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon(iconMsg); - trayIcon->showMessage(tr("Server MPS"), - textMsg, - icon, 100); + trayIcon->showMessage(tr("Server MPS"), textMsg, icon, 100); } void MainWindow::slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization) @@ -230,7 +222,7 @@ void MainWindow::errorCheck() slot_TrayMenu_ShowWindow(); //выключение с задержкой, так как eventLoop инициализируется позже - QTimer::singleShot(1000,this,&MainWindow::slot_TrayMenu_Exit); + QTimer::singleShot(1000, this, &MainWindow::slot_TrayMenu_Exit); } } diff --git a/ProgramServerMPS/mainwindow.h b/ProgramServerMPS/mainwindow.h index de3cecc..191d9ff 100644 --- a/ProgramServerMPS/mainwindow.h +++ b/ProgramServerMPS/mainwindow.h @@ -52,13 +52,14 @@ public slots: //Слот вывода сообщения из трея void slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information); - //Слот изменения иконки трея + //Слот изменения иконки трея о статусе Сервера void slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization); //Слот отложенной инициализации void slot_LazyInitialization(); void slot_hasError(int code); + private: void exit(); void errorCheck();