From 77a999e22e60312252f383d97a2d4671d6358a14 Mon Sep 17 00:00:00 2001
From: zty199 <1282441920@qq.com>
Date: Sat, 30 Jan 2021 14:11:25 +0800
Subject: [PATCH] Improve Features

Delete hint when switching between FullScreen and Windowed Mode;
Support closing MainWindow automatically when windowCloseRequested by
webpage.
---
 spark-webapp-runtime/mainwindow.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/spark-webapp-runtime/mainwindow.cpp b/spark-webapp-runtime/mainwindow.cpp
index 5dc8453..4786926 100644
--- a/spark-webapp-runtime/mainwindow.cpp
+++ b/spark-webapp-runtime/mainwindow.cpp
@@ -167,6 +167,11 @@ MainWindow::MainWindow(QString szTitle,
     connect(m_tray, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivated);
 
     connect(m_widget->getPage()->profile(), &QWebEngineProfile::downloadRequested, this, &MainWindow::on_downloadStart);
+
+    connect(m_widget->getPage(), &QWebEnginePage::windowCloseRequested, this, [=]()
+    {
+        this->close();
+    });
 }
 
 MainWindow::~MainWindow()
@@ -195,7 +200,7 @@ void MainWindow::fullScreen()
         m_fixSize->setDisabled(true);
         m_menu->update();
         showFullScreen();
-        DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("dialog-information").pixmap(64, 64), QString(tr("%1Fullscreen Mode")).arg("    "));
+        // DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("dialog-information").pixmap(64, 64), QString(tr("%1Fullscreen Mode")).arg("    "));
     }
     else
     {
@@ -205,7 +210,7 @@ void MainWindow::fullScreen()
         }
         m_menu->update();
         showNormal();
-        DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("dialog-information").pixmap(64, 64), QString(tr("%1Windowed Mode")).arg("    "));
+        // DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("dialog-information").pixmap(64, 64), QString(tr("%1Windowed Mode")).arg("    "));
     }
 }