summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2015-03-20 07:48:17 (GMT)
committerMontel Laurent <montel@kde.org>2015-03-20 07:48:17 (GMT)
commit25684630616bd3d9dc2fac70ad7cf3c59876651a (patch)
tree3f88e72cd3c0b2f895afafd84fc7b7c899b6d2bd
parentfca577bd6f7de424f4f78aec14f34dfa71309976 (diff)
Port to QCDebug
-rw-r--r--generators/fax/CMakeLists.txt2
-rw-r--r--generators/fax/fax_debug.cpp23
-rw-r--r--generators/fax/fax_debug.h27
-rw-r--r--generators/fax/faxexpand.cpp24
4 files changed, 63 insertions, 13 deletions
diff --git a/generators/fax/CMakeLists.txt b/generators/fax/CMakeLists.txt
index 1799df8..6fc7c31 100644
--- a/generators/fax/CMakeLists.txt
+++ b/generators/fax/CMakeLists.txt
@@ -5,7 +5,7 @@ include_directories(
########### next target ###############
-set(okularGenerator_fax_PART_SRCS generator_fax.cpp faxdocument.cpp faxexpand.cpp faxinit.cpp )
+set(okularGenerator_fax_PART_SRCS generator_fax.cpp faxdocument.cpp faxexpand.cpp faxinit.cpp fax_debug.cpp)
add_library(okularGenerator_fax MODULE ${okularGenerator_fax_PART_SRCS})
diff --git a/generators/fax/fax_debug.cpp b/generators/fax/fax_debug.cpp
new file mode 100644
index 0000000..9913ce6
--- /dev/null
+++ b/generators/fax/fax_debug.cpp
@@ -0,0 +1,23 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "fax_debug.h"
+Q_LOGGING_CATEGORY(FAX_LOG, "log_fax")
+
+
diff --git a/generators/fax/fax_debug.h b/generators/fax/fax_debug.h
new file mode 100644
index 0000000..b82ca0a
--- /dev/null
+++ b/generators/fax/fax_debug.h
@@ -0,0 +1,27 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef FAX_DEBUG_H
+#define FAX_DEBUG_H
+
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(FAX_LOG)
+
+#endif
+
diff --git a/generators/fax/faxexpand.cpp b/generators/fax/faxexpand.cpp
index 4e8a47d..101bbc0 100644
--- a/generators/fax/faxexpand.cpp
+++ b/generators/fax/faxexpand.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
#include <QtCore/QDebug>
#include "faxexpand.h"
-#include <KDebug>
+#include "fax_debug.h"
//Uncomment this for verbose debug output
//#define DEBUG_FAX
#define verbose false
@@ -300,14 +300,14 @@ const char *StateNames[] = {
case S_Ext: \
*pa++ = lastx - a0; \
if (verbose) \
- kDebug() << "Line " << LineNum << ": extension code\n";\
+ qCDebug(FAX_LOG) << "Line " << LineNum << ": extension code\n";\
SKIP_EOL; \
break; \
case S_EOL: \
*pa++ = lastx - a0; \
NeedBits(4); \
if (GetBits(4) && verbose) /* already seen 7 zeros */ \
- kDebug() << "Line " << LineNum << ": Bad EOL\n"; \
+ qCDebug(FAX_LOG) << "Line " << LineNum << ": Bad EOL\n"; \
ClrBits(4); \
EOLcnt = 1; \
goto eolab; \
@@ -337,7 +337,7 @@ static void
unexpected(const char *what, int LineNum)
{
if (verbose)
- kError() << "Line " << LineNum << ": Unexpected state in "
+ qCCritical(FAX_LOG) << "Line " << LineNum << ": Unexpected state in "
<< what << endl;
}
@@ -379,7 +379,7 @@ MHexpand(struct pagenode *pn, drawfunc df)
SETVAL(0);
if (a0 != lastx) {
if (verbose)
- kWarning() << "Line " << LineNum << ": length is "
+ qCWarning(FAX_LOG) << "Line " << LineNum << ": length is "
<< a0 << " (expected "<< lastx << ")\n";
while (a0 > lastx)
a0 -= *--pa;
@@ -448,7 +448,7 @@ g31expand(struct pagenode *pn, drawfunc df)
ClrBits(11);
}
if (EOLcnt > 1 && EOLcnt != 6 && verbose) {
- kError() << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
+ qCCritical(FAX_LOG) << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
}
if (EOLcnt >= 6 || EndOfData(pn)) {
free(runs);
@@ -463,7 +463,7 @@ g31expand(struct pagenode *pn, drawfunc df)
SETVAL(0);
if (a0 != lastx) {
if (verbose)
- kWarning() << "Line " << LineNum << ": length is "
+ qCWarning(FAX_LOG) << "Line " << LineNum << ": length is "
<< a0 << " (expected "<< lastx << ")\n";
while (a0 > lastx)
a0 -= *--pa;
@@ -539,13 +539,13 @@ g32expand(struct pagenode *pn, drawfunc df)
ClrBits(11);
}
if (EOLcnt > 1 && EOLcnt != 6 && verbose)
- kError() << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
+ qCCritical(FAX_LOG) << "Line " << LineNum << ": bad RTC (" << EOLcnt << " EOLs)\n";
if (EOLcnt >= 6 || EndOfData(pn)) {
free(run0);
return;
}
if (LineNum == 0 && refline == 0 && verbose)
- kDebug() << "First line is 2-D encoded\n";
+ qCDebug(FAX_LOG) << "First line is 2-D encoded\n";
RunLength = 0;
if (LineNum & 1) {
pa = run1;
@@ -570,7 +570,7 @@ g32expand(struct pagenode *pn, drawfunc df)
SETVAL(0);
if (a0 != lastx) {
if (verbose)
- kWarning() << "Line " << LineNum << ": length is "
+ qCWarning(FAX_LOG) << "Line " << LineNum << ": length is "
<< a0 << " (expected "<< lastx << ")\n";
while (a0 > lastx)
a0 -= *--pa;
@@ -592,7 +592,7 @@ g32expand(struct pagenode *pn, drawfunc df)
#undef eol2lab
#define SKIP_EOL do { \
if (verbose) \
- kError() << "Line " << LineNum << ": G4 coding error\n"; \
+ qCCritical(FAX_LOG) << "Line " << LineNum << ": G4 coding error\n"; \
free(run0); \
return; \
} while (0)
@@ -654,7 +654,7 @@ g4expand(struct pagenode *pn, drawfunc df)
EOFB:
NeedBits(13);
if (GetBits(13) != 0x1001 && verbose)
- kError() << "Bad RTC\n";
+ qCCritical(FAX_LOG) << "Bad RTC\n";
break;
}
free(run0);