mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Нотификация рефакт
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user