fix mpris errors and create player selector
This commit is contained in:
parent
dddbb82984
commit
2d6cb05015
4 changed files with 105 additions and 93 deletions
|
|
@ -1,9 +1,7 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import qs.components
|
||||
import qs.constants
|
||||
import qs.services
|
||||
import qs.widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
|
|
@ -16,44 +14,9 @@ StyledDrawer {
|
|||
margin: 32
|
||||
ColumnLayout {
|
||||
spacing: 8
|
||||
RowLayout {
|
||||
spacing: 8
|
||||
|
||||
MprisPlayerSelector {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
StyledIconButton {
|
||||
id: previousPlayerButton
|
||||
|
||||
visible: Mpris.players.length > 1
|
||||
text: Icons.chevronLeft
|
||||
|
||||
onClicked: {
|
||||
Mpris.previousPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (Mpris.active?.identity) {
|
||||
const words = Mpris.active?.identity.split("-");
|
||||
const capitalized = words.map(val => String(val).charAt(0).toUpperCase() + String(val).slice(1));
|
||||
return capitalized.join(" ");
|
||||
}
|
||||
return Mpris.active?.desktopEntry ?? Mpris.active?.dbusName ?? "unknown";
|
||||
}
|
||||
font.pixelSize: 20
|
||||
}
|
||||
|
||||
StyledButton {
|
||||
id: nextPlayerButton
|
||||
visible: Mpris.players.length > 1
|
||||
|
||||
text: Icons.chevronRight
|
||||
|
||||
onClicked: {
|
||||
Mpris.nextPlayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MprisController {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue