From: Yves Marcoz Date: Sun, 15 Jan 2012 20:38:06 +0000 (-0800) Subject: psa: using 2 flickables X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=826d5c0e4fecbfe5ca459d38adb3320a7c92a914;p=feedingit psa: using 2 flickables --- diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/changelog b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/changelog index c7198f6..f42025d 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/changelog +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/changelog @@ -2,4 +2,4 @@ feedingit (0.1.0-1) unstable; urgency=low * source package automatically created by stdeb 0.6.0+git - -- Slocan Thu, 05 Jan 2012 20:58:44 -0800 + -- Slocan Sun, 15 Jan 2012 12:25:53 -0800 diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/control b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/control index 65e43f3..4268e6f 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/control +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/control @@ -2,7 +2,7 @@ Package: feedingit Version: 0.1.0-1 Architecture: all Maintainer: Slocan -Installed-Size: 816 +Installed-Size: 828 Depends: python-pyside.qtgui, python-pyside.qtopengl, python-pyside.qtdeclarative, python-dbus, python-gconf Breaks: python (<< 2.6) Section: user/network diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/md5sums b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/md5sums index ef6b60f..5156b63 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/md5sums +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/DEBIAN/md5sums @@ -1,14 +1,14 @@ ab6be1fce6e02f7f10857cd79755bf18 usr/bin/feedingit 1af83cdf3d338e6460a92c00537c375b usr/share/applications/feedingit.desktop eda8cc6ffe8d842d6dfe0244b01b3042 usr/share/dbus-1/services/feedingit_status.service -3f2da2596c2f5788fee074a589c9bbd0 usr/share/doc/feedingit/changelog.Debian.gz +eda7952eb2c876abd07aae9a579d4a56 usr/share/doc/feedingit/changelog.Debian.gz bac2be6ae9673ee5096e20e8b714c9cd usr/share/feedingit/BeautifulSoup.py 8f6e980f2e1154103a90763be6c00dc4 usr/share/feedingit/XmlHandler.py d41d8cd98f00b204e9800998ecf8427e usr/share/feedingit/__init__.py -3485a6a12a47b67c26e4134c558cc3c9 usr/share/feedingit/config.py +25d2c59c4c9db6aad90fa47da2d01ece usr/share/feedingit/config.py b4b00de5dccaf56d81a9dab1eeac63e1 usr/share/feedingit/debugging.py fae02e730b76761d43a626fe19828d5e usr/share/feedingit/download.py -4db69341f53742ba38afb8173ae9ef32 usr/share/feedingit/feedingit.py +bb86ed085c33da65acdb3b167bd74638 usr/share/feedingit/feedingit.py afa4f462892136f59beaf96b6bf1cf96 usr/share/feedingit/feedparser.py c1a0c0a9ccefd64d1e27bddb817c72a3 usr/share/feedingit/httpprogresshandler.py f1e9ba0f44786f513659a7fa3111fc8a usr/share/feedingit/jobmanager.py @@ -17,16 +17,17 @@ d9c0665dfdd5cf19f1529ce88af95134 usr/share/feedingit/opml.py 7c3358bb2e3cba866248e75556a159d3 usr/share/feedingit/opml_lib.py 4ef0e77dd5685db3a51306fd7ccf585f usr/share/feedingit/qml/AddFeed.qml 538dac5d47b6d46b428d71b8c579e419 usr/share/feedingit/qml/ArticleDelegate.qml -6a0c407a7931a4b362bd07921f70c009 usr/share/feedingit/qml/ArticleDisplay.qml -d6b1c6bb6e2d09cf95c1db69227ccdd2 usr/share/feedingit/qml/ArticleViewer.qml -15083e9a1fac05c8efaaa085dfabcbcb usr/share/feedingit/qml/Articles.qml +1fcfdf2c75b378a46a4cd23bca5f7e4c usr/share/feedingit/qml/ArticleDisplay.qml +928fce93c7b4ce85f4e09862fb2018c2 usr/share/feedingit/qml/ArticleViewer.qml +adc4f778fd3dcd70f1bc4c671ce92b0a usr/share/feedingit/qml/Articles.qml 77bf6a1d2d0f265ee16c492886f96ede usr/share/feedingit/qml/AutomaticUpdate.qml bd7579a3d822222caca98684212c4f42 usr/share/feedingit/qml/Categories.qml cd30f5eaec0885358261d7a96bfaf8cd usr/share/feedingit/qml/FeedingIt.qml afdb98e07e8b5e066e745a5df9de09b9 usr/share/feedingit/qml/Feeds.qml bec5fe4599a3ad5799ed96d7ed81fb5f usr/share/feedingit/qml/MainPage.qml -26b45df56edf3db9c90e421769d76d1e usr/share/feedingit/qml/Settings.qml -c60a530cf5c92c8c08e0a073444172e1 usr/share/feedingit/qml/SettingsPage.qml +75b9275e76eb840e21199592e329feb7 usr/share/feedingit/qml/Settings.qml +07b5e6c5629b43d2b20250dbb7069909 usr/share/feedingit/qml/SettingsPage.qml +ae761587ba98f662cfbe91ae9e23ff93 usr/share/feedingit/qml/SliderSetting.qml 8c3766da8556e32346f50795e7421a8e usr/share/feedingit/qml/SwitchSetting.qml aa3fc0a4edbd17d93a9dc5c39c433c3d usr/share/feedingit/qml/TestWebview.qml 508fde19c7bb7bc4892bd6642fbcb7d3 usr/share/feedingit/qml/TextInputClear.qml @@ -62,8 +63,8 @@ af11b73b195513d08c17723b41db0b04 usr/share/feedingit/qml/common/images/wmBackIc 1c7751b124aa1bdf4b89ec76cdf815a2 usr/share/feedingit/qml/i18n/FeedingIt.ts 7790a99425dd7c1046e6ae3b1ee72a03 usr/share/feedingit/qml/i18n/qml_en.qm 1674fcce45bcf3319e61d19a9adf4fdd usr/share/feedingit/qml/i18n/qml_en.ts -5e9106fb8689ca72675d28123b36c2a5 usr/share/feedingit/qml/main.qml -d6a20bd58cfc71b071bc2de09bf1518f usr/share/feedingit/rss_sqlite.py +17f4f1f51d356494f17139abd703df42 usr/share/feedingit/qml/main.qml +aa4ee5956cc3e4f41137c558b04908ef usr/share/feedingit/rss_sqlite.py 6e88950ff9c416c362c6ca17cf4317f7 usr/share/feedingit/splash.jpg 721777a26cd2a5b8466ce2aa2b99fad7 usr/share/feedingit/update_feeds.py 6ccf12dc4379e91800ae8505b2e86082 usr/share/feedingit/updatedbus.py diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/doc/feedingit/changelog.Debian.gz b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/doc/feedingit/changelog.Debian.gz index 9908032..4f9d7f2 100644 Binary files a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/doc/feedingit/changelog.Debian.gz and b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/doc/feedingit/changelog.Debian.gz differ diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/config.py b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/config.py index 7911299..af41540 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/config.py +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/config.py @@ -231,7 +231,7 @@ class Config(): # The function to use to fetch the parameter, the parameter's # name and the default value. values = ((configParser.getint, "fontSize", 17), - (configParser.getint, "artFontSize", 14), + (configParser.getint, "artFontSize", 24), (configParser.getint, "expiry", 24), (configParser.getboolean, "autoupdate", False), (configParser.getboolean, "woodchuck", True), @@ -246,13 +246,17 @@ class Config(): (configParser.getboolean, "theme", True), (configParser.get, "feedsort", "Manual")) + newSetting = False for fetcher, name, default in values: try: v = fetcher(section, name) except Exception: + newSetting = True logger.exception("Reading config variable %s", name) v = default self.config[name] = v + if newSetting: + self.saveConfig() def saveConfig(self): configParser = RawConfigParser() @@ -297,8 +301,12 @@ class Config(): def getFontSize(self): return self.config["fontSize"] + def setFontSize(self, value): + self.config["fontSize"] = value def getArtFontSize(self): return self.config["artFontSize"] + def setArtFontSize(self, value): + self.config["artFontSize"] = value def getExpiry(self): return self.config["expiry"] def setExpiry(self, expiry): diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/feedingit.py b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/feedingit.py index 2b63a19..9d70a3c 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/feedingit.py +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/feedingit.py @@ -73,6 +73,16 @@ class Controller(QtCore.QObject): #onlyUnread = arguments.get("onlyUnread","False") return self._handler.generateArticlesXml(key, config.getHideReadArticles()) + @QtCore.Slot(str,str,result=str) + def getNextId(self, key, articleid): + feed = listing.getFeed(key) + return feed.getNextId(articleid) + + @QtCore.Slot(str,str,result=str) + def getPreviousId(self, key, articleid): + feed = listing.getFeed(key) + return feed.getPreviousId(articleid) + @QtCore.Slot(result=str) def getCategoryXml(self): return self._handler.generateCategoryXml() @@ -181,6 +191,15 @@ class Controller(QtCore.QObject): else: return 'True' + @QtCore.Slot(str, result=int) + def getIntSetting(self, setting): + if (setting == "artFontSize"): + return config.getArtFontSize() + elif (setting == "fontSize" ): + return config.getFontSize() + else: + return -1 + @QtCore.Slot(str, bool) def setBooleanSetting(self, setting, value): if (setting == "theme"): @@ -194,6 +213,14 @@ class Controller(QtCore.QObject): elif (setting == "autoupdate"): config.setAutoUpdateEnabled(value) config.saveConfig() + + @QtCore.Slot(str, int) + def setIntSetting(self, setting, value): + if (setting == "artFontSize"): + config.setArtFontSize(value) + elif (setting == "fontSize" ): + config.setFontSize(value) + config.saveConfig() @QtCore.Slot(str, str) def share(self, key, articleid): diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleDisplay.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleDisplay.qml index e014865..638fefb 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleDisplay.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleDisplay.qml @@ -17,7 +17,7 @@ Rectangle { height: parent.height; width: webView.width; contentWidth: webView.width*webView.scale; //Math.max(screen.width,webView.width*webView.scale) - contentHeight: Math.max(articleViewer.height,webView.height*webView.scale) + contentHeight: Math.max(articleView.height,webView.height*webView.scale) //contentWidth: childrenRect.width; contentHeight: childrenRect.height interactive: parent.vertPanningEnabled; @@ -32,7 +32,7 @@ Rectangle { //scale: 1.25; transformOrigin: Item.TopLeft scale: slider.value; - //settings.defaultFontSize: 24 + settings.defaultFontSize: articleView.webviewFontSize } // onFlickStarted: { diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleViewer.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleViewer.qml index f4a18a9..4d93576 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleViewer.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/ArticleViewer.qml @@ -8,10 +8,12 @@ Item { property string feedid: parent.feedid //property string feedid: "61ac1458d761423344998dc76770e36e" //articlesItem.feedid; //property string hideReadArticles: ""; - property alias articleShown: articleView.visible; + //property alias articleShown: articleView.visible; property bool zoomEnabled: false; property bool vertPanningEnabled: true + signal openArticle(string articleid); + function modulo(x,y) { // Fixes modulo for negative numbers return ((x%y)+y)%y; @@ -22,20 +24,6 @@ Item { 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(); - } - } - function markAllAsRead() { if (feedid!="") { controller.markAllAsRead(feedid) @@ -61,22 +49,23 @@ Item { clip: true } - ListView { - id: articleView; - model: articles; - delegate: viewer - orientation: ListView.Horizontal - width: parent.width; - height: updateBarArticles.visible? parent.height-updateBarArticles.height : parent.height; - visible: false; z:8 - onCurrentIndexChanged: articlesView.positionViewAtIndex(currentIndex, ListView.Contain) - highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem - //cacheBuffer: 5; - onMovementStarted: articleViewer.vertPanningEnabled=false; - onMovementEnded: articleViewer.vertPanningEnabled=true; - highlightMoveDuration: 300; - clip: true - } +// ListView { +// id: articleView; +// property int webviewFontSize: settings.webviewFontSize +// model: articles; +// delegate: viewer +// orientation: ListView.Horizontal +// width: parent.width; +// height: updateBarArticles.visible? parent.height-updateBarArticles.height : parent.height; +// visible: false; z:8 +// onCurrentIndexChanged: articleView.positionViewAtIndex(currentIndex, ListView.Contain) +// highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem +// //cacheBuffer: 5; +// onMovementStarted: articleViewer.vertPanningEnabled=false; +// onMovementEnded: articleViewer.vertPanningEnabled=true; +// highlightMoveDuration: 300; +// clip: true +// } ProgressBar { id: updateBarArticles @@ -165,41 +154,44 @@ Item { font.pointSize: settings.articleListingTextSize } MouseArea { anchors.fill: listItem; - onClicked: { articleView.currentIndex = index; articleView.visible = true; } + onClicked: { + articleViewer.openArticle(articleid) + //articleView.currentIndex = index; articleView.visible = true; + } } } } - Component { - id: viewer - Item { - id: flipItem; - width: articleDisplay.width; - height: articleView.height; - - //property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; - property string html: controller.getArticle(articleViewer.feedid, articleid) - ArticleDisplay { - id: 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=path; - controller.setEntryRead(articleViewer.feedid, articleid) - } - } - } - ] - } - } - } +// Component { +// id: viewer +// Item { +// id: flipItem; +// width: articleDisplay.width; +// height: articleView.height; + +// //property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; +// property string html: controller.getArticle(articleViewer.feedid, articleid) +// ArticleDisplay { +// id: 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=path; +// controller.setEntryRead(articleViewer.feedid, articleid) +// } +// } +// } +// ] +// } +// } +// } XmlListModel { id: articles diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/Articles.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/Articles.qml index f3bffe3..91248f0 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/Articles.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/Articles.qml @@ -1,79 +1,282 @@ import Qt 4.7 +import com.nokia.meego 1.0 +import QtWebKit 1.0 Item { - //anchors.fill: parent; - width: parent.width; - property string feedid : "" - property alias count: articles.count - property alias url: articles.source + id: articlePage + property int buffer: 60 + property string feedid: parent.feedid + property bool zoomEnabled: false + property bool vertPanningEnabled: true + width: parent.width; height: parent.height; + property int webviewFontSize: settings.webviewFontSize - x: parent.width; height: parent.height; - anchors.top: parent.top; anchors.bottom: parent.bottom - - function getArticleid(index) { - return articles.get(index).articleid + function next() { + if (flickableFront.state == "visible") { + flickableBack.moveFromRight(); + } else { + flickableFront.moveFromRight(); + } } - function reload() { - //articlesModel.reload() + function prev() { + if (flickableFront.state == "visible") { + flickableBack.moveFromLeft(); + } else { + flickableFront.moveFromLeft(); + } } - ListView { - id: articleList; model: articlesModel; delegate: articleDelegate; z: 6 - width: parent.width; height: parent.height; /*x: 0;*/ - cacheBuffer: 100; - flickDeceleration: 1500 + Component.onCompleted: { + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); } - XmlListModel { - id: articles + Flickable { + id: flickableFront + //anchors.fill: screen; + height: articlePage.height; + width: articlePage.width; + contentWidth: boundsRecFront.width + contentHeight: boundsRecFront.height + boundsBehavior: Flickable.StopAtBounds + //contentWidth: childrenRect.width; contentHeight: childrenRect.height + //interactive: parent.vertPanningEnabled; + + flickDeceleration: 2500; + //flickableDirection: Flickable.VerticalFlick + + property bool contentIsReady: false + Rectangle { + id: boundsRecFront + color: "white" + width: webViewFront.html == "" ? articlePage.width : webViewFront.width*webViewFront.scale + 2*buffer + height: Math.max(articlePage.height,webViewFront.height*webViewFront.scale) + + WebView { + id: webViewFront + anchors.horizontalCenter: parent.horizontalCenter + //url: flipItem.url; + preferredWidth: articlePage.width + //preferredHeight: articleView.height + //scale: 1.25; + transformOrigin: Item.TopLeft + //scale: slider.value; + settings.defaultFontSize: articlePage.webviewFontSize + + onLoadFinished: { + flickableFront.contentX = buffer + controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId) + //flickable.width/2 + flickableFront.contentIsReady = true + } + + + } + + } + + state: "visible" + + states: [ State { + name: "visible"; + PropertyChanges { target: flickableFront; x: 0; } + }, State { + name: "toRight"; + PropertyChanges { target: flickableFront; x: boundsRecBack.width; } + }, State { + name: "toLeft"; + PropertyChanges { target: flickableFront; x: -boundsRecFront.width; } + } + ] + + transitions: [ + Transition { + from: "visible"; + PropertyAnimation { target: flickableFront + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + }, + Transition { + to: "visible"; + PropertyAnimation { target: flickableFront + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + } + ] + + function moveFromLeft() { + flickableFront.contentIsReady = false + articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toLeft" + state = "visible" + flickableBack.state = "toRight" + } + + function moveFromRight() { + flickableFront.contentIsReady = false + articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toRight" + state = "visible" + flickableBack.state = "toLeft" + } + + Behavior on contentX { + id: contentXBehavior + enabled: flickableFront.contentIsReady + NumberAnimation { duration: 200 } + } + onMovingHorizontallyChanged: { + if (!movingHorizontally && (!atXBeginning || !atXEnd)) { + flickableFront.contentX = buffer //flickable.width/2 + } + } + + onAtXBeginningChanged: { + if (atXBeginning && contentIsReady) { + flickableBack.moveFromLeft() + } + } - source: feedid == "" ? "" : "http://localhost:8000/articles/" + feedid + "?onlyUnread=" + hideReadArticles - query: "/xml/article" + onAtXEndChanged: { + if (atXEnd && contentIsReady) { + //console.log("next") + flickableBack.moveFromRight() + } + } - 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} } - Component { - id: articleDelegate - - Item { - id: wrapper; width: wrapper.ListView.view.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: (model.article.unread=="True") ? "white" : "#7b97fd"; - width: wrapper.width; wrapMode: Text.WordWrap; font.bold: false; + + Flickable { + id: flickableBack + //anchors.fill: screen; + height: articlePage.height; + width: articlePage.width; + contentWidth: boundsRecBack.width + contentHeight: boundsRecBack.height + boundsBehavior: Flickable.StopAtBounds + + //contentWidth: childrenRect.width; contentHeight: childrenRect.height + //interactive: parent.vertPanningEnabled; + + flickDeceleration: 2500; + //flickableDirection: Flickable.VerticalFlick + + property bool contentIsReady: false + Rectangle { + id: boundsRecBack + color: "white" + width: webViewBack.html == "" ? articlePage.width : webViewBack.width*webViewBack.scale + 2*buffer // flickable.width + height: Math.max(articlePage.height,webViewBack.height*webViewBack.scale) + + WebView { + id: webViewBack + anchors.horizontalCenter: parent.horizontalCenter + //url: flipItem.url; + //html: controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + preferredWidth: articlePage.width + //preferredHeight: articleView.height + //scale: 1.25; + transformOrigin: Item.TopLeft + //scale: slider.value; + settings.defaultFontSize: articlePage.webviewFontSize + + onLoadFinished: { + flickableBack.contentX = buffer + controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId) + flickableBack.contentIsReady = true } -// Rectangle { -// x: 3; y: 4; width: 77; height: 77; color: "#ff0000"; smooth: true + } + } -// } + state: "toRight" -// Column { -// x: 3; + states: [ State { + name: "visible"; + PropertyChanges { target: flickableBack; x: 0; } + }, State { + name: "toRight"; + PropertyChanges { target: flickableBack; x: boundsRecFront.width; } + }, State { + name: "toLeft"; + PropertyChanges { target: flickableBack; x: -boundsRecBack.width; } + } + ] -// width: wrapper.width - 3; y: 5; spacing: 2 -// height: parent.height; -// Text { Rectangle {anchors.fill: parent; color: "white"; opacity: 0.5;} -// verticalAlignment: Text.AlignVCenter; text: model.article.title; color: (model.article.unread=="True") ? "white" : "#7b97fd"; width: parent.width; wrapMode: Text.WordWrap; font.bold: false; /*elide: Text.ElideRight;*/ /*style: Text.Raised;*/ styleColor: "black"; } -// //Text { text: feedname; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } -// } + transitions: [ + Transition { + from: "visible"; + PropertyAnimation { target: flickableBack + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + }, + Transition { + to: "visible"; + PropertyAnimation { target: flickableBack + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } } - MouseArea { - anchors.fill: wrapper; - onClicked: { - container.articleClicked(model.article.articleid, index) - } + ] + + function moveFromLeft() { + flickableBack.contentIsReady = false + articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) + webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toLeft" + state = "visible" + flickableFront.state = "toRight" + } + + function moveFromRight() { + flickableBack.contentIsReady = false + articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) + webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toRight" + state = "visible" + flickableFront.state = "toLeft" + } + + Behavior on contentX { + id: contentXBehaviorBack + enabled: flickableBack.contentIsReady + NumberAnimation { duration: 200 } + } + + onMovingHorizontallyChanged: { + if (!movingHorizontally && (!atXBeginning || !atXEnd)) { + flickableBack.contentX = buffer //flickable.width/2 + } + } + + onAtXBeginningChanged: { + if (atXBeginning && contentIsReady) { + flickableFront.moveFromLeft() + } + } + + onAtXEndChanged: { + if (atXEnd && contentIsReady) { + flickableFront.moveFromRight() } } + } + ProgressBar { + id: updateBarArticles + minimumValue: 0 + maximumValue: 100 + value: window.updateProgressValue + visible: window.isUpdateInProgress + width: parent.width + anchors.bottom: parent.bottom } + ListModel { + id: articlesModel + + + + } } diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/main.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/main.qml index 6e34573..0b47445 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/main.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/qml/main.qml @@ -12,6 +12,7 @@ PageStackWindow { signal articlesReloadRequest() signal addFileSignal(string fullname, string filename) + property string articleid property string feedid property string catid @@ -197,7 +198,7 @@ PageStackWindow { id: feedsItem onFeedClicked: { window.feedid = feedid - pageStack.push(articlesPage) + pageStack.push(articlesListPage) } } @@ -225,63 +226,93 @@ PageStackWindow { } Component { - id: articlesPage + id: articlesListPage Page { - tools: articleTools + tools: articleListTools property string feedid: window.feedid + ArticleViewer { id: flipper + + onOpenArticle: { + window.articleid = articleid + pageStack.push(articleViewPage) + } } ToolBarLayout { - id: articleTools + id: articleListTools visible: false ToolIcon { iconId: "toolbar-back"; onClicked: { myArticlesMenu.close(); - if (flipper.articleShown) { - flipper.reload() - flipper.articleShown = false; - } else { - window.feedReloadRequest(); - pageStack.pop(); - } + window.feedReloadRequest(); + pageStack.pop(); + } + } + + ToolIcon { + platformIconId: "toolbar-view-menu" + anchors.right: (parent === undefined) ? undefined : parent.right + onClicked: (myArticlesMenu.status == DialogStatus.Closed) ? myArticlesMenu.open() : myArticlesMenu.close() + } + } + Connections { + target: window + onArticlesReloadRequest: flipper.reload() + } + } + } + + Component { + id: articleViewPage + Page { + tools: articleTools + property string feedid: window.feedid + + + Articles { + id: articlePage + property string mainArticleId: window.articleid; + } + + ToolBarLayout { + id: articleTools + visible: false + ToolIcon { iconId: "toolbar-back"; + onClicked: { + window.articlesReloadRequest(); + pageStack.pop(); } } ToolIcon { platformIconId: "toolbar-previous" - visible: flipper.articleShown - //anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: flipper.prev(); + onClicked: articlePage.prev(); } ToolIcon { platformIconId: "toolbar-share" - visible: flipper.articleShown - //anchors.right: (parent === undefined) ? undefined : parent.right onClicked: { - controller.share(window.feedid, flipper.getCurrentArticleId()); + controller.share(window.feedid, articlePage.mainArticleId); } } ToolIcon { platformIconId: "toolbar-next" - visible: flipper.articleShown - //anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: flipper.next() + onClicked: articlePage.next() } - ToolIcon { - platformIconId: "toolbar-view-menu" - anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: (myArticlesMenu.status == DialogStatus.Closed) ? myArticlesMenu.open() : myArticlesMenu.close() - } +// ToolIcon { +// platformIconId: "toolbar-view-menu" +// anchors.right: (parent === undefined) ? undefined : parent.right +// onClicked: (myArticlesMenu.status == DialogStatus.Closed) ? myArticlesMenu.open() : myArticlesMenu.close() +// } } - Connections { - target: window - onArticlesReloadRequest: flipper.reload() - } +// Connections { +// target: window +// onArticlesReloadRequest: flipper.reload() +// } } } @@ -356,20 +387,20 @@ PageStackWindow { //text: "This is an info banner with no icon" } - Item { - AutomaticUpdate { - id: autoUpdate - } - - Connections { - target: settings - onAutoUpdateEnabledChanged: { - if (!settings.autoUpdateEnabled) { - autoUpdate.stop(); - } else { - autoUpdate.start(); - } - } - } - } +// Item { +// AutomaticUpdate { +// id: autoUpdate +// } + +// Connections { +// target: settings +// onAutoUpdateEnabledChanged: { +// if (!settings.autoUpdateEnabled) { +// autoUpdate.stop(); +// } else { +// autoUpdate.start(); +// } +// } +// } +// } } diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/rss_sqlite.py b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/rss_sqlite.py index 867e1af..ff0fcba 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/rss_sqlite.py +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/feedingit/usr/share/feedingit/rss_sqlite.py @@ -814,17 +814,17 @@ class Feed(BaseObject): #ids.reverse() return ids - def getNextId(self, id, forward=True): + def getNextId(self, id, forward=True, onlyUnread=False): if forward: delta = 1 else: delta = -1 - ids = self.getIds() + ids = self.getIds(onlyUnread=onlyUnread) index = ids.index(id) return ids[(index + delta) % len(ids)] - def getPreviousId(self, id): - return self.getNextId(id, forward=False) + def getPreviousId(self, id, onlyUnread=False): + return self.getNextId(id, forward=False, onlyUnread=onlyUnread) def getNumberOfUnreadItems(self): return self.db.execute("SELECT count(*) FROM feed WHERE read=0;").fetchone()[0] diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/rules b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/rules index 68ebf16..e51a5b1 100755 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/rules +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/debian/rules @@ -1,7 +1,7 @@ #!/usr/bin/make -f # This file was automatically generated by stdeb 0.6.0+git at -# Thu, 05 Jan 2012 20:58:44 -0800 +# Sun, 15 Jan 2012 12:25:53 -0800 %: dh $@ --with python2 --buildsystem=python_distutils diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/config.py b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/config.py index 7911299..af41540 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/config.py +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/config.py @@ -231,7 +231,7 @@ class Config(): # The function to use to fetch the parameter, the parameter's # name and the default value. values = ((configParser.getint, "fontSize", 17), - (configParser.getint, "artFontSize", 14), + (configParser.getint, "artFontSize", 24), (configParser.getint, "expiry", 24), (configParser.getboolean, "autoupdate", False), (configParser.getboolean, "woodchuck", True), @@ -246,13 +246,17 @@ class Config(): (configParser.getboolean, "theme", True), (configParser.get, "feedsort", "Manual")) + newSetting = False for fetcher, name, default in values: try: v = fetcher(section, name) except Exception: + newSetting = True logger.exception("Reading config variable %s", name) v = default self.config[name] = v + if newSetting: + self.saveConfig() def saveConfig(self): configParser = RawConfigParser() @@ -297,8 +301,12 @@ class Config(): def getFontSize(self): return self.config["fontSize"] + def setFontSize(self, value): + self.config["fontSize"] = value def getArtFontSize(self): return self.config["artFontSize"] + def setArtFontSize(self, value): + self.config["artFontSize"] = value def getExpiry(self): return self.config["expiry"] def setExpiry(self, expiry): diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/feedingit.py b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/feedingit.py index 2b63a19..9d70a3c 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/feedingit.py +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/feedingit.py @@ -73,6 +73,16 @@ class Controller(QtCore.QObject): #onlyUnread = arguments.get("onlyUnread","False") return self._handler.generateArticlesXml(key, config.getHideReadArticles()) + @QtCore.Slot(str,str,result=str) + def getNextId(self, key, articleid): + feed = listing.getFeed(key) + return feed.getNextId(articleid) + + @QtCore.Slot(str,str,result=str) + def getPreviousId(self, key, articleid): + feed = listing.getFeed(key) + return feed.getPreviousId(articleid) + @QtCore.Slot(result=str) def getCategoryXml(self): return self._handler.generateCategoryXml() @@ -181,6 +191,15 @@ class Controller(QtCore.QObject): else: return 'True' + @QtCore.Slot(str, result=int) + def getIntSetting(self, setting): + if (setting == "artFontSize"): + return config.getArtFontSize() + elif (setting == "fontSize" ): + return config.getFontSize() + else: + return -1 + @QtCore.Slot(str, bool) def setBooleanSetting(self, setting, value): if (setting == "theme"): @@ -194,6 +213,14 @@ class Controller(QtCore.QObject): elif (setting == "autoupdate"): config.setAutoUpdateEnabled(value) config.saveConfig() + + @QtCore.Slot(str, int) + def setIntSetting(self, setting, value): + if (setting == "artFontSize"): + config.setArtFontSize(value) + elif (setting == "fontSize" ): + config.setFontSize(value) + config.saveConfig() @QtCore.Slot(str, str) def share(self, key, articleid): diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/rss_sqlite.py b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/rss_sqlite.py index 867e1af..ff0fcba 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/rss_sqlite.py +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/pysrc/rss_sqlite.py @@ -814,17 +814,17 @@ class Feed(BaseObject): #ids.reverse() return ids - def getNextId(self, id, forward=True): + def getNextId(self, id, forward=True, onlyUnread=False): if forward: delta = 1 else: delta = -1 - ids = self.getIds() + ids = self.getIds(onlyUnread=onlyUnread) index = ids.index(id) return ids[(index + delta) % len(ids)] - def getPreviousId(self, id): - return self.getNextId(id, forward=False) + def getPreviousId(self, id, onlyUnread=False): + return self.getNextId(id, forward=False, onlyUnread=onlyUnread) def getNumberOfUnreadItems(self): return self.db.execute("SELECT count(*) FROM feed WHERE read=0;").fetchone()[0] diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleDisplay.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleDisplay.qml index e014865..638fefb 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleDisplay.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleDisplay.qml @@ -17,7 +17,7 @@ Rectangle { height: parent.height; width: webView.width; contentWidth: webView.width*webView.scale; //Math.max(screen.width,webView.width*webView.scale) - contentHeight: Math.max(articleViewer.height,webView.height*webView.scale) + contentHeight: Math.max(articleView.height,webView.height*webView.scale) //contentWidth: childrenRect.width; contentHeight: childrenRect.height interactive: parent.vertPanningEnabled; @@ -32,7 +32,7 @@ Rectangle { //scale: 1.25; transformOrigin: Item.TopLeft scale: slider.value; - //settings.defaultFontSize: 24 + settings.defaultFontSize: articleView.webviewFontSize } // onFlickStarted: { diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleViewer.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleViewer.qml index f4a18a9..4d93576 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleViewer.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/ArticleViewer.qml @@ -8,10 +8,12 @@ Item { property string feedid: parent.feedid //property string feedid: "61ac1458d761423344998dc76770e36e" //articlesItem.feedid; //property string hideReadArticles: ""; - property alias articleShown: articleView.visible; + //property alias articleShown: articleView.visible; property bool zoomEnabled: false; property bool vertPanningEnabled: true + signal openArticle(string articleid); + function modulo(x,y) { // Fixes modulo for negative numbers return ((x%y)+y)%y; @@ -22,20 +24,6 @@ Item { 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(); - } - } - function markAllAsRead() { if (feedid!="") { controller.markAllAsRead(feedid) @@ -61,22 +49,23 @@ Item { clip: true } - ListView { - id: articleView; - model: articles; - delegate: viewer - orientation: ListView.Horizontal - width: parent.width; - height: updateBarArticles.visible? parent.height-updateBarArticles.height : parent.height; - visible: false; z:8 - onCurrentIndexChanged: articlesView.positionViewAtIndex(currentIndex, ListView.Contain) - highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem - //cacheBuffer: 5; - onMovementStarted: articleViewer.vertPanningEnabled=false; - onMovementEnded: articleViewer.vertPanningEnabled=true; - highlightMoveDuration: 300; - clip: true - } +// ListView { +// id: articleView; +// property int webviewFontSize: settings.webviewFontSize +// model: articles; +// delegate: viewer +// orientation: ListView.Horizontal +// width: parent.width; +// height: updateBarArticles.visible? parent.height-updateBarArticles.height : parent.height; +// visible: false; z:8 +// onCurrentIndexChanged: articleView.positionViewAtIndex(currentIndex, ListView.Contain) +// highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem +// //cacheBuffer: 5; +// onMovementStarted: articleViewer.vertPanningEnabled=false; +// onMovementEnded: articleViewer.vertPanningEnabled=true; +// highlightMoveDuration: 300; +// clip: true +// } ProgressBar { id: updateBarArticles @@ -165,41 +154,44 @@ Item { font.pointSize: settings.articleListingTextSize } MouseArea { anchors.fill: listItem; - onClicked: { articleView.currentIndex = index; articleView.visible = true; } + onClicked: { + articleViewer.openArticle(articleid) + //articleView.currentIndex = index; articleView.visible = true; + } } } } - Component { - id: viewer - Item { - id: flipItem; - width: articleDisplay.width; - height: articleView.height; - - //property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; - property string html: controller.getArticle(articleViewer.feedid, articleid) - ArticleDisplay { - id: 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=path; - controller.setEntryRead(articleViewer.feedid, articleid) - } - } - } - ] - } - } - } +// Component { +// id: viewer +// Item { +// id: flipItem; +// width: articleDisplay.width; +// height: articleView.height; + +// //property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; +// property string html: controller.getArticle(articleViewer.feedid, articleid) +// ArticleDisplay { +// id: 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=path; +// controller.setEntryRead(articleViewer.feedid, articleid) +// } +// } +// } +// ] +// } +// } +// } XmlListModel { id: articles diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/Articles.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/Articles.qml index f3bffe3..91248f0 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/Articles.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/Articles.qml @@ -1,79 +1,282 @@ import Qt 4.7 +import com.nokia.meego 1.0 +import QtWebKit 1.0 Item { - //anchors.fill: parent; - width: parent.width; - property string feedid : "" - property alias count: articles.count - property alias url: articles.source + id: articlePage + property int buffer: 60 + property string feedid: parent.feedid + property bool zoomEnabled: false + property bool vertPanningEnabled: true + width: parent.width; height: parent.height; + property int webviewFontSize: settings.webviewFontSize - x: parent.width; height: parent.height; - anchors.top: parent.top; anchors.bottom: parent.bottom - - function getArticleid(index) { - return articles.get(index).articleid + function next() { + if (flickableFront.state == "visible") { + flickableBack.moveFromRight(); + } else { + flickableFront.moveFromRight(); + } } - function reload() { - //articlesModel.reload() + function prev() { + if (flickableFront.state == "visible") { + flickableBack.moveFromLeft(); + } else { + flickableFront.moveFromLeft(); + } } - ListView { - id: articleList; model: articlesModel; delegate: articleDelegate; z: 6 - width: parent.width; height: parent.height; /*x: 0;*/ - cacheBuffer: 100; - flickDeceleration: 1500 + Component.onCompleted: { + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); } - XmlListModel { - id: articles + Flickable { + id: flickableFront + //anchors.fill: screen; + height: articlePage.height; + width: articlePage.width; + contentWidth: boundsRecFront.width + contentHeight: boundsRecFront.height + boundsBehavior: Flickable.StopAtBounds + //contentWidth: childrenRect.width; contentHeight: childrenRect.height + //interactive: parent.vertPanningEnabled; + + flickDeceleration: 2500; + //flickableDirection: Flickable.VerticalFlick + + property bool contentIsReady: false + Rectangle { + id: boundsRecFront + color: "white" + width: webViewFront.html == "" ? articlePage.width : webViewFront.width*webViewFront.scale + 2*buffer + height: Math.max(articlePage.height,webViewFront.height*webViewFront.scale) + + WebView { + id: webViewFront + anchors.horizontalCenter: parent.horizontalCenter + //url: flipItem.url; + preferredWidth: articlePage.width + //preferredHeight: articleView.height + //scale: 1.25; + transformOrigin: Item.TopLeft + //scale: slider.value; + settings.defaultFontSize: articlePage.webviewFontSize + + onLoadFinished: { + flickableFront.contentX = buffer + controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId) + //flickable.width/2 + flickableFront.contentIsReady = true + } + + + } + + } + + state: "visible" + + states: [ State { + name: "visible"; + PropertyChanges { target: flickableFront; x: 0; } + }, State { + name: "toRight"; + PropertyChanges { target: flickableFront; x: boundsRecBack.width; } + }, State { + name: "toLeft"; + PropertyChanges { target: flickableFront; x: -boundsRecFront.width; } + } + ] + + transitions: [ + Transition { + from: "visible"; + PropertyAnimation { target: flickableFront + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + }, + Transition { + to: "visible"; + PropertyAnimation { target: flickableFront + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + } + ] + + function moveFromLeft() { + flickableFront.contentIsReady = false + articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toLeft" + state = "visible" + flickableBack.state = "toRight" + } + + function moveFromRight() { + flickableFront.contentIsReady = false + articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toRight" + state = "visible" + flickableBack.state = "toLeft" + } + + Behavior on contentX { + id: contentXBehavior + enabled: flickableFront.contentIsReady + NumberAnimation { duration: 200 } + } + onMovingHorizontallyChanged: { + if (!movingHorizontally && (!atXBeginning || !atXEnd)) { + flickableFront.contentX = buffer //flickable.width/2 + } + } + + onAtXBeginningChanged: { + if (atXBeginning && contentIsReady) { + flickableBack.moveFromLeft() + } + } - source: feedid == "" ? "" : "http://localhost:8000/articles/" + feedid + "?onlyUnread=" + hideReadArticles - query: "/xml/article" + onAtXEndChanged: { + if (atXEnd && contentIsReady) { + //console.log("next") + flickableBack.moveFromRight() + } + } - 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} } - Component { - id: articleDelegate - - Item { - id: wrapper; width: wrapper.ListView.view.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: (model.article.unread=="True") ? "white" : "#7b97fd"; - width: wrapper.width; wrapMode: Text.WordWrap; font.bold: false; + + Flickable { + id: flickableBack + //anchors.fill: screen; + height: articlePage.height; + width: articlePage.width; + contentWidth: boundsRecBack.width + contentHeight: boundsRecBack.height + boundsBehavior: Flickable.StopAtBounds + + //contentWidth: childrenRect.width; contentHeight: childrenRect.height + //interactive: parent.vertPanningEnabled; + + flickDeceleration: 2500; + //flickableDirection: Flickable.VerticalFlick + + property bool contentIsReady: false + Rectangle { + id: boundsRecBack + color: "white" + width: webViewBack.html == "" ? articlePage.width : webViewBack.width*webViewBack.scale + 2*buffer // flickable.width + height: Math.max(articlePage.height,webViewBack.height*webViewBack.scale) + + WebView { + id: webViewBack + anchors.horizontalCenter: parent.horizontalCenter + //url: flipItem.url; + //html: controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + preferredWidth: articlePage.width + //preferredHeight: articleView.height + //scale: 1.25; + transformOrigin: Item.TopLeft + //scale: slider.value; + settings.defaultFontSize: articlePage.webviewFontSize + + onLoadFinished: { + flickableBack.contentX = buffer + controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId) + flickableBack.contentIsReady = true } -// Rectangle { -// x: 3; y: 4; width: 77; height: 77; color: "#ff0000"; smooth: true + } + } -// } + state: "toRight" -// Column { -// x: 3; + states: [ State { + name: "visible"; + PropertyChanges { target: flickableBack; x: 0; } + }, State { + name: "toRight"; + PropertyChanges { target: flickableBack; x: boundsRecFront.width; } + }, State { + name: "toLeft"; + PropertyChanges { target: flickableBack; x: -boundsRecBack.width; } + } + ] -// width: wrapper.width - 3; y: 5; spacing: 2 -// height: parent.height; -// Text { Rectangle {anchors.fill: parent; color: "white"; opacity: 0.5;} -// verticalAlignment: Text.AlignVCenter; text: model.article.title; color: (model.article.unread=="True") ? "white" : "#7b97fd"; width: parent.width; wrapMode: Text.WordWrap; font.bold: false; /*elide: Text.ElideRight;*/ /*style: Text.Raised;*/ styleColor: "black"; } -// //Text { text: feedname; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } -// } + transitions: [ + Transition { + from: "visible"; + PropertyAnimation { target: flickableBack + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + }, + Transition { + to: "visible"; + PropertyAnimation { target: flickableBack + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } } - MouseArea { - anchors.fill: wrapper; - onClicked: { - container.articleClicked(model.article.articleid, index) - } + ] + + function moveFromLeft() { + flickableBack.contentIsReady = false + articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) + webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toLeft" + state = "visible" + flickableFront.state = "toRight" + } + + function moveFromRight() { + flickableBack.contentIsReady = false + articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) + webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toRight" + state = "visible" + flickableFront.state = "toLeft" + } + + Behavior on contentX { + id: contentXBehaviorBack + enabled: flickableBack.contentIsReady + NumberAnimation { duration: 200 } + } + + onMovingHorizontallyChanged: { + if (!movingHorizontally && (!atXBeginning || !atXEnd)) { + flickableBack.contentX = buffer //flickable.width/2 + } + } + + onAtXBeginningChanged: { + if (atXBeginning && contentIsReady) { + flickableFront.moveFromLeft() + } + } + + onAtXEndChanged: { + if (atXEnd && contentIsReady) { + flickableFront.moveFromRight() } } + } + ProgressBar { + id: updateBarArticles + minimumValue: 0 + maximumValue: 100 + value: window.updateProgressValue + visible: window.isUpdateInProgress + width: parent.width + anchors.bottom: parent.bottom } + ListModel { + id: articlesModel + + + + } } diff --git a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/main.qml b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/main.qml index 6e34573..0b47445 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/main.qml +++ b/psa_harmattan/feedingit/deb_dist/feedingit-0.1.0/qml/main.qml @@ -12,6 +12,7 @@ PageStackWindow { signal articlesReloadRequest() signal addFileSignal(string fullname, string filename) + property string articleid property string feedid property string catid @@ -197,7 +198,7 @@ PageStackWindow { id: feedsItem onFeedClicked: { window.feedid = feedid - pageStack.push(articlesPage) + pageStack.push(articlesListPage) } } @@ -225,63 +226,93 @@ PageStackWindow { } Component { - id: articlesPage + id: articlesListPage Page { - tools: articleTools + tools: articleListTools property string feedid: window.feedid + ArticleViewer { id: flipper + + onOpenArticle: { + window.articleid = articleid + pageStack.push(articleViewPage) + } } ToolBarLayout { - id: articleTools + id: articleListTools visible: false ToolIcon { iconId: "toolbar-back"; onClicked: { myArticlesMenu.close(); - if (flipper.articleShown) { - flipper.reload() - flipper.articleShown = false; - } else { - window.feedReloadRequest(); - pageStack.pop(); - } + window.feedReloadRequest(); + pageStack.pop(); + } + } + + ToolIcon { + platformIconId: "toolbar-view-menu" + anchors.right: (parent === undefined) ? undefined : parent.right + onClicked: (myArticlesMenu.status == DialogStatus.Closed) ? myArticlesMenu.open() : myArticlesMenu.close() + } + } + Connections { + target: window + onArticlesReloadRequest: flipper.reload() + } + } + } + + Component { + id: articleViewPage + Page { + tools: articleTools + property string feedid: window.feedid + + + Articles { + id: articlePage + property string mainArticleId: window.articleid; + } + + ToolBarLayout { + id: articleTools + visible: false + ToolIcon { iconId: "toolbar-back"; + onClicked: { + window.articlesReloadRequest(); + pageStack.pop(); } } ToolIcon { platformIconId: "toolbar-previous" - visible: flipper.articleShown - //anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: flipper.prev(); + onClicked: articlePage.prev(); } ToolIcon { platformIconId: "toolbar-share" - visible: flipper.articleShown - //anchors.right: (parent === undefined) ? undefined : parent.right onClicked: { - controller.share(window.feedid, flipper.getCurrentArticleId()); + controller.share(window.feedid, articlePage.mainArticleId); } } ToolIcon { platformIconId: "toolbar-next" - visible: flipper.articleShown - //anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: flipper.next() + onClicked: articlePage.next() } - ToolIcon { - platformIconId: "toolbar-view-menu" - anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: (myArticlesMenu.status == DialogStatus.Closed) ? myArticlesMenu.open() : myArticlesMenu.close() - } +// ToolIcon { +// platformIconId: "toolbar-view-menu" +// anchors.right: (parent === undefined) ? undefined : parent.right +// onClicked: (myArticlesMenu.status == DialogStatus.Closed) ? myArticlesMenu.open() : myArticlesMenu.close() +// } } - Connections { - target: window - onArticlesReloadRequest: flipper.reload() - } +// Connections { +// target: window +// onArticlesReloadRequest: flipper.reload() +// } } } @@ -356,20 +387,20 @@ PageStackWindow { //text: "This is an info banner with no icon" } - Item { - AutomaticUpdate { - id: autoUpdate - } - - Connections { - target: settings - onAutoUpdateEnabledChanged: { - if (!settings.autoUpdateEnabled) { - autoUpdate.stop(); - } else { - autoUpdate.start(); - } - } - } - } +// Item { +// AutomaticUpdate { +// id: autoUpdate +// } + +// Connections { +// target: settings +// onAutoUpdateEnabledChanged: { +// if (!settings.autoUpdateEnabled) { +// autoUpdate.stop(); +// } else { +// autoUpdate.start(); +// } +// } +// } +// } } diff --git a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.debian.tar.gz b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.debian.tar.gz index 42ee4a6..8db33e3 100644 Binary files a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.debian.tar.gz and b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.debian.tar.gz differ diff --git a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.dsc b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.dsc index 6dfb132..2045d25 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.dsc +++ b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1.dsc @@ -7,11 +7,11 @@ Maintainer: Slocan Standards-Version: 3.9.1 Build-Depends: python-all (>= 2.6.6-3), debhelper (>= 7.4.3) Checksums-Sha1: - e22e0955ddccc6762aa03b7d1f5baebacebb0ebb 199505 feedingit_0.1.0.orig.tar.gz - 883b59ceea4aa57b5c83cbe38b679feeb87a2c79 886 feedingit_0.1.0-1.debian.tar.gz + d795a1cb78e275c831eea74842574537fb69e4f9 200714 feedingit_0.1.0.orig.tar.gz + 2799695eb289f5ee7a38864c32622002e4b0bff0 889 feedingit_0.1.0-1.debian.tar.gz Checksums-Sha256: - edc0b7c4b001d19e3ecf9615642bffdddcdcabe375d6cabdeb4dfbe395303980 199505 feedingit_0.1.0.orig.tar.gz - 27904d190182f50bca80bcdbd18773325ab7b79cccede4659f3ec042e3582753 886 feedingit_0.1.0-1.debian.tar.gz + 07f6b92f52bde99c639de1a0a814812201d1d6bb2a4f9d0dc54c49857d8193c2 200714 feedingit_0.1.0.orig.tar.gz + b4bac709694df947deeb708649449a71655f4f88079be65d2095c88936dc2bc2 889 feedingit_0.1.0-1.debian.tar.gz Files: - 25b45241279c8c856489cd0d6a13ffab 199505 feedingit_0.1.0.orig.tar.gz - f93ba4e3ec741aabbd3a0c320f9862fa 886 feedingit_0.1.0-1.debian.tar.gz + 8d2360ef533ff170a5617f134e8a55ac 200714 feedingit_0.1.0.orig.tar.gz + 2a03c4254fd462719e7a3c23a3d7ad80 889 feedingit_0.1.0-1.debian.tar.gz diff --git a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_all.deb b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_all.deb index 796b2e9..132857d 100644 Binary files a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_all.deb and b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_all.deb differ diff --git a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_i386.changes b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_i386.changes index 1777770..f94d5ee 100644 --- a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_i386.changes +++ b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0-1_i386.changes @@ -1,5 +1,5 @@ Format: 1.8 -Date: Thu, 05 Jan 2012 20:58:44 -0800 +Date: Sun, 15 Jan 2012 12:25:53 -0800 Source: feedingit Binary: feedingit Architecture: all @@ -15,8 +15,8 @@ Changes: . * source package automatically created by stdeb 0.6.0+git Checksums-Sha1: - 147b11cafcf8b0c652325c30dcb84540795f9e59 187912 feedingit_0.1.0-1_all.deb + 1c3e0eedea08a2a5ec8e6227d4782615dcb9e5b4 189310 feedingit_0.1.0-1_all.deb Checksums-Sha256: - fe4e11203b4e3cc25ec905172cc0c5acd92a236b2492a547ff088bbece0f243a 187912 feedingit_0.1.0-1_all.deb + 4c8975cb001ea18d093a7e21067144e7a4d1f409b844ee710ee15764198ab794 189310 feedingit_0.1.0-1_all.deb Files: - a91028946c0bc0b43bb2645a9a32f972 187912 user/network optional feedingit_0.1.0-1_all.deb + e77e2be34526d585924db07424c21ce0 189310 user/network optional feedingit_0.1.0-1_all.deb diff --git a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0.orig.tar.gz b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0.orig.tar.gz index 4477927..68853ad 100644 Binary files a/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0.orig.tar.gz and b/psa_harmattan/feedingit/deb_dist/feedingit_0.1.0.orig.tar.gz differ diff --git a/psa_harmattan/feedingit/qml/ArticleViewer.qml b/psa_harmattan/feedingit/qml/ArticleViewer.qml index 82ad870..4d93576 100644 --- a/psa_harmattan/feedingit/qml/ArticleViewer.qml +++ b/psa_harmattan/feedingit/qml/ArticleViewer.qml @@ -24,20 +24,6 @@ Item { 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(); - } - } - function markAllAsRead() { if (feedid!="") { controller.markAllAsRead(feedid) diff --git a/psa_harmattan/feedingit/qml/Articles.qml b/psa_harmattan/feedingit/qml/Articles.qml index 671b536..5019df4 100644 --- a/psa_harmattan/feedingit/qml/Articles.qml +++ b/psa_harmattan/feedingit/qml/Articles.qml @@ -5,61 +5,30 @@ import QtWebKit 1.0 Item { id: articlePage property int buffer: 60 - property string mainArticleId: parent.mainArticleId; property string feedid: parent.feedid property bool zoomEnabled: false property bool vertPanningEnabled: true width: parent.width; height: parent.height; property int webviewFontSize: settings.webviewFontSize - - - Flipable { - id: flipable - front: flickableBack - back: flickableFront - - width: parent.width - height: parent.height - - property bool flipped: false - property int targetAngle: 0 - - state: "back" - - transform: Rotation { - id: rotation - origin.x: flipable.width/2 - origin.y: flipable.height/2 - axis.x: 0; axis.y: 1; axis.z: 0 // set axis.y to 1 to rotate around y-axis - angle: 0 // the default angle - } - - states: [State { - name: "back" - PropertyChanges { target: rotation; angle: 180 } - when: flipable.flipped - }, State { - name: "front" - PropertyChanges { target: rotation; angle: 0 } - when: !flipable.flipped - }] - - transitions: Transition { - NumberAnimation { target: rotation; property: "angle"; easing.type: Easing.InOutQuad; duration: 500 } + function next() { + if (flickableFront.state == "visible") { + flickableBack.moveFromRight(); + } else { + flickableFront.moveFromRight(); } + } - function flipRight() { - targetAngle = rotation.angle + 180 - flipable.flipped = !flipable.flipped - //flipped = !flipped + function prev() { + if (flickableFront.state == "visible") { + flickableBack.moveFromLeft(); + } else { + flickableFront.moveFromLeft(); } + } - function flipLeft() { - targetAngle = rotation.angle - 180 - flipable.flipped = !flipable.flipped - //flipped = !flipped - } + Component.onCompleted: { + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); } Flickable { @@ -69,24 +38,24 @@ Item { width: articlePage.width; contentWidth: boundsRecFront.width contentHeight: boundsRecFront.height + boundsBehavior: Flickable.StopAtBounds //contentWidth: childrenRect.width; contentHeight: childrenRect.height //interactive: parent.vertPanningEnabled; - flickDeceleration: 1500; + flickDeceleration: 5000; //flickableDirection: Flickable.VerticalFlick property bool contentIsReady: false Rectangle { id: boundsRecFront color: "white" - width: webViewFront.width*webViewFront.scale + 2*buffer + width: webViewFront.html == "" ? articlePage.width : webViewFront.width*webViewFront.scale + 2*buffer height: Math.max(articlePage.height,webViewFront.height*webViewFront.scale) WebView { id: webViewFront anchors.horizontalCenter: parent.horizontalCenter //url: flipItem.url; - html: controller.getArticle(articlePage.feedid, articlePage.mainArticleId); preferredWidth: articlePage.width //preferredHeight: articleView.height //scale: 1.25; @@ -95,19 +64,64 @@ Item { settings.defaultFontSize: articlePage.webviewFontSize onLoadFinished: { - flickableFront.contentX = buffer //flickable.width/2 + flickableFront.contentX = buffer + controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId) + //flickable.width/2 flickableFront.contentIsReady = true - flipable.flipRight(); } } - // onFlickStarted: { - // console.log("start contentx"+contentX) - // console.log("start contenty"+contentY) - // } } + + state: "visible" + + states: [ State { + name: "visible"; + PropertyChanges { target: flickableFront; x: 0; } + }, State { + name: "toRight"; + PropertyChanges { target: flickableFront; x: boundsRecBack.width; } + }, State { + name: "toLeft"; + PropertyChanges { target: flickableFront; x: -boundsRecFront.width; } + } + ] + + transitions: [ + Transition { + from: "visible"; + PropertyAnimation { target: flickableFront + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + }, + Transition { + to: "visible"; + PropertyAnimation { target: flickableFront + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + } + ] + + function moveFromLeft() { + flickableFront.contentIsReady = false + articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toLeft" + state = "visible" + flickableBack.state = "toRight" + } + + function moveFromRight() { + flickableFront.contentIsReady = false + articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) + webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toRight" + state = "visible" + flickableBack.state = "toLeft" + } + Behavior on contentX { id: contentXBehavior enabled: flickableFront.contentIsReady @@ -121,37 +135,17 @@ Item { onAtXBeginningChanged: { if (atXBeginning && contentIsReady) { - flickableBack.contentIsReady = false - //console.log("previous") - articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) -// if (flipable.side == Flipable.Back) { -// webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } else { - webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } - //flickableBack.contentY = 0 - flickableFront.contentX = buffer - //flipable.flipped = !flipable.flipped - //flipable.flipLeft() + flickableBack.moveFromLeft() } } onAtXEndChanged: { if (atXEnd && contentIsReady) { //console.log("next") - flickableBack.contentIsReady = false - articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) -// if (flipable.side == Flipable.Back) { -// webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } else { - webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } - //flickableBack.contentY = 0 - flickableFront.contentX = buffer - //flipable.flipped = !flipable.flipped - //flipable.flipRight(); + flickableBack.moveFromRight() } } + } @@ -162,23 +156,26 @@ Item { width: articlePage.width; contentWidth: boundsRecBack.width contentHeight: boundsRecBack.height + boundsBehavior: Flickable.StopAtBounds + //contentWidth: childrenRect.width; contentHeight: childrenRect.height //interactive: parent.vertPanningEnabled; - flickDeceleration: 1500; + flickDeceleration: 5000; //flickableDirection: Flickable.VerticalFlick property bool contentIsReady: false Rectangle { id: boundsRecBack color: "white" - width: webViewBack.width*webViewBack.scale + 2*buffer // flickable.width + width: webViewBack.html == "" ? articlePage.width : webViewBack.width*webViewBack.scale + 2*buffer // flickable.width height: Math.max(articlePage.height,webViewBack.height*webViewBack.scale) WebView { id: webViewBack anchors.horizontalCenter: parent.horizontalCenter //url: flipItem.url; + //html: controller.getArticle(articlePage.feedid, articlePage.mainArticleId); preferredWidth: articlePage.width //preferredHeight: articleView.height //scale: 1.25; @@ -187,24 +184,66 @@ Item { settings.defaultFontSize: articlePage.webviewFontSize onLoadFinished: { - flickableBack.contentX = buffer //flickable.width/2 + flickableBack.contentX = buffer + controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId) flickableBack.contentIsReady = true - flipable.flipRight(); } + } + } - + state: "toRight" + + states: [ State { + name: "visible"; + PropertyChanges { target: flickableBack; x: 0; } + }, State { + name: "toRight"; + PropertyChanges { target: flickableBack; x: boundsRecFront.width; } + }, State { + name: "toLeft"; + PropertyChanges { target: flickableBack; x: -boundsRecBack.width; } } + ] + + transitions: [ + Transition { + from: "visible"; + PropertyAnimation { target: flickableBack + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + }, + Transition { + to: "visible"; + PropertyAnimation { target: flickableBack + easing.type: Easing.InOutSine + properties: "x"; duration: 1000 } + } + ] + + function moveFromLeft() { + flickableBack.contentIsReady = false + articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) + webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toLeft" + state = "visible" + flickableFront.state = "toRight" + } - // onFlickStarted: { - // console.log("start contentx"+contentX) - // console.log("start contenty"+contentY) - // } + function moveFromRight() { + flickableBack.contentIsReady = false + articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) + webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); + state = "toRight" + state = "visible" + flickableFront.state = "toLeft" } + Behavior on contentX { id: contentXBehaviorBack enabled: flickableBack.contentIsReady NumberAnimation { duration: 200 } } + onMovingHorizontallyChanged: { if (!movingHorizontally && (!atXBeginning || !atXEnd)) { flickableBack.contentX = buffer //flickable.width/2 @@ -213,71 +252,17 @@ Item { onAtXBeginningChanged: { if (atXBeginning && contentIsReady) { - flickableFront.contentIsReady = false - //console.log("previous") - articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId) -// if (flipable.side == Flipable.Back) { - webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } else { -// webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } - //flickableFront.contentY = 0 - //flickableBack.contentX = buffer - //flipable.flipped = !flipable.flipped - //flipable.flipLeft() + flickableFront.moveFromLeft() } } onAtXEndChanged: { if (atXEnd && contentIsReady) { - flickableFront.contentIsReady = false - //console.log("next") - articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId) -// if (flipable.side == Flipable.Back) { - webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } else { -// webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId); -// } - //flickableFront.contentY = 0 - //flickableBack.contentX = buffer - //flipable.flipped = !flipable.flipped - //flipable.flipRight(); + flickableFront.moveFromRight() } } } - - -// ListView { -// id: articleView; -// model: articlesModel; -// delegate: viewer; -// property int webviewFontSize: settings.webviewFontSize -// orientation: ListView.Horizontal -// width: parent.width; -// height: updateBarArticles.visible? parent.height-updateBarArticles.height : parent.height; -// //onCurrentIndexChanged: articleView.positionViewAtIndex(currentIndex, ListView.Contain) -// highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem -// cacheBuffer: width; -// onMovementStarted: articlePage.vertPanningEnabled=false; -// onMovementEnded: articlePage.vertPanningEnabled=true; -// highlightMoveDuration: 300; -// clip: true -// boundsBehavior: Flickable.DragOverBounds - -// onCurrentIndexChanged: { -// if (currentIndex >= count-1) { -// articlesModel.append({articleid: controller.getNextId(feedid, articlesModel.get(currentIndex).articleid)}) -// } -// } - -// onCountChanged: { -// if (count == 3) { -// articleView.currentIndex = 1 -// } -// } -// } - ProgressBar { id: updateBarArticles minimumValue: 0 @@ -294,54 +279,4 @@ Item { } - - Component { - id: viewer - Item { - id: flipItem; - width: articleDisplay.width; - height: articleView.height; - - //property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; - property string html: controller.getArticle(articlePage.feedid, articleid) - ArticleDisplay { - id: articleDisplay - zoomEnabled: articlePage.zoomEnabled; - property bool vertPanningEnabled: articlePage.vertPanningEnabled; - - states: [ State { - name: 'articleIsRead'; - when: articleView.currentIndex == index; - StateChangeScript { - name: "myScript" - script: { - //flipItem.url=path; - controller.setEntryRead(articlePage.feedid, articleid) -// if (articlesModel.count==1) { -// timer.start() -// } - } - } - } - ] - } - } - } - - Component.onCompleted: { - articlesModel.append({articleid: mainArticleId}) - //articlesModel.append({articleid: controller.getPreviousId(feedid, mainArticleId)}) - - //articleView.currentIndex = 1 - } - -// Timer { -// id: timer -// interval: 500; running: false; repeat: false -// onTriggered: { -// articlesModel.insert(0,{articleid: controller.getNextId(feedid, mainArticleId)}) -// articlesModel.append({articleid: controller.getPreviousId(feedid, mainArticleId)}) -// } -// } - } diff --git a/psa_harmattan/feedingit/qml/main.qml b/psa_harmattan/feedingit/qml/main.qml index efae8d7..0b47445 100644 --- a/psa_harmattan/feedingit/qml/main.qml +++ b/psa_harmattan/feedingit/qml/main.qml @@ -246,13 +246,8 @@ PageStackWindow { ToolIcon { iconId: "toolbar-back"; onClicked: { myArticlesMenu.close(); -// if (flipper.articleShown) { -// flipper.reload() -// flipper.articleShown = false; -// } else { - window.feedReloadRequest(); - pageStack.pop(); -// } + window.feedReloadRequest(); + pageStack.pop(); } } @@ -274,9 +269,11 @@ PageStackWindow { Page { tools: articleTools property string feedid: window.feedid - property string mainArticleId: window.articleid + Articles { + id: articlePage + property string mainArticleId: window.articleid; } ToolBarLayout { @@ -284,34 +281,27 @@ PageStackWindow { visible: false ToolIcon { iconId: "toolbar-back"; onClicked: { - myArticlesMenu.close(); window.articlesReloadRequest(); pageStack.pop(); } } -// ToolIcon { -// platformIconId: "toolbar-previous" -// visible: flipper.articleShown -// //anchors.right: (parent === undefined) ? undefined : parent.right -// onClicked: flipper.prev(); -// } + ToolIcon { + platformIconId: "toolbar-previous" + onClicked: articlePage.prev(); + } -// ToolIcon { -// platformIconId: "toolbar-share" -// visible: flipper.articleShown -// //anchors.right: (parent === undefined) ? undefined : parent.right -// onClicked: { -// controller.share(window.feedid, mainArticleId); -// } -// } + ToolIcon { + platformIconId: "toolbar-share" + onClicked: { + controller.share(window.feedid, articlePage.mainArticleId); + } + } -// ToolIcon { -// platformIconId: "toolbar-next" -// visible: article.articleShown -// //anchors.right: (parent === undefined) ? undefined : parent.right -// onClicked: flipper.next() -// } + ToolIcon { + platformIconId: "toolbar-next" + onClicked: articlePage.next() + } // ToolIcon { // platformIconId: "toolbar-view-menu"