Add debug logging

This commit is contained in:
craig.p.drummond
2013-06-10 16:34:22 +00:00
parent 20217d1353
commit 58507f551b
17 changed files with 183 additions and 35 deletions

View File

@@ -48,13 +48,14 @@
#include <QComboBox>
#include <QStackedWidget>
#include <QAction>
#include <QDebug>
//#define DBUG qWarning() << metaObject()->className() << __FUNCTION__
#ifndef DBUG
#define DBUG qDebug()
#endif
static bool debugEnabled=false;
#define DBUG if (debugEnabled) qWarning() << metaObject()->className() << __FUNCTION__
void ContextWidget::enableDebug()
{
debugEnabled=true;
}
const QLatin1String ContextWidget::constApiKey(0); // API key required
const QLatin1String ContextWidget::constCacheDir("backdrops/");
@@ -527,6 +528,7 @@ void ContextWidget::getBackdrop()
url.setQuery(q);
#endif
job=NetworkAccessManager::self()->get(url, 5000);
DBUG << url.toString();
connect(job, SIGNAL(finished()), this, SLOT(searchResponse()));
}
@@ -537,6 +539,8 @@ void ContextWidget::searchResponse()
return;
}
DBUG << "status" << reply->error() << reply->errorString();
QString id;
if (QNetworkReply::NoError==reply->error()) {
QXmlStreamReader xml(reply);
@@ -581,7 +585,13 @@ void ContextWidget::searchResponse()
void ContextWidget::downloadResponse()
{
QNetworkReply *reply = getReply(sender());
if (!reply || QNetworkReply::NoError!=reply->error()) {
if (!reply) {
return;
}
DBUG << "status" << reply->error() << reply->errorString();
if (QNetworkReply::NoError!=reply->error()) {
return;
}