1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-01 08:52:45 +00:00

Deserialized a list! Restructured project!

I finally got deserializing lists working. Exposing them to QML was not
a trivial task either. Note that I didn't do it the clean way. Nested
lists are not supported. But it works!

Because I got so frustarted at one point trying to implement things the
right way, I restructured the project to seperate the Sailfish code from
the Qt code and created a new, empty desktop project. The Qt code has
been transformed into a happy little library, to which the Sailfish OS
application links.

Note that QMake doesn't seem to strip the library for some reason.
This commit is contained in:
Chris Josten 2020-10-08 03:00:08 +02:00
parent 4e3395c4e5
commit 1e80ceb697
77 changed files with 507 additions and 213 deletions

View file

@ -0,0 +1,19 @@
[Desktop Entry]
Type=Application
Version=1.1
X-Nemo-Application-Type=silica-qt5
Icon=harbour-sailfin
Exec=harbour-sailfin
Name=Sailfin
# translation example:
# your app name in German locale (de)
#
# Remember to comment out the following line, if you do not want to use
# a different app name in German locale (de).
Name[nl] = Sailfin
GenericName=Jellyfin client
Comment=Stream audio and video from your Jellyfin media server
Categories=AudioVideo;Player

154
sailfish/icon.svg Normal file
View file

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="icon.svg"
inkscape:export-filename="/home/chris/Programmeren/Sailfish/harbour-sailfin/qml/icon.png"
inkscape:export-xdpi="48"
inkscape:export-ydpi="48">
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="background">
<stop
style="stop-color:#aa5cc3;stop-opacity:1"
offset="0"
id="stop837" />
<stop
style="stop-color:#00a4dc;stop-opacity:1"
offset="1"
id="stop839" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#background"
id="linearGradient843"
x1="96"
y1="224"
x2="448"
y2="480"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#background"
id="linearGradient868"
x1="212.15311"
y1="490.2868"
x2="436.6492"
y2="94.220024"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,1.1403316,-0.88873901,0,531.73701,-17.924891)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.49497475"
inkscape:cx="-21.524675"
inkscape:cy="373.96874"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="true"
inkscape:pagecheckerboard="true"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1015"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true">
<inkscape:grid
type="xygrid"
id="grid833"
empspacing="32" />
<sodipodi:guide
position="191.07872,242"
orientation="0,-1"
id="guide839" />
<sodipodi:guide
position="191.07872,232"
orientation="1,0"
id="guide841" />
<sodipodi:guide
position="149,202"
orientation="1,0"
id="guide843" />
<sodipodi:guide
position="149,202"
orientation="0,-1"
id="guide845" />
<sodipodi:guide
position="149,274"
orientation="0,-1"
id="guide847" />
<sodipodi:guide
position="366.05196,238.06065"
orientation="0,-1"
id="guide849" />
<sodipodi:guide
position="191.07872,234"
orientation="0,-1"
id="guide851" />
<sodipodi:guide
position="174.44599,202"
orientation="1,0"
id="guide853" />
<sodipodi:guide
position="256,0"
orientation="1,0"
id="guide898" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Laag 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:url(#linearGradient843);fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 0,512 V 256 C 0,128 128,0 256,0 384,0 512,128 512,256 v 256 z"
id="path835"
sodipodi:nodetypes="cccccc"
inkscape:label="background" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.75px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 64,448 V 256 c 0,-95.99999 96.00001,-192 192,-192 95.99999,0 192,96.00001 192,192 v 192 z"
id="path835-7"
sodipodi:nodetypes="cccccc"
inkscape:label="inner-background" />
<path
style="fill:url(#linearGradient868);fill-opacity:1;stroke:none;stroke-width:0.567858px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 191.07872,384 V 278 c 0,0 -16.591,32 -42.07872,32 v -72 c 25.51426,-0.0258 42.07872,32 42.07872,32 V 165 C 227.27463,165 366,237.50939 366,274 366,310.49061 227.27463,384 191.07872,384 Z"
id="path845-3"
sodipodi:nodetypes="cccccccc"
inkscape:label="sailfin" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

22
sailfish/qml/3rdparty.xml Normal file
View file

@ -0,0 +1,22 @@
<includes>
<include>
<name>Storeman</name>
<url>https://github.com/mentaljam/harbour-storeman/tree/f64314e7f72550faf35f95f046b52cee42501cf8</url>
<type>SNIPPET</type>
<license>
<type>MIT</type>
<copyright>Copyright (c) 2017 Petr Tsymbarovich</copyright>
<text>licenses/MIT.txt</text>
</license>
</include>
<include>
<name>Hutspot</name>
<url>https://github.com/sailfish-spotify/hutspot/tree/22787baa6603b5235a3c9e6a65778e0485dfcd7b</url>
<type>SNIPPET</type>
<license>
<type>MIT</type>
<copyright>Copyright (c) 2019 sailfish-spotify contributors</copyright>
<text>licenses/MIT.txt</text>
</license>
</include>
</includes>

View file

@ -0,0 +1,34 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
pragma Singleton
import QtQuick 2.6
import Sailfish.Silica 1.0
QtObject {
readonly property real libraryDelegateWidth: Screen.width / 3
readonly property real libraryDelegateHeight: Screen.width / 3
readonly property real libraryDelegatePosterHeight: Screen.width / 2
readonly property real libraryProgressHeight: Theme.paddingMedium
readonly property real horizontalVideoAspectRatio: 1.66666 //itemData.PrimaryImageAspectRatio
}

105
sailfish/qml/Utils.js Normal file
View file

@ -0,0 +1,105 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
.pragma library
/**
* Converts miliseconds to a h:mm:ss format
*/
function timeToText(time) {
if (time < 0) return "??:??:??"
var hours = Math.floor(time / (60 * 60 * 1000))
var left = time % (60 * 60 * 1000)
var minutes = Math.floor(left / (60 * 1000))
left = time % (60 * 1000)
var seconds = Math.floor(left / 1000)
return hours + ":" + (minutes < 10 ? "0" : "") + minutes + ":" + (seconds < 10 ? "0" : "")+ seconds
}
function msToTicks(ms) {
return ms * 10000;
}
function ticksToMs(ticks) {
return ticks / 10000;
}
function ticksToText(ticks) {
return timeToText(ticks / 10000);
}
function itemImageUrl(baseUrl, item, type, options) {
if (!item.imageTags[type]) { return "" }
return itemModelImageUrl(baseUrl, item.jellyfinId, item.imageTags[type], type, options)
}
function itemModelImageUrl(baseUrl, itemId, tag, type, options) {
if (tag == undefined) return ""
var extraQuery = "";
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
extraQuery += "&" + prop + "=" + options[prop];
}
}
return baseUrl + "/Items/" + itemId + "/Images/" + type + "?tag=" + tag + extraQuery
}
function usePortraitCover(itemType) {
return ["Series", "Movie", "tvshows", "movies"].indexOf(itemType) >= 0
}
/**
* Returns the page url for a certain item type.
*/
function getPageUrl(mediaType, itemType) {
switch (itemType.toLowerCase()) {
case "series":
return Qt.resolvedUrl("pages/itemdetails/SeriesPage.qml")
case "movie":
return Qt.resolvedUrl("pages/itemdetails/FilmPage.qml")
case "collection":
return Qt.resolvedUrl("pages/itemdetails/CollectionPage.qml")
case "season":
return Qt.resolvedUrl("pages/itemdetails/SeasonPage.qml")
case "episode":
return Qt.resolvedUrl("pages/itemdetails/EpisodePage.qml")
default:
switch (mediaType ? mediaType.toLowerCase() : "folder") {
case "folder":
return Qt.resolvedUrl("pages/itemdetails/CollectionPage.qml")
case "video":
return Qt.resolvedUrl("pages/itemdetails/VideoPage.qml")
default:
return Qt.resolvedUrl("pages/itemdetails/UnsupportedPage.qml")
}
}
}
/**
* Generates a "nice" color based on a string by "hashing" it.
*/
function colorFromString(string) {
var hash = 0;
for (var i = 0; i < string.length; i++) {
hash += string.charCodeAt(i);
}
hash = (hash % 16) / 16;
return Qt.hsva(hash, 1.0, 1.0, 1.0);
}

View file

@ -0,0 +1,71 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
File taken and adapted from hutspot. Licensed under the MIT license.
Copyright (c) 2019 sailfish-spotify contributors
View ../licenses/MIT.txt for the full license.
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import QtGraphicalEffects 1.0
/**
* A silica-like background for displaying backdrops.
*/
Rectangle {
property alias source: backgroundImage.source
property alias sourceSize: backgroundImage.sourceSize
property real dimmedOpacity: Theme.opacityFaint
readonly property alias status: backgroundImage.status
color: Theme.colorScheme == Theme.DarkOnLight ? "#fff" : "#000"
z: -1
opacity: status == Image.Ready ? 1.0 : 0.0
Behavior on opacity { FadeAnimator {} }
Image {
id: backgroundImage
cache: true
smooth: false
asynchronous: true
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
visible: false
}
FastBlur {
cached: true
anchors.fill: backgroundImage
source: backgroundImage
opacity: dimmedOpacity
radius: 100
}
Image {
anchors.fill: parent
fillMode: Image.Tile
source: "image://theme/graphic-shader-texture"
opacity: 0.1
visible: parent.visible
}
function clear() {
//source = ""
}
}

View file

@ -0,0 +1,45 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
BackgroundItem {
property alias text: label.text
property alias iconSource: icon.source
HighlightImage {
id: icon
anchors {
top: parent.top
topMargin: Theme.paddingMedium
left: parent.left
leftMargin: Theme.horizontalPageMargin
bottom: parent.bottom
bottomMargin: Theme.paddingMedium
}
}
Label {
id: label
anchors {
left: icon.right
leftMargin: Theme.paddingMedium
verticalCenter: parent.verticalCenter
}
}
}

View file

@ -0,0 +1,90 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import ".."
/**
* Delegate for displaying an item in the library.
*/
BackgroundItem {
id: root
property alias poster: posterImage.source
property alias title: titleText.text
property bool landscape: false
property real progress: 0.0
width: Constants.libraryDelegateWidth
height: landscape ? Constants.libraryDelegateHeight : Constants.libraryDelegatePosterHeight
RemoteImage {
id: posterImage
clip: true
anchors {
left: parent.left
top: parent.top
right: parent.right
bottom: parent.bottom
}
fillMode: Image.PreserveAspectCrop
fallbackColor: Utils.colorFromString(title)
}
/*Rectangle {
anchors.fill: posterImage
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
visible: root.highlighted
}*/
Shim {
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: titleText.height * 1.5 + Theme.paddingSmall * 2
}
Label {
id: titleText
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
leftMargin: Theme.paddingMedium
rightMargin: Theme.paddingMedium
bottomMargin: Theme.paddingSmall
}
truncationMode: TruncationMode.Fade
horizontalAlignment: Text.AlignLeft
}
Rectangle {
id: progress
anchors {
left: parent.left
bottom: parent.bottom
}
height: Theme.paddingSmall
color: Theme.highlightColor
width: root.progress * parent.width
}
}

View file

@ -0,0 +1,114 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
File taken and adapted from Storeman. Licensed under the MIT license.
Copyright (c) 2017 Petr Tsymbarovich
View ../licenses/MIT.txt for the full license.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
Item {
id: root
property alias text: label.text
property alias textAlignment: label.horizontalAlignment
property bool busy: false
property bool clickable: true
property int depth: 0
readonly property color _color: {
if (!clickable) {
Theme.primaryColor
} else if (enabled) {
if (highlighted) {
Theme.highlightColor
} else {
Theme.primaryColor
}
} else {
Theme.secondaryColor
}
}
default property alias content: container.data
signal headerClicked()
implicitHeight: backgroundItem.height + container.height
width: parent.width
BackgroundItem {
id: backgroundItem
enabled: parent.enabled && parent.clickable
width: parent.width
height: Theme.itemSizeMedium
onClicked: root.headerClicked()
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: Theme.rgba(Theme.highlightBackgroundColor, 0.15) }
GradientStop { position: 1.0; color: "transparent" }
}
}
Label {
id: label
anchors {
left: parent.left
right: image.left
verticalCenter: parent.verticalCenter
leftMargin: Theme.horizontalPageMargin + depth * Theme.paddingLarge
rightMargin: Theme.paddingMedium
}
horizontalAlignment: Text.AlignRight
truncationMode: TruncationMode.Fade
color: _color
}
Image {
id: image
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
rightMargin: Theme.horizontalPageMargin
}
visible: root.enabled && root.clickable && !root.busy
source: "image://theme/icon-m-right?" + _color
}
BusyIndicator {
id: busyIndicator
running: root.busy
anchors.centerIn: image
size: BusyIndicatorSize.Small
}
}
Item {
id: container
anchors {
top: backgroundItem.bottom
left: parent.left
right: parent.right
}
width: parent.width
height: children.length > 0 ? children[0].height : 0
}
}

View file

@ -0,0 +1,37 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
/**
* A label with the most commonly used settings set
*/
Label {
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
}
color: Theme.highlightColor
linkColor: Theme.primaryColor
onLinkActivated: Qt.openUrlExternally(link)
wrapMode: Text.WordWrap
}

View file

@ -0,0 +1,80 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
Column {
property alias imageSource : playImage.source
property real imageAspectRatio: 1.0
property real playProgress: 0.0
signal playPressed(bool startFromBeginning)
spacing: Theme.paddingLarge
BackgroundItem {
width: parent.width
height: width / imageAspectRatio
HighlightImage {
id: playImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
clip: true
}
Rectangle {
anchors.fill: parent
color: Theme.rgba(Theme.overlayBackgroundColor, Theme.opacityLow)
}
Icon {
id: playButton
source: "image://theme/icon-l-play"
anchors.centerIn: parent
highlighted: parent.highlighted
}
Rectangle {
anchors {
left: parent.left
bottom: parent.bottom
}
height: Theme.paddingMedium
color: Theme.highlightColor
width: parent.width * playProgress
}
onClicked: playPressed(false)
}
Row {
anchors {
//left: parent.left
right: parent.right
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
}
spacing: Theme.paddingMedium
IconButton {
id: playFromBeginning
icon.source: "image://theme/icon-m-backup"
visible: playProgress > 0
onClicked: playPressed(true)
}
IconButton {
id: favouriteButton
icon.source: "image://theme/icon-m-favorite"
}
}
}

View file

@ -0,0 +1,53 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
/**
* An image for "remote" images (loaded over e.g. http), with a spinner and a fallback image
*/
HighlightImage {
property string fallbackImage
property bool usingFallbackImage
property color fallbackColor: Theme.highlightColor
asynchronous: true
Rectangle {
id: fallbackBackground
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: fallbackColor; }
GradientStop { position: 1.0; color: Theme.highlightDimmerFromColor(fallbackColor, Theme.colorScheme); }
}
visible: parent.status == Image.Error || parent.status == Image.Null || parent.status == Image.Loading
}
BusyIndicator {
anchors.centerIn: parent
running: parent.status == Image.Loading
}
HighlightImage {
id: fallbackImageItem
anchors.centerIn: parent
visible: parent.status == Image.Error || parent.status == Image.Null
source: fallbackImage ? fallbackImage : "image://theme/icon-m-question"
}
}

View file

@ -0,0 +1,32 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
Rectangle {
property real shimOpacity: 1.0
property color shimColor: Theme.overlayBackgroundColor
property bool upsideDown: false
gradient: Gradient {
GradientStop { position: upsideDown ? 1.0 : 0.0; color: Theme.rgba(shimColor, 0.0); }
GradientStop { position: upsideDown ? 0.0 : 1.0; color: Theme.rgba(shimColor, shimOpacity); }
}
}

View file

@ -0,0 +1,54 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
GridItem {
id: root
property string image
property alias name: nameLabel.text
RemoteImage {
id: userImage
anchors.fill: parent
source: root.image ? root.image : "image://theme/icon-m-contact?" + ((root.highlighted || root.down) ? Theme.highlightColor : Theme.primaryColor)
fillMode: Image.PreserveAspectCrop
clip: true
}
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 1.0; color: Theme.overlayBackgroundColor }
}
}
Label {
id: nameLabel
anchors {
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
right: parent.right
left: parent.left
bottom: parent.bottom
bottomMargin: Theme.paddingSmall
}
text: qsTr("Other account")
color: (root.highlighted || root.down) ? Theme.highlightColor : Theme.secondaryColor
}
}

View file

@ -0,0 +1,122 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import QtMultimedia 5.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "videoplayer"
import "../"
/**
* A videoPlayer for Jellyfin videos
*/
SilicaItem {
id: playerRoot
property string itemId
property string title
property int progress
readonly property bool landscape: videoOutput.contentRect.width > videoOutput.contentRect.height
property MediaPlayer player
readonly property bool hudVisible: !hud.hidden || player.error !== MediaPlayer.NoError
property alias audioTrack: mediaSource.audioIndex
property alias subtitleTrack: mediaSource.subtitleIndex
property int startTicks: 0
// Force a Light on Dark theme since I doubt that there are persons who are willing to watch a Video
// on a white background.
palette.colorScheme: Theme.LightOnDark
// Blackground to prevent the ambience from leaking through
Rectangle {
anchors.fill: parent
color: "black"
}
PlaybackManager {
id: mediaSource
apiClient: ApiClient
itemId: playerRoot.itemId
autoOpen: true
onStreamUrlChanged: {
if (mediaSource.streamUrl != "") {
player.source = streamUrl
}
}
}
Connections {
target: player
onPlaybackStateChanged: mediaSource.state = player.playbackState
onPositionChanged: mediaSource.position = Utils.msToTicks(player.position)
}
VideoOutput {
id: videoOutput
source: player
anchors.fill: parent
}
VideoHud {
id: hud
anchors.fill: parent
player: playerRoot.player
title: videoPlayer.title
Label {
anchors.fill: parent
anchors.margins: Theme.horizontalPageMargin
text: itemId + "\n" + mediaSource.streamUrl + "\n"
+ player.status + "\n"
+ player.bufferProgress + "\n"
+ player.metaData.videoCodec + "@" + player.metaData.videoFrameRate + "(" + player.metaData.videoBitRate + ")" + "\n"
+ player.metaData.audioCodec + "(" + player.metaData.audioBitRate + ")" + "\n"
+ player.errorString + "\n"
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: "WordWrap"
visible: false
}
}
VideoError {
anchors.fill: videoOutput
player: playerRoot.player
}
function stop() {
player.stop()
}
Connections {
property bool enabled: true
id: playerReadyToSeek
target: player
onPlaybackStateChanged: {
if (!enabled) return;
if (startTicks > 0 && player.playbackState == MediaPlayer.PlayingState) {
console.log("Seeking to " + Utils.ticksToMs(startTicks))
player.seek(Utils.ticksToMs(startTicks))
playerReadyToSeek.enabled = false // Only seek the first time this property changes
}
}
}
}

View file

@ -0,0 +1,95 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
Column {
property var tracks
readonly property int audioTrack: audioSelector.currentItem ? audioSelector.currentItem._index : 0
readonly property int subtitleTrack: subitleSelector.currentItem._index
ListModel {
id: audioModel
}
ListModel {
id: subtitleModel
}
ComboBox {
id: audioSelector
label: qsTr("Audio track")
enabled: audioModel.count > 1
menu: ContextMenu {
Repeater {
model: audioModel
MenuItem {
readonly property int _index: model.index
text: model.displayTitle
}
}
}
}
ComboBox {
id: subitleSelector
label: qsTr("Subtitle track")
enabled: subtitleModel.count > 0
menu: ContextMenu {
MenuItem {
readonly property int _index: -1
//: Value in ComboBox to disable subtitles
text: qsTr("Off")
}
Repeater {
model: subtitleModel
MenuItem {
readonly property int _index: model.index
text: model.displayTitle
}
}
}
}
onTracksChanged: {
audioModel.clear()
subtitleModel.clear()
if (typeof tracks === "undefined") {
console.log("tracks undefined")
return
}
console.log(tracks)
for(var i = 0; i < tracks.length; i++) {
var track = tracks[i];
switch(track.type) {
case MediaStream.Audio:
audioModel.append(track)
break;
case MediaStream.Subtitle:
subtitleModel.append(track)
break;
default:
console.log("Ignored " + track.displayTitle + "(" + track.type + ")")
break;
}
}
}
}

View file

@ -0,0 +1,91 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import QtMultimedia 5.6
Rectangle {
id: videoError
property MediaPlayer player
color: pal.palette.overlayBackgroundColor
opacity: player.error === MediaPlayer.NoError ? 0.0 : 1.0
Behavior on opacity { FadeAnimator {} }
SilicaItem {
id: pal
}
Column {
anchors.centerIn: parent
anchors.margins: Theme.horizontalPageMargin
Label {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Theme.fontSizeExtraLarge
color: Theme.errorColor
text: {
switch(player.error) {
case MediaPlayer.NoError:
//: Just to be complete if the application shows a video playback error when there's no error.
qsTr("No error");
break;
case MediaPlayer.ResourceError:
//: Video playback error: out of resources
qsTr("Resource allocation error")
break;
case MediaPlayer.FormatError:
//: Video playback error: unsupported format/codec
qsTr("Video format unsupported")
break;
case MediaPlayer.NetworkError:
//: Video playback error: network error
qsTr("Network error")
break;
case MediaPlayer.AccessDenied:
//: Video playback error: access denied
qsTr("Access denied")
break;
case MediaPlayer.ServiceMissing:
//: Video playback error: the media cannot be played because the media service could not be instantiated.
qsTr("Media service missing")
break;
}
}
}
Label {
wrapMode: Text.WordWrap
text: player.errorString
color: Theme.errorColor
width: videoError.width - Theme.horizontalPageMargin * 2
horizontalAlignment: Text.AlignHCenter
}
Item { width: 1; height: Theme.paddingLarge; }
ButtonLayout {
Button {
//: Button to retry loading a video after a failure
text: qsTr("Retry")
onClicked: player.play()
}
}
}
}

View file

@ -0,0 +1,188 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import QtMultimedia 5.6
import Sailfish.Silica 1.0
import "../../Utils.js" as Utils
/**
* The video "hud" or controls. This is the overlay displayed over a video player, which contains controls
* and playback information.
*/
Item {
id: videoHud
property MediaPlayer player
property string title
property bool _manuallyActivated: false
readonly property bool hidden: opacity == 0.0
Behavior on opacity { FadeAnimator {} }
Rectangle {
id: topBar
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: pageTitle.height
gradient: Gradient {
GradientStop { position: 1.0; color: Theme.rgba(palette.overlayBackgroundColor, 0.15); }
GradientStop { position: 0.0; color: Theme.rgba(palette.overlayBackgroundColor, 0.30); }
}
PageHeader {
id: pageTitle
title: videoHud.title
anchors.fill: parent
titleColor: palette.primaryColor
}
}
Rectangle {
anchors.top: topBar.bottom
anchors.bottom: bottomBar.top
anchors.left: parent.left
anchors.right: parent.right
color: Theme.rgba(palette.overlayBackgroundColor, 0.15)
}
MouseArea {
id: wakeupArea
enabled: true
anchors.fill: parent
onClicked: {
hidden ? videoHud.show(true) : videoHud.hide(true)
console.log("Trying")
}
}
BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
size: BusyIndicatorSize.Medium
running: [MediaPlayer.Loading, MediaPlayer.Stalled].indexOf(player.status) >= 0
}
IconButton {
id: playPause
enabled: !hidden
anchors.centerIn: parent
icon.source: player.playbackState == MediaPlayer.PausedState ? "image://theme/icon-l-play" : "image://theme/icon-l-pause"
onClicked: {
if (player.playbackState == MediaPlayer.PlayingState) {
player.pause()
} else {
player.play()
}
}
visible: !busyIndicator.running
}
Rectangle {
id: bottomBar
anchors.bottom: parent.bottom
width: parent.width
height: progress.height
visible: [MediaPlayer.Unavailable, MediaPlayer.Loading, MediaPlayer.NoMedia].indexOf(player.status) == -1
gradient: Gradient {
GradientStop { position: 0.0; color: Theme.rgba(palette.overlayBackgroundColor, 0.15); }
GradientStop { position: 1.0; color: Theme.rgba(palette.overlayBackgroundColor, 0.30); }
}
Item {
id: progress
height: progressSlider.height + 2 * Theme.paddingMedium
width: parent.width
Label {
id: playedTime
anchors.left: parent.left
anchors.leftMargin: Theme.horizontalPageMargin
anchors.verticalCenter: progressSlider.verticalCenter
text: Utils.timeToText(player.position)
}
Slider {
id: progressSlider
enabled: player.seekable
value: player.position
maximumValue: player.duration
stepSize: 1000
anchors.left: playedTime.right
anchors.right: totalTime.left
anchors.verticalCenter: parent.verticalCenter
onDownChanged: if (!down) { player.seek(value) }
}
Label {
id: totalTime
anchors.right: parent.right
anchors.rightMargin: Theme.horizontalPageMargin
anchors.verticalCenter: progress.verticalCenter
text: Utils.timeToText(player.duration)
}
}
}
Connections {
target: player
onStatusChanged: {
console.log("New mediaPlayer status: " + player.status)
switch(player.status) {
case MediaPlayer.Loaded:
case MediaPlayer.Buffering:
show(false)
break;
case MediaPlayer.Buffered:
hide(false)
break;
}
}
}
function show(manual) {
_manuallyActivated = manual
if (manual) {
inactivityTimer.restart()
} else {
inactivityTimer.stop()
}
opacity = 1
}
function hide(manual) {
// Don't hide if the user decided on their own to show the hud
//if (!manual && _manuallyActivated) return;
// Don't give in to the user if they want to hide the hud while it was forced upon them
/*if (!_manuallyActivated && manual) return;
_manuallyActivated = false;*/
opacity = 0
}
Timer {
id: inactivityTimer
interval: 5000
onTriggered: {
hide(true)
}
}
}

View file

@ -0,0 +1,169 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../components"
import "../Utils.js" as Utils
CoverBackground {
id: cover
Label {
id: label
anchors.centerIn: parent
text: qsTr("Sailfin")
}
property int rowCount: 8
UserItemModel {
id: randomItems1
apiClient: ApiClient
limit: cover.rowCount
imageTypes: ["Primary"]
sortBy: ["IsFavoriteOrLiked", "Random"]
recursive: true
parentId: appWindow.collectionId
Component.onCompleted: reload()
}
UserItemModel {
id: randomItems2
apiClient: ApiClient
limit: cover.rowCount
imageTypes: ["Primary"]
sortBy: ["IsFavoriteOrLiked", "Random"]
recursive: true
parentId: appWindow.collectionId
Component.onCompleted: reload()
}
Row {
id: row1
property bool movingRight: true
property int moveCount: 0
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
transform: [
Translate {
x: -row1.height// + (row1.width - row1.height) / 2;
},
Translate {
id: row1Translate;
Behavior on x { NumberAnimation { duration: 500; easing.type: Easing.InOutQuad }}
}
]
height: parent.height / 2
width: parent.width
Repeater {
model: randomItems1
RemoteImage {
clip: true
height: row1.height
width: height
source: model.id ? Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags["Primary"], "Primary", {"maxHeight": row1.height})
: ""
fillMode: Image.PreserveAspectCrop
}
}
function move() {
if (movingRight) {
row1Translate.x -= row1.height
moveCount++;
} else {
row1Translate.x += row1.height
moveCount--;
}
if (moveCount == 0) movingRight = true;
if (moveCount == rowCount - 3) movingRight = false;
}
}
Row {
id: row2
property bool movingRight: false
property int moveCount: rowCount - 3
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
transform: [
Translate {
x: -row2.height * (rowCount - 2) + (row2.width - row2.height);
},
Translate {
id: row2Translate;
Behavior on x { NumberAnimation { duration: 500; easing.type: Easing.InOutQuad }}
}
]
height: parent.height / 2
width: parent.width
Repeater {
model: randomItems2
RemoteImage {
clip: true
height: row2.height
width: height
source: Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags["Primary"], "Primary", {"maxHeight": row1.height})
fillMode: Image.PreserveAspectCrop
}
}
function move() {
if (movingRight) {
row2Translate.x -= row1.height
moveCount++;
} else {
row2Translate.x += row1.height
moveCount--;
}
if (moveCount == 0) movingRight = true;
if (moveCount == rowCount - 3) movingRight = false;
}
}
Connections {
target: appWindow
onCollectionIdChanged: {
randomItems1.parentId = collectionId
randomItems2.parentId = collectionId
randomItems1.reload()
randomItems2.reload()
}
}
Timer {
property bool odd: false
running: true
interval: 5000
repeat: true
onTriggered: {
if (odd) {
row1.move()
} else {
row2.move()
}
odd = !odd
}
}
}

View file

@ -0,0 +1,86 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../components"
import ".."
CoverBackground {
property var mData: appWindow.itemData
RemoteImage {
anchors.fill: parent
source: mData.ImageTags["Primary"] ? ApiClient.baseUrl + "/Items/" + mData.Id
+ "/Images/Primary?maxHeight=" + height + "&tag=" + mData.ImageTags["Primary"]
: ""
fillMode: Image.PreserveAspectCrop
}
Shim {
// Movies usually show their name on the poster,
// so showing it here as well is a bit double
visible: itemData.Type !== "Movie"
anchors {
left: parent.left
right: parent.right
top: parent.top
}
upsideDown: true
height: parent.height / 2
Rectangle {
anchors {
top: parent.top
left: parent.left
}
width: itemData.UserData.PlayedPercentage / 100 * parent.width
height: Theme.paddingSmall
color: Theme.highlightColor
}
Column {
id: infoColumn
anchors {
top: parent.top
left: parent.left
right: parent.right
}
anchors.margins: Theme.paddingMedium
Label {
id: itemName
anchors {
left: parent.left
right: parent.right
}
color: Theme.primaryColor
text: itemData.Name
truncationMode: TruncationMode.Fade
}
Label {
visible: typeof itemData.RunTimeTicks !== "undefined"
color: Theme.secondaryColor
text: Utils.ticksToText(itemData.RunTimeTicks)
}
}
}
}

View file

@ -0,0 +1,77 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import QtMultimedia 5.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../components"
CoverBackground {
readonly property MediaPlayer player: appWindow.mediaPlayer
property var mData: appWindow.itemData
Rectangle {
anchors.fill: parent
color: "black"
// Wanted to display the currently running move on here, but it's hard :/
/*VideoOutput {
id: coverOutput
anchors.fill: parent
source: player
}*/
}
// As a temporary fallback, use the poster image
RemoteImage {
anchors.fill: parent
source: mData.ImageTags["Primary"] ? ApiClient.baseUrl + "/Items/" + mData.Id
+ "/Images/Primary?maxHeight=" + height + "&tag=" + mData.ImageTags["Primary"]
: ""
fillMode: Image.PreserveAspectCrop
}
Shim {
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
}
height: Theme.iconSizeLarge
}
CoverActionList {
CoverAction {
id: playPause
iconSource: player.playbackState === MediaPlayer.PlayingState ? "image://theme/icon-cover-pause"
: "image://theme/icon-cover-play"
onTriggered: {
if (player.playbackState === MediaPlayer.PlayingState) {
player.pause()
} else {
player.play()
}
}
}
}
}

View file

@ -0,0 +1,110 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import QtMultimedia 5.6
import nl.netsoj.chris.Jellyfin 1.0
import Nemo.Notifications 1.0
import Nemo.KeepAlive 1.2
import "components"
import "pages"
ApplicationWindow {
id: appWindow
property bool _hasInitialized: false
// The global mediaPlayer instance
readonly property MediaPlayer mediaPlayer: _mediaPlayer
// Data of the currently selected item. For use on the cover.
property var itemData
// Id of the collection currently browsing. For use on the cover.
property string collectionId
//FIXME: proper error handling
Connections {
target: ApiClient
onNetworkError: errorNotification.show("Network error: " + error)
onConnectionFailed: errorNotification.show("Connect error: " + error)
//onConnectionSuccess: errorNotification.show("Success: " + loginMessage)
onSetupRequired: {
var isInSetup = pageStack.find(function (page) { return typeof page._isSetupPage !== "undefined" }) !== null
console.log("Is in setup: " + isInSetup)
if (!isInSetup) {
pageStack.replace(Qt.resolvedUrl("pages/setup/AddServerPage.qml"), {"backNavigation": false});
}
}
}
initialPage: Component {
MainPage {
Connections {
target: ApiClient
// Replace the MainPage if no server was set up.
}
onStatusChanged: {
if (status == PageStatus.Active && !_hasInitialized) {
_hasInitialized = true;
ApiClient.restoreSavedSession();
}
}
}
}
cover: {
if ([MediaPlayer.NoMedia, MediaPlayer.InvalidMedia, MediaPlayer.UnknownStatus].indexOf(mediaPlayer.status) >= 0) {
if (itemData) {
return Qt.resolvedUrl("cover/PosterCover.qml")
} else {
return Qt.resolvedUrl("cover/CoverPage.qml")
}
} else if (mediaPlayer.hasVideo){
return Qt.resolvedUrl("cover/VideoCover.qml")
}
}
allowedOrientations: Orientation.All
Notification {
id: errorNotification
previewSummary: "foo"
isTransient: true
function show(data) {
previewSummary = data;
publish();
}
}
MediaPlayer {
id: _mediaPlayer
autoPlay: true
}
// Keep the sytem alive while playing media
KeepAlive {
enabled: _mediaPlayer.playbackState == MediaPlayer.PlayingState
}
DisplayBlanking {
preventBlanking: _mediaPlayer.playbackState == MediaPlayer.PlayingState && _mediaPlayer.hasVideo
}
}

BIN
sailfish/qml/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,616 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" http://www.w3.org/TR/html4/strict.dtd">
<html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GNU Lesser General Public License v2.1 - GNU Project - Free Software Foundation (FSF)</title>
<link rel="alternate" type="application/rdf+xml" href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.rdf">
</head>
<body>
<h3><a id="SEC1">GNU LESSER GENERAL PUBLIC LICENSE</a></h3>
<p>
Version 2.1, February 1999
</p>
<pre>Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
</pre>
<h3><a id="SEC2">Preamble</a></h3>
<p>
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
</p>
<p>
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
</p>
<p>
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
</p>
<p>
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
</p>
<p>
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
</p>
<p>
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
</p>
<p>
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
</p>
<p>
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
</p>
<p>
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
</p>
<p>
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
</p>
<p>
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
</p>
<p>
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
</p>
<p>
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
</p>
<p>
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
</p>
<p>
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
</p>
<h3><a id="SEC3">TERMS AND CONDITIONS FOR COPYING,
DISTRIBUTION AND MODIFICATION</a></h3>
<p>
<strong>0.</strong>
This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
</p>
<p>
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
</p>
<p>
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
</p>
<p>
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
</p>
<p>
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
</p>
<p>
<strong>1.</strong>
You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
</p>
<p>
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
</p>
<p>
<strong>2.</strong>
You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
</p>
<ul>
<li><strong>a)</strong>
The modified work must itself be a software library.</li>
<li><strong>b)</strong>
You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.</li>
<li><strong>c)</strong>
You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.</li>
<li><strong>d)</strong>
If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
<p>
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)</p></li>
</ul>
<p>
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be
reasonably considered independent and separate works in themselves, then
this License, and its terms, do not apply to those sections when you
distribute them as separate works. But when you distribute the same
sections as part of a whole which is a work based on the Library, the
distribution of the whole must be on the terms of this License, whose
permissions for other licensees extend to the entire whole, and thus to
each and every part regardless of who wrote it.
</p>
<p>
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works
based on the Library.
</p>
<p>
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of
this License.
</p>
<p>
<strong>3.</strong>
You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
</p>
<p>
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
</p>
<p>
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
</p>
<p>
<strong>4.</strong>
You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
</p>
<p>
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
</p>
<p>
<strong>5.</strong>
A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
</p>
<p>
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
</p>
<p>
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
</p>
<p>
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
</p>
<p>
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
</p>
<p>
<strong>6.</strong>
As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
</p>
<p>
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
</p>
<ul>
<li><strong>a)</strong> Accompany the work with the complete
corresponding machine-readable source code for the Library
including whatever changes were used in the work (which must be
distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete
machine-readable "work that uses the Library", as object code
and/or source code, so that the user can modify the Library and
then relink to produce a modified executable containing the
modified Library. (It is understood that the user who changes the
contents of definitions files in the Library will not necessarily
be able to recompile the application to use the modified
definitions.)</li>
<li><strong>b)</strong> Use a suitable shared library mechanism
for linking with the Library. A suitable mechanism is one that
(1) uses at run time a copy of the library already present on the
user's computer system, rather than copying library functions into
the executable, and (2) will operate properly with a modified
version of the library, if the user installs one, as long as the
modified version is interface-compatible with the version that the
work was made with.</li>
<li><strong>c)</strong> Accompany the work with a written offer,
valid for at least three years, to give the same user the
materials specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.</li>
<li><strong>d)</strong> If distribution of the work is made by
offering access to copy from a designated place, offer equivalent
access to copy the above specified materials from the same
place.</li>
<li><strong>e)</strong> Verify that the user has already received
a copy of these materials or that you have already sent this user
a copy.</li>
</ul>
<p>
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
</p>
<p>
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
</p>
<p>
<strong>7.</strong> You may place library facilities that are a work
based on the Library side-by-side in a single library together with
other library facilities not covered by this License, and distribute
such a combined library, provided that the separate distribution of
the work based on the Library and of the other library facilities is
otherwise permitted, and provided that you do these two things:
</p>
<ul>
<li><strong>a)</strong> Accompany the combined library with a copy
of the same work based on the Library, uncombined with any other
library facilities. This must be distributed under the terms of
the Sections above.</li>
<li><strong>b)</strong> Give prominent notice with the combined
library of the fact that part of it is a work based on the
Library, and explaining where to find the accompanying uncombined
form of the same work.</li>
</ul>
<p>
<strong>8.</strong> You may not copy, modify, sublicense, link with,
or distribute the Library except as expressly provided under this
License. Any attempt otherwise to copy, modify, sublicense, link
with, or distribute the Library is void, and will automatically
terminate your rights under this License. However, parties who have
received copies, or rights, from you under this License will not have
their licenses terminated so long as such parties remain in full
compliance.
</p>
<p>
<strong>9.</strong>
You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
</p>
<p>
<strong>10.</strong>
Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
</p>
<p>
<strong>11.</strong>
If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
</p>
<p>
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
</p>
<p>
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
</p>
<p>
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
</p>
<p>
<strong>12.</strong>
If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
</p>
<p>
<strong>13.</strong>
The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
</p>
<p>
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
</p>
<p>
<strong>14.</strong>
If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
</p>
<p>
<strong>NO WARRANTY</strong>
</p>
<p>
<strong>15.</strong>
BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
</p>
<p>
<strong>16.</strong>
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
</p>
<h3>END OF TERMS AND CONDITIONS</h3>
<h3><a id="SEC4">How to Apply These Terms to Your New
Libraries</a></h3>
<p>
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
</p>
<p>
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
</p>
<pre><var>one line to give the library's name and an idea of what it does.</var>
Copyright (C) <var>year</var> <var>name of author</var>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</pre>
<p>
Also add information on how to contact you by electronic and paper mail.
</p>
<p>
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
</p>
<pre>Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
<var>signature of Ty Coon</var>, 1 April 1990
Ty Coon, President of Vice
</pre>
<p>
That's all there is to it!</p>
</body></html>

View file

@ -0,0 +1,118 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../components"
Page {
id: page
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height
Column {
id: content
width: parent.width
PageHeader {
title: qsTr("About Sailfin")
}
Image {
anchors.horizontalCenter: parent.horizontalCenter
source: Qt.resolvedUrl("../icon.png")
}
Item { width: 1; height: Theme.paddingLarge }
Label {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Theme.horizontalPageMargin
anchors.rightMargin: Theme.horizontalPageMargin
wrapMode: Text.WordWrap
text: qsTr("<p><b>Sailfin version %1</b><br/>" +
"Copyright © Chris Josten 2020</p>" +
"<p>Sailfin is Free Software licensed under the <a href='lgpl'>LGPL-v2.1</a> or later, at your choice. " +
"Parts of the code of Sailfin are from other libraries. <a href='3rdparty'>View their licenses here</a>.</p>")
.arg(ApiClient.version)
textFormat: Text.StyledText
color: Theme.secondaryHighlightColor
linkColor: Theme.primaryColor
onLinkActivated: {
switch(link) {
case "lgpl":
pageStack.push(licensePage)
break;
case "3rdparty":
pageStack.push(Qt.resolvedUrl("LegalPage.qml"))
break;
}
}
}
}
VerticalScrollDecorator {}
}
Component {
id: licensePage
Page {
allowedOrientations: Orientation.All
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height
PullDownMenu {
MenuItem {
text: qsTr("Open externally")
onClicked: Qt.openUrlExternally(Qt.resolvedUrl("../licenses/lgpl-2.1.html"))
}
}
VerticalScrollDecorator {}
Column {
id: content
width: parent.width
PageHeader {
title: qsTr("LGPL 2.1 License")
}
PlainLabel {
id: licenseLabel
Component.onCompleted: {
var xhr = new XMLHttpRequest;
xhr.open("GET", Qt.resolvedUrl("../licenses/lgpl-2.1.html")); // set Method and File
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE){ // if request_status == DONE
licenseLabel.text = xhr.responseText;
}
}
xhr.send(); // begin the request
}
}
}
}
}
}
}

View file

@ -0,0 +1,128 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import QtQuick.XmlListModel 2.0
import Sailfish.Silica 1.0
import "../components"
/**
* This page contains legal information about snippets and 3rd party libraries.
*
* Displaying them is done by loading ../3rdparty.xml, which contains a list of all
* the included snippets/libraries and their licenses.
*/
Page {
allowedOrientations: Orientation.All
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height
Column {
id: content
width: parent.width
XmlListModel {
id: licencesModel
source: Qt.resolvedUrl("../3rdparty.xml")
query: "/includes/include"
XmlRole { name: "name"; query: "name/string()" }
XmlRole { name: "type"; query: "type/string()" }
XmlRole { name: "url"; query: "url/string()" }
XmlRole { name: "copyright"; query: "license/copyright/string()" }
XmlRole { name: "licenseUrl"; query: "license/text/string()" }
XmlRole { name: "licenseType"; query: "license/type/string()" }
}
PageHeader {
title: qsTr("Legal")
}
PlainLabel {
text: qsTr("Sailfin contains code taken from other projects. Without them, Sailfin would " +
"not be possible!")
}
Repeater {
model: licencesModel
Column {
width: parent.width
SectionHeader {
text: name
}
PlainLabel {
color: Theme.secondaryHighlightColor
text: {
switch(type) {
case "SNIPPET":
return qsTr("This program contains small snippets of code taken from <a href=\"%1\">%2</a>, which " +
"is licensed under the %3 license:")
.arg(model.url).arg(model.name).arg(model.licenseType);
}
}
}
Item {
width: 1
height: Theme.paddingLarge
}
SilicaFlickable {
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
}
height: licenseLabel.contentHeight
contentWidth: licenseLabel.contentWidth
clip: true
Label {
id: licenseLabel
color: Theme.secondaryHighlightColor
font.family: "monospace"
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.NoWrap
Component.onCompleted: {
var xhr = new XMLHttpRequest;
xhr.open("GET", Qt.resolvedUrl("../" + model.licenseUrl)); // set Method and File
console.log(Qt.resolvedUrl("../" + model.licenseUrl))
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE){ // if request_status == DONE
var response = model.copyright + "\n\n" + xhr.responseText;
console.log(response);
licenseLabel.text = response
}
}
xhr.send(); // begin the request
}
}
HorizontalScrollDecorator {}
}
}
}
VerticalScrollDecorator {}
}
}
}

View file

@ -0,0 +1,214 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../components"
import "../"
import "../Utils.js" as Utils
/**
* Main page, which simply shows some content of every library, as well as next items.
*/
Page {
property bool _modelsLoaded: false
id: page
allowedOrientations: Orientation.All
SilicaFlickable {
anchors.fill: parent
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
PullDownMenu {
MenuItem {
text: qsTr("Settings")
onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
}
MenuItem {
text: qsTr("Refresh")
onClicked: loadModels(true)
}
busy: mediaLibraryModel.status == ApiModel.Loading
}
// Tell SilicaFlickable the height of its content.
contentHeight: column.height
// Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content.
Column {
id: column
width: page.width
//spacing: Theme.paddingLarge
UserViewModel {
id: mediaLibraryModel2
apiClient: ApiClient
}
MoreSection {
text: qsTr("Resume watching")
clickable: false
busy: userResumeModel.status == ApiModel.Loading
Loader {
width: parent.width
sourceComponent: carrouselView
property alias itemModel: userResumeModel
property string collectionType: "series"
UserItemResumeModel {
id: userResumeModel
apiClient: ApiClient
limit: 12
recursive: true
}
}
}
MoreSection {
text: qsTr("Next up")
clickable: false
}
UserViewModel {
id: mediaLibraryModel
apiClient: ApiClient
}
Repeater {
model: mediaLibraryModel
MoreSection {
text: model.name
busy: userItemModel.status != ApiModel.Ready
onHeaderClicked: pageStack.push(Qt.resolvedUrl("itemdetails/CollectionPage.qml"), {"itemId": model.id})
Loader {
width: parent.width
sourceComponent: carrouselView
property alias itemModel: userItemModel
property string collectionType: model.collectionType || ""
UserItemLatestModel {
id: userItemModel
apiClient: ApiClient
parentId: model.id
limit: 12
}
Connections {
target: mediaLibraryModel
onStatusChanged: {
console.log("MediaLibraryModel status " + status)
if (status == ApiModel.Ready) {
userItemModel.reload()
}
}
}
}
}
}
Column {
width: parent.width
visible: mediaLibraryModel.status == ApiModel.Error
PageHeader {
title: qsTr("Network error")
//clickable: false
}
PlainLabel {
text: qsTr("An error has occurred. Please try again.")
}
Item { width: 1; height: Theme.paddingLarge }
Button {
text: qsTr("Retry")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: loadModels(true)
}
Item { width: 1; height: Theme.paddingLarge }
}
}
}
onStatusChanged: {
if (status == PageStatus.Active) {
appWindow.itemData = null
loadModels(false)
}
}
Connections {
target: ApiClient
onAuthenticatedChanged: loadModels(false)
}
/**
* Loads models if not laoded. Set force to true to reload models
* even if loaded.
*/
function loadModels(force) {
if (force || (ApiClient.authenticated && !_modelsLoaded)) {
_modelsLoaded = true;
mediaLibraryModel.reload()
userResumeModel.reload()
}
}
Component {
id: carrouselView
SilicaListView {
id: list
clip: true
height: {
if (count > 0) {
if (["tvshows", "movies"].indexOf(collectionType) == -1) {
Constants.libraryDelegateHeight
} else {
Constants.libraryDelegatePosterHeight
}
} else {
0
}
}
Behavior on height {
NumberAnimation { duration: 300 }
}
model: itemModel
width: parent.width
orientation: ListView.Horizontal
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
spacing: Theme.paddingLarge
delegate: LibraryItemDelegate {
property string id: model.id
title: model.name
poster: Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags["Primary"], "Primary", {"maxHeight": height})
/*model.imageTags["Primary"] ? ApiClient.baseUrl + "/Items/" + model.id
+ "/Images/Primary?maxHeight=" + height + "&tag=" + model.imageTags["Primary"]
: ""*/
landscape: !Utils.usePortraitCover(collectionType)
progress: (typeof model.userData !== "undefined") ? model.userData.PlayedPercentage / 100 : 0.0
onClicked: {
pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
}
}
}
}
}

View file

@ -0,0 +1,93 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../components"
Page {
id: settingsPage
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height
Column {
id: content
width: parent.width
RemorsePopup {
id: remorse
}
PageHeader {
//: Header of Settings page
title: qsTr("Settings")
}
SectionHeader {
text: qsTr("Session")
}
PlainLabel {
text: qsTr("Server")
}
PlainLabel {
text: ApiClient.baseUrl
color: Theme.secondaryHighlightColor
}
Item { width: 1; height: Theme.paddingMedium; }
PlainLabel {
text: qsTr("User id")
}
PlainLabel {
text: ApiClient.userId
color: Theme.secondaryHighlightColor
}
Item { width: 1; height: Theme.paddingLarge; }
ButtonLayout {
Button {
text: qsTr("Log out")
onClicked: remorse.execute(qsTr("Logging out"), ApiClient.deleteSession)
}
}
SectionHeader {
//: Other settings
text: qsTr("Other")
}
IconListItem {
text: qsTr("About Sailfin")
iconSource: "image://theme/icon-m-about"
onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
}
}
}
}

View file

@ -0,0 +1,68 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import "../components"
/**
* Page only containing a video player.
*
* On larger devices the video player could potentially be embedded somewhere else.
*/
Page {
id: videoPage
property string itemId
property var itemData
property int audioTrack
property int subtitleTrack
property int startTicks: 0
allowedOrientations: Orientation.All
showNavigationIndicator: videoPlayer.hudVisible
VideoPlayer {
id: videoPlayer
anchors.fill: parent
itemId: videoPage.itemId
player: appWindow.mediaPlayer
title: itemData.Name
audioTrack: videoPage.audioTrack
subtitleTrack: videoPage.subtitleTrack
startTicks: videoPage.startTicks
onLandscapeChanged: {
console.log("Is landscape: " + landscape)
//appWindow.orientation = landscape ? Orientation.Landscape : Orientation.Portrait
videoPage.allowedOrientations = landscape ? Orientation.LandscapeMask : Orientation.PortraitMask
}
}
onStatusChanged: {
switch(status) {
case PageStatus.Inactive:
videoPlayer.stop()
break;
case PageStatus.Active:
appWindow.itemData = videoPage.itemData
break;
}
}
}

View file

@ -0,0 +1,89 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../../components"
/**
* This page displays details about a film, show, season, episode, and so on.
*
* It contains the common functionality for all items. Additional components are
* loaded in for every specific type of items, from ../components/itemdetails.
*/
Page {
id: pageRoot
property alias itemId: jItem.jellyfinId
property alias itemData: jItem
//property string itemId: ""
//property var itemData: ({})
property bool _loading: jItem.status === "Loading"
readonly property bool hasLogo: (typeof itemData.ImageTags !== "undefined") && (typeof itemData.ImageTags["Logo"] !== "undefined")
readonly property var _backdropImages: itemData.BackdropImageTags
readonly property var _parentBackdropImages: itemData.ParentBackdropImageTags
readonly property string parentId: itemData.ParentId || ""
property alias backdrop: backdrop
on_BackdropImagesChanged: updateBackdrop()
on_ParentBackdropImagesChanged: updateBackdrop()
function updateBackdrop() {
return;
if (_backdropImages && _backdropImages.length > 0) {
var rand = Math.floor(Math.random() * (_backdropImages.length - 0.001))
console.log("Random: ", rand)
backdrop.source = ApiClient.baseUrl + "/Items/" + itemId + "/Images/Backdrop/" + rand + "?tag=" + _backdropImages[rand] + "&maxHeight" + height
} else if (_parentBackdropImages && _parentBackdropImages.length > 0) {
console.log(parentId)
backdrop.source = ApiClient.baseUrl + "/Items/" + itemData.ParentBackdropItemId + "/Images/Backdrop/0?tag=" + _parentBackdropImages[0]
}
}
allowedOrientations: Orientation.All
GlassyBackground {
id: backdrop
anchors.fill: parent
}
PageBusyIndicator {
running: pageRoot._loading
}
JellyfinItem {
id: jItem
apiClient: ApiClient
onStatusChanged: {
console.log("Status changed: " + newStatus, JSON.stringify(jItem))
console.log(jItem.mediaStreams)
}
}
onStatusChanged: {
if (status == PageStatus.Deactivating) {
backdrop.clear()
//appWindow.itemData = ({})
}
if (status == PageStatus.Active) {
}
}
}

View file

@ -0,0 +1,158 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../.."
import "../../components"
BaseDetailPage {
id: pageRoot
UserItemModel {
id: collectionModel
apiClient: ApiClient
parentId: itemData.jellyfinId
sortBy: ["SortName"]
onParentIdChanged: reload()
}
SilicaGridView {
id: gridView
anchors.fill: parent
model: collectionModel
cellWidth: Constants.libraryDelegateWidth
cellHeight: Utils.usePortraitCover(itemData.CollectionType) ? Constants.libraryDelegatePosterHeight
: Constants.libraryDelegateHeight
header: PageHeader {
title: itemData.Name || qsTr("Loading")
}
PullDownMenu {
id: downMenu
MenuItem {
//: Menu item for selecting the sort order of a collection
text: qsTr("Sort by")
onClicked: pageStack.push(sortPageComponent)
}
busy: collectionModel.status == ApiModel.Loading
}
delegate: GridItem {
RemoteImage {
id: itemImage
anchors.fill: parent
source: Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags["Primary"], "Primary", {"maxWidth": width})
fallbackColor: Utils.colorFromString(model.name)
fillMode: Image.PreserveAspectCrop
clip: true
}
Shim {
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
}
height: itemName.height + Theme.paddingMedium * 2
visible: itemImage.status !== Image.Null
}
Label {
id: itemName
anchors {
left: parent.left
leftMargin: Theme.paddingMedium
right: parent.right
rightMargin: Theme.paddingMedium
bottom: parent.bottom
bottomMargin: Theme.paddingSmall
}
text: model.name
truncationMode: TruncationMode.Fade
horizontalAlignment: Text.AlignLeft
font.pixelSize: Theme.fontSizeSmall
}
onClicked: pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
}
ViewPlaceholder {
enabled: gridView.count == 0 && !pageRoot._loading
text: qsTr("Empty collection")
hintText: qsTr("Add some items to this collection!")
}
VerticalScrollDecorator {}
}
// The page for selecting a sort order
Component {
id: sortPageComponent
Page {
id: sortPage
ListModel {
id: sortOptions
ListElement { name: qsTr("Name"); value: "SortName"; }
ListElement { name: qsTr("Play count"); value: "PlayCount"; }
ListElement { name: qsTr("Date added"); value: "DateCreated"; }
}
SilicaListView {
anchors.fill: parent
model: sortOptions
header: PageHeader {
title: qsTr("Sort by")
}
delegate: ListItem {
Label {
anchors {
left: parent.left
leftMargin: Theme.horizontalPageMargin
right: parent.right
rightMargin: Theme.horizontalPageMargin
verticalCenter: parent.verticalCenter
}
text: model.name
}
menu: ContextMenu {
MenuItem {
//: Sort order
text: qsTr("Ascending")
onClicked: apply(model.value, ApiModel.Ascending)
}
MenuItem {
//: Sort order
text: qsTr("Descending")
onClicked: apply(model.value, ApiModel.Descending)
}
}
onClicked: openMenu()
function apply(field, order) {
collectionModel.sortBy = [field];
collectionModel.sortOrder = order;
collectionModel.reload()
pageStack.pop()
}
}
}
}
}
}

View file

@ -0,0 +1,48 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../../components"
import "../../"
VideoPage {
subtitle: {
if (itemData.indexNumberEnd >= 0) {
qsTr("Episode %1%2 | %3").arg(itemData.indexNumber)
.arg(itemData.indexNumberEnd)
.arg(itemData.seasonName)
} else {
qsTr("Episode %1 | %2").arg(itemData.indexNumber).arg(itemData.seasonName)
}
}
SectionHeader {
text: qsTr("Overview")
}
PlainLabel {
id: overviewText
text: itemData.overview || qsTr("No overview available")
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
}
}

View file

@ -0,0 +1,41 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../../components"
import "../.."
VideoPage {
subtitle: qsTr("Released: %1 — Run time: %2").arg(itemData.productionYear).arg(Utils.ticksToText(itemData.runTimeTicks))
SectionHeader {
text: qsTr("Overview")
}
PlainLabel {
id: overviewText
text: itemData.overview
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
}
}

View file

@ -0,0 +1,5 @@
import QtQuick 2.0
Item {
}

View file

@ -0,0 +1,137 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../.."
import "../../components"
import ".."
BaseDetailPage {
ShowEpisodesModel {
id: episodeModel
apiClient: ApiClient
show: itemData.seriesId
seasonId: itemData.jellyfinId
fields: ["Overview"]
}
SilicaListView {
anchors.fill: parent
contentHeight: content.height
header: PageHeader {
title: itemData.name
description: itemData.seriesName
}
model: episodeModel
delegate: BackgroundItem {
height: Constants.libraryDelegateHeight
RemoteImage {
id: episodeImage
anchors {
top: parent.top
left: parent.left
bottom: parent.bottom
}
width: Constants.libraryDelegateWidth
height: Constants.libraryDelegateHeight
source: Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags["Primary"], "Primary", {"maxHeight": height})
fillMode: Image.PreserveAspectCrop
clip: true
// Makes the progress bar stand out more
Shim {
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
}
height: parent.height / 3
shimColor: Theme.overlayBackgroundColor
shimOpacity: Theme.opacityOverlay
//width: model.userData.PlayedPercentage * parent.width / 100
visible: episodeProgress.width > 0 // It doesn't look nice when it's visible on every image
}
Rectangle {
id: episodeProgress
anchors {
left: parent.left
bottom: parent.bottom
}
height: Theme.paddingMedium
width: model.userData.PlayedPercentage * parent.width / 100
color: Theme.highlightColor
}
}
Label {
id: episodeTitle
anchors {
left: episodeImage.right
leftMargin: Theme.paddingLarge
top: parent.top
right: parent.right
rightMargin: Theme.horizontalPageMargin
}
text: model.name
truncationMode: TruncationMode.Fade
horizontalAlignment: Text.AlignLeft
}
Label {
id: episodeOverview
anchors {
left: episodeImage.right
leftMargin: Theme.paddingLarge
right: parent.right
rightMargin: Theme.horizontalPageMargin
top: episodeTitle.bottom
bottom: parent.bottom
}
color: highlighted ? Theme.secondaryHighlightColor: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
//: No overview/summary text of an episode available
text: model.overview || qsTr("No overview available")
wrapMode: Text.WordWrap
elide: Text.ElideRight
}
onClicked: pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
}
VerticalScrollDecorator {}
}
Connections {
target: itemData
onStatusChanged: {
if (itemData.status == JellyfinItem.Ready) {
episodeModel.reload()
}
}
}
onStatusChanged: {
if (status == PageStatus.Active) {
console.log(JSON.stringify(itemData))
episodeModel.show = itemData.seriesId
episodeModel.seasonId = itemData.jellyfinId
}
}
}

View file

@ -0,0 +1,103 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../../components"
import "../.."
BaseDetailPage {
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height
Column {
id: content
width: parent.width
PageHeader {
id: header
title: itemData.name
visible: !hasLogo
}
Item {
visible: hasLogo
width: parent.width
height: Math.max(logoImage.height, header.height) + 2 * Theme.paddingLarge
RemoteImage {
id: logoImage
anchors.centerIn: parent
source: Utils.itemImageUrl(ApiClient.baseUrl, itemData, "Logo")
}
}
PlainLabel {
id: overviewText
text: itemData.overview
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryHighlightColor
}
SectionHeader {
//: Seasons of a (TV) show
text: qsTr("Seasons")
}
ShowSeasonsModel {
id: showSeasonsModel
apiClient: ApiClient
show: itemData.jellyfinId
onShowChanged: reload()
}
SilicaListView {
model: showSeasonsModel
clip: true
width: parent.width
height: Screen.width / 2
orientation: ListView.Horizontal
spacing: Theme.paddingLarge
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
delegate: LibraryItemDelegate {
poster: Utils.itemModelImageUrl(ApiClient.baseUrl, model.id, model.imageTags["Primary"], "Primary", {"maxHeight": height})
title: model.name
onClicked: pageStack.push(Utils.getPageUrl(model.mediaType, model.type), {"itemId": model.id})
}
}
}
}
/*onStatusChanged: {
if (status == PageStatus.Active) {
showSeasonsModel.reload()
}
}*/
Connections {
target: itemData
onJellyfinIdChanged: {
console.log("Item id changed")
//showSeasonsModel.show = itemData.jellyfinId
}
}
}

View file

@ -0,0 +1,36 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
BaseDetailPage {
SilicaFlickable {
anchors.fill: parent
PageHeader {
title: itemData.name
}
ViewPlaceholder {
enabled: true
text: qsTr("Item type (%1) unsupported").arg(itemData.type)
hintText: qsTr("This is still an alpha version :)")
}
}
}

View file

@ -0,0 +1,82 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../../components"
import "../.."
/**
* Fallback page for everything that's a video, but we haven't a more specific page for, like
* the FilmPage or EpisodePage.
*/
BaseDetailPage {
property alias subtitle: pageHeader.description
default property alias _data: content.data
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge
VerticalScrollDecorator {}
Column {
id: content
width: parent.width
spacing: Theme.paddingMedium
PageHeader {
id: pageHeader
title: itemData.name
description: qsTr("Run time: %2").arg(Utils.ticksToText(itemData.runTimeTicks))
}
PlayToolbar {
id: toolbar
width: parent.width
imageSource: Utils.itemImageUrl(ApiClient.baseUrl, itemData, "Primary", {"maxWidth": parent.width})
imageAspectRatio: Constants.horizontalVideoAspectRatio
playProgress: itemData.UserData.PlayedPercentage / 100
onPlayPressed: pageStack.push(Qt.resolvedUrl("../VideoPage.qml"),
{"itemId": itemId, "itemData": itemData,
"audioTrack": trackSelector.audioTrack,
"subtitleTrack": trackSelector.subtitleTrack,
"startTicks": startFromBeginning ? 0.0
: itemData.UserData.PlaybackPositionTicks })
}
VideoTrackSelector {
id: trackSelector
width: parent.width
tracks: itemData.mediaStreams
}
}
}
Connections {
target: itemData
onStatusChanged: {
if (status == JellyfinItem.Ready) {
console.log(itemData.mediaStreams)
}
}
}
}

View file

@ -0,0 +1,61 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
/**
* Page to indicate that the application is connecting to a server.
*/
Page {
property string serverName
property string serverAddress
property Page firstPage
allowedOrientations: Orientation.All
BusyLabel {
text: qsTr("Connecting to %1").arg(serverName)
running: true
}
onStatusChanged: {
if (status == PageStatus.Active) {
console.log("Connecting page active");
ApiClient.setupConnection();
}
}
Connections {
target: ApiClient
onConnectionSuccess: {
console.log("Login success: " + loginMessage);
pageStack.replace(Qt.resolvedUrl("LoginDialog.qml"), {"loginMessage": loginMessage, "firstPage": firstPage});
}
onConnectionFailed: function(error) {
console.log("Connection failed : " + error)
pageStack.pop();
}
onNetworkError: {
console.log("ConnectingPage: popping page!")
pageStack.pop();
}
}
}

View file

@ -0,0 +1,113 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
/**
* Dialog showed when the user has to connect to a Jellyfin server.
*
* This dialog allows manual address entry or use one of the addresses discovered via UDP broadcasts.
*/
Dialog {
id: dialogRoot
allowedOrientations: Orientation.All
// Picks the address of the ComboBox if selected, otherwise the manual address entry
readonly property string address: serverSelect.currentItem._address
readonly property bool addressCorrect: serverSelect.currentIndex > 0 || manualAddress.acceptableInput
readonly property string serverName: serverSelect.currentItem._name
readonly property bool _isSetupPage: true
acceptDestination: AddServerConnectingPage {
id: connectingPage
serverName: dialogRoot.serverName
serverAddress: address
firstPage: dialogRoot
}
Column {
width: parent.width
DialogHeader {
acceptText: qsTr("Connect")
title: qsTr("Connect to Jellyfin")
}
ServerDiscoveryModel {
id: serverModel
}
ComboBox {
id: serverSelect
label: qsTr("Server")
description: qsTr("Sailfin will try to search for Jellyfin servers on your local network automatically")
menu: ContextMenu {
MenuItem {
// Special values are cool, aren't they?
readonly property string _address: manualAddress.text
readonly property string _name: manualAddress.text
text: qsTr("enter address manually")
}
Repeater {
model: serverModel
delegate: MenuItem {
readonly property string _address: address
readonly property string _name: name
text: qsTr("%1 - %2").arg(name).arg(address)
}
}
}
}
TextField {
id: manualAddress
width: parent.width
clip: true
label: qsTr("Server address")
placeholderText: qsTr("e.g. https://demo.jellyfin.org")
enabled: serverSelect.currentIndex == 0
visible: enabled
inputMethodHints: Qt.ImhUrlCharactersOnly
validator: RegExpValidator {
regExp: /^https?:\/\/[a-zA-Z0-9-._~:/?#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+$/m
}
EnterKey.enabled: addressCorrect
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
EnterKey.onClicked: accept()
}
}
onOpened: serverModel.refresh()
canAccept: addressCorrect
function tryConnect() {
console.log("Hi there!")
ApiClient.baseUrl = address;
//ApiClient.setupConnection()
//fakeTimer.start()
}
onDone: tryConnect()
}

View file

@ -0,0 +1,172 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0
import "../../components"
/**
* Page where the user can login on their server. Is displayed after the AddServerPage successfully connected
* to a Jellyfin server. This page also displays a login message and, if applicable, a list of public users.
*/
Dialog {
id: loginDialog
property string loginMessage
property Page firstPage
property string error
allowedOrientations: Orientation.All
acceptDestination: Page {
BusyLabel {
text: qsTr("Logging in as %1").arg(username.text)
running: true
}
onStatusChanged: {
if(status == PageStatus.Active) {
ApiClient.authenticate(username.text, password.text, true)
}
}
Connections {
target: ApiClient
onAuthenticatedChanged: {
if (ApiClient.authenticated) {
console.log("authenticated!")
pageStack.replaceAbove(null, Qt.resolvedUrl("../MainPage.qml"))
}
}
onAuthenticationError: {
loginDialog.error = qsTr("Invalid username or password")
pageStack.completeAnimation()
pageStack.pop()
}
}
}
PublicUserModel {
id: userModel
apiClient: ApiClient
Component.onCompleted: reload();
}
DialogHeader {
id: dialogHeader
anchors.left: parent.left
anchors.right: parent.right
//: Dialog action
acceptText: qsTr("Login");
}
SilicaFlickable {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: dialogHeader.bottom
anchors.bottom: parent.bottom
contentHeight: column.height
clip: true
VerticalScrollDecorator {}
Column {
id: column
width: parent.width
Flow {
width: parent.width
Repeater {
model: userModel
delegate: UserGridDelegate {
name: model.name
image: model.primaryImageTag ? "%1/Users/%2/Images/Primary?tag=%3".arg(ApiClient.baseUrl).arg(model.id).arg(model.primaryImageTag) : ""
highlighted: model.name === username.text
onClicked: {
username.text = model.name
password.focus = true
}
}
}
}
SectionHeader {
//: Section header for entering username and password
text: qsTr("Credentials")
}
TextField {
id: username
width: parent.width
//: Label placeholder for username field
placeholderText: qsTr("Username")
label: placeholderText
errorHighlight: error
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: password.focus = true
}
TextField {
id: password
width: parent.width
//: Label placeholder for password field
placeholderText: qsTr("Password")
label: placeholderText
echoMode: TextInput.Password
errorHighlight: error
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
EnterKey.onClicked: accept()
}
Label {
anchors {
left: parent.left
leftMargin: Theme.horizontalPageMargin
right: parent.right
rightMargin: Theme.horizontalPageMargin
}
text: error
color: Theme.errorColor
visible: error
}
SectionHeader {
//: Message shown on login, configured by the server owner. Some form of a MOTD
text: qsTr("Login message")
visible: loginMessage
}
Label {
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.horizontalPageMargin
rightMargin: Theme.horizontalPageMargin
}
visible: loginMessage
text: loginMessage
wrapMode: Text.WordWrap
color: Theme.highlightColor
}
}
}
canAccept: username.text
}

19
sailfish/qml/qmldir Normal file
View file

@ -0,0 +1,19 @@
# Sailfin: a Jellyfin client written using Qt
# Copyright (C) 2020 Chris Josten
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
singleton Constants 1.0 Constants.qml
Utils 1.0 Utils.js

79
sailfish/sailfish.pro Normal file
View file

@ -0,0 +1,79 @@
# NOTICE:
#
# Application name defined in TARGET has a corresponding QML filename.
# If name defined in TARGET is changed, the following needs to be done
# to match new name:
# - corresponding QML filename must be changed
# - desktop icon filename must be changed
# - desktop filename must be changed
# - icon definition filename in desktop file must be changed
# - translation filenames have to be changed
# The name of your application
TARGET = harbour-sailfin
#INCLUDEPATH += ../core/include
#DEPENDPATH += ../core
#LIBS += -Lcore -lcore
include(../core/defines.pri)
include(../harbour-sailfin.pri)
# include our shared library and install it
LIBS += -L$$OUT_PWD/../core/lib -ljellyfin-qt
core.files += ../core/lib
core.path = /usr/share/$${TARGET}
INSTALLS += core
# Other configuration
CONFIG += sailfishapp # c++17
DISTFILES += \
qml/Constants.qml \
qml/Utils.js \
qml/components/GlassyBackground.qml \
qml/components/IconListItem.qml \
qml/components/LibraryItemDelegate.qml \
qml/components/MoreSection.qml \
qml/components/PlainLabel.qml \
qml/components/PlayToolbar.qml \
qml/components/RemoteImage.qml \
qml/components/Shim.qml \
qml/components/UserGridDelegate.qml \
qml/components/VideoPlayer.qml \
qml/components/VideoTrackSelector.qml \
qml/components/itemdetails/SeasonDetails.qml \
qml/components/videoplayer/VideoError.qml \
qml/components/videoplayer/VideoHud.qml \
qml/cover/CoverPage.qml \
qml/cover/PosterCover.qml \
qml/cover/VideoCover.qml \
qml/pages/LegalPage.qml \
qml/pages/MainPage.qml \
qml/pages/AboutPage.qml \
qml/harbour-sailfin.qml \
qml/pages/SettingsPage.qml \
qml/pages/VideoPage.qml \
qml/pages/itemdetails/BaseDetailPage.qml \
qml/pages/itemdetails/CollectionPage.qml \
qml/pages/itemdetails/EpisodePage.qml \
qml/pages/itemdetails/FilmPage.qml \
qml/pages/itemdetails/MusicAlbumPage.qml \
qml/pages/itemdetails/SeasonPage.qml \
qml/pages/itemdetails/SeriesPage.qml \
qml/pages/itemdetails/UnsupportedPage.qml \
qml/pages/itemdetails/VideoPage.qml \
qml/pages/setup/AddServerConnectingPage.qml \
qml/pages/setup/LoginDialog.qml \
qml/qmldir
SOURCES += \
src/harbour-sailfin.cpp
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
# to disable building translations every time, comment out the
# following CONFIG line
CONFIG += sailfishapp_i18n

View file

@ -0,0 +1,50 @@
/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif
#include <QJSEngine>
#include <QGuiApplication>
#include <QQuickView>
#include <QQmlEngine>
#include <sailfishapp.h>
#include <jellyfin.h>
int main(int argc, char *argv[]) {
// SailfishApp::main() will display "qml/harbour-sailfin.qml", if you need more
// control over initialization, you can use:
//
// - SailfishApp::application(int, char *[]) to get the QGuiApplication *
// - SailfishApp::createView() to get a new QQuickView * instance
// - SailfishApp::pathTo(QString) to get a QUrl to a resource file
// - SailfishApp::pathToMainQml() to get a QUrl to the main QML file
//
// To display the view, call "show()" (will show fullscreen on device).
QGuiApplication *app = SailfishApp::application(argc, argv);
Jellyfin::registerTypes();
QQuickView *view = SailfishApp::createView();
view->setSource(SailfishApp::pathToMainQml());
view->show();
return app->exec();
}

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0">
<context>
<name>CoverPage</name>
<message>
<source>My Cover</source>
<translation>Mein Cover</translation>
</message>
</context>
<context>
<name>FirstPage</name>
<message>
<source>Show Page 2</source>
<translation>Zur Seite 2</translation>
</message>
<message>
<source>UI Template</source>
<translation>UI-Vorlage</translation>
</message>
<message>
<source>Hello Sailors</source>
<translation>Hallo Matrosen</translation>
</message>
</context>
<context>
<name>SecondPage</name>
<message>
<source>Nested Page</source>
<translation>Unterseite</translation>
</message>
<message>
<source>Item</source>
<translation>Element</translation>
</message>
</context>
</TS>

View file

@ -0,0 +1,358 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AboutPage</name>
<message>
<source>About Sailfin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open externally</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LGPL 2.1 License</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;p&gt;&lt;b&gt;Sailfin version %1&lt;/b&gt;&lt;br/&gt;Copyright © Chris Josten 2020&lt;/p&gt;&lt;p&gt;Sailfin is Free Software licensed under the &lt;a href=&apos;lgpl&apos;&gt;LGPL-v2.1&lt;/a&gt; or later, at your choice. Parts of the code of Sailfin are from other libraries. &lt;a href=&apos;3rdparty&apos;&gt;View their licenses here&lt;/a&gt;.&lt;/p&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AddServerConnectingPage</name>
<message>
<source>Connecting to %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AddServerPage</name>
<message>
<source>Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connect to Jellyfin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Server</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sailfin will try to search for Jellyfin servers on your local network automatically</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>enter address manually</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 - %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Server address</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>e.g. https://demo.jellyfin.org</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CollectionPage</name>
<message>
<source>Loading</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sort by</source>
<extracomment>Menu item for selecting the sort order of a collection</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Empty collection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add some items to this collection!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Play count</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date added</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ascending</source>
<extracomment>Sort order</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Descending</source>
<extracomment>Sort order</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>Sailfin</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EpisodePage</name>
<message>
<source>Episode %1%2 | %3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Episode %1 | %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Overview</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No overview available</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FilmPage</name>
<message>
<source>Released: %1 Run time: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Overview</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LegalPage</name>
<message>
<source>Legal</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This program contains small snippets of code taken from &lt;a href=&quot;%1&quot;&gt;%2&lt;/a&gt;, which is licensed under the %3 license:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sailfin contains code taken from other projects. Without them, Sailfin would not be possible!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LoginDialog</name>
<message>
<source>Logging in as %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Login</source>
<extracomment>Dialog action</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Credentials</source>
<extracomment>Section header for entering username and password</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Username</source>
<extracomment>Label placeholder for username field</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Password</source>
<extracomment>Label placeholder for password field</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Login message</source>
<extracomment>Message shown on login, configured by the server owner. Some form of a MOTD</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Invalid username or password</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<source>Resume watching</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Next up</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Network error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An error has occurred. Please try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Retry</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SeasonPage</name>
<message>
<source>No overview available</source>
<extracomment>No overview/summary text of an episode available</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SeriesPage</name>
<message>
<source>Seasons</source>
<extracomment>Seasons of a (TV) show</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsPage</name>
<message>
<source>Settings</source>
<extracomment>Header of Settings page</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Other</source>
<extracomment>Other settings</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>About Sailfin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Server</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User id</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Log out</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Logging out</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UnsupportedPage</name>
<message>
<source>Item type (%1) unsupported</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is still an alpha version :)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserGridDelegate</name>
<message>
<source>Other account</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoError</name>
<message>
<source>Resource allocation error</source>
<extracomment>Video playback error: out of resources</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video format unsupported</source>
<extracomment>Video playback error: unsupported format/codec</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Network error</source>
<extracomment>Video playback error: network error</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Access denied</source>
<extracomment>Video playback error: access denied</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Media service missing</source>
<extracomment>Video playback error: the media cannot be played because the media service could not be instantiated.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Retry</source>
<extracomment>Button to retry loading a video after a failure</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>No error</source>
<extracomment>Just to be complete if the application shows a video playback error when there&apos;s no error.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoPage</name>
<message>
<source>Run time: %2</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoTrackSelector</name>
<message>
<source>Audio track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Subtitle track</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Off</source>
<extracomment>Value in ComboBox to disable subtitles</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
</TS>