diff --git a/Content.qml b/Content.qml
index f43dae6..eda26ab 100644
--- a/Content.qml
+++ b/Content.qml
@@ -7,23 +7,54 @@ ScrollView {
property Post post
property int headLinefontSize: 23
property int textfontSize: 14
+ property int scrollJump: 48
+ property int pageJump: parent.height
style: ScrollViewStyle {
transientScrollBars: true
}
- function scrollDown() {
- flickableItem.contentY += 30
+ function scrollDown(jump) {
+ smoothScrolling.enabled = true
+
+ var top = Math.max(contentItem.height - parent.height, 0);
+
+ if(jump && flickableItem.contentY < top - jump) {
+ flickableItem.contentY += jump
+ } else {
+ flickableItem.contentY = top
+ }
}
- function scrollUp() {
+ function scrollUp(jump) {
+ smoothScrolling.enabled = true
+ if(jump && flickableItem.contentY >= jump) {
+ flickableItem.contentY -= jump;
+ } else {
+ flickableItem.contentY = 0;
+ }
+ }
+ Behavior on flickableItem.contentY {
+ id: smoothScrolling
+ enabled: false
+ NumberAnimation {
+ easing.type: Easing.OutCubic
+ }
}
Item {
height: column.height + 50
width: parent.parent.width
+ MouseArea {
+ onWheel: {
+ wheel.accepted = false
+ smoothScrolling.enabled = false
+ }
+ anchors.fill: parent
+ }
+
Rectangle {
anchors.fill: parent
width: parent.width
diff --git a/FeedMonkey.pro b/FeedMonkey.pro
index eaec577..bf28aa0 100644
--- a/FeedMonkey.pro
+++ b/FeedMonkey.pro
@@ -7,7 +7,10 @@ SOURCES += main.cpp \
tinytinyrsslogin.cpp \
post.cpp
-RESOURCES += qml.qrc
+RESOURCES += qml.qrc \
+ images.qrc
+
+RC_FILE = Icon.icns
# Needed for bringing browser from background to foreground using QDesktopServices: http://bugreports.qt-project.org/browse/QTBUG-8336
TARGET.CAPABILITY += SwEvent
diff --git a/images.qrc b/images.qrc
index 807350d..cda1bc1 100644
--- a/images.qrc
+++ b/images.qrc
@@ -1,2 +1,6 @@
-
-
+
+
+ feedthemonkey.xpm
+ Icon.icns
+
+
diff --git a/main.cpp b/main.cpp
index 9610c69..b85fa71 100644
--- a/main.cpp
+++ b/main.cpp
@@ -3,6 +3,7 @@
#include
#include
#include
+#include
#include "tinytinyrsslogin.h"
#include "tinytinyrss.h"
diff --git a/main.qml b/main.qml
index 972d249..e4eed9e 100644
--- a/main.qml
+++ b/main.qml
@@ -50,8 +50,22 @@ ApplicationWindow {
Keys.onRightPressed: sidebar.next()
Keys.onLeftPressed: sidebar.previous()
- Keys.onDownPressed: content.scrollDown()
- Keys.onUpPressed: content.scrollUp()
+ Keys.onDownPressed: content.scrollDown(content.scrollJump)
+ Keys.onUpPressed: content.scrollUp(content.scrollJump)
+ Keys.onSpacePressed: content.scrollDown(content.pageJump)
+ Keys.onEnterPressed: Qt.openUrlExternally(content.post.link)
+ Keys.onReturnPressed: Qt.openUrlExternally(content.post.link)
+ Keys.onPressed: {
+ if(event.key === Qt.Key_Home) {
+ content.scrollUp();
+ } else if (event.key === Qt.Key_End) {
+ content.scrollDown();
+ } else if (event.key === Qt.Key_PageUp) {
+ content.scrollUp(content.pageJump)
+ } else if (event.key === Qt.Key_PageDown) {
+ content.scrollDown(content.pageJump)
+ }
+ }
}
Login {