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:
@@ -200,6 +200,8 @@ void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png")));
|
||||
//emit signal_Tray_ShowMessage(tr("Authorization unblocked!"));
|
||||
}
|
||||
//updateStateServer();
|
||||
emit signal_updateStateServer(server->getStateServer(), server->getStateBlockAutorization());
|
||||
}
|
||||
|
||||
void ServerLMSWidget::slot_LanguageChanged(QString language)
|
||||
@@ -221,9 +223,10 @@ void ServerLMSWidget::on_btnStartServer_clicked()
|
||||
ui->btnStopServer->setEnabled(true);
|
||||
slot_BlockAutorization(false);
|
||||
|
||||
updateStateServer();
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Server is started!"));
|
||||
}
|
||||
updateStateServer();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::on_btnStopServer_clicked()
|
||||
@@ -234,9 +237,10 @@ void ServerLMSWidget::on_btnStopServer_clicked()
|
||||
ui->btnStartServer->setEnabled(true);
|
||||
slot_BlockAutorization(true);
|
||||
|
||||
updateStateServer();
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Server is stoped!"));
|
||||
}
|
||||
updateStateServer();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::on_btnSettings_clicked()
|
||||
@@ -462,6 +466,8 @@ void ServerLMSWidget::updateStateServer()
|
||||
{
|
||||
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
|
||||
}
|
||||
|
||||
emit signal_updateStateServer(server->getStateServer(), server->getStateBlockAutorization());
|
||||
}
|
||||
|
||||
if(providerDBLMS)
|
||||
|
||||
@@ -87,6 +87,8 @@ signals:
|
||||
void signal_DocsChanged();
|
||||
void signal_hasError(int code);
|
||||
|
||||
void signal_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
|
||||
|
||||
public slots:
|
||||
void slot_LanguageChanged(QString language);
|
||||
void slot_UpdateListClients();
|
||||
|
||||
@@ -2,5 +2,8 @@
|
||||
<qresource prefix="/">
|
||||
<file>resources/PngServerRRJ.png</file>
|
||||
<file>resources/IcoServerRRJ.ico</file>
|
||||
<file>resources/PngServerRRJ_lock.png</file>
|
||||
<file>resources/PngServerRRJ_start.png</file>
|
||||
<file>resources/PngServerRRJ_stop.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -30,6 +30,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_ShowWindow, this, &MainWindow::slot_TrayMenu_ShowWindow);
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_HideWindow, this, &MainWindow::slot_TrayMenu_HideWindow);
|
||||
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_updateStateServer, this, &MainWindow::slot_updateStateServer);
|
||||
|
||||
qtLanguageTranslator.load(QString("translations/RRJServer_") + serverLMSWidget->getLanguage(), ".");
|
||||
qApp->installTranslator(&qtLanguageTranslator);
|
||||
|
||||
@@ -38,7 +40,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
* */
|
||||
trayIcon = new QSystemTrayIcon(this);
|
||||
//trayIcon->setIcon(this->style()->standardIcon(QStyle::SP_ComputerIcon));
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ.png"));
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_stop.png"));
|
||||
|
||||
/* После чего создаем контекстное меню для иконки трея*/
|
||||
trayMenu = new QMenu(this);
|
||||
@@ -172,6 +174,25 @@ void MainWindow::slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::Message
|
||||
icon, 100);
|
||||
}
|
||||
|
||||
void MainWindow::slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization)
|
||||
{
|
||||
if(stateServer == EStateServer::started)
|
||||
{
|
||||
if(stateBlockAutorization == EStateBlockAutorization::unblocked)
|
||||
{
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_start.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_lock.png"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_stop.png"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slot_LazyInitialization()
|
||||
{
|
||||
serverLMSWidget->start();
|
||||
|
||||
@@ -52,6 +52,8 @@ public slots:
|
||||
|
||||
//Слот вывода сообщения из трея
|
||||
void slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information);
|
||||
//Слот изменения иконки трея
|
||||
void slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
|
||||
|
||||
//Слот отложенной инициализации
|
||||
void slot_LazyInitialization();
|
||||
|
||||
BIN
ProgramServerMPS/resources/PngServerRRJ_lock.png
Normal file
BIN
ProgramServerMPS/resources/PngServerRRJ_lock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
ProgramServerMPS/resources/PngServerRRJ_start.png
Normal file
BIN
ProgramServerMPS/resources/PngServerRRJ_start.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
ProgramServerMPS/resources/PngServerRRJ_stop.png
Normal file
BIN
ProgramServerMPS/resources/PngServerRRJ_stop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user