feat: add configurable now playing label text
This commit is contained in:
@@ -21,6 +21,11 @@
|
||||
<label>Now Playing label placement</label>
|
||||
<default>left</default>
|
||||
</entry>
|
||||
<entry name="labelText" type="String">
|
||||
<label>Now Playing label text</label>
|
||||
<default><![CDATA[NOW
|
||||
PLAYING]]></default>
|
||||
</entry>
|
||||
<entry name="backgroundStyle" type="String">
|
||||
<label>Background style</label>
|
||||
<default>custom</default>
|
||||
|
||||
@@ -10,6 +10,7 @@ MouseArea {
|
||||
property string configuredFontFamily: "Noto Sans"
|
||||
property string configuredLabelVisibilityMode: "auto"
|
||||
property string configuredLabelPlacement: "left"
|
||||
property string configuredLabelText: "NOW\nPLAYING"
|
||||
property string configuredBackgroundStyle: "custom"
|
||||
property string configuredBackgroundColor: "transparent"
|
||||
property int configuredBackgroundRadius: 0
|
||||
@@ -35,6 +36,7 @@ MouseArea {
|
||||
readonly property int effectiveSeparatorGapLabel: Math.max(0, configuredSeparatorGapLabel)
|
||||
readonly property int effectiveSeparatorGapTrack: Math.max(0, configuredSeparatorGapTrack)
|
||||
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 nowPlayingLabelsVisible: {
|
||||
if (effectiveLabelVisibilityMode === "always")
|
||||
@@ -116,30 +118,23 @@ MouseArea {
|
||||
spacing: mediaControlsMouseArea.effectiveLabelVerticalSpacing
|
||||
visible: mediaControlsMouseArea.nowPlayingLabelsVisible
|
||||
|
||||
ShadowedLabel {
|
||||
Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
|
||||
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
|
||||
}
|
||||
Repeater {
|
||||
model: mediaControlsMouseArea.effectiveLabelLines
|
||||
|
||||
ShadowedLabel {
|
||||
id: nowPlayingLabel2
|
||||
delegate: ShadowedLabel {
|
||||
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_labelVisibilityMode
|
||||
property string cfg_labelPlacement
|
||||
property alias cfg_labelText: labelTextArea.text
|
||||
property string cfg_backgroundStyle
|
||||
property alias cfg_backgroundColor: backgroundColorField.text
|
||||
property alias cfg_backgroundRadius: backgroundRadiusSpinBox.value
|
||||
@@ -125,6 +126,16 @@ KCM.SimpleKCM {
|
||||
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 {
|
||||
id: backgroundStyleComboBox
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ PlasmoidItem {
|
||||
// qmllint disable missing-property
|
||||
property string configuredLabelPlacement: plasmoid.configuration.labelPlacement
|
||||
// qmllint disable missing-property
|
||||
property string configuredLabelText: plasmoid.configuration.labelText
|
||||
// qmllint disable missing-property
|
||||
property string configuredBackgroundStyle: plasmoid.configuration.backgroundStyle
|
||||
// qmllint disable missing-property
|
||||
property string configuredBackgroundColor: plasmoid.configuration.backgroundColor
|
||||
@@ -66,6 +68,7 @@ PlasmoidItem {
|
||||
configuredFontFamily: root.configuredFontFamily
|
||||
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
||||
configuredLabelPlacement: root.configuredLabelPlacement
|
||||
configuredLabelText: root.configuredLabelText
|
||||
configuredBackgroundStyle: root.configuredBackgroundStyle
|
||||
configuredBackgroundColor: root.configuredBackgroundColor
|
||||
configuredBackgroundRadius: root.configuredBackgroundRadius
|
||||
@@ -86,6 +89,7 @@ PlasmoidItem {
|
||||
configuredFontFamily: root.configuredFontFamily
|
||||
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
||||
configuredLabelPlacement: root.configuredLabelPlacement
|
||||
configuredLabelText: root.configuredLabelText
|
||||
configuredBackgroundStyle: root.configuredBackgroundStyle
|
||||
configuredBackgroundColor: root.configuredBackgroundColor
|
||||
configuredBackgroundRadius: root.configuredBackgroundRadius
|
||||
|
||||
Reference in New Issue
Block a user