From 7f9088ba831644ef850e1badd0d09bb83532fe2c Mon Sep 17 00:00:00 2001 From: yinjie Date: Thu, 21 Apr 2022 16:19:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E4=BB=BB=E5=8A=A1=E6=A0=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加彻底隐藏任务栏的配置 Log: 支持任务栏彻底隐藏 Task: https://pms.uniontech.com/task-view-113997.html Influence: 任务栏隐藏和显示 Change-Id: I79412029758e38f56719bd03302cb667506f531e --- configs/org.deepin.dde.dock.json | 11 +++++++++++ frame/main.cpp | 1 + frame/window/mainwindow.cpp | 16 +++++++++++++++- frame/window/mainwindow.h | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/configs/org.deepin.dde.dock.json b/configs/org.deepin.dde.dock.json index 1656b5df2..dff258105 100644 --- a/configs/org.deepin.dde.dock.json +++ b/configs/org.deepin.dde.dock.json @@ -15,6 +15,17 @@ "description":"0 Mouse over show;1 Always show; 2 Always hide", "permissions":"readwrite", "visibility":"private" + }, + "alwaysHideDock":{ + "value": false, + "serial": 0, + "flags":[], + "name":"alwaysHideDock", + "name[zh_CN]":"一直隐藏", + "description[zh_CN]":"当设置为true时,即使鼠标放在任务栏区域也不会显示任务栏;配置即时生效", + "description":"ture: Dock is hidden all the time, false: Depend on other settings of dock", + "permissions":"readwrite", + "visibility":"private" } } } \ No newline at end of file diff --git a/frame/main.cpp b/frame/main.cpp index 76f0700a6..4ae0b6b67 100644 --- a/frame/main.cpp +++ b/frame/main.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 0f0799dd3..0ac9d47f9 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -90,6 +90,7 @@ MainWindow::MainWindow(QWidget *parent) , m_dragWidget(new DragWidget(this)) , m_launched(false) , m_updateDragAreaTimer(new QTimer(this)) + , m_dconfig(DConfig::create("org.deepin.dde.dock", "org.deepin.dde.dock", QString(), this)) { setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_X11DoNotAcceptFocus); @@ -156,7 +157,12 @@ void MainWindow::launch() m_launched = true; m_multiScreenWorker->initShow(); m_shadowMaskOptimizeTimer->start(); - QTimer::singleShot(0, this, [ this ] { this->setVisible(true); }); + QTimer::singleShot(0, this, [ this ] { + bool showDock = true; + if (m_dconfig.data()->isValid()) + showDock = !m_dconfig.data()->value("alwaysHideDock", false).toBool(); + setVisible(showDock); + }); } /** @@ -298,6 +304,14 @@ void MainWindow::initComponents() QTimer::singleShot(1, this, &MainWindow::compositeChanged); themeTypeChanged(DGuiApplicationHelper::instance()->themeType()); + + if (m_dconfig.data()->isValid()) { + connect(m_dconfig.data(), &DConfig::valueChanged, this, [this] (const QString &key) { + if (key == "alwaysHideDock") { + setVisible(!m_dconfig.data()->value(key, false).toBool()); + } + }); + } } void MainWindow::compositeChanged() diff --git a/frame/window/mainwindow.h b/frame/window/mainwindow.h index 32b440eb7..fe25b8710 100644 --- a/frame/window/mainwindow.h +++ b/frame/window/mainwindow.h @@ -35,10 +35,12 @@ #include #include #include +#include #include DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE class MainPanelControl; class QTimer; @@ -226,6 +228,7 @@ private: QStringList m_registerKeys; QTimer *m_updateDragAreaTimer; + QSharedPointer m_dconfig; }; #endif // MAINWINDOW_H