From c77a12d7bb5f329cfbc617a67d9cc780b5cbceda Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 18 May 2025 12:23:02 -0700 Subject: [PATCH] ui/reload: add textual fallback for copy and close icons --- src/ui/ReloadPopup.qml | 27 ++++++++++++++++++++++----- src/ui/reload_popup.cpp | 2 +- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/ui/ReloadPopup.qml b/src/ui/ReloadPopup.qml index cf2806d2..81fa1ee2 100644 --- a/src/ui/ReloadPopup.qml +++ b/src/ui/ReloadPopup.qml @@ -58,7 +58,8 @@ PanelWindow { component TopButton: WrapperMouseArea { id: buttonMouse - property alias image: image.source + required property string icon + required property string fallbackText property bool red: false hoverEnabled: true @@ -95,7 +96,20 @@ PanelWindow { Behavior on color { ColorAnimation { duration: 100 } } Behavior on border.color { ColorAnimation { duration: 100 } } - IconImage { id: image; implicitSize: 22 } + IconImage { + id: image + source: Quickshell.iconPath(buttonMouse.icon, true) + implicitSize: 22 + visible: source != "" + } + + Text { + id: fallback + text: buttonMouse.fallbackText + color: buttonMouse.red ? "white" : palette.active.buttonText + } + + child: image.visible ? image : fallback } } @@ -130,7 +144,8 @@ PanelWindow { TopButton { id: copyButton visible: root.failed - image: Quickshell.iconPath("edit-copy") + icon: "edit-copy" + fallbackText: "Copy" onClicked: { Quickshell.clipboardText = root.errorString; copyTooltip.showAction(); @@ -146,7 +161,8 @@ PanelWindow { } TopButton { - image: Quickshell.iconPath("window-close") + icon: "window-close" + fallbackText: "Close" red: true onClicked: { fadeOutAnim.stop() @@ -216,7 +232,8 @@ PanelWindow { IconImage { Layout.fillHeight: true implicitWidth: height - source: Quickshell.iconPath("edit-copy") + source: Quickshell.iconPath("edit-copy", true) + visible: source != "" } } } diff --git a/src/ui/reload_popup.cpp b/src/ui/reload_popup.cpp index 9a77fae3..8e58dc9d 100644 --- a/src/ui/reload_popup.cpp +++ b/src/ui/reload_popup.cpp @@ -39,7 +39,7 @@ void ReloadPopup::closed() { this->deleting = true; QTimer::singleShot(0, [this]() { - this->popup->deleteLater(); + if (this->popup) this->popup->deleteLater(); this->generation->destroy(); this->deleteLater(); });