Allow downloading posts from the toolbar

This allows downloading if the QML area is not filled.

TODO: Configure infinite scrolling
This commit is contained in:
Luca Beltrame 2015-02-21 11:07:57 +01:00
parent db03bdbce2
commit 7b8214401b
3 changed files with 11 additions and 1 deletions

View file

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

View file

@ -117,6 +117,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
m_view->rootObject()->setProperty("poolMode", QVariant(false)); m_view->rootObject()->setProperty("poolMode", QVariant(false));
statusBar()->addPermanentWidget(m_connectWidget); statusBar()->addPermanentWidget(m_connectWidget);
statusBar()->hide();
setupDockWidgets(); setupDockWidgets();
@ -140,6 +141,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
actionCollection()->action(QLatin1String("find"))->setEnabled(true); actionCollection()->action(QLatin1String("find"))->setEnabled(true);
actionCollection()->action(QLatin1String("poolDownload"))->setEnabled(true); actionCollection()->action(QLatin1String("poolDownload"))->setEnabled(true);
actionCollection()->action(QLatin1String("tags"))->setEnabled(true); actionCollection()->action(QLatin1String("tags"))->setEnabled(true);
actionCollection()->action(QLatin1String("morePosts"))->setEnabled(true);
if (DanbooruSettings::self()->autoDownload()) { if (DanbooruSettings::self()->autoDownload()) {
m_view->rootObject()->setProperty("poolMode", QVariant(false)); m_view->rootObject()->setProperty("poolMode", QVariant(false));
@ -261,6 +263,8 @@ void DanbooruMainWindow::setupActions()
i18n("Search"), this); i18n("Search"), this);
KToggleAction *poolAction = new KToggleAction(QIcon::fromTheme(QLatin1String("image-x-generic")), KToggleAction *poolAction = new KToggleAction(QIcon::fromTheme(QLatin1String("image-x-generic")),
i18n("Pools"), this); 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); KDualAction* tagAction = new KDualAction(i18n("Show tags"), i18n("Hide tags"), this);
tagAction->setIconForStates(QIcon::fromTheme(QLatin1String("tag"))); tagAction->setIconForStates(QIcon::fromTheme(QLatin1String("tag")));
@ -268,6 +272,7 @@ void DanbooruMainWindow::setupActions()
fetchAction->setEnabled(false); fetchAction->setEnabled(false);
findAction->setEnabled(false); findAction->setEnabled(false);
poolAction->setEnabled(false); poolAction->setEnabled(false);
nextPageAction->setEnabled(false);
poolAction->setChecked(false); poolAction->setChecked(false);
findAction->setChecked(false); findAction->setChecked(false);
@ -278,6 +283,7 @@ void DanbooruMainWindow::setupActions()
actionCollection()->addAction(QLatin1String("find"), findAction); actionCollection()->addAction(QLatin1String("find"), findAction);
actionCollection()->addAction(QLatin1String("poolDownload"), poolAction); actionCollection()->addAction(QLatin1String("poolDownload"), poolAction);
actionCollection()->addAction(QLatin1String("tags"), tagAction); actionCollection()->addAction(QLatin1String("tags"), tagAction);
actionCollection()->addAction(QLatin1String("morePosts"), nextPageAction);
actionCollection()->setDefaultShortcut(connectAction, KStandardShortcut::Open); actionCollection()->setDefaultShortcut(connectAction, KStandardShortcut::Open);
actionCollection()->setDefaultShortcut(findAction, KStandardShortcut::Find); actionCollection()->setDefaultShortcut(findAction, KStandardShortcut::Find);
@ -339,6 +345,8 @@ void DanbooruMainWindow::setupActions()
}); });
connect(nextPageAction, &QAction::triggered, [this]() {m_service->nextPostPage();});
} }

View file

@ -42,6 +42,7 @@ public:
void clear(); void clear();
DanbooruPool* poolAt(int index) const; DanbooruPool* poolAt(int index) const;
private: private:
QVector<DanbooruPool *> m_items; QVector<DanbooruPool *> m_items;
static const QStringList m_headerNames; static const QStringList m_headerNames;