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/UserGridDelegate.qml \
qml/components/VideoPlayer.qml \
qml/components/itemdetails/EpisodeDetails.qml \
qml/components/itemdetails/FilmDetails.qml \
qml/components/itemdetails/SeasonDetails.qml \
qml/components/itemdetails/SeriesDetails.qml \
qml/components/videoplayer/VideoHud.qml \
qml/cover/CoverPage.qml \

View file

@ -2,6 +2,9 @@ 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
@ -10,7 +13,7 @@ Rectangle {
color: Theme.colorScheme == Theme.DarkOnLight ? "#fff" : "#000"
z: -1
opacity: status == Image.Ready ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 300 } }
Behavior on opacity { FadeAnimator {} }
Image {
id: backgroundImage

View file

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

View file

@ -1,6 +1,9 @@
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
*/
Image {
property string fallbackImage
property bool usingFallbackImage

View file

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

View file

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

View file

@ -11,10 +11,12 @@ ApplicationWindow {
id: appWindow
property bool isInSetup: false
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
//property alias backdrop: backdrop
//FIXME: proper error handling
Connections {
target: ApiClient
onNetworkError: errorNotification.show("Network error: " + error)
@ -27,21 +29,11 @@ ApplicationWindow {
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 {
MainPage {
Connections {
target: ApiClient
// Replace the MainPage if no server was set up.
onSetupRequired: {
if (!isInSetup) {
isInSetup = true;

View file

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

View file

@ -4,6 +4,12 @@ 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
@ -32,7 +38,7 @@ Page {
}
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!")
}

View file

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

View file

@ -3,30 +3,31 @@ 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
allowedOrientations: Orientation.All
palette.colorScheme: Theme.LightOnDark
showNavigationIndicator: videoPlayer.hudVisible
Rectangle {
anchors.fill: parent
color: "black"
}
VideoPlayer {
id: videoPlayer
anchors.fill: parent
itemId: videoPage.itemId
player: appWindow.mediaPlayer
title: itemData.Name
onLandscapeChanged: {
console.log("Is landscape: " + landscape)
//appWindow.orientation = landscape ? Orientation.Landscape : Orientation.Portrait
videoPage.allowedOrientations = landscape ? Orientation.LandscapeMask : Orientation.PortraitMask
}
player: appWindow.mediaPlayer
title: itemData.Name
}
onStatusChanged: {

View file

@ -2,6 +2,9 @@ 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

View file

@ -2,6 +2,11 @@ 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

View file

@ -4,6 +4,11 @@ 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 {
property string loginMessage
property Page firstPage