From 0200965e99eff4fad2c4ae9e6043766265b05396 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Fri, 13 Feb 2015 07:46:57 +0100 Subject: [PATCH] Add the missing method setBlacklist(const QStringList&) On top of that, make nextPostPage() Q_INVOKABLE so it can be used from QML. --- src/libdanbooru/danbooruservice.cpp | 15 +++++++++++++++ src/libdanbooru/danbooruservice.h | 21 ++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/libdanbooru/danbooruservice.cpp b/src/libdanbooru/danbooruservice.cpp index afe6a62..d298fcb 100644 --- a/src/libdanbooru/danbooruservice.cpp +++ b/src/libdanbooru/danbooruservice.cpp @@ -523,6 +523,21 @@ void DanbooruService::setBlacklist(const QSet< QString > &blacklist) } +void DanbooruService::setBlacklist(const QStringList &blacklist) +{ + + if (blacklist.isEmpty()) { + return; + } + + m_blacklist.clear(); + + for (auto element : blacklist) { + m_blacklist.insert(element); + } + +} + void DanbooruService::setBoardUrl(const QUrl& url) { m_url = url; diff --git a/src/libdanbooru/danbooruservice.h b/src/libdanbooru/danbooruservice.h index b06722e..6d764a2 100644 --- a/src/libdanbooru/danbooruservice.h +++ b/src/libdanbooru/danbooruservice.h @@ -198,7 +198,7 @@ public: **/ int maxPosts() const; - void nextPostPage(); + Q_INVOKABLE void nextPostPage(); QStringList postTags() const; @@ -210,7 +210,16 @@ public: * @param blacklist A QSet including unwanted tags. * @return void */ - void setBlacklist(const QSet &blacklist); + void setBlacklist(const QStringList& blacklist); + + /** + * @brief Set the tag blacklist. + * + * If a tag is in the blacklist, posts tagged with it will not be downloaded. + * + **/ + + void setBlacklist(const QSet& blacklist); /** * @brief Set the maximum allowed rating for the board. @@ -221,13 +230,7 @@ public: **/ void setMaximumAllowedRating(DanbooruPost::Rating rating); - /** - * @brief Set the tag blacklist. - * - * If a tag is in the blacklist, posts tagged with it will not be downloaded. - * - **/ - void setBlackList(QStringList blacklist); + /**