mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Запуск refact
This commit is contained in:
@@ -56,7 +56,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
waitAnimationWidget->setParent(this);
|
waitAnimationWidget->setParent(this);
|
||||||
waitAnimationWidget->initialize(movie,this);
|
waitAnimationWidget->initialize(movie,this);
|
||||||
|
|
||||||
waitAnimationWidget->showWithPlay();
|
//waitAnimationWidget->showWithPlay();
|
||||||
|
|
||||||
updateStateOnlyVersion();
|
updateStateOnlyVersion();
|
||||||
}
|
}
|
||||||
@@ -361,6 +361,10 @@ QString ServerLMSWidget::loadStyleSheet()
|
|||||||
|
|
||||||
void ServerLMSWidget::startInitialization_step0()
|
void ServerLMSWidget::startInitialization_step0()
|
||||||
{
|
{
|
||||||
|
emit signal_Tray_ShowMessage(tr("Starting the server..."));
|
||||||
|
|
||||||
|
waitAnimationWidget->showWithPlay();
|
||||||
|
|
||||||
//QApplication::setOverrideCursor(Qt::WaitCursor);
|
//QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
providerDBLMS = new ProviderDBLMS(this);
|
providerDBLMS = new ProviderDBLMS(this);
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ signals:
|
|||||||
void signal_updateDocsXML();
|
void signal_updateDocsXML();
|
||||||
|
|
||||||
void signal_InitializeFinished();
|
void signal_InitializeFinished();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slot_LanguageChanged(QString language);
|
void slot_LanguageChanged(QString language);
|
||||||
void slot_UpdateListClients();
|
void slot_UpdateListClients();
|
||||||
|
|||||||
@@ -21,34 +21,34 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint);
|
||||||
|
|
||||||
serverLMSWidget = new ServerLMSWidget(this);
|
serverLMSWidget = new ServerLMSWidget(this);
|
||||||
ui->verticalLayout_Main->addWidget(serverLMSWidget);
|
|
||||||
|
|
||||||
connect(serverLMSWidget, &ServerLMSWidget::signal_InitializeFinished, this, &MainWindow::slot_InitializeFinished);
|
connect(serverLMSWidget, &ServerLMSWidget::signal_InitializeFinished, this, &MainWindow::slot_InitializeFinished);
|
||||||
|
|
||||||
connect(serverLMSWidget, &ServerLMSWidget::signal_hasError, this, &MainWindow::slot_hasError);
|
connect(serverLMSWidget, &ServerLMSWidget::signal_hasError, this, &MainWindow::slot_hasError);
|
||||||
|
|
||||||
connect(serverLMSWidget, &ServerLMSWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged);
|
connect(serverLMSWidget, &ServerLMSWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged);
|
||||||
|
|
||||||
connect(serverLMSWidget, &ServerLMSWidget::signal_updateStateServer, this, &MainWindow::slot_updateStateServer);
|
connect(serverLMSWidget, &ServerLMSWidget::signal_updateStateServer, this, &MainWindow::slot_updateStateServer);
|
||||||
|
connect(serverLMSWidget, &ServerLMSWidget::signal_Tray_ShowMessage, this, &MainWindow::slot_Tray_ShowMessage);
|
||||||
|
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_ShowWindow, this, &MainWindow::slot_TrayMenu_ShowWindow);
|
||||||
|
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_HideWindow, this, &MainWindow::slot_TrayMenu_HideWindow);
|
||||||
|
|
||||||
qtLanguageTranslator.load(QString("translations/RRJServer_") + serverLMSWidget->getLanguage(), ".");
|
qtLanguageTranslator.load(QString("translations/RRJServer_") + serverLMSWidget->getLanguage(), ".");
|
||||||
qApp->installTranslator(&qtLanguageTranslator);
|
qApp->installTranslator(&qtLanguageTranslator);
|
||||||
|
|
||||||
/* Инициализируем иконку трея, устанавливаем иконку,
|
/* Инициализируем иконку трея, устанавливаем иконку*/
|
||||||
* а также задаем всплывающую подсказку
|
|
||||||
* */
|
|
||||||
trayIcon = new QSystemTrayIcon(this);
|
trayIcon = new QSystemTrayIcon(this);
|
||||||
//trayIcon->setIcon(this->style()->standardIcon(QStyle::SP_ComputerIcon));
|
|
||||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_stop.png"));
|
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_stop.png"));
|
||||||
|
|
||||||
/* После чего создаем контекстное меню для иконки трея*/
|
/* Подключаем сигнал нажатия на иконку*/
|
||||||
|
connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::slot_TrayIconActivated);
|
||||||
|
/* Подключаем сигнал нажатия на всплывающее сообщение*/
|
||||||
|
connect(trayIcon, &QSystemTrayIcon::messageClicked, this, &MainWindow::slot_TrayMessageClicked);
|
||||||
|
|
||||||
|
/* Создаем контекстное меню для иконки трея*/
|
||||||
trayMenu = new QMenu(this);
|
trayMenu = new QMenu(this);
|
||||||
action_ShowWindow = new QAction(this);
|
action_ShowWindow = new QAction(this);
|
||||||
action_HideWindow = new QAction(this);
|
action_HideWindow = new QAction(this);
|
||||||
action_Exit = new QAction(this);
|
action_Exit = new QAction(this);
|
||||||
|
|
||||||
/* подключаем сигналы нажатий на пункты меню к соответсвующим слотам.
|
/* Подключаем сигналы нажатий на пункты меню к соответсвующим слотам.*/
|
||||||
* */
|
|
||||||
connect(action_ShowWindow, &QAction::triggered, this, &MainWindow::slot_TrayMenu_ShowWindow);
|
connect(action_ShowWindow, &QAction::triggered, this, &MainWindow::slot_TrayMenu_ShowWindow);
|
||||||
connect(action_HideWindow, &QAction::triggered, this, &MainWindow::slot_TrayMenu_HideWindow);
|
connect(action_HideWindow, &QAction::triggered, this, &MainWindow::slot_TrayMenu_HideWindow);
|
||||||
connect(action_Exit, &QAction::triggered, this, &MainWindow::slot_TrayMenu_Exit);
|
connect(action_Exit, &QAction::triggered, this, &MainWindow::slot_TrayMenu_Exit);
|
||||||
@@ -65,8 +65,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
trayIcon->setContextMenu(trayMenu);
|
trayIcon->setContextMenu(trayMenu);
|
||||||
trayIcon->show();
|
trayIcon->show();
|
||||||
|
|
||||||
slot_Tray_ShowMessage(tr("Starting the server..."));
|
//slot_Tray_ShowMessage(tr("Starting the server..."));
|
||||||
|
|
||||||
|
ui->verticalLayout_Main->addWidget(serverLMSWidget);
|
||||||
|
|
||||||
|
//Отложенная инициализация (для serverLMSWidget)
|
||||||
QTimer::singleShot(1000, this, &MainWindow::slot_LazyInitialization);
|
QTimer::singleShot(1000, this, &MainWindow::slot_LazyInitialization);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,8 +84,6 @@ MainWindow::~MainWindow()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Метод, который обрабатывает событие закрытия окна приложения
|
|
||||||
* */
|
|
||||||
void MainWindow::closeEvent(QCloseEvent * event)
|
void MainWindow::closeEvent(QCloseEvent * event)
|
||||||
{
|
{
|
||||||
/* Если окно видимо, то завершение приложения
|
/* Если окно видимо, то завершение приложения
|
||||||
@@ -93,8 +94,10 @@ void MainWindow::closeEvent(QCloseEvent * event)
|
|||||||
event->ignore();
|
event->ignore();
|
||||||
|
|
||||||
if(flInitServerLMSWidget)
|
if(flInitServerLMSWidget)
|
||||||
|
{//Не даем свернуть окно, пока не прошла инициализация serverLMSWidget
|
||||||
slot_TrayMenu_HideWindow();
|
slot_TrayMenu_HideWindow();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::changeEvent(QEvent *event)
|
void MainWindow::changeEvent(QEvent *event)
|
||||||
@@ -109,8 +112,6 @@ void MainWindow::changeEvent(QEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Метод, который обрабатывает нажатие на иконку приложения в трее
|
|
||||||
* */
|
|
||||||
void MainWindow::slot_TrayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
void MainWindow::slot_TrayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
{
|
{
|
||||||
switch (reason){
|
switch (reason){
|
||||||
@@ -132,8 +133,6 @@ void MainWindow::slot_TrayIconActivated(QSystemTrayIcon::ActivationReason reason
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Метод, который обрабатывает нажатие на сообщение из трея
|
|
||||||
* */
|
|
||||||
void MainWindow::slot_TrayMessageClicked()
|
void MainWindow::slot_TrayMessageClicked()
|
||||||
{
|
{
|
||||||
if(!this->isVisible())
|
if(!this->isVisible())
|
||||||
@@ -194,24 +193,17 @@ void MainWindow::slot_LazyInitialization()
|
|||||||
|
|
||||||
void MainWindow::slot_hasError(int code)
|
void MainWindow::slot_hasError(int code)
|
||||||
{
|
{
|
||||||
errorCheck();
|
if(code == 100)
|
||||||
|
{
|
||||||
|
slot_TrayMenu_ShowWindow();
|
||||||
|
|
||||||
|
//выключение с задержкой
|
||||||
|
QTimer::singleShot(1000, this, &MainWindow::slot_TrayMenu_Exit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::slot_InitializeFinished()
|
void MainWindow::slot_InitializeFinished()
|
||||||
{
|
{
|
||||||
/* Также подключаем сигнал нажатия на иконку к обработчику
|
|
||||||
* данного нажатия
|
|
||||||
* */
|
|
||||||
connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::slot_TrayIconActivated);
|
|
||||||
/* Также подключаем сигнал нажатия на всплывающее сообщение к обработчику
|
|
||||||
* данного нажатия
|
|
||||||
* */
|
|
||||||
connect(trayIcon, &QSystemTrayIcon::messageClicked, this, &MainWindow::slot_TrayMessageClicked);
|
|
||||||
|
|
||||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Tray_ShowMessage, this, &MainWindow::slot_Tray_ShowMessage);
|
|
||||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_ShowWindow, this, &MainWindow::slot_TrayMenu_ShowWindow);
|
|
||||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_HideWindow, this, &MainWindow::slot_TrayMenu_HideWindow);
|
|
||||||
|
|
||||||
flInitServerLMSWidget = true;
|
flInitServerLMSWidget = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,21 +213,6 @@ void MainWindow::slot_LanguageChanged(QString language)
|
|||||||
qApp->installTranslator(&qtLanguageTranslator);
|
qApp->installTranslator(&qtLanguageTranslator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::exit()
|
|
||||||
{
|
|
||||||
QApplication::exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::errorCheck()
|
|
||||||
{
|
|
||||||
if(serverLMSWidget->hasError() == 100)
|
|
||||||
{
|
|
||||||
slot_TrayMenu_ShowWindow();
|
|
||||||
|
|
||||||
//выключение с задержкой, так как eventLoop инициализируется позже
|
|
||||||
QTimer::singleShot(1000, this, &MainWindow::slot_TrayMenu_Exit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateTrayTitles()
|
void MainWindow::updateTrayTitles()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,15 +25,7 @@ public:
|
|||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Метод получения событий в главном окне приложения
|
|
||||||
* В нём будет производиться проверка события смены перевода приложения
|
|
||||||
*/
|
|
||||||
void changeEvent(QEvent * event) override;
|
void changeEvent(QEvent * event) override;
|
||||||
|
|
||||||
/* Виртуальная функция родительского класса в нашем классе
|
|
||||||
* переопределяется для изменения поведения приложения,
|
|
||||||
* чтобы оно сворачивалось в трей, когда мы этого хотим
|
|
||||||
*/
|
|
||||||
void closeEvent(QCloseEvent * event) override;
|
void closeEvent(QCloseEvent * event) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -52,19 +44,18 @@ 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(); //TODO ?
|
||||||
|
|
||||||
void slot_hasError(int code);
|
void slot_hasError(int code); //TODO ?
|
||||||
|
|
||||||
void slot_InitializeFinished();
|
void slot_InitializeFinished(); //TODO ?
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void exit();
|
|
||||||
void errorCheck();
|
|
||||||
void updateTrayTitles();
|
void updateTrayTitles();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user