summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp39
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallams.cpp17
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallbase.cpp25
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallfile.cpp15
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallhex.cpp7
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallimx.cpp19
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallipod.cpp14
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallmi4.cpp21
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallmpio.cpp9
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallsansa.cpp10
-rw-r--r--rbutil/rbutilqt/base/encoderexe.cpp4
-rw-r--r--rbutil/rbutilqt/base/encoderlame.cpp45
-rw-r--r--rbutil/rbutilqt/base/encoderrbspeex.cpp9
-rw-r--r--rbutil/rbutilqt/base/httpget.cpp20
-rw-r--r--rbutil/rbutilqt/base/httpget.h5
-rw-r--r--rbutil/rbutilqt/base/mspackutil.cpp19
-rw-r--r--rbutil/rbutilqt/base/rbsettings.cpp9
-rw-r--r--rbutil/rbutilqt/base/rockboxinfo.cpp3
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp7
-rw-r--r--rbutil/rbutilqt/base/system.cpp21
-rw-r--r--rbutil/rbutilqt/base/systeminfo.cpp7
-rw-r--r--rbutil/rbutilqt/base/talkfile.cpp23
-rw-r--r--rbutil/rbutilqt/base/talkgenerator.cpp29
-rw-r--r--rbutil/rbutilqt/base/ttscarbon.cpp3
-rw-r--r--rbutil/rbutilqt/base/ttsexes.cpp11
-rw-r--r--rbutil/rbutilqt/base/ttsfestival.cpp51
-rw-r--r--rbutil/rbutilqt/base/ttssapi.cpp23
-rw-r--r--rbutil/rbutilqt/base/uninstall.cpp5
-rw-r--r--rbutil/rbutilqt/base/utils.cpp65
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp13
-rw-r--r--rbutil/rbutilqt/base/zipinstaller.cpp17
-rw-r--r--rbutil/rbutilqt/base/zipinstaller.h5
-rw-r--r--rbutil/rbutilqt/base/ziputil.cpp43
-rw-r--r--rbutil/rbutilqt/changelog.txt1
-rw-r--r--rbutil/rbutilqt/configure.cpp31
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp3
-rw-r--r--rbutil/rbutilqt/encttscfggui.cpp7
-rw-r--r--rbutil/rbutilqt/gui/backupdialog.cpp5
-rw-r--r--rbutil/rbutilqt/gui/infowidget.cpp3
-rw-r--r--rbutil/rbutilqt/gui/manualwidget.cpp3
-rw-r--r--rbutil/rbutilqt/gui/selectiveinstallwidget.cpp35
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp5
-rw-r--r--rbutil/rbutilqt/logger/AbstractAppender.cpp58
-rw-r--r--rbutil/rbutilqt/logger/AbstractAppender.h125
-rw-r--r--rbutil/rbutilqt/logger/AbstractStringAppender.cpp161
-rw-r--r--rbutil/rbutilqt/logger/AbstractStringAppender.h116
-rw-r--r--rbutil/rbutilqt/logger/ConsoleAppender.cpp25
-rw-r--r--rbutil/rbutilqt/logger/ConsoleAppender.h32
-rw-r--r--rbutil/rbutilqt/logger/CuteLogger_global.h12
-rw-r--r--rbutil/rbutilqt/logger/FileAppender.cpp85
-rw-r--r--rbutil/rbutilqt/logger/FileAppender.h63
-rw-r--r--rbutil/rbutilqt/logger/LICENSE.LGPL504
-rw-r--r--rbutil/rbutilqt/logger/Logger.cpp370
-rw-r--r--rbutil/rbutilqt/logger/Logger.h319
-rw-r--r--rbutil/rbutilqt/logger/OutputDebugAppender.cpp31
-rw-r--r--rbutil/rbutilqt/logger/OutputDebugAppender.h33
-rw-r--r--rbutil/rbutilqt/logger/README.ROCKBOX7
-rw-r--r--rbutil/rbutilqt/main.cpp20
-rw-r--r--rbutil/rbutilqt/progressloggergui.cpp7
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp39
-rw-r--r--rbutil/rbutilqt/rbutilqt.pri5
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro3
-rw-r--r--rbutil/rbutilqt/systrace.cpp108
-rw-r--r--rbutil/rbutilqt/systrace.h12
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.cpp34
65 files changed, 2420 insertions, 455 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 4b3d1a1ab1..1253202e40 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -28,6 +28,7 @@
28#include "system.h" 28#include "system.h"
29#include "utils.h" 29#include "utils.h"
30#include "rockboxinfo.h" 30#include "rockboxinfo.h"
31#include "Logger.h"
31 32
32Autodetection::Autodetection(QObject* parent): QObject(parent) 33Autodetection::Autodetection(QObject* parent): QObject(parent)
33{ 34{
@@ -67,8 +68,8 @@ bool Autodetection::detect(void)
67 } 68 }
68 } 69 }
69 for(int i = 0; i < m_detected.size(); ++i) { 70 for(int i = 0; i < m_detected.size(); ++i) {
70 qDebug() << "[Autodetect] Detected player:" << m_detected.at(i).device 71 LOG_INFO() << "Detected player:" << m_detected.at(i).device
71 << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status]; 72 << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status];
72 } 73 }
73 74
74 return m_detected.size() > 0; 75 return m_detected.size() > 0;
@@ -98,14 +99,14 @@ void Autodetection::detectUsb()
98 d.status = PlayerOk; 99 d.status = PlayerOk;
99 d.usbdevices = usbids.value(attached.at(i)); 100 d.usbdevices = usbids.value(attached.at(i));
100 m_detected.append(d); 101 m_detected.append(d);
101 qDebug() << "[USB] detected supported player" << d.usbdevices; 102 LOG_INFO() << "[USB] detected supported player" << d.usbdevices;
102 } 103 }
103 if(usberror.contains(attached.at(i))) { 104 if(usberror.contains(attached.at(i))) {
104 struct Detected d; 105 struct Detected d;
105 d.status = PlayerMtpMode; 106 d.status = PlayerMtpMode;
106 d.device = usbids.value(attached.at(i)).at(0); 107 d.device = usbids.value(attached.at(i)).at(0);
107 m_detected.append(d); 108 m_detected.append(d);
108 qDebug() << "[USB] detected problem with player" << d.device; 109 LOG_WARNING() << "[USB] detected problem with player" << d.device;
109 } 110 }
110 QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0')); 111 QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
111 if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) { 112 if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) {
@@ -113,7 +114,7 @@ void Autodetection::detectUsb()
113 d.status = PlayerIncompatible; 114 d.status = PlayerIncompatible;
114 d.device = idstring; 115 d.device = idstring;
115 m_detected.append(d); 116 m_detected.append(d);
116 qDebug() << "[USB] detected incompatible player" << d.device; 117 LOG_WARNING() << "[USB] detected incompatible player" << d.device;
117 } 118 }
118 } 119 }
119} 120}
@@ -125,7 +126,7 @@ void Autodetection::detectUsb()
125void Autodetection::mergeMounted(void) 126void Autodetection::mergeMounted(void)
126{ 127{
127 QStringList mounts = Utils::mountpoints(Utils::MountpointsSupported); 128 QStringList mounts = Utils::mountpoints(Utils::MountpointsSupported);
128 qDebug() << "[Autodetect] paths to check:" << mounts; 129 LOG_INFO() << "paths to check:" << mounts;
129 130
130 for(int i = 0; i < mounts.size(); i++) 131 for(int i = 0; i < mounts.size(); i++)
131 { 132 {
@@ -143,8 +144,8 @@ void Autodetection::mergeMounted(void)
143 d.mountpoint = mounts.at(i); 144 d.mountpoint = mounts.at(i);
144 d.status = PlayerOk; 145 d.status = PlayerOk;
145 updateDetectedDevice(d); 146 updateDetectedDevice(d);
146 qDebug() << "[Autodetect] rbutil.log detected:" 147 LOG_INFO() << "rbutil.log detected:"
147 << log.value("platform").toString() << mounts.at(i); 148 << log.value("platform").toString() << mounts.at(i);
148 } 149 }
149 } 150 }
150 151
@@ -157,8 +158,8 @@ void Autodetection::mergeMounted(void)
157 d.mountpoint = mounts.at(i); 158 d.mountpoint = mounts.at(i);
158 d.status = PlayerOk; 159 d.status = PlayerOk;
159 updateDetectedDevice(d); 160 updateDetectedDevice(d);
160 qDebug() << "[Autodetect] rockbox-info.txt detected:" 161 LOG_INFO() << "rockbox-info.txt detected:"
161 << info.target() << mounts.at(i); 162 << info.target() << mounts.at(i);
162 } 163 }
163 164
164 // check for some specific files in root folder 165 // check for some specific files in root folder
@@ -193,13 +194,13 @@ void Autodetection::mergeMounted(void)
193 } 194 }
194 if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive)) 195 if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive))
195 { 196 {
196 qDebug() << "[Autodetect] ajbrec.ajz found. Trying detectAjbrec()"; 197 LOG_INFO() << "ajbrec.ajz found. Trying detectAjbrec()";
197 struct Detected d; 198 struct Detected d;
198 d.device = detectAjbrec(mounts.at(i)); 199 d.device = detectAjbrec(mounts.at(i));
199 d.mountpoint = mounts.at(i); 200 d.mountpoint = mounts.at(i);
200 d.status = PlayerOk; 201 d.status = PlayerOk;
201 if(!d.device.isEmpty()) { 202 if(!d.device.isEmpty()) {
202 qDebug() << "[Autodetect]" << d.device; 203 LOG_INFO() << d.device;
203 updateDetectedDevice(d); 204 updateDetectedDevice(d);
204 } 205 }
205 } 206 }
@@ -255,7 +256,7 @@ void Autodetection::mergePatcher(void)
255 n = ipod_scan(&ipod); 256 n = ipod_scan(&ipod);
256 // FIXME: handle more than one Ipod connected in ipodpatcher. 257 // FIXME: handle more than one Ipod connected in ipodpatcher.
257 if(n == 1) { 258 if(n == 1) {
258 qDebug() << "[Autodetect] Ipod found:" << ipod.modelstr << "at" << ipod.diskname; 259 LOG_INFO() << "Ipod found:" << ipod.modelstr << "at" << ipod.diskname;
259 // since resolveMountPoint is doing exact matches we need to select 260 // since resolveMountPoint is doing exact matches we need to select
260 // the correct partition. 261 // the correct partition.
261 QString mp(ipod.diskname); 262 QString mp(ipod.diskname);
@@ -276,7 +277,7 @@ void Autodetection::mergePatcher(void)
276 updateDetectedDevice(d); 277 updateDetectedDevice(d);
277 } 278 }
278 else { 279 else {
279 qDebug() << "[Autodetect] ipodpatcher: no Ipod found." << n; 280 LOG_INFO() << "ipodpatcher: no Ipod found." << n;
280 } 281 }
281 ipod_dealloc_buffer(&ipod); 282 ipod_dealloc_buffer(&ipod);
282 283
@@ -286,8 +287,8 @@ void Autodetection::mergePatcher(void)
286 sansa_alloc_buffer(&sansa, BUFFER_SIZE); 287 sansa_alloc_buffer(&sansa, BUFFER_SIZE);
287 n = sansa_scan(&sansa); 288 n = sansa_scan(&sansa);
288 if(n == 1) { 289 if(n == 1) {
289 qDebug() << "[Autodetect] Sansa found:" 290 LOG_INFO() << "Sansa found:"
290 << sansa.targetname << "at" << sansa.diskname; 291 << sansa.targetname << "at" << sansa.diskname;
291 QString mp(sansa.diskname); 292 QString mp(sansa.diskname);
292#ifdef Q_OS_LINUX 293#ifdef Q_OS_LINUX
293 mp.append("1"); 294 mp.append("1");
@@ -302,7 +303,7 @@ void Autodetection::mergePatcher(void)
302 updateDetectedDevice(d); 303 updateDetectedDevice(d);
303 } 304 }
304 else { 305 else {
305 qDebug() << "[Autodetect] sansapatcher: no Sansa found." << n; 306 LOG_INFO() << "sansapatcher: no Sansa found." << n;
306 } 307 }
307 sansa_dealloc_buffer(&sansa); 308 sansa_dealloc_buffer(&sansa);
308} 309}
@@ -323,8 +324,8 @@ QString Autodetection::detectAjbrec(QString root)
323 // recorder v1 has the binary length in the first 4 bytes, so check 324 // recorder v1 has the binary length in the first 4 bytes, so check
324 // for them first. 325 // for them first.
325 int len = (header[0]<<24) | (header[1]<<16) | (header[2]<<8) | header[3]; 326 int len = (header[0]<<24) | (header[1]<<16) | (header[2]<<8) | header[3];
326 qDebug() << "[Autodetect] ABJREC possible bin length:" << len 327 LOG_INFO() << "abjrec.ajz possible bin length:" << len
327 << "file len:" << f.size(); 328 << "file len:" << f.size();
328 if((f.size() - 6) == len) 329 if((f.size() - 6) == len)
329 return "recorder"; 330 return "recorder";
330 331
diff --git a/rbutil/rbutilqt/base/bootloaderinstallams.cpp b/rbutil/rbutilqt/base/bootloaderinstallams.cpp
index dbdac8e2ce..33ad51c200 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallams.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallams.cpp
@@ -19,6 +19,7 @@
19#include <QtCore> 19#include <QtCore>
20#include "bootloaderinstallbase.h" 20#include "bootloaderinstallbase.h"
21#include "bootloaderinstallams.h" 21#include "bootloaderinstallams.h"
22#include "Logger.h"
22 23
23#include "../mkamsboot/mkamsboot.h" 24#include "../mkamsboot/mkamsboot.h"
24 25
@@ -51,7 +52,7 @@ bool BootloaderInstallAms::install(void)
51 if(m_offile.isEmpty()) 52 if(m_offile.isEmpty())
52 return false; 53 return false;
53 54
54 qDebug() << "[BootloaderInstallAms] installing bootloader"; 55 LOG_INFO() << "installing bootloader";
55 56
56 // download firmware from server 57 // download firmware from server
57 emit logItem(tr("Downloading bootloader file"), LOGINFO); 58 emit logItem(tr("Downloading bootloader file"), LOGINFO);
@@ -64,7 +65,7 @@ bool BootloaderInstallAms::install(void)
64 65
65void BootloaderInstallAms::installStage2(void) 66void BootloaderInstallAms::installStage2(void)
66{ 67{
67 qDebug() << "[BootloaderInstallAms] installStage2"; 68 LOG_INFO() << "installStage2";
68 69
69 unsigned char* buf; 70 unsigned char* buf;
70 unsigned char* of_packed; 71 unsigned char* of_packed;
@@ -94,7 +95,7 @@ void BootloaderInstallAms::installStage2(void)
94 errstr,sizeof(errstr)); 95 errstr,sizeof(errstr));
95 if (rb_packed == NULL) 96 if (rb_packed == NULL)
96 { 97 {
97 qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile; 98 LOG_ERROR() << "could not load bootloader: " << bootfile;
98 emit logItem(errstr, LOGERROR); 99 emit logItem(errstr, LOGERROR);
99 emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR); 100 emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR);
100 emit done(true); 101 emit done(true);
@@ -107,7 +108,7 @@ void BootloaderInstallAms::installStage2(void)
107 errstr, sizeof(errstr)); 108 errstr, sizeof(errstr));
108 if (buf == NULL) 109 if (buf == NULL)
109 { 110 {
110 qDebug() << "[BootloaderInstallAms] could not load OF: " << m_offile; 111 LOG_ERROR() << "could not load OF: " << m_offile;
111 emit logItem(errstr, LOGERROR); 112 emit logItem(errstr, LOGERROR);
112 emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR); 113 emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR);
113 free(rb_packed); 114 free(rb_packed);
@@ -121,7 +122,7 @@ void BootloaderInstallAms::installStage2(void)
121 122
122 if (!patchable) 123 if (!patchable)
123 { 124 {
124 qDebug() << "[BootloaderInstallAms] No room to insert bootloader"; 125 LOG_ERROR() << "No room to insert bootloader";
125 emit logItem(errstr, LOGERROR); 126 emit logItem(errstr, LOGERROR);
126 emit logItem(tr("No room to insert bootloader, try another firmware version"), 127 emit logItem(tr("No room to insert bootloader, try another firmware version"),
127 LOGERROR); 128 LOGERROR);
@@ -143,7 +144,7 @@ void BootloaderInstallAms::installStage2(void)
143 144
144 if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) 145 if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate))
145 { 146 {
146 qDebug() << "[BootloaderInstallAms] Could not open" << m_blfile << "for writing"; 147 LOG_ERROR() << "Could not open" << m_blfile << "for writing";
147 emit logItem(tr("Could not open %1 for writing").arg(m_blfile),LOGERROR); 148 emit logItem(tr("Could not open %1 for writing").arg(m_blfile),LOGERROR);
148 free(buf); 149 free(buf);
149 free(of_packed); 150 free(of_packed);
@@ -156,7 +157,7 @@ void BootloaderInstallAms::installStage2(void)
156 157
157 if (n != len) 158 if (n != len)
158 { 159 {
159 qDebug() << "[BootloaderInstallAms] Could not write firmware file"; 160 LOG_ERROR() << "Could not write firmware file";
160 emit logItem(tr("Could not write firmware file"),LOGERROR); 161 emit logItem(tr("Could not write firmware file"),LOGERROR);
161 free(buf); 162 free(buf);
162 free(of_packed); 163 free(of_packed);
@@ -172,7 +173,7 @@ void BootloaderInstallAms::installStage2(void)
172 free(rb_packed); 173 free(rb_packed);
173 174
174 //end of install 175 //end of install
175 qDebug() << "[BootloaderInstallAms] install successfull"; 176 LOG_INFO() << "install successfull";
176 emit logItem(tr("Success: modified firmware file created"), LOGINFO); 177 emit logItem(tr("Success: modified firmware file created"), LOGINFO);
177 logInstall(LogAdd); 178 logInstall(LogAdd);
178 emit done(false); 179 emit done(false);
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
index 1a47f967b0..9a1c74c690 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
@@ -23,6 +23,7 @@
23#include "utils.h" 23#include "utils.h"
24#include "ziputil.h" 24#include "ziputil.h"
25#include "mspackutil.h" 25#include "mspackutil.h"
26#include "Logger.h"
26 27
27#if defined(Q_OS_MACX) 28#if defined(Q_OS_MACX)
28#include <sys/param.h> 29#include <sys/param.h>
@@ -58,8 +59,8 @@ void BootloaderInstallBase::downloadBlStart(QUrl source)
58 59
59void BootloaderInstallBase::downloadReqFinished(int id, bool error) 60void BootloaderInstallBase::downloadReqFinished(int id, bool error)
60{ 61{
61 qDebug() << "[BootloaderInstallBase] Download Request" << id 62 LOG_INFO() << "Download Request" << id
62 << "finished, error:" << m_http.errorString(); 63 << "finished, error:" << m_http.errorString();
63 64
64 downloadBlFinish(error); 65 downloadBlFinish(error);
65} 66}
@@ -67,8 +68,8 @@ void BootloaderInstallBase::downloadReqFinished(int id, bool error)
67 68
68void BootloaderInstallBase::downloadBlFinish(bool error) 69void BootloaderInstallBase::downloadBlFinish(bool error)
69{ 70{
70 qDebug() << "[BootloaderInstallBase] Downloading bootloader finished, error:" 71 LOG_INFO() << "Downloading bootloader finished, error:"
71 << error; 72 << error;
72 73
73 // update progress bar 74 // update progress bar
74 emit logProgress(100, 100); 75 emit logProgress(100, 100);
@@ -98,7 +99,7 @@ void BootloaderInstallBase::downloadBlFinish(bool error)
98 99
99void BootloaderInstallBase::installBlfile(void) 100void BootloaderInstallBase::installBlfile(void)
100{ 101{
101 qDebug() << "[BootloaderInstallBase] installBlFile(void)"; 102 LOG_INFO() << "installBlFile(void)";
102} 103}
103 104
104 105
@@ -107,7 +108,7 @@ void BootloaderInstallBase::installBlfile(void)
107//! @return true on success, false on error. 108//! @return true on success, false on error.
108bool BootloaderInstallBase::backup(QString to) 109bool BootloaderInstallBase::backup(QString to)
109{ 110{
110 qDebug() << "[BootloaderInstallBase] Backing up bootloader file"; 111 LOG_INFO() << "Backing up bootloader file";
111 QDir targetDir("."); 112 QDir targetDir(".");
112 emit logItem(tr("Creating backup of original firmware file."), LOGINFO); 113 emit logItem(tr("Creating backup of original firmware file."), LOGINFO);
113 if(!targetDir.mkpath(to)) { 114 if(!targetDir.mkpath(to)) {
@@ -115,7 +116,7 @@ bool BootloaderInstallBase::backup(QString to)
115 return false; 116 return false;
116 } 117 }
117 QString tofile = to + "/" + QFileInfo(m_blfile).fileName(); 118 QString tofile = to + "/" + QFileInfo(m_blfile).fileName();
118 qDebug() << "[BootloaderInstallBase] trying to backup" << m_blfile << "to" << tofile; 119 LOG_INFO() << "trying to backup" << m_blfile << "to" << tofile;
119 if(!QFile::copy(Utils::resolvePathCase(m_blfile), tofile)) { 120 if(!QFile::copy(Utils::resolvePathCase(m_blfile), tofile)) {
120 emit logItem(tr("Creating backup copy failed."), LOGERROR); 121 emit logItem(tr("Creating backup copy failed."), LOGERROR);
121 return false; 122 return false;
@@ -137,8 +138,8 @@ int BootloaderInstallBase::logInstall(LogMode mode)
137 138
138 if(mode == LogAdd) { 139 if(mode == LogAdd) {
139 s.setValue("Bootloader/" + section, m_blversion.toString(Qt::ISODate)); 140 s.setValue("Bootloader/" + section, m_blversion.toString(Qt::ISODate));
140 qDebug() << "[BootloaderInstallBase] Writing log, version:" 141 LOG_INFO() << "Writing log, version:"
141 << m_blversion.toString(Qt::ISODate); 142 << m_blversion.toString(Qt::ISODate);
142 } 143 }
143 else { 144 else {
144 s.remove("Bootloader/" + section); 145 s.remove("Bootloader/" + section);
@@ -182,7 +183,7 @@ void BootloaderInstallBase::checkRemount()
182 if(!status) { 183 if(!status) {
183 // still not remounted, restart timer. 184 // still not remounted, restart timer.
184 QTimer::singleShot(500, this, SLOT(checkRemount())); 185 QTimer::singleShot(500, this, SLOT(checkRemount()));
185 qDebug() << "[BootloaderInstallBase] Player not remounted yet" << m_remountDevice; 186 LOG_INFO() << "Player not remounted yet" << m_remountDevice;
186 } 187 }
187 else { 188 else {
188 emit logItem(tr("Player remounted"), LOGINFO); 189 emit logItem(tr("Player remounted"), LOGINFO);
@@ -244,11 +245,11 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile)
244 // check if the file set is in zip format 245 // check if the file set is in zip format
245 if(util) { 246 if(util) {
246 QStringList contents = util->files(); 247 QStringList contents = util->files();
247 qDebug() << "[BootloaderInstallBase] archive contains:" << contents; 248 LOG_INFO() << "archive contains:" << contents;
248 for(int i = 0; i < blfile.size(); ++i) { 249 for(int i = 0; i < blfile.size(); ++i) {
249 // strip any path, we don't know the structure in the zip 250 // strip any path, we don't know the structure in the zip
250 QString f = QFileInfo(blfile.at(i)).fileName(); 251 QString f = QFileInfo(blfile.at(i)).fileName();
251 qDebug() << "[BootloaderInstallBase] searching archive for" << f; 252 LOG_INFO() << "searching archive for" << f;
252 // contents.indexOf() works case sensitive. Since the filename 253 // contents.indexOf() works case sensitive. Since the filename
253 // casing is unknown (and might change) do this manually. 254 // casing is unknown (and might change) do this manually.
254 // FIXME: support files in folders 255 // FIXME: support files in folders
diff --git a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp
index fc293e54eb..70867b8868 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp
@@ -20,6 +20,7 @@
20#include <QtDebug> 20#include <QtDebug>
21#include "bootloaderinstallfile.h" 21#include "bootloaderinstallfile.h"
22#include "utils.h" 22#include "utils.h"
23#include "Logger.h"
23 24
24 25
25BootloaderInstallFile::BootloaderInstallFile(QObject *parent) 26BootloaderInstallFile::BootloaderInstallFile(QObject *parent)
@@ -31,7 +32,7 @@ BootloaderInstallFile::BootloaderInstallFile(QObject *parent)
31bool BootloaderInstallFile::install(void) 32bool BootloaderInstallFile::install(void)
32{ 33{
33 emit logItem(tr("Downloading bootloader"), LOGINFO); 34 emit logItem(tr("Downloading bootloader"), LOGINFO);
34 qDebug() << "[BootloaderInstallFile] installing bootloader"; 35 LOG_INFO() << "installing bootloader";
35 downloadBlStart(m_blurl); 36 downloadBlStart(m_blurl);
36 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); 37 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
37 return true; 38 return true;
@@ -46,7 +47,7 @@ void BootloaderInstallFile::installStage2(void)
46 QString fwfile(Utils::resolvePathCase(m_blfile)); 47 QString fwfile(Utils::resolvePathCase(m_blfile));
47 if(!fwfile.isEmpty()) { 48 if(!fwfile.isEmpty()) {
48 QString moved = Utils::resolvePathCase(m_blfile) + ".ORIG"; 49 QString moved = Utils::resolvePathCase(m_blfile) + ".ORIG";
49 qDebug() << "[BootloaderInstallFile] renaming" << fwfile << "to" << moved; 50 LOG_INFO() << "renaming" << fwfile << "to" << moved;
50 QFile::rename(fwfile, moved); 51 QFile::rename(fwfile, moved);
51 } 52 }
52 53
@@ -80,8 +81,8 @@ void BootloaderInstallFile::installStage2(void)
80 81
81 // place (new) bootloader 82 // place (new) bootloader
82 m_tempfile.open(); 83 m_tempfile.open();
83 qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName() 84 LOG_INFO() << "renaming" << m_tempfile.fileName()
84 << "to" << fwfile; 85 << "to" << fwfile;
85 m_tempfile.close(); 86 m_tempfile.close();
86 87
87 if(!Utils::resolvePathCase(fwfile).isEmpty()) { 88 if(!Utils::resolvePathCase(fwfile).isEmpty()) {
@@ -106,7 +107,7 @@ void BootloaderInstallFile::installStage2(void)
106 107
107bool BootloaderInstallFile::uninstall(void) 108bool BootloaderInstallFile::uninstall(void)
108{ 109{
109 qDebug() << "[BootloaderInstallFile] Uninstalling bootloader"; 110 LOG_INFO() << "Uninstalling bootloader";
110 emit logItem(tr("Removing Rockbox bootloader"), LOGINFO); 111 emit logItem(tr("Removing Rockbox bootloader"), LOGINFO);
111 // check if a .ORIG file is present, and allow moving it back. 112 // check if a .ORIG file is present, and allow moving it back.
112 QString origbl = Utils::resolvePathCase(m_blfile + ".ORIG"); 113 QString origbl = Utils::resolvePathCase(m_blfile + ".ORIG");
@@ -138,7 +139,7 @@ bool BootloaderInstallFile::uninstall(void)
138//! @return BootloaderRockbox, BootloaderOther or BootloaderUnknown. 139//! @return BootloaderRockbox, BootloaderOther or BootloaderUnknown.
139BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void) 140BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void)
140{ 141{
141 qDebug() << "[BootloaderInstallFile] checking installed bootloader"; 142 LOG_INFO() << "checking installed bootloader";
142 if(!Utils::resolvePathCase(m_blfile).isEmpty() 143 if(!Utils::resolvePathCase(m_blfile).isEmpty()
143 && !Utils::resolvePathCase(m_blfile + ".ORIG").isEmpty()) 144 && !Utils::resolvePathCase(m_blfile + ".ORIG").isEmpty())
144 return BootloaderRockbox; 145 return BootloaderRockbox;
@@ -151,7 +152,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void)
151 152
152BootloaderInstallBase::Capabilities BootloaderInstallFile::capabilities(void) 153BootloaderInstallBase::Capabilities BootloaderInstallFile::capabilities(void)
153{ 154{
154 qDebug() << "[BootloaderInstallFile] getting capabilities"; 155 LOG_INFO() << "getting capabilities";
155 return Install | Uninstall | IsFile | CanCheckInstalled | Backup; 156 return Install | Uninstall | IsFile | CanCheckInstalled | Backup;
156} 157}
157 158
diff --git a/rbutil/rbutilqt/base/bootloaderinstallhex.cpp b/rbutil/rbutilqt/base/bootloaderinstallhex.cpp
index 506a05522a..39a2392731 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallhex.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallhex.cpp
@@ -20,6 +20,7 @@
20#include "bootloaderinstallbase.h" 20#include "bootloaderinstallbase.h"
21#include "bootloaderinstallhex.h" 21#include "bootloaderinstallhex.h"
22#include "utils.h" 22#include "utils.h"
23#include "Logger.h"
23 24
24#include "../../tools/iriver.h" 25#include "../../tools/iriver.h"
25#include "../../tools/mkboot.h" 26#include "../../tools/mkboot.h"
@@ -74,7 +75,7 @@ bool BootloaderInstallHex::install(void)
74 file.close(); 75 file.close();
75 QString hash = QCryptographicHash::hash(filedata, 76 QString hash = QCryptographicHash::hash(filedata,
76 QCryptographicHash::Md5).toHex(); 77 QCryptographicHash::Md5).toHex();
77 qDebug() << "[BootloaderInstallHex] hexfile hash:" << hash; 78 LOG_INFO() << "hexfile hash:" << hash;
78 if(file.error() != QFile::NoError) { 79 if(file.error() != QFile::NoError) {
79 emit logItem(tr("Could not verify original firmware file"), LOGERROR); 80 emit logItem(tr("Could not verify original firmware file"), LOGERROR);
80 emit done(true); 81 emit done(true);
@@ -112,7 +113,7 @@ bool BootloaderInstallHex::install(void)
112 int result; 113 int result;
113 result = iriver_decode(m_offile.toLatin1().data(), 114 result = iriver_decode(m_offile.toLatin1().data(),
114 m_descrambled.fileName().toLatin1().data(), FALSE, STRIP_NONE); 115 m_descrambled.fileName().toLatin1().data(), FALSE, STRIP_NONE);
115 qDebug() << "[BootloaderInstallHex] iriver_decode" << result; 116 LOG_INFO() << "iriver_decode():" << result;
116 117
117 if(result < 0) { 118 if(result < 0) {
118 emit logItem(tr("Error in descramble: %1").arg(scrambleError(result)), LOGERROR); 119 emit logItem(tr("Error in descramble: %1").arg(scrambleError(result)), LOGERROR);
@@ -200,7 +201,7 @@ void BootloaderInstallHex::installStage2(void)
200 targethex.close(); 201 targethex.close();
201 QString hash = QCryptographicHash::hash(filedata, 202 QString hash = QCryptographicHash::hash(filedata,
202 QCryptographicHash::Md5).toHex(); 203 QCryptographicHash::Md5).toHex();
203 qDebug() << "[BootloaderInstallHex] created hexfile hash:" << hash; 204 LOG_INFO() << "created hexfile hash:" << hash;
204 205
205 emit logItem(tr("Checking modified firmware file"), LOGINFO); 206 emit logItem(tr("Checking modified firmware file"), LOGINFO);
206 if(hash != QString(md5sums[m_hashindex].patched)) { 207 if(hash != QString(md5sums[m_hashindex].patched)) {
diff --git a/rbutil/rbutilqt/base/bootloaderinstallimx.cpp b/rbutil/rbutilqt/base/bootloaderinstallimx.cpp
index e12849e856..74c6f94f78 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallimx.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallimx.cpp
@@ -21,6 +21,7 @@
21#include "bootloaderinstallbase.h" 21#include "bootloaderinstallbase.h"
22#include "bootloaderinstallimx.h" 22#include "bootloaderinstallimx.h"
23#include "../mkimxboot/mkimxboot.h" 23#include "../mkimxboot/mkimxboot.h"
24#include "Logger.h"
24 25
25// class for running mkimxboot() in a separate thread to keep the UI responsive. 26// class for running mkimxboot() in a separate thread to keep the UI responsive.
26class BootloaderThreadImx : public QThread 27class BootloaderThreadImx : public QThread
@@ -45,7 +46,7 @@ class BootloaderThreadImx : public QThread
45 46
46void BootloaderThreadImx::run(void) 47void BootloaderThreadImx::run(void)
47{ 48{
48 qDebug() << "[BootloaderThreadImx] Thread started."; 49 LOG_INFO() << "Thread started.";
49 struct imx_option_t opt; 50 struct imx_option_t opt;
50 memset(&opt, 0, sizeof(opt)); 51 memset(&opt, 0, sizeof(opt));
51 opt.debug = false; 52 opt.debug = false;
@@ -55,7 +56,7 @@ void BootloaderThreadImx::run(void)
55 m_error = mkimxboot(m_inputfile.toLocal8Bit().constData(), 56 m_error = mkimxboot(m_inputfile.toLocal8Bit().constData(),
56 m_bootfile.toLocal8Bit().constData(), 57 m_bootfile.toLocal8Bit().constData(),
57 m_outputfile.toLocal8Bit().constData(), opt); 58 m_outputfile.toLocal8Bit().constData(), opt);
58 qDebug() << "[BootloaderThreadImx] Thread finished, result:" << m_error; 59 LOG_INFO() << "Thread finished, result:" << m_error;
59} 60}
60 61
61 62
@@ -88,13 +89,13 @@ bool BootloaderInstallImx::install(void)
88{ 89{
89 if(!QFileInfo(m_offile).isReadable()) 90 if(!QFileInfo(m_offile).isReadable())
90 { 91 {
91 qDebug() << "[BootloaderInstallImx] could not read original firmware file" 92 LOG_ERROR() << "could not read original firmware file"
92 << m_offile; 93 << m_offile;
93 emit logItem(tr("Could not read original firmware file"), LOGERROR); 94 emit logItem(tr("Could not read original firmware file"), LOGERROR);
94 return false; 95 return false;
95 } 96 }
96 97
97 qDebug() << "[BootloaderInstallImx] downloading bootloader"; 98 LOG_INFO() << "downloading bootloader";
98 // download bootloader from server 99 // download bootloader from server
99 emit logItem(tr("Downloading bootloader file"), LOGINFO); 100 emit logItem(tr("Downloading bootloader file"), LOGINFO);
100 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); 101 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
@@ -105,7 +106,7 @@ bool BootloaderInstallImx::install(void)
105 106
106void BootloaderInstallImx::installStage2(void) 107void BootloaderInstallImx::installStage2(void)
107{ 108{
108 qDebug() << "[BootloaderInstallImx] patching file..."; 109 LOG_INFO() << "patching file...";
109 emit logItem(tr("Patching file..."), LOGINFO); 110 emit logItem(tr("Patching file..."), LOGINFO);
110 m_tempfile.open(); 111 m_tempfile.open();
111 112
@@ -132,26 +133,26 @@ void BootloaderInstallImx::installStage3(void)
132 // if the patch failed 133 // if the patch failed
133 if (err != IMX_SUCCESS) 134 if (err != IMX_SUCCESS)
134 { 135 {
135 qDebug() << "[BootloaderInstallImx] Could not patch the original firmware file"; 136 LOG_ERROR() << "Could not patch the original firmware file";
136 emit logItem(tr("Patching the original firmware failed"), LOGERROR); 137 emit logItem(tr("Patching the original firmware failed"), LOGERROR);
137 emit done(true); 138 emit done(true);
138 return; 139 return;
139 } 140 }
140 141
141 qDebug() << "[BootloaderInstallImx] Original Firmware succesfully patched"; 142 LOG_INFO() << "Original Firmware succesfully patched";
142 emit logItem(tr("Succesfully patched firmware file"), LOGINFO); 143 emit logItem(tr("Succesfully patched firmware file"), LOGINFO);
143 144
144 // if a bootloader is already present delete it. 145 // if a bootloader is already present delete it.
145 QString fwfile(m_blfile); 146 QString fwfile(m_blfile);
146 if(QFileInfo(fwfile).isFile()) 147 if(QFileInfo(fwfile).isFile())
147 { 148 {
148 qDebug() << "[BootloaderInstallImx] deleting old target file"; 149 LOG_INFO() << "deleting old target file";
149 QFile::remove(fwfile); 150 QFile::remove(fwfile);
150 } 151 }
151 152
152 // place (new) bootloader. Copy, since the temporary file will be removed 153 // place (new) bootloader. Copy, since the temporary file will be removed
153 // automatically. 154 // automatically.
154 qDebug() << "[BootloaderInstallImx] moving patched bootloader to" << fwfile; 155 LOG_INFO() << "moving patched bootloader to" << fwfile;
155 if(m_patchedFile.copy(fwfile)) 156 if(m_patchedFile.copy(fwfile))
156 { 157 {
157 emit logItem(tr("Bootloader successful installed"), LOGOK); 158 emit logItem(tr("Bootloader successful installed"), LOGOK);
diff --git a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
index de7aaa897b..6c23bc200f 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
@@ -22,6 +22,7 @@
22 22
23#include "../ipodpatcher/ipodpatcher.h" 23#include "../ipodpatcher/ipodpatcher.h"
24#include "utils.h" 24#include "utils.h"
25#include "Logger.h"
25 26
26 27
27BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent) 28BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent)
@@ -131,7 +132,8 @@ void BootloaderInstallIpod::installStage3(bool mounted)
131 emit logItem(tr("Writing log aborted"), LOGERROR); 132 emit logItem(tr("Writing log aborted"), LOGERROR);
132 emit done(true); 133 emit done(true);
133 } 134 }
134 qDebug() << "[BootloaderInstallIpod] version installed:" << m_blversion.toString(Qt::ISODate); 135 LOG_INFO() << "version installed:"
136 << m_blversion.toString(Qt::ISODate);
135} 137}
136 138
137 139
@@ -190,7 +192,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallIpod::installed(void)
190 BootloaderInstallBase::BootloaderType result = BootloaderRockbox; 192 BootloaderInstallBase::BootloaderType result = BootloaderRockbox;
191 193
192 if(!ipodInitialize(&ipod)) { 194 if(!ipodInitialize(&ipod)) {
193 qDebug() << "[BootloaderInstallIpod] installed: BootloaderUnknown"; 195 LOG_INFO() << "installed: BootloaderUnknown";
194 result = BootloaderUnknown; 196 result = BootloaderUnknown;
195 } 197 }
196 else { 198 else {
@@ -200,7 +202,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallIpod::installed(void)
200 result = BootloaderOther; 202 result = BootloaderOther;
201 } 203 }
202 else { 204 else {
203 qDebug() << "[BootloaderInstallIpod] installed: BootloaderRockbox"; 205 LOG_INFO() << "installed: BootloaderRockbox";
204 } 206 }
205 } 207 }
206 ipod_close(&ipod); 208 ipod_close(&ipod);
@@ -235,12 +237,12 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
235 sprintf(ipod->diskname, "%s", 237 sprintf(ipod->diskname, "%s",
236 qPrintable(devicename.remove(QRegExp("[0-9]+$")))); 238 qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
237#endif 239#endif
238 qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using" 240 LOG_INFO() << "ipodpatcher: overriding scan, using"
239 << ipod->diskname; 241 << ipod->diskname;
240 } 242 }
241 else { 243 else {
242 emit logItem(tr("Error: no mountpoint specified!"), LOGERROR); 244 emit logItem(tr("Error: no mountpoint specified!"), LOGERROR);
243 qDebug() << "[BootloaderInstallIpod] no mountpoint specified!"; 245 LOG_ERROR() << "no mountpoint specified!";
244 } 246 }
245 int result = ipod_open(ipod, 1); 247 int result = ipod_open(ipod, 1);
246 if(result == -2) { 248 if(result == -2) {
diff --git a/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp b/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp
index 8bce8212a9..e4722fda23 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp
@@ -21,6 +21,7 @@
21#include <QtDebug> 21#include <QtDebug>
22#include "bootloaderinstallmi4.h" 22#include "bootloaderinstallmi4.h"
23#include "utils.h" 23#include "utils.h"
24#include "Logger.h"
24 25
25BootloaderInstallMi4::BootloaderInstallMi4(QObject *parent) 26BootloaderInstallMi4::BootloaderInstallMi4(QObject *parent)
26 : BootloaderInstallBase(parent) 27 : BootloaderInstallBase(parent)
@@ -31,7 +32,7 @@ BootloaderInstallMi4::BootloaderInstallMi4(QObject *parent)
31bool BootloaderInstallMi4::install(void) 32bool BootloaderInstallMi4::install(void)
32{ 33{
33 emit logItem(tr("Downloading bootloader"), LOGINFO); 34 emit logItem(tr("Downloading bootloader"), LOGINFO);
34 qDebug() << "[BootloaderInstallMi4] installing bootloader"; 35 LOG_INFO() << "installing bootloader";
35 downloadBlStart(m_blurl); 36 downloadBlStart(m_blurl);
36 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); 37 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
37 return true; 38 return true;
@@ -48,18 +49,18 @@ void BootloaderInstallMi4::installStage2(void)
48 QString moved = QFileInfo(Utils::resolvePathCase(m_blfile)).absolutePath() 49 QString moved = QFileInfo(Utils::resolvePathCase(m_blfile)).absolutePath()
49 + "/OF.mi4"; 50 + "/OF.mi4";
50 if(!QFileInfo(moved).exists()) { 51 if(!QFileInfo(moved).exists()) {
51 qDebug() << "[BootloaderInstallMi4] renaming" << fwfile << "to" << moved; 52 LOG_INFO() << "renaming" << fwfile << "to" << moved;
52 oldbl.rename(moved); 53 oldbl.rename(moved);
53 } 54 }
54 else { 55 else {
55 qDebug() << "[BootloaderInstallMi4] OF.mi4 already present, not renaming again."; 56 LOG_INFO() << "OF.mi4 already present, not renaming again.";
56 oldbl.remove(); 57 oldbl.remove();
57 } 58 }
58 59
59 // place new bootloader 60 // place new bootloader
60 m_tempfile.open(); 61 m_tempfile.open();
61 qDebug() << "[BootloaderInstallMi4] renaming" << m_tempfile.fileName() 62 LOG_INFO() << "renaming" << m_tempfile.fileName()
62 << "to" << fwfile; 63 << "to" << fwfile;
63 m_tempfile.close(); 64 m_tempfile.close();
64 if(!Utils::resolvePathCase(fwfile).isEmpty()) { 65 if(!Utils::resolvePathCase(fwfile).isEmpty()) {
65 emit logItem(tr("A firmware file is already present on player"), LOGERROR); 66 emit logItem(tr("A firmware file is already present on player"), LOGERROR);
@@ -84,7 +85,7 @@ void BootloaderInstallMi4::installStage2(void)
84 85
85bool BootloaderInstallMi4::uninstall(void) 86bool BootloaderInstallMi4::uninstall(void)
86{ 87{
87 qDebug() << "[BootloaderInstallMi4] Uninstalling bootloader"; 88 LOG_INFO() << "Uninstalling bootloader";
88 89
89 // check if it's actually a Rockbox bootloader 90 // check if it's actually a Rockbox bootloader
90 emit logItem(tr("Checking for Rockbox bootloader"), LOGINFO); 91 emit logItem(tr("Checking for Rockbox bootloader"), LOGINFO);
@@ -128,7 +129,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
128 QString resolved; 129 QString resolved;
129 resolved = Utils::resolvePathCase(m_blfile); 130 resolved = Utils::resolvePathCase(m_blfile);
130 if(resolved.isEmpty()) { 131 if(resolved.isEmpty()) {
131 qDebug() << "[BootloaderInstallMi4] installed: BootloaderNone"; 132 LOG_INFO() << "installed: BootloaderNone";
132 return BootloaderNone; 133 return BootloaderNone;
133 } 134 }
134 135
@@ -140,11 +141,11 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
140 f.close(); 141 f.close();
141 142
142 if(!memcmp(magic, "RBBL", 4)) { 143 if(!memcmp(magic, "RBBL", 4)) {
143 qDebug() << "[BootloaderInstallMi4] installed: BootloaderRockbox"; 144 LOG_INFO() << "installed: BootloaderRockbox";
144 return BootloaderRockbox; 145 return BootloaderRockbox;
145 } 146 }
146 else { 147 else {
147 qDebug() << "[BootloaderInstallMi4] installed: BootloaderOther"; 148 LOG_INFO() << "installed: BootloaderOther";
148 return BootloaderOther; 149 return BootloaderOther;
149 } 150 }
150} 151}
@@ -152,7 +153,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
152 153
153BootloaderInstallBase::Capabilities BootloaderInstallMi4::capabilities(void) 154BootloaderInstallBase::Capabilities BootloaderInstallMi4::capabilities(void)
154{ 155{
155 qDebug() << "[BootloaderInstallMi4] getting capabilities"; 156 LOG_INFO() << "getting capabilities";
156 return Install | Uninstall | Backup | IsFile | CanCheckInstalled | CanCheckVersion; 157 return Install | Uninstall | Backup | IsFile | CanCheckInstalled | CanCheckVersion;
157} 158}
158 159
diff --git a/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp b/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp
index 52a6f351f1..97b68f7f61 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp
@@ -20,6 +20,7 @@
20#include <QtCore> 20#include <QtCore>
21#include "bootloaderinstallbase.h" 21#include "bootloaderinstallbase.h"
22#include "bootloaderinstallmpio.h" 22#include "bootloaderinstallmpio.h"
23#include "Logger.h"
23 24
24#include "../mkmpioboot/mkmpioboot.h" 25#include "../mkmpioboot/mkmpioboot.h"
25 26
@@ -46,7 +47,7 @@ bool BootloaderInstallMpio::install(void)
46 if(m_offile.isEmpty()) 47 if(m_offile.isEmpty())
47 return false; 48 return false;
48 49
49 qDebug() << "[BootloaderInstallMpio] installing bootloader"; 50 LOG_INFO() << "installing bootloader";
50 51
51 // download firmware from server 52 // download firmware from server
52 emit logItem(tr("Downloading bootloader file"), LOGINFO); 53 emit logItem(tr("Downloading bootloader file"), LOGINFO);
@@ -59,7 +60,7 @@ bool BootloaderInstallMpio::install(void)
59 60
60void BootloaderInstallMpio::installStage2(void) 61void BootloaderInstallMpio::installStage2(void)
61{ 62{
62 qDebug() << "[BootloaderInstallMpio] installStage2"; 63 LOG_INFO() << "installStage2";
63 64
64 int origin = 0xe0000; /* MPIO HD200 bootloader address */ 65 int origin = 0xe0000; /* MPIO HD200 bootloader address */
65 66
@@ -107,14 +108,14 @@ void BootloaderInstallMpio::installStage2(void)
107 break; 108 break;
108 } 109 }
109 110
110 qDebug() << "[BootloaderInstallMpio] Patching original firmware failed:" << error; 111 LOG_ERROR() << "Patching original firmware failed:" << error;
111 emit logItem(tr("Patching original firmware failed: %1").arg(error), LOGERROR); 112 emit logItem(tr("Patching original firmware failed: %1").arg(error), LOGERROR);
112 emit done(true); 113 emit done(true);
113 return; 114 return;
114 } 115 }
115 116
116 //end of install 117 //end of install
117 qDebug() << "[BootloaderInstallMpio] install successful"; 118 LOG_INFO() << "install successful";
118 emit logItem(tr("Success: modified firmware file created"), LOGINFO); 119 emit logItem(tr("Success: modified firmware file created"), LOGINFO);
119 logInstall(LogAdd); 120 logInstall(LogAdd);
120 emit done(false); 121 emit done(false);
diff --git a/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp b/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp
index 49099ebaf8..d722dfdf6e 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp
@@ -19,6 +19,7 @@
19#include <QtCore> 19#include <QtCore>
20#include "bootloaderinstallbase.h" 20#include "bootloaderinstallbase.h"
21#include "bootloaderinstallsansa.h" 21#include "bootloaderinstallsansa.h"
22#include "Logger.h"
22 23
23#include "../sansapatcher/sansapatcher.h" 24#include "../sansapatcher/sansapatcher.h"
24#include "utils.h" 25#include "utils.h"
@@ -116,7 +117,7 @@ void BootloaderInstallSansa::installStage2(void)
116 m_tempfile.close(); 117 m_tempfile.close();
117 if(memcmp(sansa.targetname, magic, 4) != 0) { 118 if(memcmp(sansa.targetname, magic, 4) != 0) {
118 emit logItem(tr("Bootloader mismatch! Aborting."), LOGERROR); 119 emit logItem(tr("Bootloader mismatch! Aborting."), LOGERROR);
119 qDebug("[BootloaderInstallSansa] Targetname: %s, mi4 magic: %c%c%c%c", 120 LOG_INFO("Targetname: %s, mi4 magic: %c%c%c%c",
120 sansa.targetname, magic[0], magic[1], magic[2], magic[3]); 121 sansa.targetname, magic[0], magic[1], magic[2], magic[3]);
121 emit done(true); 122 emit done(true);
122 sansa_close(&sansa); 123 sansa_close(&sansa);
@@ -157,7 +158,8 @@ void BootloaderInstallSansa::installStage3(bool mounted)
157 emit logItem(tr("Writing log aborted"), LOGERROR); 158 emit logItem(tr("Writing log aborted"), LOGERROR);
158 emit done(true); 159 emit done(true);
159 } 160 }
160 qDebug() << "[BootloaderInstallSansa] version installed:" << m_blversion.toString(Qt::ISODate); 161 LOG_INFO() << "version installed:"
162 << m_blversion.toString(Qt::ISODate);
161} 163}
162 164
163 165
@@ -245,8 +247,8 @@ bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
245 sprintf(sansa->diskname, 247 sprintf(sansa->diskname,
246 qPrintable(devicename.remove(QRegExp("[0-9]+$")))); 248 qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
247#endif 249#endif
248 qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using" 250 LOG_INFO() << "sansapatcher: overriding scan, using"
249 << sansa->diskname; 251 << sansa->diskname;
250 } 252 }
251 else if(sansa_scan(sansa) != 1) { 253 else if(sansa_scan(sansa) != 1) {
252 emit logItem(tr("Can't find Sansa"), LOGERROR); 254 emit logItem(tr("Can't find Sansa"), LOGERROR);
diff --git a/rbutil/rbutilqt/base/encoderexe.cpp b/rbutil/rbutilqt/base/encoderexe.cpp
index f0f39daad7..f56cf368eb 100644
--- a/rbutil/rbutilqt/base/encoderexe.cpp
+++ b/rbutil/rbutilqt/base/encoderexe.cpp
@@ -20,6 +20,7 @@
20#include "encoderexe.h" 20#include "encoderexe.h"
21#include "rbsettings.h" 21#include "rbsettings.h"
22#include "utils.h" 22#include "utils.h"
23#include "Logger.h"
23 24
24EncoderExe::EncoderExe(QString name,QObject *parent) : EncoderBase(parent) 25EncoderExe::EncoderExe(QString name,QObject *parent) : EncoderBase(parent)
25{ 26{
@@ -69,14 +70,13 @@ bool EncoderExe::start()
69 70
70bool EncoderExe::encode(QString input,QString output) 71bool EncoderExe::encode(QString input,QString output)
71{ 72{
72 //qDebug() << "encoding..";
73 QString execstring = m_EncTemplate; 73 QString execstring = m_EncTemplate;
74 74
75 execstring.replace("%exe",m_EncExec); 75 execstring.replace("%exe",m_EncExec);
76 execstring.replace("%options",m_EncOpts); 76 execstring.replace("%options",m_EncOpts);
77 execstring.replace("%input",input); 77 execstring.replace("%input",input);
78 execstring.replace("%output",output); 78 execstring.replace("%output",output);
79 qDebug() << "[EncoderExe] cmd: " << execstring; 79 LOG_INFO() << "cmd: " << execstring;
80 int result = QProcess::execute(execstring); 80 int result = QProcess::execute(execstring);
81 return (result == 0) ? true : false; 81 return (result == 0) ? true : false;
82} 82}
diff --git a/rbutil/rbutilqt/base/encoderlame.cpp b/rbutil/rbutilqt/base/encoderlame.cpp
index c8554194c4..ad283ccf9e 100644
--- a/rbutil/rbutilqt/base/encoderlame.cpp
+++ b/rbutil/rbutilqt/base/encoderlame.cpp
@@ -20,13 +20,14 @@
20#include "encoderlame.h" 20#include "encoderlame.h"
21#include "rbsettings.h" 21#include "rbsettings.h"
22#include "lame/lame.h" 22#include "lame/lame.h"
23#include "Logger.h"
23 24
24/** Resolve a symbol from loaded library. 25/** Resolve a symbol from loaded library.
25 */ 26 */
26#define SYMBOLRESOLVE(symbol, type) \ 27#define SYMBOLRESOLVE(symbol, type) \
27 do { m_##symbol = (type)lib->resolve(#symbol); \ 28 do { m_##symbol = (type)lib->resolve(#symbol); \
28 if(!m_##symbol) return; \ 29 if(!m_##symbol) return; \
29 qDebug() << "[EncoderLame] Resolved symbol " #symbol; } \ 30 LOG_INFO() << "Resolved symbol " #symbol; } \
30 while(0) 31 while(0)
31 32
32EncoderLame::EncoderLame(QObject *parent) : EncoderBase(parent) 33EncoderLame::EncoderLame(QObject *parent) : EncoderBase(parent)
@@ -50,7 +51,7 @@ EncoderLame::EncoderLame(QObject *parent) : EncoderBase(parent)
50 SYMBOLRESOLVE(lame_encode_flush, int (*)(lame_global_flags*, unsigned char*, int)); 51 SYMBOLRESOLVE(lame_encode_flush, int (*)(lame_global_flags*, unsigned char*, int));
51 SYMBOLRESOLVE(lame_close, int (*)(lame_global_flags*)); 52 SYMBOLRESOLVE(lame_close, int (*)(lame_global_flags*));
52 53
53 qDebug() << "[EncoderLame] libmp3lame loaded:" << lib->isLoaded(); 54 LOG_INFO() << "libmp3lame loaded:" << lib->isLoaded();
54 55
55 m_encoderVolume = RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble(); 56 m_encoderVolume = RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble();
56 m_encoderQuality = RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble(); 57 m_encoderQuality = RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble();
@@ -108,9 +109,9 @@ bool EncoderLame::start()
108 109
109bool EncoderLame::encode(QString input,QString output) 110bool EncoderLame::encode(QString input,QString output)
110{ 111{
111 qDebug() << "[EncoderLame] Encoding" << QDir::cleanPath(input); 112 LOG_INFO() << "Encoding" << QDir::cleanPath(input);
112 if(!m_symbolsResolved) { 113 if(!m_symbolsResolved) {
113 qDebug() << "[EncoderLame] Symbols not successfully resolved, cannot run!"; 114 LOG_ERROR() << "Symbols not successfully resolved, cannot run!";
114 return false; 115 return false;
115 } 116 }
116 117
@@ -144,21 +145,21 @@ bool EncoderLame::encode(QString input,QString output)
144 m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag. 145 m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag.
145 146
146 if(!fin.open(QIODevice::ReadOnly)) { 147 if(!fin.open(QIODevice::ReadOnly)) {
147 qDebug() << "[EncoderLame] Could not open input file" << input; 148 LOG_ERROR() << "Could not open input file" << input;
148 return false; 149 return false;
149 } 150 }
150 151
151 // read RIFF header 152 // read RIFF header
152 fin.read((char*)header, 12); 153 fin.read((char*)header, 12);
153 if(memcmp("RIFF", header, 4) != 0) { 154 if(memcmp("RIFF", header, 4) != 0) {
154 qDebug() << "[EncoderLame] RIFF header not found!" 155 LOG_ERROR() << "RIFF header not found!"
155 << header[0] << header[1] << header[2] << header[3]; 156 << header[0] << header[1] << header[2] << header[3];
156 fin.close(); 157 fin.close();
157 return false; 158 return false;
158 } 159 }
159 if(memcmp("WAVE", &header[8], 4) != 0) { 160 if(memcmp("WAVE", &header[8], 4) != 0) {
160 qDebug() << "[EncoderLame] WAVE FOURCC not found!" 161 LOG_ERROR() << "WAVE FOURCC not found!"
161 << header[8] << header[9] << header[10] << header[11]; 162 << header[8] << header[9] << header[10] << header[11];
162 fin.close(); 163 fin.close();
163 return false; 164 return false;
164 } 165 }
@@ -178,7 +179,7 @@ bool EncoderLame::encode(QString input,QString output)
178 // input format used should be known. In case some TTS uses a 179 // input format used should be known. In case some TTS uses a
179 // different wave encoding some time this needs to get adjusted. 180 // different wave encoding some time this needs to get adjusted.
180 if(chunkdatalen < 16) { 181 if(chunkdatalen < 16) {
181 qDebug() << "[EncoderLame] fmt chunk too small!"; 182 LOG_ERROR() << "fmt chunk too small!";
182 } 183 }
183 else { 184 else {
184 unsigned char *buf = new unsigned char[chunkdatalen]; 185 unsigned char *buf = new unsigned char[chunkdatalen];
@@ -196,18 +197,18 @@ bool EncoderLame::encode(QString input,QString output)
196 } 197 }
197 else { 198 else {
198 // unknown chunk, just skip its data. 199 // unknown chunk, just skip its data.
199 qDebug() << "[EncoderLame] unknown chunk, skipping." 200 LOG_WARNING() << "unknown chunk, skipping."
200 << chunkheader[0] << chunkheader[1] 201 << chunkheader[0] << chunkheader[1]
201 << chunkheader[2] << chunkheader[3]; 202 << chunkheader[2] << chunkheader[3];
202 fin.seek(fin.pos() + chunkdatalen); 203 fin.seek(fin.pos() + chunkdatalen);
203 } 204 }
204 } while(!fin.atEnd()); 205 } while(!fin.atEnd());
205 206
206 // check format 207 // check format
207 if(channels == 0 || samplerate == 0 || samplesize == 0 || datalength == 0) { 208 if(channels == 0 || samplerate == 0 || samplesize == 0 || datalength == 0) {
208 qDebug() << "[EncoderLame] invalid format. Channels:" << channels 209 LOG_ERROR() << "invalid format. Channels:" << channels
209 << "Samplerate:" << samplerate << "Samplesize:" << samplesize 210 << "Samplerate:" << samplerate << "Samplesize:" << samplesize
210 << "Data chunk length:" << datalength; 211 << "Data chunk length:" << datalength;
211 fin.close(); 212 fin.close();
212 return false; 213 return false;
213 } 214 }
@@ -220,7 +221,7 @@ bool EncoderLame::encode(QString input,QString output)
220 // initialize encoder. 221 // initialize encoder.
221 ret = m_lame_init_params(gfp); 222 ret = m_lame_init_params(gfp);
222 if(ret != 0) { 223 if(ret != 0) {
223 qDebug() << "[EncoderLame] lame_init_params() failed with" << ret; 224 LOG_ERROR() << "lame_init_params() failed with" << ret;
224 fin.close(); 225 fin.close();
225 return false; 226 return false;
226 } 227 }
@@ -230,7 +231,7 @@ bool EncoderLame::encode(QString input,QString output)
230 // bytes the input file has. This wastes space but should be ok. 231 // bytes the input file has. This wastes space but should be ok.
231 // Put an upper limit of 8MiB. 232 // Put an upper limit of 8MiB.
232 if(datalength > 8*1024*1024) { 233 if(datalength > 8*1024*1024) {
233 qDebug() << "[EncoderLame] Input file too large:" << datalength; 234 LOG_ERROR() << "Input file too large:" << datalength;
234 fin.close(); 235 fin.close();
235 return false; 236 return false;
236 } 237 }
@@ -255,7 +256,7 @@ bool EncoderLame::encode(QString input,QString output)
255 } 256 }
256 } 257 }
257 else { 258 else {
258 qDebug() << "[EncoderLame] Unknown samplesize:" << samplesize; 259 LOG_ERROR() << "Unknown samplesize:" << samplesize;
259 fin.close(); 260 fin.close();
260 delete[] mp3buf; 261 delete[] mp3buf;
261 delete[] wavbuf; 262 delete[] wavbuf;
@@ -270,10 +271,10 @@ bool EncoderLame::encode(QString input,QString output)
270 fout.open(QIODevice::ReadWrite); 271 fout.open(QIODevice::ReadWrite);
271 ret = m_lame_encode_buffer(gfp, wavbuf, wavbuf, num_samples, mp3buf, mp3buflen); 272 ret = m_lame_encode_buffer(gfp, wavbuf, wavbuf, num_samples, mp3buf, mp3buflen);
272 if(ret < 0) { 273 if(ret < 0) {
273 qDebug() << "[EncoderLame] Error during encoding:" << ret; 274 LOG_ERROR() << "Error during encoding:" << ret;
274 } 275 }
275 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) { 276 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
276 qDebug() << "[EncoderLame] Writing mp3 data failed!" << ret; 277 LOG_ERROR() << "Writing mp3 data failed!" << ret;
277 fout.close(); 278 fout.close();
278 delete[] mp3buf; 279 delete[] mp3buf;
279 delete[] wavbuf; 280 delete[] wavbuf;
@@ -282,7 +283,7 @@ bool EncoderLame::encode(QString input,QString output)
282 // flush remaining data 283 // flush remaining data
283 ret = m_lame_encode_flush(gfp, mp3buf, mp3buflen); 284 ret = m_lame_encode_flush(gfp, mp3buf, mp3buflen);
284 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) { 285 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
285 qDebug() << "[EncoderLame] Writing final mp3 data failed!"; 286 LOG_ERROR() << "Writing final mp3 data failed!";
286 fout.close(); 287 fout.close();
287 delete[] mp3buf; 288 delete[] mp3buf;
288 delete[] wavbuf; 289 delete[] wavbuf;
diff --git a/rbutil/rbutilqt/base/encoderrbspeex.cpp b/rbutil/rbutilqt/base/encoderrbspeex.cpp
index a8b7555fa9..0fc0293685 100644
--- a/rbutil/rbutilqt/base/encoderrbspeex.cpp
+++ b/rbutil/rbutilqt/base/encoderrbspeex.cpp
@@ -20,6 +20,7 @@
20#include "encoderrbspeex.h" 20#include "encoderrbspeex.h"
21#include "rbsettings.h" 21#include "rbsettings.h"
22#include "rbspeex.h" 22#include "rbspeex.h"
23#include "Logger.h"
23 24
24EncoderRbSpeex::EncoderRbSpeex(QObject *parent) : EncoderBase(parent) 25EncoderRbSpeex::EncoderRbSpeex(QObject *parent) : EncoderBase(parent)
25{ 26{
@@ -78,16 +79,16 @@ bool EncoderRbSpeex::start()
78 79
79bool EncoderRbSpeex::encode(QString input,QString output) 80bool EncoderRbSpeex::encode(QString input,QString output)
80{ 81{
81 qDebug() << "[RbSpeex] Encoding " << input << " to "<< output; 82 LOG_INFO() << "Encoding " << input << " to "<< output;
82 char errstr[512]; 83 char errstr[512];
83 84
84 FILE *fin,*fout; 85 FILE *fin,*fout;
85 if ((fin = fopen(input.toLocal8Bit(), "rb")) == NULL) { 86 if ((fin = fopen(input.toLocal8Bit(), "rb")) == NULL) {
86 qDebug() << "[RbSpeex] Error: could not open input file\n"; 87 LOG_ERROR() << "Error: could not open input file\n";
87 return false; 88 return false;
88 } 89 }
89 if ((fout = fopen(output.toLocal8Bit(), "wb")) == NULL) { 90 if ((fout = fopen(output.toLocal8Bit(), "wb")) == NULL) {
90 qDebug() << "[RbSpeex] Error: could not open output file\n"; 91 LOG_ERROR() << "Error: could not open output file\n";
91 fclose(fin); 92 fclose(fin);
92 return false; 93 return false;
93 } 94 }
@@ -99,7 +100,7 @@ bool EncoderRbSpeex::encode(QString input,QString output)
99 100
100 if (!ret) { 101 if (!ret) {
101 /* Attempt to delete unfinished output */ 102 /* Attempt to delete unfinished output */
102 qDebug() << "[RbSpeex] Error:" << errstr; 103 LOG_ERROR() << "Error:" << errstr;
103 QFile(output).remove(); 104 QFile(output).remove();
104 return false; 105 return false;
105 } 106 }
diff --git a/rbutil/rbutilqt/base/httpget.cpp b/rbutil/rbutilqt/base/httpget.cpp
index e6b9eb4d3c..4b08faf33b 100644
--- a/rbutil/rbutilqt/base/httpget.cpp
+++ b/rbutil/rbutilqt/base/httpget.cpp
@@ -23,6 +23,7 @@
23#include <QNetworkRequest> 23#include <QNetworkRequest>
24 24
25#include "httpget.h" 25#include "httpget.h"
26#include "Logger.h"
26 27
27QString HttpGet::m_globalUserAgent; //< globally set user agent for requests 28QString HttpGet::m_globalUserAgent; //< globally set user agent for requests
28QDir HttpGet::m_globalCache; //< global cach path value for new objects 29QDir HttpGet::m_globalCache; //< global cach path value for new objects
@@ -71,14 +72,14 @@ void HttpGet::setCache(bool c)
71 QString path = m_cachedir.absolutePath(); 72 QString path = m_cachedir.absolutePath();
72 73
73 if(!c || m_cachedir.absolutePath().isEmpty()) { 74 if(!c || m_cachedir.absolutePath().isEmpty()) {
74 qDebug() << "[HttpGet] disabling download cache"; 75 LOG_INFO() << "disabling download cache";
75 } 76 }
76 else { 77 else {
77 // append the cache path to make it unique in case the path points to 78 // append the cache path to make it unique in case the path points to
78 // the system temporary path. In that case using it directly might 79 // the system temporary path. In that case using it directly might
79 // cause problems. Extra path also used in configure dialog. 80 // cause problems. Extra path also used in configure dialog.
80 path += "/rbutil-cache"; 81 path += "/rbutil-cache";
81 qDebug() << "[HttpGet] setting cache folder to" << path; 82 LOG_INFO() << "setting cache folder to" << path;
82 m_cache = new QNetworkDiskCache(this); 83 m_cache = new QNetworkDiskCache(this);
83 m_cache->setCacheDirectory(path); 84 m_cache->setCacheDirectory(path);
84 } 85 }
@@ -97,7 +98,7 @@ QByteArray HttpGet::readAll()
97 98
98void HttpGet::setProxy(const QUrl &proxy) 99void HttpGet::setProxy(const QUrl &proxy)
99{ 100{
100 qDebug() << "[HttpGet] Proxy set to" << proxy; 101 LOG_INFO() << "Proxy set to" << proxy;
101 m_proxy.setType(QNetworkProxy::HttpProxy); 102 m_proxy.setType(QNetworkProxy::HttpProxy);
102 m_proxy.setHostName(proxy.host()); 103 m_proxy.setHostName(proxy.host());
103 m_proxy.setPort(proxy.port()); 104 m_proxy.setPort(proxy.port());
@@ -130,10 +131,10 @@ void HttpGet::requestFinished(QNetworkReply* reply)
130{ 131{
131 m_lastStatusCode 132 m_lastStatusCode
132 = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); 133 = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
133 qDebug() << "[HttpGet] Request finished, status code:" << m_lastStatusCode; 134 LOG_INFO() << "Request finished, status code:" << m_lastStatusCode;
134 m_lastServerTimestamp 135 m_lastServerTimestamp
135 = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toLocalTime(); 136 = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toLocalTime();
136 qDebug() << "[HttpGet] Data from cache:" 137 LOG_INFO() << "Data from cache:"
137 << reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(); 138 << reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool();
138 m_lastRequestCached = 139 m_lastRequestCached =
139 reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool(); 140 reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool();
@@ -150,7 +151,7 @@ void HttpGet::requestFinished(QNetworkReply* reply)
150#else 151#else
151 url.setQuery(org.query()); 152 url.setQuery(org.query());
152#endif 153#endif
153 qDebug() << "[HttpGet] Redirected to" << url; 154 LOG_INFO() << "Redirected to" << url;
154 startRequest(url); 155 startRequest(url);
155 return; 156 return;
156 } 157 }
@@ -179,7 +180,7 @@ void HttpGet::downloadProgress(qint64 received, qint64 total)
179 180
180void HttpGet::startRequest(QUrl url) 181void HttpGet::startRequest(QUrl url)
181{ 182{
182 qDebug() << "[HttpGet] Request started"; 183 LOG_INFO() << "Request started";
183 QNetworkRequest req(url); 184 QNetworkRequest req(url);
184 if(!m_globalUserAgent.isEmpty()) 185 if(!m_globalUserAgent.isEmpty())
185 req.setRawHeader("User-Agent", m_globalUserAgent.toLatin1()); 186 req.setRawHeader("User-Agent", m_globalUserAgent.toLatin1());
@@ -194,15 +195,14 @@ void HttpGet::startRequest(QUrl url)
194 195
195void HttpGet::networkError(QNetworkReply::NetworkError error) 196void HttpGet::networkError(QNetworkReply::NetworkError error)
196{ 197{
197 qDebug() << "[HttpGet] NetworkError occured:" 198 LOG_ERROR() << "NetworkError occured:" << error << m_reply->errorString();
198 << error << m_reply->errorString();
199 m_lastErrorString = m_reply->errorString(); 199 m_lastErrorString = m_reply->errorString();
200} 200}
201 201
202 202
203bool HttpGet::getFile(const QUrl &url) 203bool HttpGet::getFile(const QUrl &url)
204{ 204{
205 qDebug() << "[HttpGet] Get URI" << url.toString(); 205 LOG_INFO() << "Get URI" << url.toString();
206 m_data.clear(); 206 m_data.clear();
207 startRequest(url); 207 startRequest(url);
208 208
diff --git a/rbutil/rbutilqt/base/httpget.h b/rbutil/rbutilqt/base/httpget.h
index 2f6448a40d..8c62157e5f 100644
--- a/rbutil/rbutilqt/base/httpget.h
+++ b/rbutil/rbutilqt/base/httpget.h
@@ -25,6 +25,7 @@
25#include <QtCore> 25#include <QtCore>
26#include <QtNetwork> 26#include <QtNetwork>
27#include <QNetworkAccessManager> 27#include <QNetworkAccessManager>
28#include "Logger.h"
28 29
29class HttpGet : public QObject 30class HttpGet : public QObject
30{ 31{
@@ -49,13 +50,13 @@ class HttpGet : public QObject
49 //< set global cache path 50 //< set global cache path
50 static void setGlobalCache(const QDir& d) 51 static void setGlobalCache(const QDir& d)
51 { 52 {
52 qDebug() << "[HttpGet] Global cache set to" << d.absolutePath(); 53 LOG_INFO() << "Global cache set to" << d.absolutePath();
53 m_globalCache = d; 54 m_globalCache = d;
54 } 55 }
55 //< set global proxy value 56 //< set global proxy value
56 static void setGlobalProxy(const QUrl& p) 57 static void setGlobalProxy(const QUrl& p)
57 { 58 {
58 qDebug() << "[HttpGet] setting global proxy" << p; 59 LOG_INFO() << "setting global proxy" << p;
59 if(!p.isValid() || p.isEmpty()) { 60 if(!p.isValid() || p.isEmpty()) {
60 HttpGet::m_globalProxy.setType(QNetworkProxy::NoProxy); 61 HttpGet::m_globalProxy.setType(QNetworkProxy::NoProxy);
61 } 62 }
diff --git a/rbutil/rbutilqt/base/mspackutil.cpp b/rbutil/rbutilqt/base/mspackutil.cpp
index 4bc7307cd9..1ee250cd6d 100644
--- a/rbutil/rbutilqt/base/mspackutil.cpp
+++ b/rbutil/rbutilqt/base/mspackutil.cpp
@@ -17,7 +17,7 @@
17 ****************************************************************************/ 17 ****************************************************************************/
18 18
19#include <QtCore> 19#include <QtCore>
20#include <QDebug> 20#include "Logger.h"
21#include "mspackutil.h" 21#include "mspackutil.h"
22#include "progressloggerinterface.h" 22#include "progressloggerinterface.h"
23 23
@@ -27,7 +27,7 @@ MsPackUtil::MsPackUtil(QObject* parent)
27 m_cabd = mspack_create_cab_decompressor(NULL); 27 m_cabd = mspack_create_cab_decompressor(NULL);
28 m_cabinet = NULL; 28 m_cabinet = NULL;
29 if(!m_cabd) 29 if(!m_cabd)
30 qDebug() << "[MsPackUtil] CAB decompressor creation failed!"; 30 LOG_ERROR() << "CAB decompressor creation failed!";
31} 31}
32 32
33MsPackUtil::~MsPackUtil() 33MsPackUtil::~MsPackUtil()
@@ -43,7 +43,7 @@ bool MsPackUtil::open(QString& mspackfile)
43 43
44 if(m_cabd == NULL) 44 if(m_cabd == NULL)
45 { 45 {
46 qDebug() << "[MsPackUtil] No CAB decompressor available: cannot open file!"; 46 LOG_ERROR() << "No CAB decompressor available: cannot open file!";
47 return false; 47 return false;
48 } 48 }
49 m_cabinet = m_cabd->search(m_cabd, QFile::encodeName(mspackfile).constData()); 49 m_cabinet = m_cabd->search(m_cabd, QFile::encodeName(mspackfile).constData());
@@ -60,10 +60,10 @@ bool MsPackUtil::close(void)
60 60
61bool MsPackUtil::extractArchive(const QString& dest, QString file) 61bool MsPackUtil::extractArchive(const QString& dest, QString file)
62{ 62{
63 qDebug() << "[MsPackUtil] extractArchive" << dest << file; 63 LOG_INFO() << "extractArchive" << dest << file;
64 if(!m_cabinet) 64 if(!m_cabinet)
65 { 65 {
66 qDebug() << "[MsPackUtil] CAB file not open!"; 66 LOG_ERROR() << "CAB file not open!";
67 return false; 67 return false;
68 } 68 }
69 69
@@ -78,7 +78,7 @@ bool MsPackUtil::extractArchive(const QString& dest, QString file)
78 struct mscabd_file *f = m_cabinet->files; 78 struct mscabd_file *f = m_cabinet->files;
79 if(f == NULL) 79 if(f == NULL)
80 { 80 {
81 qDebug() << "[MsPackUtil] CAB doesn't contain file" << file; 81 LOG_WARNING() << "CAB doesn't contain file" << file;
82 return true; 82 return true;
83 } 83 }
84 bool found = false; 84 bool found = false;
@@ -99,7 +99,7 @@ bool MsPackUtil::extractArchive(const QString& dest, QString file)
99 if(!QDir().mkpath(QFileInfo(path).absolutePath())) 99 if(!QDir().mkpath(QFileInfo(path).absolutePath()))
100 { 100 {
101 emit logItem(tr("Creating output path failed"), LOGERROR); 101 emit logItem(tr("Creating output path failed"), LOGERROR);
102 qDebug() << "[MsPackUtil] creating output path failed for:" << path; 102 LOG_ERROR() << "creating output path failed for:" << path;
103 emit logProgress(1, 1); 103 emit logProgress(1, 1);
104 return false; 104 return false;
105 } 105 }
@@ -107,7 +107,8 @@ bool MsPackUtil::extractArchive(const QString& dest, QString file)
107 if(ret != MSPACK_ERR_OK) 107 if(ret != MSPACK_ERR_OK)
108 { 108 {
109 emit logItem(tr("Error during CAB operation"), LOGERROR); 109 emit logItem(tr("Error during CAB operation"), LOGERROR);
110 qDebug() << "[MsPackUtil] mspack error: " << ret << "(" << errorStringMsPack(ret) << ")"; 110 LOG_ERROR() << "mspack error: " << ret
111 << "(" << errorStringMsPack(ret) << ")";
111 emit logProgress(1, 1); 112 emit logProgress(1, 1);
112 return false; 113 return false;
113 } 114 }
@@ -125,7 +126,7 @@ QStringList MsPackUtil::files(void)
125 QStringList list; 126 QStringList list;
126 if(!m_cabinet) 127 if(!m_cabinet)
127 { 128 {
128 qDebug() << "[MsPackUtil] CAB file not open!"; 129 LOG_WARNING() << "CAB file not open!";
129 return list; 130 return list;
130 } 131 }
131 struct mscabd_file *file = m_cabinet->files; 132 struct mscabd_file *file = m_cabinet->files;
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp
index a2f801844b..854883c4dd 100644
--- a/rbutil/rbutilqt/base/rbsettings.cpp
+++ b/rbutil/rbutilqt/base/rbsettings.cpp
@@ -19,6 +19,7 @@
19#include "rbsettings.h" 19#include "rbsettings.h"
20#include "systeminfo.h" 20#include "systeminfo.h"
21#include <QSettings> 21#include <QSettings>
22#include "Logger.h"
22 23
23#if defined(Q_OS_LINUX) 24#if defined(Q_OS_LINUX)
24#include <unistd.h> 25#include <unistd.h>
@@ -96,13 +97,13 @@ void RbSettings::ensureRbSettingsExists()
96 { 97 {
97 userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath() 98 userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath()
98 + "/RockboxUtility.ini", QSettings::IniFormat, NULL); 99 + "/RockboxUtility.ini", QSettings::IniFormat, NULL);
99 qDebug() << "[Settings] configuration: portable"; 100 LOG_INFO() << "configuration: portable";
100 } 101 }
101 else 102 else
102 { 103 {
103 userSettings = new QSettings(QSettings::IniFormat, 104 userSettings = new QSettings(QSettings::IniFormat,
104 QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL); 105 QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL);
105 qDebug() << "[Settings] configuration: system"; 106 LOG_INFO() << "configuration: system";
106 } 107 }
107 } 108 }
108} 109}
@@ -158,7 +159,7 @@ QVariant RbSettings::subValue(QString sub, enum UserSettings setting)
158 i++; 159 i++;
159 160
160 QString s = constructSettingPath(UserSettingsList[i].name, sub); 161 QString s = constructSettingPath(UserSettingsList[i].name, sub);
161 qDebug() << "[Settings] GET U:" << s << userSettings->value(s).toString(); 162 LOG_INFO() << "GET U:" << s << userSettings->value(s).toString();
162 return userSettings->value(s, UserSettingsList[i].def); 163 return userSettings->value(s, UserSettingsList[i].def);
163} 164}
164 165
@@ -179,7 +180,7 @@ void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant va
179 180
180 QString s = constructSettingPath(UserSettingsList[i].name, sub); 181 QString s = constructSettingPath(UserSettingsList[i].name, sub);
181 userSettings->setValue(s, value); 182 userSettings->setValue(s, value);
182 qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString(); 183 LOG_INFO() << "SET U:" << s << userSettings->value(s).toString();
183} 184}
184 185
185QString RbSettings::constructSettingPath(QString path, QString substitute) 186QString RbSettings::constructSettingPath(QString path, QString substitute)
diff --git a/rbutil/rbutilqt/base/rockboxinfo.cpp b/rbutil/rbutilqt/base/rockboxinfo.cpp
index e5bce09d2c..f34adbfc2f 100644
--- a/rbutil/rbutilqt/base/rockboxinfo.cpp
+++ b/rbutil/rbutilqt/base/rockboxinfo.cpp
@@ -20,10 +20,11 @@
20 20
21#include <QtCore> 21#include <QtCore>
22#include <QDebug> 22#include <QDebug>
23#include "Logger.h"
23 24
24RockboxInfo::RockboxInfo(QString mountpoint, QString fname) 25RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
25{ 26{
26 qDebug() << "[RockboxInfo] Getting version info from rockbox-info.txt"; 27 LOG_INFO() << "Getting version info from rockbox-info.txt";
27 QFile file(mountpoint + "/" + fname); 28 QFile file(mountpoint + "/" + fname);
28 m_success = false; 29 m_success = false;
29 m_voicefmt = 400; // default value for compatibility 30 m_voicefmt = 400; // default value for compatibility
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
index 8d91309e66..4773c1ee71 100644
--- a/rbutil/rbutilqt/base/serverinfo.cpp
+++ b/rbutil/rbutilqt/base/serverinfo.cpp
@@ -19,6 +19,7 @@
19#include "serverinfo.h" 19#include "serverinfo.h"
20#include "rbsettings.h" 20#include "rbsettings.h"
21#include "systeminfo.h" 21#include "systeminfo.h"
22#include "Logger.h"
22 23
23#if defined(Q_OS_LINUX) 24#if defined(Q_OS_LINUX)
24#include <unistd.h> 25#include <unistd.h>
@@ -181,7 +182,7 @@ QVariant ServerInfo::value(enum ServerInfos info)
181 182
182 QString s = ServerInfoList[i].name; 183 QString s = ServerInfoList[i].name;
183 s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString()); 184 s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
184 qDebug() << "[ServerInfo] GET:" << s << serverInfos.value(s, ServerInfoList[i].def).toString(); 185 LOG_INFO() << "GET:" << s << serverInfos.value(s, ServerInfoList[i].def).toString();
185 return serverInfos.value(s, ServerInfoList[i].def); 186 return serverInfos.value(s, ServerInfoList[i].def);
186} 187}
187 188
@@ -201,7 +202,7 @@ void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVari
201 QString s = ServerInfoList[i].name; 202 QString s = ServerInfoList[i].name;
202 s.replace(":platform:", platform); 203 s.replace(":platform:", platform);
203 serverInfos.insert(s, value); 204 serverInfos.insert(s, value);
204 qDebug() << "[ServerInfo] SET:" << s << serverInfos.value(s).toString(); 205 LOG_INFO() << "SET:" << s << serverInfos.value(s).toString();
205} 206}
206 207
207QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info) 208QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
@@ -215,7 +216,7 @@ QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
215 s.replace(":platform:", platform); 216 s.replace(":platform:", platform);
216 QString d = ServerInfoList[i].def; 217 QString d = ServerInfoList[i].def;
217 d.replace(":platform:", platform); 218 d.replace(":platform:", platform);
218 qDebug() << "[ServerInfo] GET:" << s << serverInfos.value(s, d).toString(); 219 LOG_INFO() << "GET:" << s << serverInfos.value(s, d).toString();
219 return serverInfos.value(s, d); 220 return serverInfos.value(s, d);
220} 221}
221 222
diff --git a/rbutil/rbutilqt/base/system.cpp b/rbutil/rbutilqt/base/system.cpp
index fd3b04e338..117e5dc9b4 100644
--- a/rbutil/rbutilqt/base/system.cpp
+++ b/rbutil/rbutilqt/base/system.cpp
@@ -69,6 +69,7 @@
69 69
70#include "utils.h" 70#include "utils.h"
71#include "rbsettings.h" 71#include "rbsettings.h"
72#include "Logger.h"
72 73
73/** @brief detect permission of user (only Windows at moment). 74/** @brief detect permission of user (only Windows at moment).
74 * @return enum userlevel. 75 * @return enum userlevel.
@@ -242,17 +243,17 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
242{ 243{
243 QMap<uint32_t, QString> usbids; 244 QMap<uint32_t, QString> usbids;
244 // usb pid detection 245 // usb pid detection
245 qDebug() << "[System] Searching for USB devices"; 246 LOG_INFO() << "Searching for USB devices";
246#if defined(Q_OS_LINUX) 247#if defined(Q_OS_LINUX)
247#if defined(LIBUSB1) 248#if defined(LIBUSB1)
248 libusb_device **devs; 249 libusb_device **devs;
249 if(libusb_init(NULL) != 0) { 250 if(libusb_init(NULL) != 0) {
250 qDebug() << "[System] Initializing libusb-1 failed."; 251 LOG_ERROR() << "Initializing libusb-1 failed.";
251 return usbids; 252 return usbids;
252 } 253 }
253 254
254 if(libusb_get_device_list(NULL, &devs) < 1) { 255 if(libusb_get_device_list(NULL, &devs) < 1) {
255 qDebug() << "[System] Error getting device list."; 256 LOG_ERROR() << "Error getting device list.";
256 return usbids; 257 return usbids;
257 } 258 }
258 libusb_device *dev; 259 libusb_device *dev;
@@ -277,7 +278,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
277 name = tr("(no description available)"); 278 name = tr("(no description available)");
278 if(id) { 279 if(id) {
279 usbids.insertMulti(id, name); 280 usbids.insertMulti(id, name);
280 qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data()); 281 LOG_INFO("USB: 0x%08x, %s", id, name.toLocal8Bit().data());
281 } 282 }
282 } 283 }
283 } 284 }
@@ -323,7 +324,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
323 324
324 if(id) { 325 if(id) {
325 usbids.insertMulti(id, name); 326 usbids.insertMulti(id, name);
326 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; 327 LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16) << name;
327 } 328 }
328 u = u->next; 329 u = u->next;
329 } 330 }
@@ -341,7 +342,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
341 result = IOServiceGetMatchingServices(kIOMasterPortDefault, usb_matching_dictionary, 342 result = IOServiceGetMatchingServices(kIOMasterPortDefault, usb_matching_dictionary,
342 &usb_iterator); 343 &usb_iterator);
343 if(result) { 344 if(result) {
344 qDebug() << "[System] USB: IOKit: Could not get matching services."; 345 LOG_ERROR() << "USB: IOKit: Could not get matching services.";
345 return usbids; 346 return usbids;
346 } 347 }
347 348
@@ -404,7 +405,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
404 405
405 if(id) { 406 if(id) {
406 usbids.insertMulti(id, name); 407 usbids.insertMulti(id, name);
407 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; 408 LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16) << name;
408 } 409 }
409 410
410 } 411 }
@@ -468,7 +469,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
468 uint32_t id; 469 uint32_t id;
469 id = vid << 16 | pid; 470 id = vid << 16 | pid;
470 usbids.insert(id, description); 471 usbids.insert(id, description);
471 qDebug("[System] USB VID: %04x, PID: %04x", vid, pid); 472 LOG_INFO("USB VID: %04x, PID: %04x", vid, pid);
472 } 473 }
473 if(buffer) free(buffer); 474 if(buffer) free(buffer);
474 } 475 }
@@ -507,7 +508,7 @@ QUrl System::systemProxy(void)
507 508
508 RegCloseKey(hk); 509 RegCloseKey(hk);
509 510
510 //qDebug() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable); 511 //LOG_INFO() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable);
511 if(enable != 0) 512 if(enable != 0)
512 return QUrl("http://" + QString::fromWCharArray(proxyval)); 513 return QUrl("http://" + QString::fromWCharArray(proxyval));
513 else 514 else
@@ -537,7 +538,7 @@ QUrl System::systemProxy(void)
537 bufsize = CFStringGetLength(stringref) * 2 + 1; 538 bufsize = CFStringGetLength(stringref) * 2 + 1;
538 buf = (char*)malloc(sizeof(char) * bufsize); 539 buf = (char*)malloc(sizeof(char) * bufsize);
539 if(buf == NULL) { 540 if(buf == NULL) {
540 qDebug() << "[System] can't allocate memory for proxy string!"; 541 LOG_ERROR() << "can't allocate memory for proxy string!";
541 CFRelease(dictref); 542 CFRelease(dictref);
542 return QUrl(""); 543 return QUrl("");
543 } 544 }
diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp
index 971a1196ac..d75b90c22d 100644
--- a/rbutil/rbutilqt/base/systeminfo.cpp
+++ b/rbutil/rbutilqt/base/systeminfo.cpp
@@ -16,10 +16,11 @@
16 * 16 *
17 ****************************************************************************/ 17 ****************************************************************************/
18 18
19#include "systeminfo.h" 19#include "systeminfo.h"
20#include "rbsettings.h" 20#include "rbsettings.h"
21 21
22#include <QSettings> 22#include <QSettings>
23#include "Logger.h"
23 24
24#if defined(Q_OS_LINUX) 25#if defined(Q_OS_LINUX)
25#include <unistd.h> 26#include <unistd.h>
@@ -89,7 +90,7 @@ QVariant SystemInfo::value(enum SystemInfos info)
89 s.replace(":platform:", platform); 90 s.replace(":platform:", platform);
90 QString d = SystemInfosList[i].def; 91 QString d = SystemInfosList[i].def;
91 d.replace(":platform:", platform); 92 d.replace(":platform:", platform);
92 qDebug() << "[SystemInfo] GET:" << s << systemInfos->value(s, d).toString(); 93 LOG_INFO() << "GET:" << s << systemInfos->value(s, d).toString();
93 return systemInfos->value(s, d); 94 return systemInfos->value(s, d);
94} 95}
95 96
@@ -106,7 +107,7 @@ QVariant SystemInfo::platformValue(QString platform, enum SystemInfos info)
106 s.replace(":platform:", platform); 107 s.replace(":platform:", platform);
107 QString d = SystemInfosList[i].def; 108 QString d = SystemInfosList[i].def;
108 d.replace(":platform:", platform); 109 d.replace(":platform:", platform);
109 qDebug() << "[SystemInfo] GET P:" << s << systemInfos->value(s, d).toString(); 110 LOG_INFO() << "GET P:" << s << systemInfos->value(s, d).toString();
110 return systemInfos->value(s, d); 111 return systemInfos->value(s, d);
111} 112}
112 113
diff --git a/rbutil/rbutilqt/base/talkfile.cpp b/rbutil/rbutilqt/base/talkfile.cpp
index dc4dceef08..1e9a968576 100644
--- a/rbutil/rbutilqt/base/talkfile.cpp
+++ b/rbutil/rbutilqt/base/talkfile.cpp
@@ -18,6 +18,7 @@
18 18
19#include "talkfile.h" 19#include "talkfile.h"
20#include "rbsettings.h" 20#include "rbsettings.h"
21#include "Logger.h"
21 22
22TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent) 23TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
23{ 24{
@@ -109,7 +110,7 @@ void TalkFileCreator::doAbort()
109//! \param startDir The directory from which to start scanning 110//! \param startDir The directory from which to start scanning
110bool TalkFileCreator::createTalkList(QDir startDir) 111bool TalkFileCreator::createTalkList(QDir startDir)
111{ 112{
112 qDebug() << "[TalkGenerator] generating list of files" << startDir; 113 LOG_INFO() << "generating list of files" << startDir;
113 m_talkList.clear(); 114 m_talkList.clear();
114 115
115 // create Iterator 116 // create Iterator
@@ -161,9 +162,9 @@ bool TalkFileCreator::createTalkList(QDir startDir)
161 entry.target = dir.path() + "/_dirname.talk"; 162 entry.target = dir.path() + "/_dirname.talk";
162 entry.voiced = false; 163 entry.voiced = false;
163 entry.encoded = false; 164 entry.encoded = false;
164 qDebug() << "[TalkFileCreator] toSpeak:" << entry.toSpeak 165 LOG_INFO() << "toSpeak:" << entry.toSpeak
165 << "target:" << entry.target 166 << "target:" << entry.target
166 << "intermediates:" << entry.wavfilename << entry.talkfilename; 167 << "intermediates:" << entry.wavfilename << entry.talkfilename;
167 m_talkList.append(entry); 168 m_talkList.append(entry);
168 } 169 }
169 } 170 }
@@ -205,16 +206,16 @@ bool TalkFileCreator::createTalkList(QDir startDir)
205 entry.target = fileInf.path() + "/" + fileInf.fileName() + ".talk"; 206 entry.target = fileInf.path() + "/" + fileInf.fileName() + ".talk";
206 entry.voiced = false; 207 entry.voiced = false;
207 entry.encoded = false; 208 entry.encoded = false;
208 qDebug() << "[TalkFileCreator] toSpeak:" << entry.toSpeak 209 LOG_INFO() << "toSpeak:" << entry.toSpeak
209 << "target:" << entry.target 210 << "target:" << entry.target
210 << "intermediates:" << 211 << "intermediates:"
211 entry.wavfilename << entry.talkfilename; 212 << entry.wavfilename << entry.talkfilename;
212 m_talkList.append(entry); 213 m_talkList.append(entry);
213 } 214 }
214 } 215 }
215 QCoreApplication::processEvents(); 216 QCoreApplication::processEvents();
216 } 217 }
217 qDebug() << "[TalkFileCreator] list created, entries:" << m_talkList.size(); 218 LOG_INFO() << "list created, entries:" << m_talkList.size();
218 return true; 219 return true;
219} 220}
220 221
@@ -251,8 +252,8 @@ bool TalkFileCreator::copyTalkFiles(QString* errString)
251 QFile::remove(m_talkList[i].target); 252 QFile::remove(m_talkList[i].target);
252 253
253 // copying 254 // copying
254 qDebug() << "[TalkFileCreator] copying" << m_talkList[i].talkfilename 255 LOG_INFO() << "copying" << m_talkList[i].talkfilename
255 << "to" << m_talkList[i].target; 256 << "to" << m_talkList[i].target;
256 if(!QFile::copy(m_talkList[i].talkfilename,m_talkList[i].target)) 257 if(!QFile::copy(m_talkList[i].talkfilename,m_talkList[i].target))
257 { 258 {
258 *errString = tr("Copying of %1 to %2 failed").arg(m_talkList[i].talkfilename).arg(m_talkList[i].target); 259 *errString = tr("Copying of %1 to %2 failed").arg(m_talkList[i].talkfilename).arg(m_talkList[i].target);
diff --git a/rbutil/rbutilqt/base/talkgenerator.cpp b/rbutil/rbutilqt/base/talkgenerator.cpp
index a2ab578ade..32686c78c2 100644
--- a/rbutil/rbutilqt/base/talkgenerator.cpp
+++ b/rbutil/rbutilqt/base/talkgenerator.cpp
@@ -20,6 +20,7 @@
20#include "rbsettings.h" 20#include "rbsettings.h"
21#include "systeminfo.h" 21#include "systeminfo.h"
22#include "wavtrim.h" 22#include "wavtrim.h"
23#include "Logger.h"
23 24
24TalkGenerator::TalkGenerator(QObject* parent): QObject(parent) 25TalkGenerator::TalkGenerator(QObject* parent): QObject(parent)
25{ 26{
@@ -39,7 +40,7 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt
39 m_tts = TTSBase::getTTS(this, RbSettings::value(RbSettings::Tts).toString()); 40 m_tts = TTSBase::getTTS(this, RbSettings::value(RbSettings::Tts).toString());
40 if(!m_tts) 41 if(!m_tts)
41 { 42 {
42 qDebug() << "[TalkGenerator] getting the TTS object failed!"; 43 LOG_ERROR() << "getting the TTS object failed!";
43 emit logItem(tr("Init of TTS engine failed"), LOGERROR); 44 emit logItem(tr("Init of TTS engine failed"), LOGERROR);
44 emit done(true); 45 emit done(true);
45 return eERROR; 46 return eERROR;
@@ -131,7 +132,7 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
131 duplicates.append(list->at(i).wavfilename); 132 duplicates.append(list->at(i).wavfilename);
132 else 133 else
133 { 134 {
134 qDebug() << "[TalkGenerator] duplicate skipped"; 135 LOG_INFO() << "duplicate skipped";
135 (*list)[i].voiced = true; 136 (*list)[i].voiced = true;
136 emit logProgress(++m_progress,progressMax); 137 emit logProgress(++m_progress,progressMax);
137 continue; 138 continue;
@@ -152,7 +153,7 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
152 153
153 // voice entry 154 // voice entry
154 QString error; 155 QString error;
155 qDebug() << "[TalkGenerator] voicing: " << list->at(i).toSpeak 156 LOG_INFO() << "voicing: " << list->at(i).toSpeak
156 << "to" << list->at(i).wavfilename; 157 << "to" << list->at(i).wavfilename;
157 TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error); 158 TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error);
158 if(status == Warning) 159 if(status == Warning)
@@ -177,8 +178,8 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
177 if(wavtrim(list->at(i).wavfilename.toLocal8Bit().data(), 178 if(wavtrim(list->at(i).wavfilename.toLocal8Bit().data(),
178 wavtrimth, buffer, 255)) 179 wavtrimth, buffer, 255))
179 { 180 {
180 qDebug() << "[TalkGenerator] wavtrim returned error on" 181 LOG_ERROR() << "wavtrim returned error on"
181 << list->at(i).wavfilename; 182 << list->at(i).wavfilename;
182 return eERROR; 183 return eERROR;
183 } 184 }
184 } 185 }
@@ -214,8 +215,8 @@ TalkGenerator::Status TalkGenerator::encodeList(QList<TalkEntry>* list)
214 //skip non-voiced entrys 215 //skip non-voiced entrys
215 if(list->at(i).voiced == false) 216 if(list->at(i).voiced == false)
216 { 217 {
217 qDebug() << "[TalkGenerator] non voiced entry detected:" 218 LOG_WARNING() << "non voiced entry detected:"
218 << list->at(i).toSpeak; 219 << list->at(i).toSpeak;
219 emit logProgress(++m_progress,progressMax); 220 emit logProgress(++m_progress,progressMax);
220 continue; 221 continue;
221 } 222 }
@@ -224,15 +225,15 @@ TalkGenerator::Status TalkGenerator::encodeList(QList<TalkEntry>* list)
224 duplicates.append(list->at(i).talkfilename); 225 duplicates.append(list->at(i).talkfilename);
225 else 226 else
226 { 227 {
227 qDebug() << "[TalkGenerator] duplicate skipped"; 228 LOG_INFO() << "duplicate skipped";
228 (*list)[i].encoded = true; 229 (*list)[i].encoded = true;
229 emit logProgress(++m_progress,progressMax); 230 emit logProgress(++m_progress,progressMax);
230 continue; 231 continue;
231 } 232 }
232 233
233 //encode entry 234 //encode entry
234 qDebug() << "[TalkGenerator] encoding " << list->at(i).wavfilename 235 LOG_INFO() << "encoding " << list->at(i).wavfilename
235 << "to" << list->at(i).talkfilename; 236 << "to" << list->at(i).talkfilename;
236 if(!m_enc->encode(list->at(i).wavfilename,list->at(i).talkfilename)) 237 if(!m_enc->encode(list->at(i).wavfilename,list->at(i).talkfilename))
237 { 238 {
238 emit logItem(tr("Encoding of %1 failed").arg( 239 emit logItem(tr("Encoding of %1 failed").arg(
@@ -268,7 +269,7 @@ QString TalkGenerator::correctString(QString s)
268 } 269 }
269 270
270 if(corrected != s) 271 if(corrected != s)
271 qDebug() << "[VoiceFileCreator] corrected string" << s << "to" << corrected; 272 LOG_INFO() << "corrected string" << s << "to" << corrected;
272 273
273 return corrected; 274 return corrected;
274 m_abort = true; 275 m_abort = true;
@@ -287,7 +288,7 @@ void TalkGenerator::setLang(QString name)
287 TTSBase* tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString()); 288 TTSBase* tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString());
288 if(!tts) 289 if(!tts)
289 { 290 {
290 qDebug() << "[TalkGenerator] getting the TTS object failed!"; 291 LOG_ERROR() << "getting the TTS object failed!";
291 return; 292 return;
292 } 293 }
293 QString vendor = tts->voiceVendor(); 294 QString vendor = tts->voiceVendor();
@@ -295,8 +296,8 @@ void TalkGenerator::setLang(QString name)
295 296
296 if(m_lang.isEmpty()) 297 if(m_lang.isEmpty())
297 m_lang = "english"; 298 m_lang = "english";
298 qDebug() << "[TalkGenerator] building string corrections list for" 299 LOG_INFO() << "building string corrections list for"
299 << m_lang << engine << vendor; 300 << m_lang << engine << vendor;
300 QTextStream stream(&correctionsFile); 301 QTextStream stream(&correctionsFile);
301 while(!stream.atEnd()) { 302 while(!stream.atEnd()) {
302 QString line = stream.readLine(); 303 QString line = stream.readLine();
diff --git a/rbutil/rbutilqt/base/ttscarbon.cpp b/rbutil/rbutilqt/base/ttscarbon.cpp
index ff7709dc63..a01d402cd4 100644
--- a/rbutil/rbutilqt/base/ttscarbon.cpp
+++ b/rbutil/rbutilqt/base/ttscarbon.cpp
@@ -28,6 +28,7 @@
28#include <unistd.h> 28#include <unistd.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <inttypes.h> 30#include <inttypes.h>
31#include "Logger.h"
31 32
32TTSCarbon::TTSCarbon(QObject* parent) : TTSBase(parent) 33TTSCarbon::TTSCarbon(QObject* parent) : TTSBase(parent)
33{ 34{
@@ -74,7 +75,7 @@ bool TTSCarbon::start(QString *errStr)
74 if(voiceIndex == numVoices) { 75 if(voiceIndex == numVoices) {
75 // voice not found. Add user notification here and proceed with 76 // voice not found. Add user notification here and proceed with
76 // system default voice. 77 // system default voice.
77 qDebug() << "[TTSCarbon] Selected voice not found, using system default!"; 78 LOG_WARNING() << "Selected voice not found, using system default!";
78 GetVoiceDescription(&vspec, &vdesc, sizeof(vdesc)); 79 GetVoiceDescription(&vspec, &vdesc, sizeof(vdesc));
79 if(vdesc.script != -1) 80 if(vdesc.script != -1)
80 m_voiceScript = (CFStringBuiltInEncodings)vdesc.script; 81 m_voiceScript = (CFStringBuiltInEncodings)vdesc.script;
diff --git a/rbutil/rbutilqt/base/ttsexes.cpp b/rbutil/rbutilqt/base/ttsexes.cpp
index 348db103bc..a8c10bfb19 100644
--- a/rbutil/rbutilqt/base/ttsexes.cpp
+++ b/rbutil/rbutilqt/base/ttsexes.cpp
@@ -20,6 +20,7 @@
20#include "ttsexes.h" 20#include "ttsexes.h"
21#include "utils.h" 21#include "utils.h"
22#include "rbsettings.h" 22#include "rbsettings.h"
23#include "Logger.h"
23 24
24TTSExes::TTSExes(QObject* parent) : TTSBase(parent) 25TTSExes::TTSExes(QObject* parent) : TTSBase(parent)
25{ 26{
@@ -85,15 +86,15 @@ TTSStatus TTSExes::voice(QString text, QString wavfile, QString *errStr)
85 QString execstring; 86 QString execstring;
86 if(wavfile.isEmpty() && m_capabilities & TTSBase::CanSpeak) { 87 if(wavfile.isEmpty() && m_capabilities & TTSBase::CanSpeak) {
87 if(m_TTSSpeakTemplate.isEmpty()) { 88 if(m_TTSSpeakTemplate.isEmpty()) {
88 qDebug() << "[TTSExes] internal error: TTS announces CanSpeak " 89 LOG_ERROR() << "internal error: TTS announces CanSpeak "
89 "but template empty!"; 90 "but template empty!";
90 return FatalError; 91 return FatalError;
91 } 92 }
92 execstring = m_TTSSpeakTemplate; 93 execstring = m_TTSSpeakTemplate;
93 } 94 }
94 else if(wavfile.isEmpty()) { 95 else if(wavfile.isEmpty()) {
95 qDebug() << "[TTSExes] no output file passed to voice() " 96 LOG_ERROR() << "no output file passed to voice() "
96 "but TTS can't speak directly."; 97 "but TTS can't speak directly.";
97 return FatalError; 98 return FatalError;
98 } 99 }
99 else { 100 else {
@@ -108,7 +109,7 @@ TTSStatus TTSExes::voice(QString text, QString wavfile, QString *errStr)
108 QProcess::execute(execstring); 109 QProcess::execute(execstring);
109 110
110 if(!wavfile.isEmpty() && !QFileInfo(wavfile).isFile()) { 111 if(!wavfile.isEmpty() && !QFileInfo(wavfile).isFile()) {
111 qDebug() << "[TTSExes] output file does not exist:" << wavfile; 112 LOG_ERROR() << "output file does not exist:" << wavfile;
112 return FatalError; 113 return FatalError;
113 } 114 }
114 return NoError; 115 return NoError;
diff --git a/rbutil/rbutilqt/base/ttsfestival.cpp b/rbutil/rbutilqt/base/ttsfestival.cpp
index cbf24a3f03..41358ba488 100644
--- a/rbutil/rbutilqt/base/ttsfestival.cpp
+++ b/rbutil/rbutilqt/base/ttsfestival.cpp
@@ -22,10 +22,11 @@
22#include "ttsfestival.h" 22#include "ttsfestival.h"
23#include "utils.h" 23#include "utils.h"
24#include "rbsettings.h" 24#include "rbsettings.h"
25#include "Logger.h"
25 26
26TTSFestival::~TTSFestival() 27TTSFestival::~TTSFestival()
27{ 28{
28 qDebug() << "[Festival] Destroying instance"; 29 LOG_INFO() << "Destroying instance";
29 stop(); 30 stop();
30} 31}
31 32
@@ -87,7 +88,7 @@ void TTSFestival::updateVoiceDescription()
87 currentPath = getSetting(eSERVERPATH)->current().toString(); 88 currentPath = getSetting(eSERVERPATH)->current().toString();
88 QString info = getVoiceInfo(getSetting(eVOICE)->current().toString()); 89 QString info = getVoiceInfo(getSetting(eVOICE)->current().toString());
89 currentPath = ""; 90 currentPath = "";
90 91
91 getSetting(eVOICEDESC)->setCurrent(info); 92 getSetting(eVOICEDESC)->setCurrent(info);
92} 93}
93 94
@@ -101,7 +102,7 @@ void TTSFestival::updateVoiceList()
101 currentPath = getSetting(eSERVERPATH)->current().toString(); 102 currentPath = getSetting(eSERVERPATH)->current().toString();
102 QStringList voiceList = getVoiceList(); 103 QStringList voiceList = getVoiceList();
103 currentPath = ""; 104 currentPath = "";
104 105
105 getSetting(eVOICE)->setList(voiceList); 106 getSetting(eVOICE)->setList(voiceList);
106 if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0)); 107 if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0));
107 else getSetting(eVOICE)->setCurrent(""); 108 else getSetting(eVOICE)->setCurrent("");
@@ -130,9 +131,10 @@ void TTSFestival::startServer()
130 QCoreApplication::processEvents(QEventLoop::AllEvents, 50); 131 QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
131 132
132 if(serverProcess.state() == QProcess::Running) 133 if(serverProcess.state() == QProcess::Running)
133 qDebug() << "[Festival] Server is up and running"; 134 LOG_INFO() << "Server is up and running";
134 else 135 else
135 qDebug() << "[Festival] Server failed to start, state: " << serverProcess.state(); 136 LOG_ERROR() << "Server failed to start, state:"
137 << serverProcess.state();
136 } 138 }
137} 139}
138 140
@@ -147,8 +149,9 @@ bool TTSFestival::ensureServerRunning()
147 149
148bool TTSFestival::start(QString* errStr) 150bool TTSFestival::start(QString* errStr)
149{ 151{
150 qDebug() << "[Festival] Starting server with voice " << RbSettings::subValue("festival", RbSettings::TtsVoice).toString(); 152 LOG_INFO() << "Starting server with voice"
151 153 << RbSettings::subValue("festival", RbSettings::TtsVoice).toString();
154
152 bool running = ensureServerRunning(); 155 bool running = ensureServerRunning();
153 if (!RbSettings::subValue("festival",RbSettings::TtsVoice).toString().isEmpty()) 156 if (!RbSettings::subValue("festival",RbSettings::TtsVoice).toString().isEmpty())
154 { 157 {
@@ -156,17 +159,17 @@ bool TTSFestival::start(QString* errStr)
156 QString voiceSelect = QString("(voice.select '%1)\n") 159 QString voiceSelect = QString("(voice.select '%1)\n")
157 .arg(RbSettings::subValue("festival", RbSettings::TtsVoice).toString()); 160 .arg(RbSettings::subValue("festival", RbSettings::TtsVoice).toString());
158 queryServer(voiceSelect, 3000); 161 queryServer(voiceSelect, 3000);
159 162
160 if(prologFile.open()) 163 if(prologFile.open())
161 { 164 {
162 prologFile.write(voiceSelect.toLatin1()); 165 prologFile.write(voiceSelect.toLatin1());
163 prologFile.close(); 166 prologFile.close();
164 prologPath = QFileInfo(prologFile).absoluteFilePath(); 167 prologPath = QFileInfo(prologFile).absoluteFilePath();
165 qDebug() << "[Festival] Prolog created at " << prologPath; 168 LOG_INFO() << "Prolog created at" << prologPath;
166 } 169 }
167 170
168 } 171 }
169 172
170 if (!running) 173 if (!running)
171 (*errStr) = "Festival could not be started"; 174 (*errStr) = "Festival could not be started";
172 return running; 175 return running;
@@ -182,13 +185,13 @@ bool TTSFestival::stop()
182 185
183TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr) 186TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
184{ 187{
185 qDebug() << "[Festival] Voicing " << text << "->" << wavfile; 188 LOG_INFO() << "Voicing" << text << "->" << wavfile;
186 189
187 QString path = RbSettings::subValue("festival-client", 190 QString path = RbSettings::subValue("festival-client",
188 RbSettings::TtsPath).toString(); 191 RbSettings::TtsPath).toString();
189 QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp" 192 QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp"
190 " --output \"%2\" --prolog \"%3\" - ").arg(path).arg(wavfile).arg(prologPath); 193 " --output \"%2\" --prolog \"%3\" - ").arg(path).arg(wavfile).arg(prologPath);
191 qDebug() << "[Festival] Client cmd: " << cmd; 194 LOG_INFO() << "Client cmd:" << cmd;
192 195
193 QProcess clientProcess; 196 QProcess clientProcess;
194 clientProcess.start(cmd); 197 clientProcess.start(cmd);
@@ -200,7 +203,7 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
200 response = response.trimmed(); 203 response = response.trimmed();
201 if(!response.contains("Utterance")) 204 if(!response.contains("Utterance"))
202 { 205 {
203 qDebug() << "[Festival] Could not voice string: " << response; 206 LOG_WARNING() << "Could not voice string: " << response;
204 *errStr = tr("engine could not voice string"); 207 *errStr = tr("engine could not voice string");
205 return Warning; 208 return Warning;
206 /* do not stop the voicing process because of a single string 209 /* do not stop the voicing process because of a single string
@@ -231,10 +234,10 @@ bool TTSFestival::configOk()
231 ret = ret && (voices.indexOf(RbSettings::subValue("festival", 234 ret = ret && (voices.indexOf(RbSettings::subValue("festival",
232 RbSettings::TtsVoice).toString()) != -1); 235 RbSettings::TtsVoice).toString()) != -1);
233 } 236 }
234 else /* If we're currently configuring the server, we need to know that 237 else /* If we're currently configuring the server, we need to know that
235 the entered path is valid */ 238 the entered path is valid */
236 ret = QFileInfo(currentPath).isExecutable(); 239 ret = QFileInfo(currentPath).isExecutable();
237 240
238 return ret; 241 return ret;
239} 242}
240 243
@@ -245,7 +248,7 @@ QStringList TTSFestival::getVoiceList()
245 248
246 if(voices.size() > 0) 249 if(voices.size() > 0)
247 { 250 {
248 qDebug() << "[Festival] Using voice cache"; 251 LOG_INFO() << "Using voice cache";
249 return voices; 252 return voices;
250 } 253 }
251 254
@@ -261,9 +264,9 @@ QStringList TTSFestival::getVoiceList()
261 if (voices.size() == 1 && voices[0].size() == 0) 264 if (voices.size() == 1 && voices[0].size() == 0)
262 voices.removeAt(0); 265 voices.removeAt(0);
263 if (voices.size() > 0) 266 if (voices.size() > 0)
264 qDebug() << "[Festival] Voices: " << voices; 267 LOG_INFO() << "Voices:" << voices;
265 else 268 else
266 qDebug() << "[Festival] No voices. Response was: " << response; 269 LOG_WARNING() << "No voices. Response was:" << response;
267 270
268 return voices; 271 return voices;
269} 272}
@@ -290,7 +293,7 @@ QString TTSFestival::getVoiceInfo(QString voice)
290 { 293 {
291 response = response.remove(QRegExp("(description \"*\")", 294 response = response.remove(QRegExp("(description \"*\")",
292 Qt::CaseInsensitive, QRegExp::Wildcard)); 295 Qt::CaseInsensitive, QRegExp::Wildcard));
293 qDebug() << "[Festival] voiceInfo w/o descr: " << response; 296 LOG_INFO() << "voiceInfo w/o descr:" << response;
294 response = response.remove(')'); 297 response = response.remove(')');
295 QStringList responseLines = response.split('(', QString::SkipEmptyParts); 298 QStringList responseLines = response.split('(', QString::SkipEmptyParts);
296 responseLines.removeAt(0); // the voice name itself 299 responseLines.removeAt(0); // the voice name itself
@@ -327,12 +330,12 @@ QString TTSFestival::queryServer(QString query, int timeout)
327 330
328 // this operation could take some time 331 // this operation could take some time
329 emit busy(); 332 emit busy();
330 333
331 qDebug() << "[Festival] queryServer with " << query; 334 LOG_INFO() << "queryServer with" << query;
332 335
333 if (!ensureServerRunning()) 336 if (!ensureServerRunning())
334 { 337 {
335 qDebug() << "[Festival] queryServer: ensureServerRunning failed"; 338 LOG_ERROR() << "queryServer: ensureServerRunning failed";
336 emit busyEnd(); 339 emit busyEnd();
337 return ""; 340 return "";
338 } 341 }
@@ -393,7 +396,7 @@ QString TTSFestival::queryServer(QString query, int timeout)
393 lines.removeLast(); /* should be ft_StUfF_keyOK */ 396 lines.removeLast(); /* should be ft_StUfF_keyOK */
394 } 397 }
395 else 398 else
396 qDebug() << "[Festival] Response too short: " << response; 399 LOG_ERROR() << "Response too short:" << response;
397 400
398 emit busyEnd(); 401 emit busyEnd();
399 return lines.join("\n"); 402 return lines.join("\n");
diff --git a/rbutil/rbutilqt/base/ttssapi.cpp b/rbutil/rbutilqt/base/ttssapi.cpp
index 603e7c5559..320ee1191a 100644
--- a/rbutil/rbutilqt/base/ttssapi.cpp
+++ b/rbutil/rbutilqt/base/ttssapi.cpp
@@ -20,6 +20,7 @@
20#include "utils.h" 20#include "utils.h"
21#include "rbsettings.h" 21#include "rbsettings.h"
22#include "systeminfo.h" 22#include "systeminfo.h"
23#include "Logger.h"
23 24
24TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent) 25TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
25{ 26{
@@ -89,7 +90,7 @@ void TTSSapi::saveSettings()
89 90
90void TTSSapi::updateVoiceList() 91void TTSSapi::updateVoiceList()
91{ 92{
92 qDebug() << "[TTSSapi] updating voicelist"; 93 LOG_INFO() << "updating voicelist";
93 QStringList voiceList = getVoiceList(getSetting(eLANGUAGE)->current().toString()); 94 QStringList voiceList = getVoiceList(getSetting(eLANGUAGE)->current().toString());
94 getSetting(eVOICE)->setList(voiceList); 95 getSetting(eVOICE)->setList(voiceList);
95 if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0)); 96 if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0));
@@ -122,15 +123,15 @@ bool TTSSapi::start(QString *errStr)
122 execstring.replace("%voice",m_TTSVoice); 123 execstring.replace("%voice",m_TTSVoice);
123 execstring.replace("%speed",m_TTSSpeed); 124 execstring.replace("%speed",m_TTSSpeed);
124 125
125 qDebug() << "[TTSSapi] Start:" << execstring; 126 LOG_INFO() << "Start:" << execstring;
126 voicescript = new QProcess(NULL); 127 voicescript = new QProcess(NULL);
127 //connect(voicescript,SIGNAL(readyReadStandardError()),this,SLOT(error())); 128 //connect(voicescript,SIGNAL(readyReadStandardError()),this,SLOT(error()));
128 voicescript->start(execstring); 129 voicescript->start(execstring);
129 qDebug() << "[TTSSapi] wait for process"; 130 LOG_INFO() << "wait for process";
130 if(!voicescript->waitForStarted()) 131 if(!voicescript->waitForStarted())
131 { 132 {
132 *errStr = tr("Could not start SAPI process"); 133 *errStr = tr("Could not start SAPI process");
133 qDebug() << "[TTSSapi] starting process timed out!"; 134 LOG_ERROR() << "starting process timed out!";
134 return false; 135 return false;
135 } 136 }
136 137
@@ -161,7 +162,7 @@ QString TTSSapi::voiceVendor(void)
161 while((vendor = voicestream->readLine()).isEmpty()) 162 while((vendor = voicestream->readLine()).isEmpty())
162 QCoreApplication::processEvents(); 163 QCoreApplication::processEvents();
163 164
164 qDebug() << "[TTSSAPI] TTS vendor:" << vendor; 165 LOG_INFO() << "TTS vendor:" << vendor;
165 if(!keeprunning) { 166 if(!keeprunning) {
166 stop(); 167 stop();
167 } 168 }
@@ -184,12 +185,12 @@ QStringList TTSSapi::getVoiceList(QString language)
184 execstring.replace("%exe",m_TTSexec); 185 execstring.replace("%exe",m_TTSexec);
185 execstring.replace("%lang",language); 186 execstring.replace("%lang",language);
186 187
187 qDebug() << "[TTSSapi] Start:" << execstring; 188 LOG_INFO() << "Start:" << execstring;
188 voicescript = new QProcess(NULL); 189 voicescript = new QProcess(NULL);
189 voicescript->start(execstring); 190 voicescript->start(execstring);
190 qDebug() << "[TTSSapi] wait for process"; 191 LOG_INFO() << "wait for process";
191 if(!voicescript->waitForStarted()) { 192 if(!voicescript->waitForStarted()) {
192 qDebug() << "[TTSSapi] process startup timed out!"; 193 LOG_INFO() << "process startup timed out!";
193 return result; 194 return result;
194 } 195 }
195 voicescript->closeWriteChannel(); 196 voicescript->closeWriteChannel();
@@ -197,7 +198,7 @@ QStringList TTSSapi::getVoiceList(QString language)
197 198
198 QString dataRaw = voicescript->readAllStandardError().data(); 199 QString dataRaw = voicescript->readAllStandardError().data();
199 if(dataRaw.startsWith("Error")) { 200 if(dataRaw.startsWith("Error")) {
200 qDebug() << "[TTSSapi] Error:" << dataRaw; 201 LOG_INFO() << "Error:" << dataRaw;
201 } 202 }
202 result = dataRaw.split(";",QString::SkipEmptyParts); 203 result = dataRaw.split(";",QString::SkipEmptyParts);
203 if(result.size() > 0) 204 if(result.size() > 0)
@@ -226,7 +227,7 @@ TTSStatus TTSSapi::voice(QString text,QString wavfile, QString *errStr)
226{ 227{
227 (void) errStr; 228 (void) errStr;
228 QString query = "SPEAK\t"+wavfile+"\t"+text; 229 QString query = "SPEAK\t"+wavfile+"\t"+text;
229 qDebug() << "[TTSSapi] voicing" << query; 230 LOG_INFO() << "voicing" << query;
230 // append newline to query. Done now to keep debug output more readable. 231 // append newline to query. Done now to keep debug output more readable.
231 query.append("\r\n"); 232 query.append("\r\n");
232 *voicestream << query; 233 *voicestream << query;
@@ -236,7 +237,7 @@ TTSStatus TTSSapi::voice(QString text,QString wavfile, QString *errStr)
236 voicescript->waitForReadyRead(); 237 voicescript->waitForReadyRead();
237 238
238 if(!QFileInfo(wavfile).isFile()) { 239 if(!QFileInfo(wavfile).isFile()) {
239 qDebug() << "[TTSSapi] output file does not exist:" << wavfile; 240 LOG_ERROR() << "output file does not exist:" << wavfile;
240 return FatalError; 241 return FatalError;
241 } 242 }
242 return NoError; 243 return NoError;
diff --git a/rbutil/rbutilqt/base/uninstall.cpp b/rbutil/rbutilqt/base/uninstall.cpp
index ef6eb61ca5..498edbb057 100644
--- a/rbutil/rbutilqt/base/uninstall.cpp
+++ b/rbutil/rbutilqt/base/uninstall.cpp
@@ -19,6 +19,7 @@
19#include <QtCore> 19#include <QtCore>
20#include "uninstall.h" 20#include "uninstall.h"
21#include "utils.h" 21#include "utils.h"
22#include "Logger.h"
22 23
23Uninstaller::Uninstaller(QObject* parent,QString mountpoint): QObject(parent) 24Uninstaller::Uninstaller(QObject* parent,QString mountpoint): QObject(parent)
24{ 25{
@@ -66,7 +67,7 @@ void Uninstaller::uninstall(void)
66 if(installlog.contains(toDeleteList.at(j))) 67 if(installlog.contains(toDeleteList.at(j)))
67 { 68 {
68 deleteFile = false; 69 deleteFile = false;
69 qDebug() << "[Uninstaller] file still in use:" << toDeleteList.at(j); 70 LOG_INFO() << "file still in use:" << toDeleteList.at(j);
70 } 71 }
71 installlog.endGroup(); 72 installlog.endGroup();
72 } 73 }
@@ -79,7 +80,7 @@ void Uninstaller::uninstall(void)
79 emit logItem(tr("Could not delete %1") 80 emit logItem(tr("Could not delete %1")
80 .arg(toDelete.filePath()), LOGWARNING); 81 .arg(toDelete.filePath()), LOGWARNING);
81 installlog.remove(toDeleteList.at(j)); 82 installlog.remove(toDeleteList.at(j));
82 qDebug() << "[Uninstaller] deleted:" << toDelete.filePath(); 83 LOG_INFO() << "deleted:" << toDelete.filePath();
83 } 84 }
84 else // if it is a dir, remember it for later deletion 85 else // if it is a dir, remember it for later deletion
85 { 86 {
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 1aeea7f18c..6a817e86da 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -21,6 +21,7 @@
21#include "system.h" 21#include "system.h"
22#include "rbsettings.h" 22#include "rbsettings.h"
23#include "systeminfo.h" 23#include "systeminfo.h"
24#include "Logger.h"
24 25
25#ifdef UNICODE 26#ifdef UNICODE
26#define _UNICODE 27#define _UNICODE
@@ -125,7 +126,7 @@ QString Utils::resolvePathCase(QString path)
125 else 126 else
126 return QString(""); 127 return QString("");
127 } 128 }
128 qDebug() << "[Utils] resolving path" << path << "->" << realpath; 129 LOG_INFO() << "resolving path" << path << "->" << realpath;
129 return realpath; 130 return realpath;
130} 131}
131 132
@@ -179,7 +180,7 @@ QString Utils::filesystemName(QString path)
179 } while(result == noErr); 180 } while(result == noErr);
180#endif 181#endif
181 182
182 qDebug() << "[Utils] Volume name of" << path << "is" << name; 183 LOG_INFO() << "Volume name of" << path << "is" << name;
183 return name; 184 return name;
184} 185}
185 186
@@ -190,7 +191,7 @@ QString Utils::filesystemName(QString path)
190qulonglong Utils::filesystemFree(QString path) 191qulonglong Utils::filesystemFree(QString path)
191{ 192{
192 qulonglong size = filesystemSize(path, FilesystemFree); 193 qulonglong size = filesystemSize(path, FilesystemFree);
193 qDebug() << "[Utils] free disk space for" << path << size; 194 LOG_INFO() << "free disk space for" << path << size;
194 return size; 195 return size;
195} 196}
196 197
@@ -198,7 +199,7 @@ qulonglong Utils::filesystemFree(QString path)
198qulonglong Utils::filesystemTotal(QString path) 199qulonglong Utils::filesystemTotal(QString path)
199{ 200{
200 qulonglong size = filesystemSize(path, FilesystemTotal); 201 qulonglong size = filesystemSize(path, FilesystemTotal);
201 qDebug() << "[Utils] total disk space for" << path << size; 202 LOG_INFO() << "total disk space for" << path << size;
202 return size; 203 return size;
203} 204}
204 205
@@ -206,7 +207,7 @@ qulonglong Utils::filesystemTotal(QString path)
206qulonglong Utils::filesystemClusterSize(QString path) 207qulonglong Utils::filesystemClusterSize(QString path)
207{ 208{
208 qulonglong size = filesystemSize(path, FilesystemClusterSize); 209 qulonglong size = filesystemSize(path, FilesystemClusterSize);
209 qDebug() << "[Utils] cluster size for" << path << size; 210 LOG_INFO() << "cluster size for" << path << size;
210 return size; 211 return size;
211} 212}
212 213
@@ -273,7 +274,7 @@ QString Utils::findExecutable(QString name)
273#elif defined(Q_OS_WIN) 274#elif defined(Q_OS_WIN)
274 QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts); 275 QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
275#endif 276#endif
276 qDebug() << "[Utils] system path:" << path; 277 LOG_INFO() << "system path:" << path;
277 for(int i = 0; i < path.size(); i++) 278 for(int i = 0; i < path.size(); i++)
278 { 279 {
279 QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + name; 280 QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + name;
@@ -284,11 +285,11 @@ QString Utils::findExecutable(QString name)
284#endif 285#endif
285 if(QFileInfo(executable).isExecutable()) 286 if(QFileInfo(executable).isExecutable())
286 { 287 {
287 qDebug() << "[Utils] findExecutable: found" << executable; 288 LOG_INFO() << "findExecutable: found" << executable;
288 return QDir::toNativeSeparators(executable); 289 return QDir::toNativeSeparators(executable);
289 } 290 }
290 } 291 }
291 qDebug() << "[Utils] findExecutable: could not find" << name; 292 LOG_INFO() << "findExecutable: could not find" << name;
292 return ""; 293 return "";
293} 294}
294 295
@@ -299,7 +300,7 @@ QString Utils::findExecutable(QString name)
299 */ 300 */
300QString Utils::checkEnvironment(bool permission) 301QString Utils::checkEnvironment(bool permission)
301{ 302{
302 qDebug() << "[Utils] checking environment"; 303 LOG_INFO() << "checking environment";
303 QString text = ""; 304 QString text = "";
304 305
305 // check permission 306 // check permission
@@ -338,7 +339,7 @@ QString Utils::checkEnvironment(bool permission)
338 */ 339 */
339int Utils::compareVersionStrings(QString s1, QString s2) 340int Utils::compareVersionStrings(QString s1, QString s2)
340{ 341{
341 qDebug() << "[Utils] comparing version strings" << s1 << "and" << s2; 342 LOG_INFO() << "comparing version strings" << s1 << "and" << s2;
342 QString a = s1.trimmed(); 343 QString a = s1.trimmed();
343 QString b = s2.trimmed(); 344 QString b = s2.trimmed();
344 // if strings are identical return 0. 345 // if strings are identical return 0.
@@ -418,7 +419,7 @@ int Utils::compareVersionStrings(QString s1, QString s2)
418 */ 419 */
419QString Utils::resolveDevicename(QString path) 420QString Utils::resolveDevicename(QString path)
420{ 421{
421 qDebug() << "[Utils] resolving device name" << path; 422 LOG_INFO() << "resolving device name" << path;
422#if defined(Q_OS_LINUX) 423#if defined(Q_OS_LINUX)
423 FILE *mn = setmntent("/etc/mtab", "r"); 424 FILE *mn = setmntent("/etc/mtab", "r");
424 if(!mn) 425 if(!mn)
@@ -434,7 +435,7 @@ QString Utils::resolveDevicename(QString path)
434 && (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive) 435 && (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)
435 || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) { 436 || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) {
436 endmntent(mn); 437 endmntent(mn);
437 qDebug() << "[Utils] device name is" << ent->mnt_fsname; 438 LOG_INFO() << "device name is" << ent->mnt_fsname;
438 return QString(ent->mnt_fsname); 439 return QString(ent->mnt_fsname);
439 } 440 }
440 } 441 }
@@ -453,7 +454,7 @@ QString Utils::resolveDevicename(QString path)
453 if(QString(mntinf->f_mntonname) == path 454 if(QString(mntinf->f_mntonname) == path
454 && (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive) 455 && (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)
455 || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) { 456 || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) {
456 qDebug() << "[Utils] device name is" << mntinf->f_mntfromname; 457 LOG_INFO() << "device name is" << mntinf->f_mntfromname;
457 return QString(mntinf->f_mntfromname); 458 return QString(mntinf->f_mntfromname);
458 } 459 }
459 mntinf++; 460 mntinf++;
@@ -471,17 +472,17 @@ QString Utils::resolveDevicename(QString path)
471 h = CreateFile(uncpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 472 h = CreateFile(uncpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
472 NULL, OPEN_EXISTING, 0, NULL); 473 NULL, OPEN_EXISTING, 0, NULL);
473 if(h == INVALID_HANDLE_VALUE) { 474 if(h == INVALID_HANDLE_VALUE) {
474 //qDebug() << "error getting extents for" << uncpath; 475 //LOG_INFO() << "error getting extents for" << uncpath;
475 return ""; 476 return "";
476 } 477 }
477 // get the extents 478 // get the extents
478 if(DeviceIoControl(h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, 479 if(DeviceIoControl(h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
479 NULL, 0, extents, sizeof(buffer), &written, NULL)) { 480 NULL, 0, extents, sizeof(buffer), &written, NULL)) {
480 if(extents->NumberOfDiskExtents > 1) { 481 if(extents->NumberOfDiskExtents > 1) {
481 qDebug() << "[Utils] resolving device name: volume spans multiple disks!"; 482 LOG_INFO() << "resolving device name: volume spans multiple disks!";
482 return ""; 483 return "";
483 } 484 }
484 qDebug() << "[Utils] device name is" << extents->Extents[0].DiskNumber; 485 LOG_INFO() << "device name is" << extents->Extents[0].DiskNumber;
485 return QString("%1").arg(extents->Extents[0].DiskNumber); 486 return QString("%1").arg(extents->Extents[0].DiskNumber);
486 } 487 }
487#endif 488#endif
@@ -496,7 +497,7 @@ QString Utils::resolveDevicename(QString path)
496 */ 497 */
497QString Utils::resolveMountPoint(QString device) 498QString Utils::resolveMountPoint(QString device)
498{ 499{
499 qDebug() << "[Utils] resolving mountpoint:" << device; 500 LOG_INFO() << "resolving mountpoint:" << device;
500 501
501#if defined(Q_OS_LINUX) 502#if defined(Q_OS_LINUX)
502 FILE *mn = setmntent("/etc/mtab", "r"); 503 FILE *mn = setmntent("/etc/mtab", "r");
@@ -511,11 +512,11 @@ QString Utils::resolveMountPoint(QString device)
511 QString result; 512 QString result;
512 if(QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive) 513 if(QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)
513 || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive)) { 514 || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive)) {
514 qDebug() << "[Utils] resolved mountpoint is:" << ent->mnt_dir; 515 LOG_INFO() << "resolved mountpoint is:" << ent->mnt_dir;
515 result = QString(ent->mnt_dir); 516 result = QString(ent->mnt_dir);
516 } 517 }
517 else { 518 else {
518 qDebug() << "[Utils] mountpoint is wrong filesystem!"; 519 LOG_INFO() << "mountpoint is wrong filesystem!";
519 } 520 }
520 endmntent(mn); 521 endmntent(mn);
521 return result; 522 return result;
@@ -536,11 +537,11 @@ QString Utils::resolveMountPoint(QString device)
536 if(QString(mntinf->f_mntfromname) == device) { 537 if(QString(mntinf->f_mntfromname) == device) {
537 if(QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive) 538 if(QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)
538 || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive)) { 539 || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive)) {
539 qDebug() << "[Utils] resolved mountpoint is:" << mntinf->f_mntonname; 540 LOG_INFO() << "resolved mountpoint is:" << mntinf->f_mntonname;
540 return QString(mntinf->f_mntonname); 541 return QString(mntinf->f_mntonname);
541 } 542 }
542 else { 543 else {
543 qDebug() << "[Utils] mountpoint is wrong filesystem!"; 544 LOG_INFO() << "mountpoint is wrong filesystem!";
544 return QString(); 545 return QString();
545 } 546 }
546 } 547 }
@@ -556,14 +557,14 @@ QString Utils::resolveMountPoint(QString device)
556 for(letter = 'A'; letter <= 'Z'; letter++) { 557 for(letter = 'A'; letter <= 'Z'; letter++) {
557 if(resolveDevicename(QString(letter)).toUInt() == driveno) { 558 if(resolveDevicename(QString(letter)).toUInt() == driveno) {
558 result = letter; 559 result = letter;
559 qDebug() << "[Utils] resolved mountpoint is:" << result; 560 LOG_INFO() << "resolved mountpoint is:" << result;
560 break; 561 break;
561 } 562 }
562 } 563 }
563 if(!result.isEmpty()) 564 if(!result.isEmpty())
564 return result + ":/"; 565 return result + ":/";
565#endif 566#endif
566 qDebug() << "[Utils] resolving mountpoint failed!"; 567 LOG_INFO() << "resolving mountpoint failed!";
567 return QString(""); 568 return QString("");
568} 569}
569 570
@@ -589,11 +590,11 @@ QStringList Utils::mountpoints(enum MountpointsFilter type)
589 QString fstype = QString::fromWCharArray(t); 590 QString fstype = QString::fromWCharArray(t);
590 if(type == MountpointsAll || supported.contains(fstype)) { 591 if(type == MountpointsAll || supported.contains(fstype)) {
591 tempList << list.at(i).absolutePath(); 592 tempList << list.at(i).absolutePath();
592 qDebug() << "[Utils] Added:" << list.at(i).absolutePath() 593 LOG_INFO() << "Added:" << list.at(i).absolutePath()
593 << "type" << fstype; 594 << "type" << fstype;
594 } 595 }
595 else { 596 else {
596 qDebug() << "[Utils] Ignored:" << list.at(i).absolutePath() 597 LOG_INFO() << "Ignored:" << list.at(i).absolutePath()
597 << "type" << fstype; 598 << "type" << fstype;
598 } 599 }
599 } 600 }
@@ -607,11 +608,11 @@ QStringList Utils::mountpoints(enum MountpointsFilter type)
607 while(num--) { 608 while(num--) {
608 if(type == MountpointsAll || supported.contains(mntinf->f_fstypename)) { 609 if(type == MountpointsAll || supported.contains(mntinf->f_fstypename)) {
609 tempList << QString(mntinf->f_mntonname); 610 tempList << QString(mntinf->f_mntonname);
610 qDebug() << "[Utils] Added:" << mntinf->f_mntonname 611 LOG_INFO() << "Added:" << mntinf->f_mntonname
611 << "is" << mntinf->f_mntfromname << "type" << mntinf->f_fstypename; 612 << "is" << mntinf->f_mntfromname << "type" << mntinf->f_fstypename;
612 } 613 }
613 else { 614 else {
614 qDebug() << "[Utils] Ignored:" << mntinf->f_mntonname 615 LOG_INFO() << "Ignored:" << mntinf->f_mntonname
615 << "is" << mntinf->f_mntfromname << "type" << mntinf->f_fstypename; 616 << "is" << mntinf->f_mntfromname << "type" << mntinf->f_fstypename;
616 } 617 }
617 mntinf++; 618 mntinf++;
@@ -626,11 +627,11 @@ QStringList Utils::mountpoints(enum MountpointsFilter type)
626 while((ent = getmntent(mn))) { 627 while((ent = getmntent(mn))) {
627 if(type == MountpointsAll || supported.contains(ent->mnt_type)) { 628 if(type == MountpointsAll || supported.contains(ent->mnt_type)) {
628 tempList << QString(ent->mnt_dir); 629 tempList << QString(ent->mnt_dir);
629 qDebug() << "[Utils] Added:" << ent->mnt_dir 630 LOG_INFO() << "Added:" << ent->mnt_dir
630 << "is" << ent->mnt_fsname << "type" << ent->mnt_type; 631 << "is" << ent->mnt_fsname << "type" << ent->mnt_type;
631 } 632 }
632 else { 633 else {
633 qDebug() << "[Utils] Ignored:" << ent->mnt_dir 634 LOG_INFO() << "Ignored:" << ent->mnt_dir
634 << "is" << ent->mnt_fsname << "type" << ent->mnt_type; 635 << "is" << ent->mnt_fsname << "type" << ent->mnt_type;
635 } 636 }
636 } 637 }
@@ -658,13 +659,13 @@ QStringList Utils::findRunningProcess(QStringList names)
658 659
659 hdl = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 660 hdl = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
660 if(hdl == INVALID_HANDLE_VALUE) { 661 if(hdl == INVALID_HANDLE_VALUE) {
661 qDebug() << "[Utils] CreateToolhelp32Snapshot failed."; 662 LOG_ERROR() << "CreateToolhelp32Snapshot failed.";
662 return found; 663 return found;
663 } 664 }
664 entry.dwSize = sizeof(PROCESSENTRY32); 665 entry.dwSize = sizeof(PROCESSENTRY32);
665 entry.szExeFile[0] = '\0'; 666 entry.szExeFile[0] = '\0';
666 if(!Process32First(hdl, &entry)) { 667 if(!Process32First(hdl, &entry)) {
667 qDebug() << "[Utils] Process32First failed."; 668 LOG_ERROR() << "Process32First failed.";
668 return found; 669 return found;
669 } 670 }
670 671
@@ -721,7 +722,7 @@ QStringList Utils::findRunningProcess(QStringList names)
721 found.append(processlist.at(index)); 722 found.append(processlist.at(index));
722 } 723 }
723 } 724 }
724 qDebug() << "[Utils] Found listed processes running:" << found; 725 LOG_INFO() << "Found listed processes running:" << found;
725 return found; 726 return found;
726} 727}
727 728
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index 70c0f7b653..814ac538e2 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -23,6 +23,7 @@
23#include "rbsettings.h" 23#include "rbsettings.h"
24#include "systeminfo.h" 24#include "systeminfo.h"
25#include "ziputil.h" 25#include "ziputil.h"
26#include "Logger.h"
26 27
27VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent) 28VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent)
28{ 29{
@@ -65,7 +66,7 @@ bool VoiceFileCreator::createVoiceFile()
65 66
66 // check if voicefile is present on target 67 // check if voicefile is present on target
67 QString fn = m_mountpoint + "/.rockbox/langs/voicestrings.zip"; 68 QString fn = m_mountpoint + "/.rockbox/langs/voicestrings.zip";
68 qDebug() << "[VoiceFile] searching for zipped voicestrings at" << fn; 69 LOG_INFO() << "searching for zipped voicestrings at" << fn;
69 if(QFileInfo(fn).isFile()) { 70 if(QFileInfo(fn).isFile()) {
70 // search for binary voice strings file in archive 71 // search for binary voice strings file in archive
71 ZipUtil z(this); 72 ZipUtil z(this);
@@ -79,7 +80,7 @@ bool VoiceFileCreator::createVoiceFile()
79 } 80 }
80 } 81 }
81 if(index < contents.size()) { 82 if(index < contents.size()) {
82 qDebug() << "[VoiceFile] extracting strings file from zip"; 83 LOG_INFO() << "extracting strings file from zip";
83 // extract strings 84 // extract strings
84 QTemporaryFile stringsfile; 85 QTemporaryFile stringsfile;
85 stringsfile.open(); 86 stringsfile.open();
@@ -153,7 +154,7 @@ bool VoiceFileCreator::createVoiceFile()
153 genlang.replace("%REVISION%", version); 154 genlang.replace("%REVISION%", version);
154 genlang.replace("%FEATURES%", features); 155 genlang.replace("%FEATURES%", features);
155 QUrl genlangUrl(genlang); 156 QUrl genlangUrl(genlang);
156 qDebug() << "[VoiceFileCreator] downloading" << genlangUrl; 157 LOG_INFO() << "downloading" << genlangUrl;
157 158
158 //download the correct genlang output 159 //download the correct genlang output
159 QTemporaryFile *downloadFile = new QTemporaryFile(this); 160 QTemporaryFile *downloadFile = new QTemporaryFile(this);
@@ -175,7 +176,7 @@ bool VoiceFileCreator::createVoiceFile()
175 176
176void VoiceFileCreator::downloadDone(bool error) 177void VoiceFileCreator::downloadDone(bool error)
177{ 178{
178 qDebug() << "[VoiceFileCreator] download done, error:" << error; 179 LOG_INFO() << "download done, error:" << error;
179 180
180 // update progress bar 181 // update progress bar
181 emit logProgress(1,1); 182 emit logProgress(1,1);
@@ -253,7 +254,7 @@ void VoiceFileCreator::create(void)
253 m_talkList.append(entry); 254 m_talkList.append(entry);
254 } 255 }
255 else if(entry.toSpeak.isEmpty()) { 256 else if(entry.toSpeak.isEmpty()) {
256 qDebug() << "[Voicefile] Empty voice string for ID" << id; 257 LOG_WARNING() << "Empty voice string for ID" << id;
257 } 258 }
258 else { 259 else {
259 m_talkList.append(entry); 260 m_talkList.append(entry);
@@ -314,7 +315,7 @@ void VoiceFileCreator::create(void)
314 return; 315 return;
315 } 316 }
316 317
317 qDebug() << "[VoiceFile] Running voicefont, format" << m_voiceformat; 318 LOG_INFO() << "Running voicefont, format" << m_voiceformat;
318 voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output, m_voiceformat); 319 voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output, m_voiceformat);
319 // ids2 and output are closed by voicefont(). 320 // ids2 and output are closed by voicefont().
320 321
diff --git a/rbutil/rbutilqt/base/zipinstaller.cpp b/rbutil/rbutilqt/base/zipinstaller.cpp
index e24199408e..b2c8e09178 100644
--- a/rbutil/rbutilqt/base/zipinstaller.cpp
+++ b/rbutil/rbutilqt/base/zipinstaller.cpp
@@ -20,6 +20,7 @@
20#include "zipinstaller.h" 20#include "zipinstaller.h"
21#include "utils.h" 21#include "utils.h"
22#include "ziputil.h" 22#include "ziputil.h"
23#include "Logger.h"
23 24
24ZipInstaller::ZipInstaller(QObject* parent): QObject(parent) 25ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
25{ 26{
@@ -31,7 +32,7 @@ ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
31 32
32void ZipInstaller::install() 33void ZipInstaller::install()
33{ 34{
34 qDebug() << "[ZipInstall] initializing installation"; 35 LOG_INFO() << "initializing installation";
35 36
36 runner = 0; 37 runner = 0;
37 connect(this, SIGNAL(cont()), this, SLOT(installContinue())); 38 connect(this, SIGNAL(cont()), this, SLOT(installContinue()));
@@ -44,17 +45,17 @@ void ZipInstaller::install()
44 45
45void ZipInstaller::abort() 46void ZipInstaller::abort()
46{ 47{
47 qDebug() << "[ZipInstall] Aborted"; 48 LOG_INFO() << "Aborted";
48 emit internalAborted(); 49 emit internalAborted();
49} 50}
50 51
51 52
52void ZipInstaller::installContinue() 53void ZipInstaller::installContinue()
53{ 54{
54 qDebug() << "[ZipInstall] continuing installation"; 55 LOG_INFO() << "continuing installation";
55 56
56 runner++; // this gets called when a install finished, so increase first. 57 runner++; // this gets called when a install finished, so increase first.
57 qDebug() << "[ZipInstall] runner done:" << runner << "/" << m_urllist.size(); 58 LOG_INFO() << "runner done:" << runner << "/" << m_urllist.size();
58 if(runner < m_urllist.size()) { 59 if(runner < m_urllist.size()) {
59 emit logItem(tr("done."), LOGOK); 60 emit logItem(tr("done."), LOGOK);
60 m_url = m_urllist.at(runner); 61 m_url = m_urllist.at(runner);
@@ -74,7 +75,7 @@ void ZipInstaller::installContinue()
74 75
75void ZipInstaller::installStart() 76void ZipInstaller::installStart()
76{ 77{
77 qDebug() << "[ZipInstall] starting installation"; 78 LOG_INFO() << "starting installation";
78 79
79 emit logItem(tr("Downloading file %1.%2").arg(QFileInfo(m_url).baseName(), 80 emit logItem(tr("Downloading file %1.%2").arg(QFileInfo(m_url).baseName(),
80 QFileInfo(m_url).completeSuffix()),LOGINFO); 81 QFileInfo(m_url).completeSuffix()),LOGINFO);
@@ -105,7 +106,7 @@ void ZipInstaller::installStart()
105 106
106void ZipInstaller::downloadDone(bool error) 107void ZipInstaller::downloadDone(bool error)
107{ 108{
108 qDebug() << "[ZipInstall] download done, error:" << error; 109 LOG_INFO() << "download done, error:" << error;
109 QStringList zipContents; // needed later 110 QStringList zipContents; // needed later
110 // update progress bar 111 // update progress bar
111 112
@@ -127,7 +128,7 @@ void ZipInstaller::downloadDone(bool error)
127 QCoreApplication::processEvents(); 128 QCoreApplication::processEvents();
128 if(m_unzip) { 129 if(m_unzip) {
129 // unzip downloaded file 130 // unzip downloaded file
130 qDebug() << "[ZipInstall] about to unzip " << m_file << "to" << m_mountpoint; 131 LOG_INFO() << "about to unzip" << m_file << "to" << m_mountpoint;
131 132
132 emit logItem(tr("Extracting file."), LOGINFO); 133 emit logItem(tr("Extracting file."), LOGINFO);
133 QCoreApplication::processEvents(); 134 QCoreApplication::processEvents();
@@ -159,7 +160,7 @@ void ZipInstaller::downloadDone(bool error)
159 else { 160 else {
160 // only copy the downloaded file to the output location / name 161 // only copy the downloaded file to the output location / name
161 emit logItem(tr("Installing file."), LOGINFO); 162 emit logItem(tr("Installing file."), LOGINFO);
162 qDebug() << "[ZipInstall] saving downloaded file (no extraction)"; 163 LOG_INFO() << "saving downloaded file (no extraction)";
163 164
164 m_downloadFile->open(); // copy fails if file is not opened (filename issue?) 165 m_downloadFile->open(); // copy fails if file is not opened (filename issue?)
165 // make sure the required path is existing 166 // make sure the required path is existing
diff --git a/rbutil/rbutilqt/base/zipinstaller.h b/rbutil/rbutilqt/base/zipinstaller.h
index 4ea08fbe53..97a5156ee8 100644
--- a/rbutil/rbutilqt/base/zipinstaller.h
+++ b/rbutil/rbutilqt/base/zipinstaller.h
@@ -26,6 +26,7 @@
26 26
27#include "progressloggerinterface.h" 27#include "progressloggerinterface.h"
28#include "httpget.h" 28#include "httpget.h"
29#include "Logger.h"
29 30
30class ZipInstaller : public QObject 31class ZipInstaller : public QObject
31{ 32{
@@ -40,9 +41,9 @@ public:
40 void setLogSection(QString name) {m_loglist = QStringList(name);} 41 void setLogSection(QString name) {m_loglist = QStringList(name);}
41 void setLogSection(QStringList name) { m_loglist = name; } 42 void setLogSection(QStringList name) { m_loglist = name; }
42 void setLogVersion(QString v = "") 43 void setLogVersion(QString v = "")
43 { m_verlist = QStringList(v); qDebug() << m_verlist;} 44 { m_verlist = QStringList(v); LOG_INFO() << m_verlist;}
44 void setLogVersion(QStringList v) 45 void setLogVersion(QStringList v)
45 { m_verlist = v; qDebug() << m_verlist;} 46 { m_verlist = v; LOG_INFO() << m_verlist;}
46 void setUnzip(bool i) { m_unzip = i; } 47 void setUnzip(bool i) { m_unzip = i; }
47 void setTarget(QString t) { m_target = t; } 48 void setTarget(QString t) { m_target = t; }
48 void setCache(QDir c) { m_cache = c; m_usecache = true; }; 49 void setCache(QDir c) { m_cache = c; m_usecache = true; };
diff --git a/rbutil/rbutilqt/base/ziputil.cpp b/rbutil/rbutilqt/base/ziputil.cpp
index b93d5fd86a..b6cfdddce2 100644
--- a/rbutil/rbutilqt/base/ziputil.cpp
+++ b/rbutil/rbutilqt/base/ziputil.cpp
@@ -20,6 +20,7 @@
20#include <QDebug> 20#include <QDebug>
21#include "ziputil.h" 21#include "ziputil.h"
22#include "progressloggerinterface.h" 22#include "progressloggerinterface.h"
23#include "Logger.h"
23 24
24#include "quazip/quazip.h" 25#include "quazip/quazip.h"
25#include "quazip/quazipfile.h" 26#include "quazip/quazipfile.h"
@@ -76,7 +77,7 @@ bool ZipUtil::close(void)
76//! @return true on success, false otherwise 77//! @return true on success, false otherwise
77bool ZipUtil::extractArchive(const QString& dest, QString file) 78bool ZipUtil::extractArchive(const QString& dest, QString file)
78{ 79{
79 qDebug() << "[ZipUtil] extractArchive" << dest << file; 80 LOG_INFO() << "extractArchive" << dest << file;
80 bool result = true; 81 bool result = true;
81 if(!m_zip) { 82 if(!m_zip) {
82 return false; 83 return false;
@@ -122,15 +123,15 @@ bool ZipUtil::extractArchive(const QString& dest, QString file)
122 if(!QDir().mkpath(QFileInfo(outfilename).absolutePath())) { 123 if(!QDir().mkpath(QFileInfo(outfilename).absolutePath())) {
123 result = false; 124 result = false;
124 emit logItem(tr("Creating output path failed"), LOGERROR); 125 emit logItem(tr("Creating output path failed"), LOGERROR);
125 qDebug() << "[ZipUtil] creating output path failed for:" 126 LOG_INFO() << "creating output path failed for:"
126 << outfilename; 127 << outfilename;
127 break; 128 break;
128 } 129 }
129 if(!outputFile.open(QFile::WriteOnly)) { 130 if(!outputFile.open(QFile::WriteOnly)) {
130 result = false; 131 result = false;
131 emit logItem(tr("Creating output file failed"), LOGERROR); 132 emit logItem(tr("Creating output file failed"), LOGERROR);
132 qDebug() << "[ZipUtil] creating output file failed:" 133 LOG_INFO() << "creating output file failed:"
133 << outfilename; 134 << outfilename;
134 break; 135 break;
135 } 136 }
136 currentFile->open(QIODevice::ReadOnly); 137 currentFile->open(QIODevice::ReadOnly);
@@ -138,8 +139,8 @@ bool ZipUtil::extractArchive(const QString& dest, QString file)
138 if(currentFile->getZipError() != UNZ_OK) { 139 if(currentFile->getZipError() != UNZ_OK) {
139 result = false; 140 result = false;
140 emit logItem(tr("Error during Zip operation"), LOGERROR); 141 emit logItem(tr("Error during Zip operation"), LOGERROR);
141 qDebug() << "[ZipUtil] QuaZip error:" << currentFile->getZipError() 142 LOG_INFO() << "QuaZip error:" << currentFile->getZipError()
142 << "on file" << currentFile->getFileName(); 143 << "on file" << currentFile->getFileName();
143 break; 144 break;
144 } 145 }
145 currentFile->close(); 146 currentFile->close();
@@ -162,7 +163,7 @@ bool ZipUtil::appendDirToArchive(QString& source, QString& basedir)
162{ 163{
163 bool result = true; 164 bool result = true;
164 if(!m_zip || !m_zip->isOpen()) { 165 if(!m_zip || !m_zip->isOpen()) {
165 qDebug() << "[ZipUtil] Zip file not open!"; 166 LOG_INFO() << "Zip file not open!";
166 return false; 167 return false;
167 } 168 }
168 // get a list of all files and folders. Needed for progress info and avoids 169 // get a list of all files and folders. Needed for progress info and avoids
@@ -176,14 +177,14 @@ bool ZipUtil::appendDirToArchive(QString& source, QString& basedir)
176 fileList.append(iterator.filePath()); 177 fileList.append(iterator.filePath());
177 } 178 }
178 } 179 }
179 qDebug() << "[ZipUtil] Adding" << fileList.size() << "files to archive"; 180 LOG_INFO() << "Adding" << fileList.size() << "files to archive";
180 181
181 int max = fileList.size(); 182 int max = fileList.size();
182 for(int i = 0; i < max; i++) { 183 for(int i = 0; i < max; i++) {
183 QString current = fileList.at(i); 184 QString current = fileList.at(i);
184 if(!appendFileToArchive(current, basedir)) { 185 if(!appendFileToArchive(current, basedir)) {
185 qDebug() << "[ZipUtil] Error appending file" << current 186 LOG_ERROR() << "Error appending file" << current
186 << "to archive" << m_zip->getZipName(); 187 << "to archive" << m_zip->getZipName();
187 result = false; 188 result = false;
188 break; 189 break;
189 } 190 }
@@ -199,7 +200,7 @@ bool ZipUtil::appendFileToArchive(QString& file, QString& basedir)
199{ 200{
200 bool result = true; 201 bool result = true;
201 if(!m_zip || !m_zip->isOpen()) { 202 if(!m_zip || !m_zip->isOpen()) {
202 qDebug() << "[ZipUtil] Zip file not open!"; 203 LOG_ERROR() << "Zip file not open!";
203 return false; 204 return false;
204 } 205 }
205 // skip folders, we can't add them. 206 // skip folders, we can't add them.
@@ -215,12 +216,12 @@ bool ZipUtil::appendFileToArchive(QString& file, QString& basedir)
215 QFile fin(file); 216 QFile fin(file);
216 217
217 if(!fin.open(QFile::ReadOnly)) { 218 if(!fin.open(QFile::ReadOnly)) {
218 qDebug() << "[ZipUtil] Could not open file for reading:" << file; 219 LOG_ERROR() << "Could not open file for reading:" << file;
219 return false; 220 return false;
220 } 221 }
221 if(!fout.open(QIODevice::WriteOnly, QuaZipNewInfo(newfile, infile))) { 222 if(!fout.open(QIODevice::WriteOnly, QuaZipNewInfo(newfile, infile))) {
222 fin.close(); 223 fin.close();
223 qDebug() << "[ZipUtil] Could not open file for writing:" << newfile; 224 LOG_ERROR() << "Could not open file for writing:" << newfile;
224 return false; 225 return false;
225 } 226 }
226 227
@@ -253,11 +254,11 @@ qint64 ZipUtil::totalUncompressedSize(unsigned int clustersize)
253 } 254 }
254 } 255 }
255 if(clustersize > 0) { 256 if(clustersize > 0) {
256 qDebug() << "[ZipUtil] calculation rounded to cluster size for each file:" 257 LOG_INFO() << "calculation rounded to cluster size for each file:"
257 << clustersize; 258 << clustersize;
258 } 259 }
259 qDebug() << "[ZipUtil] size of archive files uncompressed:" 260 LOG_INFO() << "size of archive files uncompressed:"
260 << uncompressed; 261 << uncompressed;
261 return uncompressed; 262 return uncompressed;
262} 263}
263 264
@@ -281,7 +282,7 @@ QList<QuaZipFileInfo> ZipUtil::contentProperties()
281{ 282{
282 QList<QuaZipFileInfo> items; 283 QList<QuaZipFileInfo> items;
283 if(!m_zip || !m_zip->isOpen()) { 284 if(!m_zip || !m_zip->isOpen()) {
284 qDebug() << "[ZipUtil] Zip file not open!"; 285 LOG_ERROR() << "Zip file not open!";
285 return items; 286 return items;
286 } 287 }
287 QuaZipFileInfo info; 288 QuaZipFileInfo info;
@@ -290,8 +291,8 @@ QList<QuaZipFileInfo> ZipUtil::contentProperties()
290 { 291 {
291 currentFile.getFileInfo(&info); 292 currentFile.getFileInfo(&info);
292 if(currentFile.getZipError() != UNZ_OK) { 293 if(currentFile.getZipError() != UNZ_OK) {
293 qDebug() << "[ZipUtil] QuaZip error:" << currentFile.getZipError() 294 LOG_ERROR() << "QuaZip error:" << currentFile.getZipError()
294 << "on file" << currentFile.getFileName(); 295 << "on file" << currentFile.getFileName();
295 return QList<QuaZipFileInfo>(); 296 return QList<QuaZipFileInfo>();
296 } 297 }
297 items.append(info); 298 items.append(info);
diff --git a/rbutil/rbutilqt/changelog.txt b/rbutil/rbutilqt/changelog.txt
index 35c5322dc9..7b3bef6cb9 100644
--- a/rbutil/rbutilqt/changelog.txt
+++ b/rbutil/rbutilqt/changelog.txt
@@ -13,5 +13,6 @@ Version 1.4
13* Save proxy password differently in configuration file (better solution for FS#12166). 13* Save proxy password differently in configuration file (better solution for FS#12166).
14* Add support for building Rockbox Utility with Qt5. 14* Add support for building Rockbox Utility with Qt5.
15* Add Changelog window. 15* Add Changelog window.
16* Rework System Trace functionality.
16 17
17 18
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 456e65cdd9..5a78c6f6a1 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -47,6 +47,7 @@
47#include "rbutilqt.h" 47#include "rbutilqt.h"
48 48
49#include "systrace.h" 49#include "systrace.h"
50#include "Logger.h"
50 51
51#define DEFAULT_LANG "English (en)" 52#define DEFAULT_LANG "English (en)"
52#define DEFAULT_LANG_CODE "en" 53#define DEFAULT_LANG_CODE "en"
@@ -125,7 +126,7 @@ Config::Config(QWidget *parent,int index) : QDialog(parent)
125 126
126void Config::accept() 127void Config::accept()
127{ 128{
128 qDebug() << "[Config] checking configuration"; 129 LOG_INFO() << "checking configuration";
129 QString errormsg = tr("The following errors occurred:") + "<ul>"; 130 QString errormsg = tr("The following errors occurred:") + "<ul>";
130 bool error = false; 131 bool error = false;
131 132
@@ -154,7 +155,7 @@ void Config::accept()
154 QUrl p = proxy; 155 QUrl p = proxy;
155 p.setPassword(proxy.password().toUtf8().toBase64()); 156 p.setPassword(proxy.password().toUtf8().toBase64());
156 RbSettings::setValue(RbSettings::Proxy, p.toString()); 157 RbSettings::setValue(RbSettings::Proxy, p.toString());
157 qDebug() << "[Config] setting proxy to:" << proxy.toString(QUrl::RemovePassword); 158 LOG_INFO() << "setting proxy to:" << proxy.toString(QUrl::RemovePassword);
158 // proxy type 159 // proxy type
159 QString proxyType; 160 QString proxyType;
160 if(ui.radioNoProxy->isChecked()) proxyType = "none"; 161 if(ui.radioNoProxy->isChecked()) proxyType = "none";
@@ -240,7 +241,7 @@ void Config::accept()
240 241
241void Config::abort() 242void Config::abort()
242{ 243{
243 qDebug() << "[Config] aborted."; 244 LOG_INFO() << "aborted.";
244 this->close(); 245 this->close();
245} 246}
246 247
@@ -334,7 +335,7 @@ void Config::showProxyPassword(bool show)
334 335
335void Config::showDisabled(bool show) 336void Config::showDisabled(bool show)
336{ 337{
337 qDebug() << "[Config] disabled targets shown:" << show; 338 LOG_INFO() << "disabled targets shown:" << show;
338 if(show) 339 if(show)
339 QMessageBox::warning(this, tr("Showing disabled targets"), 340 QMessageBox::warning(this, tr("Showing disabled targets"),
340 tr("You just enabled showing targets that are marked disabled. " 341 tr("You just enabled showing targets that are marked disabled. "
@@ -349,7 +350,7 @@ void Config::setDevices()
349{ 350{
350 351
351 // setup devices table 352 // setup devices table
352 qDebug() << "[Config] setting up devices list"; 353 LOG_INFO() << "setting up devices list";
353 354
354 QStringList platformList; 355 QStringList platformList;
355 if(ui.showDisabled->isChecked()) 356 if(ui.showDisabled->isChecked())
@@ -393,7 +394,7 @@ void Config::setDevices()
393 SystemInfo::CurName).toString() + 394 SystemInfo::CurName).toString() +
394 " (" +ServerInfo::platformValue(platformList.at(it), 395 " (" +ServerInfo::platformValue(platformList.at(it),
395 ServerInfo::CurStatus).toString() +")"; 396 ServerInfo::CurStatus).toString() +")";
396 qDebug() << "[Config] add supported device:" << brands.at(c) << curname; 397 LOG_INFO() << "add supported device:" << brands.at(c) << curname;
397 w2 = new QTreeWidgetItem(w, QStringList(curname)); 398 w2 = new QTreeWidgetItem(w, QStringList(curname));
398 w2->setData(0, Qt::UserRole, platformList.at(it)); 399 w2->setData(0, Qt::UserRole, platformList.at(it));
399 400
@@ -516,7 +517,7 @@ void Config::setSystemProxy(bool checked)
516 proxy.setPort(ui.proxyPort->text().toInt()); 517 proxy.setPort(ui.proxyPort->text().toInt());
517 // show system values in input box 518 // show system values in input box
518 QUrl envproxy = System::systemProxy(); 519 QUrl envproxy = System::systemProxy();
519 qDebug() << "[Config] setting system proxy" << envproxy; 520 LOG_INFO() << "setting system proxy" << envproxy;
520 521
521 ui.proxyHost->setText(envproxy.host()); 522 ui.proxyHost->setText(envproxy.host());
522 ui.proxyPort->setText(QString("%1").arg(envproxy.port())); 523 ui.proxyPort->setText(QString("%1").arg(envproxy.port()));
@@ -524,7 +525,7 @@ void Config::setSystemProxy(bool checked)
524 ui.proxyPass->setText(envproxy.password()); 525 ui.proxyPass->setText(envproxy.password());
525 526
526 if(envproxy.host().isEmpty() || envproxy.port() == -1) { 527 if(envproxy.host().isEmpty() || envproxy.port() == -1) {
527 qDebug() << "[Config] sytem proxy is invalid."; 528 LOG_WARNING() << "system proxy is invalid.";
528 QMessageBox::warning(this, tr("Proxy Detection"), 529 QMessageBox::warning(this, tr("Proxy Detection"),
529 tr("The System Proxy settings are invalid!\n" 530 tr("The System Proxy settings are invalid!\n"
530 "Rockbox Utility can't work with this proxy settings. " 531 "Rockbox Utility can't work with this proxy settings. "
@@ -571,7 +572,7 @@ QStringList Config::findLanguageFiles()
571 langs.append(a); 572 langs.append(a);
572 } 573 }
573 langs.sort(); 574 langs.sort();
574 qDebug() << "[Config] available lang files:" << langs; 575 LOG_INFO() << "available lang files:" << langs;
575 576
576 return langs; 577 return langs;
577} 578}
@@ -592,7 +593,7 @@ QString Config::languageName(const QString &qmFile)
592 593
593void Config::updateLanguage() 594void Config::updateLanguage()
594{ 595{
595 qDebug() << "[Config] update selected language"; 596 LOG_INFO() << "update selected language";
596 597
597 // remove all old translators 598 // remove all old translators
598 for(int i = 0; i < RbUtilQt::translators.size(); ++i) { 599 for(int i = 0; i < RbUtilQt::translators.size(); ++i) {
@@ -603,7 +604,7 @@ void Config::updateLanguage()
603 QList<QListWidgetItem*> a = ui.listLanguages->selectedItems(); 604 QList<QListWidgetItem*> a = ui.listLanguages->selectedItems();
604 if(a.size() > 0) 605 if(a.size() > 0)
605 language = lang.value(a.at(0)->text()); 606 language = lang.value(a.at(0)->text());
606 qDebug() << "[Config] new language:" << language; 607 LOG_INFO() << "new language:" << language;
607 608
608 QString applang = QLocale::system().name(); 609 QString applang = QLocale::system().name();
609 QTranslator *translator = new QTranslator(qApp); 610 QTranslator *translator = new QTranslator(qApp);
@@ -668,7 +669,7 @@ void Config::refreshMountpoint()
668 ui.mountPoint->addItem(QDir::toNativeSeparators(mps.at(i)), description); 669 ui.mountPoint->addItem(QDir::toNativeSeparators(mps.at(i)), description);
669 } 670 }
670 else { 671 else {
671 qDebug() << "[Config] mountpoint not writable, skipping:" << mps.at(i); 672 LOG_WARNING() << "mountpoint not writable, skipping:" << mps.at(i);
672 } 673 }
673 } 674 }
674 if(!mountpoint.isEmpty()) { 675 if(!mountpoint.isEmpty()) {
@@ -682,7 +683,7 @@ void Config::updateMountpoint(QString m)
682{ 683{
683 if(!m.isEmpty()) { 684 if(!m.isEmpty()) {
684 mountpoint = QDir::fromNativeSeparators(m); 685 mountpoint = QDir::fromNativeSeparators(m);
685 qDebug() << "[Config] Mountpoint set to" << mountpoint; 686 LOG_INFO() << "Mountpoint set to" << mountpoint;
686 } 687 }
687} 688}
688 689
@@ -695,7 +696,7 @@ void Config::updateMountpoint(int idx)
695 QString mp = ui.mountPoint->itemText(idx); 696 QString mp = ui.mountPoint->itemText(idx);
696 if(!mp.isEmpty()) { 697 if(!mp.isEmpty()) {
697 mountpoint = QDir::fromNativeSeparators(mp); 698 mountpoint = QDir::fromNativeSeparators(mp);
698 qDebug() << "[Config] Mountpoint set to" << mountpoint; 699 LOG_INFO() << "Mountpoint set to" << mountpoint;
699 } 700 }
700} 701}
701 702
@@ -715,7 +716,7 @@ void Config::setMountpoint(QString m)
715 ui.mountPoint->addItem(QDir::toNativeSeparators(m)); 716 ui.mountPoint->addItem(QDir::toNativeSeparators(m));
716 ui.mountPoint->setCurrentIndex(ui.mountPoint->findText(m)); 717 ui.mountPoint->setCurrentIndex(ui.mountPoint->findText(m));
717 } 718 }
718 qDebug() << "[Config] Mountpoint set to" << mountpoint; 719 LOG_INFO() << "Mountpoint set to" << mountpoint;
719} 720}
720 721
721 722
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
index f008c31f7b..b56ffdb2c7 100644
--- a/rbutil/rbutilqt/createvoicewindow.cpp
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -23,6 +23,7 @@
23#include "configure.h" 23#include "configure.h"
24#include "rbsettings.h" 24#include "rbsettings.h"
25#include "systeminfo.h" 25#include "systeminfo.h"
26#include "Logger.h"
26 27
27CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent) 28CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
28{ 29{
@@ -88,7 +89,7 @@ void CreateVoiceWindow::updateSettings(void)
88 f = languages.value(uilang).at(0); 89 f = languages.value(uilang).at(0);
89 } 90 }
90 sel = ui.comboLanguage->findData(f); 91 sel = ui.comboLanguage->findData(f);
91 qDebug() << "[CreateVoiceWindow] Selected language index:" << sel; 92 LOG_INFO() << "Selected language index:" << sel;
92 } 93 }
93 ui.comboLanguage->setCurrentIndex(sel); 94 ui.comboLanguage->setCurrentIndex(sel);
94 95
diff --git a/rbutil/rbutilqt/encttscfggui.cpp b/rbutil/rbutilqt/encttscfggui.cpp
index 6a51869318..54ec4bc67a 100644
--- a/rbutil/rbutilqt/encttscfggui.cpp
+++ b/rbutil/rbutilqt/encttscfggui.cpp
@@ -32,6 +32,7 @@
32#include <QCheckBox> 32#include <QCheckBox>
33#include <QProgressDialog> 33#include <QProgressDialog>
34#include "encttscfggui.h" 34#include "encttscfggui.h"
35#include "Logger.h"
35 36
36EncTtsCfgGui::EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* iface, QString name) 37EncTtsCfgGui::EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* iface, QString name)
37 : QDialog(parent) 38 : QDialog(parent)
@@ -174,7 +175,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
174 } 175 }
175 default: 176 default:
176 { 177 {
177 qDebug() << "Warning: unknown EncTTsSetting type" << setting->type(); 178 LOG_WARNING() << "Warning: unknown EncTTsSetting type" << setting->type();
178 break; 179 break;
179 } 180 }
180 } 181 }
@@ -252,7 +253,7 @@ void EncTtsCfgGui::updateSetting()
252 } 253 }
253 default: 254 default:
254 { 255 {
255 qDebug() << "unknown Settingtype !!"; 256 LOG_WARNING() << "unknown setting type!";
256 break; 257 break;
257 } 258 }
258 } 259 }
@@ -331,7 +332,7 @@ void EncTtsCfgGui::updateWidget()
331 } 332 }
332 default: 333 default:
333 { 334 {
334 qDebug() << "unknown EncTTsSetting"; 335 LOG_WARNING() << "unknown EncTTsSetting";
335 break; 336 break;
336 } 337 }
337 } 338 }
diff --git a/rbutil/rbutilqt/gui/backupdialog.cpp b/rbutil/rbutilqt/gui/backupdialog.cpp
index 1571ae9191..f12c47b570 100644
--- a/rbutil/rbutilqt/gui/backupdialog.cpp
+++ b/rbutil/rbutilqt/gui/backupdialog.cpp
@@ -26,6 +26,7 @@
26#include "progressloggergui.h" 26#include "progressloggergui.h"
27#include "ziputil.h" 27#include "ziputil.h"
28#include "rockboxinfo.h" 28#include "rockboxinfo.h"
29#include "Logger.h"
29 30
30class BackupSizeThread : public QThread 31class BackupSizeThread : public QThread
31{ 32{
@@ -42,14 +43,14 @@ class BackupSizeThread : public QThread
42 43
43void BackupSizeThread::run(void) 44void BackupSizeThread::run(void)
44{ 45{
45 qDebug() << "BackupSizeThread] Thread started, calculating" << m_path; 46 LOG_INFO() << "Thread started, calculating" << m_path;
46 m_currentSize = 0; 47 m_currentSize = 0;
47 48
48 QDirIterator it(m_path, QDirIterator::Subdirectories); 49 QDirIterator it(m_path, QDirIterator::Subdirectories);
49 while(it.hasNext()) { 50 while(it.hasNext()) {
50 m_currentSize += QFileInfo(it.next()).size(); 51 m_currentSize += QFileInfo(it.next()).size();
51 } 52 }
52 qDebug() << "[BackupSizeThread] Thread done, sum:" << m_currentSize; 53 LOG_INFO() << "Thread done, sum:" << m_currentSize;
53} 54}
54 55
55 56
diff --git a/rbutil/rbutilqt/gui/infowidget.cpp b/rbutil/rbutilqt/gui/infowidget.cpp
index bfc0742593..25b0503090 100644
--- a/rbutil/rbutilqt/gui/infowidget.cpp
+++ b/rbutil/rbutilqt/gui/infowidget.cpp
@@ -20,6 +20,7 @@
20#include <QDebug> 20#include <QDebug>
21#include "infowidget.h" 21#include "infowidget.h"
22#include "rbsettings.h" 22#include "rbsettings.h"
23#include "Logger.h"
23 24
24InfoWidget::InfoWidget(QWidget *parent) : QWidget(parent) 25InfoWidget::InfoWidget(QWidget *parent) : QWidget(parent)
25{ 26{
@@ -35,7 +36,7 @@ InfoWidget::InfoWidget(QWidget *parent) : QWidget(parent)
35 36
36void InfoWidget::updateInfo(void) 37void InfoWidget::updateInfo(void)
37{ 38{
38 qDebug() << "[InfoWidget] updating server info"; 39 LOG_INFO() << "updating server info";
39 40
40 QString mp = RbSettings::value(RbSettings::Mountpoint).toString(); 41 QString mp = RbSettings::value(RbSettings::Mountpoint).toString();
41 QSettings log(mp + "/.rockbox/rbutil.log", QSettings::IniFormat, this); 42 QSettings log(mp + "/.rockbox/rbutil.log", QSettings::IniFormat, this);
diff --git a/rbutil/rbutilqt/gui/manualwidget.cpp b/rbutil/rbutilqt/gui/manualwidget.cpp
index dc68e65460..0ba3012aea 100644
--- a/rbutil/rbutilqt/gui/manualwidget.cpp
+++ b/rbutil/rbutilqt/gui/manualwidget.cpp
@@ -24,6 +24,7 @@
24#include "rbsettings.h" 24#include "rbsettings.h"
25#include "serverinfo.h" 25#include "serverinfo.h"
26#include "systeminfo.h" 26#include "systeminfo.h"
27#include "Logger.h"
27 28
28ManualWidget::ManualWidget(QWidget *parent) : QWidget(parent) 29ManualWidget::ManualWidget(QWidget *parent) : QWidget(parent)
29{ 30{
@@ -36,7 +37,7 @@ ManualWidget::ManualWidget(QWidget *parent) : QWidget(parent)
36 37
37void ManualWidget::updateManual() 38void ManualWidget::updateManual()
38{ 39{
39 qDebug() << "[ManualWidget] updating manual URLs"; 40 LOG_INFO() << "updating manual URLs";
40 m_platform = RbSettings::value(RbSettings::Platform).toString(); 41 m_platform = RbSettings::value(RbSettings::Platform).toString();
41 if(!m_platform.isEmpty()) 42 if(!m_platform.isEmpty())
42 { 43 {
diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp
index 96183d1075..35837ba41d 100644
--- a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp
+++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp
@@ -30,6 +30,7 @@
30#include "bootloaderinstallhelper.h" 30#include "bootloaderinstallhelper.h"
31#include "themesinstallwindow.h" 31#include "themesinstallwindow.h"
32#include "utils.h" 32#include "utils.h"
33#include "Logger.h"
33 34
34SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent) 35SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent)
35{ 36{
@@ -147,7 +148,7 @@ void SelectiveInstallWidget::updateVersion(void)
147 148
148void SelectiveInstallWidget::saveSettings(void) 149void SelectiveInstallWidget::saveSettings(void)
149{ 150{
150 qDebug() << "[SelectiveInstallWidget] saving current settings"; 151 LOG_INFO() << "saving current settings";
151 152
152 RbSettings::setValue(RbSettings::InstallRockbox, ui.rockboxCheckbox->isChecked()); 153 RbSettings::setValue(RbSettings::InstallRockbox, ui.rockboxCheckbox->isChecked());
153 RbSettings::setValue(RbSettings::InstallFonts, ui.fontsCheckbox->isChecked()); 154 RbSettings::setValue(RbSettings::InstallFonts, ui.fontsCheckbox->isChecked());
@@ -158,7 +159,7 @@ void SelectiveInstallWidget::saveSettings(void)
158 159
159void SelectiveInstallWidget::startInstall(void) 160void SelectiveInstallWidget::startInstall(void)
160{ 161{
161 qDebug() << "[SelectiveInstallWidget] starting installation"; 162 LOG_INFO() << "starting installation";
162 saveSettings(); 163 saveSettings();
163 164
164 m_installStage = 0; 165 m_installStage = 0;
@@ -191,15 +192,15 @@ void SelectiveInstallWidget::startInstall(void)
191 192
192void SelectiveInstallWidget::continueInstall(bool error) 193void SelectiveInstallWidget::continueInstall(bool error)
193{ 194{
194 qDebug() << "[SelectiveInstallWidget] continuing install with stage" << m_installStage; 195 LOG_INFO() << "continuing install with stage" << m_installStage;
195 if(error) { 196 if(error) {
196 qDebug() << "[SelectiveInstallWidget] Last part returned error."; 197 LOG_ERROR() << "Last part returned error.";
197 m_logger->setFinished(); 198 m_logger->setFinished();
198 m_installStage = 7; 199 m_installStage = 7;
199 } 200 }
200 m_installStage++; 201 m_installStage++;
201 switch(m_installStage) { 202 switch(m_installStage) {
202 case 0: qDebug() << "[SelectiveInstallWidget] Something wrong!"; break; 203 case 0: LOG_ERROR() << "Something wrong!"; break;
203 case 1: installBootloader(); break; 204 case 1: installBootloader(); break;
204 case 2: installRockbox(); break; 205 case 2: installRockbox(); break;
205 case 3: installFonts(); break; 206 case 3: installFonts(); break;
@@ -210,7 +211,7 @@ void SelectiveInstallWidget::continueInstall(bool error)
210 } 211 }
211 212
212 if(m_installStage > 6) { 213 if(m_installStage > 6) {
213 qDebug() << "[SelectiveInstallWidget] All install stages done."; 214 LOG_INFO() << "All install stages done.";
214 m_logger->setFinished(); 215 m_logger->setFinished();
215 if(m_blmethod != "none") { 216 if(m_blmethod != "none") {
216 // check if Rockbox is installed by looking after rockbox-info.txt. 217 // check if Rockbox is installed by looking after rockbox-info.txt.
@@ -225,7 +226,7 @@ void SelectiveInstallWidget::continueInstall(bool error)
225void SelectiveInstallWidget::installBootloader(void) 226void SelectiveInstallWidget::installBootloader(void)
226{ 227{
227 if(ui.bootloaderCheckbox->isChecked()) { 228 if(ui.bootloaderCheckbox->isChecked()) {
228 qDebug() << "[SelectiveInstallWidget] installing bootloader"; 229 LOG_INFO() << "installing bootloader";
229 230
230 QString platform = RbSettings::value(RbSettings::Platform).toString(); 231 QString platform = RbSettings::value(RbSettings::Platform).toString();
231 QString backupDestination = ""; 232 QString backupDestination = "";
@@ -292,7 +293,7 @@ void SelectiveInstallWidget::installBootloader(void)
292 if(!backupDestination.isEmpty()) 293 if(!backupDestination.isEmpty())
293 backupDestination += "/" + targetFolder; 294 backupDestination += "/" + targetFolder;
294 295
295 qDebug() << "[RbUtil] backing up to" << backupDestination; 296 LOG_INFO() << "backing up to" << backupDestination;
296 // backup needs to be done after the m_logger has been set up. 297 // backup needs to be done after the m_logger has been set up.
297 } 298 }
298 } 299 }
@@ -350,7 +351,7 @@ void SelectiveInstallWidget::installBootloader(void)
350 351
351 } 352 }
352 else { 353 else {
353 qDebug() << "[SelectiveInstallWidget] Bootloader install disabled."; 354 LOG_INFO() << "Bootloader install disabled.";
354 emit installSkipped(false); 355 emit installSkipped(false);
355 } 356 }
356} 357}
@@ -372,7 +373,7 @@ void SelectiveInstallWidget::installBootloaderPost()
372void SelectiveInstallWidget::installRockbox(void) 373void SelectiveInstallWidget::installRockbox(void)
373{ 374{
374 if(ui.rockboxCheckbox->isChecked()) { 375 if(ui.rockboxCheckbox->isChecked()) {
375 qDebug() << "[SelectiveInstallWidget] installing Rockbox"; 376 LOG_INFO() << "installing Rockbox";
376 QString url; 377 QString url;
377 378
378 QString selected = ui.selectedVersion->itemData(ui.selectedVersion->currentIndex()).toString(); 379 QString selected = ui.selectedVersion->itemData(ui.selectedVersion->currentIndex()).toString();
@@ -405,7 +406,7 @@ void SelectiveInstallWidget::installRockbox(void)
405 406
406 } 407 }
407 else { 408 else {
408 qDebug() << "[SelectiveInstallWidget] Rockbox install disabled."; 409 LOG_INFO() << "Rockbox install disabled.";
409 emit installSkipped(false); 410 emit installSkipped(false);
410 } 411 }
411} 412}
@@ -414,7 +415,7 @@ void SelectiveInstallWidget::installRockbox(void)
414void SelectiveInstallWidget::installFonts(void) 415void SelectiveInstallWidget::installFonts(void)
415{ 416{
416 if(ui.fontsCheckbox->isChecked()) { 417 if(ui.fontsCheckbox->isChecked()) {
417 qDebug() << "[SelectiveInstallWidget] installing Fonts"; 418 LOG_INFO() << "installing Fonts";
418 419
419 RockboxInfo installInfo(m_mountpoint); 420 RockboxInfo installInfo(m_mountpoint);
420 QString fontsurl; 421 QString fontsurl;
@@ -447,7 +448,7 @@ void SelectiveInstallWidget::installFonts(void)
447 m_zipinstaller->install(); 448 m_zipinstaller->install();
448 } 449 }
449 else { 450 else {
450 qDebug() << "[SelectiveInstallWidget] Fonts install disabled."; 451 LOG_INFO() << "Fonts install disabled.";
451 emit installSkipped(false); 452 emit installSkipped(false);
452 } 453 }
453} 454}
@@ -465,7 +466,7 @@ void SelectiveInstallWidget::customizeThemes(void)
465void SelectiveInstallWidget::installThemes(void) 466void SelectiveInstallWidget::installThemes(void)
466{ 467{
467 if(ui.themesCheckbox->isChecked()) { 468 if(ui.themesCheckbox->isChecked()) {
468 qDebug() << "[SelectiveInstallWidget] installing themes"; 469 LOG_INFO() << "installing themes";
469 if(m_themesinstaller == NULL) 470 if(m_themesinstaller == NULL)
470 m_themesinstaller = new ThemesInstallWindow(this); 471 m_themesinstaller = new ThemesInstallWindow(this);
471 472
@@ -475,7 +476,7 @@ void SelectiveInstallWidget::installThemes(void)
475 m_themesinstaller->install(); 476 m_themesinstaller->install();
476 } 477 }
477 else { 478 else {
478 qDebug() << "[SelectiveInstallWidget] Themes install disabled."; 479 LOG_INFO() << "Themes install disabled.";
479 emit installSkipped(false); 480 emit installSkipped(false);
480 } 481 }
481} 482}
@@ -489,7 +490,7 @@ void SelectiveInstallWidget::installGamefiles(void)
489 m_logger->addItem(tr("Your installation doesn't require game files, skipping."), LOGINFO); 490 m_logger->addItem(tr("Your installation doesn't require game files, skipping."), LOGINFO);
490 emit installSkipped(false); 491 emit installSkipped(false);
491 } 492 }
492 qDebug() << "[SelectiveInstallWidget] installing gamefiles"; 493 LOG_INFO() << "installing gamefiles";
493 // create new zip installer 494 // create new zip installer
494 if(m_zipinstaller != NULL) m_zipinstaller->deleteLater(); 495 if(m_zipinstaller != NULL) m_zipinstaller->deleteLater();
495 m_zipinstaller = new ZipInstaller(this); 496 m_zipinstaller = new ZipInstaller(this);
@@ -507,7 +508,7 @@ void SelectiveInstallWidget::installGamefiles(void)
507 m_zipinstaller->install(); 508 m_zipinstaller->install();
508 } 509 }
509 else { 510 else {
510 qDebug() << "[SelectiveInstallWidget] Gamefile install disabled."; 511 LOG_INFO() << "Gamefile install disabled.";
511 emit installSkipped(false); 512 emit installSkipped(false);
512 } 513 }
513} 514}
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index db5bccabe9..d9f2cc7e98 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -23,6 +23,7 @@
23#include "configure.h" 23#include "configure.h"
24#include "rbsettings.h" 24#include "rbsettings.h"
25#include "systeminfo.h" 25#include "systeminfo.h"
26#include "Logger.h"
26 27
27InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent) 28InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
28{ 29{
@@ -118,8 +119,8 @@ void InstallTalkWindow::accept()
118 connect(logger,SIGNAL(aborted()),talkcreator,SLOT(abort())); 119 connect(logger,SIGNAL(aborted()),talkcreator,SLOT(abort()));
119 120
120 for(int i = 0; i < foldersToTalk.size(); i++) { 121 for(int i = 0; i < foldersToTalk.size(); i++) {
121 qDebug() << "[InstallTalkWindow] creating talk files for folder" 122 LOG_INFO() << "creating talk files for folder"
122 << foldersToTalk.at(i); 123 << foldersToTalk.at(i);
123 talkcreator->setDir(foldersToTalk.at(i)); 124 talkcreator->setDir(foldersToTalk.at(i));
124 talkcreator->createTalkFiles(); 125 talkcreator->createTalkFiles();
125 } 126 }
diff --git a/rbutil/rbutilqt/logger/AbstractAppender.cpp b/rbutil/rbutilqt/logger/AbstractAppender.cpp
new file mode 100644
index 0000000000..de86b930d0
--- /dev/null
+++ b/rbutil/rbutilqt/logger/AbstractAppender.cpp
@@ -0,0 +1,58 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14// Local
15#include "AbstractAppender.h"
16
17// Qt
18#include <QMutexLocker>
19
20
21AbstractAppender::AbstractAppender()
22 : m_detailsLevel(Logger::Debug)
23{}
24
25
26AbstractAppender::~AbstractAppender()
27{}
28
29
30Logger::LogLevel AbstractAppender::detailsLevel() const
31{
32 QMutexLocker locker(&m_detailsLevelMutex);
33 return m_detailsLevel;
34}
35
36
37void AbstractAppender::setDetailsLevel(Logger::LogLevel level)
38{
39 QMutexLocker locker(&m_detailsLevelMutex);
40 m_detailsLevel = level;
41}
42
43
44void AbstractAppender::setDetailsLevel(const QString& level)
45{
46 setDetailsLevel(Logger::levelFromString(level));
47}
48
49
50void AbstractAppender::write(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
51 const char* function, const QString& message)
52{
53 if (logLevel >= detailsLevel())
54 {
55 QMutexLocker locker(&m_writeMutex);
56 append(timeStamp, logLevel, file, line, function, message);
57 }
58}
diff --git a/rbutil/rbutilqt/logger/AbstractAppender.h b/rbutil/rbutilqt/logger/AbstractAppender.h
new file mode 100644
index 0000000000..df1df4957c
--- /dev/null
+++ b/rbutil/rbutilqt/logger/AbstractAppender.h
@@ -0,0 +1,125 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14#ifndef ABSTRACTAPPENDER_H
15#define ABSTRACTAPPENDER_H
16
17// Local
18#include "CuteLogger_global.h"
19#include <Logger.h>
20
21// Qt
22#include <QMutex>
23
24//! The AbstractAppender class provides an abstract base class for writing a log entries.
25/**
26 * The AbstractAppender class is the base interface class for all log appenders that could be used with Logger.
27 *
28 * AbstractAppender provides a common implementation for the thread safe, mutex-protected logging of application
29 * messages, such as ConsoleAppender, FileAppender or something else. AbstractAppender is abstract and can not be
30 * instantiated, but you can use any of its subclasses or create a custom log appender at your choice.
31 *
32 * Appenders are the logical devices that is aimed to be attached to Logger object by calling
33 * Logger::registerAppender(). On each log record call from the application Logger object sequentially calls write()
34 * function on all the appenders registered in it.
35 *
36 * You can subclass AbstractAppender to implement a logging target of any kind you like. It may be the external logging
37 * subsystem (for example, syslog in *nix), XML file, SQL database entries, D-Bus messages or anything else you can
38 * imagine.
39 *
40 * For the simple non-structured plain text logging (for example, to a plain text file or to the console output) you may
41 * like to subclass the AbstractStringAppender instead of AbstractAppender, which will give you a more convinient way to
42 * control the format of the log output.
43 *
44 * \sa AbstractStringAppender
45 * \sa Logger::registerAppender()
46 */
47class CUTELOGGERSHARED_EXPORT AbstractAppender
48{
49 public:
50 //! Constructs a AbstractAppender object.
51 AbstractAppender();
52
53 //! Destructs the AbstractAppender object.
54 virtual ~AbstractAppender();
55
56 //! Returns the current details level of appender.
57 /**
58 * Log records with a log level lower than a current detailsLevel() will be silently ignored by appender and would not
59 * be sent to its append() function.
60 *
61 * It provides additional logging flexibility, allowing you to set the different severity levels for different types
62 * of logs.
63 *
64 * \note This function is thread safe.
65 *
66 * \sa setDetailsLevel()
67 * \sa Logger::LogLevel
68 */
69 Logger::LogLevel detailsLevel() const;
70
71 //! Sets the current details level of appender.
72 /**
73 * \note This function is thread safe.
74 *
75 * \sa detalsLevel()
76 * \sa Logger::LogLevel
77 */
78 void setDetailsLevel(Logger::LogLevel level);
79
80 //! Sets the current details level of appender
81 /**
82 * This function is provided for convinience, it behaves like an above function.
83 *
84 * \sa detalsLevel()
85 * \sa Logger::LogLevel
86 */
87 void setDetailsLevel(const QString& level);
88
89 //! Tries to write the log record to this logger
90 /**
91 * This is the function called by Logger object to write a log message to the appender.
92 *
93 * \note This function is thread safe.
94 *
95 * \sa Logger::write()
96 * \sa detailsLevel()
97 */
98 void write(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line, const char* function,
99 const QString& message);
100
101 protected:
102 //! Writes the log record to the logger instance
103 /**
104 * This function is called every time when user tries to write a message to this AbstractAppender instance using
105 * the write() function. Write function works as proxy and transfers only the messages with log level more or equal
106 * to the current logLevel().
107 *
108 * Overload this function when you are implementing a custom appender.
109 *
110 * \note This function is not needed to be thread safe because it is never called directly by Logger object. The
111 * write() function works as a proxy and protects this function from concurrent access.
112 *
113 * \sa Logger::write()
114 */
115 virtual void append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
116 const char* function, const QString& message) = 0;
117
118 private:
119 QMutex m_writeMutex;
120
121 Logger::LogLevel m_detailsLevel;
122 mutable QMutex m_detailsLevelMutex;
123};
124
125#endif // ABSTRACTAPPENDER_H
diff --git a/rbutil/rbutilqt/logger/AbstractStringAppender.cpp b/rbutil/rbutilqt/logger/AbstractStringAppender.cpp
new file mode 100644
index 0000000000..073ecb7782
--- /dev/null
+++ b/rbutil/rbutilqt/logger/AbstractStringAppender.cpp
@@ -0,0 +1,161 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14// Local
15#include "AbstractStringAppender.h"
16
17// Qt
18#include <QReadLocker>
19#include <QWriteLocker>
20#include <QDateTime>
21#include <QRegExp>
22
23const char formattingMarker = '%';
24
25AbstractStringAppender::AbstractStringAppender()
26 : m_format(QLatin1String("%t{yyyy-MM-ddTHH:mm:ss.zzz} [%-7l] <%c> %m\n"))
27{}
28
29
30QString AbstractStringAppender::format() const
31{
32 QReadLocker locker(&m_formatLock);
33 return m_format;
34}
35
36
37void AbstractStringAppender::setFormat(const QString& format)
38{
39 QWriteLocker locker(&m_formatLock);
40 m_format = format;
41}
42
43
44QString AbstractStringAppender::stripFunctionName(const char* name)
45{
46 QRegExp rx("^.+\\s((?:[\\w\\d]+::)+)?([\\w\\d\\<\\>~]+)(?:\\(.*\\)).*$"); // XXX: SLOW!
47 return QString::fromLatin1(name).replace(rx, QString(QLatin1String("\\1\\2")));
48}
49
50
51QString AbstractStringAppender::formattedString(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file,
52 int line, const char* function, const QString& message) const
53{
54 QString f = format();
55 const int size = f.size();
56
57 QString result;
58
59 int i = 0;
60 while (i < f.size())
61 {
62 QChar c = f.at(i);
63
64 // We will silently ignore the broken % marker at the end of string
65 if (c != QLatin1Char(formattingMarker) || (i + 1) == size)
66 {
67 result.append(c);
68 }
69 else
70 {
71 QChar command = f.at(++i);
72
73 // Check for the padding instruction
74 int fieldWidth = 0;
75 if (command.isDigit() || command.category() == QChar::Punctuation_Dash)
76 {
77 int j = 1;
78 while ((i + j) < size && f.at(i + j).isDigit())
79 j++;
80 fieldWidth = f.mid(i, j).toInt();
81
82 i += j;
83 command = f.at(i);
84 }
85
86 // Log record chunk to insert instead of formatting instruction
87 QString chunk;
88
89 // Time stamp
90 if (command == QLatin1Char('t'))
91 {
92 if (f.at(i + 1) == QLatin1Char('{'))
93 {
94 int j = 1;
95 while ((i + 2 + j) < size && f.at(i + 2 + j) != QLatin1Char('}'))
96 j++;
97
98 if ((i + 2 + j) < size)
99 {
100 chunk = timeStamp.toString(f.mid(i + 2, j));
101
102 i += j;
103 i += 2;
104 }
105 }
106
107 if (chunk.isNull())
108 chunk = timeStamp.toString(QLatin1String("HH:mm:ss.zzz"));
109 }
110
111 // Log level
112 else if (command == QLatin1Char('l'))
113 chunk = Logger::levelToString(logLevel);
114
115 // Uppercased log level
116 else if (command == QLatin1Char('L'))
117 chunk = Logger::levelToString(logLevel).toUpper();
118
119 // Filename
120 else if (command == QLatin1Char('F'))
121 chunk = QLatin1String(file);
122
123 // Filename without a path
124 else if (command == QLatin1Char('f'))
125 chunk = QString(QLatin1String(file)).section('/', -1);
126
127 // Source line number
128 else if (command == QLatin1Char('i'))
129 chunk = QString::number(line);
130
131 // Function name, as returned by Q_FUNC_INFO
132 else if (command == QLatin1Char('C'))
133 chunk = QString::fromLatin1(function);
134
135 // Stripped function name
136 else if (command == QLatin1Char('c'))
137 chunk = stripFunctionName(function);
138
139 // Log message
140 else if (command == QLatin1Char('m'))
141 chunk = message;
142
143 // We simply replace the double formatting marker (%) with one
144 else if (command == QLatin1Char(formattingMarker))
145 chunk = QLatin1Char(formattingMarker);
146
147 // Do not process any unknown commands
148 else
149 {
150 chunk = QLatin1Char(formattingMarker);
151 chunk.append(command);
152 }
153
154 result.append(QString(QLatin1String("%1")).arg(chunk, fieldWidth));
155 }
156
157 ++i;
158 }
159
160 return result;
161}
diff --git a/rbutil/rbutilqt/logger/AbstractStringAppender.h b/rbutil/rbutilqt/logger/AbstractStringAppender.h
new file mode 100644
index 0000000000..3cef63bff9
--- /dev/null
+++ b/rbutil/rbutilqt/logger/AbstractStringAppender.h
@@ -0,0 +1,116 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14#ifndef ABSTRACTSTRINGAPPENDER_H
15#define ABSTRACTSTRINGAPPENDER_H
16
17// Local
18#include "CuteLogger_global.h"
19#include <AbstractAppender.h>
20
21// Qt
22#include <QReadWriteLock>
23
24
25//! The AbstractStringAppender class provides a convinient base for appenders working with plain text formatted logs.
26/**
27 * AbstractSringAppender is the simple extension of the AbstractAppender class providing the convinient way to create
28 * custom log appenders working with a plain text formatted log targets.
29 *
30 * It have the formattedString() protected function that formats the logging arguments according to a format set with
31 * setFormat().
32 *
33 * This class can not be directly instantiated because it contains pure virtual function inherited from AbstractAppender
34 * class.
35 *
36 * For more detailed description of customizing the log output format see the documentation on the setFormat() function.
37 */
38class CUTELOGGERSHARED_EXPORT AbstractStringAppender : public AbstractAppender
39{
40 public:
41 //! Constructs a new string appender object
42 AbstractStringAppender();
43
44 //! Returns the current log format string.
45 /**
46 * The default format is set to "%t{yyyy-MM-ddTHH:mm:ss.zzz} [%-7l] <%C> %m\n". You can set a different log record
47 * format using the setFormat() function.
48 *
49 * \sa setFormat(const QString&)
50 */
51 QString format() const;
52
53 //! Sets the logging format for writing strings to the log target with this appender.
54 /**
55 * The string format seems to be very common to those developers who have used a standart sprintf function.
56 *
57 * Log output format is a simple QString with the special markers (starting with % sign) which will be replaced with
58 * it's internal meaning when writing a log record.
59 *
60 * Controlling marker begins with the percent sign (%) which is followed by (optional) field width argument, the
61 * (necessary) single-letter command (which describes, what will be put to log record instead of marker, and an
62 * additional formatting argument (in the {} brackets) supported for some of the log commands.
63 *
64 * Field width argument works almost identically to the \c QString::arg() \c fieldWidth argument (and uses it
65 * internally). For example, \c "%-7l" will be replaced with the left padded debug level of the message
66 * (\c "Debug ") or something. For the more detailed description of it you may consider to look to the Qt
67 * Reference Documentation.
68 *
69 * Supported marker commands are:
70 * \arg \c %t - timestamp. You may specify your custom timestamp format using the {} brackets after the marker,
71 * timestamp format here will be similiar to those used in QDateTime::toString() function. For example,
72 * "%t{dd-MM-yyyy, HH:mm}" may be replaced with "17-12-2010, 20:17" depending on current date and time.
73 * The default format used here is "HH:mm:ss.zzz".
74 * \arg \c %l - Log level. Possible log levels are shown in the Logger::LogLevel enumerator.
75 * \arg \c %L - Uppercased log level.
76 * \arg \c %F - Full source file name (with path) of the file that requested log recording. Uses the \c __FILE__
77 * preprocessor macro.
78 * \arg \c %f - Short file name (with stripped path).
79 * \arg \c %i - Line number in the source file. Uses the \c __LINE__ preprocessor macro.
80 * \arg \c %C - Name of function that called on of the LOG_* macros. Uses the \c Q_FUNC_INFO macro provided with
81 * Qt.
82 * \arg \c %c - [EXPERIMENTAL] Similiar to the %C, but the function name is stripped using stripFunctionName
83 * \arg \c %m - The log message sent by the caller.
84 * \arg \c %% - Convinient marker that is replaced with the single \c % mark.
85 *
86 * \note Format doesn't add \c '\\n' to the end of the format line. Please consider adding it manually.
87 *
88 * \sa format()
89 * \sa stripFunctionName()
90 * \sa Logger::LogLevel
91 */
92 void setFormat(const QString&);
93
94 //! Strips the long function signature (as added by Q_FUNC_INFO macro)
95 /**
96 * The string processing drops the returning type, arguments and template parameters of function. It is definitely
97 * useful for enchancing the log output readability.
98 * \return stripped function name
99 */
100 static QString stripFunctionName(const char*);
101
102 protected:
103 //! Returns the string to record to the logging target, formatted according to the format().
104 /**
105 * \sa format()
106 * \sa setFormat(const QString&)
107 */
108 QString formattedString(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
109 const char* function, const QString& message) const;
110
111 private:
112 QString m_format;
113 mutable QReadWriteLock m_formatLock;
114};
115
116#endif // ABSTRACTSTRINGAPPENDER_H
diff --git a/rbutil/rbutilqt/logger/ConsoleAppender.cpp b/rbutil/rbutilqt/logger/ConsoleAppender.cpp
new file mode 100644
index 0000000000..da4a43c740
--- /dev/null
+++ b/rbutil/rbutilqt/logger/ConsoleAppender.cpp
@@ -0,0 +1,25 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14// Local
15#include "ConsoleAppender.h"
16
17// STL
18#include <iostream>
19
20
21void ConsoleAppender::append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
22 const char* function, const QString& message)
23{
24 std::cerr << qPrintable(formattedString(timeStamp, logLevel, file, line, function, message));
25}
diff --git a/rbutil/rbutilqt/logger/ConsoleAppender.h b/rbutil/rbutilqt/logger/ConsoleAppender.h
new file mode 100644
index 0000000000..fa685b5e82
--- /dev/null
+++ b/rbutil/rbutilqt/logger/ConsoleAppender.h
@@ -0,0 +1,32 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14#ifndef CONSOLEAPPENDER_H
15#define CONSOLEAPPENDER_H
16
17#include "CuteLogger_global.h"
18#include <AbstractStringAppender.h>
19
20//! ConsoleAppender is the simple appender that writes the log records to the std::cerr output stream.
21class CUTELOGGERSHARED_EXPORT ConsoleAppender : public AbstractStringAppender
22{
23 protected:
24 //! Writes the log record to the std::cerr stream.
25 /**
26 * \sa AbstractStringAppender::format()
27 */
28 virtual void append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
29 const char* function, const QString& message);
30};
31
32#endif // CONSOLEAPPENDER_H
diff --git a/rbutil/rbutilqt/logger/CuteLogger_global.h b/rbutil/rbutilqt/logger/CuteLogger_global.h
new file mode 100644
index 0000000000..43e74affdb
--- /dev/null
+++ b/rbutil/rbutilqt/logger/CuteLogger_global.h
@@ -0,0 +1,12 @@
1#ifndef CUTELOGGER_GLOBAL_H
2#define CUTELOGGER_GLOBAL_H
3
4#include <QtCore/qglobal.h>
5
6#if defined(CUTELOGGER_LIBRARY)
7# define CUTELOGGERSHARED_EXPORT Q_DECL_EXPORT
8#else
9# define CUTELOGGERSHARED_EXPORT Q_DECL_IMPORT
10#endif
11
12#endif // CUTELOGGER_GLOBAL_H
diff --git a/rbutil/rbutilqt/logger/FileAppender.cpp b/rbutil/rbutilqt/logger/FileAppender.cpp
new file mode 100644
index 0000000000..3e4d0e22f9
--- /dev/null
+++ b/rbutil/rbutilqt/logger/FileAppender.cpp
@@ -0,0 +1,85 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14// Local
15#include "FileAppender.h"
16
17// STL
18#include <iostream>
19
20
21FileAppender::FileAppender(const QString& fileName)
22{
23 setFileName(fileName);
24}
25
26
27FileAppender::~FileAppender()
28{
29 closeFile();
30}
31
32
33QString FileAppender::fileName() const
34{
35 QMutexLocker locker(&m_logFileMutex);
36 return m_logFile.fileName();
37}
38
39
40void FileAppender::setFileName(const QString& s)
41{
42 QMutexLocker locker(&m_logFileMutex);
43 if (m_logFile.isOpen())
44 m_logFile.close();
45
46 m_logFile.setFileName(s);
47}
48
49
50bool FileAppender::openFile()
51{
52 bool isOpen = false;
53 if (!m_logFile.isOpen())
54 {
55 if (m_logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
56 {
57 m_logStream.setDevice(&m_logFile);
58 isOpen = true;
59 }
60 else
61 {
62 std::cerr << "<FileAppender::append> Cannot open the log file " << qPrintable(m_logFile.fileName()) << std::endl;
63 }
64 }
65 return isOpen;
66}
67
68
69void FileAppender::append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
70 const char* function, const QString& message)
71{
72 QMutexLocker locker(&m_logFileMutex);
73
74 openFile();
75
76 m_logStream << formattedString(timeStamp, logLevel, file, line, function, message);
77 m_logStream.flush();
78 m_logFile.flush();
79}
80
81void FileAppender::closeFile()
82{
83 QMutexLocker locker(&m_logFileMutex);
84 m_logFile.close();
85}
diff --git a/rbutil/rbutilqt/logger/FileAppender.h b/rbutil/rbutilqt/logger/FileAppender.h
new file mode 100644
index 0000000000..70a70c3e43
--- /dev/null
+++ b/rbutil/rbutilqt/logger/FileAppender.h
@@ -0,0 +1,63 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14#ifndef FILEAPPENDER_H
15#define FILEAPPENDER_H
16
17// Logger
18#include "CuteLogger_global.h"
19#include <AbstractStringAppender.h>
20
21// Qt
22#include <QFile>
23#include <QTextStream>
24
25
26//! File is the simple appender that writes the log records to the plain text file.
27class CUTELOGGERSHARED_EXPORT FileAppender : public AbstractStringAppender
28{
29 public:
30 //! Constructs the new file appender assigned to file with the given name.
31 FileAppender(const QString& fileName = QString());
32 ~FileAppender();
33
34 //! Returns the name set by setFileName() or to the FileAppender constructor.
35 /**
36 * \sa setFileName()
37 */
38 QString fileName() const;
39
40 //! Sets the name of the file. The name can have no path, a relative path, or an absolute path.
41 /**
42 * \sa fileName()
43 */
44 void setFileName(const QString&);
45
46 protected:
47 //! Write the log record to the file.
48 /**
49 * \sa fileName()
50 * \sa AbstractStringAppender::format()
51 */
52 virtual void append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
53 const char* function, const QString& message);
54 bool openFile();
55 void closeFile();
56
57 private:
58 QFile m_logFile;
59 QTextStream m_logStream;
60 mutable QMutex m_logFileMutex;
61};
62
63#endif // FILEAPPENDER_H
diff --git a/rbutil/rbutilqt/logger/LICENSE.LGPL b/rbutil/rbutilqt/logger/LICENSE.LGPL
new file mode 100644
index 0000000000..5ab7695ab8
--- /dev/null
+++ b/rbutil/rbutilqt/logger/LICENSE.LGPL
@@ -0,0 +1,504 @@
1 GNU LESSER GENERAL PUBLIC LICENSE
2 Version 2.1, February 1999
3
4 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9[This is the first released version of the Lesser GPL. It also counts
10 as the successor of the GNU Library Public License, version 2, hence
11 the version number 2.1.]
12
13 Preamble
14
15 The licenses for most software are designed to take away your
16freedom to share and change it. By contrast, the GNU General Public
17Licenses are intended to guarantee your freedom to share and change
18free software--to make sure the software is free for all its users.
19
20 This license, the Lesser General Public License, applies to some
21specially designated software packages--typically libraries--of the
22Free Software Foundation and other authors who decide to use it. You
23can use it too, but we suggest you first think carefully about whether
24this license or the ordinary General Public License is the better
25strategy to use in any particular case, based on the explanations below.
26
27 When we speak of free software, we are referring to freedom of use,
28not price. Our General Public Licenses are designed to make sure that
29you have the freedom to distribute copies of free software (and charge
30for this service if you wish); that you receive source code or can get
31it if you want it; that you can change the software and use pieces of
32it in new free programs; and that you are informed that you can do
33these things.
34
35 To protect your rights, we need to make restrictions that forbid
36distributors to deny you these rights or to ask you to surrender these
37rights. These restrictions translate to certain responsibilities for
38you if you distribute copies of the library or if you modify it.
39
40 For example, if you distribute copies of the library, whether gratis
41or for a fee, you must give the recipients all the rights that we gave
42you. You must make sure that they, too, receive or can get the source
43code. If you link other code with the library, you must provide
44complete object files to the recipients, so that they can relink them
45with the library after making changes to the library and recompiling
46it. And you must show them these terms so they know their rights.
47
48 We protect your rights with a two-step method: (1) we copyright the
49library, and (2) we offer you this license, which gives you legal
50permission to copy, distribute and/or modify the library.
51
52 To protect each distributor, we want to make it very clear that
53there is no warranty for the free library. Also, if the library is
54modified by someone else and passed on, the recipients should know
55that what they have is not the original version, so that the original
56author's reputation will not be affected by problems that might be
57introduced by others.
58
59 Finally, software patents pose a constant threat to the existence of
60any free program. We wish to make sure that a company cannot
61effectively restrict the users of a free program by obtaining a
62restrictive license from a patent holder. Therefore, we insist that
63any patent license obtained for a version of the library must be
64consistent with the full freedom of use specified in this license.
65
66 Most GNU software, including some libraries, is covered by the
67ordinary GNU General Public License. This license, the GNU Lesser
68General Public License, applies to certain designated libraries, and
69is quite different from the ordinary General Public License. We use
70this license for certain libraries in order to permit linking those
71libraries into non-free programs.
72
73 When a program is linked with a library, whether statically or using
74a shared library, the combination of the two is legally speaking a
75combined work, a derivative of the original library. The ordinary
76General Public License therefore permits such linking only if the
77entire combination fits its criteria of freedom. The Lesser General
78Public License permits more lax criteria for linking other code with
79the library.
80
81 We call this license the "Lesser" General Public License because it
82does Less to protect the user's freedom than the ordinary General
83Public License. It also provides other free software developers Less
84of an advantage over competing non-free programs. These disadvantages
85are the reason we use the ordinary General Public License for many
86libraries. However, the Lesser license provides advantages in certain
87special circumstances.
88
89 For example, on rare occasions, there may be a special need to
90encourage the widest possible use of a certain library, so that it becomes
91a de-facto standard. To achieve this, non-free programs must be
92allowed to use the library. A more frequent case is that a free
93library does the same job as widely used non-free libraries. In this
94case, there is little to gain by limiting the free library to free
95software only, so we use the Lesser General Public License.
96
97 In other cases, permission to use a particular library in non-free
98programs enables a greater number of people to use a large body of
99free software. For example, permission to use the GNU C Library in
100non-free programs enables many more people to use the whole GNU
101operating system, as well as its variant, the GNU/Linux operating
102system.
103
104 Although the Lesser General Public License is Less protective of the
105users' freedom, it does ensure that the user of a program that is
106linked with the Library has the freedom and the wherewithal to run
107that program using a modified version of the Library.
108
109 The precise terms and conditions for copying, distribution and
110modification follow. Pay close attention to the difference between a
111"work based on the library" and a "work that uses the library". The
112former contains code derived from the library, whereas the latter must
113be combined with the library in order to run.
114
115 GNU LESSER GENERAL PUBLIC LICENSE
116 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
118 0. This License Agreement applies to any software library or other
119program which contains a notice placed by the copyright holder or
120other authorized party saying it may be distributed under the terms of
121this Lesser General Public License (also called "this License").
122Each licensee is addressed as "you".
123
124 A "library" means a collection of software functions and/or data
125prepared so as to be conveniently linked with application programs
126(which use some of those functions and data) to form executables.
127
128 The "Library", below, refers to any such software library or work
129which has been distributed under these terms. A "work based on the
130Library" means either the Library or any derivative work under
131copyright law: that is to say, a work containing the Library or a
132portion of it, either verbatim or with modifications and/or translated
133straightforwardly into another language. (Hereinafter, translation is
134included without limitation in the term "modification".)
135
136 "Source code" for a work means the preferred form of the work for
137making modifications to it. For a library, complete source code means
138all the source code for all modules it contains, plus any associated
139interface definition files, plus the scripts used to control compilation
140and installation of the library.
141
142 Activities other than copying, distribution and modification are not
143covered by this License; they are outside its scope. The act of
144running a program using the Library is not restricted, and output from
145such a program is covered only if its contents constitute a work based
146on the Library (independent of the use of the Library in a tool for
147writing it). Whether that is true depends on what the Library does
148and what the program that uses the Library does.
149
150 1. You may copy and distribute verbatim copies of the Library's
151complete source code as you receive it, in any medium, provided that
152you conspicuously and appropriately publish on each copy an
153appropriate copyright notice and disclaimer of warranty; keep intact
154all the notices that refer to this License and to the absence of any
155warranty; and distribute a copy of this License along with the
156Library.
157
158 You may charge a fee for the physical act of transferring a copy,
159and you may at your option offer warranty protection in exchange for a
160fee.
161
162 2. You may modify your copy or copies of the Library or any portion
163of it, thus forming a work based on the Library, and copy and
164distribute such modifications or work under the terms of Section 1
165above, provided that you also meet all of these conditions:
166
167 a) The modified work must itself be a software library.
168
169 b) You must cause the files modified to carry prominent notices
170 stating that you changed the files and the date of any change.
171
172 c) You must cause the whole of the work to be licensed at no
173 charge to all third parties under the terms of this License.
174
175 d) If a facility in the modified Library refers to a function or a
176 table of data to be supplied by an application program that uses
177 the facility, other than as an argument passed when the facility
178 is invoked, then you must make a good faith effort to ensure that,
179 in the event an application does not supply such function or
180 table, the facility still operates, and performs whatever part of
181 its purpose remains meaningful.
182
183 (For example, a function in a library to compute square roots has
184 a purpose that is entirely well-defined independent of the
185 application. Therefore, Subsection 2d requires that any
186 application-supplied function or table used by this function must
187 be optional: if the application does not supply it, the square
188 root function must still compute square roots.)
189
190These requirements apply to the modified work as a whole. If
191identifiable sections of that work are not derived from the Library,
192and can be reasonably considered independent and separate works in
193themselves, then this License, and its terms, do not apply to those
194sections when you distribute them as separate works. But when you
195distribute the same sections as part of a whole which is a work based
196on the Library, the distribution of the whole must be on the terms of
197this License, whose permissions for other licensees extend to the
198entire whole, and thus to each and every part regardless of who wrote
199it.
200
201Thus, it is not the intent of this section to claim rights or contest
202your rights to work written entirely by you; rather, the intent is to
203exercise the right to control the distribution of derivative or
204collective works based on the Library.
205
206In addition, mere aggregation of another work not based on the Library
207with the Library (or with a work based on the Library) on a volume of
208a storage or distribution medium does not bring the other work under
209the scope of this License.
210
211 3. You may opt to apply the terms of the ordinary GNU General Public
212License instead of this License to a given copy of the Library. To do
213this, you must alter all the notices that refer to this License, so
214that they refer to the ordinary GNU General Public License, version 2,
215instead of to this License. (If a newer version than version 2 of the
216ordinary GNU General Public License has appeared, then you can specify
217that version instead if you wish.) Do not make any other change in
218these notices.
219
220 Once this change is made in a given copy, it is irreversible for
221that copy, so the ordinary GNU General Public License applies to all
222subsequent copies and derivative works made from that copy.
223
224 This option is useful when you wish to copy part of the code of
225the Library into a program that is not a library.
226
227 4. You may copy and distribute the Library (or a portion or
228derivative of it, under Section 2) in object code or executable form
229under the terms of Sections 1 and 2 above provided that you accompany
230it with the complete corresponding machine-readable source code, which
231must be distributed under the terms of Sections 1 and 2 above on a
232medium customarily used for software interchange.
233
234 If distribution of object code is made by offering access to copy
235from a designated place, then offering equivalent access to copy the
236source code from the same place satisfies the requirement to
237distribute the source code, even though third parties are not
238compelled to copy the source along with the object code.
239
240 5. A program that contains no derivative of any portion of the
241Library, but is designed to work with the Library by being compiled or
242linked with it, is called a "work that uses the Library". Such a
243work, in isolation, is not a derivative work of the Library, and
244therefore falls outside the scope of this License.
245
246 However, linking a "work that uses the Library" with the Library
247creates an executable that is a derivative of the Library (because it
248contains portions of the Library), rather than a "work that uses the
249library". The executable is therefore covered by this License.
250Section 6 states terms for distribution of such executables.
251
252 When a "work that uses the Library" uses material from a header file
253that is part of the Library, the object code for the work may be a
254derivative work of the Library even though the source code is not.
255Whether this is true is especially significant if the work can be
256linked without the Library, or if the work is itself a library. The
257threshold for this to be true is not precisely defined by law.
258
259 If such an object file uses only numerical parameters, data
260structure layouts and accessors, and small macros and small inline
261functions (ten lines or less in length), then the use of the object
262file is unrestricted, regardless of whether it is legally a derivative
263work. (Executables containing this object code plus portions of the
264Library will still fall under Section 6.)
265
266 Otherwise, if the work is a derivative of the Library, you may
267distribute the object code for the work under the terms of Section 6.
268Any executables containing that work also fall under Section 6,
269whether or not they are linked directly with the Library itself.
270
271 6. As an exception to the Sections above, you may also combine or
272link a "work that uses the Library" with the Library to produce a
273work containing portions of the Library, and distribute that work
274under terms of your choice, provided that the terms permit
275modification of the work for the customer's own use and reverse
276engineering for debugging such modifications.
277
278 You must give prominent notice with each copy of the work that the
279Library is used in it and that the Library and its use are covered by
280this License. You must supply a copy of this License. If the work
281during execution displays copyright notices, you must include the
282copyright notice for the Library among them, as well as a reference
283directing the user to the copy of this License. Also, you must do one
284of these things:
285
286 a) Accompany the work with the complete corresponding
287 machine-readable source code for the Library including whatever
288 changes were used in the work (which must be distributed under
289 Sections 1 and 2 above); and, if the work is an executable linked
290 with the Library, with the complete machine-readable "work that
291 uses the Library", as object code and/or source code, so that the
292 user can modify the Library and then relink to produce a modified
293 executable containing the modified Library. (It is understood
294 that the user who changes the contents of definitions files in the
295 Library will not necessarily be able to recompile the application
296 to use the modified definitions.)
297
298 b) Use a suitable shared library mechanism for linking with the
299 Library. A suitable mechanism is one that (1) uses at run time a
300 copy of the library already present on the user's computer system,
301 rather than copying library functions into the executable, and (2)
302 will operate properly with a modified version of the library, if
303 the user installs one, as long as the modified version is
304 interface-compatible with the version that the work was made with.
305
306 c) Accompany the work with a written offer, valid for at
307 least three years, to give the same user the materials
308 specified in Subsection 6a, above, for a charge no more
309 than the cost of performing this distribution.
310
311 d) If distribution of the work is made by offering access to copy
312 from a designated place, offer equivalent access to copy the above
313 specified materials from the same place.
314
315 e) Verify that the user has already received a copy of these
316 materials or that you have already sent this user a copy.
317
318 For an executable, the required form of the "work that uses the
319Library" must include any data and utility programs needed for
320reproducing the executable from it. However, as a special exception,
321the materials to be distributed need not include anything that is
322normally distributed (in either source or binary form) with the major
323components (compiler, kernel, and so on) of the operating system on
324which the executable runs, unless that component itself accompanies
325the executable.
326
327 It may happen that this requirement contradicts the license
328restrictions of other proprietary libraries that do not normally
329accompany the operating system. Such a contradiction means you cannot
330use both them and the Library together in an executable that you
331distribute.
332
333 7. You may place library facilities that are a work based on the
334Library side-by-side in a single library together with other library
335facilities not covered by this License, and distribute such a combined
336library, provided that the separate distribution of the work based on
337the Library and of the other library facilities is otherwise
338permitted, and provided that you do these two things:
339
340 a) Accompany the combined library with a copy of the same work
341 based on the Library, uncombined with any other library
342 facilities. This must be distributed under the terms of the
343 Sections above.
344
345 b) Give prominent notice with the combined library of the fact
346 that part of it is a work based on the Library, and explaining
347 where to find the accompanying uncombined form of the same work.
348
349 8. You may not copy, modify, sublicense, link with, or distribute
350the Library except as expressly provided under this License. Any
351attempt otherwise to copy, modify, sublicense, link with, or
352distribute the Library is void, and will automatically terminate your
353rights under this License. However, parties who have received copies,
354or rights, from you under this License will not have their licenses
355terminated so long as such parties remain in full compliance.
356
357 9. You are not required to accept this License, since you have not
358signed it. However, nothing else grants you permission to modify or
359distribute the Library or its derivative works. These actions are
360prohibited by law if you do not accept this License. Therefore, by
361modifying or distributing the Library (or any work based on the
362Library), you indicate your acceptance of this License to do so, and
363all its terms and conditions for copying, distributing or modifying
364the Library or works based on it.
365
366 10. Each time you redistribute the Library (or any work based on the
367Library), the recipient automatically receives a license from the
368original licensor to copy, distribute, link with or modify the Library
369subject to these terms and conditions. You may not impose any further
370restrictions on the recipients' exercise of the rights granted herein.
371You are not responsible for enforcing compliance by third parties with
372this License.
373
374 11. If, as a consequence of a court judgment or allegation of patent
375infringement or for any other reason (not limited to patent issues),
376conditions are imposed on you (whether by court order, agreement or
377otherwise) that contradict the conditions of this License, they do not
378excuse you from the conditions of this License. If you cannot
379distribute so as to satisfy simultaneously your obligations under this
380License and any other pertinent obligations, then as a consequence you
381may not distribute the Library at all. For example, if a patent
382license would not permit royalty-free redistribution of the Library by
383all those who receive copies directly or indirectly through you, then
384the only way you could satisfy both it and this License would be to
385refrain entirely from distribution of the Library.
386
387If any portion of this section is held invalid or unenforceable under any
388particular circumstance, the balance of the section is intended to apply,
389and the section as a whole is intended to apply in other circumstances.
390
391It is not the purpose of this section to induce you to infringe any
392patents or other property right claims or to contest validity of any
393such claims; this section has the sole purpose of protecting the
394integrity of the free software distribution system which is
395implemented by public license practices. Many people have made
396generous contributions to the wide range of software distributed
397through that system in reliance on consistent application of that
398system; it is up to the author/donor to decide if he or she is willing
399to distribute software through any other system and a licensee cannot
400impose that choice.
401
402This section is intended to make thoroughly clear what is believed to
403be a consequence of the rest of this License.
404
405 12. If the distribution and/or use of the Library is restricted in
406certain countries either by patents or by copyrighted interfaces, the
407original copyright holder who places the Library under this License may add
408an explicit geographical distribution limitation excluding those countries,
409so that distribution is permitted only in or among countries not thus
410excluded. In such case, this License incorporates the limitation as if
411written in the body of this License.
412
413 13. The Free Software Foundation may publish revised and/or new
414versions of the Lesser General Public License from time to time.
415Such new versions will be similar in spirit to the present version,
416but may differ in detail to address new problems or concerns.
417
418Each version is given a distinguishing version number. If the Library
419specifies a version number of this License which applies to it and
420"any later version", you have the option of following the terms and
421conditions either of that version or of any later version published by
422the Free Software Foundation. If the Library does not specify a
423license version number, you may choose any version ever published by
424the Free Software Foundation.
425
426 14. If you wish to incorporate parts of the Library into other free
427programs whose distribution conditions are incompatible with these,
428write to the author to ask for permission. For software which is
429copyrighted by the Free Software Foundation, write to the Free
430Software Foundation; we sometimes make exceptions for this. Our
431decision will be guided by the two goals of preserving the free status
432of all derivatives of our free software and of promoting the sharing
433and reuse of software generally.
434
435 NO WARRANTY
436
437 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
447 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456DAMAGES.
457
458 END OF TERMS AND CONDITIONS
459
460 How to Apply These Terms to Your New Libraries
461
462 If you develop a new library, and you want it to be of the greatest
463possible use to the public, we recommend making it free software that
464everyone can redistribute and change. You can do so by permitting
465redistribution under these terms (or, alternatively, under the terms of the
466ordinary General Public License).
467
468 To apply these terms, attach the following notices to the library. It is
469safest to attach them to the start of each source file to most effectively
470convey the exclusion of warranty; and each file should have at least the
471"copyright" line and a pointer to where the full notice is found.
472
473 <one line to give the library's name and a brief idea of what it does.>
474 Copyright (C) <year> <name of author>
475
476 This library is free software; you can redistribute it and/or
477 modify it under the terms of the GNU Lesser General Public
478 License as published by the Free Software Foundation; either
479 version 2.1 of the License, or (at your option) any later version.
480
481 This library is distributed in the hope that it will be useful,
482 but WITHOUT ANY WARRANTY; without even the implied warranty of
483 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484 Lesser General Public License for more details.
485
486 You should have received a copy of the GNU Lesser General Public
487 License along with this library; if not, write to the Free Software
488 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
489
490Also add information on how to contact you by electronic and paper mail.
491
492You should also get your employer (if you work as a programmer) or your
493school, if any, to sign a "copyright disclaimer" for the library, if
494necessary. Here is a sample; alter the names:
495
496 Yoyodyne, Inc., hereby disclaims all copyright interest in the
497 library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498
499 <signature of Ty Coon>, 1 April 1990
500 Ty Coon, President of Vice
501
502That's all there is to it!
503
504
diff --git a/rbutil/rbutilqt/logger/Logger.cpp b/rbutil/rbutilqt/logger/Logger.cpp
new file mode 100644
index 0000000000..33ba50ec58
--- /dev/null
+++ b/rbutil/rbutilqt/logger/Logger.cpp
@@ -0,0 +1,370 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14// Local
15#include "Logger.h"
16#include "AbstractAppender.h"
17
18// Qt
19#include <QCoreApplication>
20#include <QReadWriteLock>
21#include <QSemaphore>
22#include <QDateTime>
23#include <QIODevice>
24#include <QTextCodec>
25
26// STL
27#include <iostream>
28
29
30class LogDevice : public QIODevice
31{
32 public:
33 LogDevice()
34 : m_semaphore(1)
35 {}
36
37 void lock(Logger::LogLevel logLevel, const char* file, int line, const char* function)
38 {
39 m_semaphore.acquire();
40
41 if (!isOpen())
42 open(QIODevice::WriteOnly);
43
44 m_logLevel = logLevel;
45 m_file = file;
46 m_line = line;
47 m_function = function;
48 }
49
50 protected:
51 qint64 readData(char*, qint64)
52 {
53 return 0;
54 }
55
56 qint64 writeData(const char* data, qint64 maxSize)
57 {
58 if (maxSize > 0)
59 Logger::write(m_logLevel, m_file, m_line, m_function, QString::fromLocal8Bit(QByteArray(data, maxSize)));
60
61 m_semaphore.release();
62 return maxSize;
63 }
64
65 private:
66 QSemaphore m_semaphore;
67 Logger::LogLevel m_logLevel;
68 const char* m_file;
69 int m_line;
70 const char* m_function;
71};
72
73
74// Forward declarations
75static void cleanupLoggerPrivate();
76
77#if QT_VERSION >= 0x050000
78static void qtLoggerMessageHandler(QtMsgType, const QMessageLogContext& context, const QString& msg);
79#else
80static void qtLoggerMessageHandler(QtMsgType type, const char* msg);
81#endif
82
83/**
84 * \internal
85 *
86 * LoggerPrivate class implements the Singleton pattern in a thread-safe way. It uses a static pointer to itself
87 * protected by QReadWriteLock
88 *
89 * The appender list inside the LoggerPrivate class is also protected by QReadWriteLock so this class could be safely
90 * used in a multi-threaded application.
91 */
92class LoggerPrivate
93{
94 public:
95 static LoggerPrivate* m_self;
96 static QReadWriteLock m_selfLock;
97
98 static LoggerPrivate* instance()
99 {
100 LoggerPrivate* result = 0;
101 {
102 QReadLocker locker(&m_selfLock);
103 result = m_self;
104 }
105
106 if (!result)
107 {
108 QWriteLocker locker(&m_selfLock);
109 m_self = new LoggerPrivate;
110
111#if QT_VERSION >= 0x050000
112 qInstallMessageHandler(qtLoggerMessageHandler);
113#else
114 qInstallMsgHandler(qtLoggerMessageHandler);
115#endif
116 qAddPostRoutine(cleanupLoggerPrivate);
117 result = m_self;
118 }
119
120 return result;
121 }
122
123
124 LoggerPrivate()
125 : m_logDevice(0)
126 {}
127
128
129 ~LoggerPrivate()
130 {
131 // Cleanup appenders
132 QReadLocker appendersLocker(&m_appendersLock);
133 foreach (AbstractAppender* appender, m_appenders)
134 delete appender;
135
136 // Cleanup device
137 QReadLocker deviceLocker(&m_logDeviceLock);
138 delete m_logDevice;
139 }
140
141
142 void registerAppender(AbstractAppender* appender)
143 {
144 QWriteLocker locker(&m_appendersLock);
145
146 if (!m_appenders.contains(appender))
147 m_appenders.append(appender);
148 else
149 std::cerr << "Trying to register appender that was already registered" << std::endl;
150 }
151
152
153 LogDevice* logDevice()
154 {
155 LogDevice* result = 0;
156 {
157 QReadLocker locker(&m_logDeviceLock);
158 result = m_logDevice;
159 }
160
161 if (!result)
162 {
163 QWriteLocker locker(&m_logDeviceLock);
164 m_logDevice = new LogDevice;
165 result = m_logDevice;
166 }
167
168 return result;
169 }
170
171
172 void write(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line, const char* function,
173 const QString& message)
174 {
175 QReadLocker locker(&m_appendersLock);
176
177 if (!m_appenders.isEmpty())
178 {
179 foreach (AbstractAppender* appender, m_appenders)
180 appender->write(timeStamp, logLevel, file, line, function, message);
181 }
182 else
183 {
184 // Fallback
185 QString result = QString(QLatin1String("[%1] <%2> %3")).arg(Logger::levelToString(logLevel), -7)
186 .arg(function).arg(message);
187
188 std::cerr << qPrintable(result) << std::endl;
189 }
190
191 if (logLevel == Logger::Fatal)
192 abort();
193 }
194
195
196 void write(Logger::LogLevel logLevel, const char* file, int line, const char* function, const QString& message)
197 {
198 write(QDateTime::currentDateTime(), logLevel, file, line, function, message);
199 }
200
201
202 void write(Logger::LogLevel logLevel, const char* file, int line, const char* function, const char* message)
203 {
204 write(logLevel, file, line, function, QString(message));
205 }
206
207
208 QDebug write(Logger::LogLevel logLevel, const char* file, int line, const char* function)
209 {
210 LogDevice* d = logDevice();
211 d->lock(logLevel, file, line, function);
212 return QDebug(d);
213 }
214
215
216 void writeAssert(const char* file, int line, const char* function, const char* condition)
217 {
218 write(Logger::Fatal, file, line, function, QString("ASSERT: \"%1\"").arg(condition));
219 }
220
221 private:
222 QList<AbstractAppender*> m_appenders;
223 QReadWriteLock m_appendersLock;
224
225 LogDevice* m_logDevice;
226 QReadWriteLock m_logDeviceLock;
227};
228
229// Static fields initialization
230LoggerPrivate* LoggerPrivate::m_self = 0;
231QReadWriteLock LoggerPrivate::m_selfLock;
232
233
234static void cleanupLoggerPrivate()
235{
236 QWriteLocker locker(&LoggerPrivate::m_selfLock);
237
238 delete LoggerPrivate::m_self;
239 LoggerPrivate::m_self = 0;
240}
241
242
243#if QT_VERSION >= 0x050000
244static void qtLoggerMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg)
245{
246 Logger::LogLevel level;
247 switch (type)
248 {
249 case QtDebugMsg:
250 level = Logger::Debug;
251 break;
252 case QtWarningMsg:
253 level = Logger::Warning;
254 break;
255 case QtCriticalMsg:
256 level = Logger::Error;
257 break;
258 case QtFatalMsg:
259 level = Logger::Fatal;
260 break;
261 }
262
263 Logger::write(level, context.file, context.line, context.function, msg);
264}
265
266#else
267
268static void qtLoggerMessageHandler(QtMsgType type, const char* msg)
269{
270 switch (type)
271 {
272 case QtDebugMsg:
273 LOG_DEBUG(msg);
274 break;
275 case QtWarningMsg:
276 LOG_WARNING(msg);
277 break;
278 case QtCriticalMsg:
279 LOG_ERROR(msg);
280 break;
281 case QtFatalMsg:
282 LOG_FATAL(msg);
283 break;
284 }
285}
286#endif
287
288
289QString Logger::levelToString(Logger::LogLevel logLevel)
290{
291 switch (logLevel)
292 {
293 case Trace:
294 return QLatin1String("Trace");
295 case Debug:
296 return QLatin1String("Debug");
297 case Info:
298 return QLatin1String("Info");
299 case Warning:
300 return QLatin1String("Warning");
301 case Error:
302 return QLatin1String("Error");
303 case Fatal:
304 return QLatin1String("Fatal");
305 }
306
307 return QString();
308}
309
310
311Logger::LogLevel Logger::levelFromString(const QString& s)
312{
313 QString str = s.trimmed().toLower();
314
315 LogLevel result = Debug;
316
317 if (str == QLatin1String("trace"))
318 result = Trace;
319 else if (str == QLatin1String("debug"))
320 result = Debug;
321 else if (str == QLatin1String("info"))
322 result = Info;
323 else if (str == QLatin1String("warning"))
324 result = Warning;
325 else if (str == QLatin1String("error"))
326 result = Error;
327 else if (str == QLatin1String("fatal"))
328 result = Fatal;
329
330 return result;
331}
332
333
334void Logger::registerAppender(AbstractAppender* appender)
335{
336 LoggerPrivate::instance()->registerAppender(appender);
337}
338
339
340void Logger::write(const QDateTime& timeStamp, LogLevel logLevel, const char* file, int line, const char* function,
341 const QString& message)
342{
343 LoggerPrivate::instance()->write(timeStamp, logLevel, file, line, function, message);
344}
345
346
347void Logger::write(LogLevel logLevel, const char* file, int line, const char* function, const QString& message)
348{
349 LoggerPrivate::instance()->write(logLevel, file, line, function, message);
350}
351
352
353void Logger::write(LogLevel logLevel, const char* file, int line, const char* function, const char* message, ...)
354{
355 va_list va;
356 va_start(va, message);
357 LoggerPrivate::instance()->write(logLevel, file, line, function, QString().vsprintf(message,va));
358 va_end(va);
359}
360
361QDebug Logger::write(LogLevel logLevel, const char* file, int line, const char* function)
362{
363 return LoggerPrivate::instance()->write(logLevel, file, line, function);
364}
365
366
367void Logger::writeAssert(const char* file, int line, const char* function, const char* condition)
368{
369 LoggerPrivate::instance()->writeAssert(file, line, function, condition);
370}
diff --git a/rbutil/rbutilqt/logger/Logger.h b/rbutil/rbutilqt/logger/Logger.h
new file mode 100644
index 0000000000..d056dfc25d
--- /dev/null
+++ b/rbutil/rbutilqt/logger/Logger.h
@@ -0,0 +1,319 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14#ifndef LOGGER_H
15#define LOGGER_H
16/**
17 * \file Logger.h
18 * \brief A file containing the description of Logger class and and additional useful macros for logging
19 */
20
21// Qt
22#include <QString>
23#include <QDebug>
24class QDateTime;
25
26// Local
27#include "CuteLogger_global.h"
28class AbstractAppender;
29
30
31//! Writes the trace log record
32/**
33 * This macro is the convinient way to call Logger::write(). It uses the common preprocessor macros \c __FILE__,
34 * \c __LINE__ and the standart Qt \c Q_FUNC_INFO macros to automatically determine the needed parameters to call
35 * Logger::write().
36 *
37 * \note This and other (LOG_INFO() etc...) macros uses the variadic macro arguments to give convinient usage form for
38 * the different versions of Logger::write() (using the QString or const char* argument or returning the QDebug class
39 * instance). Not all compilers will support this. Please, consider reviewing your compiler documentation to ensure
40 * it support __VA_ARGS__ macro.
41 *
42 * It is checked to work with GCC 4.4 or later.
43 *
44 * \sa Logger::LogLevel
45 * \sa Logger::write()
46 */
47#define LOG_TRACE(...) Logger::write(Logger::Trace, __FILE__, __LINE__, Q_FUNC_INFO, ##__VA_ARGS__)
48
49//! Writes the debug log record
50/**
51 * This macro records the info log record using the Logger::write() function. It works identically to the LOG_TRACE()
52 * macro.
53 *
54 * \sa LOG_TRACE()
55 * \sa Logger::LogLevel
56 * \sa Logger::write()
57 */
58#define LOG_DEBUG(...) Logger::write(Logger::Debug, __FILE__, __LINE__, Q_FUNC_INFO, ##__VA_ARGS__)
59
60//! Write the info log record
61/**
62 * This macro records the info log record using the Logger::write() function. It works identically to the LOG_TRACE()
63 * macro.
64 *
65 * \sa LOG_TRACE()
66 * \sa Logger::LogLevel
67 * \sa Logger::write()
68 */
69#define LOG_INFO(...) Logger::write(Logger::Info, __FILE__, __LINE__, Q_FUNC_INFO, ##__VA_ARGS__)
70
71//! Write the warning log record
72/**
73 * This macro records the warning log record using the Logger::write() function. It works identically to the LOG_TRACE()
74 * macro.
75 *
76 * \sa LOG_TRACE()
77 * \sa Logger::LogLevel
78 * \sa Logger::write()
79 */
80#define LOG_WARNING(...) Logger::write(Logger::Warning, __FILE__, __LINE__, Q_FUNC_INFO, ##__VA_ARGS__)
81
82//! Write the error log record
83/**
84 * This macro records the error log record using the Logger::write() function. It works identically to the LOG_TRACE()
85 * macro.
86 *
87 * \sa LOG_TRACE()
88 * \sa Logger::LogLevel
89 * \sa Logger::write()
90 */
91#define LOG_ERROR(...) Logger::write(Logger::Error, __FILE__, __LINE__, Q_FUNC_INFO, ##__VA_ARGS__)
92
93//! Write the fatal log record
94/**
95 * This macro records the fatal log record using the Logger::write() function. It works identically to the LOG_TRACE()
96 * macro.
97 *
98 * \note Recording of the log record using the Logger::Fatal log level will lead to calling the STL abort()
99 * function, which will interrupt the running of your software and begin the writing of the core dump.
100 *
101 * \sa LOG_TRACE()
102 * \sa Logger::LogLevel
103 * \sa Logger::write()
104 */
105#define LOG_FATAL(...) Logger::write(Logger::Fatal, __FILE__, __LINE__, Q_FUNC_INFO, ##__VA_ARGS__)
106
107//! Check the assertion
108/**
109 * This macro is a convinient and recommended to use way to call Logger::writeAssert() function. It uses the
110 * preprocessor macros (as the LOG_DEBUG() does) to fill the necessary arguments of the Logger::writeAssert() call. It
111 * also uses undocumented but rather mature and stable \c qt_noop() function (which does nothing) when the assertion
112 * is true.
113 *
114 * Example:
115 * \code
116 * bool b = checkSomething();
117 * ...
118 * LOG_ASSERT(b == true);
119 * \endcode
120 *
121 * \sa Logger::writeAssert()
122 */
123#define LOG_ASSERT(cond) ((!(cond)) ? Logger::writeAssert(__FILE__, __LINE__, Q_FUNC_INFO, #cond) : qt_noop())
124
125
126/**
127 * \mainpage
128 *
129 * Logger is a simple way to write the history of your application lifecycle to any target logging device (which is
130 * called Appender and may write to any target you will implement with it: console, text file, XML or something - you
131 * choose) and to map logging message to a class, function, source file and line of code which it is called from.
132 *
133 * Some simple appenders (which may be considered an examples) are provided with the logger itself: see ConsoleAppender
134 * and FileAppender documentation.
135 *
136 * It supports using it in a multithreaded applications, so ALL of its functions are thread safe.
137 *
138 * Simple usage example:
139 * \code
140 * #include <QCoreApplication>
141 *
142 * #include <Logger.h>
143 * #include <ConsoleAppender.h>
144 *
145 * int main(int argc, char* argv[])
146 * {
147 * QCoreApplication app(argc, argv);
148 * ...
149 * ConsoleAppender* consoleAppender = new ConsoleAppender();
150 * consoleAppender->setFormat("[%-7l] <%C> %m\n");
151 * Logger::registerAppender(consoleAppender);
152 * ...
153 * LOG_INFO("Starting the application");
154 * int result = app.exec();
155 * ...
156 * if (result)
157 * LOG_WARNING() << "Something went wrong." << "Result code is" << result;
158 *
159 * return result;
160 * }
161 * \endcode
162 *
163 * Logger internally uses the lazy-initialized singleton object and needs no definite initialization, but you may
164 * consider registering a log appender before calling any log recording functions or macros.
165 *
166 * The library design of Logger allows you to simply mass-replace all occurrences of qDebug and similiar calls with
167 * similiar Logger macros (e.g. LOG_DEBUG)
168 *
169 * \note Logger uses a singleton class which must live through all the application life cycle and cleans it on the
170 * destruction of the QCoreApplication (or QApplication) instance. It needs a QCoreApplication instance to be
171 * created before any of the Logger's functions are called.
172 *
173 * \sa AbstractAppender
174 * \sa LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL
175 * \sa LOG_ASSERT
176 */
177
178//! Very simple but rather powerful component which may be used for logging your application activities.
179class CUTELOGGERSHARED_EXPORT Logger
180{
181 public:
182 //! Describes the possible severity levels of the log records
183 enum LogLevel
184 {
185 Trace, //!< Trace level. Can be used for mostly unneeded records used for internal code tracing.
186 Debug, //!< Debug level. Useful for non-necessary records used for the debugging of the software.
187 Info, //!< Info level. Can be used for informational records, which may be interesting for not only developers.
188 Warning, //!< Warning. May be used to log some non-fatal warnings detected by your application.
189 Error, //!< Error. May be used for a big problems making your application work wrong but not crashing.
190 Fatal //!< Fatal. Used for unrecoverable errors, crashes the application right after the log record is written.
191 };
192
193 //! Converts the LogLevel enum value to its string representation
194 /**
195 * \param logLevel Log level to convert
196 *
197 * \sa LogLevel
198 * \sa levelFromString()
199 */
200 static QString levelToString(LogLevel logLevel);
201
202 //! Converts the LogLevel string representation to enum value
203 /**
204 * Comparation of the strings is case independent. If the log level string provided cannot be understood
205 * Logger::Debug is returned.
206 *
207 * \param s String to be decoded
208 *
209 * \sa LogLevel
210 * \sa levelToString()
211 */
212 static LogLevel levelFromString(const QString& s);
213
214 //! Registers the appender to write the log records to
215 /**
216 * On the log writing call (using one of the macros or the write() function) Logger traverses through the list of
217 * the appenders and writes a log records to the each of them. Please, look through the AbstractAppender
218 * documentation to understand the concept of appenders.
219 *
220 * If no appenders was added to Logger, it falls back to logging into the \c std::cerr STL stream.
221 *
222 * \param appender Appender to register in the Logger
223 *
224 * \note Logger takes ownership on the appender and it will delete it on the application exit. According to this,
225 * appenders must be created on heap to prevent double destruction of the appender.
226 *
227 * \sa AbstractAppender
228 */
229 static void registerAppender(AbstractAppender* appender);
230
231 //! Writes the log record
232 /**
233 * Writes the log records with the supplied arguments to all the registered appenders.
234 *
235 * \note It is not recommended to call this function directly. Instead of this you can just call one of the macros
236 * (LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL) that will supply all the needed
237 * information to this function.
238 *
239 * \param timeStamp - the time stamp of the record
240 * \param logLevel - the log level of the record
241 * \param file - the name of the source file that requested the log record
242 * \param line - the line of the code of source file that requested the log record
243 * \param function - name of the function that requested the log record
244 * \param message - log message
245 *
246 * \note Recording of the log record using the Logger::Fatal log level will lead to calling the STL abort()
247 * function, which will interrupt the running of your software and begin the writing of the core dump.
248 *
249 * \sa LogLevel
250 * \sa LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL
251 * \sa AbstractAppender
252 */
253 static void write(const QDateTime& timeStamp, LogLevel logLevel, const char* file, int line, const char* function,
254 const QString& message);
255
256 /**
257 * This is the overloaded function provided for the convinience. It behaves identically to the above function.
258 *
259 * This function uses the current timestamp obtained with \c QDateTime::currentDateTime().
260 *
261 * \sa write()
262 */
263 static void write(LogLevel logLevel, const char* file, int line, const char* function, const QString& message);
264
265 /**
266 * This is the overloaded function provided for the convinience. It behaves identically to the above function.
267 *
268 * This function uses the current timestamp obtained with \c QDateTime::currentDateTime(). Also it supports writing
269 * <tt>const char*</tt> instead of \c QString and converts it internally using the \c QString::fromAscii(). If you
270 * want this function to support the non-ascii strings, you will need to setup the codec using the
271 * \c QTextCodec::setCodecForCStrings()
272 *
273 * \sa write()
274 */
275 static void write(LogLevel logLevel, const char* file, int line, const char* function, const char* message, ...);
276
277 /**
278 * This is the overloaded function provided for the convinience. It behaves identically to the above function.
279 *
280 * This function doesn't accept any log message as argument. It returns the \c QDebug object that can be written
281 * using the stream functions. For example, you may like to write:
282 * \code
283 * LOG_DEBUG() << "This is the size" << size << "of the element" << elementName;
284 * \endcode
285 * instead of writing
286 * \code
287 * LOG_DEBUG(QString(QLatin1String("This is the size %1x%2 of the element %3"))
288 * .arg(size.x()).arg(size.y()).arg(elementName));
289 * \endcode
290 *
291 * Please consider reading the Qt Reference Documentation for the description of the QDebug class usage syntax.
292 *
293 * \note This overload is definitely more pleasant to use than the first write() overload, but it behaves definitely
294 * slower than all the above overloads.
295 *
296 * \sa write()
297 */
298 static QDebug write(LogLevel logLevel, const char* file, int line, const char* function);
299
300 //! Writes the assertion
301 /**
302 * This function writes the assertion record using the write() function.
303 *
304 * The assertion record is always written using the Logger::Fatal log level which leads to the abortation of the
305 * program and generation of the core dump (if supported).
306 *
307 * The message written to the appenders will be identical to the \c condition argument prefixed with the
308 * <tt>ASSERT:</tt> notification.
309 *
310 * \note It is not recommended to call this function directly. Instead of this you can just call the LOG_ASSERT
311 * macro that will supply all the needed information to this function.
312 *
313 * \sa LOG_ASSERT
314 * \sa write()
315 */
316 static void writeAssert(const char* file, int line, const char* function, const char* condition);
317};
318
319#endif // LOGGER_H
diff --git a/rbutil/rbutilqt/logger/OutputDebugAppender.cpp b/rbutil/rbutilqt/logger/OutputDebugAppender.cpp
new file mode 100644
index 0000000000..2d7facbd98
--- /dev/null
+++ b/rbutil/rbutilqt/logger/OutputDebugAppender.cpp
@@ -0,0 +1,31 @@
1/*
2 Copyright (c) 2010 Karl-Heinz Reichel (khreichel at googlemail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14// Local
15#include "OutputDebugAppender.h"
16
17// STL
18#include <windows.h>
19
20
21void OutputDebugAppender::append(const QDateTime& timeStamp,
22 Logger::LogLevel logLevel,
23 const char* file,
24 int line,
25 const char* function,
26 const QString& message)
27{
28 QString s = formattedString(timeStamp, logLevel, file, line, function, message);
29 OutputDebugStringW((LPCWSTR) s.utf16());
30}
31
diff --git a/rbutil/rbutilqt/logger/OutputDebugAppender.h b/rbutil/rbutilqt/logger/OutputDebugAppender.h
new file mode 100644
index 0000000000..f5a5b8c588
--- /dev/null
+++ b/rbutil/rbutilqt/logger/OutputDebugAppender.h
@@ -0,0 +1,33 @@
1/*
2 Copyright (c) 2010 Karl-Heinz Reichel (khreichel at googlemail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14
15#ifndef OUTPUTDEBUGAPPENDER_H
16#define OUTPUTDEBUGAPPENDER_H
17
18#include "CuteLogger_global.h"
19#include <AbstractStringAppender.h>
20
21//! OutputDebugAppender is the appender that writes the log records to the Microsoft Debug Log
22class CUTELOGGERSHARED_EXPORT OutputDebugAppender : public AbstractStringAppender
23{
24 protected:
25 //! Writes the log record to the windows debug log.
26 /**
27 * \sa AbstractStringAppender::format()
28 */
29 virtual void append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
30 const char* function, const QString& message);
31};
32
33#endif // OUTPUTDEBUGAPPENDER_H
diff --git a/rbutil/rbutilqt/logger/README.ROCKBOX b/rbutil/rbutilqt/logger/README.ROCKBOX
new file mode 100644
index 0000000000..08f537fb3f
--- /dev/null
+++ b/rbutil/rbutilqt/logger/README.ROCKBOX
@@ -0,0 +1,7 @@
1This folder contains the cutelogger project for logging functionality.
2These files are distributed under the LGPL v2 or later.
3The source files have been last synced with the projects at
4https://gitorious.org/cutelogger to commit
5e3c2745c6c5f38896f87472e01ea2caf2d9e211b.
6
7
diff --git a/rbutil/rbutilqt/main.cpp b/rbutil/rbutilqt/main.cpp
index 7d57f42290..9f272281d4 100644
--- a/rbutil/rbutilqt/main.cpp
+++ b/rbutil/rbutilqt/main.cpp
@@ -21,6 +21,9 @@
21#include <QSettings> 21#include <QSettings>
22#include "rbutilqt.h" 22#include "rbutilqt.h"
23#include "systrace.h" 23#include "systrace.h"
24#include "Logger.h"
25#include "ConsoleAppender.h"
26#include "FileAppender.h"
24 27
25#ifdef STATIC 28#ifdef STATIC
26#include <QtPlugin> 29#include <QtPlugin>
@@ -28,14 +31,19 @@ Q_IMPORT_PLUGIN(qtaccessiblewidgets)
28#endif 31#endif
29 32
30 33
31
32int main( int argc, char ** argv ) { 34int main( int argc, char ** argv ) {
33#if QT_VERSION < 0x050000
34 qInstallMsgHandler(SysTrace::debug);
35#else
36 qInstallMessageHandler(SysTrace::debug);
37#endif
38 QApplication app( argc, argv ); 35 QApplication app( argc, argv );
36 ConsoleAppender* consoleAppender = new ConsoleAppender();
37 consoleAppender->setFormat("[%f:%i %L] %m\n");
38 Logger::registerAppender(consoleAppender);
39 SysTrace::rotateTrace();
40 QString tracefile = QDir::tempPath() + "/rbutil-trace.log";
41 FileAppender* fileAppender = new FileAppender();
42 fileAppender->setFormat("[%f:%i %L] %m\n");
43 fileAppender->setFileName(tracefile);
44 Logger::registerAppender(fileAppender);
45 LOG_INFO() << "Starting trace at" << QDateTime::currentDateTime().toString(Qt::ISODate);
46
39#if defined(Q_OS_MAC) 47#if defined(Q_OS_MAC)
40 QDir dir(QApplication::applicationDirPath()); 48 QDir dir(QApplication::applicationDirPath());
41 dir.cdUp(); 49 dir.cdUp();
diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp
index 1f5b2c0cd3..41df0600f0 100644
--- a/rbutil/rbutilqt/progressloggergui.cpp
+++ b/rbutil/rbutilqt/progressloggergui.cpp
@@ -142,9 +142,9 @@ void ProgressLoggerGui::show()
142 142
143void ProgressLoggerGui::saveErrorLog() 143void ProgressLoggerGui::saveErrorLog()
144{ 144{
145 QString filename = QFileDialog::getSaveFileName(downloadProgress, tr("Save system trace log"), 145 QString filename = QFileDialog::getSaveFileName(downloadProgress,
146 QDir::homePath(), "*.log"); 146 tr("Save system trace log"), QDir::homePath(), "*.log");
147 if(filename == "") 147 if(filename.isEmpty())
148 return; 148 return;
149 149
150 QFile file(filename); 150 QFile file(filename);
@@ -155,6 +155,7 @@ void ProgressLoggerGui::saveErrorLog()
155 QString loggerTexts = "\n*********************************************\n" 155 QString loggerTexts = "\n*********************************************\n"
156 "*************** Logger *******************\n" 156 "*************** Logger *******************\n"
157 "*********************************************\n"; 157 "*********************************************\n";
158
158 file.write(loggerTexts.toUtf8(), loggerTexts.size()); 159 file.write(loggerTexts.toUtf8(), loggerTexts.size());
159 160
160 161
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 = "";
diff --git a/rbutil/rbutilqt/rbutilqt.pri b/rbutil/rbutilqt/rbutilqt.pri
index b8193d56ab..d67bf65bc3 100644
--- a/rbutil/rbutilqt/rbutilqt.pri
+++ b/rbutil/rbutilqt/rbutilqt.pri
@@ -87,6 +87,11 @@ SOURCES += \
87 mspack/system-mspack.c \ 87 mspack/system-mspack.c \
88 base/mspackutil.cpp \ 88 base/mspackutil.cpp \
89 base/archiveutil.cpp \ 89 base/archiveutil.cpp \
90 logger/AbstractAppender.cpp \
91 logger/AbstractStringAppender.cpp \
92 logger/ConsoleAppender.cpp \
93 logger/FileAppender.cpp \
94 logger/Logger.cpp \
90 95
91 96
92HEADERS += \ 97HEADERS += \
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 6a40de6422..4a4016c21d 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -110,6 +110,7 @@ INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools \
110 $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/gui 110 $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/gui
111INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher \ 111INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher \
112 $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools 112 $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools
113INCLUDEPATH += logger
113 114
114DEPENDPATH = $$INCLUDEPATH 115DEPENDPATH = $$INCLUDEPATH
115 116
@@ -143,13 +144,11 @@ contains(QT_MAJOR_VERSION, 5) {
143 144
144dbg { 145dbg {
145 CONFIG += debug thread qt warn_on 146 CONFIG += debug thread qt warn_on
146 DEFINES -= QT_NO_DEBUG_OUTPUT
147 DEFINES += DBG 147 DEFINES += DBG
148 message("debug") 148 message("debug")
149} 149}
150!dbg { 150!dbg {
151 CONFIG += release thread qt 151 CONFIG += release thread qt
152 DEFINES -= QT_NO_DEBUG_OUTPUT
153 DEFINES += NODEBUG 152 DEFINES += NODEBUG
154 message("release") 153 message("release")
155} 154}
diff --git a/rbutil/rbutilqt/systrace.cpp b/rbutil/rbutilqt/systrace.cpp
index dc8534af03..5e42e1b2d8 100644
--- a/rbutil/rbutilqt/systrace.cpp
+++ b/rbutil/rbutilqt/systrace.cpp
@@ -22,10 +22,8 @@
22#include "ui_systracefrm.h" 22#include "ui_systracefrm.h"
23 23
24#include "rbsettings.h" 24#include "rbsettings.h"
25#include "Logger.h"
25 26
26QString SysTrace::debugbuffer;
27QString SysTrace::lastmessage;
28unsigned int SysTrace::repeat = 0;
29 27
30SysTrace::SysTrace(QWidget *parent) : QDialog(parent) 28SysTrace::SysTrace(QWidget *parent) : QDialog(parent)
31{ 29{
@@ -43,7 +41,28 @@ SysTrace::SysTrace(QWidget *parent) : QDialog(parent)
43void SysTrace::refresh(void) 41void SysTrace::refresh(void)
44{ 42{
45 int pos = ui.textTrace->verticalScrollBar()->value(); 43 int pos = ui.textTrace->verticalScrollBar()->value();
46 flush(); 44
45 QString debugbuffer;
46 QFile tracefile(QDir::tempPath() + "/rbutil-trace.log");
47 tracefile.open(QIODevice::ReadOnly);
48 QTextStream c(&tracefile);
49 QString line;
50 QString color;
51 while(!c.atEnd()) {
52 line = c.readLine();
53 if(line.contains("WARNING"))
54 color = "orange";
55 else if(line.contains("ERROR"))
56 color = "red";
57#if 0
58 else if(line.contains("INFO"))
59 color = "green";
60#endif
61 else
62 color = "black";
63 debugbuffer += QString("<div style='color:%1;'>%2</div>").arg(color, line);
64 }
65 tracefile.close();
47 ui.textTrace->setHtml("<pre>" + debugbuffer + "</pre>"); 66 ui.textTrace->setHtml("<pre>" + debugbuffer + "</pre>");
48 ui.textTrace->verticalScrollBar()->setValue(pos); 67 ui.textTrace->verticalScrollBar()->setValue(pos);
49 QString oldlog = RbSettings::value(RbSettings::CachePath).toString() 68 QString oldlog = RbSettings::value(RbSettings::CachePath).toString()
@@ -52,23 +71,26 @@ void SysTrace::refresh(void)
52} 71}
53 72
54 73
74QString SysTrace::getTrace(void)
75{
76 QString debugbuffer;
77 QFile tracefile(QDir::tempPath() + "/rbutil-trace.log");
78 tracefile.open(QIODevice::ReadOnly);
79 QTextStream c(&tracefile);
80 debugbuffer = c.readAll();
81 tracefile.close();
82
83 return debugbuffer;
84}
85
86
55void SysTrace::save(QString filename) 87void SysTrace::save(QString filename)
56{ 88{
57 if(filename.isEmpty()) 89 if(filename.isEmpty())
58 filename = RbSettings::value(RbSettings::CachePath).toString()
59 + "/rbutil-trace.log";
60 // make sure any repeat detection is flushed
61 flush();
62 // append save date to the trace. Append it directly instead of using
63 // qDebug() as the handler might have been unregistered.
64 debugbuffer.append("[SysTrace] saving trace at ");
65 debugbuffer.append(QDateTime::currentDateTime().toString(Qt::ISODate));
66 debugbuffer.append("\n");
67 QFile fh(filename);
68 if(!fh.open(QIODevice::WriteOnly))
69 return; 90 return;
70 fh.write(debugbuffer.toUtf8(), debugbuffer.size()); 91 LOG_INFO() << "saving trace at" << QDateTime::currentDateTime().toString(Qt::ISODate);
71 fh.close(); 92 QFile::copy(QDir::tempPath() + "/rbutil-trace.log", filename);
93
72} 94}
73 95
74void SysTrace::saveCurrentTrace(void) 96void SysTrace::saveCurrentTrace(void)
@@ -87,59 +109,19 @@ void SysTrace::savePreviousTrace(void)
87 if(fp.isEmpty()) 109 if(fp.isEmpty())
88 return; 110 return;
89 111
90 QString oldlog = RbSettings::value(RbSettings::CachePath).toString() 112 QString oldlog = QDir::tempPath() + "/rbutil-trace.log.1";
91 + "/rbutil-trace.log";
92 QFile::copy(oldlog, fp); 113 QFile::copy(oldlog, fp);
93 return; 114 return;
94} 115}
95 116
96#if QT_VERSION < 0x050000
97void SysTrace::debug(QtMsgType type, const char* msg)
98{
99 (void)type;
100 if(lastmessage != msg) {
101 lastmessage = msg;
102 flush();
103 debugbuffer.append(QString::fromLocal8Bit(msg) + "\n");
104#if !defined(NODEBUG)
105 fprintf(stderr, "%s\n", msg);
106#endif
107 repeat = 1;
108 }
109 else {
110 repeat++;
111 }
112}
113#else
114void SysTrace::debug(QtMsgType type, const QMessageLogContext &context, const QString &msg)
115{
116 (void)type;
117 (void)context;
118 QByteArray localMsg = msg.toLocal8Bit();
119 if(lastmessage != msg) {
120 lastmessage = msg;
121 flush();
122 debugbuffer.append(msg + "\n");
123#if !defined(NODEBUG)
124 fprintf(stderr, "%s\n", localMsg.constData());
125#endif
126 repeat = 1;
127 }
128 else {
129 repeat++;
130 }
131}
132#endif
133 117
134void SysTrace::flush(void) 118void SysTrace::rotateTrace(void)
135{ 119{
136 if(repeat > 1) { 120 QString f = QDir::tempPath() + "/rbutil-trace.log.1";
137 debugbuffer.append( 121 if(QFileInfo(f).exists()) {
138 QString(" (Last message repeated %1 times.)\n").arg(repeat)); 122 QFile::remove(f);
139#if !defined(NODEBUG)
140 fprintf(stderr, " (Last message repeated %i times.)\n", repeat);
141#endif
142 } 123 }
124 QFile::rename(QDir::tempPath() + "/rbutil-trace.log", f);
143} 125}
144 126
145 127
diff --git a/rbutil/rbutilqt/systrace.h b/rbutil/rbutilqt/systrace.h
index 092d115489..b0a6f70fa6 100644
--- a/rbutil/rbutilqt/systrace.h
+++ b/rbutil/rbutilqt/systrace.h
@@ -29,20 +29,12 @@ class SysTrace : public QDialog
29 Q_OBJECT 29 Q_OBJECT
30 public: 30 public:
31 SysTrace(QWidget *parent); 31 SysTrace(QWidget *parent);
32#if QT_VERSION < 0x050000 32 static QString getTrace(void);
33 static void debug(QtMsgType type, const char* msg);
34#else
35 static void debug(QtMsgType type, const QMessageLogContext &context, const QString &msg);
36#endif
37 static QString getTrace() {return debugbuffer;}
38 static void save(QString filename = ""); 33 static void save(QString filename = "");
34 static void rotateTrace(void);
39 private: 35 private:
40 static void flush(void);
41 void changeEvent(QEvent *event); 36 void changeEvent(QEvent *event);
42 Ui::SysTraceFrm ui; 37 Ui::SysTraceFrm ui;
43 static QString debugbuffer;
44 static QString lastmessage;
45 static unsigned int repeat;
46 38
47 private slots: 39 private slots:
48 void saveCurrentTrace(void); 40 void saveCurrentTrace(void);
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp
index 2003b41c02..c514c65b0c 100644
--- a/rbutil/rbutilqt/themesinstallwindow.cpp
+++ b/rbutil/rbutilqt/themesinstallwindow.cpp
@@ -28,6 +28,7 @@
28#include "systeminfo.h" 28#include "systeminfo.h"
29#include "rockboxinfo.h" 29#include "rockboxinfo.h"
30#include "version.h" 30#include "version.h"
31#include "Logger.h"
31 32
32ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) 33ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
33{ 34{
@@ -79,7 +80,7 @@ void ThemesInstallWindow::downloadInfo()
79 = RockboxInfo(RbSettings::value(RbSettings::Mountpoint).toString()); 80 = RockboxInfo(RbSettings::value(RbSettings::Mountpoint).toString());
80 81
81 themesInfo.open(); 82 themesInfo.open();
82 qDebug() << "[Themes] downloading info to" << themesInfo.fileName(); 83 LOG_INFO() << "downloading info to" << themesInfo.fileName();
83 themesInfo.close(); 84 themesInfo.close();
84 85
85 QString infoUrl = SystemInfo::value(SystemInfo::ThemesInfoUrl).toString(); 86 QString infoUrl = SystemInfo::value(SystemInfo::ThemesInfoUrl).toString();
@@ -89,7 +90,7 @@ void ThemesInstallWindow::downloadInfo()
89 infoUrl.replace("%RELEASE%", installInfo.release()); 90 infoUrl.replace("%RELEASE%", installInfo.release());
90 infoUrl.replace("%RBUTILVER%", VERSION); 91 infoUrl.replace("%RBUTILVER%", VERSION);
91 QUrl url = QUrl(infoUrl); 92 QUrl url = QUrl(infoUrl);
92 qDebug() << "[Themes] Info URL:" << url; 93 LOG_INFO() << "Info URL:" << url;
93 getter->setFile(&themesInfo); 94 getter->setFile(&themesInfo);
94 95
95 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 96 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
@@ -101,13 +102,13 @@ void ThemesInstallWindow::downloadInfo()
101void ThemesInstallWindow::downloadDone(int id, bool error) 102void ThemesInstallWindow::downloadDone(int id, bool error)
102{ 103{
103 downloadDone(error); 104 downloadDone(error);
104 qDebug() << "[Themes] Download" << id << "done, error:" << error; 105 LOG_INFO() << "Download" << id << "done, error:" << error;
105} 106}
106 107
107 108
108void ThemesInstallWindow::downloadDone(bool error) 109void ThemesInstallWindow::downloadDone(bool error)
109{ 110{
110 qDebug() << "[Themes] Download done, error:" << error; 111 LOG_INFO() << "Download done, error:" << error;
111 112
112 disconnect(logger, SIGNAL(aborted()), getter, SLOT(abort())); 113 disconnect(logger, SIGNAL(aborted()), getter, SLOT(abort()));
113 disconnect(logger, SIGNAL(aborted()), this, SLOT(close())); 114 disconnect(logger, SIGNAL(aborted()), this, SLOT(close()));
@@ -115,10 +116,10 @@ void ThemesInstallWindow::downloadDone(bool error)
115 116
116 QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); 117 QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
117 QStringList tl = iniDetails.childGroups(); 118 QStringList tl = iniDetails.childGroups();
118 qDebug() << "[Themes] Theme site result:" 119 LOG_INFO() << "Theme site result:"
119 << iniDetails.value("error/code").toString() 120 << iniDetails.value("error/code").toString()
120 << iniDetails.value("error/description").toString() 121 << iniDetails.value("error/description").toString()
121 << iniDetails.value("error/query").toString(); 122 << iniDetails.value("error/query").toString();
122 123
123 if(error) { 124 if(error) {
124 logger->addItem(tr("Network error: %1.\n" 125 logger->addItem(tr("Network error: %1.\n"
@@ -132,8 +133,8 @@ void ThemesInstallWindow::downloadDone(bool error)
132 } 133 }
133 // handle possible error codes 134 // handle possible error codes
134 if(iniDetails.value("error/code").toInt() != 0 || !iniDetails.contains("error/code")) { 135 if(iniDetails.value("error/code").toInt() != 0 || !iniDetails.contains("error/code")) {
135 qDebug() << "[Themes] Theme site returned an error:" 136 LOG_ERROR() << "Theme site returned an error:"
136 << iniDetails.value("error/code"); 137 << iniDetails.value("error/code");
137 logger->addItem(tr("the following error occured:\n%1") 138 logger->addItem(tr("the following error occured:\n%1")
138 .arg(iniDetails.value("error/description", "unknown error").toString()), LOGERROR); 139 .arg(iniDetails.value("error/description", "unknown error").toString()), LOGERROR);
139 logger->setFinished(); 140 logger->setFinished();
@@ -152,7 +153,7 @@ void ThemesInstallWindow::downloadDone(bool error)
152 iniDetails.endGroup(); 153 iniDetails.endGroup();
153 continue; 154 continue;
154 } 155 }
155 qDebug() << "[Themes] adding to list:" << tl.at(i); 156 LOG_INFO() << "adding to list:" << tl.at(i);
156 // convert to unicode and replace HTML-specific entities 157 // convert to unicode and replace HTML-specific entities
157 QByteArray raw = iniDetails.value("name").toByteArray(); 158 QByteArray raw = iniDetails.value("name").toByteArray();
158 QTextCodec* codec = QTextCodec::codecForHtml(raw); 159 QTextCodec* codec = QTextCodec::codecForHtml(raw);
@@ -175,7 +176,7 @@ void ThemesInstallWindow::downloadDone(bool error)
175 msg = iniDetails.value("status/msg." + lang).toString(); 176 msg = iniDetails.value("status/msg." + lang).toString();
176 else 177 else
177 msg = iniDetails.value("status/msg").toString(); 178 msg = iniDetails.value("status/msg").toString();
178 qDebug() << "[Themes] MOTD" << msg; 179 LOG_INFO() << "MOTD" << msg;
179 if(!msg.isEmpty()) 180 if(!msg.isEmpty())
180 QMessageBox::information(this, tr("Information"), msg); 181 QMessageBox::information(this, tr("Information"), msg);
181 } 182 }
@@ -240,7 +241,7 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p
240 241
241void ThemesInstallWindow::updateImage(bool error) 242void ThemesInstallWindow::updateImage(bool error)
242{ 243{
243 qDebug() << "[Themes] Updating image:"<< !error; 244 LOG_INFO() << "Updating image:"<< !error;
244 245
245 if(error) { 246 if(error) {
246 ui.themePreview->clear(); 247 ui.themePreview->clear();
@@ -266,8 +267,7 @@ void ThemesInstallWindow::updateImage(bool error)
266 267
267void ThemesInstallWindow::resizeEvent(QResizeEvent* e) 268void ThemesInstallWindow::resizeEvent(QResizeEvent* e)
268{ 269{
269 qDebug() << "[Themes]" << e; 270 (void)e;
270
271 QPixmap p, q; 271 QPixmap p, q;
272 QSize img; 272 QSize img;
273 img.setHeight(ui.themePreview->height()); 273 img.setHeight(ui.themePreview->height());
@@ -344,13 +344,13 @@ void ThemesInstallWindow::install()
344 QDate().currentDate().toString("yyyyMMdd")).toString()); 344 QDate().currentDate().toString("yyyyMMdd")).toString());
345 iniDetails.endGroup(); 345 iniDetails.endGroup();
346 } 346 }
347 qDebug() << "[Themes] installing:" << themes; 347 LOG_INFO() << "installing:" << themes;
348 348
349 if(logger == NULL) 349 if(logger == NULL)
350 logger = new ProgressLoggerGui(this); 350 logger = new ProgressLoggerGui(this);
351 logger->show(); 351 logger->show();
352 QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString(); 352 QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();
353 qDebug() << "[Themes] mountpoint:" << mountPoint; 353 LOG_INFO() << "mountpoint:" << mountPoint;
354 // show dialog with error if mount point is wrong 354 // show dialog with error if mount point is wrong
355 if(!QFileInfo(mountPoint).isDir()) { 355 if(!QFileInfo(mountPoint).isDir()) {
356 logger->addItem(tr("Mount point is wrong!"),LOGERROR); 356 logger->addItem(tr("Mount point is wrong!"),LOGERROR);