mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #1814 from CLEMENTINATOR/media-controls-on-lock-screen-option
lock screen: add option for media controls
This commit is contained in:
@@ -342,6 +342,124 @@ Item {
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
// Media controls (when enabled)
|
||||
RowLayout {
|
||||
spacing: Style.marginXS
|
||||
visible: Settings.data.general.enableLockScreenMediaControls
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: Math.min(Style.radiusL, width / 2)
|
||||
color: prevButtonArea.containsMouse ? Color.mPrimary : Qt.alpha(Color.mOnSurface, 0.1)
|
||||
visible: MediaService.canGoPrevious
|
||||
|
||||
NIcon {
|
||||
anchors.centerIn: parent
|
||||
icon: "media-prev"
|
||||
pointSize: Style.fontSizeM
|
||||
color: prevButtonArea.containsMouse ? Color.mOnPrimary : Color.mOnSurface
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: prevButtonArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: MediaService.canGoPrevious ? MediaService.previous() : {}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 32
|
||||
height: 32
|
||||
radius: Math.min(Style.radiusL, width / 2)
|
||||
color: playPauseButtonArea.containsMouse ? Color.mPrimary : Qt.alpha(Color.mOnSurface, 0.15)
|
||||
visible: MediaService.canPlay || MediaService.canPause
|
||||
|
||||
NIcon {
|
||||
anchors.centerIn: parent
|
||||
icon: MediaService.isPlaying ? "media-pause" : "media-play"
|
||||
pointSize: Style.fontSizeL
|
||||
color: playPauseButtonArea.containsMouse ? Color.mOnPrimary : Color.mOnSurface
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: playPauseButtonArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: (MediaService.canPlay || MediaService.canPause) ? MediaService.playPause() : {}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: Math.min(Style.radiusL, width / 2)
|
||||
color: nextButtonArea.containsMouse ? Color.mPrimary : Qt.alpha(Color.mOnSurface, 0.1)
|
||||
visible: MediaService.canGoNext
|
||||
|
||||
NIcon {
|
||||
anchors.centerIn: parent
|
||||
icon: "media-next"
|
||||
pointSize: Style.fontSizeM
|
||||
color: nextButtonArea.containsMouse ? Color.mOnPrimary : Color.mOnSurface
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: nextButtonArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: MediaService.canGoNext ? MediaService.next() : {}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user