mirror of
https://gitee.com/spark-store-project/spark-web-app-runtime.git
synced 2025-07-03 20:26:02 +08:00
修改: spark-webapp-runtime/main.cpp
修改: spark-webapp-runtime/mainwindow.cpp 修改: spark-webapp-runtime/mainwindow.h
This commit is contained in:
parent
2453752bd7
commit
21cdb5c15f
spark-webapp-runtime
@ -14,17 +14,19 @@
|
|||||||
#include "globaldefine.h"
|
#include "globaldefine.h"
|
||||||
#include "httpd.h"
|
#include "httpd.h"
|
||||||
|
|
||||||
|
DWIDGET_USE_NAMESPACE
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
DApplication a(argc, argv);
|
DApplication a(argc, argv);
|
||||||
|
|
||||||
a.loadTranslator();
|
a.loadTranslator();
|
||||||
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
|
||||||
a.setApplicationVersion(QString::number(CURRENT_VER));
|
a.setApplicationVersion(QString::number(CURRENT_VER));
|
||||||
a.setOrganizationName("spark-union"); // 添加组织名称,和商店主体的文件夹同在 ~/.local/share/spark-union 文件夹下
|
a.setOrganizationName("spark-union"); // 添加组织名称,和商店主体的文件夹同在 ~/.local/share/spark-union 文件夹下
|
||||||
a.setApplicationName("SparkWebAppRuntime"); // 这里不要翻译,否则 ~/.local/share 中文件夹名也会被翻译
|
a.setApplicationName("SparkWebAppRuntime"); // 这里不要翻译,否则 ~/.local/share 中文件夹名也会被翻译
|
||||||
|
QDialog *dialog ;
|
||||||
|
/* Customized DAboutDialog (Can't work on other distro like Ubuntu...)
|
||||||
DAboutDialog *dialog = new DAboutDialog;
|
DAboutDialog *dialog = new DAboutDialog;
|
||||||
a.setAboutDialog(dialog);
|
a.setAboutDialog(dialog);
|
||||||
|
|
||||||
@ -39,17 +41,21 @@ int main(int argc, char *argv[])
|
|||||||
// CompanyLogo
|
// CompanyLogo
|
||||||
dialog->setCompanyLogo(QPixmap(":/images/Logo-Spark.png"));
|
dialog->setCompanyLogo(QPixmap(":/images/Logo-Spark.png"));
|
||||||
// Description
|
// 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/>"
|
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>")
|
"<span style='font-size:12pt;'>%2</span>")
|
||||||
.arg(DEFAULT_TITLE)
|
.arg(DEFAULT_TITLE)
|
||||||
.arg(QObject::tr("Presented By Spark developers # HadesStudio"));
|
.arg(QObject::tr("Presented By Spark developers # HadesStudio"));
|
||||||
dialog->setDescription(szDefaultDesc);
|
/*
|
||||||
|
dialog->setDescription(szDefaultDesc);
|
||||||
// WebsiteName
|
// WebsiteName
|
||||||
dialog->setWebsiteName("Spark Project");
|
dialog->setWebsiteName("Spark Project");
|
||||||
// WebsiteLink
|
// WebsiteLink
|
||||||
dialog->setWebsiteLink("https://gitee.com/deepin-community-store/");
|
dialog->setWebsiteLink("https://git
|
||||||
|
ee.com/deepin-community-store/");
|
||||||
// License
|
// License
|
||||||
dialog->setLicense(QObject::tr("This program is open source under GPLv3")); // 本程序按GPL第三版开源
|
dialog->setLicense(QObject::tr("This program is open source under GPLv3")); // 本程序按GPL第三版开源
|
||||||
|
*/
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
|
|
||||||
@ -295,7 +301,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
a.setQuitOnLastWindowClosed(!tray); // 启用托盘时,退出程序后服务不终止
|
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");
|
// qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=UseModernMediaControls");
|
||||||
|
|
||||||
#if SSL_SERVER
|
#if SSL_SERVER
|
||||||
@ -315,7 +321,7 @@ int main(int argc, char *argv[])
|
|||||||
szIcon = parser.value(optIcon);
|
szIcon = parser.value(optIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!szIcon.isEmpty()) {
|
/* if (!szIcon.isEmpty()) {
|
||||||
dialog->setWindowIcon(QIcon(szIcon));
|
dialog->setWindowIcon(QIcon(szIcon));
|
||||||
dialog->setProductIcon(QIcon(szIcon));
|
dialog->setProductIcon(QIcon(szIcon));
|
||||||
w.setIcon(szIcon);
|
w.setIcon(szIcon);
|
||||||
@ -323,7 +329,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!szDesc.isEmpty()) {
|
if (!szDesc.isEmpty()) {
|
||||||
dialog->setDescription(szDesc);
|
dialog->setDescription(szDesc);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include <DWidgetUtil>
|
#include <DWidgetUtil>
|
||||||
#include <DTitlebar>
|
#include <DTitlebar>
|
||||||
@ -20,11 +20,11 @@ MainWindow::MainWindow(QString szTitle,
|
|||||||
bool nFullScreen,
|
bool nFullScreen,
|
||||||
bool nFixSize,
|
bool nFixSize,
|
||||||
bool nHideButtons,
|
bool nHideButtons,
|
||||||
DAboutDialog *dialog,
|
QDialog *dialog,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: DMainWindow(parent)
|
: DMainWindow(parent)
|
||||||
, m_widget(new Widget(szUrl))
|
, m_widget(new Widget(szUrl))
|
||||||
, m_dialog(dialog)
|
// , m_dialog(dialog)
|
||||||
, m_tray(new QSystemTrayIcon)
|
, m_tray(new QSystemTrayIcon)
|
||||||
, btnBack(new DToolButton(titlebar()))
|
, btnBack(new DToolButton(titlebar()))
|
||||||
, btnForward(new DToolButton(titlebar()))
|
, btnForward(new DToolButton(titlebar()))
|
||||||
@ -47,8 +47,8 @@ MainWindow::MainWindow(QString szTitle,
|
|||||||
, isCanceled(false)
|
, isCanceled(false)
|
||||||
, mtray(tray)
|
, mtray(tray)
|
||||||
, mFixSize(nFixSize)
|
, mFixSize(nFixSize)
|
||||||
, m_width(nWidth)
|
, m_width(nWidth)
|
||||||
, m_height(nHeight)
|
, m_height(nHeight)
|
||||||
{
|
{
|
||||||
/* 初始化 MainWindow */
|
/* 初始化 MainWindow */
|
||||||
setCentralWidget(m_widget);
|
setCentralWidget(m_widget);
|
||||||
@ -205,13 +205,15 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
{}
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
if (!mtray) {
|
if (!mtray) {
|
||||||
m_dialog->close(); // 不启用托盘时,关闭主窗口则关闭关于窗口
|
m_dialog->close(); // 不启用托盘时,关闭主窗口则关闭关于窗口
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void MainWindow::fullScreen()
|
void MainWindow::fullScreen()
|
||||||
{
|
{
|
||||||
if (m_fullScreen->isChecked()) {
|
if (m_fullScreen->isChecked()) {
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
bool nFullScreen = false,
|
bool nFullScreen = false,
|
||||||
bool nFixSize = false,
|
bool nFixSize = false,
|
||||||
bool nHideButtons = false,
|
bool nHideButtons = false,
|
||||||
DAboutDialog *dialog = nullptr,
|
QDialog *dialog = nullptr,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user