From 2c299a2d906d229c3bb0f05e9055fe2049b9d693 Mon Sep 17 00:00:00 2001 From: zty199 <46324746+zty199@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:04:58 +0800 Subject: [PATCH] chore: merge changes from branch master fix hide buttons from cmd or cfg won't work; support local html files Log: merge changes from branch master --- src/main.cpp | 20 ++++++++++---------- src/mainwindow.cpp | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f150fad..a0a3178 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,12 +21,6 @@ int main(int argc, char *argv[]) // 龙芯机器配置,使得 DApplication 能正确加载 QTWEBENGINE qputenv("DTK_FORCE_RASTER_WIDGETS", "FALSE"); -// qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=UseModernMediaControls"); -// qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-web-security"); -#if defined __sw_64__ || __loongarch__ - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox"); -#endif - // 强制使用 DTK 平台插件 int fakeArgc = argc + 2; QVector<char *> fakeArgv(fakeArgc); @@ -239,11 +233,17 @@ int main(int argc, char *argv[]) if (parser.isSet(useGPU)) { toUseGPU = parser.value(useGPU).toUInt(); } - if (toUseGPU == true) { - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blocklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode"); -#ifdef __sw_64__ - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blocklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode --no-sandbox"); + + QStringList chromium_flags = {"--disable-web-security"}; +#if defined __sw_64__ || __loongarch__ + chromium_flags << "--no-sandbox"; #endif + if (toUseGPU == true) { + chromium_flags << "--ignore-gpu-blocklist" + << "--enable-gpu-rasterization" + << "--enable-native-gpu-memory-buffers" + << "--enable-accelerated-video-decode"; + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromium_flags.join(" ").toUtf8()); qDebug() << "Setting GPU to True."; } // 初始化 QtWebEngine 深色模式环境变量 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e3c224a..76539e0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -196,6 +196,7 @@ void MainWindow::initUI() fixSize(); fullScreen(); + hideButtons(); // 修复指定hidebuttons之后没有生效 } void MainWindow::initTitleBar()