summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/rbutilqt.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-03 11:08:18 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-04 23:32:52 +0100
commit4d2ce949b3b41f8bf0af446fa20205ddd229e579 (patch)
tree01fa19471d9831b296bea5d7049f765e38b30bbb /rbutil/rbutilqt/rbutilqt.cpp
parent335ec75d60bba82f23fc47b20f9390e0cba9c9c5 (diff)
downloadrockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.gz
rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.zip
Use cutelogger for Rockbox Utility internal trace.
Change tracing from qDebug() to use cutelogger, which is available under the LGPL2.1. This allows to automatically add filename and line number to the log, and also provides multiple log levels. Change-Id: I5dbdaf902ba54ea99f07ae10a07467c52fdac910
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index f83020050a..e7c2eaaf28 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -49,6 +49,8 @@
49#include "bootloaderinstallbase.h" 49#include "bootloaderinstallbase.h"
50#include "bootloaderinstallhelper.h" 50#include "bootloaderinstallhelper.h"
51 51
52#include "Logger.h"
53
52#if defined(Q_OS_LINUX) 54#if defined(Q_OS_LINUX)
53#include <stdio.h> 55#include <stdio.h>
54#endif 56#endif
@@ -66,10 +68,10 @@ QList<QTranslator*> RbUtilQt::translators;
66RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) 68RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
67{ 69{
68 // startup log 70 // startup log
69 qDebug() << "======================================"; 71 LOG_INFO() << "======================================";
70 qDebug() << "[System] Rockbox Utility " VERSION; 72 LOG_INFO() << "Rockbox Utility" << VERSION;
71 qDebug() << "[System] Qt version:" << qVersion(); 73 LOG_INFO() << "Qt version:" << qVersion();
72 qDebug() << "======================================"; 74 LOG_INFO() << "======================================";
73 75
74 absolutePath = qApp->applicationDirPath(); 76 absolutePath = qApp->applicationDirPath();
75 77
@@ -110,7 +112,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
110 "Please don't do this, running under Wine will fail. " 112 "Please don't do this, running under Wine will fail. "
111 "Use the native Linux binary instead."), 113 "Use the native Linux binary instead."),
112 QMessageBox::Ok, QMessageBox::Ok); 114 QMessageBox::Ok, QMessageBox::Ok);
113 qDebug() << "[RbUtil] WINE DETECTED!"; 115 LOG_WARNING() << "WINE DETECTED!";
114 RegCloseKey(hk); 116 RegCloseKey(hk);
115 } 117 }
116#endif 118#endif
@@ -181,15 +183,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
181 183
182void RbUtilQt::shutdown(void) 184void RbUtilQt::shutdown(void)
183{ 185{
184 // restore default message handler to prevent trace accesses during
185 // object destruction -- the trace object could already be destroyed.
186 // Fixes segfaults on exit.
187#if QT_VERSION < 0x050000
188 qInstallMsgHandler(0);
189#else
190 qInstallMessageHandler(0);
191#endif
192 SysTrace::save();
193 this->close(); 186 this->close();
194} 187}
195 188
@@ -229,7 +222,7 @@ void RbUtilQt::downloadInfo()
229 connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); 222 connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
230 daily->setCache(false); 223 daily->setCache(false);
231 ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); 224 ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
232 qDebug() << "[RbUtil] downloading build info"; 225 LOG_INFO() << "downloading build info";
233 daily->setFile(&buildInfo); 226 daily->setFile(&buildInfo);
234 daily->getFile(QUrl(SystemInfo::value(SystemInfo::BuildInfoUrl).toString())); 227 daily->getFile(QUrl(SystemInfo::value(SystemInfo::BuildInfoUrl).toString()));
235} 228}
@@ -238,7 +231,7 @@ void RbUtilQt::downloadInfo()
238void RbUtilQt::downloadDone(bool error) 231void RbUtilQt::downloadDone(bool error)
239{ 232{
240 if(error) { 233 if(error) {
241 qDebug() << "[RbUtil] network error:" << daily->errorString(); 234 LOG_INFO() << "network error:" << daily->errorString();
242 ui.statusbar->showMessage(tr("Can't get version information!")); 235 ui.statusbar->showMessage(tr("Can't get version information!"));
243 QMessageBox::critical(this, tr("Network error"), 236 QMessageBox::critical(this, tr("Network error"),
244 tr("Can't get version information.\n" 237 tr("Can't get version information.\n"
@@ -246,7 +239,7 @@ void RbUtilQt::downloadDone(bool error)
246 .arg(daily->errorString())); 239 .arg(daily->errorString()));
247 return; 240 return;
248 } 241 }
249 qDebug() << "[RbUtil] network status:" << daily->errorString(); 242 LOG_INFO() << "network status:" << daily->errorString();
250 243
251 // read info into ServerInfo object 244 // read info into ServerInfo object
252 buildInfo.open(); 245 buildInfo.open();
@@ -320,7 +313,7 @@ void RbUtilQt::configDialog()
320 313
321void RbUtilQt::updateSettings() 314void RbUtilQt::updateSettings()
322{ 315{
323 qDebug() << "[RbUtil] updating current settings"; 316 LOG_INFO() << "updating current settings";
324 updateDevice(); 317 updateDevice();
325 manual->updateManual(); 318 manual->updateManual();
326 QString c = RbSettings::value(RbSettings::CachePath).toString(); 319 QString c = RbSettings::value(RbSettings::CachePath).toString();
@@ -409,7 +402,7 @@ void RbUtilQt::backup(void)
409 402
410void RbUtilQt::installdone(bool error) 403void RbUtilQt::installdone(bool error)
411{ 404{
412 qDebug() << "[RbUtil] install done"; 405 LOG_INFO() << "install done";
413 m_installed = true; 406 m_installed = true;
414 m_error = error; 407 m_error = error;
415} 408}
@@ -464,7 +457,7 @@ void RbUtilQt::installVoice()
464 voiceurl.replace("%MODEL%", model); 457 voiceurl.replace("%MODEL%", model);
465 voiceurl.replace("%RELVERSION%", relversion); 458 voiceurl.replace("%RELVERSION%", relversion);
466 459
467 qDebug() << "[RbUtil] voicefile URL:" << voiceurl; 460 LOG_INFO() << "voicefile URL:" << voiceurl;
468 461
469 // create logger 462 // create logger
470 logger = new ProgressLoggerGui(this); 463 logger = new ProgressLoggerGui(this);
@@ -633,7 +626,7 @@ QUrl RbUtilQt::proxy()
633 else if(proxytype == "system") 626 else if(proxytype == "system")
634 proxy = System::systemProxy(); 627 proxy = System::systemProxy();
635 628
636 qDebug() << "[RbUtilQt] Proxy is" << proxy; 629 LOG_INFO() << "Proxy is" << proxy;
637 return proxy; 630 return proxy;
638} 631}
639 632
@@ -675,7 +668,7 @@ void RbUtilQt::checkUpdate(void)
675void RbUtilQt::downloadUpdateDone(bool error) 668void RbUtilQt::downloadUpdateDone(bool error)
676{ 669{
677 if(error) { 670 if(error) {
678 qDebug() << "[RbUtil] network error:" << update->errorString(); 671 LOG_INFO() << "network error:" << update->errorString();
679 } 672 }
680 else { 673 else {
681 QString toParse(update->readAll()); 674 QString toParse(update->readAll());
@@ -688,7 +681,7 @@ void RbUtilQt::downloadUpdateDone(bool error)
688 rbutilList << searchString.cap(1); 681 rbutilList << searchString.cap(1);
689 pos += searchString.matchedLength(); 682 pos += searchString.matchedLength();
690 } 683 }
691 qDebug() << "[RbUtilQt] Checking for update"; 684 LOG_INFO() << "Checking for update";
692 685
693 QString newVersion = ""; 686 QString newVersion = "";
694 QString foundVersion = ""; 687 QString foundVersion = "";