Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a48b1b3a9 | |||
| 42268d7266 | |||
| 6d8f237547 | |||
| 45906f07c6 | |||
| c26793dfe2 | |||
| de22c05c33 | |||
| 3d334b9896 | |||
| 7045ecf8e6 | |||
| b88c2ba3c5 |
@@ -0,0 +1,19 @@
|
||||
# AGENTS
|
||||
|
||||
## Commit Style
|
||||
|
||||
- Use Conventional Commits for every commit message.
|
||||
- Required format: `type(scope): subject` or `type: subject`.
|
||||
- Keep `type`, optional `scope`, and subject text lowercase.
|
||||
- Use imperative, concise subjects.
|
||||
- Proper nouns may keep their normal capitalization only when necessary.
|
||||
|
||||
Valid examples:
|
||||
- `feat(ui): add artist text truncation`
|
||||
- `fix: handle empty metadata values`
|
||||
- `chore(release): bump plasmoid version`
|
||||
|
||||
Invalid examples:
|
||||
- `Feat(ui): add artist text truncation` (uppercase type)
|
||||
- `fix(UI): handle empty metadata values` (uppercase scope)
|
||||
- `fix: Handle empty metadata values` (uppercase subject)
|
||||
@@ -38,6 +38,14 @@
|
||||
<default><![CDATA[NOW
|
||||
PLAYING]]></default>
|
||||
</entry>
|
||||
<entry name="useLabelArtwork" type="Bool">
|
||||
<label>Show track image when available</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="imageBorderRadius" type="Int">
|
||||
<label>Image border radius</label>
|
||||
<default>8</default>
|
||||
</entry>
|
||||
<entry name="backgroundStyle" type="String">
|
||||
<label>Background style</label>
|
||||
<default>custom</default>
|
||||
@@ -58,6 +66,10 @@ PLAYING]]></default>
|
||||
<label>Enable text shadow</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="showMediaControls" type="Bool">
|
||||
<label>Show media controls</label>
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="trackTextVerticalSpacing" type="Int">
|
||||
<label>Track text vertical spacing</label>
|
||||
<default>5</default>
|
||||
@@ -78,5 +90,9 @@ PLAYING]]></default>
|
||||
<label>Separator height percent</label>
|
||||
<default>90</default>
|
||||
</entry>
|
||||
<entry name="hideSeparator" type="Bool">
|
||||
<label>Hide separator</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
Item {
|
||||
id: labelContent
|
||||
|
||||
required property string artworkSource
|
||||
required property var labelLines
|
||||
required property string fontFamily
|
||||
required property int fontPixelSize
|
||||
required property string textColor
|
||||
required property bool textShadowEnabled
|
||||
required property int verticalSpacing
|
||||
required property int horizontalAlignment
|
||||
required property int borderRadius
|
||||
required property int artworkSize
|
||||
property string currentArtworkSource: ""
|
||||
property string incomingArtworkSource: ""
|
||||
property real currentArtworkOpacity: 0
|
||||
property real incomingArtworkOpacity: 0
|
||||
property bool crossfadeActive: false
|
||||
readonly property bool artworkVisible: currentArtworkOpacity > 0 || incomingArtworkOpacity > 0
|
||||
readonly property bool holdsArtworkSlot: currentArtworkSource.length > 0 || artworkVisible
|
||||
readonly property real textOpacity: crossfadeActive || (currentArtworkSource.length > 0 && incomingArtworkSource.length > 0) ? 0 : 1 - Math.max(currentArtworkOpacity, incomingArtworkOpacity)
|
||||
|
||||
function resetIncomingArtwork() {
|
||||
incomingArtworkSource = "";
|
||||
incomingArtworkOpacity = 0;
|
||||
crossfadeActive = false;
|
||||
}
|
||||
|
||||
function finishIncomingArtwork() {
|
||||
currentArtworkSource = incomingArtworkSource;
|
||||
currentArtworkOpacity = incomingArtworkOpacity;
|
||||
resetIncomingArtwork();
|
||||
}
|
||||
|
||||
function clearCurrentArtwork() {
|
||||
currentArtworkSource = "";
|
||||
currentArtworkOpacity = 0;
|
||||
resetIncomingArtwork();
|
||||
}
|
||||
|
||||
function startFadeOutToText() {
|
||||
crossfadeAnimation.stop();
|
||||
fadeInIncomingArtwork.stop();
|
||||
resetIncomingArtwork();
|
||||
if (currentArtworkSource.length === 0 && currentArtworkOpacity === 0) {
|
||||
clearCurrentArtwork();
|
||||
return ;
|
||||
}
|
||||
fadeOutCurrentArtwork.restart();
|
||||
}
|
||||
|
||||
function handleArtworkSourceChange() {
|
||||
const nextSource = artworkSource;
|
||||
if (nextSource.length === 0) {
|
||||
startFadeOutToText();
|
||||
return ;
|
||||
}
|
||||
if (nextSource === currentArtworkSource) {
|
||||
fadeOutCurrentArtwork.stop();
|
||||
currentArtworkOpacity = currentArtworkSource.length > 0 ? 1 : 0;
|
||||
resetIncomingArtwork();
|
||||
return ;
|
||||
}
|
||||
if (nextSource === incomingArtworkSource)
|
||||
return ;
|
||||
|
||||
fadeOutCurrentArtwork.stop();
|
||||
if (currentArtworkSource.length > 0)
|
||||
currentArtworkOpacity = 1;
|
||||
|
||||
crossfadeAnimation.stop();
|
||||
fadeInIncomingArtwork.stop();
|
||||
incomingArtworkSource = nextSource;
|
||||
incomingArtworkOpacity = 0;
|
||||
crossfadeActive = false;
|
||||
}
|
||||
|
||||
function startIncomingTransition() {
|
||||
if (incomingArtworkSource.length === 0 || incomingArtworkSource !== artworkSource)
|
||||
return ;
|
||||
|
||||
fadeOutCurrentArtwork.stop();
|
||||
incomingArtworkOpacity = 0;
|
||||
if (currentArtworkSource.length > 0 && currentArtworkOpacity > 0) {
|
||||
crossfadeActive = true;
|
||||
currentArtworkOpacity = 1;
|
||||
crossfadeAnimation.restart();
|
||||
} else {
|
||||
crossfadeActive = false;
|
||||
currentArtworkOpacity = 0;
|
||||
fadeInIncomingArtwork.restart();
|
||||
}
|
||||
}
|
||||
|
||||
function handleIncomingArtworkFailure() {
|
||||
if (incomingArtworkSource.length === 0)
|
||||
return ;
|
||||
|
||||
resetIncomingArtwork();
|
||||
startFadeOutToText();
|
||||
}
|
||||
|
||||
clip: holdsArtworkSlot
|
||||
implicitHeight: holdsArtworkSlot ? artworkSize : labelTextColumn.implicitHeight
|
||||
onArtworkSourceChanged: handleArtworkSourceChange()
|
||||
Component.onCompleted: handleArtworkSourceChange()
|
||||
|
||||
Image {
|
||||
id: currentArtworkImage
|
||||
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
cache: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
opacity: 0
|
||||
source: labelContent.currentArtworkSource
|
||||
sourceSize.width: labelContent.artworkSize
|
||||
sourceSize.height: labelContent.artworkSize
|
||||
}
|
||||
|
||||
Image {
|
||||
id: incomingArtworkImage
|
||||
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
cache: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
opacity: 0
|
||||
source: labelContent.incomingArtworkSource
|
||||
sourceSize.width: labelContent.artworkSize
|
||||
sourceSize.height: labelContent.artworkSize
|
||||
onSourceChanged: labelContent.incomingArtworkOpacity = 0
|
||||
onStatusChanged: {
|
||||
if (source.toString().length === 0)
|
||||
return ;
|
||||
|
||||
if (status === Image.Ready)
|
||||
labelContent.startIncomingTransition();
|
||||
else if (status === Image.Error)
|
||||
labelContent.handleIncomingArtworkFailure();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: artworkMaskShape
|
||||
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
color: "white"
|
||||
layer.enabled: true
|
||||
radius: labelContent.borderRadius
|
||||
visible: false
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
id: currentArtworkMask
|
||||
|
||||
anchors.fill: parent
|
||||
autoPaddingEnabled: false
|
||||
maskEnabled: true
|
||||
maskSource: artworkMaskShape
|
||||
source: currentArtworkImage
|
||||
opacity: labelContent.currentArtworkOpacity
|
||||
visible: labelContent.currentArtworkSource.length > 0 && opacity > 0
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
id: incomingArtworkMask
|
||||
|
||||
anchors.fill: parent
|
||||
autoPaddingEnabled: false
|
||||
maskEnabled: true
|
||||
maskSource: artworkMaskShape
|
||||
source: incomingArtworkImage
|
||||
opacity: labelContent.incomingArtworkOpacity
|
||||
visible: labelContent.incomingArtworkSource.length > 0 && opacity > 0
|
||||
}
|
||||
|
||||
Column {
|
||||
id: labelTextColumn
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: labelContent.verticalSpacing
|
||||
opacity: labelContent.textOpacity
|
||||
visible: opacity > 0
|
||||
|
||||
Repeater {
|
||||
model: labelContent.labelLines
|
||||
|
||||
delegate: ShadowedLabel {
|
||||
required property string modelData
|
||||
|
||||
width: labelTextColumn.width
|
||||
shadowEnabled: labelContent.textShadowEnabled
|
||||
text: modelData
|
||||
lineHeight: 0.8
|
||||
font.bold: true
|
||||
font.pixelSize: labelContent.fontPixelSize
|
||||
font.family: labelContent.fontFamily
|
||||
color: labelContent.textColor
|
||||
horizontalAlignment: labelContent.horizontalAlignment
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 250
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: crossfadeAnimation
|
||||
|
||||
ParallelAnimation {
|
||||
NumberAnimation {
|
||||
target: labelContent
|
||||
property: "currentArtworkOpacity"
|
||||
to: 0
|
||||
duration: 250
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
target: labelContent
|
||||
property: "incomingArtworkOpacity"
|
||||
to: 1
|
||||
duration: 250
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: labelContent.finishIncomingArtwork()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: fadeInIncomingArtwork
|
||||
|
||||
NumberAnimation {
|
||||
target: labelContent
|
||||
property: "incomingArtworkOpacity"
|
||||
to: 1
|
||||
duration: 250
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: labelContent.finishIncomingArtwork()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: fadeOutCurrentArtwork
|
||||
|
||||
NumberAnimation {
|
||||
target: labelContent
|
||||
property: "currentArtworkOpacity"
|
||||
to: 0
|
||||
duration: 250
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: labelContent.clearCurrentArtwork()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.plasma.components as PlasmaComponents
|
||||
|
||||
MouseArea {
|
||||
id: mediaControlsMouseArea
|
||||
@@ -14,16 +13,20 @@ MouseArea {
|
||||
property string configuredLabelVisibilityMode: "auto"
|
||||
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
|
||||
property string configuredForegroundColor: "white"
|
||||
property bool configuredTextShadowEnabled: false
|
||||
property bool configuredShowMediaControls: true
|
||||
property int configuredTrackTextVerticalSpacing: 5
|
||||
property int configuredLabelVerticalSpacing: 0
|
||||
property int configuredSeparatorGapLabel: 4
|
||||
property int configuredSeparatorGapTrack: 4
|
||||
property int configuredSeparatorHeight: 90
|
||||
property bool configuredHideSeparator: false
|
||||
readonly property double buttonSize: 16
|
||||
readonly property string effectiveLabelVisibilityMode: configuredLabelVisibilityMode === "always" || configuredLabelVisibilityMode === "never" ? configuredLabelVisibilityMode : "auto"
|
||||
readonly property bool labelsOnRight: configuredLabelPlacement === "right"
|
||||
@@ -31,6 +34,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"
|
||||
@@ -43,9 +47,10 @@ MouseArea {
|
||||
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 mediaControlsEnabled: configuredShowMediaControls
|
||||
readonly property bool hasTrackInfo: player.ready && (((player.title || "").trim().length > 0) || ((player.artists || "").trim().length > 0))
|
||||
readonly property bool rawHoverActive: rootHoverHandler.hovered
|
||||
readonly property bool controlsHoverActive: rawHoverActive || hoverExitTimer.running
|
||||
readonly property bool rawHoverActive: mediaControlsEnabled && rootHoverHandler.hovered
|
||||
readonly property bool controlsHoverActive: mediaControlsEnabled && (rawHoverActive || hoverExitTimer.running)
|
||||
readonly property bool nowPlayingLabelsVisible: {
|
||||
if (effectiveLabelVisibilityMode === "always")
|
||||
return true;
|
||||
@@ -60,12 +65,25 @@ MouseArea {
|
||||
acceptedButtons: Qt.NoButton
|
||||
hoverEnabled: true
|
||||
onRawHoverActiveChanged: {
|
||||
if (!mediaControlsMouseArea.mediaControlsEnabled) {
|
||||
hoverExitTimer.stop();
|
||||
return ;
|
||||
}
|
||||
if (rawHoverActive)
|
||||
hoverExitTimer.stop();
|
||||
else
|
||||
hoverExitTimer.restart();
|
||||
}
|
||||
onMediaControlsEnabledChanged: {
|
||||
if (!mediaControlsMouseArea.mediaControlsEnabled)
|
||||
hoverExitTimer.stop();
|
||||
|
||||
}
|
||||
Keys.onPressed: (event) => {
|
||||
if (!mediaControlsMouseArea.mediaControlsEnabled) {
|
||||
event.accepted = false;
|
||||
return ;
|
||||
}
|
||||
if (!event.modifiers) {
|
||||
event.accepted = true;
|
||||
if (event.key === Qt.Key_Space || event.key === Qt.Key_K)
|
||||
@@ -82,7 +100,8 @@ MouseArea {
|
||||
HoverHandler {
|
||||
id: rootHoverHandler
|
||||
|
||||
margin: 12
|
||||
enabled: mediaControlsMouseArea.mediaControlsEnabled
|
||||
margin: 60
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -143,27 +162,21 @@ MouseArea {
|
||||
|
||||
Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
|
||||
Layout.fillWidth: true
|
||||
spacing: mediaControlsMouseArea.effectiveLabelVerticalSpacing
|
||||
visible: mediaControlsMouseArea.nowPlayingLabelsVisible
|
||||
|
||||
Repeater {
|
||||
model: mediaControlsMouseArea.effectiveLabelLines
|
||||
|
||||
delegate: ShadowedLabel {
|
||||
required property string modelData
|
||||
|
||||
LabelContent {
|
||||
Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
|
||||
Layout.fillWidth: true
|
||||
shadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
|
||||
text: modelData
|
||||
lineHeight: 0.8
|
||||
font.bold: true
|
||||
font.pixelSize: mediaControlsMouseArea.effectiveLabelFontSize
|
||||
font.family: mediaControlsMouseArea.configuredFontFamily
|
||||
color: mediaControlsMouseArea.effectiveForegroundColor
|
||||
artworkSource: mediaControlsMouseArea.configuredUseLabelArtwork ? player.artUrl : ""
|
||||
labelLines: mediaControlsMouseArea.effectiveLabelLines
|
||||
fontFamily: mediaControlsMouseArea.configuredFontFamily
|
||||
fontPixelSize: mediaControlsMouseArea.effectiveLabelFontSize
|
||||
textColor: mediaControlsMouseArea.effectiveForegroundColor
|
||||
textShadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
|
||||
verticalSpacing: mediaControlsMouseArea.effectiveLabelVerticalSpacing
|
||||
horizontalAlignment: mediaControlsMouseArea.labelsOnRight ? Text.AlignLeft : Text.AlignRight
|
||||
}
|
||||
|
||||
borderRadius: mediaControlsMouseArea.effectiveImageBorderRadius
|
||||
artworkSize: mediaControlsMouseArea.labelRailWidth
|
||||
}
|
||||
|
||||
}
|
||||
@@ -172,9 +185,9 @@ MouseArea {
|
||||
id: mediaControls
|
||||
|
||||
Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
|
||||
enabled: mediaControlsMouseArea.controlsHoverActive
|
||||
opacity: mediaControlsMouseArea.controlsHoverActive && mediaControlsMouseArea.nowPlayingLabelsVisible && !mediaControlsMouseArea.hideNowPlayingArea ? 1 : 0
|
||||
visible: mediaControlsMouseArea.controlsHoverActive && mediaControlsMouseArea.nowPlayingLabelsVisible && !mediaControlsMouseArea.hideNowPlayingArea
|
||||
enabled: mediaControlsMouseArea.mediaControlsEnabled && mediaControlsMouseArea.controlsHoverActive
|
||||
opacity: mediaControlsMouseArea.mediaControlsEnabled && mediaControlsMouseArea.controlsHoverActive && mediaControlsMouseArea.nowPlayingLabelsVisible && !mediaControlsMouseArea.hideNowPlayingArea ? 1 : 0
|
||||
visible: mediaControlsMouseArea.mediaControlsEnabled && mediaControlsMouseArea.controlsHoverActive && mediaControlsMouseArea.nowPlayingLabelsVisible && !mediaControlsMouseArea.hideNowPlayingArea
|
||||
|
||||
QQC2.Button {
|
||||
Layout.preferredWidth: buttonSize
|
||||
@@ -268,7 +281,7 @@ MouseArea {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 1
|
||||
height: Math.round(parent.height * mediaControlsMouseArea.effectiveSeparatorHeight / 100)
|
||||
color: mediaControlsMouseArea.effectiveForegroundColor
|
||||
color: mediaControlsMouseArea.configuredHideSeparator ? "transparent" : mediaControlsMouseArea.effectiveForegroundColor
|
||||
}
|
||||
|
||||
}
|
||||
@@ -312,44 +325,4 @@ MouseArea {
|
||||
|
||||
}
|
||||
|
||||
component ShadowedLabel: Item {
|
||||
id: shadowedLabel
|
||||
|
||||
property alias text: foregroundLabel.text
|
||||
property alias font: foregroundLabel.font
|
||||
property alias lineHeight: foregroundLabel.lineHeight
|
||||
property alias elide: foregroundLabel.elide
|
||||
property alias horizontalAlignment: foregroundLabel.horizontalAlignment
|
||||
property alias verticalAlignment: foregroundLabel.verticalAlignment
|
||||
property alias color: foregroundLabel.color
|
||||
property bool shadowEnabled: false
|
||||
|
||||
implicitWidth: foregroundLabel.implicitWidth + (shadowEnabled ? 1 : 0)
|
||||
implicitHeight: foregroundLabel.implicitHeight + (shadowEnabled ? 1 : 0)
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: shadowLabel
|
||||
|
||||
visible: shadowedLabel.shadowEnabled
|
||||
x: 1
|
||||
y: 1
|
||||
width: foregroundLabel.width
|
||||
height: foregroundLabel.height
|
||||
text: foregroundLabel.text
|
||||
font: foregroundLabel.font
|
||||
lineHeight: foregroundLabel.lineHeight
|
||||
elide: foregroundLabel.elide
|
||||
horizontalAlignment: foregroundLabel.horizontalAlignment
|
||||
verticalAlignment: foregroundLabel.verticalAlignment
|
||||
color: "#99000000"
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: foregroundLabel
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import org.kde.plasma.components as PlasmaComponents
|
||||
|
||||
Item {
|
||||
id: shadowedLabel
|
||||
|
||||
property alias text: foregroundLabel.text
|
||||
property alias font: foregroundLabel.font
|
||||
property alias lineHeight: foregroundLabel.lineHeight
|
||||
property alias elide: foregroundLabel.elide
|
||||
property alias horizontalAlignment: foregroundLabel.horizontalAlignment
|
||||
property alias verticalAlignment: foregroundLabel.verticalAlignment
|
||||
property alias color: foregroundLabel.color
|
||||
property bool shadowEnabled: false
|
||||
readonly property real contentWidth: width > 0 ? width : foregroundLabel.implicitWidth
|
||||
readonly property real contentHeight: height > 0 ? height : foregroundLabel.implicitHeight
|
||||
|
||||
implicitWidth: foregroundLabel.implicitWidth
|
||||
implicitHeight: foregroundLabel.implicitHeight
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: shadowSourceLabel
|
||||
|
||||
visible: false
|
||||
width: shadowedLabel.contentWidth
|
||||
height: shadowedLabel.contentHeight
|
||||
text: foregroundLabel.text
|
||||
font: foregroundLabel.font
|
||||
lineHeight: foregroundLabel.lineHeight
|
||||
elide: foregroundLabel.elide
|
||||
horizontalAlignment: foregroundLabel.horizontalAlignment
|
||||
verticalAlignment: foregroundLabel.verticalAlignment
|
||||
color: "white"
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
x: shadowSourceLabel.x
|
||||
y: shadowSourceLabel.y
|
||||
width: shadowSourceLabel.width
|
||||
height: shadowSourceLabel.height
|
||||
autoPaddingEnabled: true
|
||||
shadowBlur: 0.5
|
||||
shadowColor: "#3f4c66"
|
||||
shadowEnabled: shadowedLabel.shadowEnabled
|
||||
shadowHorizontalOffset: 0
|
||||
shadowOpacity: 0.42
|
||||
shadowScale: 1
|
||||
shadowVerticalOffset: 2
|
||||
source: shadowSourceLabel
|
||||
visible: shadowedLabel.shadowEnabled
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: foregroundLabel
|
||||
|
||||
width: shadowedLabel.contentWidth
|
||||
height: shadowedLabel.contentHeight
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,16 +16,20 @@ KCM.SimpleKCM {
|
||||
property string cfg_labelVisibilityMode
|
||||
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
|
||||
property alias cfg_foregroundColor: foregroundColorField.text
|
||||
property alias cfg_textShadowEnabled: textShadowCheckBox.checked
|
||||
property alias cfg_showMediaControls: showMediaControlsCheckBox.checked
|
||||
property alias cfg_trackTextVerticalSpacing: trackTextVerticalSpacingSpinBox.value
|
||||
property alias cfg_labelVerticalSpacing: labelVerticalSpacingSpinBox.value
|
||||
property alias cfg_separatorGapLabel: separatorGapLabelSpinBox.value
|
||||
property alias cfg_separatorGapTrack: separatorGapTrackSpinBox.value
|
||||
property alias cfg_separatorHeight: separatorHeightSpinBox.value
|
||||
property alias cfg_hideSeparator: hideSeparatorCheckBox.checked
|
||||
readonly property var availableFonts: Qt.fontFamilies()
|
||||
readonly property var labelVisibilityOptions: [{
|
||||
"text": i18n("Auto hide when idle"),
|
||||
@@ -67,33 +71,6 @@ KCM.SimpleKCM {
|
||||
return options[resolvedIndex].value;
|
||||
}
|
||||
|
||||
component SectionHeader: Item {
|
||||
required property string title
|
||||
Kirigami.FormData.isSection: true
|
||||
implicitHeight: sectionLayout.implicitHeight
|
||||
|
||||
ColumnLayout {
|
||||
id: sectionLayout
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
|
||||
QQC2.Label {
|
||||
text: parent.parent.title
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 1
|
||||
color: Kirigami.Theme.textColor
|
||||
opacity: 0.25
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onCfg_fontFamilyChanged: {
|
||||
const index = availableFonts.indexOf(cfg_fontFamily);
|
||||
if (index >= 0 && fontFamilyComboBox.currentIndex !== index)
|
||||
@@ -207,6 +184,13 @@ KCM.SimpleKCM {
|
||||
text: i18n("Enable")
|
||||
}
|
||||
|
||||
QQC2.CheckBox {
|
||||
id: showMediaControlsCheckBox
|
||||
|
||||
Kirigami.FormData.label: i18n("Media controls:")
|
||||
text: i18n("Show media controls")
|
||||
}
|
||||
|
||||
QQC2.SpinBox {
|
||||
id: separatorHeightSpinBox
|
||||
|
||||
@@ -215,6 +199,13 @@ KCM.SimpleKCM {
|
||||
to: 100
|
||||
}
|
||||
|
||||
QQC2.CheckBox {
|
||||
id: hideSeparatorCheckBox
|
||||
|
||||
Kirigami.FormData.label: i18n("Separator:")
|
||||
text: i18n("Hide separator")
|
||||
}
|
||||
|
||||
SectionHeader {
|
||||
title: i18n("Label")
|
||||
}
|
||||
@@ -239,6 +230,21 @@ KCM.SimpleKCM {
|
||||
onActivated: configRoot.cfg_labelPlacement = currentValue
|
||||
}
|
||||
|
||||
QQC2.CheckBox {
|
||||
id: useLabelArtworkCheckBox
|
||||
|
||||
Kirigami.FormData.label: i18n("Label image:")
|
||||
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
|
||||
|
||||
@@ -327,4 +333,33 @@ KCM.SimpleKCM {
|
||||
onAccepted: configRoot.cfg_foregroundColor = selectedColor.toString()
|
||||
}
|
||||
|
||||
component SectionHeader: Item {
|
||||
required property string title
|
||||
|
||||
Kirigami.FormData.isSection: true
|
||||
implicitHeight: sectionLayout.implicitHeight
|
||||
|
||||
ColumnLayout {
|
||||
id: sectionLayout
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
|
||||
QQC2.Label {
|
||||
text: parent.parent.title
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 1
|
||||
color: Kirigami.Theme.textColor
|
||||
opacity: 0.25
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ PlasmoidItem {
|
||||
// qmllint disable missing-property
|
||||
property string configuredLabelText: plasmoid.configuration.labelText
|
||||
// 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
|
||||
@@ -37,6 +41,8 @@ PlasmoidItem {
|
||||
// qmllint disable missing-property
|
||||
property bool configuredTextShadowEnabled: plasmoid.configuration.textShadowEnabled
|
||||
// qmllint disable missing-property
|
||||
property bool configuredShowMediaControls: plasmoid.configuration.showMediaControls
|
||||
// qmllint disable missing-property
|
||||
property int configuredTrackTextVerticalSpacing: plasmoid.configuration.trackTextVerticalSpacing
|
||||
// qmllint disable missing-property
|
||||
property int configuredLabelVerticalSpacing: plasmoid.configuration.labelVerticalSpacing
|
||||
@@ -46,6 +52,8 @@ PlasmoidItem {
|
||||
property int configuredSeparatorGapTrack: plasmoid.configuration.separatorGapTrack
|
||||
// qmllint disable missing-property
|
||||
property int configuredSeparatorHeight: plasmoid.configuration.separatorHeight
|
||||
// qmllint disable missing-property
|
||||
property bool configuredHideSeparator: plasmoid.configuration.hideSeparator
|
||||
readonly property int resolvedBackgroundHints: {
|
||||
if (configuredBackgroundStyle === "default")
|
||||
return PlasmaCore.Types.DefaultBackground | PlasmaCore.Types.ConfigurableBackground;
|
||||
@@ -81,16 +89,20 @@ PlasmoidItem {
|
||||
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
||||
configuredLabelPlacement: root.configuredLabelPlacement
|
||||
configuredLabelText: root.configuredLabelText
|
||||
configuredUseLabelArtwork: root.configuredUseLabelArtwork
|
||||
configuredImageBorderRadius: root.configuredImageBorderRadius
|
||||
configuredBackgroundStyle: root.configuredBackgroundStyle
|
||||
configuredBackgroundColor: root.configuredBackgroundColor
|
||||
configuredBackgroundRadius: root.configuredBackgroundRadius
|
||||
configuredForegroundColor: root.configuredForegroundColor
|
||||
configuredTextShadowEnabled: root.configuredTextShadowEnabled
|
||||
configuredShowMediaControls: root.configuredShowMediaControls
|
||||
configuredTrackTextVerticalSpacing: root.configuredTrackTextVerticalSpacing
|
||||
configuredLabelVerticalSpacing: root.configuredLabelVerticalSpacing
|
||||
configuredSeparatorGapLabel: root.configuredSeparatorGapLabel
|
||||
configuredSeparatorGapTrack: root.configuredSeparatorGapTrack
|
||||
configuredSeparatorHeight: root.configuredSeparatorHeight
|
||||
configuredHideSeparator: root.configuredHideSeparator
|
||||
}
|
||||
|
||||
compactRepresentation: Representation {
|
||||
@@ -107,16 +119,20 @@ PlasmoidItem {
|
||||
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
|
||||
configuredLabelPlacement: root.configuredLabelPlacement
|
||||
configuredLabelText: root.configuredLabelText
|
||||
configuredUseLabelArtwork: root.configuredUseLabelArtwork
|
||||
configuredImageBorderRadius: root.configuredImageBorderRadius
|
||||
configuredBackgroundStyle: root.configuredBackgroundStyle
|
||||
configuredBackgroundColor: root.configuredBackgroundColor
|
||||
configuredBackgroundRadius: root.configuredBackgroundRadius
|
||||
configuredForegroundColor: root.configuredForegroundColor
|
||||
configuredTextShadowEnabled: root.configuredTextShadowEnabled
|
||||
configuredShowMediaControls: root.configuredShowMediaControls
|
||||
configuredTrackTextVerticalSpacing: root.configuredTrackTextVerticalSpacing
|
||||
configuredLabelVerticalSpacing: root.configuredLabelVerticalSpacing
|
||||
configuredSeparatorGapLabel: root.configuredSeparatorGapLabel
|
||||
configuredSeparatorGapTrack: root.configuredSeparatorGapTrack
|
||||
configuredSeparatorHeight: root.configuredSeparatorHeight
|
||||
configuredHideSeparator: root.configuredHideSeparator
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user