2022-12-28 20:20:04 +00:00
|
|
|
import QtQuick 2.6
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
|
|
|
import nl.netsoj.chris.Jellyfin 1.0 as J
|
|
|
|
import ".."
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: pageRoot
|
|
|
|
SilicaListView {
|
|
|
|
id: listView
|
|
|
|
anchors.fill: parent
|
|
|
|
contentHeight: Theme.itemSizeLarge
|
|
|
|
|
|
|
|
header: PageHeader {
|
|
|
|
//: Page title: page for remote controlling other Jellyfin apps
|
|
|
|
title: qsTr("Remote control")
|
|
|
|
}
|
|
|
|
model: J.RemoteDeviceList {
|
|
|
|
id: deviceList
|
|
|
|
apiClient: appWindow.apiClient
|
|
|
|
scanning: pageRoot.status == PageStatus.Active
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: ListItem {
|
|
|
|
property bool isConnected: model.jellyfinId === appWindow.playbackManager.controllingSessionId
|
|
|
|
onClicked: deviceList.activateSession(appWindow.playbackManager, model.index)
|
|
|
|
contentHeight: Theme.itemSizeMedium
|
2023-01-11 22:11:02 +00:00
|
|
|
Icon {
|
2022-12-28 20:20:04 +00:00
|
|
|
id: deviceIcon
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: Theme.horizontalPageMargin
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
height: parent.contentHeight - 2 * Theme.paddingMedium
|
|
|
|
width: height
|
2024-01-02 14:14:23 +00:00
|
|
|
source: {
|
|
|
|
if (model.deviceType == J.DeviceType.Phone) {
|
|
|
|
return "image://theme/icon-m-device"
|
|
|
|
} else if (model.deviceType == J.DeviceType.Tv) {
|
|
|
|
// For the lack of a better icon
|
|
|
|
return "image://theme/icon-m-device-landscape"
|
|
|
|
} else if (model.deviceType == J.DeviceType.Computer) {
|
|
|
|
return "image://theme/icon-m-computer"
|
|
|
|
} else {
|
|
|
|
//case J.DeviceType.Unknown:
|
|
|
|
return "image://theme/icon-m-question"
|
|
|
|
}
|
|
|
|
}
|
2022-12-28 20:20:04 +00:00
|
|
|
highlighted: parent.down || isConnected
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
anchors {
|
|
|
|
left: deviceIcon.right
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
leftMargin: Theme.paddingLarge
|
|
|
|
rightMargin: Theme.horizontalPageMargin
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: deviceName
|
|
|
|
//: List of devices item title in the form of <app name> — <device name>
|
|
|
|
text: qsTr("%1 — %2").arg(model.name).arg(model.deviceName)
|
|
|
|
color: isConnected || highlighted ? Theme.highlightColor : Theme.primaryColor
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: deviceUser
|
|
|
|
text: model.userName
|
|
|
|
color: isConnected || highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|