From b97ef73677f7b445b6473953c91e61cfb9388b0c Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sun, 1 Mar 2015 22:38:01 +0100 Subject: [PATCH] Hook in the new pool page feature I still need to fix the conflict between the pool and the post page... --- src/danbooru-clientui.rc | 3 ++- src/mainwindow.cpp | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/danbooru-clientui.rc b/src/danbooru-clientui.rc index 1045213..745eafc 100644 --- a/src/danbooru-clientui.rc +++ b/src/danbooru-clientui.rc @@ -1,6 +1,6 @@ - + Main Toolbar @@ -9,6 +9,7 @@ + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 012f19e..b785001 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -118,6 +118,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent) auto qmlViewPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, qApp->applicationName() + QLatin1String("/danbooruimageview.qml")); + qDebug() << qmlViewPath; QQmlContext *ctxt = m_view->rootContext(); ctxt->setContextProperty("danbooruModel", m_model); @@ -276,8 +277,10 @@ 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("go-next")), + QAction *nextPageAction = new QAction(QIcon::fromTheme(QLatin1String("go-next")), i18n("More posts"), this); + QAction *nextPoolAction = new QAction(QIcon::fromTheme(QLatin1String("go-next")), + i18n("More pools"), this); KDualAction* tagAction = new KDualAction(i18n("Show tags"), i18n("Hide tags"), this); tagAction->setIconForStates(QIcon::fromTheme(QLatin1String("tag"))); @@ -286,6 +289,7 @@ void DanbooruMainWindow::setupActions() findAction->setEnabled(false); poolAction->setEnabled(false); nextPageAction->setEnabled(false); + nextPoolAction->setEnabled(false); poolAction->setChecked(false); findAction->setChecked(false); @@ -297,6 +301,7 @@ void DanbooruMainWindow::setupActions() actionCollection()->addAction(QLatin1String("poolDownload"), poolAction); actionCollection()->addAction(QLatin1String("tags"), tagAction); actionCollection()->addAction(QLatin1String("morePosts"), nextPageAction); + actionCollection()->addAction(QLatin1String("morePools"), nextPoolAction); actionCollection()->setDefaultShortcut(connectAction, KStandardShortcut::Open); actionCollection()->setDefaultShortcut(findAction, KStandardShortcut::Find); @@ -318,14 +323,17 @@ void DanbooruMainWindow::setupActions() if (m_poolModel->rowCount() == 0) { m_service->getPoolList(); + } poolDockWidget->show(); + actionCollection()->action(QLatin1String("morePools"))->setEnabled(true); m_tableView->show(); } else { poolDockWidget->hide(); + actionCollection()->action(QLatin1String("morePools"))->setEnabled(false); m_tableView->hide(); } }); @@ -359,11 +367,20 @@ void DanbooruMainWindow::setupActions() }); connect(nextPageAction, &QAction::triggered, [this]() { + + if (m_model->rowCount() == 0) { + return; + } + QMetaObject::invokeMethod(m_view->rootObject(), "downloadStarted"); m_service->nextPostPage(); } ); + connect(nextPoolAction, &QAction::triggered, [this]() { + m_service->nextPoolPage(); + } + ); }