chore: Adjust about function closeAllNotification

Log: maek closeAllNotification on all platform, move
closeAllNotification action to aboutToQuit
This commit is contained in:
ShootingStarDragons 2023-02-01 09:54:01 +08:00
parent 919ec2a5e3
commit 0e2cc65548
4 changed files with 4 additions and 13 deletions

View file

@ -1641,10 +1641,10 @@ ChatPage::isRoomActive(const QString &room_id)
MainWindow::instance()->windowForRoom(room_id) == QGuiApplication::focusWindow(); MainWindow::instance()->windowForRoom(room_id) == QGuiApplication::focusWindow();
} }
#if defined (Q_OS_LINUX)
void void
ChatPage::removeAllNotifications() ChatPage::removeAllNotifications()
{ {
#if defined (Q_OS_LINUX)
notificationsManager->closeAllNotifications(); notificationsManager->closeAllNotifications();
}
#endif #endif
}

View file

@ -84,9 +84,7 @@ public:
return pushrules; return pushrules;
} }
#if defined(Q_OS_LINUX)
void removeAllNotifications(); void removeAllNotifications();
#endif
public slots: public slots:
bool handleMatrixUri(QString uri); bool handleMatrixUri(QString uri);

View file

@ -15,9 +15,6 @@
#include "TrayIcon.h" #include "TrayIcon.h"
#if defined(Q_OS_LINUX)
#include "ChatPage.h"
#endif
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#include <QtMacExtras> #include <QtMacExtras>
#endif #endif
@ -122,12 +119,7 @@ TrayIcon::TrayIcon(const QString &filename, QWindow *parent)
quitAction_ = new QAction(tr("Quit"), this); quitAction_ = new QAction(tr("Quit"), this);
connect(viewAction_, &QAction::triggered, parent, &QWindow::show); connect(viewAction_, &QAction::triggered, parent, &QWindow::show);
connect(quitAction_, &QAction::triggered, this, [=] { connect(quitAction_, &QAction::triggered, this, QApplication::quit);
#if defined(Q_OS_LINUX)
ChatPage::instance()->removeAllNotifications();
#endif
QApplication::quit();
});
menu->addAction(viewAction_); menu->addAction(viewAction_);
menu->addAction(quitAction_); menu->addAction(quitAction_);

View file

@ -350,6 +350,7 @@ main(int argc, char *argv[])
w.show(); w.show();
QObject::connect(&app, &QApplication::aboutToQuit, &w, [&w]() { QObject::connect(&app, &QApplication::aboutToQuit, &w, [&w]() {
ChatPage::instance()->removeAllNotifications();
w.saveCurrentWindowSize(); w.saveCurrentWindowSize();
if (http::client() != nullptr) { if (http::client() != nullptr) {
nhlog::net()->debug("shutting down all I/O threads & open connections"); nhlog::net()->debug("shutting down all I/O threads & open connections");