From 01293edb6067f2b2ae66eb05fe842a546c30e3a8 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 18 Aug 2023 22:13:41 -0400 Subject: [PATCH] Add link indicators for news --- launcher/ui/Pages/NewsPage.qml | 18 ++++++++++++++++++ launcher/ui/main.qml | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/launcher/ui/Pages/NewsPage.qml b/launcher/ui/Pages/NewsPage.qml index b57b6b9..f3d8dc6 100644 --- a/launcher/ui/Pages/NewsPage.qml +++ b/launcher/ui/Pages/NewsPage.qml @@ -61,8 +61,11 @@ Controls.Control { anchors.fill: parent cursorShape: Qt.PointingHandCursor + hoverEnabled: true onClicked: applicationWindow().openUrl(LauncherCore.headline.banners[page.currentBannerIndex].link) + onEntered: applicationWindow().hoverLinkIndicator.text = LauncherCore.headline.banners[page.currentBannerIndex].link + onExited: applicationWindow().hoverLinkIndicator.text = "" } layer.enabled: true @@ -103,6 +106,13 @@ Controls.Control { description: Qt.formatDate(modelData.date) onClicked: applicationWindow().openUrl(modelData.url) + onHoveredChanged: { + if (hovered) { + applicationWindow().hoverLinkIndicator.text = modelData.url; + } else { + applicationWindow().hoverLinkIndicator.text = ""; + } + } } } @@ -135,7 +145,15 @@ Controls.Control { text: modelData.title description: Qt.formatDate(modelData.date) + hoverEnabled: true onClicked: applicationWindow().openUrl(modelData.url) + onHoveredChanged: { + if (hovered) { + applicationWindow().hoverLinkIndicator.text = modelData.url; + } else { + applicationWindow().hoverLinkIndicator.text = ""; + } + } } } diff --git a/launcher/ui/main.qml b/launcher/ui/main.qml index 81965f1..9773d08 100644 --- a/launcher/ui/main.qml +++ b/launcher/ui/main.qml @@ -101,4 +101,27 @@ Kirigami.ApplicationWindow { } Component.onCompleted: checkSetup() + + property Item hoverLinkIndicator: Controls.Control { + parent: overlay.parent + property alias text: linkText.text + opacity: text.length > 0 ? 1 : 0 + + Behavior on opacity { + OpacityAnimator { + duration: Kirigami.Units.longDuration + } + } + + z: 999990 + x: 0 + y: parent.height - implicitHeight + contentItem: Controls.Label { + id: linkText + } + Kirigami.Theme.colorSet: Kirigami.Theme.View + background: Rectangle { + color: Kirigami.Theme.backgroundColor + } + } }