mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-29 20:05:38 +03:00
refact
This commit is contained in:
@@ -54,7 +54,7 @@
|
|||||||
<string>Assign</string>
|
<string>Assign</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../resources.qrc">
|
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||||
<normaloff>:/resources/icons/assignTask.png</normaloff>:/resources/icons/assignTask.png</iconset>
|
<normaloff>:/resources/icons/assignTask.png</normaloff>:/resources/icons/assignTask.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<string>Check</string>
|
<string>Check</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../resources.qrc">
|
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||||
<normaloff>:/resources/icons/check.png</normaloff>:/resources/icons/check.png</iconset>
|
<normaloff>:/resources/icons/check.png</normaloff>:/resources/icons/check.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
<string>Delete</string>
|
<string>Delete</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../resources.qrc">
|
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||||
<normaloff>:/resources/icons/delete.png</normaloff>:/resources/icons/delete.png</iconset>
|
<normaloff>:/resources/icons/delete.png</normaloff>:/resources/icons/delete.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../resources.qrc"/>
|
<include location="../InstructorsAndTrainees.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QXmlStreamAttribute>
|
#include <QXmlStreamAttribute>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QErrorMessage>
|
#include <QErrorMessage>
|
||||||
#include "serverlmswidget.h"
|
#include "serverlmswidget.h"
|
||||||
@@ -141,7 +140,7 @@ void ServerLMSWidget::slot_AddMessageToLog(QString message)
|
|||||||
void ServerLMSWidget::slot_ErrorPostgreSQL(QString text)
|
void ServerLMSWidget::slot_ErrorPostgreSQL(QString text)
|
||||||
{
|
{
|
||||||
emit signal_Menu_ShowWindow();
|
emit signal_Menu_ShowWindow();
|
||||||
SpecMsgBox::CriticalClose(this, tr("Error PostgreSQL!"));
|
SpecMsgBox::CriticalClose(this, tr("Error PostgreSQL!") + "\n" + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLMSWidget::slot_UpdateDocs()
|
void ServerLMSWidget::slot_UpdateDocs()
|
||||||
@@ -183,13 +182,13 @@ void ServerLMSWidget::slot_startInitialization_step1()
|
|||||||
void ServerLMSWidget::slot_setVersion(QString versionStr)
|
void ServerLMSWidget::slot_setVersion(QString versionStr)
|
||||||
{
|
{
|
||||||
this->versionStr = versionStr;
|
this->versionStr = versionStr;
|
||||||
|
Logger::instance().log("Set Version: " + versionStr);
|
||||||
updateStateOnlyVersion();
|
updateStateOnlyVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLMSWidget::start()
|
void ServerLMSWidget::start()
|
||||||
{
|
{
|
||||||
startInitialization_step0();
|
startInitialization_step0();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||||
@@ -197,41 +196,14 @@ void ServerLMSWidget::slot_BlockAutorization(bool block)
|
|||||||
if(block)
|
if(block)
|
||||||
{
|
{
|
||||||
server->blockAutorization();
|
server->blockAutorization();
|
||||||
//ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
|
Logger::instance().log("Autorization is blocked");
|
||||||
//emit signal_Tray_ShowMessage(tr("Authorization blocked!"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server->unBlockAutorization();
|
server->unBlockAutorization();
|
||||||
//ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png")));
|
Logger::instance().log("Autorization is unblocked");
|
||||||
//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());
|
|
||||||
}
|
}
|
||||||
|
updateStateOnlyServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLMSWidget::slot_LanguageChanged(QString language)
|
void ServerLMSWidget::slot_LanguageChanged(QString language)
|
||||||
@@ -247,7 +219,6 @@ void ServerLMSWidget::on_btnStartServer_clicked()
|
|||||||
if(server->startServer())
|
if(server->startServer())
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
|
|
||||||
ui->btnStartServer->setEnabled(false);
|
ui->btnStartServer->setEnabled(false);
|
||||||
ui->btnStopServer->setEnabled(true);
|
ui->btnStopServer->setEnabled(true);
|
||||||
@@ -256,6 +227,8 @@ void ServerLMSWidget::on_btnStartServer_clicked()
|
|||||||
updateStateOnlyServer();
|
updateStateOnlyServer();
|
||||||
|
|
||||||
emit signal_Tray_ShowMessage(tr("Server is started!"));
|
emit signal_Tray_ShowMessage(tr("Server is started!"));
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,6 +236,8 @@ void ServerLMSWidget::on_btnStopServer_clicked()
|
|||||||
{
|
{
|
||||||
if(server->stopServer())
|
if(server->stopServer())
|
||||||
{
|
{
|
||||||
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
ui->btnStopServer->setEnabled(false);
|
ui->btnStopServer->setEnabled(false);
|
||||||
ui->btnStartServer->setEnabled(true);
|
ui->btnStartServer->setEnabled(true);
|
||||||
slot_BlockAutorization(true);
|
slot_BlockAutorization(true);
|
||||||
@@ -270,6 +245,8 @@ void ServerLMSWidget::on_btnStopServer_clicked()
|
|||||||
updateStateOnlyServer();
|
updateStateOnlyServer();
|
||||||
|
|
||||||
emit signal_Tray_ShowMessage(tr("Server is stoped!"));
|
emit signal_Tray_ShowMessage(tr("Server is stoped!"));
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,8 +405,8 @@ void ServerLMSWidget::startInitialization_step0()
|
|||||||
Logger::instance().setLoggingType(LoggingType::WIDGET);
|
Logger::instance().setLoggingType(LoggingType::WIDGET);
|
||||||
Logger::instance().setLogToFile(true);
|
Logger::instance().setLogToFile(true);
|
||||||
|
|
||||||
connect(this,&ServerLMSWidget::sigUpdateControllerInitialize,updateController,&UpdateController::initialize/*,Qt::DirectConnection*/);
|
connect(this, &ServerLMSWidget::sigUpdateControllerInitialize, updateController, &UpdateController::initialize);
|
||||||
connect(updateController,&UpdateController::sigInitializeFinished, this,&ServerLMSWidget::slot_startInitialization_step1/*,Qt::DirectConnection*/);
|
connect(updateController, &UpdateController::sigInitializeFinished, this, &ServerLMSWidget::slot_startInitialization_step1);
|
||||||
connect(this, &ServerLMSWidget::sigCalculateFullHash, updateController, &UpdateController::calculateFullHash, Qt::AutoConnection);
|
connect(this, &ServerLMSWidget::sigCalculateFullHash, updateController, &UpdateController::calculateFullHash, Qt::AutoConnection);
|
||||||
connect(updateController, &UpdateController::sigErrorRequired, this, &ServerLMSWidget::setError);
|
connect(updateController, &UpdateController::sigErrorRequired, this, &ServerLMSWidget::setError);
|
||||||
connect(updateController, &UpdateController::sigUpdateDocs, this, &ServerLMSWidget::slot_UpdateDocs, Qt::AutoConnection);
|
connect(updateController, &UpdateController::sigUpdateDocs, this, &ServerLMSWidget::slot_UpdateDocs, Qt::AutoConnection);
|
||||||
@@ -444,6 +421,8 @@ void ServerLMSWidget::tryConnectionToDB()
|
|||||||
{
|
{
|
||||||
if(! providerDBLMS->ConnectionToDB())
|
if(! providerDBLMS->ConnectionToDB())
|
||||||
{
|
{
|
||||||
|
Logger::instance().log("Database connection error!");
|
||||||
|
|
||||||
emit signal_Tray_ShowMessage(tr("Database connection error!"), QSystemTrayIcon::Critical);
|
emit signal_Tray_ShowMessage(tr("Database connection error!"), QSystemTrayIcon::Critical);
|
||||||
|
|
||||||
emit signal_Menu_ShowWindow();
|
emit signal_Menu_ShowWindow();
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ signals:
|
|||||||
void sigRecognize();
|
void sigRecognize();
|
||||||
void sigCalculateFullHash();
|
void sigCalculateFullHash();
|
||||||
void sigUpdateControllerInitialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
|
void sigUpdateControllerInitialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
|
||||||
QTcpSocket* sigGetSocket();
|
|
||||||
|
|
||||||
void signal_DocsChanged();
|
void signal_DocsChanged();
|
||||||
void signal_hasError(int code);
|
void signal_hasError(int code);
|
||||||
@@ -103,6 +102,8 @@ public slots:
|
|||||||
|
|
||||||
void slot_setVersion(QString versionStr);
|
void slot_setVersion(QString versionStr);
|
||||||
|
|
||||||
|
void slot_trySetServerState(PacketType packetType);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString getLanguage()
|
QString getLanguage()
|
||||||
{
|
{
|
||||||
@@ -144,7 +145,6 @@ private slots:
|
|||||||
void on_btnStartServer_clicked();
|
void on_btnStartServer_clicked();
|
||||||
void on_btnStopServer_clicked();
|
void on_btnStopServer_clicked();
|
||||||
void on_btnSettings_clicked();
|
void on_btnSettings_clicked();
|
||||||
void slot_trySetServerState(PacketType packetType);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setLanguageInterfase();
|
void setLanguageInterfase();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>resources/IcoGUIRRJ.ico</file>
|
|
||||||
<file>resources/PngGUIRRJ.png</file>
|
<file>resources/PngGUIRRJ.png</file>
|
||||||
|
<file>resources/IcoGUIRRJ.ico</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#include <QMessageBox>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@@ -153,11 +152,6 @@ void MainWindow::slot_TrayMenu_HideWindow()
|
|||||||
this->hide();
|
this->hide();
|
||||||
action_ShowWindow->setEnabled(true);
|
action_ShowWindow->setEnabled(true);
|
||||||
action_HideWindow->setEnabled(false);
|
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()
|
void MainWindow::slot_TrayMenu_Exit()
|
||||||
@@ -169,9 +163,7 @@ void MainWindow::slot_TrayMenu_Exit()
|
|||||||
void MainWindow::slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg)
|
void MainWindow::slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg)
|
||||||
{
|
{
|
||||||
QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon(iconMsg);
|
QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon(iconMsg);
|
||||||
trayIcon->showMessage(tr("Server MPS"),
|
trayIcon->showMessage(tr("Server MPS"), textMsg, icon, 100);
|
||||||
textMsg,
|
|
||||||
icon, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization)
|
void MainWindow::slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization)
|
||||||
|
|||||||
@@ -52,13 +52,14 @@ public slots:
|
|||||||
|
|
||||||
//Слот вывода сообщения из трея
|
//Слот вывода сообщения из трея
|
||||||
void slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information);
|
void slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information);
|
||||||
//Слот изменения иконки трея
|
//Слот изменения иконки трея о статусе Сервера
|
||||||
void slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
|
void slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
|
||||||
|
|
||||||
//Слот отложенной инициализации
|
//Слот отложенной инициализации
|
||||||
void slot_LazyInitialization();
|
void slot_LazyInitialization();
|
||||||
|
|
||||||
void slot_hasError(int code);
|
void slot_hasError(int code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void exit();
|
void exit();
|
||||||
void errorCheck();
|
void errorCheck();
|
||||||
|
|||||||
Reference in New Issue
Block a user