From 2a120208fa33c373db7a7363a3f59f4a4dee6440 Mon Sep 17 00:00:00 2001 From: manjaro Date: Sat, 31 Oct 2020 05:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=86=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E5=9B=BE=E6=A0=87=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZoomPipeline_FuncSvr/zpmainframe.cpp | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/ZoomPipeline_FuncSvr/zpmainframe.cpp b/ZoomPipeline_FuncSvr/zpmainframe.cpp index c839dfa..ce9d51e 100644 --- a/ZoomPipeline_FuncSvr/zpmainframe.cpp +++ b/ZoomPipeline_FuncSvr/zpmainframe.cpp @@ -123,7 +123,8 @@ void ZPMainFrame::changeEvent(QEvent *e) if (this->isMinimized()==true) { this->hide(); - this->m_IconTray->showMessage(tr("Server still running"), + if (m_IconTray) + this->m_IconTray->showMessage(tr("Server still running"), tr("If you want to terminate server, just using exit Toolbar button.")); } break; @@ -384,12 +385,15 @@ void ZPMainFrame::timerEvent(QTimerEvent * e) static int ppIc = 0; lastRecieved = g_bytesRecieved; lastSent = g_bytesSent; - if (++ppIc % 2==0) - m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic Green.png")); - else - m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic, Performa 250, 275.png")); + if (m_IconTray) + { + if (++ppIc % 2==0) + m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic Green.png")); + else + m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic, Performa 250, 275.png")); + } } - else + else if (m_IconTray) { m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic.png")); } @@ -974,21 +978,27 @@ void ZPMainFrame::closeEvent(QCloseEvent * e) if (this->isVisible()==true) { this->hide(); - this->m_IconTray->showMessage(tr("Server still running"), + if (m_IconTray) + this->m_IconTray->showMessage(tr("Server still running"), tr("If you want to terminate server, just using exit Toolbar button.")); e->ignore(); } else { - e->accept(); - this->m_IconTray->showMessage(tr("Server is going to closed"), + if (m_IconTray) + this->m_IconTray->showMessage(tr("Server is going to closed"), tr("Waiting for all unfinished progress...")); + e->accept(); + m_IconTray->deleteLater(); + m_IconTray = nullptr; } } void ZPMainFrame::on_actionExit_triggered() { this->hide(); - this->m_IconTray->setContextMenu(0); + if (m_IconTray) + this->m_IconTray->setContextMenu(0); this->close(); + } -- GitLab