Use kdelibs coding style
This commit is contained in:
parent
0084798a2c
commit
d965371d23
31 changed files with 201 additions and 234 deletions
|
|
@ -17,13 +17,11 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DANBOORU_H
|
||||
#define DANBOORU_H
|
||||
|
||||
#include "libdanbooru_version.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief The Danbooru namespace.
|
||||
* @file danbooru.h
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "danboorupool.h"
|
||||
|
||||
namespace Danbooru
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DANBOORUPOOL_H
|
||||
#define DANBOORUPOOL_H
|
||||
|
||||
|
|
@ -104,6 +103,6 @@ public:
|
|||
|
||||
} // namespace Danbooru
|
||||
|
||||
Q_DECLARE_METATYPE(Danbooru::DanbooruPool*)
|
||||
Q_DECLARE_METATYPE(Danbooru::DanbooruPool *)
|
||||
|
||||
#endif // DANBOORUPOOL_H
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
// Qt
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
|
@ -36,7 +35,7 @@ namespace Danbooru
|
|||
|
||||
const QMap<QString, DanbooruPost::Rating> DanbooruPost::RATING_MAP = initRatingMap();
|
||||
|
||||
DanbooruPost::DanbooruPost(QObject* parent): QObject(parent)
|
||||
DanbooruPost::DanbooruPost(QObject *parent): QObject(parent)
|
||||
{
|
||||
m_pixmap = QPixmap();
|
||||
m_tags = QSet<QString>();
|
||||
|
|
@ -48,7 +47,6 @@ DanbooruPost::DanbooruPost(QObject* parent): QObject(parent)
|
|||
m_rating = Questionable;
|
||||
}
|
||||
|
||||
|
||||
DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
|
||||
QObject *parent):
|
||||
QObject(parent),
|
||||
|
|
@ -149,7 +147,6 @@ const QUrl DanbooruPost::sampleUrl() const
|
|||
return m_sampleUrl;
|
||||
}
|
||||
|
||||
|
||||
QPixmap DanbooruPost::pixmap() const
|
||||
{
|
||||
return m_pixmap;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DANBOORUPOST_H
|
||||
#define DANBOORUPOST_H
|
||||
|
||||
|
|
@ -90,7 +89,6 @@ public:
|
|||
Q_DECLARE_FLAGS(Ratings, DanbooruPost::Rating)
|
||||
Q_ENUMS(Rating)
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QPixmap m_pixmap;
|
||||
|
|
@ -133,7 +131,7 @@ public:
|
|||
explicit DanbooruPost(QVariantMap postData, QPixmap pixmap = QPixmap(),
|
||||
QObject *parent = 0);
|
||||
|
||||
explicit DanbooruPost(QObject* parent = 0);
|
||||
explicit DanbooruPost(QObject *parent = 0);
|
||||
|
||||
/**
|
||||
* @brief Construct a Danbooru post from XML attributes
|
||||
|
|
@ -227,6 +225,5 @@ Q_DECLARE_METATYPE(Danbooru::DanbooruPost *)
|
|||
Q_DECLARE_METATYPE(Danbooru::DanbooruPost::Rating)
|
||||
Q_DECLARE_METATYPE(QSet<QString>)
|
||||
|
||||
|
||||
#endif // DANBOORUPOST_H
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
// STL
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -100,7 +99,6 @@ void DanbooruService::getPostList()
|
|||
|
||||
}
|
||||
|
||||
|
||||
void DanbooruService::getTagList(int limit, QString name)
|
||||
{
|
||||
QMap<QString, QString> parameters;
|
||||
|
|
@ -202,7 +200,7 @@ void DanbooruService::getPoolList()
|
|||
Q_EMIT(poolDownloadFinished());
|
||||
}
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +235,6 @@ void DanbooruService::getRelatedTags(const QStringList &tags,
|
|||
|
||||
// qCDebug(LIBDANBOORU) << "Final constructed related tag URL" << danbooruUrl;
|
||||
|
||||
|
||||
StoredTransferJob *job = KIO::storedGet(
|
||||
danbooruUrl, KIO::NoReload,
|
||||
KIO::HideProgressInfo
|
||||
|
|
@ -291,7 +288,6 @@ void DanbooruService::getRelatedTags(const QStringList &tags,
|
|||
|
||||
}
|
||||
|
||||
|
||||
const QSet< QString > DanbooruService::blacklist() const
|
||||
{
|
||||
return m_blacklist;
|
||||
|
|
@ -322,7 +318,6 @@ int DanbooruService::currentPage() const
|
|||
return m_currentPage;
|
||||
}
|
||||
|
||||
|
||||
const DanbooruPost::Ratings DanbooruService::maximumAllowedRating() const
|
||||
{
|
||||
|
||||
|
|
@ -347,7 +342,6 @@ void DanbooruService::nextPoolPage()
|
|||
getPoolList();
|
||||
}
|
||||
|
||||
|
||||
QStringList DanbooruService::postTags() const
|
||||
{
|
||||
return m_tags;
|
||||
|
|
@ -362,7 +356,8 @@ void DanbooruService::reset()
|
|||
|
||||
// Slots
|
||||
|
||||
void DanbooruService::processTagList(KJob *job) {
|
||||
void DanbooruService::processTagList(KJob *job)
|
||||
{
|
||||
|
||||
if (job->error()) {
|
||||
Q_EMIT(downloadError(job->errorString()));
|
||||
|
|
@ -387,7 +382,7 @@ void DanbooruService::processTagList(KJob *job) {
|
|||
QVariantMap map = element.toMap();
|
||||
DanbooruTag *tag = new DanbooruTag(map);
|
||||
|
||||
if(!tag) {
|
||||
if (!tag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -437,7 +432,6 @@ void DanbooruService::processPostList(KJob *job)
|
|||
|
||||
for (auto element : postList) {
|
||||
|
||||
|
||||
QVariantMap map = element.toMap();
|
||||
DanbooruPost *post = new DanbooruPost(map);
|
||||
|
||||
|
|
@ -469,7 +463,6 @@ void DanbooruService::processPostList(KJob *job)
|
|||
StoredTransferJob *pixmapJob = KIO::storedGet(post->thumbnailUrl(),
|
||||
KIO::NoReload, KIO::HideProgressInfo);
|
||||
|
||||
|
||||
// We don't want to overload the servers, so set some rational
|
||||
// priority
|
||||
|
||||
|
|
@ -523,7 +516,6 @@ void DanbooruService::processPostList(KJob *job)
|
|||
|
||||
}
|
||||
|
||||
|
||||
void DanbooruService::downloadAllTags(KJob *job)
|
||||
{
|
||||
Q_UNUSED(job)
|
||||
|
|
@ -554,7 +546,7 @@ void DanbooruService::setBlacklist(const QStringList &blacklist)
|
|||
|
||||
}
|
||||
|
||||
void DanbooruService::setBoardUrl(const QUrl& url)
|
||||
void DanbooruService::setBoardUrl(const QUrl &url)
|
||||
{
|
||||
m_url = url;
|
||||
}
|
||||
|
|
@ -579,7 +571,7 @@ void DanbooruService::setMaximumAllowedRating(DanbooruPost::Rating rating)
|
|||
|
||||
}
|
||||
|
||||
void DanbooruService::setUserName(const QString& username)
|
||||
void DanbooruService::setUserName(const QString &username)
|
||||
{
|
||||
if (username.isEmpty()) {
|
||||
return;
|
||||
|
|
@ -587,34 +579,36 @@ void DanbooruService::setUserName(const QString& username)
|
|||
m_username = username;
|
||||
}
|
||||
|
||||
void DanbooruService::setPassword(const QString& password)
|
||||
void DanbooruService::setPassword(const QString &password)
|
||||
{
|
||||
if(password.isEmpty()) {
|
||||
if (password.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_password = password;
|
||||
}
|
||||
|
||||
void DanbooruService::setPostTags(const QStringList& tags)
|
||||
void DanbooruService::setPostTags(const QStringList &tags)
|
||||
{
|
||||
if (!tags.isEmpty()) {
|
||||
m_tags = tags;
|
||||
}
|
||||
}
|
||||
|
||||
void DanbooruService::setImageCache(KImageCache* cache)
|
||||
void DanbooruService::setImageCache(KImageCache *cache)
|
||||
{
|
||||
m_cache = cache;
|
||||
}
|
||||
|
||||
void DanbooruService::setMaxPosts(int number) {
|
||||
void DanbooruService::setMaxPosts(int number)
|
||||
{
|
||||
|
||||
m_maxPosts = number < 100 ? number : 100;
|
||||
|
||||
}
|
||||
|
||||
void DanbooruService::setCurrentPage(int page) {
|
||||
void DanbooruService::setCurrentPage(int page)
|
||||
{
|
||||
m_currentPage = page;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DANBOORUSERVICE_H
|
||||
#define DANBOORUSERVICE_H
|
||||
|
||||
|
|
@ -102,7 +101,6 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
|
||||
/**
|
||||
* @brief Construct a default instance of the service.
|
||||
*
|
||||
|
|
@ -114,7 +112,7 @@ public:
|
|||
* @param parent The parent QObject
|
||||
*
|
||||
**/
|
||||
DanbooruService(QUrl boardUrl=QUrl(), QString username = QString(),
|
||||
DanbooruService(QUrl boardUrl = QUrl(), QString username = QString(),
|
||||
QString password = QString(), KImageCache *cache = 0,
|
||||
QObject *parent = 0);
|
||||
|
||||
|
|
@ -222,16 +220,16 @@ public:
|
|||
* @param blacklist A QSet<QString> including unwanted tags.
|
||||
*
|
||||
**/
|
||||
void setBlacklist(const QStringList& 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.
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* @brief Set the tag blacklist.
|
||||
*
|
||||
* If a tag is in the blacklist, posts tagged with it will not be downloaded.
|
||||
*
|
||||
**/
|
||||
|
||||
void setBlacklist(const QSet<QString>& blacklist);
|
||||
void setBlacklist(const QSet<QString> &blacklist);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum allowed rating for the board.
|
||||
|
|
@ -248,7 +246,7 @@ public:
|
|||
* @param url The URL to connect to.
|
||||
* @return void
|
||||
*/
|
||||
void setBoardUrl(const QUrl& url);
|
||||
void setBoardUrl(const QUrl &url);
|
||||
|
||||
/**
|
||||
* @brief Set an image cache to use.
|
||||
|
|
@ -264,7 +262,7 @@ public:
|
|||
* @param username The username to use.
|
||||
*
|
||||
**/
|
||||
void setUserName(const QString& username);
|
||||
void setUserName(const QString &username);
|
||||
|
||||
/**
|
||||
* @brief Set the password used for login.
|
||||
|
|
@ -276,14 +274,13 @@ public:
|
|||
* @param password The salted password to use.
|
||||
*
|
||||
**/
|
||||
void setPassword(const QString& password);
|
||||
void setPassword(const QString &password);
|
||||
|
||||
void setMaxPosts(int number);
|
||||
|
||||
void setCurrentPage(int page);
|
||||
|
||||
void setPostTags(const QStringList& tags);
|
||||
|
||||
void setPostTags(const QStringList &tags);
|
||||
|
||||
private Q_SLOTS:
|
||||
void processPostList(KJob *job);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "danboorutag.h"
|
||||
|
||||
namespace Danbooru
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DANBOORUTAG_H
|
||||
#define DANBOORUTAG_H
|
||||
|
||||
|
|
@ -78,5 +77,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(TagTypes)
|
|||
|
||||
Q_DECLARE_METATYPE(Danbooru::DanbooruTag *)
|
||||
|
||||
|
||||
#endif // DANBOORUTAG_H
|
||||
|
|
|
|||
|
|
@ -20,4 +20,3 @@
|
|||
#include "libdanbooru_debug.h"
|
||||
Q_LOGGING_CATEGORY(LIBDANBOORU, "org.dennogumi.libdanbooru")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
// Own
|
||||
|
||||
#include "utils.h"
|
||||
|
|
@ -69,7 +68,6 @@ QUrl requestUrl(QUrl &url, const QString &path,
|
|||
danbooruUrl.setPassword(password);
|
||||
}
|
||||
|
||||
|
||||
return danbooruUrl;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +116,7 @@ QUrl requestUrl(QUrl &url, const QString &path, const QString &username,
|
|||
return danbooruUrl;
|
||||
}
|
||||
|
||||
QList< QVariant > parseDanbooruResult(QByteArray data, QString xlmElement, bool* result)
|
||||
QList< QVariant > parseDanbooruResult(QByteArray data, QString xlmElement, bool *result)
|
||||
{
|
||||
|
||||
QXmlStreamReader reader;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue