From 7b8214401b83b44d96e5691697125dbfc391fe15 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sat, 21 Feb 2015 11:07:57 +0100 Subject: [PATCH] Allow downloading posts from the toolbar This allows downloading if the QML area is not filled. TODO: Configure infinite scrolling --- src/danbooru-clientui.rc | 3 ++- src/mainwindow.cpp | 8 ++++++++ src/model/danboorupoolmodel.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/danbooru-clientui.rc b/src/danbooru-clientui.rc index b6fad12..1045213 100644 --- a/src/danbooru-clientui.rc +++ b/src/danbooru-clientui.rc @@ -1,6 +1,6 @@ - + Main Toolbar @@ -8,6 +8,7 @@ + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index aa1906f..060386c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -117,6 +117,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent) m_view->rootObject()->setProperty("poolMode", QVariant(false)); statusBar()->addPermanentWidget(m_connectWidget); + statusBar()->hide(); setupDockWidgets(); @@ -140,6 +141,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent) actionCollection()->action(QLatin1String("find"))->setEnabled(true); actionCollection()->action(QLatin1String("poolDownload"))->setEnabled(true); actionCollection()->action(QLatin1String("tags"))->setEnabled(true); + actionCollection()->action(QLatin1String("morePosts"))->setEnabled(true); if (DanbooruSettings::self()->autoDownload()) { m_view->rootObject()->setProperty("poolMode", QVariant(false)); @@ -261,6 +263,8 @@ void DanbooruMainWindow::setupActions() i18n("Search"), this); KToggleAction *poolAction = new KToggleAction(QIcon::fromTheme(QLatin1String("image-x-generic")), i18n("Pools"), this); + QAction* nextPageAction = new QAction(QIcon::fromTheme(QLatin1String("download")), + i18n("More posts"), this); KDualAction* tagAction = new KDualAction(i18n("Show tags"), i18n("Hide tags"), this); tagAction->setIconForStates(QIcon::fromTheme(QLatin1String("tag"))); @@ -268,6 +272,7 @@ void DanbooruMainWindow::setupActions() fetchAction->setEnabled(false); findAction->setEnabled(false); poolAction->setEnabled(false); + nextPageAction->setEnabled(false); poolAction->setChecked(false); findAction->setChecked(false); @@ -278,6 +283,7 @@ void DanbooruMainWindow::setupActions() actionCollection()->addAction(QLatin1String("find"), findAction); actionCollection()->addAction(QLatin1String("poolDownload"), poolAction); actionCollection()->addAction(QLatin1String("tags"), tagAction); + actionCollection()->addAction(QLatin1String("morePosts"), nextPageAction); actionCollection()->setDefaultShortcut(connectAction, KStandardShortcut::Open); actionCollection()->setDefaultShortcut(findAction, KStandardShortcut::Find); @@ -339,6 +345,8 @@ void DanbooruMainWindow::setupActions() }); + connect(nextPageAction, &QAction::triggered, [this]() {m_service->nextPostPage();}); + } diff --git a/src/model/danboorupoolmodel.h b/src/model/danboorupoolmodel.h index df038eb..44d6d5d 100644 --- a/src/model/danboorupoolmodel.h +++ b/src/model/danboorupoolmodel.h @@ -42,6 +42,7 @@ public: void clear(); DanbooruPool* poolAt(int index) const; + private: QVector m_items; static const QStringList m_headerNames;