From e084d58377ec367e26f13c22ec6c529ccde88c8f Mon Sep 17 00:00:00 2001 From: shenmo <jifengshenmo@outlook.com> Date: Wed, 29 Dec 2021 23:24:26 +0800 Subject: [PATCH] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20sp?= =?UTF-8?q?ark-webapp-runtime/main.cpp=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20?= =?UTF-8?q?=20=20=20=20spark-webapp-runtime/mainwindow.cpp=20=09=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=9A=20=20=20=20=20spark-webapp-runtime/mainwindo?= =?UTF-8?q?w.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spark-webapp-runtime/main.cpp | 20 +++++++++++++------- spark-webapp-runtime/mainwindow.cpp | 14 ++++++++------ spark-webapp-runtime/mainwindow.h | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/spark-webapp-runtime/main.cpp b/spark-webapp-runtime/main.cpp index 60caece..da9078a 100644 --- a/spark-webapp-runtime/main.cpp +++ b/spark-webapp-runtime/main.cpp @@ -14,17 +14,19 @@ #include "globaldefine.h" #include "httpd.h" +DWIDGET_USE_NAMESPACE int main(int argc, char *argv[]) { DApplication a(argc, argv); - + a.loadTranslator(); a.setAttribute(Qt::AA_UseHighDpiPixmaps); a.setApplicationVersion(QString::number(CURRENT_VER)); a.setOrganizationName("spark-union"); // 添加组织名称,和商店主体的文件夹同在 ~/.local/share/spark-union 文件夹下 a.setApplicationName("SparkWebAppRuntime"); // 这里不要翻译,否则 ~/.local/share 中文件夹名也会被翻译 - +QDialog *dialog ; +/* Customized DAboutDialog (Can't work on other distro like Ubuntu...) DAboutDialog *dialog = new DAboutDialog; a.setAboutDialog(dialog); @@ -39,17 +41,21 @@ int main(int argc, char *argv[]) // CompanyLogo dialog->setCompanyLogo(QPixmap(":/images/Logo-Spark.png")); // Description +*/ QString szDefaultDesc = QString("<a href='https://gitee.com/deepin-community-store/spark-web-app-runtime'><span style='font-size:12pt;font-weight:500;'>%1</span></a><br/>" "<span style='font-size:12pt;'>%2</span>") .arg(DEFAULT_TITLE) .arg(QObject::tr("Presented By Spark developers # HadesStudio")); - dialog->setDescription(szDefaultDesc); +/* +dialog->setDescription(szDefaultDesc); // WebsiteName dialog->setWebsiteName("Spark Project"); // WebsiteLink - dialog->setWebsiteLink("https://gitee.com/deepin-community-store/"); + dialog->setWebsiteLink("https://git +ee.com/deepin-community-store/"); // License dialog->setLicense(QObject::tr("This program is open source under GPLv3")); // 本程序按GPL第三版开源 +*/ QCommandLineParser parser; @@ -295,7 +301,7 @@ int main(int argc, char *argv[]) a.setQuitOnLastWindowClosed(!tray); // 启用托盘时,退出程序后服务不终止 - MainWindow w(szTitle, szUrl, width, height, tray, fullScreen, fixSize, hideButtons, dialog); + MainWindow w(szTitle, szUrl, width, height, tray, fullScreen, fixSize, hideButtons,dialog); // qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=UseModernMediaControls"); #if SSL_SERVER @@ -315,7 +321,7 @@ int main(int argc, char *argv[]) szIcon = parser.value(optIcon); } - if (!szIcon.isEmpty()) { +/* if (!szIcon.isEmpty()) { dialog->setWindowIcon(QIcon(szIcon)); dialog->setProductIcon(QIcon(szIcon)); w.setIcon(szIcon); @@ -323,7 +329,7 @@ int main(int argc, char *argv[]) if (!szDesc.isEmpty()) { dialog->setDescription(szDesc); } - +*/ w.show(); return a.exec(); } diff --git a/spark-webapp-runtime/mainwindow.cpp b/spark-webapp-runtime/mainwindow.cpp index cc3134f..af0cb6d 100644 --- a/spark-webapp-runtime/mainwindow.cpp +++ b/spark-webapp-runtime/mainwindow.cpp @@ -1,4 +1,4 @@ -#include "mainwindow.h" +#include "mainwindow.h" #include <DWidgetUtil> #include <DTitlebar> @@ -20,11 +20,11 @@ MainWindow::MainWindow(QString szTitle, bool nFullScreen, bool nFixSize, bool nHideButtons, - DAboutDialog *dialog, + QDialog *dialog, QWidget *parent) : DMainWindow(parent) , m_widget(new Widget(szUrl)) - , m_dialog(dialog) +// , m_dialog(dialog) , m_tray(new QSystemTrayIcon) , btnBack(new DToolButton(titlebar())) , btnForward(new DToolButton(titlebar())) @@ -47,8 +47,8 @@ MainWindow::MainWindow(QString szTitle, , isCanceled(false) , mtray(tray) , mFixSize(nFixSize) - , m_width(nWidth) - , m_height(nHeight) + , m_width(nWidth) + , m_height(nHeight) { /* 初始化 MainWindow */ setCentralWidget(m_widget); @@ -205,13 +205,15 @@ void MainWindow::resizeEvent(QResizeEvent *event) } void MainWindow::closeEvent(QCloseEvent *event) +{} +/* { if (!mtray) { m_dialog->close(); // 不启用托盘时,关闭主窗口则关闭关于窗口 } event->accept(); } - +*/ void MainWindow::fullScreen() { if (m_fullScreen->isChecked()) { diff --git a/spark-webapp-runtime/mainwindow.h b/spark-webapp-runtime/mainwindow.h index a1cc46e..a585a09 100644 --- a/spark-webapp-runtime/mainwindow.h +++ b/spark-webapp-runtime/mainwindow.h @@ -30,7 +30,7 @@ public: bool nFullScreen = false, bool nFixSize = false, bool nHideButtons = false, - DAboutDialog *dialog = nullptr, + QDialog *dialog = nullptr, QWidget *parent = nullptr); ~MainWindow();