diff --git a/LibServer/resources/icons/lock.png b/LibServer/resources/icons/lock.png index e970b1e..0cd09ca 100644 Binary files a/LibServer/resources/icons/lock.png and b/LibServer/resources/icons/lock.png differ diff --git a/LibServer/resources/icons/old/lock.png b/LibServer/resources/icons/old/lock.png new file mode 100644 index 0000000..e970b1e Binary files /dev/null and b/LibServer/resources/icons/old/lock.png differ diff --git a/LibServer/resources/icons/old/stop.png b/LibServer/resources/icons/old/stop.png new file mode 100644 index 0000000..d9122fd Binary files /dev/null and b/LibServer/resources/icons/old/stop.png differ diff --git a/LibServer/resources/icons/stop.png b/LibServer/resources/icons/stop.png index d9122fd..286e53f 100644 Binary files a/LibServer/resources/icons/stop.png and b/LibServer/resources/icons/stop.png differ diff --git a/LibServer/serverlmswidget.cpp b/LibServer/serverlmswidget.cpp index 6d1a9a5..95f63eb 100644 --- a/LibServer/serverlmswidget.cpp +++ b/LibServer/serverlmswidget.cpp @@ -57,6 +57,8 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) : waitAnimationWidget->initialize(movie,this); waitAnimationWidget->showWithPlay(); + + updateStateOnlyVersion(); } ServerLMSWidget::~ServerLMSWidget() @@ -100,7 +102,9 @@ void ServerLMSWidget::changeEvent(QEvent *event) { ui->retranslateUi(this); // переведём окно заново - updateStateServer(); + updateStateOnlyServer(); + updateStateOnlyDB(); + updateStateOnlyVersion(); } } @@ -161,7 +165,9 @@ void ServerLMSWidget::slot_startInitialization_step1() flStartInitialization = true; - updateStateServer(); + updateStateOnlyServer(); + updateStateOnlyDB(); + updateStateOnlyVersion(); QApplication::restoreOverrideCursor(); @@ -177,7 +183,7 @@ void ServerLMSWidget::slot_startInitialization_step1() void ServerLMSWidget::slot_setVersion(QString versionStr) { this->versionStr = versionStr; - ui->lblVersionText->setText(versionStr); + updateStateOnlyVersion(); } void ServerLMSWidget::start() @@ -191,17 +197,41 @@ void ServerLMSWidget::slot_BlockAutorization(bool block) if(block) { server->blockAutorization(); - ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png"))); + //ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png"))); //emit signal_Tray_ShowMessage(tr("Authorization blocked!")); } else { server->unBlockAutorization(); - ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png"))); + //ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png"))); //emit signal_Tray_ShowMessage(tr("Authorization unblocked!")); } //updateStateServer(); - emit signal_updateStateServer(server->getStateServer(), server->getStateBlockAutorization()); + //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()); + } } void ServerLMSWidget::slot_LanguageChanged(QString language) @@ -223,7 +253,7 @@ void ServerLMSWidget::on_btnStartServer_clicked() ui->btnStopServer->setEnabled(true); slot_BlockAutorization(false); - updateStateServer(); + updateStateOnlyServer(); emit signal_Tray_ShowMessage(tr("Server is started!")); } @@ -237,7 +267,7 @@ void ServerLMSWidget::on_btnStopServer_clicked() ui->btnStartServer->setEnabled(true); slot_BlockAutorization(true); - updateStateServer(); + updateStateOnlyServer(); emit signal_Tray_ShowMessage(tr("Server is stoped!")); } @@ -275,7 +305,7 @@ void ServerLMSWidget::on_btnSettings_clicked() providerDBLMS->DisConnectionFromDB(); - updateStateServer(); + updateStateOnlyDB(); SpecMsgBox::WarningClose(this, tr("Database settings have been changed.\nThe server will be restarted.")); @@ -296,12 +326,12 @@ void ServerLMSWidget::slot_trySetServerState(PacketType packetType) if (packetType == PacketType::BUSY) { server->blockAutorization(); - updateStateServer(); + updateStateOnlyServer(); } else if (packetType == PacketType::FREE) { server->unBlockAutorization(); - updateStateServer(); + updateStateOnlyServer(); } } @@ -440,36 +470,38 @@ void ServerLMSWidget::tryConnectionToDB() on_btnStartServer_clicked(); } - updateStateServer(); + updateStateOnlyDB(); } -void ServerLMSWidget::updateStateServer() +void ServerLMSWidget::updateStateOnlyServer() { if(server) { if(server->getStateServer() == EStateServer::started) { - ui->lblOnOffText->setText(tr("started")); - ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png"))); + 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/circleGray.png"))); - } - - if(server->getStateBlockAutorization() == EStateBlockAutorization::unblocked) - { - ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png"))); - } - else - { - ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png"))); + ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/stop.png"))); } emit signal_updateStateServer(server->getStateServer(), server->getStateBlockAutorization()); } +} +void ServerLMSWidget::updateStateOnlyDB() +{ if(providerDBLMS) { if(providerDBLMS->DBisConnected()) @@ -492,6 +524,9 @@ void ServerLMSWidget::updateStateServer() ui->btnStartServer->setEnabled(false); } } +} +void ServerLMSWidget::updateStateOnlyVersion() +{ ui->lblVersionText->setText(versionStr); } diff --git a/LibServer/serverlmswidget.h b/LibServer/serverlmswidget.h index 54ee0bb..8c1d26d 100644 --- a/LibServer/serverlmswidget.h +++ b/LibServer/serverlmswidget.h @@ -155,7 +155,9 @@ private: void tryConnectionToDB(); - void updateStateServer(); + void updateStateOnlyServer(); + void updateStateOnlyDB(); + void updateStateOnlyVersion(); private: Ui::ServerLMSWidget *ui; diff --git a/LibServer/serverlmswidget.ui b/LibServer/serverlmswidget.ui index 24272ee..cf72489 100644 --- a/LibServer/serverlmswidget.ui +++ b/LibServer/serverlmswidget.ui @@ -68,7 +68,7 @@ Start - + :/resources/icons/rocket.png:/resources/icons/rocket.png @@ -109,7 +109,7 @@ Stop - + :/resources/icons/stop.png:/resources/icons/stop.png @@ -148,7 +148,7 @@ Settings - + :/resources/icons/settings.png:/resources/icons/settings.png @@ -250,7 +250,7 @@ - :/resources/icons/circleGray.png + :/resources/icons/circleGray.png true @@ -268,7 +268,7 @@ - 100 + 200 0 @@ -305,7 +305,7 @@ - :/resources/icons/circleGray.png + :/resources/icons/circleGray.png @@ -374,61 +374,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Authorization - - - - - - - - 0 - 0 - - - - - 32 - 32 - - - - - 32 - 32 - - - - - - - :/resources/icons/lock.png - - - true - - - - - @@ -436,8 +381,8 @@ - - + +