From f7a73edaead5659cb0a5afc9c3d39cdf5f950899 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:28:43 +0200 Subject: [PATCH] relocate api indicator --- .../modules/common/widgets/StyledSwitch.qml | 2 + .../quickshell/modules/sidebarLeft/Anime.qml | 80 ++++++++++--------- .../sidebarLeft/anime/BooruTagButton.qml | 2 +- 3 files changed, 47 insertions(+), 37 deletions(-) diff --git a/.config/quickshell/modules/common/widgets/StyledSwitch.qml b/.config/quickshell/modules/common/widgets/StyledSwitch.qml index c0b0a4ff..73734f3b 100644 --- a/.config/quickshell/modules/common/widgets/StyledSwitch.qml +++ b/.config/quickshell/modules/common/widgets/StyledSwitch.qml @@ -10,6 +10,8 @@ Switch { implicitHeight: 32 * root.scale implicitWidth: 52 * root.scale + PointingHandInteraction {} + // Custom track styling background: Rectangle { width: parent.width diff --git a/.config/quickshell/modules/sidebarLeft/Anime.qml b/.config/quickshell/modules/sidebarLeft/Anime.qml index e7076214..e5e41aed 100644 --- a/.config/quickshell/modules/sidebarLeft/Anime.qml +++ b/.config/quickshell/modules/sidebarLeft/Anime.qml @@ -71,41 +71,6 @@ Item { id: columnLayout anchors.fill: parent - Rectangle { - Layout.alignment: Qt.AlignHCenter - implicitHeight: providerRowLayout.implicitHeight + 5 * 2 - implicitWidth: providerRowLayout.implicitWidth + 10 * 2 - radius: Appearance.rounding.small - color: Appearance.colors.colLayer1 - RowLayout { - id: providerRowLayout - anchors.centerIn: parent - - MaterialSymbol { - text: "api" - font.pixelSize: Appearance.font.pixelSize.large - } - StyledText { - id: providerName - font.pixelSize: Appearance.font.pixelSize.large - font.weight: Font.DemiBold - color: Appearance.m3colors.m3onSurface - text: Booru.providers[Booru.currentProvider].name - } - } - StyledToolTip { - id: toolTip - alternativeVisibleCondition: mouseArea.containsMouse // Show tooltip when hovered - content: qsTr("The current API used. Endpoint: ") + Booru.providers[Booru.currentProvider].url + qsTr("\nSet with /mode PROVIDER") - } - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - } - } - Item { Layout.fillWidth: true Layout.fillHeight: true @@ -248,6 +213,47 @@ Item { }, ] + Item { + implicitHeight: providerRowLayout.implicitHeight + 5 * 2 + implicitWidth: providerRowLayout.implicitWidth + 10 * 2 + // radius: Appearance.rounding.small + // color: Appearance.colors.colLayer1 + + RowLayout { + id: providerRowLayout + anchors.centerIn: parent + + MaterialSymbol { + text: "api" + font.pixelSize: Appearance.font.pixelSize.large + } + StyledText { + id: providerName + font.pixelSize: Appearance.font.pixelSize.small + font.weight: Font.DemiBold + color: Appearance.m3colors.m3onSurface + text: Booru.providers[Booru.currentProvider].name + } + } + StyledToolTip { + id: toolTip + alternativeVisibleCondition: mouseArea.containsMouse // Show tooltip when hovered + content: qsTr("The current API used. Endpoint: ") + Booru.providers[Booru.currentProvider].url + qsTr("\nSet with /mode PROVIDER") + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + } + } + + StyledText { + font.pixelSize: Appearance.font.pixelSize.small + color: Appearance.colors.colOnLayer1 + text: "•" + } + Rectangle { implicitWidth: switchesRow.implicitWidth @@ -266,10 +272,12 @@ Item { } StyledSwitch { id: nsfwSwitch + enabled: Booru.currentProvider !== "zerochan" scale: 0.75 Layout.alignment: Qt.AlignVCenter - checked: ConfigOptions.sidebar.booru.allowNsfw + checked: (ConfigOptions.sidebar.booru.allowNsfw && Booru.currentProvider !== "zerochan") onCheckedChanged: { + if (!nsfwSwitch.enabled) return; ConfigOptions.sidebar.booru.allowNsfw = checked } } diff --git a/.config/quickshell/modules/sidebarLeft/anime/BooruTagButton.qml b/.config/quickshell/modules/sidebarLeft/anime/BooruTagButton.qml index 0154cdd2..25bfdbb8 100644 --- a/.config/quickshell/modules/sidebarLeft/anime/BooruTagButton.qml +++ b/.config/quickshell/modules/sidebarLeft/anime/BooruTagButton.qml @@ -15,7 +15,7 @@ Button { leftPadding: 10 rightPadding: 10 - // PointingHandInteraction {} + PointingHandInteraction {} background: Rectangle { radius: Appearance.rounding.small