mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Рефакт
This commit is contained in:
@@ -40,11 +40,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
||||
|
||||
updateMyStyleSheet();
|
||||
|
||||
setLanguageInterfase();
|
||||
|
||||
startInitialization();
|
||||
|
||||
tryConnectionToDB();
|
||||
setLanguageInterfase();
|
||||
}
|
||||
|
||||
ServerLMSWidget::~ServerLMSWidget()
|
||||
@@ -95,10 +91,12 @@ void ServerLMSWidget::changeEvent(QEvent *event)
|
||||
dbSettings.dbHostName,
|
||||
QString::number(dbSettings.dbPort));
|
||||
ui->lblDBsettings->setText(strDBsettings);
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lblDBsettings->setText("");
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,17 +124,25 @@ void ServerLMSWidget::slot_AddMessageToLog(QString message)
|
||||
ui->loggerTextField->appendPlainText(message);
|
||||
}
|
||||
|
||||
void ServerLMSWidget::start()
|
||||
{
|
||||
startInitialization();
|
||||
tryConnectionToDB();
|
||||
}
|
||||
|
||||
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!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
server->unBlockAutorization();
|
||||
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png")));
|
||||
//emit signal_Tray_ShowMessage(tr("Authorization unblocked!"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +203,7 @@ void ServerLMSWidget::on_btnSettings_clicked()
|
||||
providerDBLMS->DisConnectionFromDB();
|
||||
|
||||
ui->lblDBsettings->setText("");
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||
|
||||
QMessageBox::warning(this, tr("Warning!"), tr("Database settings have been changed.\nThe server will be restarted."));
|
||||
|
||||
@@ -315,9 +322,12 @@ void ServerLMSWidget::tryConnectionToDB()
|
||||
if(! providerDBLMS->ConnectionToDB())
|
||||
{
|
||||
ui->lblDBsettings->setText("");
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
ui->btnStopServer->setEnabled(false);
|
||||
ui->btnStartServer->setEnabled(false);
|
||||
QMessageBox::critical(this, tr("Error!"), tr("Database connection error"));
|
||||
//QMessageBox::critical(this, tr("Error!"), tr("Database connection error!"));
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Database connection error!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -330,6 +340,9 @@ void ServerLMSWidget::tryConnectionToDB()
|
||||
dbSettings.dbHostName,
|
||||
QString::number(dbSettings.dbPort));
|
||||
ui->lblDBsettings->setText(strDBsettings);
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Database connection OK!") + "\n" + strDBsettings);
|
||||
|
||||
on_btnStartServer_clicked();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user