From a1761b3ddbf0b3454d3add8c289c2a627a5bbf37 Mon Sep 17 00:00:00 2001 From: reionwong Date: Sat, 16 Oct 2021 19:53:52 +0800 Subject: [PATCH] Add new style --- qml/main.qml | 15 +++++--- src/com.cutefish.Dock.xml | 4 +++ src/docksettings.cpp | 17 +++++++++ src/docksettings.h | 12 +++++++ src/mainwindow.cpp | 72 ++++++++++++++++++++++++++++++--------- src/mainwindow.h | 5 +++ src/xwindowinterface.cpp | 3 +- 7 files changed, 107 insertions(+), 21 deletions(-) diff --git a/qml/main.qml b/qml/main.qml index 22e6bd5..88164c5 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -37,6 +37,10 @@ Item { mainWindow.updateSize() } + Component.onCompleted: { + console.log(Settings.style) + } + DropArea { anchors.fill: parent enabled: true @@ -46,9 +50,9 @@ Item { Rectangle { id: _background anchors.fill: parent - radius: root.compositing ? windowRadius : 0 + radius: root.compositing && Settings.style === 0 ? windowRadius : 0 color: FishUI.Theme.darkMode ? "#666666" : "#E6E6E6" - opacity: root.compositing ? FishUI.Theme.darkMode ? 0.5 : 0.4 : 0.9 + opacity: root.compositing ? FishUI.Theme.darkMode ? 0.5 : 0.5 : 0.9 border.width: 0 Behavior on color { @@ -67,13 +71,13 @@ Item { view: mainWindow geometry: Qt.rect(root.x, root.y, root.width, root.height) strength: 1 - radius: root.windowRadius + radius: _background.radius } FishUI.WindowBlur { view: mainWindow geometry: Qt.rect(root.x, root.y, root.width, root.height) - windowRadius: root.windowRadius + windowRadius: _background.radius enabled: true } @@ -86,6 +90,9 @@ Item { GridLayout { id: mainLayout anchors.fill: parent + anchors.topMargin: Settings.style === 1 + && (Settings.direction === 0 || Settings.direction === 2) + ? 28 : 0 flow: isHorizontal ? Grid.LeftToRight : Grid.TopToBottom columnSpacing: 0 rowSpacing: 0 diff --git a/src/com.cutefish.Dock.xml b/src/com.cutefish.Dock.xml index 52bbdd9..586f12f 100644 --- a/src/com.cutefish.Dock.xml +++ b/src/com.cutefish.Dock.xml @@ -11,6 +11,7 @@ + @@ -18,9 +19,12 @@ + + + diff --git a/src/docksettings.cpp b/src/docksettings.cpp index 48239f3..b051bf9 100644 --- a/src/docksettings.cpp +++ b/src/docksettings.cpp @@ -53,6 +53,8 @@ DockSettings::DockSettings(QObject *parent) m_settings->setValue("Visibility", AlwaysShow); if (!m_settings->contains("RoundedWindow")) m_settings->setValue("RoundedWindow", true); + if (!m_settings->contains("Style")) + m_settings->setValue("Style", Straight); m_settings->sync(); @@ -60,6 +62,7 @@ DockSettings::DockSettings(QObject *parent) m_direction = static_cast(m_settings->value("Direction").toInt()); m_visibility = static_cast(m_settings->value("Visibility").toInt()); m_roundedWindowEnabled = m_settings->value("RoundedWindow").toBool(); + m_style = static_cast