Initial commit
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
property string src: ""
|
||||
// property int donevalue: 3
|
||||
property bool done: true//donevalue !== 3 ? false : true
|
||||
JSONSimple {
|
||||
id: showupdated
|
||||
source: src
|
||||
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
var id
|
||||
var name
|
||||
var image
|
||||
var summary
|
||||
var status
|
||||
var premiered
|
||||
var rating
|
||||
var network
|
||||
var updated
|
||||
var next
|
||||
var prev
|
||||
var imdb
|
||||
|
||||
simple.id ? id = simple.id : id = "???"
|
||||
simple.name ? name = simple.name : name = "???"
|
||||
simple.image.medium ? image = simple.image.medium : image = "???"
|
||||
simple.summary ? summary = simple.summary : summary = "???"
|
||||
simple.status ? status = simple.status : status = "???"
|
||||
simple.premiered ? premiered = simple.premiered : premiered = "???"
|
||||
simple.rating.average ? rating = simple.rating.average : rating = "???"
|
||||
simple.webChannel ? network = simple.webChannel.name : network = simple.network.name
|
||||
simple.updated ? updated = simple.updated : updated = "???"
|
||||
|
||||
simple._links.previousepisode ? prev = simple._links.previousepisode.href : prev = ""
|
||||
simple._links.nextepisode ? next = simple._links.nextepisode.href : next = ""
|
||||
simple.externals.imdb ? imdb = simple.externals.imdb : imdb = ""
|
||||
|
||||
|
||||
updateFav(id, name, image, summary, status, premiered, rating, network, updated, prev, next, imdb)
|
||||
//donevalue = donevalue + 1
|
||||
|
||||
console.log("---SHOWUPDATED: "+simple.name)
|
||||
done = true
|
||||
// prevshow.shid = simple.id
|
||||
// simple._links.previousepisode ? prevshow.source = simple._links.previousepisode.href : donevalue = donevalue + 1
|
||||
// nextshow.shid = simple.id
|
||||
// simple._links.nextepisode ? nextshow.source = simple._links.nextepisode.href : donevalue = donevalue + 1
|
||||
|
||||
|
||||
|
||||
|
||||
/* if (typeof(simple._links.nextepisode.href) == 'undefined') {
|
||||
donevalue = donevalue + 1
|
||||
} else nextshow.source = simple._links.nextepisode.href */
|
||||
|
||||
|
||||
/* if (simple.status !== "Ended") {
|
||||
prevshow.next =
|
||||
prevshow.source = simple._links.previousepisode.href
|
||||
nextshow.source = simple._links.nextepisode.href
|
||||
} */
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONSimple {
|
||||
id: nextshow
|
||||
property int shid
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
var senext = "S"+simple.season+"E"+simple.number
|
||||
updateNext(shid, simple.airdate, senext);
|
||||
donevalue = donevalue + 1
|
||||
console.log("---NEXT: "+shid+" : "+simple.airdate)
|
||||
|
||||
// snext = simple.airdate // update database here
|
||||
// senext = "S"+simple.season+"E"+simple.number
|
||||
|
||||
// list.append({"cost": 5.95, "name":"Pizza"})
|
||||
// updateFav(sshowid, showName, showimg, ssummary, showStatus, showPrem, showRating, showNetwork, shupdated, sprev, snext, senext);
|
||||
//showPrev.text = sprev
|
||||
//showNext.text = snext
|
||||
//reloadFav()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONSimple {
|
||||
id: prevshow
|
||||
property int shid
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
updatePrev(shid, simple.airdate);
|
||||
donevalue = donevalue + 1
|
||||
console.log("---PREVIOUS: "+shid+" : "+simple.airdate)
|
||||
// console.log("PREV: "+simple.airdate)
|
||||
// sprev = simple.airdate
|
||||
// senext = ""
|
||||
// if (showupdated.simple._links.nextepisode) {
|
||||
// console.log("GOING NEXT")
|
||||
// nextshow.source = lnext
|
||||
// } else {
|
||||
// console.log("NOT GOING NEXT")
|
||||
// snext = "" //update database here
|
||||
// updateFav(sshowid, showName, showimg, ssummary, showStatus, showPrem, showRating, showNetwork, shupdated, sprev, snext, senext);
|
||||
//showPrev.text = sprev
|
||||
//showNext.text = snext
|
||||
//reloadFav()
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/* JSONListModel - a QML ListModel with JSON and JSONPath support
|
||||
*
|
||||
* Copyright (c) 2012 Romain Pokrzywka (KDAB) (romain@kdab.com)
|
||||
* Licensed under the MIT licence (http://opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import "../js/jsonpath.js" as JSONPath
|
||||
|
||||
Item {
|
||||
property string source: ""
|
||||
property string json: ""
|
||||
property string query: ""
|
||||
property bool jsonready: true
|
||||
property bool modelready: true
|
||||
property bool prev: false
|
||||
property bool next: false
|
||||
property string sortby: ""
|
||||
//property string filterby: ""
|
||||
//property string filterkey: ""
|
||||
|
||||
property ListModel model : ListModel { id: jsonModel }
|
||||
property alias count: jsonModel.count
|
||||
//property alias get: jsonModel.get
|
||||
|
||||
onSourceChanged: {
|
||||
if (source !== "") {
|
||||
jsonready = false
|
||||
modelready = false
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open("GET", source);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE)
|
||||
json = xhr.responseText;
|
||||
}
|
||||
xhr.send();
|
||||
} else jsonModel.clear();
|
||||
}
|
||||
|
||||
onJsonChanged: updateJSONModel()
|
||||
onQueryChanged: updateJSONModel()
|
||||
//onFilterbyChanged: updateJSONModel()
|
||||
//onFilterkeyChanged: updateJSONModel()
|
||||
|
||||
function updateJSONModel() {
|
||||
jsonModel.clear();
|
||||
|
||||
if ( json === "" )
|
||||
return;
|
||||
|
||||
var objectArray = parseJSONString(json, query);
|
||||
|
||||
if (sortby !== "") objectArray = sortByKey(objectArray, sortby);
|
||||
//if (filterby !== "" && filterkey !=="") objectArray = filterValuePart(objectArray, filterby, filterkey);
|
||||
|
||||
for ( var key in objectArray ) {
|
||||
var jo = objectArray[key];
|
||||
if( jo.toString() === "[object Object]"){
|
||||
jsonModel.append( jo );
|
||||
} else {
|
||||
//this is comma separated strings
|
||||
var str = jo.toString().split(",");
|
||||
for(var i = 0; i < str.length; i++){
|
||||
jsonModel.append({ "item": str[i] } );
|
||||
}
|
||||
break;
|
||||
}
|
||||
// var jo = objectArray[key];
|
||||
// jsonModel.append( jo );
|
||||
// console.log("JSON: "+objectArray[key])
|
||||
}
|
||||
jsonready = true
|
||||
}
|
||||
|
||||
function parseJSONString(jsonString, jsonPathQuery) {
|
||||
var objectArray = JSON.parse(jsonString);
|
||||
if ( jsonPathQuery !== "" )
|
||||
objectArray = JSONPath.jsonPath(objectArray, jsonPathQuery);
|
||||
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
function filterValuePart(array, part, key) {
|
||||
part = part.toLowerCase();
|
||||
return array.filter(function(a) {
|
||||
var x = a[key];
|
||||
return x.toLowerCase().indexOf(part) !== -1;
|
||||
});
|
||||
}
|
||||
|
||||
function sortByKey(array, key) {
|
||||
var res = key.split(".")
|
||||
//console.log("RES: "+res.length)
|
||||
if (res.length === 1) {
|
||||
return array.sort(function(a, b) {
|
||||
var x = a[res[0]]; var y = b[res[0]];
|
||||
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
|
||||
});
|
||||
} else {
|
||||
return array.sort(function(a, b) {
|
||||
var x = a[res[0]][res[1]]; var y = b[res[0]][res[1]];
|
||||
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
property string source: ""
|
||||
property variant simple
|
||||
property bool ready: true
|
||||
|
||||
onSourceChanged: {
|
||||
ready = false
|
||||
request(source, function (o) {
|
||||
//console.log(o.responseText);
|
||||
simple = eval('new Object(' + o.responseText + ')');ready = true;
|
||||
});
|
||||
|
||||
}
|
||||
function request(url, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = (function(myxhr) {
|
||||
return function() {
|
||||
if (myxhr.readyState === XMLHttpRequest.DONE && xhr.status == 200) {callback(myxhr);}
|
||||
}
|
||||
})(xhr);
|
||||
xhr.open('get', url, true);
|
||||
xhr.send('');
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright (C) 2013 Jolla Ltd.
|
||||
Contact: Thomas Perl <thomas.perl@jollamobile.com>
|
||||
All rights reserved.
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Jolla Ltd nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
CoverBackground {
|
||||
Image{
|
||||
source: "../harbour-labyrinth.png"
|
||||
//height: parent.height
|
||||
//width: parent.width
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.paddingSmall
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
opacity: 0.1
|
||||
//anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
Column {
|
||||
id: column1
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.paddingSmall
|
||||
|
||||
|
||||
Label {
|
||||
font.pixelSize: Theme.fontSizeExtraLarge
|
||||
font.bold: true
|
||||
text: "Labyrinth"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
opacity: 0.7
|
||||
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
font.bold: false
|
||||
text: "(version "+ Qt.application.version+")"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
opacity: 0.7
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,425 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
|
||||
ListItem {
|
||||
id: showDelegate
|
||||
width: ListView.view.width
|
||||
contentHeight: showImg.height + showName.height + (Theme.paddingLarge * 4)
|
||||
|
||||
property bool favorite: getFav(model.id)
|
||||
property string prev: ""
|
||||
property string next: ""
|
||||
property string nextse: ""
|
||||
property string genretext: ""
|
||||
|
||||
ListModel{id: sgenres}
|
||||
|
||||
function getArrary(ent, model) {
|
||||
if (ent) {
|
||||
console.log("LEN: "+ent.count)
|
||||
for (var i = 0; i < ent.count; i ++) {
|
||||
console.log(ent.get(i))
|
||||
model.append(ent.get(i))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONSimple {
|
||||
id: nextshow
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
simple.airdate ? next = simple.airdate : next = "?"
|
||||
next !== "" ? nextse = "S"+simple.season+"E"+simple.number : nextse = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONSimple {
|
||||
id: prevshow
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
simple.airdate ? prev = simple.airdate : prev = "?"
|
||||
if (model._links.nextepisode) {
|
||||
nextshow.source = model._links.nextepisode.href
|
||||
} else {
|
||||
next = "?"
|
||||
nextse = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RemorseItem {
|
||||
id: remorse
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
function showRemorseItem() {
|
||||
var idx = index
|
||||
remorseAction( "Removing "+name+" from favorites!", function() {delFav(model.id);favorite = false})
|
||||
}
|
||||
|
||||
OpacityRampEffect {
|
||||
sourceItem: showRect
|
||||
direction: OpacityRamp.TopToBottom
|
||||
offset: 0.0
|
||||
slope: 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: showRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
width: parent.width
|
||||
height: showName.height + Theme.paddingLarge
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextIcon
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
anchors.right: showRect.right
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-right"
|
||||
}
|
||||
|
||||
Image {
|
||||
id: seenIcon
|
||||
visible: false
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-acknowledge"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showName
|
||||
text: model.name !== null ? model.name : ""
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
anchors.right: nextIcon.left
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
wrapMode: Text.ElideRight
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
maximumLineCount: 1
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// console.log("COMPLETED")
|
||||
//sgenres.clear()
|
||||
// getArrary(model.genres,sgenres)
|
||||
//blahh = model.get(0).genres
|
||||
//console.log("GENRES: "+blahh.get(1))
|
||||
if (model._links.previousepisode) {
|
||||
prevshow.source = model._links.previousepisode.href
|
||||
} else {
|
||||
prev = "";
|
||||
next = "";
|
||||
nextse = ""
|
||||
}
|
||||
//sgenres = model.genres
|
||||
//console.log("GENRE: "+sgenres.get(0)[0])
|
||||
//var temp = [] //model.genres.count
|
||||
//temp = model.genres
|
||||
//var genretext = ""
|
||||
//console.log("LOG: "+ genres.get(1).modelData)
|
||||
//var genre = temp.split(",")
|
||||
// for(var i = 0; i < model.genres.count; i++) {
|
||||
//fruitModel.get(0).attributes.get(1).value
|
||||
//genretext = genretext + "|" + model.genres.get(i) //model.genres.sublist(i)
|
||||
|
||||
|
||||
// }
|
||||
//return genretext
|
||||
|
||||
}
|
||||
|
||||
Image {
|
||||
id: showImg
|
||||
anchors.top: showRect.bottom
|
||||
anchors.margins: Theme.paddingLarge
|
||||
anchors.left: parent.left
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: model.image ? model.image.medium : "../No-Image-.png"
|
||||
width: height * 0.8
|
||||
// height: (showName.height + showStatus.height + showPrem.height + showRating.height + showNext.height + showPrev.height + Theme.paddingMedium) * showImg.scale
|
||||
height: (showName.height + showS.height + showP.height + showR.height + showN.height + showPr.height + Theme.paddingLarge) * showImg.scale
|
||||
scale: 1.1
|
||||
|
||||
BusyIndicator {
|
||||
id: imgBysy
|
||||
running: showImg.progress !== 1.0
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: favIcon
|
||||
//visible: false
|
||||
anchors.right: parent.right
|
||||
anchors.top: showImg.top
|
||||
//anchors.verticalCenter: showStatus.verticalCenter
|
||||
height: showStatus.height + (showStatus.height/2)
|
||||
width: height
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: favorite ? "image://theme/icon-m-favorite-selected" : "image://theme/icon-m-favorite"
|
||||
MouseArea {
|
||||
anchors.fill: favIcon
|
||||
onClicked: if (getFav(model.id)) {showRemorseItem()} else {
|
||||
console.log("ID: "+model.id)
|
||||
var network
|
||||
model.webChannel ? network = model.webChannel.name : network = model.network.name
|
||||
addFav(model.id, model.name, showImg.source, model.summary, model.status, model.premiered, model.rating.average, network, model.updated, prev, next, nextse, model.externals.imdb);
|
||||
reloadFav()
|
||||
favorite=true
|
||||
}
|
||||
}
|
||||
BusyIndicator {
|
||||
id: addBusy
|
||||
running: false
|
||||
size: BusyIndicatorSize.Medium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showS
|
||||
text: "Status:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.bottom: showP.top
|
||||
anchors.left: showImg.right
|
||||
//anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showStatus
|
||||
text: model.status !== null ? model.status : ""
|
||||
//color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
color: {//highlighted ? Theme.highlightColor : running && f_next !== "?" ? Theme.primaryColor : ended ? Theme.errorColor : Theme.secondaryColor
|
||||
if (highlighted) Theme.highlightColor;
|
||||
else if (model.status === "Ended") Theme.errorColor;
|
||||
else if (model.status === "Running" && next !== "?") Theme.highlightColor
|
||||
else if (model.status === "Running" && next === "?") Theme.primaryColor
|
||||
else Theme.secondaryColor
|
||||
}
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.bottom: showP.top
|
||||
//anchors.left: showImg.right
|
||||
anchors.left: showS.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showP
|
||||
text: "Premiered:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showR.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showPrem
|
||||
text: model.premiered !== null ? model.premiered : ""
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showR.top
|
||||
anchors.left: showP.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
/* Text {
|
||||
id: showPrem
|
||||
text: model.premiered !== null ? "Premiered: <b>" + model.premiered + "</b>" : ""
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.top: showStatus.bottom
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
*/
|
||||
|
||||
Text {
|
||||
id: showR
|
||||
text: "Average rating:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showN.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showRating
|
||||
text: model.rating.average ? model.rating.average : "?"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showN.top
|
||||
anchors.left: showR.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
/*
|
||||
Text {
|
||||
id: showRating
|
||||
text: model.rating.average ? "Average rating: <b>" + model.rating.average + "</b>" : "Average rating: <b>?</b>"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.top: showPrem.bottom
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
*/
|
||||
Text {
|
||||
id: showN
|
||||
text: "Network:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showPr.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNetwork
|
||||
text: model.webChannel ? model.webChannel.name : model.network.name
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showPr.top
|
||||
anchors.left: showN.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
/*
|
||||
Text {
|
||||
id: showNetwork
|
||||
text: model.webChannel ? "Network: <b>" + model.webChannel.name + "</b>" : "Network: <b>" + model.network.name + "</b>"
|
||||
//enabled: model.network.name ? true : false
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.top: showRating.bottom
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
*/
|
||||
Text {
|
||||
id: showPr
|
||||
text: "Previous:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showNe.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showPrev
|
||||
text: prev
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showNe.top
|
||||
anchors.left: showPr.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: prev !== "Unknown" ? true : false
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNe
|
||||
text: nextse !== "" ? "Next: ("+nextse+")" : "Next: "
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.bottomMargin: Theme.paddingSmall
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNext
|
||||
text: next
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.bottomMargin: Theme.paddingSmall
|
||||
anchors.left: showNe.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: next !== "Unknown" ? true : false
|
||||
}
|
||||
|
||||
/* Text {
|
||||
id: showGenre
|
||||
text: ""//sgenres.get(1)[0]//genre() //model.network ? "Network: <b>" + model.network.name + "</b>" : "Network:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.top: showImg.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
} */
|
||||
|
||||
onPressAndHold: {
|
||||
pageStack.push(Qt.resolvedUrl("../pages/ShowImg.qml"),{"img": model.image ? model.image.medium : "../No-Image-.png"})
|
||||
//pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": model.id,"showname": model.name,"showimage": showImg.source} )
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
//frompage === undefined ?
|
||||
var network
|
||||
model.webChannel ? network = model.webChannel.name : network = model.network.name
|
||||
pageStack.push(Qt.resolvedUrl("../pages/InfoPage.qml"),
|
||||
{"showid": model.id,"showname": model.name, "showimage": showImg.source, "summary": model.summary, "showstatus": model.status, "showprem": model.premiered, "showrating": model.rating.average, "shownetwork": network, "showupdated": model.updated, "showprev": model.previousepisode, "shownext": model.nextepisode, "simdb": model.externals.imdb, "sofficial": model.officialSite})
|
||||
|
||||
|
||||
//:
|
||||
//pageStack.pop(frompage,PageStackAction.Immediate)
|
||||
//frompage = undefined
|
||||
//pageStack.push(Qt.resolvedUrl("../pages/InfoPage.qml"),{"showid": model.id,"showname": model.name, "showimage": showImg.source, "summary": model.summary, "showstatus": model.status, "showprem": model.premiered, "showrating": model.rating.average, "shownetwork": model.network.name, "showupdated": model.updated, "showprev": model.previousepisode, "shownext": model.nextepisode})//pageStack.clear();pageStack.push(Qt.resolvedUrl("SearchPage.qml")),{};
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -0,0 +1,62 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import QtQuick.LocalStorage 2.0
|
||||
|
||||
import "JSONListModel"
|
||||
import "pages"
|
||||
import "js/favorites.js" as FavDb
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
|
||||
|
||||
ListModel{id: favorites}
|
||||
|
||||
function updateFav(showid, name, image, summary, status, prem, rating, network, updated, imdb, official) {
|
||||
FavDb.update(showid, name, image, summary, status, prem, rating, network, updated, imdb, official)
|
||||
}
|
||||
|
||||
// DETTA SKA GÖRAS BÅDE VID UPPDATERING OCH LÄGGA TILL!!!
|
||||
function updateNext(showid, next, nextse) {
|
||||
FavDb.updateNext(showid, next, nextse)
|
||||
}
|
||||
|
||||
function updatePrev(showid, previous) {
|
||||
FavDb.updatePrev(showid, previous)
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
function dropFav() {
|
||||
FavDb.drop()
|
||||
FavDb.initialize()
|
||||
FavDb.load(favorites)
|
||||
}
|
||||
|
||||
function getFav(showid) {
|
||||
return FavDb.getFav(showid)
|
||||
}
|
||||
|
||||
function reloadFav() {
|
||||
FavDb.load(favorites)
|
||||
}
|
||||
|
||||
function addFav(showid, name, image, summary, status, prem, rating, network, updated, previous, next, nextse, imdb, official) {
|
||||
FavDb.add(showid, name, image, summary, status, prem, rating, network, updated, previous, next, nextse,imdb,official)
|
||||
}
|
||||
|
||||
function delFav(showid) {
|
||||
FavDb.del(showid)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
FavDb.initialize()
|
||||
FavDb.load(favorites)
|
||||
}
|
||||
|
||||
initialPage: Component { Favorites { } }
|
||||
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
||||
allowedOrientations: defaultAllowedOrientations//| Orientation.Landscape
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
// Database should be updated to contain location and section.
|
||||
|
||||
var db = undefined;
|
||||
function settings_db_open() {
|
||||
if (db == undefined)
|
||||
db = LocalStorage.openDatabaseSync("harbour-labyrinth-test1", "1.0", "StorageDatabase", 100000);
|
||||
|
||||
/* db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql("DROP TABLE IF EXISTS favorites");
|
||||
}); */
|
||||
|
||||
|
||||
// drop()
|
||||
/* property string showname
|
||||
|
||||
property string showimage: ""
|
||||
property string summary: ""
|
||||
property string showid: ""
|
||||
|
||||
property string showstatus: ""
|
||||
property string showprem: ""
|
||||
property string showrating: ""
|
||||
property string shownetwork: "" */
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
/*
|
||||
showName.text = simple.name
|
||||
showStatus.text = simple.status
|
||||
showPrem.text = simple.premiered
|
||||
showRating.text = simple.rating.average
|
||||
showNetwork.text = simple.network.name
|
||||
ssummary = simple.summary
|
||||
imdb = simple.externals.imdb
|
||||
*/
|
||||
|
||||
function initialize() { // klar
|
||||
db = settings_db_open();
|
||||
db.transaction(
|
||||
function(tx) {
|
||||
|
||||
// tx.executeSql('ALTER TABLE favorites ADD seen INTEGER');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS favorites(showid INTEGER UNIQUE, name TEXT, image TEXT, summary TEXT, status TEXT, premiered TEXT, rating TEXT, network TEXT, updated INTEGER, previous TEXT, next TEXT,nextse TEXT, imdb TEXT, official TEXT, seen INTEGER)');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS seen(showid INTEGER UNIQUE, season INTEGER, episode INTEGER)');
|
||||
// tx.executeSql('CREATE TABLE IF NOT EXISTS next(showid INTEGER UNIQUE, next TEXT)');
|
||||
// tx.executeSql('CREATE TABLE IF NOT EXISTS previous(showid INTEGER UNIQUE, prev TEXT)');
|
||||
});
|
||||
|
||||
}
|
||||
/*
|
||||
function getCount(){
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
var rs = tx.executeSql('SELECT * FROM favorites');
|
||||
dbcount = rs.rows.length
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
function getFavByNr(shids,nr) // klar
|
||||
{
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
var rs = tx.executeSql('SELECT * FROM favorites');
|
||||
// var shids = new Array();
|
||||
// var shids = []
|
||||
// var shid = ""
|
||||
// var shupdated = ""
|
||||
shids.push(rs.rows.item(nr).showid)
|
||||
shids.push(rs.rows.item(nr).updated)
|
||||
// shids = [rs.rows.item(nr).showid,rs.rows.item(nr).updated]
|
||||
// console.log(" --- DB SHIDS; "+shids)
|
||||
// return shids
|
||||
});
|
||||
}
|
||||
|
||||
function getFav(showid) {
|
||||
var res = undefined
|
||||
settings_db_open();
|
||||
db.transaction(function(tx) {
|
||||
|
||||
res = tx.executeSql("SELECT * FROM favorites WHERE showid like ('"+ showid + "')");})
|
||||
try {
|
||||
if (typeof res.rows.item(0).showid === 'number')
|
||||
return true
|
||||
} catch(a) {
|
||||
return false
|
||||
}}
|
||||
|
||||
function getFav_(showid) {
|
||||
settings_db_open();
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
try {
|
||||
tx.executeSql("SELECT * FROM favorites WHERE showid='"+showid+"'");
|
||||
console.log("SUCCESS")
|
||||
} catch(a) {
|
||||
console.log("ERROR")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// console.log("FAVDB: "+ result.item(0))
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function loadWakeup(model,showid) // klar
|
||||
{
|
||||
model.clear()
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
var rs = tx.executeSql('SELECT '+showid+' FROM favorites');
|
||||
//for(var i = 0; i < rs.rows.length; i++)
|
||||
//{ model.id, model.name, showImg.source, model.summary, model.status, model.premiered, model.rating, model.network
|
||||
model.append({"showid" : rs.rows.item(i).showid, "name" : rs.rows.item(i).name,"image" : rs.rows.item(i).image,"summary" : rs.rows.item(i).summary,"status" : rs.rows.item(i).status,"premiered" : rs.rows.item(i).premiered,"rating" : rs.rows.item(i).rating,"network" : rs.rows.item(i).network,"updated" : rs.rows.item(i).updated,"previous" : rs.rows.item(i).previous,"next" : rs.rows.item(i).next, "nextse" : rs.rows.item(i).nextse})
|
||||
//}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function load(model) // klar
|
||||
{
|
||||
model.clear()
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
var rs = tx.executeSql('SELECT * FROM favorites ORDER BY name ASC, next');
|
||||
for(var i = 0; i < rs.rows.length; i++)
|
||||
{
|
||||
model.append({"showid" : rs.rows.item(i).showid, "name" : rs.rows.item(i).name,"image" : rs.rows.item(i).image,"summary" : rs.rows.item(i).summary,"status" : rs.rows.item(i).status,"premiered" : rs.rows.item(i).premiered,"rating" : rs.rows.item(i).rating,"network" : rs.rows.item(i).network,"updated" : rs.rows.item(i).updated,"prev" : rs.rows.item(i).previous,"next" : rs.rows.item(i).next, "nextse" : rs.rows.item(i).nextse, "imdb" : rs.rows.item(i).imdb, "official" : rs.rows.item(i).official, "seen" : rs.rows.item(i).seen})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ADD FAVORITE
|
||||
function add(showid, name, image, summary, status, prem, rating, network, updated, previous, next, nextse, imdb, official) // klar
|
||||
{
|
||||
settings_db_open();
|
||||
try {
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql('INSERT INTO favorites VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);', [showid, name, image, summary, status, prem, rating, network, updated, previous, next, nextse, imdb, official])
|
||||
return true
|
||||
});
|
||||
}
|
||||
catch(a)
|
||||
{
|
||||
console.log("insert failed, probably already exists");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
|
||||
function update(showid, name, image, summary, status, prem, rating, network, updated, imdb, official) // klar
|
||||
{
|
||||
settings_db_open();
|
||||
try {
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql('UPDATE favorites SET name=?,image=?,summary=?,status=?,premiered=?,rating=?,network=?,updated=?,imdb=?,official=? WHERE showid='+showid+';',
|
||||
[name, image, summary, status, prem, rating, network, updated, imdb, official])
|
||||
return true;
|
||||
});
|
||||
}
|
||||
catch(a)
|
||||
{
|
||||
console.log("insert failed, probably already exists");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// SKA GÖRAS BÅDE VID ADD OCH UPPDATE
|
||||
function updateNext(showid, next, nextse) // klar
|
||||
{
|
||||
settings_db_open();
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql('UPDATE favorites SET next=?,nextse=? WHERE showid='+showid+';', [next, nextse])
|
||||
console.log("*** DB UPDATE NEXT: "+showid+" / "+next)
|
||||
});
|
||||
}
|
||||
|
||||
function updatePrev(showid, prev) // klar
|
||||
{
|
||||
settings_db_open();
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql('UPDATE favorites SET previous=? WHERE showid='+showid+';', [prev])
|
||||
console.log("*** DB UPDATE PREV: "+showid+" / "+prev)
|
||||
|
||||
});
|
||||
}
|
||||
// -------------------
|
||||
|
||||
function del(showid) // klar
|
||||
{
|
||||
settings_db_open();
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql('DELETE FROM favorites WHERE showid = ?', [showid])
|
||||
});
|
||||
}
|
||||
|
||||
function drop() // klar
|
||||
{
|
||||
settings_db_open();
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql("DROP TABLE IF EXISTS favorites");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/* JSONPath 0.8.5 - XPath for JSON
|
||||
*
|
||||
* Copyright (c) 2007 Stefan Goessner (goessner.net)
|
||||
* Licensed under the MIT (MIT-LICENSE.txt) licence.
|
||||
*
|
||||
*/
|
||||
function jsonPath(obj, expr, arg) {
|
||||
var P = {
|
||||
resultType: arg && arg.resultType || "VALUE",
|
||||
result: [],
|
||||
normalize: function(expr) {
|
||||
var subx = [];
|
||||
return expr.replace(/[\['](\??\(.*?\))[\]']|\['(.*?)'\]/g, function($0,$1,$2){return "[#"+(subx.push($1||$2)-1)+"]";}) /* http://code.google.com/p/jsonpath/issues/detail?id=4 */
|
||||
.replace(/'?\.'?|\['?/g, ";")
|
||||
.replace(/;;;|;;/g, ";..;")
|
||||
.replace(/;$|'?\]|'$/g, "")
|
||||
.replace(/#([0-9]+)/g, function($0,$1){return subx[$1];});
|
||||
},
|
||||
asPath: function(path) {
|
||||
var x = path.split(";"), p = "$";
|
||||
for (var i=1,n=x.length; i<n; i++)
|
||||
p += /^[0-9*]+$/.test(x[i]) ? ("["+x[i]+"]") : ("['"+x[i]+"']");
|
||||
return p;
|
||||
},
|
||||
store: function(p, v) {
|
||||
if (p) P.result[P.result.length] = P.resultType == "PATH" ? P.asPath(p) : v;
|
||||
return !!p;
|
||||
},
|
||||
trace: function(expr, val, path) {
|
||||
if (expr !== "") {
|
||||
var x = expr.split(";"), loc = x.shift();
|
||||
x = x.join(";");
|
||||
if (val && val.hasOwnProperty(loc))
|
||||
P.trace(x, val[loc], path + ";" + loc);
|
||||
else if (loc === "*")
|
||||
P.walk(loc, x, val, path, function(m,l,x,v,p) { P.trace(m+";"+x,v,p); });
|
||||
else if (loc === "..") {
|
||||
P.trace(x, val, path);
|
||||
P.walk(loc, x, val, path, function(m,l,x,v,p) { typeof v[m] === "object" && P.trace("..;"+x,v[m],p+";"+m); });
|
||||
}
|
||||
else if (/^\(.*?\)$/.test(loc)) // [(expr)]
|
||||
P.trace(P.eval(loc, val, path.substr(path.lastIndexOf(";")+1))+";"+x, val, path);
|
||||
else if (/^\?\(.*?\)$/.test(loc)) // [?(expr)]
|
||||
P.walk(loc, x, val, path, function(m,l,x,v,p) { if (P.eval(l.replace(/^\?\((.*?)\)$/,"$1"), v instanceof Array ? v[m] : v, m)) P.trace(m+";"+x,v,p); }); // issue 5 resolved
|
||||
else if (/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(loc)) // [start:end:step] phyton slice syntax
|
||||
P.slice(loc, x, val, path);
|
||||
else if (/,/.test(loc)) { // [name1,name2,...]
|
||||
for (var s=loc.split(/'?,'?/),i=0,n=s.length; i<n; i++)
|
||||
P.trace(s[i]+";"+x, val, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
P.store(path, val);
|
||||
},
|
||||
walk: function(loc, expr, val, path, f) {
|
||||
if (val instanceof Array) {
|
||||
for (var i=0,n=val.length; i<n; i++)
|
||||
if (i in val)
|
||||
f(i,loc,expr,val,path);
|
||||
}
|
||||
else if (typeof val === "object") {
|
||||
for (var m in val)
|
||||
if (val.hasOwnProperty(m))
|
||||
f(m,loc,expr,val,path);
|
||||
}
|
||||
},
|
||||
slice: function(loc, expr, val, path) {
|
||||
if (val instanceof Array) {
|
||||
var len=val.length, start=0, end=len, step=1;
|
||||
loc.replace(/^(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)$/g, function($0,$1,$2,$3){start=parseInt($1||start);end=parseInt($2||end);step=parseInt($3||step);});
|
||||
start = (start < 0) ? Math.max(0,start+len) : Math.min(len,start);
|
||||
end = (end < 0) ? Math.max(0,end+len) : Math.min(len,end);
|
||||
for (var i=start; i<end; i+=step)
|
||||
P.trace(i+";"+expr, val, path);
|
||||
}
|
||||
},
|
||||
eval: function(x, _v, _vname) {
|
||||
try { return $ && _v && eval(x.replace(/(^|[^\\])@/g, "$1_v").replace(/\\@/g, "@")); } // issue 7 : resolved ..
|
||||
catch(e) { throw new SyntaxError("jsonPath: " + e.message + ": " + x.replace(/(^|[^\\])@/g, "$1_v").replace(/\\@/g, "@")); } // issue 7 : resolved ..
|
||||
}
|
||||
};
|
||||
|
||||
var $ = obj;
|
||||
if (expr && obj && (P.resultType == "VALUE" || P.resultType == "PATH")) {
|
||||
P.trace(P.normalize(expr).replace(/^\$;?/,""), obj, "$"); // issue 6 resolved
|
||||
return P.result.length ? P.result : false;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
Page {
|
||||
Flickable {
|
||||
id: flick
|
||||
width:parent.width
|
||||
height: parent.height - Theme.paddingLarge * 3
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Theme.paddingLarge * 3
|
||||
contentHeight: column1.height
|
||||
|
||||
|
||||
|
||||
Column {
|
||||
id: column1
|
||||
width: parent.width
|
||||
spacing: Theme.paddingLarge
|
||||
Row {
|
||||
//width: parent.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Theme.paddingLarge * 2
|
||||
Image{
|
||||
source: "../harbour-labyrinth.png"
|
||||
height: Theme.itemSizeExtraLarge
|
||||
width: height
|
||||
fillMode: Image.PreserveAspectFit
|
||||
//anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
Column{
|
||||
id: column2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
//width: parent.width
|
||||
//spacing: Theme.paddingLarge
|
||||
|
||||
Label {
|
||||
font.pixelSize: Theme.fontSizeExtraLarge
|
||||
font.bold: true
|
||||
text: "Labyrinth v"+ Qt.application.version
|
||||
//anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "(License: WTFPL)"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Separator {
|
||||
width: parent.width
|
||||
anchors.margins: Theme.paddingSmall
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
//height: Theme.itemSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
width: parent.width-(Theme.paddingLarge * 2)
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
text:"<p>DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE</p>
|
||||
<p>Version 2, December 2004</p>
|
||||
<p>Copyright (C) 2004 Sam Hocevar <sam@hocevar.net></p>
|
||||
<p>Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.</p>
|
||||
<p>DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</p>
|
||||
<p>0. You just DO WHAT THE FUCK YOU WANT TO.</p>"
|
||||
color: Theme.primaryColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Separator {
|
||||
width: parent.width
|
||||
anchors.margins: Theme.paddingSmall
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
//height: Theme.itemSizeSmall
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
import "../delegates"
|
||||
|
||||
Page {
|
||||
id: page
|
||||
property string showname: ""
|
||||
property string showimage: ""
|
||||
property string summary: ""
|
||||
property string showid: ""
|
||||
property string actorname: ""
|
||||
property string filter: ""
|
||||
//property string country: "DK"
|
||||
//property string _country: country ? "?country="+country : ""
|
||||
//property string jsonSource: "http://api.tvmaze.com/schedule"+_country
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
JSONListModel {
|
||||
id: jsonModel1
|
||||
source: "http://api.tvmaze.com/people/"+showid+"/castcredits?embed=show" //"http://api.tvmaze.com/schedule?country=US&date="+Qt.formatDateTime(new Date(), "yyyy-MM-dd") //2016-07-16" //+filter
|
||||
query: "$[*]._embedded.show."
|
||||
}
|
||||
|
||||
model: jsonModel1.model
|
||||
|
||||
BusyIndicator {
|
||||
id: busyIndicator
|
||||
running: !jsonModel1.jsonready
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
header: PageHeader {
|
||||
id: pHeader
|
||||
title: actorname
|
||||
description: "Known for"
|
||||
}
|
||||
|
||||
delegate: ShowDelegate {}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.count == 0 && jsonModel1.jsonready
|
||||
text: "No TVmaze data"
|
||||
hintText: "no information about cast"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
|
||||
Page {
|
||||
id: page
|
||||
property string showname: ""
|
||||
property string showimage: ""
|
||||
property string summary: ""
|
||||
property string showid: ""
|
||||
property string jsonSource: "http://api.tvmaze.com/schedule"+_country //"date="+Qt.formatDateTime(new Date(), "yyyy-MM-dd")
|
||||
|
||||
//property string filter: ""
|
||||
property string country: ""
|
||||
//property string date: ""
|
||||
property string _country: country ? "?country="+country : ""
|
||||
//property string _date: date ? ""
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
JSONListModel {
|
||||
id: jsonModel1
|
||||
source: "http://api.tvmaze.com/shows/"+showid+"/cast" //"http://api.tvmaze.com/schedule?country=US&date="+Qt.formatDateTime(new Date(), "yyyy-MM-dd") //2016-07-16" //+filter
|
||||
query: "$[*]"
|
||||
}
|
||||
|
||||
model: jsonModel1.model
|
||||
|
||||
BusyIndicator {
|
||||
id: busyIndicator
|
||||
running: !jsonModel1.jsonready
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
header: PageHeader {
|
||||
id: pHeader
|
||||
title: showname
|
||||
description: "Main cast"
|
||||
}
|
||||
|
||||
delegate: BackgroundItem {
|
||||
id: myListItem
|
||||
width: ListView.view.width
|
||||
height: (showImg.height + showRect.height ) * showImg.scale
|
||||
|
||||
OpacityRampEffect {
|
||||
sourceItem: showRect
|
||||
direction: OpacityRamp.TopToBottom
|
||||
offset: 0.0
|
||||
slope: 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: showRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
width: parent.width
|
||||
height: firstName.height + Theme.paddingLarge
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextIcon
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
anchors.right: showRect.right
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-right"
|
||||
}
|
||||
|
||||
Image {
|
||||
id: seenIcon
|
||||
visible: false
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-acknowledge"
|
||||
}
|
||||
|
||||
Image {
|
||||
id: showImg
|
||||
property int errorCount: 0
|
||||
anchors.top: showRect.bottom
|
||||
anchors.margins: Theme.paddingLarge
|
||||
// anchors.topMargin: Theme.paddingLarge
|
||||
// anchors.leftMargin: Theme.paddingLarge
|
||||
anchors.left: parent.left
|
||||
// width: parent.width * 0.4
|
||||
// height: parent.height
|
||||
scale: 1.2
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: model.person.image ? model.person.image.medium ? model.person.image.medium : "../No-Image-.png" : "../No-Image-.png"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: firstName
|
||||
text: model.person.name !== null ? model.person.name : ""
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
wrapMode: Text.ElideRight
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showType
|
||||
text: model.character.name !== null ? "<u>Character</u><br><b>" + model.character.name + "</b>" : ""
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingLarge * showImg.scale
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
pageStack.push(Qt.resolvedUrl("ShowImg.qml"),{"img": model.person.image ? model.person.image.medium ? model.person.image.medium : "../No-Image-.png" : "../No-Image-.png"})
|
||||
|
||||
//window.pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": model.id,"showname": showname,"showimage": showImg.source} )
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
// frompage = pageStack.currentPage
|
||||
pageStack.push(Qt.resolvedUrl("CastInfoPage.qml"),
|
||||
{"showid": model.person.id,"actorname": model.person.name,"showname": showname, "showimage": showImg.source, "summary": model.summary})
|
||||
}
|
||||
}
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Show seasons")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage},PageStackAction.Immediate )
|
||||
}
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.count == 0 && jsonModel1.jsonready
|
||||
text: "No TVmaze data"
|
||||
hintText: "no information about cast"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,554 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
import Nemo.Notifications 1.0
|
||||
|
||||
Page {
|
||||
id: page
|
||||
//property int ny: 0
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
model: favorites
|
||||
|
||||
header: PageHeader {
|
||||
id: pHeader
|
||||
title: "Favorites"
|
||||
}
|
||||
|
||||
delegate: ListItem {
|
||||
id: showDelegate
|
||||
width: ListView.view.width
|
||||
|
||||
property string f_name: name ? name : ""
|
||||
property string f_summary: summary ? summary : ""
|
||||
property string f_stat: status ? status : ""
|
||||
property string f_premiered: premiered ? premiered : ""
|
||||
property string f_rating: rating ? rating : ""
|
||||
property int f_updated: updated ? updated : ""
|
||||
property string f_imdb: imdb ? imdb : ""
|
||||
property string f_official: official ? official : ""
|
||||
property string f_network: network ? network : ""
|
||||
property string f_image: image ? image : "../No-Image-.png"
|
||||
|
||||
property string f_next: next ? next : ""
|
||||
property string f_nextse: nextse ? nextse : ""
|
||||
property string f_prev: prev ? prev : ""
|
||||
|
||||
property bool f_upd: false
|
||||
property bool running: false
|
||||
property bool ended: false
|
||||
|
||||
property bool max: false
|
||||
|
||||
|
||||
|
||||
contentHeight: showImg.height + showName.height + (Theme.paddingLarge * 4)
|
||||
|
||||
Notification {
|
||||
id: notification
|
||||
category: "Update"
|
||||
//summary: "Updated tv show"
|
||||
//itemCount: favorites.count
|
||||
|
||||
|
||||
//itemCount: favorites.count
|
||||
//expireTimeout: 0
|
||||
//itemCount: favorites.count
|
||||
}
|
||||
|
||||
JSONSimple {
|
||||
id: updateFavorite
|
||||
|
||||
source: "http://api.tvmaze.com/shows/"+showid
|
||||
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
if (updated !== simple.updated ) {
|
||||
var ne
|
||||
var nese
|
||||
var pr
|
||||
|
||||
f_upd = true
|
||||
f_name = simple.name
|
||||
f_summary = simple.summary
|
||||
f_stat = simple.status
|
||||
simple.premiered ? f_premiered = simple.premiered : f_premiered = ""
|
||||
f_rating = simple.rating.average
|
||||
f_updated = simple.updated
|
||||
//officialSite ? sofficial = officialSite : ""
|
||||
simple.externals.imdb ? f_imdb = simple.externals.imdb : f_imdb = ""
|
||||
simple.officialSite ? f_official = simple.officialSite : f_official = ""
|
||||
simple.webChannel ? f_network = simple.webChannel.name : f_network = simple.network.name
|
||||
f_image = simple.image.medium
|
||||
simple._links.previousepisode ? pr = simple._links.previousepisode.href : pr = ""
|
||||
simple._links.nextepisode ? ne = simple._links.nextepisode.href : ne = ""
|
||||
|
||||
// console.log(simple.officialSite)
|
||||
|
||||
if (pr !== "") {
|
||||
prevshow.showNlink = ne
|
||||
prevshow.showPlink = pr
|
||||
prevshow.source = pr
|
||||
} else {
|
||||
if (next !== ""){
|
||||
nextshow.source = ne
|
||||
} else {
|
||||
doneUdating = true
|
||||
}
|
||||
}
|
||||
|
||||
updateFav(showid, f_name, f_image, f_summary, f_stat, f_premiered, f_rating, f_network, f_updated, f_imdb, f_official)
|
||||
|
||||
}
|
||||
//console.log("IMDB: "+f_imdb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONSimple {
|
||||
id: nextshow
|
||||
//property string showid: ""
|
||||
property string showNlink: ""
|
||||
property string ne: ""
|
||||
property string nese: ""
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
console.log(" ---- UPDATING NEXTSHOW")
|
||||
simple.airdate ? ne = simple.airdate : ne = "?"
|
||||
ne !== "?" ? nese = "S"+simple.season+"E"+simple.number : nese = ""
|
||||
f_next = ne
|
||||
f_nextse = nese
|
||||
console.log(f_name+" has been updated. ")
|
||||
updateNext(showid, ne, nese)
|
||||
notification.summary = f_name
|
||||
notification.subText = "Labyrinth"
|
||||
notification.body = "Next episode: "+f_next
|
||||
//notification.text = "Next episode: "+f_next
|
||||
notification.publish()
|
||||
//doneUdating = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONSimple {
|
||||
id: prevshow
|
||||
//property string showid: ""
|
||||
property string showPlink: ""
|
||||
property string showNlink: ""
|
||||
property string pr: ""
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
console.log(" ---- UPDATING PREVSHOW")
|
||||
simple.airdate ? pr = simple.airdate : pr = "?"
|
||||
f_prev = pr
|
||||
updatePrev(showid, pr)
|
||||
if (showNlink !== "") {
|
||||
//nextshow.showid = showid
|
||||
//nextShow.showNlink = showNlink
|
||||
nextshow.source = showNlink
|
||||
} else {
|
||||
f_next = "?"
|
||||
f_nextse = ""
|
||||
updateNext(showid, "?", "")
|
||||
//doneUdating = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showRemorseItem() {
|
||||
var idx = index
|
||||
remorseAction("Removing "+name+" from favorites!", function() {delFav(showid);listView.model.remove(idx)})
|
||||
}
|
||||
|
||||
OpacityRampEffect {
|
||||
sourceItem: showRect
|
||||
direction: OpacityRamp.TopToBottom
|
||||
offset: 0.0
|
||||
slope: 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: showRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
width: parent.width
|
||||
height: showName.height + Theme.paddingLarge
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextIcon
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
anchors.right: showRect.right
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-right"
|
||||
}
|
||||
|
||||
Image {
|
||||
id: seenIcon
|
||||
visible: false
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-acknowledge"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showName
|
||||
//text: ""
|
||||
text: f_name
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
anchors.right: nextIcon.left
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
wrapMode: Text.ElideRight
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
maximumLineCount: 1
|
||||
}
|
||||
|
||||
Image {
|
||||
id: showImg
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: f_image
|
||||
anchors.top: showRect.bottom
|
||||
anchors.margins: Theme.paddingLarge
|
||||
anchors.left: parent.left
|
||||
width: height * 0.8
|
||||
height: (showName.height + showS.height + showP.height + showR.height + showN.height + showPr.height + Theme.paddingLarge) * showImg.scale
|
||||
scale: 1.1
|
||||
BusyIndicator {
|
||||
id: imgBysy
|
||||
running: showImg.progress !== 1.0
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: favIcon
|
||||
anchors.right: parent.right
|
||||
anchors.top: showImg.top
|
||||
anchors.topMargin: Theme.paddingSmall
|
||||
height: showStatus.height + (showStatus.height/2)
|
||||
width: height
|
||||
//anchors.top: showImg.top
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: getFav(showid) ? "image://theme/icon-m-favorite-selected" : "image://theme/icon-m-favorite"
|
||||
MouseArea {
|
||||
anchors.fill: favIcon
|
||||
onClicked: showRemorseItem()//remorse.executeqsTr("Removing "+name+" from favorites!"), function() {delFav(model.showid)}, 5000)
|
||||
}
|
||||
}
|
||||
|
||||
//icon-m-refresh
|
||||
|
||||
Image {
|
||||
id: updIcon
|
||||
anchors.right: favIcon.left
|
||||
anchors.top: showImg.top
|
||||
anchors.topMargin: Theme.paddingSmall
|
||||
height: showStatus.height + (showStatus.height/2)
|
||||
width: height
|
||||
//anchors.top: showImg.top
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
mirror: true
|
||||
source: f_upd ? "image://theme/icon-m-notifications" : ""
|
||||
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showS
|
||||
text: "Status:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.bottom: showP.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showStatus
|
||||
text: f_stat
|
||||
color: {//highlighted ? Theme.highlightColor : running && f_next !== "?" ? Theme.primaryColor : ended ? Theme.errorColor : Theme.secondaryColor
|
||||
if (highlighted) Theme.highlightColor;
|
||||
else if (f_stat === "Ended") Theme.errorColor;
|
||||
else if (f_stat === "Running" && f_next !== "?") Theme.highlightColor
|
||||
else if (f_stat === "Running" && f_next === "?") Theme.primaryColor
|
||||
else Theme.secondaryColor
|
||||
}
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.bottom: showP.top
|
||||
anchors.left: showS.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showP
|
||||
text: "Premiered:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showR.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showPrem
|
||||
text: f_premiered
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showR.top
|
||||
anchors.left: showP.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showR
|
||||
text: "Average rating:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showN.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showRating
|
||||
text: f_rating
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showN.top
|
||||
anchors.left: showR.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showN
|
||||
text: "Network:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showPr.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNetwork
|
||||
text: f_network
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showPr.top
|
||||
anchors.left: showN.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showPr
|
||||
text: "Previous:"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showNe.top
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showPrev
|
||||
text: f_prev
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showNe.top
|
||||
anchors.left: showPr.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: f_prev !== "Unknown" ? true : false
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNe
|
||||
text: f_nextse ? "Next: ("+f_nextse+")" : "Next: "
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.bottomMargin: Theme.paddingSmall
|
||||
anchors.left: showImg.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNext
|
||||
text: f_next
|
||||
color: highlighted ? Theme.highlightColor : f_stat === "Running" && f_next !== "?" ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.bottomMargin: Theme.paddingSmall
|
||||
anchors.left: showNe.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingSmall
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.bold: text !== "Unknown" ? true : false
|
||||
}
|
||||
|
||||
onPressAndHold: pageStack.push(Qt.resolvedUrl("ShowImg.qml"),{"img": f_image})
|
||||
|
||||
|
||||
onClicked: {
|
||||
//frompage === undefined ?
|
||||
if (f_upd) f_upd = false
|
||||
pageStack.push(Qt.resolvedUrl("../pages/InfoPage.qml"),
|
||||
{"showid": showid,"showname": name, "showimage": showImg.source, "summary": summary, "showstatus": status, "showprem": showPrem.text, "showrating": showRating.text,
|
||||
"shownetwork": showNetwork.text, "showupdated": model.updated, "showprev": showPrev.text, "shownext": showNext.text, "shownextse": nextse, "simdb": f_imdb, "sofficial": f_official})
|
||||
}
|
||||
}
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("About Labyrinth")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("About.qml"))
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Popular shows by rating")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": false},PageStackAction.Immediate)
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Popular shows by clicks")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": true},PageStackAction.Immediate)
|
||||
}
|
||||
/* MenuItem {
|
||||
text: qsTr("Refresh Favorites")
|
||||
onClicked: {//pageStack.replace(Qt.resolvedUrl("SearchPage.qml"),{},PageStackAction.Immediate)
|
||||
favorites.clear()
|
||||
pageStack.replace(Qt.resolvedUrl("Favorites.qml"),{},PageStackAction.Immediate)
|
||||
}
|
||||
} */
|
||||
MenuItem {
|
||||
text: qsTr("Search TV show")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("SearchPage.qml"),{},PageStackAction.Immediate)
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Notify")
|
||||
onClicked: notification.publish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Notification {
|
||||
id: notifi
|
||||
category: "x-nemo.example"
|
||||
appName: "Example App"
|
||||
appIcon: "/usr/share/example-app/icon-l-application"
|
||||
summary: "Notification summary"
|
||||
body: "Notification body"
|
||||
previewSummary: "Notification preview summary"
|
||||
previewBody: "Notification preview body"
|
||||
itemCount: 5
|
||||
timestamp: "2013-02-20 18:21:00"
|
||||
remoteActions: [ {
|
||||
"name": "default",
|
||||
"displayName": "Do something",
|
||||
"icon": "icon-s-do-it",
|
||||
"service": "org.nemomobile.example",
|
||||
"path": "/example",
|
||||
"iface": "org.nemomobile.example",
|
||||
"method": "doSomething",
|
||||
"arguments": [ "argument", 1 ]
|
||||
},{
|
||||
"name": "ignore",
|
||||
"displayName": "Ignore the problem",
|
||||
"icon": "icon-s-ignore",
|
||||
"input" : {
|
||||
"label": "Please select",
|
||||
"editable": true,
|
||||
"choices": [ "Yes", "No", "Maybe" ]
|
||||
},
|
||||
"service": "org.nemomobile.example",
|
||||
"path": "/example",
|
||||
"iface": "org.nemomobile.example",
|
||||
"method": "ignore",
|
||||
"arguments": [ "argument", 1 ]
|
||||
} ]
|
||||
onClicked: console.log("Clicked")
|
||||
onClosed: console.log("Closed, reason: " + reason)
|
||||
}
|
||||
|
||||
|
||||
/* ViewPlaceholder {
|
||||
enabled: !updateModel.ready || favorites.count === 0//listView.count === 0 //|| jsonModel1.jsonready
|
||||
text: dbcount > 0 ? "Checking TVMAZE for updated TV-shows" : listView.count === 0 ? "Favorites empty" : ""
|
||||
hintText: updateModel.ready === 0 ? "add shows from TVMAZE" : ""
|
||||
|
||||
Image {
|
||||
id: logo
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
//anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width * 0.4
|
||||
height: width
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
opacity: 0.2
|
||||
source: "../harbour-labyrinth.png"
|
||||
}
|
||||
BusyIndicator {
|
||||
id: checking
|
||||
running: !updateModel.ready
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.bottom
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
//anchors.centerIn: logo
|
||||
//anchors.horizontalCenter: parent.horizontalCenter
|
||||
//anchors.top: logo.bottom
|
||||
//anchors.topMargin: Theme.paddingLarge
|
||||
//anchors.verticalCenter: parent.verticalCenter
|
||||
} */
|
||||
|
||||
/* Button {
|
||||
text: "Search TVMaze"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("SearchPage.qml"),{},PageStackAction.Immediate)
|
||||
} */
|
||||
|
||||
// }
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,380 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Page {
|
||||
id:infoPage
|
||||
property string showname
|
||||
property string showimage: ""
|
||||
property string summary: ""
|
||||
property string showid: ""
|
||||
property string showstatus: ""
|
||||
property string showprem: ""
|
||||
property string showrating: ""
|
||||
property string shownetwork: ""
|
||||
property string showupdated: ""
|
||||
property string showprev: ""
|
||||
property string shownext: ""
|
||||
property string shownextse: ""
|
||||
property string simdb: ""
|
||||
property string sofficial: ""
|
||||
property bool favorite: getFav(showid)
|
||||
|
||||
SilicaFlickable {
|
||||
id: flick
|
||||
anchors.top: parent.top
|
||||
clip: true
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width// - (Theme.paddingLarge * 2)
|
||||
height: (showImg.height * showImg.scale) + sumheader.height + Theme.paddingLarge
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
contentHeight: showSummary.height + showImg.height + sumheader.height + seasonA.height + seasonB.height + (Theme.paddingLarge * 5)
|
||||
PageHeader {id: sumheader; title: showname; }
|
||||
|
||||
|
||||
RemorsePopup {id: remorse}
|
||||
|
||||
Image {
|
||||
id: favIcon
|
||||
anchors.right: parent.right
|
||||
anchors.top: showImg.top
|
||||
anchors.topMargin: Theme.paddingSmall
|
||||
//anchors.verticalCenter: showStatus.verticalCenter
|
||||
height: showStatus.height + (showStatus.height/2)
|
||||
width: height
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: favorite ? "image://theme/icon-m-favorite-selected" : "image://theme/icon-m-favorite"
|
||||
MouseArea {
|
||||
anchors.fill: favIcon
|
||||
onClicked: if (getFav(showid)) {favorite = false; delFav(showid)} else {favorite = true; addFav(showid, showname, showimage, summary, showstatus, showprem, showrating, shownetwork)}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showStatus
|
||||
text: "Status: <b>" + showstatus + "</b>"
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.bottom: showPrem.top
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
/* Image {
|
||||
id: showImg
|
||||
|
||||
anchors.top: sumheader.bottom
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: showimage
|
||||
//width: height * 0.8
|
||||
//height: parent.height
|
||||
|
||||
} */
|
||||
Image {
|
||||
id: showImg
|
||||
property bool zoomed: false
|
||||
/* anchors.top: sumheader.bottom
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
anchors.left: parent.left */
|
||||
|
||||
anchors.top: sumheader.bottom
|
||||
anchors.margins: Theme.paddingLarge
|
||||
anchors.left: parent.left
|
||||
scale: 1.1
|
||||
|
||||
// x: 0
|
||||
// y: 0
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: showimage ? showimage : "../No-Image-.png"
|
||||
|
||||
// width: 210
|
||||
width: height * 0.8
|
||||
// height: showName.height + showS.height + showP.height + showR.height + showN.height + showPr.height + Theme.paddingMedium
|
||||
// height: (showName.height + showS.height + showP.height + showR.height + showN.height + showPr.height + Theme.paddingLarge) * showImg.scale
|
||||
height: (showPrem.height + showRating.height + showNetwork.height + showPrev.height + showNext.height + showStatus.height + Theme.itemSizeSmall) * showImg.scale
|
||||
// scale: 1.1
|
||||
// height: showName.height + showStatus.height + showPrem.height + showRating.height + showNext.height + showPrev.height
|
||||
BusyIndicator {
|
||||
id: imgBysy
|
||||
running: showImg.progress !== 1.0
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: showImg
|
||||
onClicked: {
|
||||
//if (showImg.width !== Screen.width) {showImg.width = Screen.width; showImg.height = Screen.height;} else {showImg.height = showPrem.height + showRating.height + showNetwork.height + showPrev.height + showNext.height + showStatus.height}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showPrem
|
||||
text: showprem ? "Premiered: <b>" + showprem + "</b>" : "Premiered: ?"
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showRating.top
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showRating
|
||||
text: "Average rating: <b>" + showrating + "</b>"
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottom: showNetwork.top
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNetwork
|
||||
text: "Network: <b>" + shownetwork + "</b>"
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showPrev.top
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showPrev
|
||||
text: showprev !== "" ? "Previous: <b>" + showprev+"</b>" : ""
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showNext.top
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showNext
|
||||
text: shownext !== "" || shownext !== "Unknown" ? "Next: ("+shownextse + ") <b>" + shownext + "</b>" : "" //nextse !=="" ? "Next: ("+nextse+")" : "Next: " + next
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.bottomMargin: Theme.paddingMedium
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
BackgroundItem {
|
||||
id: seasonA
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: showImg.bottom
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
|
||||
OpacityRampEffect {
|
||||
sourceItem: actorRect
|
||||
direction: OpacityRamp.TopToBottom
|
||||
offset: 0.0
|
||||
slope: 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: actorRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
width: parent.width
|
||||
height: actorName.height + Theme.paddingLarge
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextIconActor
|
||||
anchors.verticalCenter: actorRect.verticalCenter
|
||||
anchors.right: actorRect.right
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-right" + "?" + (seasonA.highlighted ? Theme.highlightColor : Theme.primaryColor)
|
||||
|
||||
}
|
||||
|
||||
Text {
|
||||
id: actorName
|
||||
text: "Show main cast"
|
||||
color: seasonA.highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
anchors.right: nextIconActor.left
|
||||
anchors.verticalCenter: actorRect.verticalCenter
|
||||
wrapMode: Text.ElideRight
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
maximumLineCount: 1
|
||||
}
|
||||
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("CastPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
|
||||
}
|
||||
|
||||
/* IconButton {
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.paddingLarge
|
||||
//width: 200
|
||||
//height: 50
|
||||
icon.source: "../imdb.png"
|
||||
onClicked: console.log("Delete!")
|
||||
} */
|
||||
|
||||
BackgroundItem {
|
||||
id: seasonB
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: seasonA.bottom
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
|
||||
OpacityRampEffect {
|
||||
sourceItem: seasonRect
|
||||
direction: OpacityRamp.TopToBottom
|
||||
offset: 0.0
|
||||
slope: 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: seasonRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
width: parent.width
|
||||
height: seasonName.height + Theme.paddingLarge
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextIconSeason
|
||||
anchors.verticalCenter: seasonRect.verticalCenter
|
||||
anchors.right: seasonRect.right
|
||||
anchors.rightMargin: Theme.paddingMediumIMDB
|
||||
source: "image://theme/icon-m-right" + "?" + (seasonB.highlighted ? Theme.highlightColor : Theme.primaryColor)
|
||||
}
|
||||
|
||||
Text {
|
||||
id: seasonName
|
||||
text: "Show seasons"
|
||||
color: seasonB.highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
anchors.right: nextIconSeason.left
|
||||
anchors.verticalCenter: seasonRect.verticalCenter
|
||||
wrapMode: Text.ElideRight
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
maximumLineCount: 1
|
||||
// font.bold: true
|
||||
}
|
||||
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
|
||||
}
|
||||
|
||||
/* Text {
|
||||
id: showSummaryH
|
||||
anchors.top: seasonB.bottom
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
text: "Summary"
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
//font.underline: true
|
||||
//font.bold: true
|
||||
} */
|
||||
|
||||
Text {
|
||||
id: showSummary
|
||||
anchors.top: seasonB.bottom
|
||||
//anchors.topMargin: Theme.paddingSmall
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
anchors.rightMargin: Theme.paddingLarge
|
||||
text: summary
|
||||
textFormat: Text.StyledText
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
}
|
||||
|
||||
|
||||
function fitToScreen() {
|
||||
showImg.scale = Math.min(flick.width / showImg.width, flick.height / showImg.height, 1)
|
||||
//pinchArea.minScale = scale
|
||||
prevScale = scale
|
||||
}
|
||||
|
||||
/* Image {
|
||||
id: showImg
|
||||
|
||||
anchors.top: sumheader.bottom
|
||||
anchors.topMargin: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: showimage
|
||||
//width: height * 0.8
|
||||
//height: parent.height
|
||||
|
||||
property real prevScale
|
||||
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
scale = Math.min(flick.width / width, flick.height / height, 1)
|
||||
//pinchArea.minScale = scale
|
||||
//prevScale = scale
|
||||
|
||||
}
|
||||
|
||||
//transform: Scale { origin.x: 25; origin.y: 25; xScale: 3}
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
PullDownMenu {
|
||||
|
||||
MenuItem {
|
||||
visible: simdb !== "" ? true : false
|
||||
text: qsTr("Open IMDB page")
|
||||
onClicked: { //remorse.execute(qsTr("Opening webpage"), function() {Qt.openUrlExternally("http://m.imdb.com/title/"+simdb)}, 2000)//Qt.openUrlExternally("http://m.imdb.com/title/"+imdb)//pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
|
||||
//WebViewer {webPageAddress: defaultDevice }
|
||||
console.log("IMDB: "+simdb)
|
||||
pageStack.push(Qt.resolvedUrl("WebViewer.qml"),{"webPageAddress": "http://m.imdb.com/title/"+simdb} )
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
visible: sofficial !== "" ? true : false
|
||||
text: qsTr("Official site")
|
||||
onClicked: { //remorse.execute(qsTr("Opening webpage"), function() {Qt.openUrlExternally("http://m.imdb.com/title/"+simdb)}, 2000)//Qt.openUrlExternally("http://m.imdb.com/title/"+imdb)//pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
|
||||
//WebViewer {webPageAddress: defaultDevice }
|
||||
console.log("Official: "+sofficial)
|
||||
pageStack.push(Qt.resolvedUrl("WebViewer.qml"),{"webPageAddress": sofficial} )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
import "../delegates"
|
||||
|
||||
Page {
|
||||
id: page
|
||||
//property string filter: ""
|
||||
//property string country: ""
|
||||
//property string _country: country ? "?country="+country : ""
|
||||
//property string jsonSource: "http://api.tvmaze.com/schedule"+_country //"date="+Qt.formatDateTime(new Date(), "yyyy-MM-dd")
|
||||
property string jsonSource: "http://api.tvmaze.com/shows"
|
||||
property bool showweight: false
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
JSONListModel {
|
||||
id: jsonModel1
|
||||
sortby: showweight ? "weight" : "rating.average"
|
||||
source: jsonSource //"http://api.tvmaze.com/schedule?country=SE&date="+Qt.formatDateTime(new Date(), "yyyy-MM-dd") //2016-07-16" //+filter
|
||||
query: showweight ? "$[?(@.weight>7)]" : "$[?(@.rating.average>7.9)]"
|
||||
}
|
||||
|
||||
model: jsonModel1.model
|
||||
|
||||
BusyIndicator {
|
||||
id: busyIndicator
|
||||
running: !jsonModel1.jsonready
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
header: PageHeader {
|
||||
id: pHeader
|
||||
title: showweight ? "Popular shows by clicks" : "Popular shows by rating"
|
||||
}
|
||||
|
||||
delegate: ShowDelegate {}
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
visible: showweight
|
||||
text: qsTr("Popular shows by rating")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": false},PageStackAction.Immediate)
|
||||
}
|
||||
MenuItem {
|
||||
visible: !showweight
|
||||
text: qsTr("Popular shows by clicks")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": true},PageStackAction.Immediate)
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Favourites")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("Favorites.qml"),{},PageStackAction.Immediate)
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Search shows")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("SearchPage.qml"),{},PageStackAction.Immediate)
|
||||
}
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
visible: listView.count === 0 && jsonModel1.jsonready
|
||||
text: "Unable to load TVmaze data!"
|
||||
hintText: "Check your connection"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
import "../delegates"
|
||||
|
||||
Page {
|
||||
id: page
|
||||
property string filter: ""
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
JSONListModel {
|
||||
id: jsonModel1
|
||||
source: filter !=="" ? "http://api.tvmaze.com/search/shows?q="+filter : ""
|
||||
query: "$[*].show"
|
||||
}
|
||||
|
||||
model: jsonModel1.model
|
||||
|
||||
BusyIndicator {
|
||||
id: busyIndicator
|
||||
running: !jsonModel1.jsonready
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
header: PageHeader {
|
||||
id: pHeader
|
||||
|
||||
SearchField {
|
||||
id: searchField
|
||||
width: parent.width
|
||||
placeholderText: "Search"
|
||||
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
|
||||
EnterKey.iconSource: "image://theme/icon-m-enter-close"
|
||||
EnterKey.onClicked: {filter = text;focus = false}
|
||||
focus: true
|
||||
onTextChanged: if (text.length > 1) filter = text; else {filter = "";focus=true;}
|
||||
// onTextChanged: if (text.length > 1) jsonModel1.source = "http://www.radio-browser.info/webservice/json/stations/"+searchby+"/"+text; else {jsonModel1.source = "";focus=true;jsonModel1.model.clear()}
|
||||
onClicked: {listView.currentIndex = -1}
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ShowDelegate {}
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Popular shows by rating")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": false},PageStackAction.Immediate)
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Popular shows by clicks")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": true},PageStackAction.Immediate)
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Favorites")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("Favorites.qml"),{},PageStackAction.Immediate)
|
||||
}
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.count === 0 //|| jsonModel1.jsonready
|
||||
text: "Search a TV Show"
|
||||
hintText: "on TVMaze"
|
||||
|
||||
Image {
|
||||
id: logo
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
opacity: 0.2
|
||||
source: "../harbour-labyrinth.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
|
||||
Page {
|
||||
id: page
|
||||
property string filter: ""
|
||||
property string showid: ""
|
||||
property string showname: ""
|
||||
property string showimage: ""
|
||||
property string number: ""
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
|
||||
clip: true
|
||||
|
||||
JSONListModel {
|
||||
id: jsonModel1
|
||||
source: "http://api.tvmaze.com/shows/"+showid+"/episodes"
|
||||
query: "$[?(@.season==="+number+")]"
|
||||
}
|
||||
|
||||
model: jsonModel1.model
|
||||
|
||||
BusyIndicator {
|
||||
id: busyIndicator
|
||||
running: !jsonModel1.jsonready
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
header: PageHeader {
|
||||
id: pHeader
|
||||
title: showname
|
||||
description: "Season: "+number
|
||||
}
|
||||
|
||||
delegate: BackgroundItem {
|
||||
id: myListItem
|
||||
|
||||
enabled: model.summary !== ""
|
||||
width: ListView.view.width
|
||||
height: showImg.height + showRect.height + showAirdate.height + showSummary.height + showSummaryIcon.height + Theme.paddingLarge//showImg.height > 20 ? showImg.height + showSummary.height + showAirdate.heigth + showRect.height + showSummaryIcon.height + (Theme.paddingLarge * 3) : firstName.height + showAirdate.height + showAirdate.heigth + showRuntime.height + showSummary.height + showRect.height + (Theme.paddingLarge * 3)
|
||||
|
||||
OpacityRampEffect {
|
||||
sourceItem: showRect
|
||||
direction: OpacityRamp.TopToBottom
|
||||
offset: 0.0
|
||||
slope: 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: showRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
width: parent.width
|
||||
height: firstName.height + Theme.paddingLarge
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: seenIcon
|
||||
visible: false
|
||||
anchors.right: parent.right
|
||||
anchors.top: showImg.top
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-acknowledge"
|
||||
}
|
||||
|
||||
Image {
|
||||
id: showImg
|
||||
property int errorCount: 0
|
||||
anchors.top: showAirdate.bottom
|
||||
//anchors.margins: Theme.paddingLarge
|
||||
anchors.topMargin: Theme.paddingSmall
|
||||
/* anchors.topMargin: Theme.paddingLarge
|
||||
anchors.bottomMargin: Theme.paddingMedium
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.leftMargin: Theme.paddingMedium */
|
||||
anchors.left: parent.left
|
||||
// width: parent.width * 0.4
|
||||
// x: 0
|
||||
// y: 0
|
||||
// width: parent.width * 0.4
|
||||
// height: parent.width * 0.3
|
||||
height: width * 0.6
|
||||
width: page.width
|
||||
//scale: 1.1
|
||||
// height: parent.height
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: model.image ? model.image.medium ? model.image.medium : "" : ""
|
||||
}
|
||||
|
||||
Text {
|
||||
id: firstName
|
||||
text: model.number + ": " + model.name
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
wrapMode: Text.ElideRight
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showSummary
|
||||
//anchors.bottom: showSummaryIcon.top
|
||||
anchors.top: showImg.bottom
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: ""
|
||||
color: Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
Image {
|
||||
id: showSummaryIcon
|
||||
anchors.top: showImg.bottom
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
//anchors.topMargin: Theme.paddingMedium
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: model.summary !== "" ? "image://theme/icon-lock-more" : ""
|
||||
}
|
||||
|
||||
Text {
|
||||
id: showAirdate
|
||||
text: "Air date: <b>"+model.airdate+"</b>"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
//anchors.topMargin: Theme.paddingMedium
|
||||
anchors.top: showRect.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
//anchors.right: parent.right
|
||||
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
Text {
|
||||
id: showRuntime
|
||||
text: model.runtime !== null ? "(Runtime: <b>" + model.runtime + " minutes)</b>" : ""
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.top: showRect.bottom
|
||||
//anchors.topMargin: Theme.paddingMedium
|
||||
//anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingMedium
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
|
||||
|
||||
onClicked: {
|
||||
showSummary.text !== "" ? showSummary.text = "" : showSummary.text = model.summary
|
||||
}
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.count == 0 && jsonModel1.jsonready
|
||||
text: "No TVmaze data"
|
||||
hintText: "no information about season"
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: sectionDelegate
|
||||
|
||||
Text {
|
||||
id: sectionLabel
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
font.pixelSize: Theme.fontSizeExtraLarge
|
||||
color: Theme.highlightColor
|
||||
text: "SEASON: "+section
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../JSONListModel"
|
||||
|
||||
Page {
|
||||
id: page
|
||||
property string filter: ""
|
||||
property string showid: ""
|
||||
property string showname: ""
|
||||
property string showimage: ""
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
JSONListModel {
|
||||
id: jsonModel1
|
||||
source: "http://api.tvmaze.com/shows/"+showid+"/seasons"
|
||||
query: "$[*]"
|
||||
}
|
||||
|
||||
model: jsonModel1.model
|
||||
|
||||
BusyIndicator {
|
||||
id: busyIndicator
|
||||
running: !jsonModel1.jsonready
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
header: PageHeader {
|
||||
id: pHeader
|
||||
title: showname
|
||||
}
|
||||
|
||||
delegate: BackgroundItem {
|
||||
id: myListItem
|
||||
width: ListView.view.width
|
||||
height: (showImg.height * showImg.scale) + showRect.height + Theme.paddingLarge
|
||||
OpacityRampEffect {
|
||||
sourceItem: showRect
|
||||
direction: OpacityRamp.TopToBottom
|
||||
offset: 0.0
|
||||
slope: 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: showRect
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
width: parent.width
|
||||
height: firstName.height + Theme.paddingLarge
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextIcon
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
anchors.right: showRect.right
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-right"
|
||||
}
|
||||
|
||||
Image {
|
||||
id: seenIcon
|
||||
visible: false
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
source: "image://theme/icon-m-acknowledge"
|
||||
}
|
||||
|
||||
|
||||
Image {
|
||||
id: showImg
|
||||
property int errorCount: 0
|
||||
anchors.top: showRect.bottom
|
||||
anchors.margins: Theme.paddingLarge
|
||||
/* anchors.topMargin: Theme.paddingLarge
|
||||
anchors.bottomMargin: Theme.paddingLarge
|
||||
anchors.rightMargin: Theme.paddingMedium
|
||||
anchors.leftMargin: Theme.paddingMedium */
|
||||
anchors.left: parent.left
|
||||
scale: 1.2
|
||||
//height: parent.height
|
||||
// width: parent.width * 0.4
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: model.image ? model.image.medium ? model.image.medium : showimage : showimage
|
||||
}
|
||||
|
||||
Text {
|
||||
id: firstName
|
||||
text: "Season: "+model.number //!== null ? "<b>"+model.name+"</b>" : ""
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: showRect.verticalCenter
|
||||
wrapMode: Text.ElideRight
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
}
|
||||
Text {
|
||||
id: showType
|
||||
text: "<u>Premiere</u><br><b>" + model.premiereDate + "</b>"
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.bottomMargin: Theme.paddingMedium
|
||||
anchors.bottom: showImg.bottom
|
||||
anchors.left: showImg.right
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
pageStack.push(Qt.resolvedUrl("ShowImg.qml"),{"img": model.image ? model.image.medium ? model.image.medium : showimage : showimage})
|
||||
|
||||
//window.pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": model.id,"showname": showname,"showimage": showImg.source} )
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("SeasonNrPage.qml"),{"showid": showid,"showname": showname,"showimage": showImg,"number": model.number} )
|
||||
}
|
||||
}
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Show cast")
|
||||
onClicked: pageStack.replace(Qt.resolvedUrl("CastPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage},PageStackAction.Immediate )
|
||||
}
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.count == 0 && jsonModel1.jsonready
|
||||
text: "No TVmaze data"
|
||||
hintText: "no information about seasons"
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: sectionDelegate
|
||||
Text {
|
||||
id: sectionLabel
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
font.pixelSize: Theme.fontSizeExtraLarge
|
||||
color: Theme.highlightColor
|
||||
text: "SEASON: "+section
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Page {
|
||||
property string img: ""
|
||||
Image {
|
||||
id: showImg
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: img
|
||||
anchors.fill: parent
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
BusyIndicator {
|
||||
id: imgBysy
|
||||
running: showImg.progress !== 1.0
|
||||
size: BusyIndicatorSize.Large
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import Sailfish.WebView 1.0
|
||||
|
||||
WebViewPage {
|
||||
id: webViewPage
|
||||
allowedOrientations: Orientation.Portrait | Orientation.Landscape
|
||||
|
||||
property string webPageAddress: ""
|
||||
property bool webViewLoading: false
|
||||
property int webViewLoadProgress: 0
|
||||
|
||||
WebView {
|
||||
id: webView
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
active: true
|
||||
url: webPageAddress
|
||||
|
||||
onLoadingChanged: {
|
||||
webViewPage.webViewLoading = loading
|
||||
webViewPage.webViewLoadProgress = 0
|
||||
}
|
||||
|
||||
onLoadProgressChanged: {
|
||||
webViewPage.webViewLoadProgress = loadProgress
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: panel
|
||||
color: Theme.highlightDimmerColor
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
//margins: Theme.padding
|
||||
}
|
||||
width: parent.width
|
||||
height: opacity === 0.0 ? 0 : Theme.paddingLarge
|
||||
radius: 5
|
||||
|
||||
opacity: (webViewPage.webViewLoading || loadStatusShowTimer.running) ? 0.75 : 0.0
|
||||
Behavior on opacity { FadeAnimator {} }
|
||||
|
||||
Timer {
|
||||
id: loadStatusShowTimer
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
color: Theme.secondaryHighlightColor
|
||||
width: webViewPage.webViewLoading ? parent.width * (webViewPage.webViewLoadProgress / 100) : 0
|
||||
height: parent.height
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user