From 614ec3ea4836b7c8db1c3a066bf5a91c2e107e01 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 27 Mar 2019 00:57:46 +0200 Subject: [PATCH] move shortcut badges at top left corner --this way the elements are observed better and the user is able to both watch out the items and the shortcut that activates them --- .../package/contents/ui/applet/AppletItem.qml | 24 +++++++++++++++++-- .../contents/ui/applet/ShortcutBadge.qml | 6 +++-- .../package/contents/ui/task/IconItem.qml | 6 +++-- .../contents/ui/task/ShortcutBadge.qml | 6 +++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 3f665f627..d51700521 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -546,8 +546,28 @@ Item { } //! Applet Shortcut Visual Badge - ShortcutBadge{ - anchors.fill: wrapper + Item { + anchors.centerIn: parent + width: { + if (root.isHorizontal) { + return rectangled ? root.iconSize * wrapper.zoomScale : wrapper.width + } else { + return root.iconSize * wrapper.zoomScale + } + } + height: { + if (root.isHorizontal) { + return root.iconSize * wrapper.zoomScale + } else { + return rectangled ? root.iconSize * wrapper.zoomScale : wrapper.height + } + } + + property bool rectangled: canBeHovered && !lockZoom + + ShortcutBadge{ + // anchors.fill: wrapper + } } } diff --git a/containment/package/contents/ui/applet/ShortcutBadge.qml b/containment/package/contents/ui/applet/ShortcutBadge.qml index 60a29fc76..400b25492 100644 --- a/containment/package/contents/ui/applet/ShortcutBadge.qml +++ b/containment/package/contents/ui/applet/ShortcutBadge.qml @@ -97,14 +97,16 @@ Loader{ LatteComponents.BadgeText { id: appletNumber - anchors.centerIn: parent + anchors.top: parent.top + anchors.left: parent.left + //anchors.centerIn: parent minimumWidth: 0.4 * (wrapper.zoomScale * root.iconSize) height: Math.max(24, 0.4 * (wrapper.zoomScale * root.iconSize)) border.color: root.minimizedDotColor proportion: 0 - radiusPerCentage: 50 + radiusPerCentage: 100 showNumber: false showText: true textValue: appletNumberLoader.badgeString diff --git a/plasmoid/package/contents/ui/task/IconItem.qml b/plasmoid/package/contents/ui/task/IconItem.qml index 6563cd443..00114f36e 100644 --- a/plasmoid/package/contents/ui/task/IconItem.qml +++ b/plasmoid/package/contents/ui/task/IconItem.qml @@ -284,7 +284,7 @@ Item{ property bool showProgress: root.showProgressBadge && taskIcon.smartLauncherItem && !taskItem.isSeparator && taskIcon.smartLauncherItem.progressVisible - property bool showAudio: root.showAudioBadge && taskItem.hasAudioStream && taskItem.playingAudio && !taskItem.isSeparator + property bool showAudio: (root.showAudioBadge && taskItem.hasAudioStream && taskItem.playingAudio && !taskItem.isSeparator) && !shortcutBadge.active Behavior on activateProgress { NumberAnimation { duration: root.durationTime*2*units.longDuration } @@ -530,7 +530,9 @@ Item{ } //! Effects - ShortcutBadge{} + ShortcutBadge{ + id: shortcutBadge + } } VisualAddItem{ diff --git a/plasmoid/package/contents/ui/task/ShortcutBadge.qml b/plasmoid/package/contents/ui/task/ShortcutBadge.qml index 8a0e84824..67fe4554b 100644 --- a/plasmoid/package/contents/ui/task/ShortcutBadge.qml +++ b/plasmoid/package/contents/ui/task/ShortcutBadge.qml @@ -58,7 +58,9 @@ Loader{ LatteComponents.BadgeText { id: taskNumber - anchors.centerIn: parent + anchors.left: parent.left + anchors.top: parent.top + //anchors.centerIn: parent minimumWidth: 0.4 * (wrapper.mScale * root.iconSize) height: Math.max(24, 0.4 * (wrapper.mScale * root.iconSize)) @@ -69,7 +71,7 @@ Loader{ showText: true proportion: 0 - radiusPerCentage: 50 + radiusPerCentage: 100 } } }