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:
@@ -1,5 +1,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include "mainwindow.h"
|
||||
#include "./ui_mainwindow.h"
|
||||
|
||||
@@ -15,21 +16,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
serverLMSWidget = new ServerLMSWidget(this);
|
||||
|
||||
ui->verticalLayout_Main->addWidget(serverLMSWidget);
|
||||
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged);
|
||||
|
||||
qtLanguageTranslator.load(QString("translations/TrayServerLMS_") + serverLMSWidget->getLanguage(), ".");
|
||||
qApp->installTranslator(&qtLanguageTranslator);
|
||||
|
||||
//this->move(0, 0);
|
||||
//this->showNormal();
|
||||
//this->showMaximized();
|
||||
|
||||
errorCheck();
|
||||
|
||||
/* Инициализируем иконку трея, устанавливаем иконку,
|
||||
* а также задаем всплывающую подсказку
|
||||
* */
|
||||
@@ -66,6 +52,28 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
this, SLOT(slot_IconActivated(QSystemTrayIcon::ActivationReason)));
|
||||
|
||||
|
||||
|
||||
serverLMSWidget = new ServerLMSWidget(this);
|
||||
|
||||
ui->verticalLayout_Main->addWidget(serverLMSWidget);
|
||||
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged);
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Tray_ShowMessage, this, &MainWindow::slot_Tray_ShowMessage);
|
||||
|
||||
serverLMSWidget->start();
|
||||
|
||||
qtLanguageTranslator.load(QString("translations/TrayServerLMS_") + serverLMSWidget->getLanguage(), ".");
|
||||
qApp->installTranslator(&qtLanguageTranslator);
|
||||
|
||||
//this->move(0, 0);
|
||||
//this->showNormal();
|
||||
//this->showMaximized();
|
||||
|
||||
errorCheck();
|
||||
|
||||
//QThread::sleep(2);
|
||||
|
||||
slot_Menu_HideWindow();
|
||||
}
|
||||
|
||||
@@ -178,8 +186,7 @@ void MainWindow::slot_Menu_HideWindow()
|
||||
trayIcon->showMessage(tr("Server LMS"),
|
||||
tr("The application is minimized to the tray. "
|
||||
"To maximize the application window, click the application icon in the tray."),
|
||||
icon,
|
||||
2000);
|
||||
icon, 100);
|
||||
}
|
||||
|
||||
void MainWindow::slot_Menu_Exit()
|
||||
@@ -188,6 +195,14 @@ void MainWindow::slot_Menu_Exit()
|
||||
this->close();
|
||||
}
|
||||
|
||||
void MainWindow::slot_Tray_ShowMessage(QString textMsg)
|
||||
{
|
||||
QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon(QSystemTrayIcon::Warning);
|
||||
trayIcon->showMessage(tr("Server LMS"),
|
||||
textMsg,
|
||||
icon, 100);
|
||||
}
|
||||
|
||||
void MainWindow::slot_LanguageChanged(QString language)
|
||||
{
|
||||
qtLanguageTranslator.load(QString(QStringLiteral("translations/TrayServerLMS_")) + language, QStringLiteral("."));
|
||||
|
||||
@@ -48,6 +48,10 @@ public slots:
|
||||
void slot_Menu_HideWindow();
|
||||
void slot_Menu_Exit();
|
||||
|
||||
//Слот вывода сообщения из трея
|
||||
void slot_Tray_ShowMessage(QString textMsg);
|
||||
|
||||
|
||||
signals:
|
||||
//сигнал об изменении языка интерфейса
|
||||
void signal_LanguageChanged(QString language);
|
||||
|
||||
Reference in New Issue
Block a user