1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-11-22 09:15:18 +00:00

Added comments and general cleanup on qml files

This commit is contained in:
Chris Josten 2020-09-25 15:21:08 +02:00
parent 92a18c4fa5
commit 1eb6a8fb5d
17 changed files with 101 additions and 47 deletions

View file

@ -33,7 +33,9 @@ DISTFILES += \
qml/components/RemoteImage.qml \ qml/components/RemoteImage.qml \
qml/components/UserGridDelegate.qml \ qml/components/UserGridDelegate.qml \
qml/components/VideoPlayer.qml \ qml/components/VideoPlayer.qml \
qml/components/itemdetails/EpisodeDetails.qml \
qml/components/itemdetails/FilmDetails.qml \ qml/components/itemdetails/FilmDetails.qml \
qml/components/itemdetails/SeasonDetails.qml \
qml/components/itemdetails/SeriesDetails.qml \ qml/components/itemdetails/SeriesDetails.qml \
qml/components/videoplayer/VideoHud.qml \ qml/components/videoplayer/VideoHud.qml \
qml/cover/CoverPage.qml \ qml/cover/CoverPage.qml \

View file

@ -2,6 +2,9 @@ import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
/**
* A silica-like background for displaying backdrops.
*/
Rectangle { Rectangle {
property alias source: backgroundImage.source property alias source: backgroundImage.source
property alias sourceSize: backgroundImage.sourceSize property alias sourceSize: backgroundImage.sourceSize
@ -10,7 +13,7 @@ Rectangle {
color: Theme.colorScheme == Theme.DarkOnLight ? "#fff" : "#000" color: Theme.colorScheme == Theme.DarkOnLight ? "#fff" : "#000"
z: -1 z: -1
opacity: status == Image.Ready ? 1.0 : 0.0 opacity: status == Image.Ready ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 300 } } Behavior on opacity { FadeAnimator {} }
Image { Image {
id: backgroundImage id: backgroundImage

View file

@ -1,6 +1,9 @@
import QtQuick 2.6 import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
/**
* Delegate for displaying an item in the library.
*/
BackgroundItem { BackgroundItem {
id: root id: root
property alias poster: posterImage.source property alias poster: posterImage.source

View file

@ -1,6 +1,9 @@
import QtQuick 2.6 import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
/**
* An image for "remote" images (loaded over e.g. http), with a spinner and a fallback image
*/
Image { Image {
property string fallbackImage property string fallbackImage
property bool usingFallbackImage property bool usingFallbackImage

View file

@ -6,7 +6,11 @@ import nl.netsoj.chris.Jellyfin 1.0
import "videoplayer" import "videoplayer"
Item { /**
* A videoPlayer for Jellyfin videos
*/
SilicaItem {
id: playerRoot id: playerRoot
property string itemId property string itemId
property string title property string title
@ -15,6 +19,17 @@ Item {
property MediaPlayer player property MediaPlayer player
readonly property bool hudVisible: !hud.hidden readonly property bool hudVisible: !hud.hidden
// 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"
}
MediaSource { MediaSource {
id: mediaSource id: mediaSource
apiClient: ApiClient apiClient: ApiClient

View file

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

View file

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

View file

@ -2,6 +2,10 @@ import QtQuick 2.6
import QtMultimedia 5.6 import QtMultimedia 5.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
/**
* The video "hud" or controls. This is the overlay displayed over a video player, which contains controls
* and playback information.
*/
Item { Item {
id: videoHud id: videoHud
property MediaPlayer player property MediaPlayer player

View file

@ -9,6 +9,7 @@ CoverBackground {
anchors.fill: parent anchors.fill: parent
color: "black" color: "black"
// Wanted to display the currently running move on here, but it's hard :/
/*VideoOutput { /*VideoOutput {
id: coverOutput id: coverOutput
anchors.fill: parent anchors.fill: parent

View file

@ -11,10 +11,12 @@ ApplicationWindow {
id: appWindow id: appWindow
property bool isInSetup: false property bool isInSetup: false
property bool _hasInitialized: false property bool _hasInitialized: false
// The global mediaPlayer instance
readonly property MediaPlayer mediaPlayer: _mediaPlayer readonly property MediaPlayer mediaPlayer: _mediaPlayer
// Data of the currently selected item. For use on the cover.
property var itemData property var itemData
//property alias backdrop: backdrop
//FIXME: proper error handling
Connections { Connections {
target: ApiClient target: ApiClient
onNetworkError: errorNotification.show("Network error: " + error) onNetworkError: errorNotification.show("Network error: " + error)
@ -27,21 +29,11 @@ ApplicationWindow {
autoPlay: true autoPlay: true
} }
/*GlassyBackground {
id: backdrop
anchors.fill: parent
opacity: status == Image.Ready ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 300 } }
function clear() {
source = ""
}
}*/
initialPage: Component { initialPage: Component {
MainPage { MainPage {
Connections { Connections {
target: ApiClient target: ApiClient
// Replace the MainPage if no server was set up.
onSetupRequired: { onSetupRequired: {
if (!isInSetup) { if (!isInSetup) {
isInSetup = true; isInSetup = true;

View file

@ -4,8 +4,14 @@ import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0 import nl.netsoj.chris.Jellyfin 1.0
import "../components" import "../components"
import "../compontents/details" import "../components/itemdetails"
/**
* 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 { Page {
id: pageRoot id: pageRoot
property string itemId: "" property string itemId: ""

View file

@ -4,6 +4,12 @@ import Sailfish.Silica 1.0
import "../components" 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 { Page {
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
@ -32,7 +38,7 @@ Page {
} }
PlainLabel { PlainLabel {
text: qsTr("The Sailfin application contains some code from other projects. Without them, Sailfin would " + text: qsTr("Sailfin contains code taken from other projects. Without them, Sailfin would " +
"not be possible!") "not be possible!")
} }

View file

@ -5,31 +5,15 @@ import nl.netsoj.chris.Jellyfin 1.0
import "../components" import "../components"
// Test /**
* Main page, which simply shows some content of every library, as well as next items.
*/
Page { Page {
id: page
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
property bool _modelsLoaded: false property bool _modelsLoaded: false
Connections { id: page
target: ApiClient allowedOrientations: Orientation.All
onAuthenticatedChanged: {
if (authenticated && !_modelsLoaded) loadModels();
}
}
Component.onCompleted: {
if (ApiClient.authenticated && _modelsLoaded) {
loadModels();
}
}
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable { SilicaFlickable {
anchors.fill: parent anchors.fill: parent
@ -48,7 +32,6 @@ Page {
// Tell SilicaFlickable the height of its content. // Tell SilicaFlickable the height of its content.
contentHeight: column.height contentHeight: column.height
// Place our content in a Column. The PageHeader is always placed at the top // Place our content in a Column. The PageHeader is always placed at the top
// of the page, followed by our content. // of the page, followed by our content.
Column { Column {
@ -121,6 +104,18 @@ Page {
} }
} }
Connections {
target: ApiClient
onAuthenticatedChanged: {
if (authenticated && !_modelsLoaded) loadModels();
}
}
Component.onCompleted: {
if (ApiClient.authenticated && _modelsLoaded) {
loadModels();
}
}
function loadModels() { function loadModels() {
_modelsLoaded = true; _modelsLoaded = true;
mediaLibraryModel.reload() mediaLibraryModel.reload()

View file

@ -3,30 +3,31 @@ import Sailfish.Silica 1.0
import "../components" import "../components"
/**
* Page only containing a video player.
*
* On larger devices the video player could potentially be embedded somewhere else.
*/
Page { Page {
id: videoPage id: videoPage
property string itemId property string itemId
property var itemData property var itemData
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
palette.colorScheme: Theme.LightOnDark
showNavigationIndicator: videoPlayer.hudVisible showNavigationIndicator: videoPlayer.hudVisible
Rectangle {
anchors.fill: parent
color: "black"
}
VideoPlayer { VideoPlayer {
id: videoPlayer id: videoPlayer
anchors.fill: parent anchors.fill: parent
itemId: videoPage.itemId itemId: videoPage.itemId
player: appWindow.mediaPlayer
title: itemData.Name
onLandscapeChanged: { onLandscapeChanged: {
console.log("Is landscape: " + landscape) console.log("Is landscape: " + landscape)
//appWindow.orientation = landscape ? Orientation.Landscape : Orientation.Portrait //appWindow.orientation = landscape ? Orientation.Landscape : Orientation.Portrait
videoPage.allowedOrientations = landscape ? Orientation.LandscapeMask : Orientation.PortraitMask videoPage.allowedOrientations = landscape ? Orientation.LandscapeMask : Orientation.PortraitMask
} }
player: appWindow.mediaPlayer
title: itemData.Name
} }
onStatusChanged: { onStatusChanged: {

View file

@ -2,6 +2,9 @@ import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0 import nl.netsoj.chris.Jellyfin 1.0
/**
* Page to indicate that the application is connecting to a server.
*/
Page { Page {
property string serverName property string serverName
property string serverAddress property string serverAddress

View file

@ -2,6 +2,11 @@ import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 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 { Dialog {
id: dialogRoot id: dialogRoot
allowedOrientations: Orientation.All allowedOrientations: Orientation.All

View file

@ -4,6 +4,11 @@ import nl.netsoj.chris.Jellyfin 1.0
import "../../components" 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 { Dialog {
property string loginMessage property string loginMessage
property Page firstPage property Page firstPage