Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Thomas Perl
289849b8a2 Three panes 2015-03-08 00:16:24 +01:00
11 changed files with 77 additions and 17 deletions

View file

@ -62,6 +62,10 @@ ListModel {
}); });
} }
onPodcast_idChanged: {
reload();
}
property var worker: ModelWorkerScript { property var worker: ModelWorkerScript {
id: modelWorker id: modelWorker
} }

View file

@ -31,8 +31,8 @@ MouseArea {
drag { drag {
target: parent target: parent
axis: Drag.XAxis axis: Drag.XAxis
minimumX: 0 minimumX: parent.leftDragLimit
maximumX: canClose ? parent.width : 0 maximumX: canClose ? pgst.width : 0
filterChildren: true filterChildren: true
} }
@ -44,7 +44,7 @@ MouseArea {
if (pressed) { if (pressed) {
dragging.stacking.stopAllAnimations(); dragging.stacking.stopAllAnimations();
} else { } else {
if (parent.x > parent.width / 3) { if (parent.x > pgst.width * 3 / 4) {
dragging.stacking.startFadeOut(); dragging.stacking.startFadeOut();
} else { } else {
dragging.stacking.fadeInAgain(); dragging.stacking.fadeInAgain();

View file

@ -27,6 +27,8 @@ import 'icons/icons.js' as Icons
SlidePage { SlidePage {
id: detailPage id: detailPage
width: pgst.width / 3
property int episode_id property int episode_id
property string title property string title
property string link property string link
@ -43,7 +45,7 @@ SlidePage {
visible: !detailPage.ready visible: !detailPage.ready
} }
Component.onCompleted: { onEpisode_idChanged: {
py.call('main.show_episode', [episode_id], function (episode) { py.call('main.show_episode', [episode_id], function (episode) {
detailPage.title = episode.title; detailPage.title = episode.title;
descriptionLabel.text = episode.description; descriptionLabel.text = episode.description;

View file

@ -27,9 +27,14 @@ import 'common/util.js' as Util
PListView { PListView {
id: episodeList id: episodeList
property alias podcast_id: episodeListModel.podcast_id
property int selectedIndex: -1 property int selectedIndex: -1
onPodcast_idChanged: {
selectedIndex = -1;
}
PScrollIntoView { id: scrollIntoView } PScrollIntoView { id: scrollIntoView }
onSelectedIndexChanged: { onSelectedIndexChanged: {

View file

@ -28,6 +28,8 @@ import 'icons/icons.js' as Icons
SlidePage { SlidePage {
id: page id: page
width: pgst.width / 3
property int podcast_id property int podcast_id
property string title property string title
@ -80,12 +82,6 @@ SlidePage {
], undefined, undefined, true); ], undefined, undefined, true);
} }
Component.onCompleted: {
episodeList.model.podcast_id = podcast_id;
// List model will be loaded automatically on load
}
EpisodeQueryControl { EpisodeQueryControl {
id: queryControl id: queryControl
model: episodeList.model model: episodeList.model
@ -95,5 +91,6 @@ SlidePage {
EpisodeListView { EpisodeListView {
id: episodeList id: episodeList
title: page.title title: page.title
podcast_id: page.podcast_id
} }
} }

View file

@ -68,7 +68,7 @@ Item {
// Initial focus // Initial focus
focus: true focus: true
property real scalef: (width < height) ? (width / 480) : (height / 480) property real scalef: 1.0 //(width < height) ? (width / 480) : (height / 480)
property int shorterSide: (width < height) ? width : height property int shorterSide: (width < height) ? width : height
property int dialogsVisible: 0 property int dialogsVisible: 0
@ -84,9 +84,9 @@ Item {
} }
if (page.isDialog) { if (page.isDialog) {
children[index-1].opacity = 1; //children[index-1].opacity = 1;
} else { } else {
children[index-1].opacity = x / width; //children[index-1].opacity = x / width;
} }
//children[index-1].pushPhase = x / width; //children[index-1].pushPhase = x / width;
@ -115,6 +115,26 @@ Item {
} }
} }
onChildrenChanged: resizePages()
function resizePages() {
var pages = [];
for (var i=0; i<children.length; i++) {
if (children[i].filename) {
pages.push(children[i]);
}
}
var l = 0;
for (var i=0; i<pages.length; i++) {
if (i === 0) {
pages[i].leftDragLimit = 0;
} else {
pages[i].leftDragLimit = Qt.binding(function () { return pages[i-1].nextDragLimit; });
}
}
}
function topOfStackChanged(offset) { function topOfStackChanged(offset) {
if (offset === undefined) { if (offset === undefined) {
offset = 0; offset = 0;
@ -130,6 +150,12 @@ Item {
if (!page.isDialog) { if (!page.isDialog) {
pgst.windowTitle = page.title || 'gPodder'; pgst.windowTitle = page.title || 'gPodder';
} }
console.log('===== children =====');
for (var i=0; i<children.length; i++) {
console.log('child ' + i + ': ' + children[i] + ' / ' + (children[i].filename || '-') + ' / leftDragLimit = ' + children[i].leftDragLimit);
}
resizePages();
} }
function showConfirmation(title, affirmative, negative, description, icon, callback) { function showConfirmation(title, affirmative, negative, description, icon, callback) {
@ -167,6 +193,18 @@ Item {
return; return;
} }
for (var i=0; i<children.length; i++) {
if (children[i].filename === filename) {
console.log('reusing existing child, setting properties');
for (var key in properties) {
children[i][key] = properties[key];
}
// just in case
topOfStackChanged();
return;
}
}
var component = Qt.createComponent(filename); var component = Qt.createComponent(filename);
if (component.status != Component.Ready) { if (component.status != Component.Ready) {
console.log('Error loading ' + filename + ':' + console.log('Error loading ' + filename + ':' +
@ -178,6 +216,7 @@ Item {
} }
pgst.loadPageInProgress = true; pgst.loadPageInProgress = true;
properties.filename = filename;
component.createObject(pgst, properties); component.createObject(pgst, properties);
} }
@ -350,5 +389,6 @@ Item {
PodcastsPage { PodcastsPage {
visible: py.ready visible: py.ready
filename: 'PodcastsPage.qml'
} }
} }

View file

@ -27,6 +27,8 @@ import 'icons/icons.js' as Icons
SlidePage { SlidePage {
id: page id: page
width: pgst.width / 3
property int podcast_id property int podcast_id
property string title property string title
property string description property string description

View file

@ -28,6 +28,8 @@ import 'common/constants.js' as Constants
SlidePage { SlidePage {
id: page id: page
width: pgst.width / 3
canClose: false canClose: false
hasMenuButton: true hasMenuButton: true

View file

@ -33,6 +33,10 @@ Rectangle {
property alias canClose: dragging.canClose property alias canClose: dragging.canClose
property bool isDialog: false property bool isDialog: false
property string filename
property int leftDragLimit
property int nextDragLimit: page.x + page.width
property string title: '' property string title: ''
property bool hasMenuButton: false property bool hasMenuButton: false
property string menuButtonLabel: 'Menu' property string menuButtonLabel: 'Menu'
@ -54,6 +58,10 @@ Rectangle {
Stacking { id: stacking } Stacking { id: stacking }
function slideToLeft() {
stacking.fadeInAgain();
}
Dragging { Dragging {
id: dragging id: dragging
stacking: stacking stacking: stacking

View file

@ -28,7 +28,7 @@ Item {
id: fadeIn id: fadeIn
target: stacking.page target: stacking.page
property: 'x' property: 'x'
to: 0 to: page.leftDragLimit
duration: 500 duration: 500
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
@ -41,7 +41,7 @@ Item {
id: fadeOut id: fadeOut
target: stacking.page target: stacking.page
property: 'x' property: 'x'
to: stacking.page.width to: pgst.width
duration: 500 duration: 500
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
@ -62,7 +62,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
if (pgst.loadPageInProgress) { if (pgst.loadPageInProgress) {
page.x = page.width; page.x = pgst.width;
fadeIn.start(); fadeIn.start();
} }
} }

View file

@ -24,7 +24,7 @@ import 'common/constants.js' as Constants
Rectangle { Rectangle {
color: Constants.colors.page color: Constants.colors.page
width: 480 width: 1280
height: 800 height: 800
Main {} Main {}