KUrl -> QUrl
This commit is contained in:
parent
0eb716bda0
commit
d7fec181e2
11 changed files with 66 additions and 63 deletions
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
// KDE
|
||||
|
||||
#include <kurl.h>
|
||||
#include <QUrl>
|
||||
|
||||
// Own
|
||||
|
||||
|
|
@ -50,8 +50,8 @@ DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
|
|||
m_height = postData.value("height").toString().toInt();
|
||||
m_width = postData.value("width").toString().toInt();
|
||||
|
||||
m_url = KUrl(postData.value("file_url").toUrl());
|
||||
m_thumbnailUrl = KUrl(postData.value("preview_url").toUrl());
|
||||
m_url = QUrl(postData.value("file_url").toUrl());
|
||||
m_thumbnailUrl = QUrl(postData.value("preview_url").toUrl());
|
||||
m_size = postData.value("file_size").toInt();
|
||||
m_rating = RATING_MAP.value(postData.value("rating").toString());
|
||||
|
||||
|
|
@ -67,8 +67,8 @@ DanbooruPost::DanbooruPost(QXmlStreamAttributes& postData, QPixmap pixmap, QObje
|
|||
m_height = postData.value("height").toString().toInt();
|
||||
m_width = postData.value("width").toString().toInt();
|
||||
|
||||
m_url = KUrl(postData.value("file_url").toString());
|
||||
m_thumbnailUrl = KUrl(postData.value("preview_url").toString());
|
||||
m_url = QUrl(postData.value("file_url").toString());
|
||||
m_thumbnailUrl = QUrl(postData.value("preview_url").toString());
|
||||
m_size = postData.value("file_size").toString().toInt();
|
||||
m_rating = RATING_MAP.value(postData.value("rating").toString());
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ const QSet< QString > DanbooruPost::tags() const
|
|||
return m_tags;
|
||||
}
|
||||
|
||||
const KUrl DanbooruPost::thumbnailUrl() const
|
||||
const QUrl DanbooruPost::thumbnailUrl() const
|
||||
{
|
||||
return m_thumbnailUrl;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ int DanbooruPost::size() const
|
|||
return m_size;
|
||||
}
|
||||
|
||||
const KUrl DanbooruPost::fileUrl() const
|
||||
const QUrl DanbooruPost::fileUrl() const
|
||||
{
|
||||
return m_url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
// KDE
|
||||
|
||||
#include <KUrl>
|
||||
#include <QUrl>
|
||||
|
||||
// Own
|
||||
|
||||
|
|
@ -73,9 +73,9 @@ namespace Danbooru {
|
|||
|
||||
Q_PROPERTY(const QPixmap pixmap READ pixmap WRITE setPixmap)
|
||||
Q_PROPERTY(int id READ id)
|
||||
Q_PROPERTY(KUrl fileUrl READ fileUrl)
|
||||
Q_PROPERTY(QUrl fileUrl READ fileUrl)
|
||||
Q_PROPERTY(QSet<QString> tags READ tags)
|
||||
Q_PROPERTY(KUrl thumbnailUrl READ thumbnailUrl)
|
||||
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl)
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -103,8 +103,8 @@ namespace Danbooru {
|
|||
int m_width;
|
||||
int m_size;
|
||||
|
||||
KUrl m_url;
|
||||
KUrl m_thumbnailUrl;
|
||||
QUrl m_url;
|
||||
QUrl m_thumbnailUrl;
|
||||
QSet<QString> m_tags;
|
||||
Ratings m_rating;
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ namespace Danbooru {
|
|||
/**
|
||||
* @return The URL to the post's image.
|
||||
**/
|
||||
const KUrl fileUrl() const;
|
||||
const QUrl fileUrl() const;
|
||||
|
||||
/**
|
||||
* @return The tags associated to the post.
|
||||
|
|
@ -188,7 +188,7 @@ namespace Danbooru {
|
|||
/**
|
||||
* @return The URL to the post's thumbnail.
|
||||
**/
|
||||
const KUrl thumbnailUrl() const;
|
||||
const QUrl thumbnailUrl() const;
|
||||
|
||||
/**
|
||||
* @return A pointer to the thumbnail's pixmap.
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ const QString DanbooruService::ARTIST_URL = "artist/index.json";
|
|||
const QString DanbooruService::POOL_DATA_URL = "pool/show.xml";
|
||||
const QString DanbooruService::RELATED_TAG_URL = "tag/related.json";
|
||||
|
||||
DanbooruService::DanbooruService(KUrl& boardUrl, QString username,
|
||||
DanbooruService::DanbooruService(QUrl& boardUrl, QString username,
|
||||
QString password, KImageCache* cache,
|
||||
QObject* parent):
|
||||
QObject(parent),
|
||||
|
|
@ -84,7 +84,7 @@ void DanbooruService::getPostList(int page, QStringList tags, int limit)
|
|||
parameters.insert("limit", QString::number(limit));
|
||||
parameters.insert("page", QString::number(page));
|
||||
|
||||
KUrl danbooruUrl = requestUrl(m_url, POST_URL, m_username,
|
||||
QUrl danbooruUrl = requestUrl(m_url, POST_URL, m_username,
|
||||
m_password, parameters, tags);
|
||||
|
||||
//qDebug() << "Final constructed post URL" << danbooruUrl.url();
|
||||
|
|
@ -110,7 +110,7 @@ void DanbooruService::getTagList(int limit, QString name)
|
|||
}
|
||||
parameters.insert("order", "date");
|
||||
|
||||
KUrl danbooruUrl = requestUrl(m_url, TAG_URL, m_username, m_password,
|
||||
QUrl danbooruUrl = requestUrl(m_url, TAG_URL, m_username, m_password,
|
||||
parameters);
|
||||
//qDebug() << "Final constructed tag URL" << danbooruUrl.url();
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ void DanbooruService::getPool(int poolId, int page)
|
|||
parameters.insert("page", QString::number(page));
|
||||
}
|
||||
|
||||
KUrl danbooruUrl = requestUrl(m_url, POOL_DATA_URL, m_username,
|
||||
QUrl danbooruUrl = requestUrl(m_url, POOL_DATA_URL, m_username,
|
||||
m_password, parameters);
|
||||
|
||||
//qDebug() << "Final constructed pool URL" << danbooruUrl.url();
|
||||
|
|
@ -153,7 +153,7 @@ void DanbooruService::getPool(int poolId, int page)
|
|||
void DanbooruService::getPoolList(int page)
|
||||
{
|
||||
|
||||
KUrl danbooruUrl;
|
||||
QUrl danbooruUrl;
|
||||
|
||||
if (page == 0) {
|
||||
danbooruUrl = requestUrl(m_url, POOL_URL, m_username, m_password);
|
||||
|
|
@ -203,7 +203,7 @@ void DanbooruService::getRelatedTags(const QStringList& tags,
|
|||
QMap<QString, QString> parameters;
|
||||
parameters.insert("type", type);
|
||||
|
||||
KUrl danbooruUrl = requestUrl(m_url, RELATED_TAG_URL, m_username,
|
||||
QUrl danbooruUrl = requestUrl(m_url, RELATED_TAG_URL, m_username,
|
||||
m_password, parameters, tags);
|
||||
|
||||
//qDebug() << "Final constructed related tag URL" << danbooruUrl.url();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
// KDE
|
||||
|
||||
#include <KUrl>
|
||||
#include <QUrl>
|
||||
#include <KIO/JobClasses>
|
||||
|
||||
// Own
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#include "danbooru.h"
|
||||
|
||||
class QPixmap;
|
||||
class KUrl;
|
||||
class QUrl;
|
||||
class KJob;
|
||||
class KImageCache;
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ namespace Danbooru {
|
|||
|
||||
// member variables
|
||||
|
||||
KUrl m_url;
|
||||
QUrl m_url;
|
||||
QString m_username;
|
||||
QString m_password;
|
||||
QSet<QString> m_blacklist;
|
||||
|
|
@ -112,7 +112,7 @@ namespace Danbooru {
|
|||
* @param parent The parent QObject
|
||||
*
|
||||
**/
|
||||
DanbooruService(KUrl& boardUrl, QString username = QString(),
|
||||
DanbooruService(QUrl& boardUrl, QString username = QString(),
|
||||
QString password = QString(), KImageCache* cache = 0,
|
||||
QObject* parent = 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,13 +33,14 @@
|
|||
|
||||
namespace Danbooru {
|
||||
|
||||
KUrl requestUrl(KUrl& url, const QString& path,
|
||||
QUrl requestUrl(QUrl& url, const QString& path,
|
||||
const QString& username, const QString& password,
|
||||
const dictMap& parameters, const QStringList& tags)
|
||||
{
|
||||
|
||||
KUrl danbooruUrl = KUrl(url);
|
||||
danbooruUrl.addPath(path);
|
||||
QUrl danbooruUrl = QUrl(url);
|
||||
danbooruUrl = danbooruUrl.adjusted(QUrl::StripTrailingSlash);
|
||||
danbooruUrl.setPath(danbooruUrl.path() + '/' + path);
|
||||
|
||||
// If we have parameters, add them
|
||||
|
||||
|
|
@ -66,12 +67,13 @@ namespace Danbooru {
|
|||
return danbooruUrl;
|
||||
}
|
||||
|
||||
KUrl requestUrl(KUrl& url, const QString& path, const QString& username,
|
||||
QUrl requestUrl(QUrl& url, const QString& path, const QString& username,
|
||||
const QString& password, const dictMap& parameters)
|
||||
{
|
||||
|
||||
KUrl danbooruUrl = KUrl(url);
|
||||
danbooruUrl.addPath(path);
|
||||
QUrl danbooruUrl = QUrl(url);
|
||||
danbooruUrl = danbooruUrl.adjusted(QUrl::StripTrailingSlash);
|
||||
danbooruUrl.setPath(danbooruUrl.path() + '/' + path);
|
||||
|
||||
// If we have parameters, add them
|
||||
|
||||
|
|
@ -91,11 +93,12 @@ namespace Danbooru {
|
|||
return danbooruUrl;
|
||||
}
|
||||
|
||||
KUrl requestUrl(KUrl& url, const QString& path, const QString& username,
|
||||
QUrl requestUrl(QUrl& url, const QString& path, const QString& username,
|
||||
const QString& password)
|
||||
{
|
||||
KUrl danbooruUrl = KUrl(url);
|
||||
danbooruUrl.addPath(path);
|
||||
QUrl danbooruUrl = QUrl(url);
|
||||
danbooruUrl = danbooruUrl.adjusted(QUrl::StripTrailingSlash);
|
||||
danbooruUrl.setPath(danbooruUrl.path() + '/' + path);
|
||||
|
||||
if (!username.isEmpty() && !password.isEmpty()) {
|
||||
danbooruUrl.setUserName(username);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
// KDE
|
||||
|
||||
#include <kurl.h>
|
||||
#include <QUrl>
|
||||
|
||||
/**
|
||||
* @brief Commmon utilities for Danbooru classes.
|
||||
|
|
@ -60,7 +60,7 @@ namespace Danbooru {
|
|||
*
|
||||
*
|
||||
**/
|
||||
KUrl requestUrl(KUrl& url, const QString& path, const QString& username,
|
||||
QUrl requestUrl(QUrl& url, const QString& path, const QString& username,
|
||||
const QString& password, const dictMap& parameters,
|
||||
const QStringList& tags);
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ namespace Danbooru {
|
|||
*
|
||||
*
|
||||
**/
|
||||
KUrl requestUrl(KUrl& url, const QString& path, const QString& username,
|
||||
QUrl requestUrl(QUrl& url, const QString& path, const QString& username,
|
||||
const QString& password, const dictMap& parameters);
|
||||
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ namespace Danbooru {
|
|||
*
|
||||
*
|
||||
**/
|
||||
KUrl requestUrl(KUrl& url, const QString& path, const QString& username,
|
||||
QUrl requestUrl(QUrl& url, const QString& path, const QString& username,
|
||||
const QString& password);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue