From 44d632258d5576f8cc53c348270a62f52b7b3945 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sat, 21 Feb 2015 11:33:08 +0100 Subject: [PATCH] Allow to configure infinite scrolling --- src/danboorusettings.kcfg | 5 +++ src/mainwindow.cpp | 4 +++ src/qml/danbooruimageview.qml | 6 ++-- src/ui/generalpage.ui | 68 ++++++++++++++++++++--------------- 4 files changed, 51 insertions(+), 32 deletions(-) diff --git a/src/danboorusettings.kcfg b/src/danboorusettings.kcfg index 0bb1de1..f50fcba 100644 --- a/src/danboorusettings.kcfg +++ b/src/danboorusettings.kcfg @@ -42,5 +42,10 @@ true + + + true + + \ No newline at end of file diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0c0a66e..2be4043 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -115,6 +115,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent) ctxt->setContextProperty("danbooruService", m_service); m_view->setSource(QUrl::fromLocalFile(qmlViewPath)); m_view->rootObject()->setProperty("poolMode", QVariant(false)); + ctxt->setContextProperty("infiniteScroll", DanbooruSettings::self()->infiniteScrolling()); statusBar()->addPermanentWidget(m_connectWidget); statusBar()->hide(); @@ -246,6 +247,9 @@ void DanbooruMainWindow::loadSettings() m_tagWidget->setBlackList(DanbooruSettings::self()->tagBlacklist()); + m_view->rootContext()->setContextProperty("infiniteScroll", + DanbooruSettings::self()->infiniteScrolling()); + } diff --git a/src/qml/danbooruimageview.qml b/src/qml/danbooruimageview.qml index ae33682..a2c3ad3 100644 --- a/src/qml/danbooruimageview.qml +++ b/src/qml/danbooruimageview.qml @@ -34,7 +34,6 @@ Rectangle { property bool poolMode: false; - KRun { id: runner } @@ -205,8 +204,9 @@ Rectangle { Component.onCompleted: { currentIndex = -1; forceActiveFocus()} onAtYEndChanged: { - if (grid.atYEnd && danbooruModel.rowCount > 0 && !rootObj.poolMode) { - danbooruService.nextPostPage() + + if (grid.atYEnd && danbooruModel.rowCount() > 0 && !rootObj.poolMode && infiniteScroll) { + danbooruService.nextPostPage(); } } diff --git a/src/ui/generalpage.ui b/src/ui/generalpage.ui index 130144f..0ff3419 100644 --- a/src/ui/generalpage.ui +++ b/src/ui/generalpage.ui @@ -36,14 +36,26 @@ true - - + + - Automatically download posts after connecting. - - - Automatically download posts + Only include posts up to this rating level. + + + Safe + + + + + Questionable + + + + + Explicit + + @@ -73,26 +85,24 @@ - - + + - Only include posts up to this rating level. + Automatically download posts after connecting. + + + Automatically download posts + + + + + + + Allow downloading new posts by simply scrolling to the end of the thumbnail view. + + + Enable infinite scrolling - - - Safe - - - - - Questionable - - - - - Explicit - - @@ -104,16 +114,16 @@ - - KEditListWidget - QWidget -
keditlistwidget.h
-
KComboBox QComboBox
kcombobox.h
+ + KEditListWidget + QWidget +
keditlistwidget.h
+