feat: add configurable now playing label text
This commit is contained in:
@@ -96,6 +96,7 @@ make hooks-install
|
|||||||
|
|
||||||
The widget appearance can be tuned from the Plasma widget settings, including:
|
The widget appearance can be tuned from the Plasma widget settings, including:
|
||||||
|
|
||||||
|
- custom multiline label text
|
||||||
- title/artist vertical spacing
|
- title/artist vertical spacing
|
||||||
- NOW/PLAYING label vertical spacing
|
- NOW/PLAYING label vertical spacing
|
||||||
- separator gap from labels
|
- separator gap from labels
|
||||||
|
|||||||
@@ -21,6 +21,11 @@
|
|||||||
<label>Now Playing label placement</label>
|
<label>Now Playing label placement</label>
|
||||||
<default>left</default>
|
<default>left</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="labelText" type="String">
|
||||||
|
<label>Now Playing label text</label>
|
||||||
|
<default><![CDATA[NOW
|
||||||
|
PLAYING]]></default>
|
||||||
|
</entry>
|
||||||
<entry name="backgroundStyle" type="String">
|
<entry name="backgroundStyle" type="String">
|
||||||
<label>Background style</label>
|
<label>Background style</label>
|
||||||
<default>custom</default>
|
<default>custom</default>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ MouseArea {
|
|||||||
property string configuredFontFamily: "Noto Sans"
|
property string configuredFontFamily: "Noto Sans"
|
||||||
property string configuredLabelVisibilityMode: "auto"
|
property string configuredLabelVisibilityMode: "auto"
|
||||||
property string configuredLabelPlacement: "left"
|
property string configuredLabelPlacement: "left"
|
||||||
|
property string configuredLabelText: "NOW\nPLAYING"
|
||||||
property string configuredBackgroundStyle: "custom"
|
property string configuredBackgroundStyle: "custom"
|
||||||
property string configuredBackgroundColor: "transparent"
|
property string configuredBackgroundColor: "transparent"
|
||||||
property int configuredBackgroundRadius: 0
|
property int configuredBackgroundRadius: 0
|
||||||
@@ -35,6 +36,7 @@ MouseArea {
|
|||||||
readonly property int effectiveSeparatorGapLabel: Math.max(0, configuredSeparatorGapLabel)
|
readonly property int effectiveSeparatorGapLabel: Math.max(0, configuredSeparatorGapLabel)
|
||||||
readonly property int effectiveSeparatorGapTrack: Math.max(0, configuredSeparatorGapTrack)
|
readonly property int effectiveSeparatorGapTrack: Math.max(0, configuredSeparatorGapTrack)
|
||||||
readonly property int effectiveSeparatorHeight: Math.max(0, Math.min(100, configuredSeparatorHeight))
|
readonly property int effectiveSeparatorHeight: Math.max(0, Math.min(100, configuredSeparatorHeight))
|
||||||
|
readonly property var effectiveLabelLines: (configuredLabelText || "").split(/\r?\n/)
|
||||||
readonly property bool hasTrackInfo: player.ready && (((player.title || "").trim().length > 0) || ((player.artists || "").trim().length > 0))
|
readonly property bool hasTrackInfo: player.ready && (((player.title || "").trim().length > 0) || ((player.artists || "").trim().length > 0))
|
||||||
readonly property bool nowPlayingLabelsVisible: {
|
readonly property bool nowPlayingLabelsVisible: {
|
||||||
if (effectiveLabelVisibilityMode === "always")
|
if (effectiveLabelVisibilityMode === "always")
|
||||||
@@ -116,30 +118,23 @@ MouseArea {
|
|||||||
spacing: mediaControlsMouseArea.effectiveLabelVerticalSpacing
|
spacing: mediaControlsMouseArea.effectiveLabelVerticalSpacing
|
||||||
visible: mediaControlsMouseArea.nowPlayingLabelsVisible
|
visible: mediaControlsMouseArea.nowPlayingLabelsVisible
|
||||||
|
|
||||||
ShadowedLabel {
|
Repeater {
|
||||||
Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
|
model: mediaControlsMouseArea.effectiveLabelLines
|
||||||
shadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
|
|
||||||
text: "NOW"
|
|
||||||
lineHeight: 0.8
|
|
||||||
font.pixelSize: 16
|
|
||||||
font.bold: true
|
|
||||||
font.family: mediaControlsMouseArea.configuredFontFamily
|
|
||||||
color: mediaControlsMouseArea.effectiveForegroundColor
|
|
||||||
horizontalAlignment: mediaControlsMouseArea.labelsOnRight ? Text.AlignLeft : Text.AlignRight
|
|
||||||
}
|
|
||||||
|
|
||||||
ShadowedLabel {
|
delegate: ShadowedLabel {
|
||||||
id: nowPlayingLabel2
|
required property string modelData
|
||||||
|
|
||||||
|
Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
|
||||||
|
shadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
|
||||||
|
text: modelData
|
||||||
|
lineHeight: 0.8
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: 16
|
||||||
|
font.family: mediaControlsMouseArea.configuredFontFamily
|
||||||
|
color: mediaControlsMouseArea.effectiveForegroundColor
|
||||||
|
horizontalAlignment: mediaControlsMouseArea.labelsOnRight ? Text.AlignLeft : Text.AlignRight
|
||||||
|
}
|
||||||
|
|
||||||
Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
|
|
||||||
shadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
|
|
||||||
text: "PLAYING"
|
|
||||||
lineHeight: 0.8
|
|
||||||
font.bold: true
|
|
||||||
font.pixelSize: 16
|
|
||||||
font.family: mediaControlsMouseArea.configuredFontFamily
|
|
||||||
color: mediaControlsMouseArea.effectiveForegroundColor
|
|
||||||
horizontalAlignment: mediaControlsMouseArea.labelsOnRight ? Text.AlignLeft : Text.AlignRight
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ KCM.SimpleKCM {
|
|||||||
property string cfg_fontFamily
|
property string cfg_fontFamily
|
||||||
property string cfg_labelVisibilityMode
|
property string cfg_labelVisibilityMode
|
||||||
property string cfg_labelPlacement
|
property string cfg_labelPlacement
|
||||||
|
property alias cfg_labelText: labelTextArea.text
|
||||||
property string cfg_backgroundStyle
|
property string cfg_backgroundStyle
|
||||||
property alias cfg_backgroundColor: backgroundColorField.text
|
property alias cfg_backgroundColor: backgroundColorField.text
|
||||||
property alias cfg_backgroundRadius: backgroundRadiusSpinBox.value
|
property alias cfg_backgroundRadius: backgroundRadiusSpinBox.value
|
||||||
@@ -125,6 +126,16 @@ KCM.SimpleKCM {
|
|||||||
onActivated: configRoot.cfg_labelPlacement = currentValue
|
onActivated: configRoot.cfg_labelPlacement = currentValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QQC2.TextArea {
|
||||||
|
id: labelTextArea
|
||||||
|
|
||||||
|
Kirigami.FormData.label: i18n("Label text:")
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 3
|
||||||
|
placeholderText: i18n("Use a line break for multiple lines")
|
||||||
|
wrapMode: TextEdit.NoWrap
|
||||||
|
}
|
||||||
|
|
||||||
QQC2.ComboBox {
|
QQC2.ComboBox {
|
||||||
id: backgroundStyleComboBox
|
id: backgroundStyleComboBox
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ PlasmoidItem {
|
|||||||
// qmllint disable missing-property
|
// qmllint disable missing-property
|
||||||
property string configuredLabelPlacement: plasmoid.configuration.labelPlacement
|
property string configuredLabelPlacement: plasmoid.configuration.labelPlacement
|
||||||
// qmllint disable missing-property
|
// qmllint disable missing-property
|
||||||
|
property string configuredLabelText: plasmoid.configuration.labelText
|
||||||
|
// qmllint disable missing-property
|
||||||
property string configuredBackgroundStyle: plasmoid.configuration.backgroundStyle
|
property string configuredBackgroundStyle: plasmoid.configuration.backgroundStyle
|
||||||
// qmllint disable missing-property
|
// qmllint disable missing-property
|
||||||
property string configuredBackgroundColor: plasmoid.configuration.backgroundColor
|
property string configuredBackgroundColor: plasmoid.configuration.backgroundColor
|
||||||
@@ -66,6 +68,7 @@ PlasmoidItem {
|
|||||||
configuredFontFamily: root.configuredFontFamily
|
configuredFontFamily: root.configuredFontFamily
|
||||||
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
||||||
configuredLabelPlacement: root.configuredLabelPlacement
|
configuredLabelPlacement: root.configuredLabelPlacement
|
||||||
|
configuredLabelText: root.configuredLabelText
|
||||||
configuredBackgroundStyle: root.configuredBackgroundStyle
|
configuredBackgroundStyle: root.configuredBackgroundStyle
|
||||||
configuredBackgroundColor: root.configuredBackgroundColor
|
configuredBackgroundColor: root.configuredBackgroundColor
|
||||||
configuredBackgroundRadius: root.configuredBackgroundRadius
|
configuredBackgroundRadius: root.configuredBackgroundRadius
|
||||||
@@ -86,6 +89,7 @@ PlasmoidItem {
|
|||||||
configuredFontFamily: root.configuredFontFamily
|
configuredFontFamily: root.configuredFontFamily
|
||||||
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
||||||
configuredLabelPlacement: root.configuredLabelPlacement
|
configuredLabelPlacement: root.configuredLabelPlacement
|
||||||
|
configuredLabelText: root.configuredLabelText
|
||||||
configuredBackgroundStyle: root.configuredBackgroundStyle
|
configuredBackgroundStyle: root.configuredBackgroundStyle
|
||||||
configuredBackgroundColor: root.configuredBackgroundColor
|
configuredBackgroundColor: root.configuredBackgroundColor
|
||||||
configuredBackgroundRadius: root.configuredBackgroundRadius
|
configuredBackgroundRadius: root.configuredBackgroundRadius
|
||||||
|
|||||||
Reference in New Issue
Block a user