mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
widgets/mediacontrols: Add ability to activate source app on tap
This commit is contained in:
parent
5a9099bd84
commit
f3a4913147
4 changed files with 102 additions and 85 deletions
|
|
@ -11,7 +11,9 @@ import org.kde.plasma.core 2.0 as PlasmaCore
|
|||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string imageSource
|
||||
property bool darken: false
|
||||
|
||||
// clip corners so that the image has rounded corners
|
||||
layer.enabled: true
|
||||
|
|
@ -39,7 +41,7 @@ Item {
|
|||
// ensure text is readable
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0, 0, 0, 0.6)
|
||||
color: Qt.rgba(0, 0, 0, root.darken ? 0.8 : 0.6)
|
||||
}
|
||||
|
||||
// apply lighten, saturate and blur effect
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ PlasmaCore.DataSource {
|
|||
model.push({
|
||||
'application': playerData["Identity"],
|
||||
'source': source,
|
||||
'desktopEntry': playerData["DesktopEntry"]
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import QtQuick.Controls 2.15 as QQC2
|
|||
|
||||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
|
|
@ -67,8 +68,19 @@ Item {
|
|||
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: Components.BaseItem {
|
||||
sourceComponent: MouseArea {
|
||||
id: mouseArea
|
||||
implicitHeight: playerItem.implicitHeight
|
||||
implicitWidth: playerItem.implicitWidth
|
||||
|
||||
onClicked: {
|
||||
MobileShell.ShellUtil.launchApp(modelData.desktopEntry + ".desktop");
|
||||
MobileShell.TopPanelControls.closeActionDrawer();
|
||||
}
|
||||
|
||||
Components.BaseItem {
|
||||
id: playerItem
|
||||
anchors.fill: parent
|
||||
|
||||
property string source: modelData.source
|
||||
|
||||
|
|
@ -77,6 +89,7 @@ Item {
|
|||
implicitWidth: root.width
|
||||
|
||||
background: BlurredBackground {
|
||||
darken: mouseArea.pressed
|
||||
imageSource: mpris2Source.albumArt(playerItem.source)
|
||||
}
|
||||
|
||||
|
|
@ -171,4 +184,5 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ ContainmentLayoutManager.ItemContainer {
|
|||
}
|
||||
|
||||
HomeScreenLib.DesktopModel.setMinimizedDelegate(index, delegate);
|
||||
HomeScreenLib.DesktopModel.runApplication(modelData.applicationStorageId);
|
||||
MobileShell.ShellUtil.launchApp(modelData.applicationStorageId);
|
||||
}
|
||||
|
||||
readonly property bool applicationRunning: model.applicationRunning
|
||||
|
|
|
|||
Loading…
Reference in a new issue