Hook in the new pool page feature

I still need to fix the conflict between the pool and the post page...
This commit is contained in:
Luca Beltrame 2015-03-01 22:38:01 +01:00
parent feded2bdf3
commit b97ef73677
2 changed files with 20 additions and 2 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="danbooru_client" version="4">
<kpartgui name="danbooru_client" version="5">
<ToolBar name="mainToolBar" >
<text>Main Toolbar</text>
<Action name="connect" />
@ -9,6 +9,7 @@
<Action name="poolDownload" />
<Action name="tags" />
<Action name="morePosts" />
<Action name="morePools" />
<ActionList name="dynamicActionlist" />
</ToolBar>
<MenuBar>

View file

@ -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();
}
);
}