feat: add configurable image border radius
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user