Add a reset() function to reset the service to default settings
This commit is contained in:
parent
1b9c0adaa8
commit
aaf8adf560
2 changed files with 25 additions and 6 deletions
|
@ -377,6 +377,11 @@ QStringList DanbooruService::postTags() const
|
||||||
return m_tags;
|
return m_tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DanbooruService::reset()
|
||||||
|
{
|
||||||
|
m_currentPage = 1;
|
||||||
|
m_tags = QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
// Slots
|
// Slots
|
||||||
|
|
||||||
|
@ -435,7 +440,7 @@ void DanbooruService::processPostList(KJob *job)
|
||||||
|
|
||||||
QPixmap pix;
|
QPixmap pix;
|
||||||
|
|
||||||
qDebug() << "About to donwload images";
|
// qDebug() << "About to donwload images";
|
||||||
|
|
||||||
if (m_cache && m_cache->findPixmap(post->thumbnailUrl().url(), &pix)) {
|
if (m_cache && m_cache->findPixmap(post->thumbnailUrl().url(), &pix)) {
|
||||||
|
|
||||||
|
@ -565,11 +570,18 @@ void DanbooruService::setMaximumAllowedRating(DanbooruPost::Rating rating)
|
||||||
|
|
||||||
void DanbooruService::setUserName(const QString& username)
|
void DanbooruService::setUserName(const QString& username)
|
||||||
{
|
{
|
||||||
|
if (username.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_username = username;
|
m_username = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DanbooruService::setPassword(const QString& password)
|
void DanbooruService::setPassword(const QString& password)
|
||||||
{
|
{
|
||||||
|
if(password.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_password = password;
|
m_password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,7 +599,7 @@ void DanbooruService::setImageCache(KImageCache* cache)
|
||||||
|
|
||||||
void DanbooruService::setMaxPosts(int number) {
|
void DanbooruService::setMaxPosts(int number) {
|
||||||
|
|
||||||
m_maxPosts = number ? number < 100: 100;
|
m_maxPosts = number < 100 ? number : 100;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,10 +198,21 @@ public:
|
||||||
**/
|
**/
|
||||||
int maxPosts() const;
|
int maxPosts() const;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fetches the next page of posts.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
Q_INVOKABLE void nextPostPage();
|
Q_INVOKABLE void nextPostPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return A QStringList containing the currently-selected tags
|
||||||
|
*/
|
||||||
QStringList postTags() const;
|
QStringList postTags() const;
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set blacklisted tags.
|
* @brief Set blacklisted tags.
|
||||||
*
|
*
|
||||||
|
@ -230,9 +241,6 @@ public:
|
||||||
**/
|
**/
|
||||||
void setMaximumAllowedRating(DanbooruPost::Rating rating);
|
void setMaximumAllowedRating(DanbooruPost::Rating rating);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the board URL to connect to.
|
* @brief Set the board URL to connect to.
|
||||||
*
|
*
|
||||||
|
@ -241,7 +249,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void setBoardUrl(const QUrl& url);
|
void setBoardUrl(const QUrl& url);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set an image cache to use.
|
* @brief Set an image cache to use.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue