Hook maximum allowed rating into the configuration
I wonder if max posts should be a setter in DanbooruService...
This commit is contained in:
parent
2f8d935dd6
commit
e1045e1fa6
2 changed files with 12 additions and 3 deletions
|
@ -45,6 +45,12 @@
|
||||||
namespace Danbooru
|
namespace Danbooru
|
||||||
{
|
{
|
||||||
|
|
||||||
|
QHash<int, DanbooruPost::Rating> DanbooruMainWindow::ratingMap = {
|
||||||
|
{0, DanbooruPost::Safe},
|
||||||
|
{1, DanbooruPost::Questionable},
|
||||||
|
{2, DanbooruPost::Explicit}
|
||||||
|
};
|
||||||
|
|
||||||
DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
|
DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
|
||||||
: KXmlGuiWindow(parent),
|
: KXmlGuiWindow(parent),
|
||||||
m_view(new QQuickWidget(this)),
|
m_view(new QQuickWidget(this)),
|
||||||
|
@ -177,15 +183,16 @@ void DanbooruMainWindow::optionsPreferences()
|
||||||
KConfigDialog* dialog = new KConfigDialog(this, "danboorusettings",
|
KConfigDialog* dialog = new KConfigDialog(this, "danboorusettings",
|
||||||
DanbooruSettings::self());
|
DanbooruSettings::self());
|
||||||
|
|
||||||
auto prefs = DanbooruSettings::self();
|
dialog->addPage(new GeneralPage(DanbooruSettings::self(), this), i18n("General"),
|
||||||
qDebug() << prefs->boards() << "boards!";
|
"table");
|
||||||
dialog->addPage(new GeneralPage(DanbooruSettings::self(), this), i18n("General"));
|
|
||||||
connect(dialog, &KConfigDialog::settingsChanged, [this](){
|
connect(dialog, &KConfigDialog::settingsChanged, [this](){
|
||||||
auto preferences = DanbooruSettings::self();
|
auto preferences = DanbooruSettings::self();
|
||||||
qDebug() << preferences->boards();
|
qDebug() << preferences->boards();
|
||||||
qDebug() << preferences->cacheSize();
|
qDebug() << preferences->cacheSize();
|
||||||
qDebug() << preferences->maxPosts();
|
qDebug() << preferences->maxPosts();
|
||||||
qDebug() << preferences->tagBlacklist();
|
qDebug() << preferences->tagBlacklist();
|
||||||
|
qDebug() << preferences->maxRating();
|
||||||
|
m_service->setMaximumAllowedRating(ratingMap.value(preferences->maxRating()));
|
||||||
});
|
});
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <KSharedDataCache>
|
#include <KSharedDataCache>
|
||||||
#include <KImageCache>
|
#include <KImageCache>
|
||||||
|
|
||||||
|
#include "libdanbooru/danboorupost.h"
|
||||||
|
|
||||||
class QQuickWidget;
|
class QQuickWidget;
|
||||||
|
|
||||||
|
@ -75,6 +76,7 @@ private:
|
||||||
DanbooruService *m_service;
|
DanbooruService *m_service;
|
||||||
DanbooruConnectWidget *m_connectWidget;
|
DanbooruConnectWidget *m_connectWidget;
|
||||||
KImageCache *m_cache;
|
KImageCache *m_cache;
|
||||||
|
static QHash<int, DanbooruPost::Rating> ratingMap;
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace Danbooru
|
} // namespace Danbooru
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue