key = request[2]
article = request[3]
feed = listing.getFeed(key)
- file = open(feed.getContentLink(article))
- feed.setEntryRead(article)
- html = file.read().replace("body", "body bgcolor='#ffffff'", 1)
- file.close()
+ try:
+ file = open(feed.getContentLink(article))
+ #feed.setEntryRead(article)
+ html = file.read().replace("body", "body bgcolor='#ffffff'", 1)
+ file.close()
+ except:
+ html = "<html><body>Error retrieving article</body></html>"
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(html)
+ #listing.updateUnread(key)
+ return
+ elif request[1] == "read":
+ key = request[2]
+ article = request[3]
+ feed = listing.getFeed(key)
+ feed.setEntryRead(article)
listing.updateUnread(key)
+ self.send_response(200)
+ self.send_header("Content-type", "text/html")
+ self.end_headers()
+ self.wfile.write("OK")
return
elif request[1] == "config":
xml = self.getConfigXml()
+++ /dev/null
-import Qt 4.7
-import QtWebKit 1.0
-import "common" as Common
-
-Rectangle {
- x: parent.width; /*height: parent.height;*/
- width: parent.width;
- height: parent.height
- property alias zoomEnabled: slider.visible;
- property alias value: slider.value;
- //anchors.top: parent.top; anchors.bottom: parent.bottom;
- color: "white";
-
- Flickable {
- id: flickable
- //anchors.fill: screen;
- height: parent.height;
- width: parent.width;
- contentWidth: webView.width*webView.scale; //Math.max(screen.width,webView.width*webView.scale)
- contentHeight: Math.max(screen.height,webView.height*webView.scale)
- //contentWidth: childrenRect.width; contentHeight: childrenRect.height
-
- flickDeceleration: 1000;
-
- WebView {
- id: webView
- url: articleDisplay.url;
- preferredWidth: flickable.width
- preferredHeight: flickable.height
- //scale: 1.25;
- transformOrigin: Item.TopLeft
- scale: slider.value;
- settings.defaultFontSize: 24
- }
- }
-
- Common.Slider {
- id: slider; visible: false
- minimum: 0.2;
- maximum: 2;
- property real prevScale: 1
- anchors {
- bottom: parent.bottom; bottomMargin: 65
- left: parent.left; leftMargin: 25
- right: parent.right; rightMargin: 25
- }
- onValueChanged: {
- if (webView.width * value > flickable.width) {
- var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale;
- flickable.contentX = xoff - flickable.width/2;
- }
- if (webView.height * value > flickable.height) {
- var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale;
- flickable.contentY = yoff - flickable.height/2;
- }
- prevScale = value;
- }
- Component.onCompleted: {value=0; value=1; }
- }
-}
--- /dev/null
+import Qt 4.7
+
+Item {
+ id: articleViewer
+ //width: 480; height: 360;
+ width: parent.width; height: parent.height;
+ //property string feedid: "61ac1458d761423344998dc76770e36e" //articlesItem.feedid;
+ //property string hideReadArticles: "";
+ property alias articleShown: articleView.visible;
+ property bool zoomEnabled: false;
+ property bool vertPanningEnabled: true
+
+ function modulo(x,y) {
+ // Fixes modulo for negative numbers
+ return ((x%y)+y)%y;
+ }
+
+ function reload() {
+ articles.reload()
+ }
+
+ function next() {
+ if (articleView.visible) {
+ //articleView.positionViewAtIndex(modulo(articleView.currentIndex+1, articleView.count), ListView.Contain);
+ articleView.incrementCurrentIndex();
+ }
+ }
+
+ function prev() {
+ if (articleView.visible) {
+ //articleView.positionViewAtIndex(modulo(articleView.currentIndex-1, articleView.count), ListView.Contain);
+ articleView.decrementCurrentIndex();
+ }
+ }
+
+ ListView {
+ id: articleList; model: visualModel.parts.list; z: 6
+ width: parent.width; height: parent.height; /*x: 0;*/
+ cacheBuffer: 100;
+ flickDeceleration: 1500
+ }
+
+ ListView {
+ id: articleView; model: visualModel.parts.flip; orientation: ListView.Horizontal
+ width: parent.width; height: parent.height; visible: false; z:8
+ //onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
+ highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
+ //cacheBuffer: 5;
+ onMovementStarted: articleViewer.vertPanningEnabled=false;
+ onMovementEnded: articleViewer.vertPanningEnabled=true;
+ highlightMoveDuration: 300;
+ }
+
+ VisualDataModel {
+ id: visualModel;
+ delegate: Package {
+ id: packageItem
+ Item { id: flipItem; Package.name: 'flip'; width: articleViewer.width; height: articleViewer.height;
+
+ property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? "http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid : "";
+ ArticleDisplay {
+ zoomEnabled: articleViewer.zoomEnabled;
+ property bool vertPanningEnabled: articleViewer.vertPanningEnabled;
+
+ states: [ State {
+ name: 'articleIsRead';
+ when: articleView.visible && articleView.currentIndex == index;
+ StateChangeScript {
+ name: "myScript"
+ script: {
+ flipItem.url="http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;
+ var doc = new XMLHttpRequest();
+ var url = "http://localhost:8000/read/" + articleViewer.feedid + "/" + articleid;
+ //console.log(url)
+ doc.open("GET", url);
+ doc.send();
+ //var xmlDoc=doc.responseXML;
+ }
+ }
+ }, State {
+ name: 'articleIsClose'; when: articleView.visible && Math.abs(articleView.currentIndex-index)<2;
+ StateChangeScript {
+ script: { flipItem.url="http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;}
+ }
+ }
+ ]
+ }
+ }
+
+ Item { Package.name: 'list';
+ id: wrapper; width: articleViewer.width; height: 86
+ Item {
+ id: moveMe
+ Rectangle { id: backRect; color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
+ Text {
+ anchors.fill: backRect
+ anchors.margins: 5
+ verticalAlignment: Text.AlignVCenter; text: title; color: (unread=="True") ? "white" : "#7b97fd";
+ width: wrapper.width; wrapMode: Text.WordWrap; font.bold: false;
+ }
+ }
+ MouseArea { anchors.fill: wrapper;
+ onClicked: { articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true; }
+ }
+ }
+ }
+ model: articles
+ }
+
+ XmlListModel {
+ id: articles
+
+ source: articleViewer.feedid == "" ? "" : "http://localhost:8000/articles/" + feedid + "?onlyUnread=" + hideReadArticles
+ query: "/xml/article"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "articleid"; query: "articleid/string()"; isKey: true }
+ XmlRole { name: "path"; query: "path/string()" }
+ XmlRole { name: "unread"; query: "unread/string()"; isKey: true}
+ }
+
+
+}
property string feedid : ""
property alias count: articles.count
property alias url: articles.source
+
x: parent.width; height: parent.height;
anchors.top: parent.top; anchors.bottom: parent.bottom
// Depends on qt4-declarative-qmlviewer
Item {
- width: 640
- height: 480
+ width: 480
+ height: 640
id: screen
Rectangle {
id: container
- anchors.fill: parent; color: "#343434";
-
- function modulo(x,y) {
- // Fixes modulo for negative numbers
- return ((x%y)+y)%y;
- }
+ /*anchors.fill: parent;*/ color: "#343434";
+ anchors.centerIn: parent
+ transformOrigin: Item.Center
function categoryClicked(catid) {
feedsItem.catid = catid;
}
function feedClicked(feedid) {
- articlesItem.feedid = feedid;
- articlesItem.visible = true;
+ flipper.feedid = feedid;
+ flipper.visible = true;
}
- function articleClicked(articleid, index) {
- // Assign the articleId for the current, next and previous article to the associated variables
- // Note the modulo, so it goes around
- articleDisplay.articleindex = modulo(index,articlesItem.count)
- articleDisplay.nextArticle = articlesItem.getArticleid(modulo(index+1,articlesItem.count))
- articleDisplay.prevArticle = articlesItem.getArticleid(modulo(index-1,articlesItem.count))
- articleDisplay.articleid = articleid
- articleDisplay.visible = true;
- }
+// function articleClicked(articleid, index) {
+// // Assign the articleId for the current, next and previous article to the associated variables
+// // Note the modulo, so it goes around
+// //articleDisplay.articleindex = modulo(index,articlesItem.count)
+// //articleDisplay.nextArticle = articlesItem.getArticleid(modulo(index+1,articlesItem.count))
+// //articleDisplay.prevArticle = articlesItem.getArticleid(modulo(index-1,articlesItem.count))
+// //articleDisplay.articleid = articleid
+// //flipper.model = articlesItem.articles
+// flipper.visible = true;
+// }
function backClicked() {
- if (articleDisplay.visible) {
+ if (flipper.visible && flipper.articleShown) {
// We're viewing an article, and going back to article listing
- articleDisplay.visible = false;
- articleDisplay.articleid = "";
- articleDisplay.value = 1;
- articlesItem.reload()
+ flipper.articleShown = false;
+ flipper.reload()
+ //flipper.articleid = "";
+ //flipper.value = 1;
+ //articlesItem.reload()
return;
}
- if (articlesItem.visible) {
- // Viewing articles, going back to feeds
- //articlesItem.feedid = "";
+ if (flipper.visible) {
feedsItem.reload();
- articlesItem.visible = false;
- //articlesItem.reload();
+ flipper.visible = false;
+ flipper.feedid = "";
return;
}
+
+// if (articlesItem.visible) {
+// // Viewing articles, going back to feeds
+// //articlesItem.feedid = "";
+// feedsItem.reload();
+// articlesItem.visible = false;
+// //articlesItem.reload();
+// return;
+// }
if (feedsItem.visible) {
// Viewing feeds, going back to categories
//feedsItem.catid = "";
Common.ToolBar {
id: toolBar; z: 7
height: 66; anchors.top: parent.top; width: parent.width; opacity: 0.9
- button1Label: qsTr("Config"); button2Label: qsTr("Back")
+ menuLabel: qsTr("Config"); backLabel: qsTr("Back")
nextLabel: qsTr("Next"); prevLabel: qsTr("Previous")
markAllLabel: qsTr("Mark All As Read"); zoomLabel: qsTr("Zoom")
taskSwitcherLabel: qsTr("Task Switch")
- onButton1Clicked: config.isShown = !config.isShown;
- onButton2Clicked: container.backClicked()
- onPrevClicked: container.articleClicked(articleDisplay.prevArticle, articleDisplay.articleindex-1)
- onNextClicked: container.articleClicked(articleDisplay.nextArticle, articleDisplay.articleindex+1)
+ onMenuClicked: config.isShown = !config.isShown;
+ onBackClicked: container.backClicked()
+ onPrevClicked: flipper.prev();
+ onNextClicked: flipper.next();
onMarkAllClicked: {
confirmationMessage.text = qsTr("Do you want to mark all items as read?");
confirmationMessage.visible = true;
}
- onZoomClicked: { articleDisplay.zoomEnabled = !articleDisplay.zoomEnabled; }
+ onZoomClicked: { flipper.zoomEnabled = !flipper.zoomEnabled; }
onTaskSwitcherClicked: {
var doc = new XMLHttpRequest();
var url = "http://localhost:8000/task"
doc.send();
//var xmlDoc=doc.responseXML;
}
+ //onRotateClicked: { container.rotation=-90; container.width=screen.height; container.height=screen.width; }
states: [ State {
- name: "navButtons"; when: articleDisplay.articleid != ""
- PropertyChanges { target: toolBar; nextVisible: true; }
- PropertyChanges { target: toolBar; prevVisible: true; }
+ name: "navButtons"; when: flipper.articleShown
+ PropertyChanges { target: toolBar; nextVisible: !container.inPortrait; }
+ PropertyChanges { target: toolBar; prevVisible: !container.inPortrait; }
PropertyChanges { target: toolBar; zoomVisible: true; }
},
State {
- name: "feedButtons"; when: (articleDisplay.articleid == "")&&(articlesItem.feedid!="")
+ name: "feedButtons"; when: (flipper.visible)&&(!flipper.articleShown)
PropertyChanges { target: toolBar; markAllVisible: true; }
+ },
+ State {
+ name: "quitButton"; when: (!feedsItem.visible)
+ PropertyChanges { target: toolBar; quitVisible: true;}
+ PropertyChanges { target: toolBar; backVisible: false; }
}
]
}
//x: 2;
//y:66;
width: parent.width // - 4
+ height: parent.height-toolBar.height;
anchors.top: toolBar.bottom; anchors.bottom: parent.bottom
+ y: toolBar.height;
Categories {
// Loads the categoryList view and delegate
visible: false;
states: [
- State { name: "articlesShown"; when: articlesItem.visible; PropertyChanges { target: feedsItem; x: -parent.width } },
+ State { name: "articlesShown"; when: flipper.visible; PropertyChanges { target: feedsItem; x: -parent.width } },
State { name: "shown"; when: feedsItem.visible; PropertyChanges { target: feedsItem; x: 0 } }
]
}
- Articles {
- // Loads the articleLost view and delegate
- id: articlesItem;
- property string hideReadArticles: config.hideReadArticles
+ ArticleViewer {
+ id: flipper
visible: false;
+ property string hideReadArticles: config.hideReadArticles
+ property string feedid: ""
+ x: parent.width
- states: [
- State { name: "shown"; when: articleDisplay.visible; PropertyChanges { target: articlesItem; x: -parent.width }
- },
- State { name: "articleShown"; when: articlesItem.visible; PropertyChanges { target: articlesItem; x: 0 }
+ states: State { name: "shown"; when: flipper.visible; PropertyChanges { target: flipper; x: 0 }
}
- ]
transitions: Transition {
NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
}
}
+ }
- ArticleDisplay{
- // Loads the WebView
- id: articleDisplay;
- //anchors.top: toolBar.bottom;
- //anchors.bottom: screen.bottom;
- height: parent.height;
- visible: false;
- property string feedid: articlesItem.feedid;
- property string articleid: "";
- property int articleindex: 0;
- property string nextArticle: "";
- property string prevArticle: "";
- property string url: (articleid == "") ? "" : "http://localhost:8000/html/" + articleDisplay.feedid + "/" + articleDisplay.articleid;
-
- gradient: Gradient {
- GradientStop {
- position: 0.00;
- color: "#ffffff";
- }
- GradientStop {
- position: 1.00;
- color: "#ffffff";
- }
- }
-
- states: State { name: "shown"; when: articleDisplay.visible; PropertyChanges { target: articleDisplay; x: 0 }
- }
+ property bool lockRotation: false
+ property variant selectedOrientation: Orientation.UnknownOrientation
+ property variant activeOrientation: selectedOrientation == Orientation.UnknownOrientation ? runtime.orientation : selectedOrientation
+ state: "orientation " + activeOrientation
+ property bool inPortrait: (activeOrientation == Orientation.Portrait || activeOrientation == Orientation.PortraitInverted);
+
+ // rotation correction for landscape devices like N900
+ property bool landscapeWindow: screen.width > screen.height
+ property variant rotationDelta: landscapeWindow ? -90 : 0
+ rotation: rotationDelta
+
+ // initial state is portrait
+ property real baseWidth: landscapeWindow ? screen.height : screen.width
+ property real baseHeight: landscapeWindow ? screen.width : screen.height
+
+ width: baseWidth
+ height: baseHeight
+
+ function getAngle(orientation) {
+ var angle;
+ if (orientation == Orientation.Portrait) {
+ angle = 0;
+ } else if (orientation == Orientation.Landscape) {
+ angle = 90;
+ } else if (orientation == Orientation.PortraitInverted) {
+ angle = 180;
+ } else if (orientation == Orientation.LandscapeInverted) {
+ angle = 270;
+ } else {
+ angle = 0;
+ }
+ return angle;
+ }
- transitions: Transition {
- NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
+ states: [
+ State {
+ name: "orientation " + Orientation.Landscape
+ PropertyChanges {
+ target: container
+ rotation: getAngle(Orientation.Landscape)+rotationDelta
+ width: baseHeight
+ height: baseWidth
}
+ StateChangeScript { script: console.log(container.width +"/"+container.height) }
+ },
+ State {
+ name: "orientation " + Orientation.PortraitInverted
+ PropertyChanges {
+ target: container
+ rotation: getAngle(Orientation.PortraitInverted)+rotationDelta
+ width: baseWidth
+ height: baseHeight
+ }
+ StateChangeScript { script: console.log(container.width +"/"+container.height) }
+ },
+ State {
+ name: "orientation " + Orientation.LandscapeInverted
+ PropertyChanges {
+ target: container
+ rotation: getAngle(Orientation.LandscapeInverted)+rotationDelta
+ width: baseHeight
+ height: baseWidth
+ }
+ StateChangeScript { script: console.log(container.width +"/"+container.height) }
+ }
+ ]
+ transitions: Transition {
+ ParallelAnimation {
+ RotationAnimation {
+ direction: RotationAnimation.Shortest
+ duration: 300
+ easing.type: Easing.InOutQuint
+ }
+ NumberAnimation {
+ properties: "x,y,width,height"
+ duration: 300
+ easing.type: Easing.InOutQuint
+ }
+ }
}
- }
+
}
}
signal clicked
property string text
+ property string imageSource: ""
+ property int imageRotation: 0
BorderImage {
id: buttonImage
source: "images/toolbutton.sci"
width: container.width; height: container.height
+ //visible: (container.imageSource=="")
}
BorderImage {
id: pressed
opacity: 0
source: "images/toolbutton.sci"
width: container.width; height: container.height
+ //visible: (container.imageSource=="")
+ }
+ Image {
+ source: container.imageSource
+ rotation: container.imageRotation
+ //fillMode: Image.PreserveAspectFit
+ smooth: true
+ anchors.centerIn: buttonImage;
+ //width: container.width; height: container.height
}
MouseArea {
id: mouseRegion
color: "white"
anchors.centerIn: buttonImage; font.bold: true
text: container.text; style: Text.Raised; styleColor: "black"
+ visible: (container.imageSource=="")
}
states: [
State {
Switch {
id: hideReadFeedsSwitch;
- text: "Hide Read Feeds";
+ text: qsTr("Hide Read Feeds");
value: config.hideReadFeeds
onClicked: config.hideReadFeeds = (config.hideReadFeeds == "False") ? "True" : "False"
}
Switch {
id: hideReadArticlesSwitch;
- text: "Hide Read Articles";
+ text: qsTr("Hide Read Articles");
value: config.hideReadArticles
onClicked: config.hideReadArticles = (config.hideReadArticles == "False") ? "True" : "False"
anchors.top: hideReadFeedsSwitch.bottom
}
+ Switch {
+ id: lockRotation;
+ text: qsTr("Lock Rotation");
+ value: container.lockRotation ? "True" : "False"
+ onClicked: { container.lockRotation=!container.lockRotation;
+ container.selectedOrientation = (container.lockRotation) ? container.activeOrientation : Orientation.UnknownOrientation }
+ anchors.top: hideReadArticlesSwitch.bottom
+ }
+
Rectangle {
id: closeButton
height: 50;
}
radius: 10;
width: parent.width
- anchors.top: hideReadArticlesSwitch.bottom
+ anchors.top: lockRotation.bottom
MouseArea {
id: mouseRegion
Item {
id: toolbar
- property alias button1Label: button1.text
- property alias button2Label: button2.text
+ property alias menuLabel: menuButton.text
+ property alias backLabel: backButton.text
property alias prevLabel: prevButton.text
property alias nextLabel: nextButton.text
property alias markAllLabel: markAllButton.text
property alias zoomLabel: zoomButton.text
property alias taskSwitcherLabel: taskSwitcherButton.text
+
+ property alias backVisible: backButton.visible
property alias nextVisible: nextButton.visible
property alias prevVisible: prevButton.visible
property alias markAllVisible: markAllButton.visible
property alias zoomVisible: zoomButton.visible
- signal button1Clicked
- signal button2Clicked
+ property alias quitVisible: quitButton.visible
+
+ signal menuClicked
+ signal backClicked
signal prevClicked
signal nextClicked
signal markAllClicked
signal zoomClicked
signal taskSwitcherClicked
+ //signal rotateClicked
//BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
Rectangle {
Button {
id: taskSwitcherButton
- anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 160; height: 60
+ anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 116; height: 60
onClicked: toolbar.taskSwitcherClicked()
+ imageSource: "images/wmTaskLauncherIcon.png"
}
Button {
- id: button1
- anchors.left: taskSwitcherButton.right; anchors.leftMargin: 5; y: 3; width: 160; height: 60
- onClicked: toolbar.button1Clicked()
+ id: menuButton
+ anchors.left: taskSwitcherButton.right; anchors.leftMargin: 5; y: 3; width: 60; height: 60
+ onClicked: toolbar.menuClicked()
+ imageSource: "images/wmEditIcon.png"
}
Button {
- id: button2
- anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 160; height: 60
- onClicked: toolbar.button2Clicked()
+ id: backButton
+ anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 116; height: 60
+ onClicked: toolbar.backClicked()
+ imageSource: "images/wmBackIcon.png"
}
Button {
id: markAllButton
visible: false
- anchors.left: button1.right; anchors.rightMargin: 5; y: 3; width: 240; height: 60
+ anchors.left: menuButton.right; anchors.rightMargin: 5; y: 3; width: 60; height: 60
onClicked: toolbar.markAllClicked()
+ imageSource: "images/checkmark.png"
}
Button {
id: prevButton
visible: false
- anchors.left: button1.right; anchors.rightMargin: 5; y: 3; width: 120; height: 60
+ anchors.left: menuButton.right; anchors.rightMargin: 5; y: 3; width: 120; height: 60
onClicked: toolbar.prevClicked()
+ imageSource: "images/InputMethodShiftButtonNormal.png"
+ imageRotation: -90;
}
Button {
id: nextButton
visible: false
- anchors.right: button2.left; anchors.rightMargin: 5; y: 3; width: 120; height: 60
+ anchors.right: zoomButton.left; anchors.rightMargin: 5; y: 3; width: 120; height: 60
onClicked: toolbar.nextClicked()
+ imageSource: "images/InputMethodShiftButtonNormal.png"
+ imageRotation: 90
}
Button {
id: zoomButton
visible: false
- anchors.right: nextButton.left; anchors.rightMargin: 5; y: 3; width: 80; height: 60
+ anchors.right: backButton.left; anchors.rightMargin: 5; y: 3; width: 80; height: 60
onClicked: toolbar.zoomClicked()
+ imageSource: "images/Zoom-In-icon.png"
}
+
+ Button {
+ id: quitButton
+ visible: false
+ anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 116; height: 60
+ onClicked: toolbar.backClicked()
+ imageSource: "images/wmCloseIcon.png"
+ }
+
+// Button {
+// id: rotateButton
+// visible: true; anchors.left: taskSwitcherButton.right;
+// anchors.rightMargin: 5; y: 3; width: 60; height: 60
+// onClicked: toolbar.rotateClicked()
+// imageSource: "images/rotate.png"
+// }
}
}
+++ /dev/null
-import Qt 4.7
-
-Item {
- id: screen; width: 800; height: 480;
-// property bool inListView : false;
- Rectangle {
- id: background
- anchors.fill: parent; color: "#343434";
-
- Text {
- text: "Hello World"
- anchors.centerIn: parent
- MouseArea {
- id: mouseRegion
- anchors.fill: parent
- onClicked: { screen.inListView = true; }
- }
- }
- }
-// states: State {
-// name: "ListView"; when: screen.inListView == true
-// PropertyChanges { target: feedList; x: 0 }
-// //PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) }
-// }
-
- transitions: Transition {
- NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" }
- }
-
- ListView {
- id: categoryList; model: categories; delegate: categoryDelegate; z: 6
- property string shownCategory : ""
- /*height: parent.height;*/ x: 0 /*-(parent.width * 1.5)*/; cacheBuffer: 100; width: parent.width;
-// states: State {
-// name: "showOneCategory"; when: categoryList.shownCategory != ""
-// PropertyChanges { target: categories; query: "/xml/category[catid=[\"" + categoryList.shownCategory + "\"]" }
-// }
- }
-
- ListView {
- id: feedList; model: feeds; delegate: feedDelegate; z: 6
- width: parent.width; height: parent.height; x: parent.width;
- cacheBuffer: 100;
-// opacity: 0;
- //anchors.top: categoryList.bottom
- }
-
- XmlListModel {
-
- id: categories
-
- //source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "")+"format=rss2"
- source: "/home/ymarcoz/feedlist.xml"
- query: "/xml/category"
- //namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
-
- XmlRole { name: "title"; query: "catname/string()" }
- XmlRole { name: "catid"; query: "catid/string()"; isKey: true }
-
- }
-
- XmlListModel {
- property string catid : ""
- id: feeds
-
- //source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "")+"format=rss2"
- source: "/home/ymarcoz/feedlist.xml"
- query: "/xml/category/feed"
- //namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
-
- XmlRole { name: "title"; query: "feedname/string()" }
- XmlRole { name: "feedid"; query: "feedid/string()" }
- }
-
- Component {
- id: categoryDelegate
-
- Item {
-
- function categoryClicked() {
-// if (categoryList.shownCategory == catid)
-// {
- categoryList.shownCategory = ""
-// categories.query="/xml/category"
-// feedList.opacity = 0;
-// } else {
-// categoryList.shownCategory = catid;
-// categories.query="/xml/category[catid=\"" + catid + "\"]";
- feeds.query = "/xml/category[catid=\"" + catid +"\"]/feed"
- feedList.x = 0
- //feeds.reload()
-// feedList.opacity = 100
-// }
-
- //feedList.model = feeds;
- }
- id: wrapper; width: wrapper.ListView.view.width; height: 86
- Item {
- id: moveMe
- height: parent.height
- Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
- Rectangle {
- x: 6; y: 4; width: 77; height: parent.height - 9; color: "white"; smooth: true
-
- }
- Column {
- x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2
- Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
- //Text { text: feedname; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
- }
- }
- MouseArea { anchors.fill: wrapper; onClicked: { categoryClicked() } }
-
- // Animate adding and removing of items:
-
-// ListView.onAdd: SequentialAnimation {
-// PropertyAction { target: wrapper; property: "height"; value: 0 }
-// NumberAnimation { target: wrapper; property: "height"; to: 86; duration: 250; easing.type: Easing.InOutQuad }
-// }
-
-// ListView.onRemove: SequentialAnimation {
-// PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
-// NumberAnimation { target: wrapper; property: "height"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
-
-// // Make sure delayRemove is set back to false so that the item can be destroyed
-// PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
-// }
-
- }
-
- }
-
- Component {
- id: feedDelegate
-
- Item {
-
- function feedClicked() {
- //feeds.query = "/xml/category[catid=\"" + catid +"\"]/feed"
- //feeds.reload()
- //feedList.model = feeds;
- }
- id: wrapper; width: wrapper.ListView.view.width; height: 86
- Item {
- id: moveMe
- Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
- Rectangle {
- x: 6; y: 4; width: 77; height: 77; color: "#ff0000"; smooth: true
-
- }
- Column {
- x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2
- Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
- //Text { text: feedname; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
- }
- }
- MouseArea { anchors.fill: wrapper; onClicked: { feedClicked() } }
- }
-
- }
-
-}