Start simplifying APIs
This commit is contained in:
parent
63d2dfdf9c
commit
f7f27699ca
13 changed files with 178 additions and 287 deletions
|
@ -22,37 +22,32 @@
|
|||
|
||||
namespace Danbooru {
|
||||
|
||||
DanbooruServiceBase::DanbooruServiceBase(QUrl boardUrl, QString username,
|
||||
QString password, KImageCache *cache,
|
||||
QObject *parent):
|
||||
DanbooruServiceBase::DanbooruServiceBase(QUrl boardUrl, QObject* parent):
|
||||
QObject(parent),
|
||||
m_url(boardUrl),
|
||||
m_username(username),
|
||||
m_password(password),
|
||||
m_maxRating(Danbooru::DanbooruPost::Safe),
|
||||
m_username(QString()),
|
||||
m_password(QString()),
|
||||
m_maxRating(Danbooru::Safe),
|
||||
m_maxPosts(10),
|
||||
m_currentPage(1),
|
||||
m_tags(QStringList()),
|
||||
m_postsToFetch(0),
|
||||
m_cache(cache){
|
||||
}
|
||||
|
||||
DanbooruServiceBase::~DanbooruServiceBase() {
|
||||
m_postsToFetch(0)
|
||||
{
|
||||
}
|
||||
|
||||
const QStringList DanbooruServiceBase::allowedRatings() const {
|
||||
|
||||
QStringList ratings;
|
||||
|
||||
if (m_maxRating.testFlag(DanbooruPost::Safe)) {
|
||||
if (m_maxRating.testFlag(Danbooru::Safe)) {
|
||||
ratings.append("Safe");
|
||||
}
|
||||
|
||||
if (m_maxRating.testFlag(DanbooruPost::Questionable)) {
|
||||
if (m_maxRating.testFlag(Danbooru::Questionable)) {
|
||||
ratings.append("Questionable");
|
||||
}
|
||||
|
||||
if (m_maxRating.testFlag(DanbooruPost::Explicit)) {
|
||||
if (m_maxRating.testFlag(Danbooru::Explicit)) {
|
||||
ratings.append("Explicit");
|
||||
}
|
||||
|
||||
|
@ -74,7 +69,7 @@ int DanbooruServiceBase::currentPage() const
|
|||
return m_currentPage;
|
||||
}
|
||||
|
||||
const DanbooruPost::Ratings DanbooruServiceBase::maximumAllowedRating() const
|
||||
const Danbooru::Ratings DanbooruServiceBase::maximumAllowedRating() const
|
||||
{
|
||||
return m_maxRating;
|
||||
}
|
||||
|
@ -151,19 +146,19 @@ void DanbooruServiceBase::setImageCache(KImageCache *cache)
|
|||
m_cache = cache;
|
||||
}
|
||||
|
||||
void DanbooruServiceBase::setMaximumAllowedRating(DanbooruPost::Rating rating)
|
||||
void DanbooruServiceBase::setMaximumAllowedRating(Danbooru::Rating rating)
|
||||
{
|
||||
DanbooruPost::Ratings flags;
|
||||
Danbooru::Ratings flags;
|
||||
|
||||
switch (rating) {
|
||||
case DanbooruPost::Safe:
|
||||
flags = DanbooruPost::Safe;
|
||||
case Danbooru::Safe:
|
||||
flags = Danbooru::Safe;
|
||||
break;
|
||||
case DanbooruPost::Questionable:
|
||||
flags = DanbooruPost::Safe | DanbooruPost::Questionable;
|
||||
case Danbooru::Questionable:
|
||||
flags = Danbooru::Safe | Danbooru::Questionable;
|
||||
break;
|
||||
case DanbooruPost::Explicit:
|
||||
flags = DanbooruPost::Safe | DanbooruPost::Questionable | DanbooruPost::Explicit;
|
||||
case Danbooru::Explicit:
|
||||
flags = Danbooru::Safe | Danbooru::Questionable | Danbooru::Explicit;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue