diff --git a/package/contents/config/main.xml b/package/contents/config/main.xml index a6683ee..fee3bfd 100644 --- a/package/contents/config/main.xml +++ b/package/contents/config/main.xml @@ -42,6 +42,10 @@ PLAYING]]> false + + + 8 + custom diff --git a/package/contents/ui/Representation.qml b/package/contents/ui/Representation.qml index 49f22c1..bc3f20d 100644 --- a/package/contents/ui/Representation.qml +++ b/package/contents/ui/Representation.qml @@ -1,3 +1,4 @@ +import Qt5Compat.GraphicalEffects import QtQuick import QtQuick.Controls as QQC2 import QtQuick.Layouts @@ -15,6 +16,7 @@ MouseArea { property string configuredLabelPlacement: "left" property string configuredLabelText: "NOW\nPLAYING" property bool configuredUseLabelArtwork: false + property int configuredImageBorderRadius: 8 property string configuredBackgroundStyle: "custom" property string configuredBackgroundColor: "transparent" property int configuredBackgroundRadius: 0 @@ -33,6 +35,7 @@ MouseArea { readonly property bool usesCustomBackground: configuredBackgroundStyle === "custom" readonly property int hideModeHorizontalPadding: 8 readonly property int labelRailWidth: 100 + readonly property int effectiveImageBorderRadius: Math.max(0, configuredImageBorderRadius) readonly property string effectiveBackgroundColor: configuredBackgroundColor || "transparent" readonly property int effectiveBackgroundRadius: Math.max(0, configuredBackgroundRadius) readonly property string effectiveForegroundColor: configuredForegroundColor || "white" @@ -179,10 +182,24 @@ MouseArea { asynchronous: true cache: true fillMode: Image.PreserveAspectCrop + visible: false source: mediaControlsMouseArea.configuredUseLabelArtwork ? player.artUrl : "" sourceSize.width: mediaControlsMouseArea.labelRailWidth sourceSize.height: mediaControlsMouseArea.labelRailWidth + } + + OpacityMask { + anchors.fill: parent + cached: true + source: artworkImage visible: labelContent.artworkReady + + maskSource: Rectangle { + width: labelContent.width + height: labelContent.height + radius: mediaControlsMouseArea.effectiveImageBorderRadius + } + } Column { diff --git a/package/contents/ui/configGeneral.qml b/package/contents/ui/configGeneral.qml index fe567b1..529dbd8 100644 --- a/package/contents/ui/configGeneral.qml +++ b/package/contents/ui/configGeneral.qml @@ -17,6 +17,7 @@ KCM.SimpleKCM { property string cfg_labelPlacement property alias cfg_labelText: labelTextArea.text property alias cfg_useLabelArtwork: useLabelArtworkCheckBox.checked + property alias cfg_imageBorderRadius: imageBorderRadiusSpinBox.value property string cfg_backgroundStyle property alias cfg_backgroundColor: backgroundColorField.text property alias cfg_backgroundRadius: backgroundRadiusSpinBox.value @@ -228,6 +229,14 @@ KCM.SimpleKCM { text: i18n("Show track image when available") } + QQC2.SpinBox { + id: imageBorderRadiusSpinBox + + Kirigami.FormData.label: i18n("Image border radius:") + from: 0 + to: 100 + } + QQC2.TextArea { id: labelTextArea diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index 35a2931..aa8e7cd 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -29,6 +29,8 @@ PlasmoidItem { // qmllint disable missing-property property bool configuredUseLabelArtwork: plasmoid.configuration.useLabelArtwork // qmllint disable missing-property + property int configuredImageBorderRadius: plasmoid.configuration.imageBorderRadius + // qmllint disable missing-property property string configuredBackgroundStyle: plasmoid.configuration.backgroundStyle // qmllint disable missing-property property string configuredBackgroundColor: plasmoid.configuration.backgroundColor @@ -86,6 +88,7 @@ PlasmoidItem { configuredLabelPlacement: root.configuredLabelPlacement configuredLabelText: root.configuredLabelText configuredUseLabelArtwork: root.configuredUseLabelArtwork + configuredImageBorderRadius: root.configuredImageBorderRadius configuredBackgroundStyle: root.configuredBackgroundStyle configuredBackgroundColor: root.configuredBackgroundColor configuredBackgroundRadius: root.configuredBackgroundRadius @@ -114,6 +117,7 @@ PlasmoidItem { configuredLabelPlacement: root.configuredLabelPlacement configuredLabelText: root.configuredLabelText configuredUseLabelArtwork: root.configuredUseLabelArtwork + configuredImageBorderRadius: root.configuredImageBorderRadius configuredBackgroundStyle: root.configuredBackgroundStyle configuredBackgroundColor: root.configuredBackgroundColor configuredBackgroundRadius: root.configuredBackgroundRadius