Commit aa9d22e1 authored by Pino Toscano's avatar Pino Toscano
Browse files

Use categorized logging

Log all the debug messages with a org.kde.ksane category.
parent 5052e588
......@@ -26,6 +26,7 @@ include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(GenerateExportHeader)
include(ECMQtDeclareLoggingCategory)
ecm_setup_version(
${KF5_VERSION}
......
......@@ -42,6 +42,12 @@ set(ksane_SRCS
options/ksaneoptcombo.cpp
)
ecm_qt_declare_logging_category(ksane_SRCS
HEADER ksane_debug.h
IDENTIFIER KSANE_LOG
CATEGORY_NAME org.kde.ksane
)
add_library(KF5Sane ${ksane_SRCS})
generate_export_header(KF5Sane BASE_NAME KSane)
add_library(KF5::Sane ALIAS KF5Sane)
......
......@@ -32,7 +32,8 @@
#include <QMutex>
#include <QMutexLocker>
#include <QList>
#include <QDebug>
#include <ksane_debug.h>
namespace KSaneIface
{
......@@ -105,7 +106,7 @@ void KSaneAuth::clearDeviceAuth(const QString &resource)
/** static function called by sane_open to get authorization from user */
void KSaneAuth::authorization(SANE_String_Const resource, SANE_Char *username, SANE_Char *password)
{
qDebug() << resource;
qCDebug(KSANE_LOG) << resource;
// This is vague in the standard... what can I find in the resource string?
// I have found that "resource contains the backend name + "$MD5$....."
// it does not contain unique identifiers like ":libusb:001:004"
......@@ -113,11 +114,11 @@ void KSaneAuth::authorization(SANE_String_Const resource, SANE_Char *username, S
QString res = QString::fromUtf8(resource);
int end = res.indexOf(QStringLiteral("$MD5$"));
res = res.left(end);
qDebug() << res;
qCDebug(KSANE_LOG) << res;
QList<Private::AuthStruct> list = getInstance()->d->authList;
for (int i = 0; i < list.size(); i++) {
qDebug() << res << list.at(i).resource;
qCDebug(KSANE_LOG) << res << list.at(i).resource;
if (list.at(i).resource.contains(res)) {
qstrncpy(username, list.at(i).username.toLocal8Bit().constData(), SANE_MAX_USERNAME_LEN);
qstrncpy(password, list.at(i).password.toLocal8Bit().constData(), SANE_MAX_PASSWORD_LEN);
......
......@@ -27,9 +27,10 @@
#include "ksanepreviewimagebuilder.h"
#include <QDebug>
#include <QImage>
#include <ksane_debug.h>
namespace KSaneIface
{
KSanePreviewImageBuilder::KSanePreviewImageBuilder(QImage *img)
......@@ -272,7 +273,7 @@ bool KSanePreviewImageBuilder::copyToImage(const SANE_Byte readData[], int read_
break;
}
qWarning() << "Format" << m_params.format
qCWarning(KSANE_LOG) << "Format" << m_params.format
<< "and depth" << m_params.depth
<< "is not yet supported by libksane!";
return false;
......
......@@ -29,9 +29,10 @@
#include "ksanepreviewthread.h"
#include <QMutexLocker>
#include <QDebug>
#include <QImage>
#include <ksane_debug.h>
namespace KSaneIface
{
KSanePreviewThread::KSanePreviewThread(SANE_Handle handle, QImage *img):
......@@ -75,7 +76,7 @@ void KSanePreviewThread::run()
m_saneStatus = sane_start(m_saneHandle);
if (m_saneStatus != SANE_STATUS_GOOD) {
qDebug() << "sane_start=" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_start=" << sane_strstatus(m_saneStatus);
sane_cancel(m_saneHandle);
m_readStatus = READ_ERROR;
return;
......@@ -84,7 +85,7 @@ void KSanePreviewThread::run()
// Read image parameters
m_saneStatus = sane_get_parameters(m_saneHandle, &m_params);
if (m_saneStatus != SANE_STATUS_GOOD) {
qDebug() << "sane_get_parameters=" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_get_parameters=" << sane_strstatus(m_saneStatus);
sane_cancel(m_saneHandle);
m_readStatus = READ_ERROR;
return;
......@@ -144,7 +145,7 @@ void KSanePreviewThread::readData()
case SANE_STATUS_EOF:
// (handscanners have negative frame size)
if (m_frameRead < m_frameSize) {
qDebug() << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize;
qCDebug(KSANE_LOG) << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize;
m_readStatus = READ_ERROR;
return;
}
......@@ -156,25 +157,25 @@ void KSanePreviewThread::readData()
// start reading next frame
SANE_Status status = sane_start(m_saneHandle);
if (status != SANE_STATUS_GOOD) {
qDebug() << "sane_start =" << sane_strstatus(status);
qCDebug(KSANE_LOG) << "sane_start =" << sane_strstatus(status);
m_readStatus = READ_ERROR;
return;
}
status = sane_get_parameters(m_saneHandle, &m_params);
if (status != SANE_STATUS_GOOD) {
qDebug() << "sane_get_parameters =" << sane_strstatus(status);
qCDebug(KSANE_LOG) << "sane_get_parameters =" << sane_strstatus(status);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
}
//qDebug() << "New Frame";
//qCDebug(KSANE_LOG) << "New Frame";
m_imageBuilder.beginFrame(m_params);
m_frameRead = 0;
m_frame_t_count++;
break;
}
default:
qDebug() << "sane_read=" << m_saneStatus << "=" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_read=" << m_saneStatus << "=" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
......@@ -188,7 +189,7 @@ void KSanePreviewThread::copyToPreviewImg(int readBytes)
QMutexLocker locker(&imgMutex);
if (m_invertColors) {
if (m_params.depth == 16) {
//if (readBytes%2) qDebug() << "readBytes=" << readBytes;
//if (readBytes%2) qCDebug(KSANE_LOG) << "readBytes=" << readBytes;
quint16 *u16ptr = reinterpret_cast<quint16 *>(m_readData);
for (int i = 0; i < readBytes / 2; i++) {
u16ptr[i] = 0xFFFF - u16ptr[i];
......
......@@ -28,7 +28,7 @@
#include "ksanescanthread.h"
#include <QDebug>
#include <ksane_debug.h>
namespace KSaneIface
{
......@@ -88,7 +88,7 @@ void KSaneScanThread::run()
}
if (m_saneStatus != SANE_STATUS_GOOD) {
qDebug() << "sane_start=" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_start=" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
// oneFinalScanDone() does the sane_cancel()
return;
......@@ -97,7 +97,7 @@ void KSaneScanThread::run()
// Read image parameters
m_saneStatus = sane_get_parameters(m_saneHandle, &m_params);
if (m_saneStatus != SANE_STATUS_GOOD) {
qDebug() << "sane_get_parameters=" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_get_parameters=" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
// oneFinalScanDone() does the sane_cancel()
return;
......@@ -154,15 +154,15 @@ void KSaneScanThread::readData()
case SANE_STATUS_EOF:
if (m_frameRead < m_frameSize) {
qDebug() << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize << "readBytes =" << readBytes;
qCDebug(KSANE_LOG) << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize << "readBytes =" << readBytes;
if ((readBytes > 0) && ((m_frameRead + readBytes) <= m_frameSize)) {
qDebug() << "This is not a standard compliant backend";
qCDebug(KSANE_LOG) << "This is not a standard compliant backend";
copyToScanData(readBytes);
}
// There are broken backends that return wrong number for bytes_per_line
if (m_params.depth == 1 && m_params.lines > 0 && m_params.lines * m_params.pixels_per_line <= m_frameRead * 8) {
qDebug() << "Warning!! This backend seems to return wrong bytes_per_line for line-art images!";
qDebug() << "Warning!! Trying to correct the value!";
qCDebug(KSANE_LOG) << "Warning!! This backend seems to return wrong bytes_per_line for line-art images!";
qCDebug(KSANE_LOG) << "Warning!! Trying to correct the value!";
m_params.bytes_per_line = m_frameRead / m_params.lines;
}
m_readStatus = READ_READY; // It is better to return a broken image than nothing
......@@ -176,24 +176,24 @@ void KSaneScanThread::readData()
// start reading next frame
m_saneStatus = sane_start(m_saneHandle);
if (m_saneStatus != SANE_STATUS_GOOD) {
qDebug() << "sane_start =" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_start =" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
return;
}
m_saneStatus = sane_get_parameters(m_saneHandle, &m_params);
if (m_saneStatus != SANE_STATUS_GOOD) {
qDebug() << "sane_get_parameters =" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_get_parameters =" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
}
//qDebug() << "New Frame";
//qCDebug(KSANE_LOG) << "New Frame";
m_frameRead = 0;
m_frame_t_count++;
break;
}
default:
qDebug() << "sane_read=" << m_saneStatus << "=" << sane_strstatus(m_saneStatus);
qCDebug(KSANE_LOG) << "sane_read=" << m_saneStatus << "=" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
......@@ -215,7 +215,7 @@ void KSaneScanThread::copyToScanData(int readBytes)
{
if (m_invertColors) {
if (m_params.depth == 16) {
//if (readBytes%2) qDebug() << "readBytes=" << readBytes;
//if (readBytes%2) qCDebug(KSANE_LOG) << "readBytes=" << readBytes;
quint16 *u16ptr = reinterpret_cast<quint16 *>(m_readData);
for (int i = 0; i < readBytes / 2; i++) {
u16ptr[i] = 0xFFFF - u16ptr[i];
......@@ -292,7 +292,7 @@ void KSaneScanThread::copyToScanData(int readBytes)
break;
}
qDebug() << "Format" << m_params.format
qCDebug(KSANE_LOG) << "Format" << m_params.format
<< "and depth" << m_params.depth
<< "is not yet supported by libksane!";
m_readStatus = READ_ERROR;
......
......@@ -40,7 +40,6 @@
#include <QSplitter>
#include <QMutex>
#include <QPointer>
#include <QDebug>
#include <QIcon>
#include <QShortcut>
......@@ -60,6 +59,8 @@
#include "ksanedevicedialog.h"
#include "labeledgamma.h"
#include <ksane_debug.h>
namespace KSaneIface
{
static int s_objectCount = 0;
......@@ -80,10 +81,10 @@ KSaneWidget::KSaneWidget(QWidget *parent)
// only call sane init for the first instance
status = sane_init(&version, &KSaneAuth::authorization);
if (status != SANE_STATUS_GOOD) {
qDebug() << "libksane: sane_init() failed("
qCDebug(KSANE_LOG) << "libksane: sane_init() failed("
<< sane_strstatus(status) << ")";
} else {
//qDebug() << "Sane Version = "
//qCDebug(KSANE_LOG) << "Sane Version = "
// << SANE_VERSION_MAJOR(version) << "."
// << SANE_VERSION_MINORparent(version) << "."
// << SANE_VERSION_BUILD(version);
......@@ -307,10 +308,10 @@ void KSaneWidget::initGetDeviceList() const
{
// update the device list if needed to get the vendor and model info
if (d->m_findDevThread->devicesList().size() == 0) {
//qDebug() << "initGetDeviceList() starting thread...";
//qCDebug(KSANE_LOG) << "initGetDeviceList() starting thread...";
d->m_findDevThread->start();
} else {
//qDebug() << "initGetDeviceList() have existing data...";
//qCDebug(KSANE_LOG) << "initGetDeviceList() have existing data...";
d->signalDevListUpdate();
}
}
......@@ -402,7 +403,7 @@ bool KSaneWidget::openDevice(const QString &deviceName)
}
if (status != SANE_STATUS_GOOD) {
qDebug() << "sane_open(\"" << deviceName << "\", &handle) failed! status = " << sane_strstatus(status);
qCDebug(KSANE_LOG) << "sane_open(\"" << deviceName << "\", &handle) failed! status = " << sane_strstatus(status);
d->m_auth->clearDeviceAuth(d->m_devName);
d->m_devName.clear();
return false;
......@@ -468,12 +469,12 @@ bool KSaneWidget::openDevice(const QString &deviceName)
// do the connections of the option parameters
for (i = 0; i < d->m_optList.size(); ++i) {
//qDebug() << d->m_optList.at(i)->name();
//qCDebug(KSANE_LOG) << d->m_optList.at(i)->name();
connect(d->m_optList.at(i), SIGNAL(optsNeedReload()), d, SLOT(optReload()));
connect(d->m_optList.at(i), SIGNAL(valsNeedReload()), d, SLOT(scheduleValReload()));
if (d->m_optList.at(i)->needsPolling()) {
//qDebug() << d->m_optList.at(i)->name() << " needs polling";
//qCDebug(KSANE_LOG) << d->m_optList.at(i)->name() << " needs polling";
d->m_pollList.append(d->m_optList.at(i));
KSaneOptCheckBox *buttonOption = qobject_cast<KSaneOptCheckBox *>(d->m_optList.at(i));
if (buttonOption) {
......@@ -633,7 +634,7 @@ QImage KSaneWidget::toQImageSilent(const QByteArray &data,
}
case FormatNone:
default:
qDebug() << "Unsupported conversion";
qCDebug(KSANE_LOG) << "Unsupported conversion";
break;
}
float dpm = dpi * (1000.0 / 25.4);
......@@ -899,7 +900,7 @@ float KSaneWidget::scanAreaWidth()
d->m_optBrX->getMaxValue(result);
float dpi = currentDPI();
if (dpi < 1) {
qDebug() << "Broken DPI value";
qCDebug(KSANE_LOG) << "Broken DPI value";
dpi = 1.0;
}
result = result / dpi / 25.4;
......@@ -918,7 +919,7 @@ float KSaneWidget::scanAreaHeight()
d->m_optBrY->getMaxValue(result);
float dpi = currentDPI();
if (dpi < 1) {
qDebug() << "Broken DPI value";
qCDebug(KSANE_LOG) << "Broken DPI value";
dpi = 1.0;
}
result = result / dpi / 25.4;
......
......@@ -36,9 +36,10 @@
#include <QLabel>
#include <QPushButton>
#include <QMessageBox>
#include <QDebug>
#include <QPageSize>
#include <ksane_debug.h>
#define SCALED_PREVIEW_MAX_SIDE 400
static const int ActiveSelection = 100000;
......@@ -172,7 +173,7 @@ void KSaneWidgetPrivate::devListUpdated()
}
for (int i = 0; i < list.size(); ++i) {
const KSaneWidget::DeviceInfo info = list.at(i);
qDebug() << info.name;
qCDebug(KSANE_LOG) << info.name;
if (info.name == m_devName) {
m_vendor = info.vendor;
m_model = info.model;
......@@ -328,7 +329,7 @@ float KSaneWidgetPrivate::ratioToDispUnitX(float ratio)
return mmToDispUnit(result);
}
}
qDebug() << "Failed to convert scan area to mm";
qCDebug(KSANE_LOG) << "Failed to convert scan area to mm";
return ratio;
}
......@@ -352,7 +353,7 @@ float KSaneWidgetPrivate::ratioToDispUnitY(float ratio)
return mmToDispUnit(result);
}
}
qDebug() << "Failed to convert scan area to display unit";
qCDebug(KSANE_LOG) << "Failed to convert scan area to display unit";
return ratio;
}
......@@ -869,7 +870,7 @@ void KSaneWidgetPrivate::updatePreviewSize()
m_optBrY->getMaxValue(max_y);
}
if ((max_x == m_previewWidth) && (max_y == m_previewHeight)) {
//qDebug() << "no preview size change";
//qCDebug(KSANE_LOG) << "no preview size change";
return;
}
......@@ -895,7 +896,7 @@ void KSaneWidgetPrivate::updatePreviewSize()
// Avoid crash if max_y or max_x == 0
if (max_x < 0.0001 || max_y < 0.0001) {
qWarning() << "Risk for division by 0" << max_x << max_y;
qCWarning(KSANE_LOG) << "Risk for division by 0" << max_x << max_y;
return;
}
......@@ -993,7 +994,7 @@ void KSaneWidgetPrivate::startPreviewScan()
//check what image size we would get in a scan
status = sane_get_parameters(m_saneHandle, &params);
if (status != SANE_STATUS_GOOD) {
qDebug() << "sane_get_parameters=" << sane_strstatus(status);
qCDebug(KSANE_LOG) << "sane_get_parameters=" << sane_strstatus(status);
previewScanDone();
return;
}
......@@ -1010,7 +1011,7 @@ void KSaneWidgetPrivate::startPreviewScan()
// This is a security measure for broken backends
m_optRes->getMinValue(dpi);
m_optRes->setValue(dpi);
qDebug() << "Setting minimum DPI value for a broken back-end";
qCDebug(KSANE_LOG) << "Setting minimum DPI value for a broken back-end";
}
}
}
......@@ -1166,7 +1167,7 @@ void KSaneWidgetPrivate::oneFinalScanDone()
source.contains(QStringLiteral("ADF")) ||
source.contains(QStringLiteral("Duplex"))) {
// in batch mode only one area can be scanned per page
//qDebug() << "source == " << source;
//qCDebug(KSANE_LOG) << "source == " << source;
if (!m_cancelMultiScan) {
m_updProgressTmr.start();
m_scanThread->start();
......@@ -1179,14 +1180,14 @@ void KSaneWidgetPrivate::oneFinalScanDone()
// Check if we have a "wait for button" batch scanning
if (m_optWaitForBtn) {
qDebug() << m_optWaitForBtn->name();
qCDebug(KSANE_LOG) << m_optWaitForBtn->name();
QString wait;
m_optWaitForBtn->getValue(wait);
qDebug() << "wait ==" << wait;
qCDebug(KSANE_LOG) << "wait ==" << wait;
if (wait == QStringLiteral("true")) {
// in batch mode only one area can be scanned per page
//qDebug() << "source == \"Automatic Document Feeder\"";
//qCDebug(KSANE_LOG) << "source == \"Automatic Document Feeder\"";
m_updProgressTmr.start();
m_scanThread->start();
return;
......@@ -1196,7 +1197,7 @@ void KSaneWidgetPrivate::oneFinalScanDone()
// not batch scan, call sane_cancel to be able to change parameters.
sane_cancel(m_saneHandle);
//qDebug() << "index=" << m_selIndex << "size=" << m_previewViewer->selListSize();
//qCDebug(KSANE_LOG) << "index=" << m_selIndex << "size=" << m_previewViewer->selListSize();
// check if we have multiple selections.
if (m_previewViewer->selListSize() > m_selIndex) {
if ((m_optTlX != nullptr) && (m_optTlY != nullptr) && (m_optBrX != nullptr) && (m_optBrY != nullptr)) {
......
......@@ -30,7 +30,7 @@
#include "ksanebutton.h"
#include <QDebug>
#include <ksane_debug.h>
namespace KSaneIface
{
......@@ -49,7 +49,7 @@ void KSaneOptButton::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
qDebug() << "This is a bug";
qCDebug(KSANE_LOG) << "This is a bug";
m_widget = new KSaneOptionWidget(parent, QString());
return;
}
......
......@@ -32,7 +32,7 @@
#include <QtCore/QVarLengthArray>
#include <QDebug>
#include <ksane_debug.h>
namespace KSaneIface
{
......@@ -51,7 +51,7 @@ void KSaneOptCheckBox::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
qDebug() << "This is a bug";
qCDebug(KSANE_LOG) << "This is a bug";
m_widget = new KSaneOptionWidget(parent, QString());
return;
}
......
......@@ -32,10 +32,11 @@
#include <QtCore/QVarLengthArray>
#include <QDebug>
#include <QIcon>
#include <QLocale>
#include <ksane_debug.h>
namespace KSaneIface
{
static const char tmp_binary[] = "Binary";
......@@ -205,7 +206,7 @@ void KSaneOptCombo::comboboxChangedIndex(int i)
dataPtr = (void *)m_optDesc->constraint.string_list[i];
break;
default:
qDebug() << "can not handle type:" << m_optDesc->type;
qCDebug(KSANE_LOG) << "can not handle type:" << m_optDesc->type;
return;
}
writeData(dataPtr);
......@@ -232,7 +233,7 @@ bool KSaneOptCombo::getMinValue(float &val)
}
break;
default:
qDebug() << "can not handle type:" << m_optDesc->type;
qCDebug(KSANE_LOG) << "can not handle type:" << m_optDesc->type;
return false;
}
return true;
......@@ -250,7 +251,7 @@ bool KSaneOptCombo::getValue(float &val)
SANE_Int res;
status = sane_control_option(m_handle, m_index, SANE_ACTION_GET_VALUE, data.data(), &res);
if (status != SANE_STATUS_GOOD) {
qDebug() << m_optDesc->name << "sane_control_option returned" << status;
qCDebug(KSANE_LOG) << m_optDesc->name << "sane_control_option returned" << status;
return false;
}
......@@ -262,7 +263,7 @@ bool KSaneOptCombo::getValue(float &val)
val = SANE_UNFIX(toSANE_Word(data.data()));
return true;
default:
qDebug() << "Type" << m_optDesc->type << "not supported!";
qCDebug(KSANE_LOG) << "Type" << m_optDesc->type << "not supported!";
break;
}
return false;
......@@ -306,7 +307,7 @@ bool KSaneOptCombo::setValue(float value)
readValue();
return (minDiff < 1.0);
default:
qDebug() << "can not handle type:" << m_optDesc->type;
qCDebug(KSANE_LOG) << "can not handle type:" << m_optDesc->type;
break;
}
return false;
......@@ -371,7 +372,7 @@ bool KSaneOptCombo::setValue(const QString &val)
}
break;
default:
qDebug() << "can only handle SANE_TYPE: INT, FIXED and STRING";
qCDebug(KSANE_LOG) << "can only handle SANE_TYPE: INT, FIXED and STRING";
return false;
}
writeData(data_ptr);
......
......@@ -32,7 +32,7 @@
#include <QtCore/QVarLengthArray>
#include <QDebug>
#include <ksane_debug.h>
namespace KSaneIface
{
......@@ -51,7 +51,7 @@ void KSaneOptEntry::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
qDebug() << "This is a bug";
qCDebug(KSANE_LOG) << "This is a bug";
m_widget = new KSaneOptionWidget(parent, QString());
return;
}
......
......@@ -32,7 +32,7 @@
#include <QtCore/QVarLengthArray>
#include <QDebug>
#include <ksane_debug.h>
static const float FIXED_MAX = 32767.0;
static const float FIXED_MIN = -32768.0;
......@@ -114,7 +114,7 @@ void KSaneOptFSlider::sliderChanged(float val)
if (((val - m_fVal) >= m_minChange) || ((m_fVal - val) >= m_minChange)) {
unsigned char data[4];
SANE_Word fixed;
//qDebug() <<m_optDesc->name << fVal << "!=" << val;
//qCDebug(KSANE_LOG) <<m_optDesc->name << fVal << "!=" << val;
m_fVal = val;
fixed = SANE_FIX(val);
fromSANE_Word(data, fixed);
......
......@@ -32,7 +32,7 @@
#include <QtCore/QVarLengthArray>
#include <QDebug>
#include <ksane_debug.h>
namespace KSaneIface
{
......@@ -51,7 +51,7 @@ void KSaneOptGamma::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
qDebug() << "This is a bug";
qCDebug(KSANE_LOG) << "This is a bug";
m_widget = new KSaneOptionWidget(parent, QString());
return;
}
......
......@@ -30,7 +30,7 @@
#include "ksaneoptionwidget.h"
#include <QDebug>
#include <ksane_debug.h>
namespace KSaneIface
{
......@@ -111,7 +111,7 @@ bool KSaneOption::needsPolling() const
}
if ((m_optDesc->cap & SANE_CAP_SOFT_DETECT) && !(m_optDesc->cap & SANE_CAP_SOFT_SELECT)) {
qDebug() << name() << "optDesc->cap =" << m_optDesc->cap;
qCDebug(KSANE_LOG) << name() << "optDesc->cap =" << m_optDesc->cap;
return true;
}
......@@ -137,13 +137,13 @@ bool KSaneOption::writeData(void *data)
status = sane_control_option(m_handle, m_index, SANE_ACTION_SET_VALUE, data, &res);
if (status != SANE_STATUS_GOOD) {
qDebug() << m_optDesc->name << "sane_control_option returned:" << sane_strstatus(status);
qCDebug(KSANE_LOG) << m_optDesc->name << "sane_control_option returned:" << sane_strstatus(status);
// write failed. re read the current setting
readValue();
return false;