KUrl -> QUrl
This commit is contained in:
parent
0eb716bda0
commit
d7fec181e2
11 changed files with 66 additions and 63 deletions
|
@ -56,10 +56,10 @@ namespace Danbooru {
|
|||
|
||||
// signal-slot connections
|
||||
|
||||
connect(m_delegate, SIGNAL(postDownloadRequested(KUrl)), this,
|
||||
SLOT(slotHandleDownload(KUrl)));
|
||||
connect(m_delegate, SIGNAL(postViewRequested(KUrl)), this,
|
||||
SLOT(slotHandleView(KUrl)));
|
||||
connect(m_delegate, SIGNAL(postDownloadRequested(QUrl)), this,
|
||||
SLOT(slotHandleDownload(QUrl)));
|
||||
connect(m_delegate, SIGNAL(postViewRequested(QUrl)), this,
|
||||
SLOT(slotHandleView(QUrl)));
|
||||
// connect(m_listView, SIGNAL(clicked(const QModelIndex&)), parent(),
|
||||
// SLOT(displayInfo(const QModelIndex&));
|
||||
|
||||
|
@ -71,13 +71,13 @@ namespace Danbooru {
|
|||
|
||||
}
|
||||
|
||||
void DanbooruClientView::slotHandleDownload(KUrl url)
|
||||
void DanbooruClientView::slotHandleDownload(QUrl url)
|
||||
{
|
||||
// TODO
|
||||
Q_UNUSED(url)
|
||||
}
|
||||
|
||||
void DanbooruClientView::slotHandleView(KUrl url)
|
||||
void DanbooruClientView::slotHandleView(QUrl url)
|
||||
{
|
||||
KRun* runViewer = new KRun(url, this /*window*/, 0 /*mode*/,
|
||||
false /*isLocalFile*/,
|
||||
|
|
|
@ -60,8 +60,8 @@ namespace Danbooru {
|
|||
virtual ~DanbooruClientView();
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotHandleDownload(KUrl);
|
||||
void slotHandleView(KUrl);
|
||||
void slotHandleDownload(QUrl);
|
||||
void slotHandleView(QUrl);
|
||||
|
||||
private:
|
||||
DanbooruPostModel* m_model;
|
||||
|
|
|
@ -32,26 +32,26 @@ using KWallet::Wallet;
|
|||
|
||||
namespace Danbooru {
|
||||
|
||||
const QMap< KUrl, QString > initBoardSalts()
|
||||
const QMap< QUrl, QString > initBoardSalts()
|
||||
{
|
||||
|
||||
QMap< KUrl, QString > boardSalts;
|
||||
QMap< QUrl, QString > boardSalts;
|
||||
|
||||
boardSalts.insert(KUrl("http://konachan.com"),
|
||||
boardSalts.insert(QUrl("http://konachan.com"),
|
||||
QString("So-I-Heard-You-Like-Mupkids-?--%1--"));
|
||||
boardSalts.insert(KUrl("http://konachan.net"),
|
||||
boardSalts.insert(QUrl("http://konachan.net"),
|
||||
QString("So-I-Heard-You-Like-Mupkids-?--%1--"));
|
||||
boardSalts.insert(KUrl("http://yande.re"),
|
||||
boardSalts.insert(QUrl("http://yande.re"),
|
||||
QString("choujin-steiner--%1--"));
|
||||
boardSalts.insert(KUrl("http://danbooru.donmai.us"),
|
||||
boardSalts.insert(QUrl("http://danbooru.donmai.us"),
|
||||
QString("choujin-steiner--%1--"));
|
||||
|
||||
return boardSalts;
|
||||
}
|
||||
|
||||
const QMap<KUrl, QString> DanbooruConnectWidget::boardSalts = initBoardSalts();
|
||||
const QMap<QUrl, QString> DanbooruConnectWidget::boardSalts = initBoardSalts();
|
||||
|
||||
DanbooruConnectWidget::DanbooruConnectWidget(QVector< KUrl > urlList,
|
||||
DanbooruConnectWidget::DanbooruConnectWidget(QVector< QUrl > urlList,
|
||||
QWidget* parent):
|
||||
QWidget(parent),
|
||||
m_wallet(0)
|
||||
|
@ -155,7 +155,7 @@ void DanbooruConnectWidget::emitRejected()
|
|||
Q_EMIT rejected();
|
||||
}
|
||||
|
||||
KUrl DanbooruConnectWidget::boardUrl() const
|
||||
QUrl DanbooruConnectWidget::boardUrl() const
|
||||
{
|
||||
return m_boardUrl;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include <KUrl>
|
||||
#include <QUrl>
|
||||
|
||||
namespace KWallet {
|
||||
class Wallet;
|
||||
|
@ -36,26 +36,26 @@ namespace Danbooru {
|
|||
|
||||
class DanbooruService;
|
||||
|
||||
const QMap< KUrl, QString > initBoardSalts();
|
||||
const QMap< QUrl, QString > initBoardSalts();
|
||||
|
||||
class DanbooruConnectWidget: public QWidget, public Ui::DanbooruConnectWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DanbooruConnectWidget(QVector<KUrl> urlList,
|
||||
explicit DanbooruConnectWidget(QVector<QUrl> urlList,
|
||||
QWidget* parent = 0);
|
||||
~DanbooruConnectWidget();
|
||||
|
||||
QString username() const;
|
||||
QString password() const;
|
||||
KUrl boardUrl() const;
|
||||
QUrl boardUrl() const;
|
||||
|
||||
private:
|
||||
KUrl m_boardUrl;
|
||||
QUrl m_boardUrl;
|
||||
QString m_username;
|
||||
QString m_password;
|
||||
KWallet::Wallet* m_wallet;
|
||||
static const QMap<KUrl, QString> boardSalts;
|
||||
static const QMap<QUrl, QString> boardSalts;
|
||||
|
||||
Q_SIGNALS:
|
||||
void connectionEstablished(DanbooruService* service);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include <KUrl>
|
||||
#include <QUrl>
|
||||
|
||||
class QListView;
|
||||
class QPainter;
|
||||
|
@ -79,7 +79,7 @@ namespace Danbooru {
|
|||
* @param postUrl the URL to the full picture.
|
||||
*
|
||||
*/
|
||||
void postViewRequested(KUrl postUrl);
|
||||
void postViewRequested(QUrl postUrl);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ namespace Danbooru {
|
|||
* @param postUrl the URL to the full picture.
|
||||
*
|
||||
*/
|
||||
void postDownloadRequested(KUrl postUrl);
|
||||
void postDownloadRequested(QUrl postUrl);
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue