summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-03 11:08:18 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-04 23:32:52 +0100
commit4d2ce949b3b41f8bf0af446fa20205ddd229e579 (patch)
tree01fa19471d9831b296bea5d7049f765e38b30bbb /rbutil/rbutilqt/base
parent335ec75d60bba82f23fc47b20f9390e0cba9c9c5 (diff)
downloadrockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.gz
rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.bz2
rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.zip
Use cutelogger for Rockbox Utility internal trace.
Change tracing from qDebug() to use cutelogger, which is available under the LGPL2.1. This allows to automatically add filename and line number to the log, and also provides multiple log levels. Change-Id: I5dbdaf902ba54ea99f07ae10a07467c52fdac910
Diffstat (limited to 'rbutil/rbutilqt/base')
-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
33 files changed, 324 insertions, 289 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 @@
#include "system.h"
#include "utils.h"
#include "rockboxinfo.h"
+#include "Logger.h"
Autodetection::Autodetection(QObject* parent): QObject(parent)
{
@@ -67,8 +68,8 @@ bool Autodetection::detect(void)
}
}
for(int i = 0; i < m_detected.size(); ++i) {
- qDebug() << "[Autodetect] Detected player:" << m_detected.at(i).device
- << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status];
+ LOG_INFO() << "Detected player:" << m_detected.at(i).device
+ << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status];
}
return m_detected.size() > 0;
@@ -98,14 +99,14 @@ void Autodetection::detectUsb()
d.status = PlayerOk;
d.usbdevices = usbids.value(attached.at(i));
m_detected.append(d);
- qDebug() << "[USB] detected supported player" << d.usbdevices;
+ LOG_INFO() << "[USB] detected supported player" << d.usbdevices;
}
if(usberror.contains(attached.at(i))) {
struct Detected d;
d.status = PlayerMtpMode;
d.device = usbids.value(attached.at(i)).at(0);
m_detected.append(d);
- qDebug() << "[USB] detected problem with player" << d.device;
+ LOG_WARNING() << "[USB] detected problem with player" << d.device;
}
QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) {
@@ -113,7 +114,7 @@ void Autodetection::detectUsb()
d.status = PlayerIncompatible;
d.device = idstring;
m_detected.append(d);
- qDebug() << "[USB] detected incompatible player" << d.device;
+ LOG_WARNING() << "[USB] detected incompatible player" << d.device;
}
}
}
@@ -125,7 +126,7 @@ void Autodetection::detectUsb()
void Autodetection::mergeMounted(void)
{
QStringList mounts = Utils::mountpoints(Utils::MountpointsSupported);
- qDebug() << "[Autodetect] paths to check:" << mounts;
+ LOG_INFO() << "paths to check:" << mounts;
for(int i = 0; i < mounts.size(); i++)
{
@@ -143,8 +144,8 @@ void Autodetection::mergeMounted(void)
d.mountpoint = mounts.at(i);
d.status = PlayerOk;
updateDetectedDevice(d);
- qDebug() << "[Autodetect] rbutil.log detected:"
- << log.value("platform").toString() << mounts.at(i);
+ LOG_INFO() << "rbutil.log detected:"
+ << log.value("platform").toString() << mounts.at(i);
}
}
@@ -157,8 +158,8 @@ void Autodetection::mergeMounted(void)
d.mountpoint = mounts.at(i);
d.status = PlayerOk;
updateDetectedDevice(d);
- qDebug() << "[Autodetect] rockbox-info.txt detected:"
- << info.target() << mounts.at(i);
+ LOG_INFO() << "rockbox-info.txt detected:"
+ << info.target() << mounts.at(i);
}
// check for some specific files in root folder
@@ -193,13 +194,13 @@ void Autodetection::mergeMounted(void)
}
if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive))
{
- qDebug() << "[Autodetect] ajbrec.ajz found. Trying detectAjbrec()";
+ LOG_INFO() << "ajbrec.ajz found. Trying detectAjbrec()";
struct Detected d;
d.device = detectAjbrec(mounts.at(i));
d.mountpoint = mounts.at(i);
d.status = PlayerOk;
if(!d.device.isEmpty()) {
- qDebug() << "[Autodetect]" << d.device;
+ LOG_INFO() << d.device;
updateDetectedDevice(d);
}
}
@@ -255,7 +256,7 @@ void Autodetection::mergePatcher(void)
n = ipod_scan(&ipod);
// FIXME: handle more than one Ipod connected in ipodpatcher.
if(n == 1) {
- qDebug() << "[Autodetect] Ipod found:" << ipod.modelstr << "at" << ipod.diskname;
+ LOG_INFO() << "Ipod found:" << ipod.modelstr << "at" << ipod.diskname;
// since resolveMountPoint is doing exact matches we need to select
// the correct partition.
QString mp(ipod.diskname);
@@ -276,7 +277,7 @@ void Autodetection::mergePatcher(void)
updateDetectedDevice(d);
}
else {
- qDebug() << "[Autodetect] ipodpatcher: no Ipod found." << n;
+ LOG_INFO() << "ipodpatcher: no Ipod found." << n;
}
ipod_dealloc_buffer(&ipod);
@@ -286,8 +287,8 @@ void Autodetection::mergePatcher(void)
sansa_alloc_buffer(&sansa, BUFFER_SIZE);
n = sansa_scan(&sansa);
if(n == 1) {
- qDebug() << "[Autodetect] Sansa found:"
- << sansa.targetname << "at" << sansa.diskname;
+ LOG_INFO() << "Sansa found:"
+ << sansa.targetname << "at" << sansa.diskname;
QString mp(sansa.diskname);
#ifdef Q_OS_LINUX
mp.append("1");
@@ -302,7 +303,7 @@ void Autodetection::mergePatcher(void)
updateDetectedDevice(d);
}
else {
- qDebug() << "[Autodetect] sansapatcher: no Sansa found." << n;
+ LOG_INFO() << "sansapatcher: no Sansa found." << n;
}
sansa_dealloc_buffer(&sansa);
}
@@ -323,8 +324,8 @@ QString Autodetection::detectAjbrec(QString root)
// recorder v1 has the binary length in the first 4 bytes, so check
// for them first.
int len = (header[0]<<24) | (header[1]<<16) | (header[2]<<8) | header[3];
- qDebug() << "[Autodetect] ABJREC possible bin length:" << len
- << "file len:" << f.size();
+ LOG_INFO() << "abjrec.ajz possible bin length:" << len
+ << "file len:" << f.size();
if((f.size() - 6) == len)
return "recorder";
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 @@
#include <QtCore>
#include "bootloaderinstallbase.h"
#include "bootloaderinstallams.h"
+#include "Logger.h"
#include "../mkamsboot/mkamsboot.h"
@@ -51,7 +52,7 @@ bool BootloaderInstallAms::install(void)
if(m_offile.isEmpty())
return false;
- qDebug() << "[BootloaderInstallAms] installing bootloader";
+ LOG_INFO() << "installing bootloader";
// download firmware from server
emit logItem(tr("Downloading bootloader file"), LOGINFO);
@@ -64,7 +65,7 @@ bool BootloaderInstallAms::install(void)
void BootloaderInstallAms::installStage2(void)
{
- qDebug() << "[BootloaderInstallAms] installStage2";
+ LOG_INFO() << "installStage2";
unsigned char* buf;
unsigned char* of_packed;
@@ -94,7 +95,7 @@ void BootloaderInstallAms::installStage2(void)
errstr,sizeof(errstr));
if (rb_packed == NULL)
{
- qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile;
+ LOG_ERROR() << "could not load bootloader: " << bootfile;
emit logItem(errstr, LOGERROR);
emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR);
emit done(true);
@@ -107,7 +108,7 @@ void BootloaderInstallAms::installStage2(void)
errstr, sizeof(errstr));
if (buf == NULL)
{
- qDebug() << "[BootloaderInstallAms] could not load OF: " << m_offile;
+ LOG_ERROR() << "could not load OF: " << m_offile;
emit logItem(errstr, LOGERROR);
emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR);
free(rb_packed);
@@ -121,7 +122,7 @@ void BootloaderInstallAms::installStage2(void)
if (!patchable)
{
- qDebug() << "[BootloaderInstallAms] No room to insert bootloader";
+ LOG_ERROR() << "No room to insert bootloader";
emit logItem(errstr, LOGERROR);
emit logItem(tr("No room to insert bootloader, try another firmware version"),
LOGERROR);
@@ -143,7 +144,7 @@ void BootloaderInstallAms::installStage2(void)
if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
- qDebug() << "[BootloaderInstallAms] Could not open" << m_blfile << "for writing";
+ LOG_ERROR() << "Could not open" << m_blfile << "for writing";
emit logItem(tr("Could not open %1 for writing").arg(m_blfile),LOGERROR);
free(buf);
free(of_packed);
@@ -156,7 +157,7 @@ void BootloaderInstallAms::installStage2(void)
if (n != len)
{
- qDebug() << "[BootloaderInstallAms] Could not write firmware file";
+ LOG_ERROR() << "Could not write firmware file";
emit logItem(tr("Could not write firmware file"),LOGERROR);
free(buf);
free(of_packed);
@@ -172,7 +173,7 @@ void BootloaderInstallAms::installStage2(void)
free(rb_packed);
//end of install
- qDebug() << "[BootloaderInstallAms] install successfull";
+ LOG_INFO() << "install successfull";
emit logItem(tr("Success: modified firmware file created"), LOGINFO);
logInstall(LogAdd);
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 @@
#include "utils.h"
#include "ziputil.h"
#include "mspackutil.h"
+#include "Logger.h"
#if defined(Q_OS_MACX)
#include <sys/param.h>
@@ -58,8 +59,8 @@ void BootloaderInstallBase::downloadBlStart(QUrl source)
void BootloaderInstallBase::downloadReqFinished(int id, bool error)
{
- qDebug() << "[BootloaderInstallBase] Download Request" << id
- << "finished, error:" << m_http.errorString();
+ LOG_INFO() << "Download Request" << id
+ << "finished, error:" << m_http.errorString();
downloadBlFinish(error);
}
@@ -67,8 +68,8 @@ void BootloaderInstallBase::downloadReqFinished(int id, bool error)
void BootloaderInstallBase::downloadBlFinish(bool error)
{
- qDebug() << "[BootloaderInstallBase] Downloading bootloader finished, error:"
- << error;
+ LOG_INFO() << "Downloading bootloader finished, error:"
+ << error;
// update progress bar
emit logProgress(100, 100);
@@ -98,7 +99,7 @@ void BootloaderInstallBase::downloadBlFinish(bool error)
void BootloaderInstallBase::installBlfile(void)
{
- qDebug() << "[BootloaderInstallBase] installBlFile(void)";
+ LOG_INFO() << "installBlFile(void)";
}
@@ -107,7 +108,7 @@ void BootloaderInstallBase::installBlfile(void)
//! @return true on success, false on error.
bool BootloaderInstallBase::backup(QString to)
{
- qDebug() << "[BootloaderInstallBase] Backing up bootloader file";
+ LOG_INFO() << "Backing up bootloader file";
QDir targetDir(".");
emit logItem(tr("Creating backup of original firmware file."), LOGINFO);
if(!targetDir.mkpath(to)) {
@@ -115,7 +116,7 @@ bool BootloaderInstallBase::backup(QString to)
return false;
}
QString tofile = to + "/" + QFileInfo(m_blfile).fileName();
- qDebug() << "[BootloaderInstallBase] trying to backup" << m_blfile << "to" << tofile;
+ LOG_INFO() << "trying to backup" << m_blfile << "to" << tofile;
if(!QFile::copy(Utils::resolvePathCase(m_blfile), tofile)) {
emit logItem(tr("Creating backup copy failed."), LOGERROR);
return false;
@@ -137,8 +138,8 @@ int BootloaderInstallBase::logInstall(LogMode mode)
if(mode == LogAdd) {
s.setValue("Bootloader/" + section, m_blversion.toString(Qt::ISODate));
- qDebug() << "[BootloaderInstallBase] Writing log, version:"
- << m_blversion.toString(Qt::ISODate);
+ LOG_INFO() << "Writing log, version:"
+ << m_blversion.toString(Qt::ISODate);
}
else {
s.remove("Bootloader/" + section);
@@ -182,7 +183,7 @@ void BootloaderInstallBase::checkRemount()
if(!status) {
// still not remounted, restart timer.
QTimer::singleShot(500, this, SLOT(checkRemount()));
- qDebug() << "[BootloaderInstallBase] Player not remounted yet" << m_remountDevice;
+ LOG_INFO() << "Player not remounted yet" << m_remountDevice;
}
else {
emit logItem(tr("Player remounted"), LOGINFO);
@@ -244,11 +245,11 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile)
// check if the file set is in zip format
if(util) {
QStringList contents = util->files();
- qDebug() << "[BootloaderInstallBase] archive contains:" << contents;
+ LOG_INFO() << "archive contains:" << contents;
for(int i = 0; i < blfile.size(); ++i) {
// strip any path, we don't know the structure in the zip
QString f = QFileInfo(blfile.at(i)).fileName();
- qDebug() << "[BootloaderInstallBase] searching archive for" << f;
+ LOG_INFO() << "searching archive for" << f;
// contents.indexOf() works case sensitive. Since the filename
// casing is unknown (and might change) do this manually.
// 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 @@
#include <QtDebug>
#include "bootloaderinstallfile.h"
#include "utils.h"
+#include "Logger.h"
BootloaderInstallFile::BootloaderInstallFile(QObject *parent)
@@ -31,7 +32,7 @@ BootloaderInstallFile::BootloaderInstallFile(QObject *parent)
bool BootloaderInstallFile::install(void)
{
emit logItem(tr("Downloading bootloader"), LOGINFO);
- qDebug() << "[BootloaderInstallFile] installing bootloader";
+ LOG_INFO() << "installing bootloader";
downloadBlStart(m_blurl);
connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
return true;
@@ -46,7 +47,7 @@ void BootloaderInstallFile::installStage2(void)
QString fwfile(Utils::resolvePathCase(m_blfile));
if(!fwfile.isEmpty()) {
QString moved = Utils::resolvePathCase(m_blfile) + ".ORIG";
- qDebug() << "[BootloaderInstallFile] renaming" << fwfile << "to" << moved;
+ LOG_INFO() << "renaming" << fwfile << "to" << moved;
QFile::rename(fwfile, moved);
}
@@ -80,8 +81,8 @@ void BootloaderInstallFile::installStage2(void)
// place (new) bootloader
m_tempfile.open();
- qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName()
- << "to" << fwfile;
+ LOG_INFO() << "renaming" << m_tempfile.fileName()
+ << "to" << fwfile;
m_tempfile.close();
if(!Utils::resolvePathCase(fwfile).isEmpty()) {
@@ -106,7 +107,7 @@ void BootloaderInstallFile::installStage2(void)
bool BootloaderInstallFile::uninstall(void)
{
- qDebug() << "[BootloaderInstallFile] Uninstalling bootloader";
+ LOG_INFO() << "Uninstalling bootloader";
emit logItem(tr("Removing Rockbox bootloader"), LOGINFO);
// check if a .ORIG file is present, and allow moving it back.
QString origbl = Utils::resolvePathCase(m_blfile + ".ORIG");
@@ -138,7 +139,7 @@ bool BootloaderInstallFile::uninstall(void)
//! @return BootloaderRockbox, BootloaderOther or BootloaderUnknown.
BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void)
{
- qDebug() << "[BootloaderInstallFile] checking installed bootloader";
+ LOG_INFO() << "checking installed bootloader";
if(!Utils::resolvePathCase(m_blfile).isEmpty()
&& !Utils::resolvePathCase(m_blfile + ".ORIG").isEmpty())
return BootloaderRockbox;
@@ -151,7 +152,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void)
BootloaderInstallBase::Capabilities BootloaderInstallFile::capabilities(void)
{
- qDebug() << "[BootloaderInstallFile] getting capabilities";
+ LOG_INFO() << "getting capabilities";
return Install | Uninstall | IsFile | CanCheckInstalled | Backup;
}
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 @@
#include "bootloaderinstallbase.h"
#include "bootloaderinstallhex.h"
#include "utils.h"
+#include "Logger.h"
#include "../../tools/iriver.h"
#include "../../tools/mkboot.h"
@@ -74,7 +75,7 @@ bool BootloaderInstallHex::install(void)
file.close();
QString hash = QCryptographicHash::hash(filedata,
QCryptographicHash::Md5).toHex();
- qDebug() << "[BootloaderInstallHex] hexfile hash:" << hash;
+ LOG_INFO() << "hexfile hash:" << hash;
if(file.error() != QFile::NoError) {
emit logItem(tr("Could not verify original firmware file"), LOGERROR);
emit done(true);
@@ -112,7 +113,7 @@ bool BootloaderInstallHex::install(void)
int result;
result = iriver_decode(m_offile.toLatin1().data(),
m_descrambled.fileName().toLatin1().data(), FALSE, STRIP_NONE);
- qDebug() << "[BootloaderInstallHex] iriver_decode" << result;
+ LOG_INFO() << "iriver_decode():" << result;
if(result < 0) {
emit logItem(tr("Error in descramble: %1").arg(scrambleError(result)), LOGERROR);
@@ -200,7 +201,7 @@ void BootloaderInstallHex::installStage2(void)
targethex.close();
QString hash = QCryptographicHash::hash(filedata,
QCryptographicHash::Md5).toHex();
- qDebug() << "[BootloaderInstallHex] created hexfile hash:" << hash;
+ LOG_INFO() << "created hexfile hash:" << hash;
emit logItem(tr("Checking modified firmware file"), LOGINFO);
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 @@
#include "bootloaderinstallbase.h"
#include "bootloaderinstallimx.h"
#include "../mkimxboot/mkimxboot.h"
+#include "Logger.h"
// class for running mkimxboot() in a separate thread to keep the UI responsive.
class BootloaderThreadImx : public QThread
@@ -45,7 +46,7 @@ class BootloaderThreadImx : public QThread
void BootloaderThreadImx::run(void)
{
- qDebug() << "[BootloaderThreadImx] Thread started.";
+ LOG_INFO() << "Thread started.";
struct imx_option_t opt;
memset(&opt, 0, sizeof(opt));
opt.debug = false;
@@ -55,7 +56,7 @@ void BootloaderThreadImx::run(void)
m_error = mkimxboot(m_inputfile.toLocal8Bit().constData(),
m_bootfile.toLocal8Bit().constData(),
m_outputfile.toLocal8Bit().constData(), opt);
- qDebug() << "[BootloaderThreadImx] Thread finished, result:" << m_error;
+ LOG_INFO() << "Thread finished, result:" << m_error;
}
@@ -88,13 +89,13 @@ bool BootloaderInstallImx::install(void)
{
if(!QFileInfo(m_offile).isReadable())
{
- qDebug() << "[BootloaderInstallImx] could not read original firmware file"
+ LOG_ERROR() << "could not read original firmware file"
<< m_offile;
emit logItem(tr("Could not read original firmware file"), LOGERROR);
return false;
}
- qDebug() << "[BootloaderInstallImx] downloading bootloader";
+ LOG_INFO() << "downloading bootloader";
// download bootloader from server
emit logItem(tr("Downloading bootloader file"), LOGINFO);
connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
@@ -105,7 +106,7 @@ bool BootloaderInstallImx::install(void)
void BootloaderInstallImx::installStage2(void)
{
- qDebug() << "[BootloaderInstallImx] patching file...";
+ LOG_INFO() << "patching file...";
emit logItem(tr("Patching file..."), LOGINFO);
m_tempfile.open();
@@ -132,26 +133,26 @@ void BootloaderInstallImx::installStage3(void)
// if the patch failed
if (err != IMX_SUCCESS)
{
- qDebug() << "[BootloaderInstallImx] Could not patch the original firmware file";
+ LOG_ERROR() << "Could not patch the original firmware file";
emit logItem(tr("Patching the original firmware failed"), LOGERROR);
emit done(true);
return;
}
- qDebug() << "[BootloaderInstallImx] Original Firmware succesfully patched";
+ LOG_INFO() << "Original Firmware succesfully patched";
emit logItem(tr("Succesfully patched firmware file"), LOGINFO);
// if a bootloader is already present delete it.
QString fwfile(m_blfile);
if(QFileInfo(fwfile).isFile())
{
- qDebug() << "[BootloaderInstallImx] deleting old target file";
+ LOG_INFO() << "deleting old target file";
QFile::remove(fwfile);
}
// place (new) bootloader. Copy, since the temporary file will be removed
// automatically.
- qDebug() << "[BootloaderInstallImx] moving patched bootloader to" << fwfile;
+ LOG_INFO() << "moving patched bootloader to" << fwfile;
if(m_patchedFile.copy(fwfile))
{
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 @@
#include "../ipodpatcher/ipodpatcher.h"
#include "utils.h"
+#include "Logger.h"
BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent)
@@ -131,7 +132,8 @@ void BootloaderInstallIpod::installStage3(bool mounted)
emit logItem(tr("Writing log aborted"), LOGERROR);
emit done(true);
}
- qDebug() << "[BootloaderInstallIpod] version installed:" << m_blversion.toString(Qt::ISODate);
+ LOG_INFO() << "version installed:"
+ << m_blversion.toString(Qt::ISODate);
}
@@ -190,7 +192,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallIpod::installed(void)
BootloaderInstallBase::BootloaderType result = BootloaderRockbox;
if(!ipodInitialize(&ipod)) {
- qDebug() << "[BootloaderInstallIpod] installed: BootloaderUnknown";
+ LOG_INFO() << "installed: BootloaderUnknown";
result = BootloaderUnknown;
}
else {
@@ -200,7 +202,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallIpod::installed(void)
result = BootloaderOther;
}
else {
- qDebug() << "[BootloaderInstallIpod] installed: BootloaderRockbox";
+ LOG_INFO() << "installed: BootloaderRockbox";
}
}
ipod_close(&ipod);
@@ -235,12 +237,12 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
sprintf(ipod->diskname, "%s",
qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
#endif
- qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using"
- << ipod->diskname;
+ LOG_INFO() << "ipodpatcher: overriding scan, using"
+ << ipod->diskname;
}
else {
emit logItem(tr("Error: no mountpoint specified!"), LOGERROR);
- qDebug() << "[BootloaderInstallIpod] no mountpoint specified!";
+ LOG_ERROR() << "no mountpoint specified!";
}
int result = ipod_open(ipod, 1);
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 @@
#include <QtDebug>
#include "bootloaderinstallmi4.h"
#include "utils.h"
+#include "Logger.h"
BootloaderInstallMi4::BootloaderInstallMi4(QObject *parent)
: BootloaderInstallBase(parent)
@@ -31,7 +32,7 @@ BootloaderInstallMi4::BootloaderInstallMi4(QObject *parent)
bool BootloaderInstallMi4::install(void)
{
emit logItem(tr("Downloading bootloader"), LOGINFO);
- qDebug() << "[BootloaderInstallMi4] installing bootloader";
+ LOG_INFO() << "installing bootloader";
downloadBlStart(m_blurl);
connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
return true;
@@ -48,18 +49,18 @@ void BootloaderInstallMi4::installStage2(void)
QString moved = QFileInfo(Utils::resolvePathCase(m_blfile)).absolutePath()
+ "/OF.mi4";
if(!QFileInfo(moved).exists()) {
- qDebug() << "[BootloaderInstallMi4] renaming" << fwfile << "to" << moved;
+ LOG_INFO() << "renaming" << fwfile << "to" << moved;
oldbl.rename(moved);
}
else {
- qDebug() << "[BootloaderInstallMi4] OF.mi4 already present, not renaming again.";
+ LOG_INFO() << "OF.mi4 already present, not renaming again.";
oldbl.remove();
}
// place new bootloader
m_tempfile.open();
- qDebug() << "[BootloaderInstallMi4] renaming" << m_tempfile.fileName()
- << "to" << fwfile;
+ LOG_INFO() << "renaming" << m_tempfile.fileName()
+ << "to" << fwfile;
m_tempfile.close();
if(!Utils::resolvePathCase(fwfile).isEmpty()) {
emit logItem(tr("A firmware file is already present on player"), LOGERROR);
@@ -84,7 +85,7 @@ void BootloaderInstallMi4::installStage2(void)
bool BootloaderInstallMi4::uninstall(void)
{
- qDebug() << "[BootloaderInstallMi4] Uninstalling bootloader";
+ LOG_INFO() << "Uninstalling bootloader";
// check if it's actually a Rockbox bootloader
emit logItem(tr("Checking for Rockbox bootloader"), LOGINFO);
@@ -128,7 +129,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
QString resolved;
resolved = Utils::resolvePathCase(m_blfile);
if(resolved.isEmpty()) {
- qDebug() << "[BootloaderInstallMi4] installed: BootloaderNone";
+ LOG_INFO() << "installed: BootloaderNone";
return BootloaderNone;
}
@@ -140,11 +141,11 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
f.close();
if(!memcmp(magic, "RBBL", 4)) {
- qDebug() << "[BootloaderInstallMi4] installed: BootloaderRockbox";
+ LOG_INFO() << "installed: BootloaderRockbox";
return BootloaderRockbox;
}
else {
- qDebug() << "[BootloaderInstallMi4] installed: BootloaderOther";
+ LOG_INFO() << "installed: BootloaderOther";
return BootloaderOther;
}
}
@@ -152,7 +153,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
BootloaderInstallBase::Capabilities BootloaderInstallMi4::capabilities(void)
{
- qDebug() << "[BootloaderInstallMi4] getting capabilities";
+ LOG_INFO() << "getting capabilities";
return Install | Uninstall | Backup | IsFile | CanCheckInstalled | CanCheckVersion;
}
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 @@
#include <QtCore>
#include "bootloaderinstallbase.h"
#include "bootloaderinstallmpio.h"
+#include "Logger.h"
#include "../mkmpioboot/mkmpioboot.h"
@@ -46,7 +47,7 @@ bool BootloaderInstallMpio::install(void)
if(m_offile.isEmpty())
return false;
- qDebug() << "[BootloaderInstallMpio] installing bootloader";
+ LOG_INFO() << "installing bootloader";
// download firmware from server
emit logItem(tr("Downloading bootloader file"), LOGINFO);
@@ -59,7 +60,7 @@ bool BootloaderInstallMpio::install(void)
void BootloaderInstallMpio::installStage2(void)
{
- qDebug() << "[BootloaderInstallMpio] installStage2";
+ LOG_INFO() << "installStage2";
int origin = 0xe0000; /* MPIO HD200 bootloader address */
@@ -107,14 +108,14 @@ void BootloaderInstallMpio::installStage2(void)
break;
}
- qDebug() << "[BootloaderInstallMpio] Patching original firmware failed:" << error;
+ LOG_ERROR() << "Patching original firmware failed:" << error;
emit logItem(tr("Patching original firmware failed: %1").arg(error), LOGERROR);
emit done(true);
return;
}
//end of install
- qDebug() << "[BootloaderInstallMpio] install successful";
+ LOG_INFO() << "install successful";
emit logItem(tr("Success: modified firmware file created"), LOGINFO);
logInstall(LogAdd);
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 @@
#include <QtCore>
#include "bootloaderinstallbase.h"
#include "bootloaderinstallsansa.h"
+#include "Logger.h"
#include "../sansapatcher/sansapatcher.h"
#include "utils.h"
@@ -116,7 +117,7 @@ void BootloaderInstallSansa::installStage2(void)
m_tempfile.close();
if(memcmp(sansa.targetname, magic, 4) != 0) {
emit logItem(tr("Bootloader mismatch! Aborting."), LOGERROR);
- qDebug("[BootloaderInstallSansa] Targetname: %s, mi4 magic: %c%c%c%c",
+ LOG_INFO("Targetname: %s, mi4 magic: %c%c%c%c",
sansa.targetname, magic[0], magic[1], magic[2], magic[3]);
emit done(true);
sansa_close(&sansa);
@@ -157,7 +158,8 @@ void BootloaderInstallSansa::installStage3(bool mounted)
emit logItem(tr("Writing log aborted"), LOGERROR);
emit done(true);
}
- qDebug() << "[BootloaderInstallSansa] version installed:" << m_blversion.toString(Qt::ISODate);
+ LOG_INFO() << "version installed:"
+ << m_blversion.toString(Qt::ISODate);
}
@@ -245,8 +247,8 @@ bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
sprintf(sansa->diskname,
qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
#endif
- qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using"
- << sansa->diskname;
+ LOG_INFO() << "sansapatcher: overriding scan, using"
+ << sansa->diskname;
}
else if(sansa_scan(sansa) != 1) {
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 @@
#include "encoderexe.h"
#include "rbsettings.h"
#include "utils.h"
+#include "Logger.h"
EncoderExe::EncoderExe(QString name,QObject *parent) : EncoderBase(parent)
{
@@ -69,14 +70,13 @@ bool EncoderExe::start()
bool EncoderExe::encode(QString input,QString output)
{
- //qDebug() << "encoding..";
QString execstring = m_EncTemplate;
execstring.replace("%exe",m_EncExec);
execstring.replace("%options",m_EncOpts);
execstring.replace("%input",input);
execstring.replace("%output",output);
- qDebug() << "[EncoderExe] cmd: " << execstring;
+ LOG_INFO() << "cmd: " << execstring;
int result = QProcess::execute(execstring);
return (result == 0) ? true : false;
}
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 @@
#include "encoderlame.h"
#include "rbsettings.h"
#include "lame/lame.h"
+#include "Logger.h"
/** Resolve a symbol from loaded library.
*/
#define SYMBOLRESOLVE(symbol, type) \
do { m_##symbol = (type)lib->resolve(#symbol); \
if(!m_##symbol) return; \
- qDebug() << "[EncoderLame] Resolved symbol " #symbol; } \
+ LOG_INFO() << "Resolved symbol " #symbol; } \
while(0)
EncoderLame::EncoderLame(QObject *parent) : EncoderBase(parent)
@@ -50,7 +51,7 @@ EncoderLame::EncoderLame(QObject *parent) : EncoderBase(parent)
SYMBOLRESOLVE(lame_encode_flush, int (*)(lame_global_flags*, unsigned char*, int));
SYMBOLRESOLVE(lame_close, int (*)(lame_global_flags*));
- qDebug() << "[EncoderLame] libmp3lame loaded:" << lib->isLoaded();
+ LOG_INFO() << "libmp3lame loaded:" << lib->isLoaded();
m_encoderVolume = RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble();
m_encoderQuality = RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble();
@@ -108,9 +109,9 @@ bool EncoderLame::start()
bool EncoderLame::encode(QString input,QString output)
{
- qDebug() << "[EncoderLame] Encoding" << QDir::cleanPath(input);
+ LOG_INFO() << "Encoding" << QDir::cleanPath(input);
if(!m_symbolsResolved) {
- qDebug() << "[EncoderLame] Symbols not successfully resolved, cannot run!";
+ LOG_ERROR() << "Symbols not successfully resolved, cannot run!";
return false;
}
@@ -144,21 +145,21 @@ bool EncoderLame::encode(QString input,QString output)
m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag.
if(!fin.open(QIODevice::ReadOnly)) {
- qDebug() << "[EncoderLame] Could not open input file" << input;
+ LOG_ERROR() << "Could not open input file" << input;
return false;
}
// read RIFF header
fin.read((char*)header, 12);
if(memcmp("RIFF", header, 4) != 0) {
- qDebug() << "[EncoderLame] RIFF header not found!"
- << header[0] << header[1] << header[2] << header[3];
+ LOG_ERROR() << "RIFF header not found!"
+ << header[0] << header[1] << header[2] << header[3];
fin.close();
return false;
}
if(memcmp("WAVE", &header[8], 4) != 0) {
- qDebug() << "[EncoderLame] WAVE FOURCC not found!"
- << header[8] << header[9] << header[10] << header[11];
+ LOG_ERROR() << "WAVE FOURCC not found!"
+ << header[8] << header[9] << header[10] << header[11];
fin.close();
return false;
}
@@ -178,7 +179,7 @@ bool EncoderLame::encode(QString input,QString output)
// input format used should be known. In case some TTS uses a
// different wave encoding some time this needs to get adjusted.
if(chunkdatalen < 16) {
- qDebug() << "[EncoderLame] fmt chunk too small!";
+ LOG_ERROR() << "fmt chunk too small!";
}
else {
unsigned char *buf = new unsigned char[chunkdatalen];
@@ -196,18 +197,18 @@ bool EncoderLame::encode(QString input,QString output)
}
else {
// unknown chunk, just skip its data.
- qDebug() << "[EncoderLame] unknown chunk, skipping."
- << chunkheader[0] << chunkheader[1]
- << chunkheader[2] << chunkheader[3];
+ LOG_WARNING() << "unknown chunk, skipping."
+ << chunkheader[0] << chunkheader[1]
+ << chunkheader[2] << chunkheader[3];
fin.seek(fin.pos() + chunkdatalen);
}
} while(!fin.atEnd());
// check format
if(channels == 0 || samplerate == 0 || samplesize == 0 || datalength == 0) {
- qDebug() << "[EncoderLame] invalid format. Channels:" << channels
- << "Samplerate:" << samplerate << "Samplesize:" << samplesize
- << "Data chunk length:" << datalength;
+ LOG_ERROR() << "invalid format. Channels:" << channels
+ << "Samplerate:" << samplerate << "Samplesize:" << samplesize
+ << "Data chunk length:" << datalength;
fin.close();
return false;
}
@@ -220,7 +221,7 @@ bool EncoderLame::encode(QString input,QString output)
// initialize encoder.
ret = m_lame_init_params(gfp);
if(ret != 0) {
- qDebug() << "[EncoderLame] lame_init_params() failed with" << ret;
+ LOG_ERROR() << "lame_init_params() failed with" << ret;
fin.close();
return false;
}
@@ -230,7 +231,7 @@ bool EncoderLame::encode(QString input,QString output)
// bytes the input file has. This wastes space but should be ok.
// Put an upper limit of 8MiB.
if(datalength > 8*1024*1024) {
- qDebug() << "[EncoderLame] Input file too large:" << datalength;
+ LOG_ERROR() << "Input file too large:" << datalength;
fin.close();
return false;
}
@@ -255,7 +256,7 @@ bool EncoderLame::encode(QString input,QString output)
}
}
else {
- qDebug() << "[EncoderLame] Unknown samplesize:" << samplesize;
+ LOG_ERROR() << "Unknown samplesize:" << samplesize;
fin.close();
delete[] mp3buf;
delete[] wavbuf;
@@ -270,10 +271,10 @@ bool EncoderLame::encode(QString input,QString output)
fout.open(QIODevice::ReadWrite);
ret = m_lame_encode_buffer(gfp, wavbuf, wavbuf, num_samples, mp3buf, mp3buflen);
if(ret < 0) {
- qDebug() << "[EncoderLame] Error during encoding:" << ret;
+ LOG_ERROR() << "Error during encoding:" << ret;
}
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
- qDebug() << "[EncoderLame] Writing mp3 data failed!" << ret;
+ LOG_ERROR() << "Writing mp3 data failed!" << ret;
fout.close();
delete[] mp3buf;
delete[] wavbuf;
@@ -282,7 +283,7 @@ bool EncoderLame::encode(QString input,QString output)
// flush remaining data
ret = m_lame_encode_flush(gfp, mp3buf, mp3buflen);
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
- qDebug() << "[EncoderLame] Writing final mp3 data failed!";
+ LOG_ERROR() << "Writing final mp3 data failed!";
fout.close();
delete[] mp3buf;
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 @@
#include "encoderrbspeex.h"
#include "rbsettings.h"
#include "rbspeex.h"
+#include "Logger.h"
EncoderRbSpeex::EncoderRbSpeex(QObject *parent) : EncoderBase(parent)
{
@@ -78,16 +79,16 @@ bool EncoderRbSpeex::start()
bool EncoderRbSpeex::encode(QString input,QString output)
{
- qDebug() << "[RbSpeex] Encoding " << input << " to "<< output;
+ LOG_INFO() << "Encoding " << input << " to "<< output;
char errstr[512];
FILE *fin,*fout;
if ((fin = fopen(input.toLocal8Bit(), "rb")) == NULL) {
- qDebug() << "[RbSpeex] Error: could not open input file\n";
+ LOG_ERROR() << "Error: could not open input file\n";
return false;
}
if ((fout = fopen(output.toLocal8Bit(), "wb")) == NULL) {
- qDebug() << "[RbSpeex] Error: could not open output file\n";
+ LOG_ERROR() << "Error: could not open output file\n";
fclose(fin);
return false;
}
@@ -99,7 +100,7 @@ bool EncoderRbSpeex::encode(QString input,QString output)
if (!ret) {
/* Attempt to delete unfinished output */
- qDebug() << "[RbSpeex] Error:" << errstr;
+ LOG_ERROR() << "Error:" << errstr;
QFile(output).remove();
return false;
}
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 @@
#include <QNetworkRequest>
#include "httpget.h"
+#include "Logger.h"
QString HttpGet::m_globalUserAgent; //< globally set user agent for requests
QDir HttpGet::m_globalCache; //< global cach path value for new objects
@@ -71,14 +72,14 @@ void HttpGet::setCache(bool c)
QString path = m_cachedir.absolutePath();
if(!c || m_cachedir.absolutePath().isEmpty()) {
- qDebug() << "[HttpGet] disabling download cache";
+ LOG_INFO() << "disabling download cache";
}
else {
// append the cache path to make it unique in case the path points to
// the system temporary path. In that case using it directly might
// cause problems. Extra path also used in configure dialog.
path += "/rbutil-cache";
- qDebug() << "[HttpGet] setting cache folder to" << path;
+ LOG_INFO() << "setting cache folder to" << path;
m_cache = new QNetworkDiskCache(this);
m_cache->setCacheDirectory(path);
}
@@ -97,7 +98,7 @@ QByteArray HttpGet::readAll()
void HttpGet::setProxy(const QUrl &proxy)
{
- qDebug() << "[HttpGet] Proxy set to" << proxy;
+ LOG_INFO() << "Proxy set to" << proxy;
m_proxy.setType(QNetworkProxy::HttpProxy);
m_proxy.setHostName(proxy.host());
m_proxy.setPort(proxy.port());
@@ -130,10 +131,10 @@ void HttpGet::requestFinished(QNetworkReply* reply)
{
m_lastStatusCode
= reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- qDebug() << "[HttpGet] Request finished, status code:" << m_lastStatusCode;
+ LOG_INFO() << "Request finished, status code:" << m_lastStatusCode;
m_lastServerTimestamp
= reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toLocalTime();
- qDebug() << "[HttpGet] Data from cache:"
+ LOG_INFO() << "Data from cache:"
<< reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool();
m_lastRequestCached =
reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool();
@@ -150,7 +151,7 @@ void HttpGet::requestFinished(QNetworkReply* reply)
#else
url.setQuery(org.query());
#endif
- qDebug() << "[HttpGet] Redirected to" << url;
+ LOG_INFO() << "Redirected to" << url;
startRequest(url);
return;
}
@@ -179,7 +180,7 @@ void HttpGet::downloadProgress(qint64 received, qint64 total)
void HttpGet::startRequest(QUrl url)
{
- qDebug() << "[HttpGet] Request started";
+ LOG_INFO() << "Request started";
QNetworkRequest req(url);
if(!m_globalUserAgent.isEmpty())
req.setRawHeader("User-Agent", m_globalUserAgent.toLatin1());
@@ -194,15 +195,14 @@ void HttpGet::startRequest(QUrl url)
void HttpGet::networkError(QNetworkReply::NetworkError error)
{
- qDebug() << "[HttpGet] NetworkError occured:"
- << error << m_reply->errorString();
+ LOG_ERROR() << "NetworkError occured:" << error << m_reply->errorString();
m_lastErrorString = m_reply->errorString();
}
bool HttpGet::getFile(const QUrl &url)
{
- qDebug() << "[HttpGet] Get URI" << url.toString();
+ LOG_INFO() << "Get URI" << url.toString();
m_data.clear();
startRequest(url);
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 @@
#include <QtCore>
#include <QtNetwork>
#include <QNetworkAccessManager>
+#include "Logger.h"
class HttpGet : public QObject
{
@@ -49,13 +50,13 @@ class HttpGet : public QObject
//< set global cache path
static void setGlobalCache(const QDir& d)
{
- qDebug() << "[HttpGet] Global cache set to" << d.absolutePath();
+ LOG_INFO() << "Global cache set to" << d.absolutePath();
m_globalCache = d;
}
//< set global proxy value
static void setGlobalProxy(const QUrl& p)
{
- qDebug() << "[HttpGet] setting global proxy" << p;
+ LOG_INFO() << "setting global proxy" << p;
if(!p.isValid() || p.isEmpty()) {
HttpGet::m_globalProxy.setType(QNetworkProxy::NoProxy);
}
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 @@
****************************************************************************/
#include <QtCore>
-#include <QDebug>
+#include "Logger.h"
#include "mspackutil.h"
#include "progressloggerinterface.h"
@@ -27,7 +27,7 @@ MsPackUtil::MsPackUtil(QObject* parent)
m_cabd = mspack_create_cab_decompressor(NULL);
m_cabinet = NULL;
if(!m_cabd)
- qDebug() << "[MsPackUtil] CAB decompressor creation failed!";
+ LOG_ERROR() << "CAB decompressor creation failed!";
}
MsPackUtil::~MsPackUtil()
@@ -43,7 +43,7 @@ bool MsPackUtil::open(QString& mspackfile)
if(m_cabd == NULL)
{
- qDebug() << "[MsPackUtil] No CAB decompressor available: cannot open file!";
+ LOG_ERROR() << "No CAB decompressor available: cannot open file!";
return false;
}
m_cabinet = m_cabd->search(m_cabd, QFile::encodeName(mspackfile).constData());
@@ -60,10 +60,10 @@ bool MsPackUtil::close(void)
bool MsPackUtil::extractArchive(const QString& dest, QString file)
{
- qDebug() << "[MsPackUtil] extractArchive" << dest << file;
+ LOG_INFO() << "extractArchive" << dest << file;
if(!m_cabinet)
{
- qDebug() << "[MsPackUtil] CAB file not open!";
+ LOG_ERROR() << "CAB file not open!";
return false;
}
@@ -78,7 +78,7 @@ bool MsPackUtil::extractArchive(const QString& dest, QString file)
struct mscabd_file *f = m_cabinet->files;
if(f == NULL)
{
- qDebug() << "[MsPackUtil] CAB doesn't contain file" << file;
+ LOG_WARNING() << "CAB doesn't contain file" << file;
return true;
}
bool found = false;
@@ -99,7 +99,7 @@ bool MsPackUtil::extractArchive(const QString& dest, QString file)
if(!QDir().mkpath(QFileInfo(path).absolutePath()))
{
emit logItem(tr("Creating output path failed"), LOGERROR);
- qDebug() << "[MsPackUtil] creating output path failed for:" << path;
+ LOG_ERROR() << "creating output path failed for:" << path;
emit logProgress(1, 1);
return false;
}
@@ -107,7 +107,8 @@ bool MsPackUtil::extractArchive(const QString& dest, QString file)
if(ret != MSPACK_ERR_OK)
{
emit logItem(tr("Error during CAB operation"), LOGERROR);
- qDebug() << "[MsPackUtil] mspack error: " << ret << "(" << errorStringMsPack(ret) << ")";
+ LOG_ERROR() << "mspack error: " << ret
+ << "(" << errorStringMsPack(ret) << ")";
emit logProgress(1, 1);
return false;
}
@@ -125,7 +126,7 @@ QStringList MsPackUtil::files(void)
QStringList list;
if(!m_cabinet)
{
- qDebug() << "[MsPackUtil] CAB file not open!";
+ LOG_WARNING() << "CAB file not open!";
return list;
}
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 @@
#include "rbsettings.h"
#include "systeminfo.h"
#include <QSettings>
+#include "Logger.h"
#if defined(Q_OS_LINUX)
#include <unistd.h>
@@ -96,13 +97,13 @@ void RbSettings::ensureRbSettingsExists()
{
userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath()
+ "/RockboxUtility.ini", QSettings::IniFormat, NULL);
- qDebug() << "[Settings] configuration: portable";
+ LOG_INFO() << "configuration: portable";
}
else
{
userSettings = new QSettings(QSettings::IniFormat,
QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL);
- qDebug() << "[Settings] configuration: system";
+ LOG_INFO() << "configuration: system";
}
}
}
@@ -158,7 +159,7 @@ QVariant RbSettings::subValue(QString sub, enum UserSettings setting)
i++;
QString s = constructSettingPath(UserSettingsList[i].name, sub);
- qDebug() << "[Settings] GET U:" << s << userSettings->value(s).toString();
+ LOG_INFO() << "GET U:" << s << userSettings->value(s).toString();
return userSettings->value(s, UserSettingsList[i].def);
}
@@ -179,7 +180,7 @@ void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant va
QString s = constructSettingPath(UserSettingsList[i].name, sub);
userSettings->setValue(s, value);
- qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString();
+ LOG_INFO() << "SET U:" << s << userSettings->value(s).toString();
}
QString 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 @@
#include <QtCore>
#include <QDebug>
+#include "Logger.h"
RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
{
- qDebug() << "[RockboxInfo] Getting version info from rockbox-info.txt";
+ LOG_INFO() << "Getting version info from rockbox-info.txt";
QFile file(mountpoint + "/" + fname);
m_success = false;
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 @@
#include "serverinfo.h"
#include "rbsettings.h"
#include "systeminfo.h"
+#include "Logger.h"
#if defined(Q_OS_LINUX)
#include <unistd.h>
@@ -181,7 +182,7 @@ QVariant ServerInfo::value(enum ServerInfos info)
QString s = ServerInfoList[i].name;
s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
- qDebug() << "[ServerInfo] GET:" << s << serverInfos.value(s, ServerInfoList[i].def).toString();
+ LOG_INFO() << "GET:" << s << serverInfos.value(s, ServerInfoList[i].def).toString();
return serverInfos.value(s, ServerInfoList[i].def);
}
@@ -201,7 +202,7 @@ void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVari
QString s = ServerInfoList[i].name;
s.replace(":platform:", platform);
serverInfos.insert(s, value);
- qDebug() << "[ServerInfo] SET:" << s << serverInfos.value(s).toString();
+ LOG_INFO() << "SET:" << s << serverInfos.value(s).toString();
}
QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
@@ -215,7 +216,7 @@ QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
s.replace(":platform:", platform);
QString d = ServerInfoList[i].def;
d.replace(":platform:", platform);
- qDebug() << "[ServerInfo] GET:" << s << serverInfos.value(s, d).toString();
+ LOG_INFO() << "GET:" << s << serverInfos.value(s, d).toString();
return serverInfos.value(s, d);
}
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 @@
#include "utils.h"
#include "rbsettings.h"
+#include "Logger.h"
/** @brief detect permission of user (only Windows at moment).
* @return enum userlevel.
@@ -242,17 +243,17 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
{
QMap<uint32_t, QString> usbids;
// usb pid detection
- qDebug() << "[System] Searching for USB devices";
+ LOG_INFO() << "Searching for USB devices";
#if defined(Q_OS_LINUX)
#if defined(LIBUSB1)
libusb_device **devs;
if(libusb_init(NULL) != 0) {
- qDebug() << "[System] Initializing libusb-1 failed.";
+ LOG_ERROR() << "Initializing libusb-1 failed.";
return usbids;
}
if(libusb_get_device_list(NULL, &devs) < 1) {
- qDebug() << "[System] Error getting device list.";
+ LOG_ERROR() << "Error getting device list.";
return usbids;
}
libusb_device *dev;
@@ -277,7 +278,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
name = tr("(no description available)");
if(id) {
usbids.insertMulti(id, name);
- qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data());
+ LOG_INFO("USB: 0x%08x, %s", id, name.toLocal8Bit().data());
}
}
}
@@ -323,7 +324,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
if(id) {
usbids.insertMulti(id, name);
- qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name;
+ LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16) << name;
}
u = u->next;
}
@@ -341,7 +342,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
result = IOServiceGetMatchingServices(kIOMasterPortDefault, usb_matching_dictionary,
&usb_iterator);
if(result) {
- qDebug() << "[System] USB: IOKit: Could not get matching services.";
+ LOG_ERROR() << "USB: IOKit: Could not get matching services.";
return usbids;
}
@@ -404,7 +405,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
if(id) {
usbids.insertMulti(id, name);
- qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name;
+ LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16) << name;
}
}
@@ -468,7 +469,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
uint32_t id;
id = vid << 16 | pid;
usbids.insert(id, description);
- qDebug("[System] USB VID: %04x, PID: %04x", vid, pid);
+ LOG_INFO("USB VID: %04x, PID: %04x", vid, pid);
}
if(buffer) free(buffer);
}
@@ -507,7 +508,7 @@ QUrl System::systemProxy(void)
RegCloseKey(hk);
- //qDebug() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable);
+ //LOG_INFO() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable);
if(enable != 0)
return QUrl("http://" + QString::fromWCharArray(proxyval));
else
@@ -537,7 +538,7 @@ QUrl System::systemProxy(void)
bufsize = CFStringGetLength(stringref) * 2 + 1;
buf = (char*)malloc(sizeof(char) * bufsize);
if(buf == NULL) {
- qDebug() << "[System] can't allocate memory for proxy string!";
+ LOG_ERROR() << "can't allocate memory for proxy string!";
CFRelease(dictref);
return QUrl("");
}
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 @@
*
****************************************************************************/
-#include "systeminfo.h"
+#include "systeminfo.h"
#include "rbsettings.h"
#include <QSettings>
+#include "Logger.h"
#if defined(Q_OS_LINUX)
#include <unistd.h>
@@ -89,7 +90,7 @@ QVariant SystemInfo::value(enum SystemInfos info)
s.replace(":platform:", platform);
QString d = SystemInfosList[i].def;
d.replace(":platform:", platform);
- qDebug() << "[SystemInfo] GET:" << s << systemInfos->value(s, d).toString();
+ LOG_INFO() << "GET:" << s << systemInfos->value(s, d).toString();
return systemInfos->value(s, d);
}
@@ -106,7 +107,7 @@ QVariant SystemInfo::platformValue(QString platform, enum SystemInfos info)
s.replace(":platform:", platform);
QString d = SystemInfosList[i].def;
d.replace(":platform:", platform);
- qDebug() << "[SystemInfo] GET P:" << s << systemInfos->value(s, d).toString();
+ LOG_INFO() << "GET P:" << s << systemInfos->value(s, d).toString();
return systemInfos->value(s, d);
}
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 @@
#include "talkfile.h"
#include "rbsettings.h"
+#include "Logger.h"
TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
{
@@ -109,7 +110,7 @@ void TalkFileCreator::doAbort()
//! \param startDir The directory from which to start scanning
bool TalkFileCreator::createTalkList(QDir startDir)
{
- qDebug() << "[TalkGenerator] generating list of files" << startDir;
+ LOG_INFO() << "generating list of files" << startDir;
m_talkList.clear();
// create Iterator
@@ -161,9 +162,9 @@ bool TalkFileCreator::createTalkList(QDir startDir)
entry.target = dir.path() + "/_dirname.talk";
entry.voiced = false;
entry.encoded = false;
- qDebug() << "[TalkFileCreator] toSpeak:" << entry.toSpeak
- << "target:" << entry.target
- << "intermediates:" << entry.wavfilename << entry.talkfilename;
+ LOG_INFO() << "toSpeak:" << entry.toSpeak
+ << "target:" << entry.target
+ << "intermediates:" << entry.wavfilename << entry.talkfilename;
m_talkList.append(entry);
}
}
@@ -205,16 +206,16 @@ bool TalkFileCreator::createTalkList(QDir startDir)
entry.target = fileInf.path() + "/" + fileInf.fileName() + ".talk";
entry.voiced = false;
entry.encoded = false;
- qDebug() << "[TalkFileCreator] toSpeak:" << entry.toSpeak
- << "target:" << entry.target
- << "intermediates:" <<
- entry.wavfilename << entry.talkfilename;
+ LOG_INFO() << "toSpeak:" << entry.toSpeak
+ << "target:" << entry.target
+ << "intermediates:"
+ << entry.wavfilename << entry.talkfilename;
m_talkList.append(entry);
}
}
QCoreApplication::processEvents();
}
- qDebug() << "[TalkFileCreator] list created, entries:" << m_talkList.size();
+ LOG_INFO() << "list created, entries:" << m_talkList.size();
return true;
}
@@ -251,8 +252,8 @@ bool TalkFileCreator::copyTalkFiles(QString* errString)
QFile::remove(m_talkList[i].target);
// copying
- qDebug() << "[TalkFileCreator] copying" << m_talkList[i].talkfilename
- << "to" << m_talkList[i].target;
+ LOG_INFO() << "copying" << m_talkList[i].talkfilename
+ << "to" << m_talkList[i].target;
if(!QFile::copy(m_talkList[i].talkfilename,m_talkList[i].target))
{
*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 @@
#include "rbsettings.h"
#include "systeminfo.h"
#include "wavtrim.h"
+#include "Logger.h"
TalkGenerator::TalkGenerator(QObject* parent): QObject(parent)
{
@@ -39,7 +40,7 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt
m_tts = TTSBase::getTTS(this, RbSettings::value(RbSettings::Tts).toString());
if(!m_tts)
{
- qDebug() << "[TalkGenerator] getting the TTS object failed!";
+ LOG_ERROR() << "getting the TTS object failed!";
emit logItem(tr("Init of TTS engine failed"), LOGERROR);
emit done(true);
return eERROR;
@@ -131,7 +132,7 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
duplicates.append(list->at(i).wavfilename);
else
{
- qDebug() << "[TalkGenerator] duplicate skipped";
+ LOG_INFO() << "duplicate skipped";
(*list)[i].voiced = true;
emit logProgress(++m_progress,progressMax);
continue;
@@ -152,7 +153,7 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
// voice entry
QString error;
- qDebug() << "[TalkGenerator] voicing: " << list->at(i).toSpeak
+ LOG_INFO() << "voicing: " << list->at(i).toSpeak
<< "to" << list->at(i).wavfilename;
TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error);
if(status == Warning)
@@ -177,8 +178,8 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
if(wavtrim(list->at(i).wavfilename.toLocal8Bit().data(),
wavtrimth, buffer, 255))
{
- qDebug() << "[TalkGenerator] wavtrim returned error on"
- << list->at(i).wavfilename;
+ LOG_ERROR() << "wavtrim returned error on"
+ << list->at(i).wavfilename;
return eERROR;
}
}
@@ -214,8 +215,8 @@ TalkGenerator::Status TalkGenerator::encodeList(QList<TalkEntry>* list)
//skip non-voiced entrys
if(list->at(i).voiced == false)
{
- qDebug() << "[TalkGenerator] non voiced entry detected:"
- << list->at(i).toSpeak;
+ LOG_WARNING() << "non voiced entry detected:"
+ << list->at(i).toSpeak;
emit logProgress(++m_progress,progressMax);
continue;
}
@@ -224,15 +225,15 @@ TalkGenerator::Status TalkGenerator::encodeList(QList<TalkEntry>* list)
duplicates.append(list->at(i).talkfilename);
else
{
- qDebug() << "[TalkGenerator] duplicate skipped";
+ LOG_INFO() << "duplicate skipped";
(*list)[i].encoded = true;
emit logProgress(++m_progress,progressMax);
continue;
}
//encode entry
- qDebug() << "[TalkGenerator] encoding " << list->at(i).wavfilename
- << "to" << list->at(i).talkfilename;
+ LOG_INFO() << "encoding " << list->at(i).wavfilename
+ << "to" << list->at(i).talkfilename;
if(!m_enc->encode(list->at(i).wavfilename,list->at(i).talkfilename))
{
emit logItem(tr("Encoding of %1 failed").arg(
@@ -268,7 +269,7 @@ QString TalkGenerator::correctString(QString s)
}
if(corrected != s)
- qDebug() << "[VoiceFileCreator] corrected string" << s << "to" << corrected;
+ LOG_INFO() << "corrected string" << s << "to" << corrected;
return corrected;
m_abort = true;
@@ -287,7 +288,7 @@ void TalkGenerator::setLang(QString name)
TTSBase* tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString());
if(!tts)
{
- qDebug() << "[TalkGenerator] getting the TTS object failed!";
+ LOG_ERROR() << "getting the TTS object failed!";
return;
}
QString vendor = tts->voiceVendor();
@@ -295,8 +296,8 @@ void TalkGenerator::setLang(QString name)
if(m_lang.isEmpty())
m_lang = "english";
- qDebug() << "[TalkGenerator] building string corrections list for"
- << m_lang << engine << vendor;
+ LOG_INFO() << "building string corrections list for"
+ << m_lang << engine << vendor;
QTextStream stream(&correctionsFile);
while(!stream.atEnd()) {
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 @@
#include <unistd.h>
#include <sys/stat.h>
#include <inttypes.h>
+#include "Logger.h"
TTSCarbon::TTSCarbon(QObject* parent) : TTSBase(parent)
{
@@ -74,7 +75,7 @@ bool TTSCarbon::start(QString *errStr)
if(voiceIndex == numVoices) {
// voice not found. Add user notification here and proceed with
// system default voice.
- qDebug() << "[TTSCarbon] Selected voice not found, using system default!";
+ LOG_WARNING() << "Selected voice not found, using system default!";
GetVoiceDescription(&vspec, &vdesc, sizeof(vdesc));
if(vdesc.script != -1)
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 @@
#include "ttsexes.h"
#include "utils.h"
#include "rbsettings.h"
+#include "Logger.h"
TTSExes::TTSExes(QObject* parent) : TTSBase(parent)
{
@@ -85,15 +86,15 @@ TTSStatus TTSExes::voice(QString text, QString wavfile, QString *errStr)
QString execstring;
if(wavfile.isEmpty() && m_capabilities & TTSBase::CanSpeak) {
if(m_TTSSpeakTemplate.isEmpty()) {
- qDebug() << "[TTSExes] internal error: TTS announces CanSpeak "
- "but template empty!";
+ LOG_ERROR() << "internal error: TTS announces CanSpeak "
+ "but template empty!";
return FatalError;
}
execstring = m_TTSSpeakTemplate;
}
else if(wavfile.isEmpty()) {
- qDebug() << "[TTSExes] no output file passed to voice() "
- "but TTS can't speak directly.";
+ LOG_ERROR() << "no output file passed to voice() "
+ "but TTS can't speak directly.";
return FatalError;
}
else {
@@ -108,7 +109,7 @@ TTSStatus TTSExes::voice(QString text, QString wavfile, QString *errStr)
QProcess::execute(execstring);
if(!wavfile.isEmpty() && !QFileInfo(wavfile).isFile()) {
- qDebug() << "[TTSExes] output file does not exist:" << wavfile;
+ LOG_ERROR() << "output file does not exist:" << wavfile;
return FatalError;
}
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 @@
#include "ttsfestival.h"
#include "utils.h"
#include "rbsettings.h"
+#include "Logger.h"
TTSFestival::~TTSFestival()
{
- qDebug() << "[Festival] Destroying instance";
+ LOG_INFO() << "Destroying instance";
stop();
}
@@ -87,7 +88,7 @@ void TTSFestival::updateVoiceDescription()
currentPath = getSetting(eSERVERPATH)->current().toString();
QString info = getVoiceInfo(getSetting(eVOICE)->current().toString());
currentPath = "";
-
+
getSetting(eVOICEDESC)->setCurrent(info);
}
@@ -101,7 +102,7 @@ void TTSFestival::updateVoiceList()
currentPath = getSetting(eSERVERPATH)->current().toString();
QStringList voiceList = getVoiceList();
currentPath = "";
-
+
getSetting(eVOICE)->setList(voiceList);
if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0));
else getSetting(eVOICE)->setCurrent("");
@@ -130,9 +131,10 @@ void TTSFestival::startServer()
QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
if(serverProcess.state() == QProcess::Running)
- qDebug() << "[Festival] Server is up and running";
+ LOG_INFO() << "Server is up and running";
else
- qDebug() << "[Festival] Server failed to start, state: " << serverProcess.state();
+ LOG_ERROR() << "Server failed to start, state:"
+ << serverProcess.state();
}
}
@@ -147,8 +149,9 @@ bool TTSFestival::ensureServerRunning()
bool TTSFestival::start(QString* errStr)
{
- qDebug() << "[Festival] Starting server with voice " << RbSettings::subValue("festival", RbSettings::TtsVoice).toString();
-
+ LOG_INFO() << "Starting server with voice"
+ << RbSettings::subValue("festival", RbSettings::TtsVoice).toString();
+
bool running = ensureServerRunning();
if (!RbSettings::subValue("festival",RbSettings::TtsVoice).toString().isEmpty())
{
@@ -156,17 +159,17 @@ bool TTSFestival::start(QString* errStr)
QString voiceSelect = QString("(voice.select '%1)\n")
.arg(RbSettings::subValue("festival", RbSettings::TtsVoice).toString());
queryServer(voiceSelect, 3000);
-
+
if(prologFile.open())
{
prologFile.write(voiceSelect.toLatin1());
prologFile.close();
prologPath = QFileInfo(prologFile).absoluteFilePath();
- qDebug() << "[Festival] Prolog created at " << prologPath;
+ LOG_INFO() << "Prolog created at" << prologPath;
}
-
+
}
-
+
if (!running)
(*errStr) = "Festival could not be started";
return running;
@@ -182,13 +185,13 @@ bool TTSFestival::stop()
TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
{
- qDebug() << "[Festival] Voicing " << text << "->" << wavfile;
+ LOG_INFO() << "Voicing" << text << "->" << wavfile;
QString path = RbSettings::subValue("festival-client",
RbSettings::TtsPath).toString();
QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp"
" --output \"%2\" --prolog \"%3\" - ").arg(path).arg(wavfile).arg(prologPath);
- qDebug() << "[Festival] Client cmd: " << cmd;
+ LOG_INFO() << "Client cmd:" << cmd;
QProcess clientProcess;
clientProcess.start(cmd);
@@ -200,7 +203,7 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
response = response.trimmed();
if(!response.contains("Utterance"))
{
- qDebug() << "[Festival] Could not voice string: " << response;
+ LOG_WARNING() << "Could not voice string: " << response;
*errStr = tr("engine could not voice string");
return Warning;
/* do not stop the voicing process because of a single string
@@ -231,10 +234,10 @@ bool TTSFestival::configOk()
ret = ret && (voices.indexOf(RbSettings::subValue("festival",
RbSettings::TtsVoice).toString()) != -1);
}
- else /* If we're currently configuring the server, we need to know that
+ else /* If we're currently configuring the server, we need to know that
the entered path is valid */
ret = QFileInfo(currentPath).isExecutable();
-
+
return ret;
}
@@ -245,7 +248,7 @@ QStringList TTSFestival::getVoiceList()
if(voices.size() > 0)
{
- qDebug() << "[Festival] Using voice cache";
+ LOG_INFO() << "Using voice cache";
return voices;
}
@@ -261,9 +264,9 @@ QStringList TTSFestival::getVoiceList()
if (voices.size() == 1 && voices[0].size() == 0)
voices.removeAt(0);
if (voices.size() > 0)
- qDebug() << "[Festival] Voices: " << voices;
+ LOG_INFO() << "Voices:" << voices;
else
- qDebug() << "[Festival] No voices. Response was: " << response;
+ LOG_WARNING() << "No voices. Response was:" << response;
return voices;
}
@@ -290,7 +293,7 @@ QString TTSFestival::getVoiceInfo(QString voice)
{
response = response.remove(QRegExp("(description \"*\")",
Qt::CaseInsensitive, QRegExp::Wildcard));
- qDebug() << "[Festival] voiceInfo w/o descr: " << response;
+ LOG_INFO() << "voiceInfo w/o descr:" << response;
response = response.remove(')');
QStringList responseLines = response.split('(', QString::SkipEmptyParts);
responseLines.removeAt(0); // the voice name itself
@@ -327,12 +330,12 @@ QString TTSFestival::queryServer(QString query, int timeout)
// this operation could take some time
emit busy();
-
- qDebug() << "[Festival] queryServer with " << query;
+
+ LOG_INFO() << "queryServer with" << query;
if (!ensureServerRunning())
{
- qDebug() << "[Festival] queryServer: ensureServerRunning failed";
+ LOG_ERROR() << "queryServer: ensureServerRunning failed";
emit busyEnd();
return "";
}
@@ -393,7 +396,7 @@ QString TTSFestival::queryServer(QString query, int timeout)
lines.removeLast(); /* should be ft_StUfF_keyOK */
}
else
- qDebug() << "[Festival] Response too short: " << response;
+ LOG_ERROR() << "Response too short:" << response;
emit busyEnd();
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 @@
#include "utils.h"
#include "rbsettings.h"
#include "systeminfo.h"
+#include "Logger.h"
TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
{
@@ -89,7 +90,7 @@ void TTSSapi::saveSettings()
void TTSSapi::updateVoiceList()
{
- qDebug() << "[TTSSapi] updating voicelist";
+ LOG_INFO() << "updating voicelist";
QStringList voiceList = getVoiceList(getSetting(eLANGUAGE)->current().toString());
getSetting(eVOICE)->setList(voiceList);
if(voiceList.size() > 0) getSetting(eVOICE)->setCurrent(voiceList.at(0));
@@ -122,15 +123,15 @@ bool TTSSapi::start(QString *errStr)
execstring.replace("%voice",m_TTSVoice);
execstring.replace("%speed",m_TTSSpeed);
- qDebug() << "[TTSSapi] Start:" << execstring;
+ LOG_INFO() << "Start:" << execstring;
voicescript = new QProcess(NULL);
//connect(voicescript,SIGNAL(readyReadStandardError()),this,SLOT(error()));
voicescript->start(execstring);
- qDebug() << "[TTSSapi] wait for process";
+ LOG_INFO() << "wait for process";
if(!voicescript->waitForStarted())
{
*errStr = tr("Could not start SAPI process");
- qDebug() << "[TTSSapi] starting process timed out!";
+ LOG_ERROR() << "starting process timed out!";
return false;
}
@@ -161,7 +162,7 @@ QString TTSSapi::voiceVendor(void)
while((vendor = voicestream->readLine()).isEmpty())
QCoreApplication::processEvents();
- qDebug() << "[TTSSAPI] TTS vendor:" << vendor;
+ LOG_INFO() << "TTS vendor:" << vendor;
if(!keeprunning) {
stop();
}
@@ -184,12 +185,12 @@ QStringList TTSSapi::getVoiceList(QString language)
execstring.replace("%exe",m_TTSexec);
execstring.replace("%lang",language);
- qDebug() << "[TTSSapi] Start:" << execstring;
+ LOG_INFO() << "Start:" << execstring;
voicescript = new QProcess(NULL);
voicescript->start(execstring);
- qDebug() << "[TTSSapi] wait for process";
+ LOG_INFO() << "wait for process";
if(!voicescript->waitForStarted()) {
- qDebug() << "[TTSSapi] process startup timed out!";
+ LOG_INFO() << "process startup timed out!";
return result;
}
voicescript->closeWriteChannel();
@@ -197,7 +198,7 @@ QStringList TTSSapi::getVoiceList(QString language)
QString dataRaw = voicescript->readAllStandardError().data();
if(dataRaw.startsWith("Error")) {
- qDebug() << "[TTSSapi] Error:" << dataRaw;
+ LOG_INFO() << "Error:" << dataRaw;
}
result = dataRaw.split(";",QString::SkipEmptyParts);
if(result.size() > 0)
@@ -226,7 +227,7 @@ TTSStatus TTSSapi::voice(QString text,QString wavfile, QString *errStr)
{
(void) errStr;
QString query = "SPEAK\t"+wavfile+"\t"+text;
- qDebug() << "[TTSSapi] voicing" << query;
+ LOG_INFO() << "voicing" << query;
// append newline to query. Done now to keep debug output more readable.
query.append("\r\n");
*voicestream << query;
@@ -236,7 +237,7 @@ TTSStatus TTSSapi::voice(QString text,QString wavfile, QString *errStr)
voicescript->waitForReadyRead();
if(!QFileInfo(wavfile).isFile()) {
- qDebug() << "[TTSSapi] output file does not exist:" << wavfile;
+ LOG_ERROR() << "output file does not exist:" << wavfile;
return FatalError;
}
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 @@
#include <QtCore>
#include "uninstall.h"
#include "utils.h"
+#include "Logger.h"
Uninstaller::Uninstaller(QObject* parent,QString mountpoint): QObject(parent)
{
@@ -66,7 +67,7 @@ void Uninstaller::uninstall(void)
if(installlog.contains(toDeleteList.at(j)))
{
deleteFile = false;
- qDebug() << "[Uninstaller] file still in use:" << toDeleteList.at(j);
+ LOG_INFO() << "file still in use:" << toDeleteList.at(j);
}
installlog.endGroup();
}
@@ -79,7 +80,7 @@ void Uninstaller::uninstall(void)
emit logItem(tr("Could not delete %1")
.arg(toDelete.filePath()), LOGWARNING);
installlog.remove(toDeleteList.at(j));
- qDebug() << "[Uninstaller] deleted:" << toDelete.filePath();
+ LOG_INFO() << "deleted:" << toDelete.filePath();
}
else // if it is a dir, remember it for later deletion
{
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 @@
#include "system.h"
#include "rbsettings.h"
#include "systeminfo.h"
+#include "Logger.h"
#ifdef UNICODE
#define _UNICODE
@@ -125,7 +126,7 @@ QString Utils::resolvePathCase(QString path)
else
return QString("");
}
- qDebug() << "[Utils] resolving path" << path << "->" << realpath;
+ LOG_INFO() << "resolving path" << path << "->" << realpath;
return realpath;
}
@@ -179,7 +180,7 @@ QString Utils::filesystemName(QString path)
} while(result == noErr);
#endif
- qDebug() << "[Utils] Volume name of" << path << "is" << name;
+ LOG_INFO() << "Volume name of" << path << "is" << name;
return name;
}
@@ -190,7 +191,7 @@ QString Utils::filesystemName(QString path)
qulonglong Utils::filesystemFree(QString path)
{
qulonglong size = filesystemSize(path, FilesystemFree);
- qDebug() << "[Utils] free disk space for" << path << size;
+ LOG_INFO() << "free disk space for" << path << size;
return size;
}
@@ -198,7 +199,7 @@ qulonglong Utils::filesystemFree(QString path)
qulonglong Utils::filesystemTotal(QString path)
{
qulonglong size = filesystemSize(path, FilesystemTotal);
- qDebug() << "[Utils] total disk space for" << path << size;
+ LOG_INFO() << "total disk space for" << path << size;
return size;
}
@@ -206,7 +207,7 @@ qulonglong Utils::filesystemTotal(QString path)
qulonglong Utils::filesystemClusterSize(QString path)
{
qulonglong size = filesystemSize(path, FilesystemClusterSize);
- qDebug() << "[Utils] cluster size for" << path << size;
+ LOG_INFO() << "cluster size for" << path << size;
return size;
}
@@ -273,7 +274,7 @@ QString Utils::findExecutable(QString name)
#elif defined(Q_OS_WIN)
QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
#endif
- qDebug() << "[Utils] system path:" << path;
+ LOG_INFO() << "system path:" << path;
for(int i = 0; i < path.size(); i++)
{
QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + name;
@@ -284,11 +285,11 @@ QString Utils::findExecutable(QString name)
#endif
if(QFileInfo(executable).isExecutable())
{
- qDebug() << "[Utils] findExecutable: found" << executable;
+ LOG_INFO() << "findExecutable: found" << executable;
return QDir::toNativeSeparators(executable);
}
}
- qDebug() << "[Utils] findExecutable: could not find" << name;
+ LOG_INFO() << "findExecutable: could not find" << name;
return "";
}
@@ -299,7 +300,7 @@ QString Utils::findExecutable(QString name)
*/
QString Utils::checkEnvironment(bool permission)
{
- qDebug() << "[Utils] checking environment";
+ LOG_INFO() << "checking environment";
QString text = "";
// check permission
@@ -338,7 +339,7 @@ QString Utils::checkEnvironment(bool permission)
*/
int Utils::compareVersionStrings(QString s1, QString s2)
{
- qDebug() << "[Utils] comparing version strings" << s1 << "and" << s2;
+ LOG_INFO() << "comparing version strings" << s1 << "and" << s2;
QString a = s1.trimmed();
QString b = s2.trimmed();
// if strings are identical return 0.
@@ -418,7 +419,7 @@ int Utils::compareVersionStrings(QString s1, QString s2)
*/
QString Utils::resolveDevicename(QString path)
{
- qDebug() << "[Utils] resolving device name" << path;
+ LOG_INFO() << "resolving device name" << path;
#if defined(Q_OS_LINUX)
FILE *mn = setmntent("/etc/mtab", "r");
if(!mn)
@@ -434,7 +435,7 @@ QString Utils::resolveDevicename(QString path)
&& (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)
|| QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) {
endmntent(mn);
- qDebug() << "[Utils] device name is" << ent->mnt_fsname;
+ LOG_INFO() << "device name is" << ent->mnt_fsname;
return QString(ent->mnt_fsname);
}
}
@@ -453,7 +454,7 @@ QString Utils::resolveDevicename(QString path)
if(QString(mntinf->f_mntonname) == path
&& (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)
|| QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) {
- qDebug() << "[Utils] device name is" << mntinf->f_mntfromname;
+ LOG_INFO() << "device name is" << mntinf->f_mntfromname;
return QString(mntinf->f_mntfromname);
}
mntinf++;
@@ -471,17 +472,17 @@ QString Utils::resolveDevicename(QString path)
h = CreateFile(uncpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if(h == INVALID_HANDLE_VALUE) {
- //qDebug() << "error getting extents for" << uncpath;
+ //LOG_INFO() << "error getting extents for" << uncpath;
return "";
}
// get the extents
if(DeviceIoControl(h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
NULL, 0, extents, sizeof(buffer), &written, NULL)) {
if(extents->NumberOfDiskExtents > 1) {
- qDebug() << "[Utils] resolving device name: volume spans multiple disks!";
+ LOG_INFO() << "resolving device name: volume spans multiple disks!";
return "";
}
- qDebug() << "[Utils] device name is" << extents->Extents[0].DiskNumber;
+ LOG_INFO() << "device name is" << extents->Extents[0].DiskNumber;
return QString("%1").arg(extents->Extents[0].DiskNumber);
}
#endif
@@ -496,7 +497,7 @@ QString Utils::resolveDevicename(QString path)
*/
QString Utils::resolveMountPoint(QString device)
{
- qDebug() << "[Utils] resolving mountpoint:" << device;
+ LOG_INFO() << "resolving mountpoint:" << device;
#if defined(Q_OS_LINUX)
FILE *mn = setmntent("/etc/mtab", "r");
@@ -511,11 +512,11 @@ QString Utils::resolveMountPoint(QString device)
QString result;
if(QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive)
|| QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive)) {
- qDebug() << "[Utils] resolved mountpoint is:" << ent->mnt_dir;
+ LOG_INFO() << "resolved mountpoint is:" << ent->mnt_dir;
result = QString(ent->mnt_dir);
}
else {
- qDebug() << "[Utils] mountpoint is wrong filesystem!";
+ LOG_INFO() << "mountpoint is wrong filesystem!";
}
endmntent(mn);
return result;
@@ -536,11 +537,11 @@ QString Utils::resolveMountPoint(QString device)
if(QString(mntinf->f_mntfromname) == device) {
if(QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)
|| QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive)) {
- qDebug() << "[Utils] resolved mountpoint is:" << mntinf->f_mntonname;
+ LOG_INFO() << "resolved mountpoint is:" << mntinf->f_mntonname;
return QString(mntinf->f_mntonname);
}
else {
- qDebug() << "[Utils] mountpoint is wrong filesystem!";
+ LOG_INFO() << "mountpoint is wrong filesystem!";
return QString();
}
}
@@ -556,14 +557,14 @@ QString Utils::resolveMountPoint(QString device)
for(letter = 'A'; letter <= 'Z'; letter++) {
if(resolveDevicename(QString(letter)).toUInt() == driveno) {
result = letter;
- qDebug() << "[Utils] resolved mountpoint is:" << result;
+ LOG_INFO() << "resolved mountpoint is:" << result;
break;
}
}
if(!result.isEmpty())
return result + ":/";
#endif
- qDebug() << "[Utils] resolving mountpoint failed!";
+ LOG_INFO() << "resolving mountpoint failed!";
return QString("");
}
@@ -589,11 +590,11 @@ QStringList Utils::mountpoints(enum MountpointsFilter type)
QString fstype = QString::fromWCharArray(t);
if(type == MountpointsAll || supported.contains(fstype)) {
tempList << list.at(i).absolutePath();
- qDebug() << "[Utils] Added:" << list.at(i).absolutePath()
+ LOG_INFO() << "Added:" << list.at(i).absolutePath()
<< "type" << fstype;
}
else {
- qDebug() << "[Utils] Ignored:" << list.at(i).absolutePath()
+ LOG_INFO() << "Ignored:" << list.at(i).absolutePath()
<< "type" << fstype;
}
}
@@ -607,11 +608,11 @@ QStringList Utils::mountpoints(enum MountpointsFilter type)
while(num--) {
if(type == MountpointsAll || supported.contains(mntinf->f_fstypename)) {
tempList << QString(mntinf->f_mntonname);
- qDebug() << "[Utils] Added:" << mntinf->f_mntonname
+ LOG_INFO() << "Added:" << mntinf->f_mntonname
<< "is" << mntinf->f_mntfromname << "type" << mntinf->f_fstypename;
}
else {
- qDebug() << "[Utils] Ignored:" << mntinf->f_mntonname
+ LOG_INFO() << "Ignored:" << mntinf->f_mntonname
<< "is" << mntinf->f_mntfromname << "type" << mntinf->f_fstypename;
}
mntinf++;
@@ -626,11 +627,11 @@ QStringList Utils::mountpoints(enum MountpointsFilter type)
while((ent = getmntent(mn))) {
if(type == MountpointsAll || supported.contains(ent->mnt_type)) {
tempList << QString(ent->mnt_dir);
- qDebug() << "[Utils] Added:" << ent->mnt_dir
+ LOG_INFO() << "Added:" << ent->mnt_dir
<< "is" << ent->mnt_fsname << "type" << ent->mnt_type;
}
else {
- qDebug() << "[Utils] Ignored:" << ent->mnt_dir
+ LOG_INFO() << "Ignored:" << ent->mnt_dir
<< "is" << ent->mnt_fsname << "type" << ent->mnt_type;
}
}
@@ -658,13 +659,13 @@ QStringList Utils::findRunningProcess(QStringList names)
hdl = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hdl == INVALID_HANDLE_VALUE) {
- qDebug() << "[Utils] CreateToolhelp32Snapshot failed.";
+ LOG_ERROR() << "CreateToolhelp32Snapshot failed.";
return found;
}
entry.dwSize = sizeof(PROCESSENTRY32);
entry.szExeFile[0] = '\0';
if(!Process32First(hdl, &entry)) {
- qDebug() << "[Utils] Process32First failed.";
+ LOG_ERROR() << "Process32First failed.";
return found;
}
@@ -721,7 +722,7 @@ QStringList Utils::findRunningProcess(QStringList names)
found.append(processlist.at(index));
}
}
- qDebug() << "[Utils] Found listed processes running:" << found;
+ LOG_INFO() << "Found listed processes running:" << found;
return found;
}
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 @@
#include "rbsettings.h"
#include "systeminfo.h"
#include "ziputil.h"
+#include "Logger.h"
VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent)
{
@@ -65,7 +66,7 @@ bool VoiceFileCreator::createVoiceFile()
// check if voicefile is present on target
QString fn = m_mountpoint + "/.rockbox/langs/voicestrings.zip";
- qDebug() << "[VoiceFile] searching for zipped voicestrings at" << fn;
+ LOG_INFO() << "searching for zipped voicestrings at" << fn;
if(QFileInfo(fn).isFile()) {
// search for binary voice strings file in archive
ZipUtil z(this);
@@ -79,7 +80,7 @@ bool VoiceFileCreator::createVoiceFile()
}
}
if(index < contents.size()) {
- qDebug() << "[VoiceFile] extracting strings file from zip";
+ LOG_INFO() << "extracting strings file from zip";
// extract strings
QTemporaryFile stringsfile;
stringsfile.open();
@@ -153,7 +154,7 @@ bool VoiceFileCreator::createVoiceFile()
genlang.replace("%REVISION%", version);
genlang.replace("%FEATURES%", features);
QUrl genlangUrl(genlang);
- qDebug() << "[VoiceFileCreator] downloading" << genlangUrl;
+ LOG_INFO() << "downloading" << genlangUrl;
//download the correct genlang output
QTemporaryFile *downloadFile = new QTemporaryFile(this);
@@ -175,7 +176,7 @@ bool VoiceFileCreator::createVoiceFile()
void VoiceFileCreator::downloadDone(bool error)
{
- qDebug() << "[VoiceFileCreator] download done, error:" << error;
+ LOG_INFO() << "download done, error:" << error;
// update progress bar
emit logProgress(1,1);
@@ -253,7 +254,7 @@ void VoiceFileCreator::create(void)
m_talkList.append(entry);
}
else if(entry.toSpeak.isEmpty()) {
- qDebug() << "[Voicefile] Empty voice string for ID" << id;
+ LOG_WARNING() << "Empty voice string for ID" << id;
}
else {
m_talkList.append(entry);
@@ -314,7 +315,7 @@ void VoiceFileCreator::create(void)
return;
}
- qDebug() << "[VoiceFile] Running voicefont, format" << m_voiceformat;
+ LOG_INFO() << "Running voicefont, format" << m_voiceformat;
voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output, m_voiceformat);
// ids2 and output are closed by voicefont().
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 @@
#include "zipinstaller.h"
#include "utils.h"
#include "ziputil.h"
+#include "Logger.h"
ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
{
@@ -31,7 +32,7 @@ ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
void ZipInstaller::install()
{
- qDebug() << "[ZipInstall] initializing installation";
+ LOG_INFO() << "initializing installation";
runner = 0;
connect(this, SIGNAL(cont()), this, SLOT(installContinue()));
@@ -44,17 +45,17 @@ void ZipInstaller::install()
void ZipInstaller::abort()
{
- qDebug() << "[ZipInstall] Aborted";
+ LOG_INFO() << "Aborted";
emit internalAborted();
}
void ZipInstaller::installContinue()
{
- qDebug() << "[ZipInstall] continuing installation";
+ LOG_INFO() << "continuing installation";
runner++; // this gets called when a install finished, so increase first.
- qDebug() << "[ZipInstall] runner done:" << runner << "/" << m_urllist.size();
+ LOG_INFO() << "runner done:" << runner << "/" << m_urllist.size();
if(runner < m_urllist.size()) {
emit logItem(tr("done."), LOGOK);
m_url = m_urllist.at(runner);
@@ -74,7 +75,7 @@ void ZipInstaller::installContinue()
void ZipInstaller::installStart()
{
- qDebug() << "[ZipInstall] starting installation";
+ LOG_INFO() << "starting installation";
emit logItem(tr("Downloading file %1.%2").arg(QFileInfo(m_url).baseName(),
QFileInfo(m_url).completeSuffix()),LOGINFO);
@@ -105,7 +106,7 @@ void ZipInstaller::installStart()
void ZipInstaller::downloadDone(bool error)
{
- qDebug() << "[ZipInstall] download done, error:" << error;
+ LOG_INFO() << "download done, error:" << error;
QStringList zipContents; // needed later
// update progress bar
@@ -127,7 +128,7 @@ void ZipInstaller::downloadDone(bool error)
QCoreApplication::processEvents();
if(m_unzip) {
// unzip downloaded file
- qDebug() << "[ZipInstall] about to unzip " << m_file << "to" << m_mountpoint;
+ LOG_INFO() << "about to unzip" << m_file << "to" << m_mountpoint;
emit logItem(tr("Extracting file."), LOGINFO);
QCoreApplication::processEvents();
@@ -159,7 +160,7 @@ void ZipInstaller::downloadDone(bool error)
else {
// only copy the downloaded file to the output location / name
emit logItem(tr("Installing file."), LOGINFO);
- qDebug() << "[ZipInstall] saving downloaded file (no extraction)";
+ LOG_INFO() << "saving downloaded file (no extraction)";
m_downloadFile->open(); // copy fails if file is not opened (filename issue?)
// 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 @@
#include "progressloggerinterface.h"
#include "httpget.h"
+#include "Logger.h"
class ZipInstaller : public QObject
{
@@ -40,9 +41,9 @@ public:
void setLogSection(QString name) {m_loglist = QStringList(name);}
void setLogSection(QStringList name) { m_loglist = name; }
void setLogVersion(QString v = "")
- { m_verlist = QStringList(v); qDebug() << m_verlist;}
+ { m_verlist = QStringList(v); LOG_INFO() << m_verlist;}
void setLogVersion(QStringList v)
- { m_verlist = v; qDebug() << m_verlist;}
+ { m_verlist = v; LOG_INFO() << m_verlist;}
void setUnzip(bool i) { m_unzip = i; }
void setTarget(QString t) { m_target = t; }
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 @@
#include <QDebug>
#include "ziputil.h"
#include "progressloggerinterface.h"
+#include "Logger.h"
#include "quazip/quazip.h"
#include "quazip/quazipfile.h"
@@ -76,7 +77,7 @@ bool ZipUtil::close(void)
//! @return true on success, false otherwise
bool ZipUtil::extractArchive(const QString& dest, QString file)
{
- qDebug() << "[ZipUtil] extractArchive" << dest << file;
+ LOG_INFO() << "extractArchive" << dest << file;
bool result = true;
if(!m_zip) {
return false;
@@ -122,15 +123,15 @@ bool ZipUtil::extractArchive(const QString& dest, QString file)
if(!QDir().mkpath(QFileInfo(outfilename).absolutePath())) {
result = false;
emit logItem(tr("Creating output path failed"), LOGERROR);
- qDebug() << "[ZipUtil] creating output path failed for:"
- << outfilename;
+ LOG_INFO() << "creating output path failed for:"
+ << outfilename;
break;
}
if(!outputFile.open(QFile::WriteOnly)) {
result = false;
emit logItem(tr("Creating output file failed"), LOGERROR);
- qDebug() << "[ZipUtil] creating output file failed:"
- << outfilename;
+ LOG_INFO() << "creating output file failed:"
+ << outfilename;
break;
}
currentFile->open(QIODevice::ReadOnly);
@@ -138,8 +139,8 @@ bool ZipUtil::extractArchive(const QString& dest, QString file)
if(currentFile->getZipError() != UNZ_OK) {
result = false;
emit logItem(tr("Error during Zip operation"), LOGERROR);
- qDebug() << "[ZipUtil] QuaZip error:" << currentFile->getZipError()
- << "on file" << currentFile->getFileName();
+ LOG_INFO() << "QuaZip error:" << currentFile->getZipError()
+ << "on file" << currentFile->getFileName();
break;
}
currentFile->close();
@@ -162,7 +163,7 @@ bool ZipUtil::appendDirToArchive(QString& source, QString& basedir)
{
bool result = true;
if(!m_zip || !m_zip->isOpen()) {
- qDebug() << "[ZipUtil] Zip file not open!";
+ LOG_INFO() << "Zip file not open!";
return false;
}
// 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)
fileList.append(iterator.filePath());
}
}
- qDebug() << "[ZipUtil] Adding" << fileList.size() << "files to archive";
+ LOG_INFO() << "Adding" << fileList.size() << "files to archive";
int max = fileList.size();
for(int i = 0; i < max; i++) {
QString current = fileList.at(i);
if(!appendFileToArchive(current, basedir)) {
- qDebug() << "[ZipUtil] Error appending file" << current
- << "to archive" << m_zip->getZipName();
+ LOG_ERROR() << "Error appending file" << current
+ << "to archive" << m_zip->getZipName();
result = false;
break;
}
@@ -199,7 +200,7 @@ bool ZipUtil::appendFileToArchive(QString& file, QString& basedir)
{
bool result = true;
if(!m_zip || !m_zip->isOpen()) {
- qDebug() << "[ZipUtil] Zip file not open!";
+ LOG_ERROR() << "Zip file not open!";
return false;
}
// skip folders, we can't add them.
@@ -215,12 +216,12 @@ bool ZipUtil::appendFileToArchive(QString& file, QString& basedir)
QFile fin(file);
if(!fin.open(QFile::ReadOnly)) {
- qDebug() << "[ZipUtil] Could not open file for reading:" << file;
+ LOG_ERROR() << "Could not open file for reading:" << file;
return false;
}
if(!fout.open(QIODevice::WriteOnly, QuaZipNewInfo(newfile, infile))) {
fin.close();
- qDebug() << "[ZipUtil] Could not open file for writing:" << newfile;
+ LOG_ERROR() << "Could not open file for writing:" << newfile;
return false;
}
@@ -253,11 +254,11 @@ qint64 ZipUtil::totalUncompressedSize(unsigned int clustersize)
}
}
if(clustersize > 0) {
- qDebug() << "[ZipUtil] calculation rounded to cluster size for each file:"
- << clustersize;
+ LOG_INFO() << "calculation rounded to cluster size for each file:"
+ << clustersize;
}
- qDebug() << "[ZipUtil] size of archive files uncompressed:"
- << uncompressed;
+ LOG_INFO() << "size of archive files uncompressed:"
+ << uncompressed;
return uncompressed;
}
@@ -281,7 +282,7 @@ QList<QuaZipFileInfo> ZipUtil::contentProperties()
{
QList<QuaZipFileInfo> items;
if(!m_zip || !m_zip->isOpen()) {
- qDebug() << "[ZipUtil] Zip file not open!";
+ LOG_ERROR() << "Zip file not open!";
return items;
}
QuaZipFileInfo info;
@@ -290,8 +291,8 @@ QList<QuaZipFileInfo> ZipUtil::contentProperties()
{
currentFile.getFileInfo(&info);
if(currentFile.getZipError() != UNZ_OK) {
- qDebug() << "[ZipUtil] QuaZip error:" << currentFile.getZipError()
- << "on file" << currentFile.getFileName();
+ LOG_ERROR() << "QuaZip error:" << currentFile.getZipError()
+ << "on file" << currentFile.getFileName();
return QList<QuaZipFileInfo>();
}
items.append(info);