qDebug/kDebug

This commit is contained in:
Luca Beltrame 2013-06-09 17:11:33 +02:00
parent 97a9d6e4a5
commit 5a10b663d2

View file

@ -24,6 +24,7 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <qjson/parser.h> #include <qjson/parser.h>
#include <kdebug.h>
// KDE // KDE
@ -84,7 +85,7 @@ namespace Danbooru {
KUrl danbooruUrl = requestUrl(m_url, POST_URL, m_username, KUrl danbooruUrl = requestUrl(m_url, POST_URL, m_username,
m_password, parameters, tags); m_password, parameters, tags);
qDebug() << "Final constructed URL" << danbooruUrl.url(); kDebug() << "Final constructed post URL" << danbooruUrl.url();
KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload, KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload,
KIO::HideProgressInfo); KIO::HideProgressInfo);
@ -109,7 +110,7 @@ namespace Danbooru {
KUrl danbooruUrl = requestUrl(m_url, TAG_URL, m_username, m_password, KUrl danbooruUrl = requestUrl(m_url, TAG_URL, m_username, m_password,
parameters); parameters);
qDebug() << "Final constructed URL" << danbooruUrl.url(); kDebug() << "Final constructed tag URL" << danbooruUrl.url();
KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload, KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload,
KIO::HideProgressInfo); KIO::HideProgressInfo);
@ -131,7 +132,7 @@ namespace Danbooru {
KUrl danbooruUrl = requestUrl(m_url, POOL_DATA_URL, m_username, KUrl danbooruUrl = requestUrl(m_url, POOL_DATA_URL, m_username,
m_password, parameters); m_password, parameters);
qDebug() << "Final constructed URL" << danbooruUrl.url(); kDebug() << "Final constructed pool URL" << danbooruUrl.url();
KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload, KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload,
@ -162,7 +163,7 @@ namespace Danbooru {
m_password, map); m_password, map);
} }
qDebug() << "Final constructed URL" << danbooruUrl.url(); kDebug() << "Final constructed pool list URL" << danbooruUrl.url();
KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload, KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload,
KIO::HideProgressInfo); KIO::HideProgressInfo);
@ -178,8 +179,6 @@ namespace Danbooru {
Danbooru::TagType tagType) Danbooru::TagType tagType)
{ {
qDebug() << "We start with these" << tags;
QString type; QString type;
switch(tagType) { switch(tagType) {
case Danbooru::General: case Danbooru::General:
@ -205,7 +204,7 @@ namespace Danbooru {
KUrl danbooruUrl = requestUrl(m_url, RELATED_TAG_URL, m_username, KUrl danbooruUrl = requestUrl(m_url, RELATED_TAG_URL, m_username,
m_password, parameters, tags ); m_password, parameters, tags );
qDebug() << "Final constructed URL" << danbooruUrl.url(); kDebug() << "Final constructed related tag URL" << danbooruUrl.url();
StoredTransferJob* job = KIO::storedGet( StoredTransferJob* job = KIO::storedGet(
danbooruUrl, KIO::NoReload, danbooruUrl, KIO::NoReload,
@ -286,7 +285,7 @@ namespace Danbooru {
void DanbooruService::processPostList(KJob* job) void DanbooruService::processPostList(KJob* job)
{ {
qDebug() << "Got post data OK"; //kDebug() << "Got post data OK";
if (job->error()) { if (job->error()) {
Q_EMIT(downloadError(job->errorString())); Q_EMIT(downloadError(job->errorString()));
@ -302,7 +301,7 @@ namespace Danbooru {
QByteArray data = jobResult->data(); QByteArray data = jobResult->data();
qDebug() << jobResult->mimetype(); kDebug() << jobResult->mimetype();
bool ok; bool ok;
@ -332,13 +331,9 @@ namespace Danbooru {
DanbooruPost* post = new DanbooruPost(map); DanbooruPost* post = new DanbooruPost(map);
// qDebug() << "Got rating" << post->rating();
// First check, for rating // First check, for rating
if (post->rating() > m_maxRating) { if (post->rating() > m_maxRating) {
// qDebug() << "Skipping " << post->fileUrl();
// qDebug() << "Rating was " << post->rating();
m_currentPosts--; m_currentPosts--;
delete post; delete post;
continue; continue;
@ -363,7 +358,6 @@ namespace Danbooru {
bool result; bool result;
if (m_cache) { if (m_cache) {
qDebug() << "Checking cache";
result = m_cache->findPixmap(post->thumbnailUrl().url(), result = m_cache->findPixmap(post->thumbnailUrl().url(),
pix); pix);
} else { } else {
@ -372,8 +366,7 @@ namespace Danbooru {
if (result) { if (result) {
qDebug() << "Cache hit"; post->setPixmap(pix);
post->setPixmap(pix);
Q_EMIT(postDownloaded(post)); Q_EMIT(postDownloaded(post));
m_currentPosts--; m_currentPosts--;
@ -418,7 +411,6 @@ namespace Danbooru {
void DanbooruService::processTagList(KJob* job) void DanbooruService::processTagList(KJob* job)
{ {
qDebug() << "Got tag data OK";
if (job->error()) { if (job->error()) {
Q_EMIT(downloadError(job->errorString())); Q_EMIT(downloadError(job->errorString()));
@ -455,8 +447,6 @@ namespace Danbooru {
void DanbooruService::processRelatedTagList(KJob* job) void DanbooruService::processRelatedTagList(KJob* job)
{ {
qDebug() << "Got related tag data OK";
if (job->error()) { if (job->error()) {
Q_EMIT(downloadError(job->errorString())); Q_EMIT(downloadError(job->errorString()));
return; return;
@ -508,7 +498,6 @@ namespace Danbooru {
void DanbooruService::processPoolList(KJob* job) void DanbooruService::processPoolList(KJob* job)
{ {
qDebug() << "Got pool data OK";
if (job->error()) { if (job->error()) {
Q_EMIT(downloadError(job->errorString())); Q_EMIT(downloadError(job->errorString()));
@ -540,7 +529,7 @@ namespace Danbooru {
Q_EMIT(poolDownloaded(pool)); Q_EMIT(poolDownloaded(pool));
} }
qDebug() << "Pool download finished!"; kDebug() << "Pool download finished!";
Q_EMIT(poolDownloadFinished()); Q_EMIT(poolDownloadFinished());
} }
@ -580,17 +569,17 @@ namespace Danbooru {
post->setPixmap(pix); post->setPixmap(pix);
if (m_cache) { if (m_cache) {
qDebug() << "Inserting item"; kDebug() << "Inserting item in cache";
m_cache->insertPixmap(post->thumbnailUrl().url(), *pix); m_cache->insertPixmap(post->thumbnailUrl().url(), *pix);
} }
m_currentPosts--; // One less post to do m_currentPosts--; // One less post to do
qDebug() << "Current posts remaining" << m_currentPosts; kDebug() << "Current posts remaining" << m_currentPosts;
Q_EMIT(postDownloaded(post)); Q_EMIT(postDownloaded(post));
if (m_currentPosts == 0) { if (m_currentPosts == 0) {
qDebug() << "Post download finished"; kDebug() << "Post download finished";
Q_EMIT(postDownloadFinished()); Q_EMIT(postDownloadFinished());
} }