From 54514522d433d44f3cb23d6b008bc34d414e8c0c Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:18:27 +0200 Subject: [PATCH] booru: add api provider indicator --- .../modules/common/widgets/StyledToolTip.qml | 6 ++-- .../quickshell/modules/sidebarLeft/Anime.qml | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/modules/common/widgets/StyledToolTip.qml b/.config/quickshell/modules/common/widgets/StyledToolTip.qml index 8fa4f60c8..73a06c92f 100644 --- a/.config/quickshell/modules/common/widgets/StyledToolTip.qml +++ b/.config/quickshell/modules/common/widgets/StyledToolTip.qml @@ -7,10 +7,11 @@ import QtQuick.Layouts ToolTip { property string content property bool extraVisibleCondition: true + property bool alternativeVisibleCondition: false property bool internalVisibleCondition: false padding: 7 - visible: (extraVisibleCondition && (parent.hovered === undefined || parent?.hovered) && internalVisibleCondition) + visible: ((extraVisibleCondition && (parent.hovered === undefined || parent?.hovered) && internalVisibleCondition)) || alternativeVisibleCondition Connections { target: parent @@ -36,7 +37,8 @@ ToolTip { background: Rectangle { color: Appearance.colors.colTooltip radius: Appearance.rounding.small - width: tooltipTextObject.width + 2 * padding + implicitWidth: tooltipTextObject.width + 2 * padding + implicitHeight: tooltipTextObject.height + 2 * padding Behavior on opacity { OpacityAnimator { duration: Appearance.animation.elementDecel.duration diff --git a/.config/quickshell/modules/sidebarLeft/Anime.qml b/.config/quickshell/modules/sidebarLeft/Anime.qml index f73cff822..e7076214d 100644 --- a/.config/quickshell/modules/sidebarLeft/Anime.qml +++ b/.config/quickshell/modules/sidebarLeft/Anime.qml @@ -71,6 +71,41 @@ 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