summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-24 12:56:17 +0100
committerJonathan Bauer2011-03-24 12:56:17 +0100
commit27d0351664673689caeec7e56c6851b0a12ad1ef (patch)
tree99ad7a9482b2ddd7837ba99798ea14e1b73744c3 /src
parentmd5 hash of eth0 mac + ip for hardwarehash tests, completed POST data building (diff)
downloadfbgui-27d0351664673689caeec7e56c6851b0a12ad1ef.tar.gz
fbgui-27d0351664673689caeec7e56c6851b0a12ad1ef.tar.xz
fbgui-27d0351664673689caeec7e56c6851b0a12ad1ef.zip
debug tags
Diffstat (limited to 'src')
-rw-r--r--src/downloadmanager.cpp44
-rw-r--r--src/fbgui.cpp20
-rw-r--r--src/javascriptinterface.cpp8
-rw-r--r--src/sysinfo.cpp2
4 files changed, 37 insertions, 37 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index bcfaafb..fdec663 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -16,32 +16,32 @@ void DownloadManager::checkDownloadDirectory()
// check if downloadPath exists, if not create it.
downloadDir = QDir(downloadPath);
if (!downloadDir.exists()){
- qxtLog->debug() << "Download directory: " << downloadDir.path() << " doesn't exist.";
+ qxtLog->debug() << "[dm] Download directory: " << downloadDir.path() << " doesn't exist.";
// try to create the directory
if (QDir::current().mkdir(downloadPath))
- qxtLog->debug() << "Created download directory: " << downloadDir.path();
+ qxtLog->debug() << "[dm] Created download directory: " << downloadDir.path();
else {
- qxtLog->debug() << "Failed to create directory: " << downloadDir.path();
+ qxtLog->debug() << "[dm] Failed to create directory: " << downloadDir.path();
// try to save to /tmp/fbgui
downloadDir.setPath(QDir::tempPath () + "/fbgui");
if (!downloadDir.exists()){
if (QDir::current().mkdir(QDir::tempPath () + "/fbgui"))
- qxtLog->debug() << "Successfully created: " << downloadDir.absolutePath();
+ qxtLog->debug() << "[dm] Successfully created: " << downloadDir.absolutePath();
else {
// just in case
- qxtLog->debug() << "Failed to create: " << downloadDir.absolutePath();
- qxtLog->debug() << "Exiting...";
+ qxtLog->debug() << "[dm] Failed to create: " << downloadDir.absolutePath();
+ qxtLog->debug() << "[dm] Exiting...";
exit(EXIT_FAILURE);
}
}
else
- qxtLog->debug() << downloadDir.absolutePath() << " already exists.";
+ qxtLog->debug() << "[dm] " << downloadDir.absolutePath() << " already exists.";
}
}
else
- qxtLog->debug() << "Download directory: " << downloadDir.absolutePath() << " already exists.";
+ qxtLog->debug() << "[dm] Download directory: " << downloadDir.absolutePath() << " already exists.";
- qxtLog->debug() << "Saving downloads to: " << downloadDir.absolutePath();
+ qxtLog->debug() << "[dm] Saving downloads to: " << downloadDir.absolutePath();
//downloadPath = downloadDir.absolutePath();
}
// ----------------------------------------------------------------------------------------
@@ -59,19 +59,19 @@ void DownloadManager::downloadFile(const QUrl& fileUrl)
void DownloadManager::processDownloadRequest(const QUrl& url)
{
if (url.isEmpty()){
- qxtLog->debug() << "No URL specified for download.";
+ qxtLog->debug() << "[dm] No URL specified for download.";
return;
}
// if download in progress, enqueue file and return.
if (dip){
dlQ.enqueue(url);
- qxtLog->debug() << "Download in progress! Queued:" << url.toString()
+ qxtLog->debug() << "[dm] Download in progress! Queued:" << url.toString()
<< "(" << dlQ.size() << " in queue)";
return;
}
// no running downloads: enqueue and start next download.
dlQ.enqueue(url);
- qxtLog->debug() << "Enqueueing:" << url.toString();
+ qxtLog->debug() << "[dm] Enqueueing:" << url.toString();
startNextDownload();
}
// ----------------------------------------------------------------------------------------
@@ -79,10 +79,10 @@ void DownloadManager::startNextDownload()
{
if (dlQ.isEmpty()){
emit downloadQueueEmpty();
- qxtLog->debug() << "Download manager ready. (1)";
+ qxtLog->debug() << "[dm] Download manager ready. (1)";
return;
}
- qxtLog->debug() << "Starting next download: " << dlQ.head().toString()
+ qxtLog->debug() << "[dm] Starting next download: " << dlQ.head().toString()
<< " (" << dlQ.size() - 1 << " in queue.)";
// dequeue next URL to download.
@@ -94,16 +94,16 @@ void DownloadManager::startNextDownload()
// check if filename exists on target file system
if (downloadDir.exists(tmp)){
- qxtLog->debug() << "File already exists: " << downloadDir.absoluteFilePath(tmp);
+ qxtLog->debug() << "[dm] File already exists: " << downloadDir.absoluteFilePath(tmp);
outfile.setFileName(QString(downloadDir.absolutePath() + "/" + tmp + ".\%1").arg(downloaded));
}
else
outfile.setFileName(downloadDir.absoluteFilePath(tmp));
- qxtLog->debug() << "Saving to: " << outfile.fileName();
+ qxtLog->debug() << "[dm] Saving to: " << outfile.fileName();
// try to open for writing
if (!outfile.open(QIODevice::WriteOnly)){
- qxtLog->debug() << "No write access to " << outfile.fileName() << " . Skipping download...";
+ qxtLog->debug() << "[dm] No write access to " << outfile.fileName() << " . Skipping download...";
return;
}
@@ -160,7 +160,7 @@ void DownloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal)
if (currentProgress - lastProgress >= updateInterval){
lastProgress = currentProgress;
emit updateProgress(currentProgress, speed, unit);
- qxtLog->debug() << "Download progress of " << currentDownload->url().toString()
+ qxtLog->debug() << "[dm] Download progress of " << currentDownload->url().toString()
<< ": " << bytesIn << "/" << bytesTotal << "(" << currentProgress << "\%)";
}
return;
@@ -174,21 +174,21 @@ void DownloadManager::downloadFinished()
outfile.close();
outfile.remove();
int statusCode = currentDownload->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- qxtLog->debug() << "Download of " << currentDownload->url().toString()
+ qxtLog->debug() << "[dm] Download of " << currentDownload->url().toString()
<< " failed with HTTP error code: " << statusCode;
emit notify(QString("Download failed! HTTP Status Code: %1").arg(statusCode));
}
else{
// if kcl, append the session ID to it
if (outfile.fileName() == downloadDir.absoluteFilePath("kcl")){
- qxtLog->debug() << "Completing kernel command line...";
+ qxtLog->debug() << "[dm] Completing kernel command line...";
outfile.write(" session=" + sessionID.toUtf8());
}
// end download
currentDownload->deleteLater();
outfile.close();
downloaded++;
- qxtLog->debug() << "Download of " << currentDownload->url().toString()
+ qxtLog->debug() << "[dm] Download of " << currentDownload->url().toString()
<< " finished. (downloaded = "<< downloaded << ")";
emit notify(QString("Successfully downloaded %1").arg(currentDownload->url().toString()));
}
@@ -196,7 +196,7 @@ void DownloadManager::downloadFinished()
// process next in queue
if (dlQ.isEmpty()){
emit downloadQueueEmpty();
- qxtLog->debug() << "Download manager ready. (2)";
+ qxtLog->debug() << "[dm] Download manager ready. (2)";
return;
}
startNextDownload();
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index fe7d4e2..c956588 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -137,9 +137,9 @@ void fbgui::checkForTrigger(const QString& dirname)
void fbgui::loadURL(){
// load if host is valid
if (checkHost()){
- qxtLog->debug() << "Loading URL...";
+ qxtLog->debug() << "[gui] Loading URL...";
QByteArray postData = generatePOSTData();
- qxtLog->debug() << "POST data: " << postData;
+ qxtLog->debug() << "[gui] POST data: " << postData;
QNetworkRequest req(baseURL);
_webView->load(req, QNetworkAccessManager::PostOperation, postData);
}
@@ -149,11 +149,11 @@ bool fbgui::checkHost() const
{
QHostInfo hostInfo = QHostInfo::fromName(baseURL.host());
if (hostInfo.error() != QHostInfo::NoError){
- qxtLog->debug() << "Lookup of " << baseURL.host() << "failed. Exiting...";
+ qxtLog->debug() << "[gui] Lookup of " << baseURL.host() << "failed. Exiting...";
return false;
}
else{
- qxtLog->debug() << "Lookup of " << baseURL.host() << " succeeded.";
+ qxtLog->debug() << "[gui] Lookup of " << baseURL.host() << " succeeded.";
return true;
}
}
@@ -162,19 +162,19 @@ QByteArray fbgui::generatePOSTData(){
// hash testing
SysInfo si;
QByteArray data(si.getInfo("mac").toUtf8() + "|" + si.getInfo("ip").toUtf8());
- qxtLog->debug() << "Hashing: " << data;
+ qxtLog->debug() << "[post] Hashing: " << data;
QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Md5);
- qxtLog->debug() << "MD5 Hash: " << hash.toHex();
+ qxtLog->debug() << "[post] MD5 Hash: " << hash.toHex();
// fetch serial number from usb rootfs
QByteArray serial;
QFile file(serialLocation);
if (!file.exists()){
- qxtLog->debug() << "No such file: " << file.fileName();
+ qxtLog->debug() << "[post] No such file: " << file.fileName();
serial = "10-23-43-55-67"; // tests
}
if (!file.open(QIODevice::ReadOnly)){
- qxtLog->debug() << "Could not open: " << file.fileName();
+ qxtLog->debug() << "[post] Could not open: " << file.fileName();
serial = "10-23-43-55-67"; // tests
}
// everything ok, read data
@@ -182,10 +182,10 @@ QByteArray fbgui::generatePOSTData(){
file.close();
if (serial.isEmpty())
- qxtLog->debug() << "No data in file: " << file.fileName();
+ qxtLog->debug() << "[post] No data in file: " << file.fileName();
serial.chop(1);
- qxtLog->debug() << "Serial number is: " << serial;
+ qxtLog->debug() << "[post] Serial number is: " << serial;
// construct final byte array
QByteArray postData("bootisoID=1");
diff --git a/src/javascriptinterface.cpp b/src/javascriptinterface.cpp
index 338cb2c..d0fa5a9 100644
--- a/src/javascriptinterface.cpp
+++ b/src/javascriptinterface.cpp
@@ -22,13 +22,13 @@ void JavascriptInterface::attachToDOM(){
}
//-------------------------------------------------------------------------------------------------------
void JavascriptInterface::notify(const QString& msg){
- qxtLog->debug() << "Notifying: " << msg;
+ qxtLog->debug() << "[jvi] Notifying: " << msg;
QString code = QString("notify('\%1')").arg(msg);
_parent->evaluateJavaScript(code);
}
//-------------------------------------------------------------------------------------------------------
void JavascriptInterface::getSession(const QString& session){
- qxtLog->debug() << "Received session id: " << session;
+ qxtLog->debug() << "[jvi] Received session id: " << session;
sessionID = session;
}
//-------------------------------------------------------------------------------------------------------
@@ -53,7 +53,7 @@ void JavascriptInterface::updateProgressBar(const int& percent, const double& sp
}
//-------------------------------------------------------------------------------------------------------
void JavascriptInterface::setCallbackOnFinished(const QString& function){
- qxtLog->debug() << "Callback set: " << function;
+ qxtLog->debug() << "[jvi] Callback set: " << function;
_callbackOnDownloadsFinished = QString(function);
}
//-------------------------------------------------------------------------------------------------------
@@ -98,7 +98,7 @@ void JavascriptInterface::trigger(){
QFile file(fileToTriggerURL);
if (file.open(QIODevice::WriteOnly)){
file.write("data\n");
- qxtLog->debug() << "*trigger watcher*";
+ qxtLog->debug() << "[jvi] *trigger watcher*";
}
file.close();
}
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index 1c8bc8d..e1aa88c 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -7,7 +7,7 @@ SysInfo::SysInfo(){}
SysInfo::~SysInfo(){}
// ------------------------------------------------------------------------------------------------
const QString SysInfo::getInfo(const QString& infoName){
- qxtLog->debug() << "[sysInfo] requested " << infoName;
+ qxtLog->debug() << "[si] requested " << infoName;
if (infoName == QString("mac"))
return getMACAddress();
else if (infoName == QString("ip"))