mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-25 02:15:17 +00:00
Chris Josten
9266f65c2f
Device icons for the local device is now determined by looking at what the value of the deviceType property of the ApiClient is. This property was newly introduced, so that applications using JellyfinQt can set their own device type. For other devices, a guess is made based on the client name. This guess has been derived from what Jellyfin Web does.
76 lines
2.8 KiB
QML
76 lines
2.8 KiB
QML
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
|
|
Icon {
|
|
id: deviceIcon
|
|
anchors {
|
|
left: parent.left
|
|
leftMargin: Theme.horizontalPageMargin
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
height: parent.contentHeight - 2 * Theme.paddingMedium
|
|
width: height
|
|
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"
|
|
}
|
|
}
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|