aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-19 18:56:24 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-19 18:56:24 (GMT)
commit1647f68d9945044c0685f95950c81ecb59a3bbd0 (patch)
tree73919a0601a57f2ed33bb5140834dd46950aabd3
parent3e0f2b1fb01a727aa7f04a02c9fcec04ac9c864a (diff)
many fixes because of removed KDE4 support BUT still major FIXMEs
-rw-r--r--CMakeLists.txt1
-rw-r--r--libksane/CMakeLists.txt2
-rw-r--r--libksane/ksane_auth.cpp11
-rw-r--r--libksane/ksane_device_dialog.cpp34
-rw-r--r--libksane/ksane_device_dialog.h9
-rw-r--r--libksane/ksane_find_devices_thread.cpp5
-rw-r--r--libksane/ksane_preview_thread.cpp36
-rw-r--r--libksane/ksane_scan_thread.cpp20
-rw-r--r--libksane/ksane_viewer.cpp16
-rw-r--r--libksane/ksane_viewer_test.cpp4
-rw-r--r--libksane/ksane_widget.cpp56
-rw-r--r--libksane/ksane_widget_private.cpp45
-rw-r--r--libksane/ksane_widget_private.h5
-rw-r--r--libksane/options/ksane_opt_button.cpp10
-rw-r--r--libksane/options/ksane_opt_checkbox.cpp8
-rw-r--r--libksane/options/ksane_opt_combo.cpp31
-rw-r--r--libksane/options/ksane_opt_entry.cpp8
-rw-r--r--libksane/options/ksane_opt_fslider.cpp8
-rw-r--r--libksane/options/ksane_opt_gamma.cpp11
-rw-r--r--libksane/options/ksane_opt_slider.cpp8
-rw-r--r--libksane/options/ksane_option.cpp45
-rw-r--r--libksane/splittercollapser.cpp6
-rw-r--r--libksane/widgets/ksane_button.cpp4
-rw-r--r--libksane/widgets/ksane_option_widget.cpp5
-rw-r--r--libksane/widgets/labeled_combo.cpp10
-rw-r--r--libksane/widgets/labeled_combo.h7
-rw-r--r--libksane/widgets/labeled_entry.cpp8
-rw-r--r--libksane/widgets/labeled_entry.h5
-rw-r--r--libksane/widgets/labeled_fslider.cpp4
29 files changed, 192 insertions, 230 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2cac096..4867c1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,6 +48,7 @@ find_package(KF5PrintUtils ${KF5_VERSION} REQUIRED)
find_package(KF5XmlGui ${KF5_VERSION} REQUIRED)
#find_package(KF5Notifications ${KF5_VERSION} REQUIRED)
find_package(KF5Wallet ${KF5_VERSION} REQUIRED)
+find_package(KF5WidgetsAddons ${KF5_VERSION} REQUIRED)
# Check if sane API is available.
if (NOT WIN32)
diff --git a/libksane/CMakeLists.txt b/libksane/CMakeLists.txt
index fefe563..6f7a555 100644
--- a/libksane/CMakeLists.txt
+++ b/libksane/CMakeLists.txt
@@ -39,8 +39,8 @@ target_link_libraries (ksane
LINK_PRIVATE
KF5::I18n
KF5::PrintUtils
- KF5::KDE4Support
KF5::Wallet
+ KF5::WidgetsAddons
${SANE_LIBRARY})
set_target_properties(ksane PROPERTIES VERSION ${KSANE_LIB_SO_VERSION_STRING} SOVERSION ${KSANE_LIB_SO_CUR_VERSION})
diff --git a/libksane/ksane_auth.cpp b/libksane/ksane_auth.cpp
index dc88272..40a296d 100644
--- a/libksane/ksane_auth.cpp
+++ b/libksane/ksane_auth.cpp
@@ -6,6 +6,7 @@
* Description : Sane authentication helpers.
*
* Copyright (C) 2010 by Kare Sars <kare dot sars at iki dot fi>
+* Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,9 +31,7 @@
// Qt includes
#include <QMutex>
#include <QList>
-
-// KDE includes
-#include <KDebug>
+#include <QDebug>
namespace KSaneIface
{
@@ -108,7 +107,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)
{
- kDebug() << resource;
+ qDebug() << 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"
@@ -116,11 +115,11 @@ void KSaneAuth::authorization(SANE_String_Const resource, SANE_Char *username, S
QString res(resource);
int end = res.indexOf("$MD5$");
res = res.left(end);
- kDebug() << res;
+ qDebug() << res;
QList<Private::AuthStruct> list = getInstance()->d->authList;
for (int i=0; i<list.size(); i++) {
- kDebug() << res << list.at(i).resource;
+ qDebug() << res << list.at(i).resource;
if (list.at(i).resource.contains(res)) {
qstrncpy(username, list.at(i).username.toLocal8Bit(), SANE_MAX_USERNAME_LEN);
qstrncpy(password, list.at(i).password.toLocal8Bit(), SANE_MAX_PASSWORD_LEN);
diff --git a/libksane/ksane_device_dialog.cpp b/libksane/ksane_device_dialog.cpp
index 4c3e615..8635c97 100644
--- a/libksane/ksane_device_dialog.cpp
+++ b/libksane/ksane_device_dialog.cpp
@@ -7,6 +7,7 @@
*
* Copyright (C) 2007-2008 by Kare Sars <kare dot sars at iki dot fi>
* Copyright (C) 2009 by Grzegorz Kurtyka <grzegorz dot kurtyka at gmail dot com>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -38,23 +39,24 @@ extern "C"
#include <sane/sane.h>
}
-
-// KDE includes
-#include <KDebug>
-#include <KPushButton>
-
#include <QScrollArea>
#include <QLabel>
+#include <QDialogButtonBox>
+
+
+#include <KLocalizedString>
namespace KSaneIface
{
KSaneDeviceDialog::KSaneDeviceDialog(QWidget *parent)
- : KDialog(parent)
+ : QDialog(parent)
{
-
- setButtons(KDialog::User1 | KDialog::Ok | KDialog::Cancel);
- setButtonText(User1, i18n("Reload devices list"));
+ //setButtons(KDialog::User1 | KDialog::Ok | KDialog::Cancel); // FIXME KF5
+ //setButtonText(User1, i18n("Reload devices list")); // FIXME KF5
+
+ QDialogButtonBox* buttonbox = new QDialogButtonBox();
+ buttonbox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
m_btnGroup = new QButtonGroup(this);
@@ -86,7 +88,7 @@ KSaneDeviceDialog::KSaneDeviceDialog(QWidget *parent)
area->setFrameShape(QFrame::NoFrame);
area->setWidget(m_btnContainer);
- setMainWidget(m_btnBox);
+ //setMainWidget(m_btnBox); // FIXME KF5
setMinimumHeight(200);
m_findDevThread = FindSaneDevicesThread::getInstance();
@@ -108,7 +110,7 @@ void KSaneDeviceDialog::reloadDevicesList()
}
m_btnBox->setTitle(i18n("Looking for devices. Please wait."));
m_btnBox->layout()->itemAt(0)->widget()->hide(); // explanation
- enableButton(KDialog::User1, false);
+ //enableButton(KDialog::User1, false); // FIXME KF5
if(!m_findDevThread->isRunning()) {
m_findDevThread->start();
@@ -117,10 +119,10 @@ void KSaneDeviceDialog::reloadDevicesList()
void KSaneDeviceDialog::setAvailable(bool avail)
{
- enableButtonOk(avail);
+ // enableButtonOk(avail); // FIXME KF5
if(avail) {
m_selectedDevice = getSelectedName();
- setButtonFocus(KDialog::Ok);
+ //setButtonFocus(KDialog::Ok); // FIXME KF5
}
}
@@ -148,7 +150,7 @@ void KSaneDeviceDialog::updateDevicesList()
m_btnBox->setTitle(i18n("Sorry. No devices found."));
m_btnBox->layout()->itemAt(0)->widget()->show(); // explanation
m_btnBox->layout()->itemAt(1)->widget()->hide(); // scroll area
- enableButton(KDialog::User1, true);
+ //enableButton(KDialog::User1, true); // FIXME KF5
return;
}
@@ -180,10 +182,10 @@ void KSaneDeviceDialog::updateDevicesList()
m_btnLayout->addStretch();
if(list.size() == 1) {
- button(KDialog::Ok)->animateClick();
+ //button(KDialog::Ok)->animateClick(); // FIXME KF5
}
- enableButton(KDialog::User1, true);
+ //enableButton(KDialog::User1, true); // FIXME KF5
}
} // NameSpace KSaneIface
diff --git a/libksane/ksane_device_dialog.h b/libksane/ksane_device_dialog.h
index ebf42c1..d7f86fb 100644
--- a/libksane/ksane_device_dialog.h
+++ b/libksane/ksane_device_dialog.h
@@ -7,6 +7,7 @@
*
* Copyright (C) 2007-2010 by Kare Sars <kare dot sars at iki dot fi>
* Copyright (C) 2009 by Grzegorz Kurtyka <grzegorz dot kurtyka at gmail dot com>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -40,16 +41,12 @@
#include <QCheckBox>
#include <QPushButton>
#include <QBoxLayout>
-
-
-// KDE includes
-#include <KDialog>
-#include <klocale.h>
+#include <QDialog>
namespace KSaneIface
{
-class KSaneDeviceDialog : public KDialog
+class KSaneDeviceDialog : public QDialog
{
Q_OBJECT
diff --git a/libksane/ksane_find_devices_thread.cpp b/libksane/ksane_find_devices_thread.cpp
index 0a865b6..04a1fab 100644
--- a/libksane/ksane_find_devices_thread.cpp
+++ b/libksane/ksane_find_devices_thread.cpp
@@ -7,6 +7,7 @@
*
* Copyright (C) 2009 by Grzegorz Kurtyka <grzegorz dot kurtyka at gmail dot com>
* Copyright (C) 2010 by Kare Sars <kare dot sars at iki dot fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -38,10 +39,6 @@ extern "C"
#include <sane/sane.h>
}
-// KDE includes
-#include <KDebug>
-
-// Qt includes
#include <QMutex>
namespace KSaneIface
diff --git a/libksane/ksane_preview_thread.cpp b/libksane/ksane_preview_thread.cpp
index ad385ff..784042d 100644
--- a/libksane/ksane_preview_thread.cpp
+++ b/libksane/ksane_preview_thread.cpp
@@ -28,9 +28,9 @@
#include "ksane_preview_thread.h"
-#include <KDebug>
#include <QMutexLocker>
-
+#include <QDebug>
+#include <QImage>
namespace KSaneIface
{
@@ -77,7 +77,7 @@ namespace KSaneIface
status = sane_start(m_saneHandle);
if (status != SANE_STATUS_GOOD) {
- kDebug() << "sane_start=" << sane_strstatus(status);
+ qDebug() << "sane_start=" << sane_strstatus(status);
sane_cancel(m_saneHandle);
m_readStatus = READ_ERROR;
return;
@@ -86,7 +86,7 @@ namespace KSaneIface
// Read image parameters
status = sane_get_parameters(m_saneHandle, &m_params);
if (status != SANE_STATUS_GOOD) {
- kDebug() << "sane_get_parameters=" << sane_strstatus(status);
+ qDebug() << "sane_get_parameters=" << sane_strstatus(status);
sane_cancel(m_saneHandle);
m_readStatus = READ_ERROR;
return;
@@ -166,7 +166,7 @@ namespace KSaneIface
case SANE_STATUS_EOF:
// (handscanners have negative frame size)
if (m_frameRead < m_frameSize) {
- kDebug() << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize;
+ qDebug() << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize;
m_readStatus = READ_ERROR;
return;
}
@@ -179,18 +179,18 @@ namespace KSaneIface
// start reading next frame
SANE_Status status = sane_start(m_saneHandle);
if (status != SANE_STATUS_GOOD) {
- kDebug() << "sane_start =" << sane_strstatus(status);
+ qDebug() << "sane_start =" << sane_strstatus(status);
m_readStatus = READ_ERROR;
return;
}
status = sane_get_parameters(m_saneHandle, &m_params);
if (status != SANE_STATUS_GOOD) {
- kDebug() << "sane_get_parameters =" << sane_strstatus(status);
+ qDebug() << "sane_get_parameters =" << sane_strstatus(status);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
}
- //kDebug() << "New Frame";
+ //qDebug() << "New Frame";
m_frameRead = 0;
m_pixel_x = 0;
m_pixel_y = 0;
@@ -199,7 +199,7 @@ namespace KSaneIface
break;
}
default:
- kDebug() << "sane_read=" << status << "=" << sane_strstatus(status);
+ qDebug() << "sane_read=" << status << "=" << sane_strstatus(status);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
@@ -274,7 +274,7 @@ namespace KSaneIface
else if (m_params.depth == 8) {
for (int i=0; i<read_bytes; i++) {
index = m_frameRead * 4;
- if ((index + 2) >m_img->numBytes()) {
+ if ((index + 2) >m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -291,7 +291,7 @@ namespace KSaneIface
for (int i=0; i<read_bytes; i++) {
if (m_frameRead%2 == 0) {
index = m_frameRead * 2;
- if ((index + 2) > m_img->numBytes()) {
+ if ((index + 2) > m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -357,7 +357,7 @@ namespace KSaneIface
case SANE_FRAME_RED:
if (m_params.depth == 8) {
for (int i=0; i<read_bytes; i++) {
- if (index_red8_to_argb8(m_frameRead) > m_img->numBytes()) {
+ if (index_red8_to_argb8(m_frameRead) > m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -371,7 +371,7 @@ namespace KSaneIface
else if (m_params.depth == 16) {
for (int i=0; i<read_bytes; i++) {
if (m_frameRead%2 == 0) {
- if (index_red16_to_argb8(m_frameRead) > m_img->numBytes()) {
+ if (index_red16_to_argb8(m_frameRead) > m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -388,7 +388,7 @@ namespace KSaneIface
case SANE_FRAME_GREEN:
if (m_params.depth == 8) {
for (int i=0; i<read_bytes; i++) {
- if (index_green8_to_argb8(m_frameRead) > m_img->numBytes()) {
+ if (index_green8_to_argb8(m_frameRead) > m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -402,7 +402,7 @@ namespace KSaneIface
else if (m_params.depth == 16) {
for (int i=0; i<read_bytes; i++) {
if (m_frameRead%2 == 0) {
- if (index_green16_to_argb8(m_frameRead) > m_img->numBytes()) {
+ if (index_green16_to_argb8(m_frameRead) > m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -419,7 +419,7 @@ namespace KSaneIface
case SANE_FRAME_BLUE:
if (m_params.depth == 8) {
for (int i=0; i<read_bytes; i++) {
- if (index_blue8_to_argb8(m_frameRead) > m_img->numBytes()) {
+ if (index_blue8_to_argb8(m_frameRead) > m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -433,7 +433,7 @@ namespace KSaneIface
else if (m_params.depth == 16) {
for (int i=0; i<read_bytes; i++) {
if (m_frameRead%2 == 0) {
- if (index_blue16_to_argb8(m_frameRead) > m_img->numBytes()) {
+ if (index_blue16_to_argb8(m_frameRead) > m_img->byteCount()) {
// resize the image
*m_img = m_img->copy(0, 0, m_img->width(), m_img->height() + m_img->width());
imgBits = m_img->bits();
@@ -448,7 +448,7 @@ namespace KSaneIface
break;
}
- kWarning() << "Format" << m_params.format
+ qWarning() << "Format" << m_params.format
<< "and depth" << m_params.format
<< "is not yet suppoeted by libksane!";
m_readStatus = READ_ERROR;
diff --git a/libksane/ksane_scan_thread.cpp b/libksane/ksane_scan_thread.cpp
index 151b7f9..bf87f03 100644
--- a/libksane/ksane_scan_thread.cpp
+++ b/libksane/ksane_scan_thread.cpp
@@ -28,7 +28,7 @@
#include "ksane_scan_thread.h"
-#include <KDebug>
+#include <QDebug>
namespace KSaneIface
{
@@ -104,7 +104,7 @@ namespace KSaneIface
}
if (m_saneStatus != SANE_STATUS_GOOD) {
- kDebug() << "sane_start=" << sane_strstatus(m_saneStatus);
+ qDebug() << "sane_start=" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
// oneFinalScanDone() does the sane_cancel()
return;
@@ -113,7 +113,7 @@ namespace KSaneIface
// Read image parameters
m_saneStatus = sane_get_parameters(m_saneHandle, &m_params);
if (m_saneStatus != SANE_STATUS_GOOD) {
- kDebug() << "sane_get_parameters=" << sane_strstatus(m_saneStatus);
+ qDebug() << "sane_get_parameters=" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
// oneFinalScanDone() does the sane_cancel()
return;
@@ -157,9 +157,9 @@ namespace KSaneIface
case SANE_STATUS_EOF:
if (m_frameRead < m_frameSize) {
- kDebug() << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize << "readBytes =" << readBytes;
+ qDebug() << "frameRead =" << m_frameRead << ", frameSize =" << m_frameSize << "readBytes =" << readBytes;
if ((readBytes > 0) && ((m_frameRead + readBytes) <= m_frameSize)) {
- kDebug() << "This is not a standard compliant backend";
+ qDebug() << "This is not a standard compliant backend";
copyToScanData(readBytes);
}
m_readStatus = READ_READY; // It is better to return a broken image than nothing
@@ -174,24 +174,24 @@ namespace KSaneIface
// start reading next frame
m_saneStatus = sane_start(m_saneHandle);
if (m_saneStatus != SANE_STATUS_GOOD) {
- kDebug() << "sane_start =" << sane_strstatus(m_saneStatus);
+ qDebug() << "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) {
- kDebug() << "sane_get_parameters =" << sane_strstatus(m_saneStatus);
+ qDebug() << "sane_get_parameters =" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
}
- //kDebug() << "New Frame";
+ //qDebug() << "New Frame";
m_frameRead = 0;
m_frame_t_count++;
break;
}
default:
- kDebug() << "sane_read=" << m_saneStatus << "=" << sane_strstatus(m_saneStatus);
+ qDebug() << "sane_read=" << m_saneStatus << "=" << sane_strstatus(m_saneStatus);
m_readStatus = READ_ERROR;
sane_cancel(m_saneHandle);
return;
@@ -296,7 +296,7 @@ namespace KSaneIface
break;
}
- kDebug() << "Format" << m_params.format
+ qDebug() << "Format" << m_params.format
<< "and depth" << m_params.format
<< "is not yet suppoeted by libksane!";
m_readStatus = READ_ERROR;
diff --git a/libksane/ksane_viewer.cpp b/libksane/ksane_viewer.cpp
index cb08fe8..0d6f9d6 100644
--- a/libksane/ksane_viewer.cpp
+++ b/libksane/ksane_viewer.cpp
@@ -6,6 +6,7 @@
* Description : Preview image viewer that can handle a selection.
*
* Copyright (C) 2008 by Kare Sars <kare dot sars at iki dot fi>
+* Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -37,10 +38,9 @@
#include <QAction>
#include <QList>
#include <QVector>
-#include <KIcon>
-#include <KLocale>
+#include <QIcon>
-#include <KDebug>
+#include <KLocalizedString>
#include <math.h>
@@ -128,19 +128,19 @@ KSaneViewer::KSaneViewer(QImage * img, QWidget *parent) : QGraphicsView(parent),
d->selectionList.clear();
// create context menu
- d->zoomInAction = new QAction(KIcon("zoom-in"), i18n("Zoom In"), this);
+ d->zoomInAction = new QAction(QIcon::fromTheme("zoom-in"), i18n("Zoom In"), this);
connect(d->zoomInAction, SIGNAL(triggered()), this, SLOT(zoomIn()));
- d->zoomOutAction = new QAction(KIcon("zoom-out"), i18n("Zoom Out"), this);
+ d->zoomOutAction = new QAction(QIcon::fromTheme("zoom-out"), i18n("Zoom Out"), this);
connect(d->zoomOutAction, SIGNAL(triggered()), this, SLOT(zoomOut()));
- d->zoomSelAction = new QAction(KIcon("zoom-fit-best"), i18n("Zoom to Selection"), this);
+ d->zoomSelAction = new QAction(QIcon::fromTheme("zoom-fit-best"), i18n("Zoom to Selection"), this);
connect(d->zoomSelAction, SIGNAL(triggered()), this, SLOT(zoomSel()));
- d->zoom2FitAction = new QAction(KIcon("document-preview"), i18n("Zoom to Fit"), this);
+ d->zoom2FitAction = new QAction(QIcon::fromTheme("document-preview"), i18n("Zoom to Fit"), this);
connect(d->zoom2FitAction, SIGNAL(triggered()), this, SLOT(zoom2Fit()));
- d->clrSelAction = new QAction(KIcon("edit-clear"), i18n("Clear Selections"), this);
+ d->clrSelAction = new QAction(QIcon::fromTheme("edit-clear"), i18n("Clear Selections"), this);
connect(d->clrSelAction, SIGNAL(triggered()), this, SLOT(clearSelections()));
addAction(d->zoomInAction);
diff --git a/libksane/ksane_viewer_test.cpp b/libksane/ksane_viewer_test.cpp
index de564ec..00cbc7b 100644
--- a/libksane/ksane_viewer_test.cpp
+++ b/libksane/ksane_viewer_test.cpp
@@ -27,7 +27,7 @@
#include "ksane_viewer.h"
-#include <KDebug>
+#include <qDebug>
#include <QApplication>
int main (int argc, char *argv[])
@@ -35,7 +35,7 @@ int main (int argc, char *argv[])
QApplication app(argc, argv);
if (argc != 2) {
- kDebug() << "An image filename is needed.";
+ qDebug() << "An image filename is needed.";
return 1;
}
QImage img(argv[1]);
diff --git a/libksane/ksane_widget.cpp b/libksane/ksane_widget.cpp
index 7fd1984..0704e63 100644
--- a/libksane/ksane_widget.cpp
+++ b/libksane/ksane_widget.cpp
@@ -33,20 +33,18 @@
#include <unistd.h>
-// Qt includes
#include <QApplication>
#include <QVarLengthArray>
#include <QLabel>
#include <QSplitter>
#include <QMutex>
#include <QPointer>
+#include <QDebug>
+#include <QIcon>
-// KDE includes
#include <kpassworddialog.h>
#include <kwallet.h>
-#include <kpushbutton.h>
-// Local includes
#include "ksane_widget_private.h"
#include "ksane_option.h"
#include "ksane_opt_button.h"
@@ -59,7 +57,6 @@
#include "ksane_device_dialog.h"
#include "labeled_gamma.h"
#include "kglobal.h"
-#include "kicon.h"
namespace KSaneIface
{
@@ -74,8 +71,8 @@ KSaneWidget::KSaneWidget(QWidget* parent)
SANE_Int version;
SANE_Status status;
- //kDebug() << "The language is:" << KGlobal::locale()->language();
- //kDebug() << "Languagelist" << KGlobal::locale()->languageList();
+ //qDebug() << "The language is:" << KGlobal::locale()->language();
+ //qDebug() << "Languagelist" << KGlobal::locale()->languageList();
//KGlobal::locale()->insertCatalog("libksane"); // FIXME KF5
//KGlobal::locale()->insertCatalog("sane-backends"); // FIXME KF5
@@ -86,11 +83,11 @@ KSaneWidget::KSaneWidget(QWidget* parent)
// only call sane init for the first instance
status = sane_init(&version, &KSaneAuth::authorization);
if (status != SANE_STATUS_GOOD) {
- kDebug() << "libksane: sane_init() failed("
+ qDebug() << "libksane: sane_init() failed("
<< sane_strstatus(status) << ")";
}
else {
- //kDebug() << "Sane Version = "
+ //qDebug() << "Sane Version = "
// << SANE_VERSION_MAJOR(version) << "."
// << SANE_VERSION_MINORparent(version) << "."
// << SANE_VERSION_BUILD(version);
@@ -127,7 +124,7 @@ KSaneWidget::KSaneWidget(QWidget* parent)
d->m_progressBar->setMaximum(100);
d->m_cancelBtn = new QPushButton;
- d->m_cancelBtn->setIcon(KIcon("process-stop"));
+ d->m_cancelBtn->setIcon(QIcon::fromTheme("process-stop"));
d->m_cancelBtn->setToolTip(i18n("Cancel current scan operation"));
connect(d->m_cancelBtn, SIGNAL(clicked()), this, SLOT(scanCancel()));
@@ -140,42 +137,42 @@ KSaneWidget::KSaneWidget(QWidget* parent)
d->m_zInBtn = new QToolButton(this);
d->m_zInBtn->setAutoRaise(true);
- d->m_zInBtn->setIcon(KIcon("zoom-in"));
+ d->m_zInBtn->setIcon(QIcon::fromTheme("zoom-in"));
d->m_zInBtn->setToolTip(i18n("Zoom In"));
connect(d->m_zInBtn, SIGNAL(clicked()), d->m_previewViewer, SLOT(zoomIn()));
d->m_zOutBtn = new QToolButton(this);
d->m_zOutBtn->setAutoRaise(true);
- d->m_zOutBtn->setIcon(KIcon("zoom-out"));
+ d->m_zOutBtn->setIcon(QIcon::fromTheme("zoom-out"));
d->m_zOutBtn->setToolTip(i18n("Zoom Out"));
connect(d->m_zOutBtn, SIGNAL(clicked()), d->m_previewViewer, SLOT(zoomOut()));
d->m_zSelBtn = new QToolButton(this);
d->m_zSelBtn->setAutoRaise(true);
- d->m_zSelBtn->setIcon(KIcon("zoom-fit-best"));
+ d->m_zSelBtn->setIcon(QIcon::fromTheme("zoom-fit-best"));
d->m_zSelBtn->setToolTip(i18n("Zoom to Selection"));
connect(d->m_zSelBtn, SIGNAL(clicked()), d->m_previewViewer, SLOT(zoomSel()));
d->m_zFitBtn = new QToolButton(this);
d->m_zFitBtn->setAutoRaise(true);
- d->m_zFitBtn->setIcon(KIcon("document-preview"));
+ d->m_zFitBtn->setIcon(QIcon::fromTheme("document-preview"));
d->m_zFitBtn->setToolTip(i18n("Zoom to Fit"));
connect(d->m_zFitBtn, SIGNAL(clicked()), d->m_previewViewer, SLOT(zoom2Fit()));
d->m_clearSelBtn = new QToolButton(this);
d->m_clearSelBtn->setAutoRaise(true);
- d->m_clearSelBtn->setIcon(KIcon("edit-clear"));
+ d->m_clearSelBtn->setIcon(QIcon::fromTheme("edit-clear"));
d->m_clearSelBtn->setToolTip(i18n("Clear Selections"));
connect(d->m_clearSelBtn, SIGNAL(clicked()), d->m_previewViewer, SLOT(clearSelections()));
d->m_prevBtn = new QPushButton(this);
- d->m_prevBtn->setIcon(KIcon("document-import"));
+ d->m_prevBtn->setIcon(QIcon::fromTheme("document-import"));
d->m_prevBtn->setToolTip(i18n("Scan Preview Image"));
d->m_prevBtn->setText(i18nc("Preview button text", "Preview"));
connect(d->m_prevBtn, SIGNAL(clicked()), d, SLOT(startPreviewScan()));
d->m_scanBtn = new QPushButton(this);
- d->m_scanBtn->setIcon(KIcon("document-save"));
+ d->m_scanBtn->setIcon(QIcon::fromTheme("document-save"));
d->m_scanBtn->setToolTip(i18n("Scan Final Image"));
d->m_scanBtn->setText(i18nc("Final scan button text", "Scan"));
d->m_scanBtn->setFocus(Qt::OtherFocusReason);
@@ -289,9 +286,12 @@ QString KSaneWidget::selectDevice(QWidget* parent)
QPointer<KSaneDeviceDialog> sel = new KSaneDeviceDialog(parent);
// sel.setDefault(prev_backend); // set default scanner - perhaps application using libksane should remember that
- if(sel->exec() == KDialog::Accepted) {
- selected_name = sel->getSelectedName();
- }
+
+ Q_ASSERT_X(false, "KSaneWidget::selectDevice", "FIXME KF5"); // FIXME KF5
+ //if(sel->exec() == KDialog::Accepted) {
+ // selected_name = sel->getSelectedName();
+ //}
+
delete sel;
return selected_name;
}
@@ -300,11 +300,11 @@ void KSaneWidget::initGetDeviceList() const
{
// update the device list if needed to get the vendor and model info
if (d->m_findDevThread->devicesList().size() == 0) {
- //kDebug() << "initGetDeviceList() starting thread...";
+ //qDebug() << "initGetDeviceList() starting thread...";
d->m_findDevThread->start();
}
else {
- //kDebug() << "initGetDeviceList() have existing data...";
+ //qDebug() << "initGetDeviceList() have existing data...";
d->signalDevListUpdate();
}
}
@@ -389,7 +389,7 @@ bool KSaneWidget::openDevice(const QString &deviceName)
}
if (status != SANE_STATUS_GOOD) {
- kDebug() << "sane_open(\"" << deviceName << "\", &handle) failed! status = " << sane_strstatus(status);
+ qDebug() << "sane_open(\"" << deviceName << "\", &handle) failed! status = " << sane_strstatus(status);
d->m_auth->clearDeviceAuth(d->m_devName);
d->m_devName.clear();
return false;
@@ -456,12 +456,12 @@ bool KSaneWidget::openDevice(const QString &deviceName)
// do the connections of the option parameters
for (i=1; i<d->m_optList.size(); ++i) {
- //kDebug() << d->m_optList.at(i)->name();
+ //qDebug() << 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()) {
- //kDebug() << d->m_optList.at(i)->name() << " needs polling";
+ //qDebug() << 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) {
@@ -617,7 +617,7 @@ QImage KSaneWidget::toQImageSilent(const QByteArray &data,
}
case FormatNone:
default:
- kDebug() << "Unsupported conversion";
+ qDebug() << "Unsupported conversion";
break;
}
float dpm = currentDPI() * (1000.0 / 25.4);
@@ -804,7 +804,7 @@ bool KSaneWidget::setOptVal(const QString &option, const QString &value)
void KSaneWidget::setScanButtonText(const QString &scanLabel)
{
if (d->m_scanBtn == 0) {
- kError() << "setScanButtonText was called before KSaneWidget was initialized";
+ qCritical() << "setScanButtonText was called before KSaneWidget was initialized";
return;
}
d->m_scanBtn->setText(scanLabel);
@@ -813,7 +813,7 @@ void KSaneWidget::setScanButtonText(const QString &scanLabel)
void KSaneWidget::setPreviewButtonText(const QString &previewLabel)
{
if (d->m_scanBtn == 0) {
- kError() << "setPreviewButtonText was called before KSaneWidget was initialized";
+ qCritical() << "setPreviewButtonText was called before KSaneWidget was initialized";
return;
}
d->m_prevBtn->setText(previewLabel);
diff --git a/libksane/ksane_widget_private.cpp b/libksane/ksane_widget_private.cpp
index 1fdb498..ca3547a 100644
--- a/libksane/ksane_widget_private.cpp
+++ b/libksane/ksane_widget_private.cpp
@@ -7,6 +7,7 @@
*
* Copyright (C) 2007-2008 by Kare Sars <kare dot sars at iki dot fi>
* Copyright (C) 2007-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -36,9 +37,9 @@
#include <QScrollBar>
#include <QList>
#include <QLabel>
-
-// KDE includes
-#include <KPushButton>
+#include <QPushButton>
+#include <QMessageBox>
+#include <QDebug>
#define SCALED_PREVIEW_MAX_SIDE 400
@@ -146,7 +147,7 @@ void KSaneWidgetPrivate::devListUpdated()
const QList<KSaneWidget::DeviceInfo> list = m_findDevThread->devicesList();
if (list.size() == 0) return;
for (int i=0; i<list.size(); i++) {
- kDebug() << list[i].name;
+ qDebug() << list[i].name;
if (list[i].name == m_devName) {
m_vendor = list[i].vendor;
m_model = list[i].model;
@@ -588,10 +589,10 @@ void KSaneWidgetPrivate::setTLX(float ftlx)
float max, ratio;
- //kDebug() << "setTLX " << ftlx;
+ //qDebug() << "setTLX " << ftlx;
m_optBrX->getMaxValue(max);
ratio = ftlx / max;
- //kDebug() << " -> " << ratio;
+ //qDebug() << " -> " << ratio;
m_previewViewer->setTLX(ratio);
}
@@ -604,10 +605,10 @@ void KSaneWidgetPrivate::setTLY(float ftly)
float max, ratio;
- //kDebug() << "setTLY " << ftly;
+ //qDebug() << "setTLY " << ftly;
m_optBrY->getMaxValue(max);
ratio = ftly / max;
- //kDebug() << " -> " << ratio;
+ //qDebug() << " -> " << ratio;
m_previewViewer->setTLY(ratio);
}
@@ -620,10 +621,10 @@ void KSaneWidgetPrivate::setBRX(float fbrx)
float max, ratio;
- //kDebug() << "setBRX " << fbrx;
+ //qDebug() << "setBRX " << fbrx;
m_optBrX->getMaxValue(max);
ratio = fbrx / max;
- //kDebug() << " -> " << ratio;
+ //qDebug() << " -> " << ratio;
m_previewViewer->setBRX(ratio);
}
@@ -636,10 +637,10 @@ void KSaneWidgetPrivate::setBRY(float fbry)
float max, ratio;
- //kDebug() << "setBRY " << fbry;
+ //qDebug() << "setBRY " << fbry;
m_optBrY->getMaxValue(max);
ratio = fbry / max;
- //kDebug() << " -> " << ratio;
+ //qDebug() << " -> " << ratio;
m_previewViewer->setBRY(ratio);
}
@@ -657,7 +658,7 @@ void KSaneWidgetPrivate::updatePreviewSize()
m_optBrY->getMaxValue(max_y);
}
if ((max_x == m_previewWidth) && (max_y == m_previewHeight)) {
- //kDebug() << "no preview size change";
+ //qDebug() << "no preview size change";
return;
}
@@ -753,7 +754,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) {
- kDebug() << "sane_get_parameters=" << sane_strstatus(status);
+ qDebug() << "sane_get_parameters=" << sane_strstatus(status);
previewScanDone();
return;
}
@@ -769,7 +770,7 @@ void KSaneWidgetPrivate::startPreviewScan()
// This is a security measure for broken backends
m_optRes->getMinValue(dpi);
m_optRes->setValue(dpi);
- kDebug() << "Setting minimum DPI value for a broken back-end";
+ qDebug() << "Setting minimum DPI value for a broken back-end";
}
}
}
@@ -920,7 +921,7 @@ void KSaneWidgetPrivate::oneFinalScanDone()
if (source.contains("Automatic Document Feeder")) {
// in batch mode only one area can be scanned per page
- //kDebug() << "source == \"Automatic Document Feeder\"";
+ //qDebug() << "source == \"Automatic Document Feeder\"";
m_updProgressTmr.start();
m_scanThread->start();
return;
@@ -929,14 +930,14 @@ void KSaneWidgetPrivate::oneFinalScanDone()
// Check if we have a "wait for button" batch scanning
if (m_optWaitForBtn) {
- kDebug() << m_optWaitForBtn->name();
+ qDebug() << m_optWaitForBtn->name();
QString wait;
m_optWaitForBtn->getValue(wait);
- kDebug() << "wait ==" << wait;
+ qDebug() << "wait ==" << wait;
if (wait == "true") {
// in batch mode only one area can be scanned per page
- //kDebug() << "source == \"Automatic Document Feeder\"";
+ //qDebug() << "source == \"Automatic Document Feeder\"";
m_updProgressTmr.start();
m_scanThread->start();
return;
@@ -946,7 +947,7 @@ void KSaneWidgetPrivate::oneFinalScanDone()
// not batch scan, call sane_cancel to be able to change parameters.
sane_cancel(m_saneHandle);
- //kDebug() << "index=" << m_selIndex << "size=" << m_previewViewer->selListSize();
+ //qDebug() << "index=" << m_selIndex << "size=" << m_previewViewer->selListSize();
// check if we have multiple selections.
if (m_previewViewer->selListSize() > m_selIndex)
{
@@ -1111,10 +1112,10 @@ void KSaneWidgetPrivate::alertUser(int type, const QString &strStatus)
if (q->receivers(SIGNAL(userMessage(int,QString))) == 0) {
switch (type) {
case KSaneWidget::ErrorGeneral:
- KMessageBox::sorry(0, strStatus);
+ QMessageBox::critical(nullptr, "General Error", strStatus);
break;
default:
- KMessageBox::information(0, strStatus);
+ QMessageBox::information(nullptr, "Information", strStatus);
break;
}
}
diff --git a/libksane/ksane_widget_private.h b/libksane/ksane_widget_private.h
index 27b16f5..f21ab97 100644
--- a/libksane/ksane_widget_private.h
+++ b/libksane/ksane_widget_private.h
@@ -44,11 +44,6 @@ extern "C"
#include <QTabWidget>
#include <QPushButton>
-#include <KLocale>
-#include <KDebug>
-#include <KMessageBox>
-#include <KToolBar>
-
#include "ksane_widget.h"
#include "ksane_option.h"
#include "ksane_viewer.h"
diff --git a/libksane/options/ksane_opt_button.cpp b/libksane/options/ksane_opt_button.cpp
index fe8513d..493204c 100644
--- a/libksane/options/ksane_opt_button.cpp
+++ b/libksane/options/ksane_opt_button.cpp
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2009 by Kare Sars <kare dot sars at iki dot fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,15 +25,12 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================ */
-// Local includes
+
#include "ksane_opt_button.h"
-#include "ksane_opt_button.moc"
#include "ksane_button.h"
-// KDE includes
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
namespace KSaneIface
{
@@ -49,7 +47,7 @@ void KSaneOptButton::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
- kDebug() << "This is a bug";
+ qDebug() << "This is a bug";
m_widget = new KSaneOptionWidget(parent, "");
return;
}
diff --git a/libksane/options/ksane_opt_checkbox.cpp b/libksane/options/ksane_opt_checkbox.cpp
index 60451ac..7fe5aa1 100644
--- a/libksane/options/ksane_opt_checkbox.cpp
+++ b/libksane/options/ksane_opt_checkbox.cpp
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2009 by Kare Sars <kare dot sars at iki dot fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,12 +31,9 @@
#include "labeled_checkbox.h"
-// Qt includes
#include <QtCore/QVarLengthArray>
-// KDE includes
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
namespace KSaneIface
{
@@ -52,7 +50,7 @@ void KSaneOptCheckBox::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
- kDebug() << "This is a bug";
+ qDebug() << "This is a bug";
m_widget = new KSaneOptionWidget(parent, "");
return;
}
diff --git a/libksane/options/ksane_opt_combo.cpp b/libksane/options/ksane_opt_combo.cpp
index e48e2d1..fe93b68 100644
--- a/libksane/options/ksane_opt_combo.cpp
+++ b/libksane/options/ksane_opt_combo.cpp
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2009 by Kare Sars <kare dot sars at iki dot fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,19 +25,15 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================ */
-// Local includes
+
#include "ksane_opt_combo.h"
-#include "ksane_opt_combo.moc"
#include "labeled_combo.h"
-// Qt includes
#include <QtCore/QVarLengthArray>
-// KDE includes
-#include <kicon.h>
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
+#include <QIcon>
namespace KSaneIface
{
@@ -93,13 +90,13 @@ void KSaneOptCombo::readOption()
m_combo->clear();
m_combo->setLabelText(i18n(m_optDesc->title));
m_combo->addItems(m_strList);
- m_combo->setIcon(KIcon("color"), getSaneComboString((unsigned char*)SANE_VALUE_SCAN_MODE_COLOR));
- m_combo->setIcon(KIcon("gray-scale"),
+ m_combo->setIcon(QIcon::fromTheme("color"), getSaneComboString((unsigned char*)SANE_VALUE_SCAN_MODE_COLOR));
+ m_combo->setIcon(QIcon::fromTheme("gray-scale"),
getSaneComboString((unsigned char*)SANE_VALUE_SCAN_MODE_GRAY));
- m_combo->setIcon(KIcon("black-white"),
+ m_combo->setIcon(QIcon::fromTheme("black-white"),
getSaneComboString((unsigned char*)SANE_VALUE_SCAN_MODE_LINEART));
// The epkowa/epson backend uses "Binary" which is the same as "Lineart"
- m_combo->setIcon(KIcon("black-white"), i18n(tmp_binary));
+ m_combo->setIcon(QIcon::fromTheme("black-white"), i18n(tmp_binary));
// set the previous value
m_combo->setCurrentText(saved);
@@ -210,7 +207,7 @@ void KSaneOptCombo::comboboxChangedIndex(int i)
dataPtr = (void *)m_optDesc->constraint.string_list[i];
break;
default:
- kDebug() << "can not handle type:" << m_optDesc->type;
+ qDebug() << "can not handle type:" << m_optDesc->type;
return;
}
writeData(dataPtr);
@@ -236,7 +233,7 @@ bool KSaneOptCombo::getMinValue(float &val)
}
break;
default:
- kDebug() << "can not handle type:" << m_optDesc->type;
+ qDebug() << "can not handle type:" << m_optDesc->type;
return false;
}
return true;
@@ -252,7 +249,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) {
- kDebug() << m_optDesc->name << "sane_control_option returned" << status;
+ qDebug() << m_optDesc->name << "sane_control_option returned" << status;
return false;
}
@@ -265,7 +262,7 @@ bool KSaneOptCombo::getValue(float &val)
val = SANE_UNFIX(toSANE_Word(data.data()));
return true;
default:
- kDebug() << "Type" << m_optDesc->type << "not supported!";
+ qDebug() << "Type" << m_optDesc->type << "not supported!";
break;
}
return false;
@@ -310,7 +307,7 @@ bool KSaneOptCombo::setValue(float value)
readValue();
return (minDiff < 1.0);
default:
- kDebug() << "can not handle type:" << m_optDesc->type;
+ qDebug() << "can not handle type:" << m_optDesc->type;
break;
}
return false;
@@ -367,7 +364,7 @@ bool KSaneOptCombo::setValue(const QString &val)
if (m_optDesc->constraint.string_list[i] == 0) return false;
break;
default:
- kDebug() << "can only handle SANE_TYPE: INT, FIXED and STRING";
+ qDebug() << "can only handle SANE_TYPE: INT, FIXED and STRING";
return false;
}
writeData(data_ptr);
diff --git a/libksane/options/ksane_opt_entry.cpp b/libksane/options/ksane_opt_entry.cpp
index cdc1b10..fdcda8a 100644
--- a/libksane/options/ksane_opt_entry.cpp
+++ b/libksane/options/ksane_opt_entry.cpp
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2009 by Kare Sars <kare dot sars at iki dot fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,12 +31,9 @@
#include "labeled_entry.h"
-// Qt includes
#include <QtCore/QVarLengthArray>
-// KDE includes
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
namespace KSaneIface
{
@@ -52,7 +50,7 @@ void KSaneOptEntry::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
- kDebug() << "This is a bug";
+ qDebug() << "This is a bug";
m_widget = new KSaneOptionWidget(parent, "");
return;
}
diff --git a/libksane/options/ksane_opt_fslider.cpp b/libksane/options/ksane_opt_fslider.cpp
index 460cbe3..7857314 100644
--- a/libksane/options/ksane_opt_fslider.cpp
+++ b/libksane/options/ksane_opt_fslider.cpp
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2009 by Kare Sars <kare dot sars at iki dot fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,12 +31,9 @@
#include "labeled_fslider.h"
-// Qt includes
#include <QtCore/QVarLengthArray>
-// KDE includes
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
static const float FIXED_MAX = 32767.0;
static const float FIXED_MIN =-32768.0;
@@ -112,7 +110,7 @@ void KSaneOptFSlider::sliderChanged(float val)
if (((val-m_fVal) >= m_minChange) || ((m_fVal-val) >= m_minChange)) {
unsigned char data[4];
SANE_Word fixed;
- //kDebug() <<m_optDesc->name << fVal << "!=" << val;
+ //qDebug() <<m_optDesc->name << fVal << "!=" << val;
m_fVal = val;
fixed = SANE_FIX(val);
fromSANE_Word(data, fixed);
diff --git a/libksane/options/ksane_opt_gamma.cpp b/libksane/options/ksane_opt_gamma.cpp
index be39f38..5247bd3 100644
--- a/libksane/options/ksane_opt_gamma.cpp
+++ b/libksane/options/ksane_opt_gamma.cpp
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2009 by Kare Sars <kare dot sars at iki dot fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,18 +25,14 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================ */
-// Local includes
+
#include "ksane_opt_gamma.h"
-#include "ksane_opt_gamma.moc"
#include "labeled_gamma.h"
-// Qt includes
#include <QtCore/QVarLengthArray>
-// KDE includes
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
namespace KSaneIface
{
@@ -52,7 +49,7 @@ void KSaneOptGamma::createWidget(QWidget *parent)
readOption();
if (!m_optDesc) {
- kDebug() << "This is a bug";
+ qDebug() << "This is a bug";
m_widget = new KSaneOptionWidget(parent, "");
return;
}
diff --git a/libksane/options/ksane_opt_slider.cpp b/libksane/options/ksane_opt_slider.cpp
index f80e7e0..90d236c 100644
--- a/libksane/options/ksane_opt_slider.cpp
+++ b/libksane/options/ksane_opt_slider.cpp
@@ -25,18 +25,14 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================ */
-// Local includes
+
#include "ksane_opt_slider.h"
-#include "ksane_opt_slider.moc"
#include "labeled_slider.h"
-// Qt includes
#include <QtCore/QVarLengthArray>
-// KDE includes
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
static const int KSW_INT_MAX = 2147483647;
static const int KSW_INT_MIN = -2147483647-1; // prevent warning
diff --git a/libksane/options/ksane_option.cpp b/libksane/options/ksane_option.cpp
index a63affb..7219af0 100644
--- a/libksane/options/ksane_option.cpp
+++ b/libksane/options/ksane_option.cpp
@@ -25,13 +25,10 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================ */
-// Local includes
+
#include "ksane_option.h"
-#include "ksane_option.moc"
-// KDE includes
-#include <KDebug>
-#include <KLocale>
+#include <QDebug>
#include "ksane_option_widget.h"
@@ -111,7 +108,7 @@ bool KSaneOption::needsPolling()
if (!m_optDesc) return false;
if ((m_optDesc->cap & SANE_CAP_SOFT_DETECT) && !(m_optDesc->cap & SANE_CAP_SOFT_SELECT)) {
- kDebug() << name() << "optDesc->cap =" << m_optDesc->cap;
+ qDebug() << name() << "optDesc->cap =" << m_optDesc->cap;
return true;
}
@@ -135,13 +132,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) {
- kDebug() << m_optDesc->name << "sane_control_option returned:" << sane_strstatus(status);
+ qDebug() << m_optDesc->name << "sane_control_option returned:" << sane_strstatus(status);
// write failed. re read the current setting
readValue();
return false;
}
if ((res & SANE_INFO_INEXACT) && (m_widget != 0)) {
- //kDebug() << "write was inexact. Reload value just in case...";
+ //qDebug() << "write was inexact. Reload value just in case...";
readValue();
}
@@ -216,7 +213,7 @@ bool KSaneOption::storeCurrentData()
m_data = (unsigned char *)malloc(m_optDesc->size);
status = sane_control_option (m_handle, m_index, SANE_ACTION_GET_VALUE, m_data, &res);
if (status != SANE_STATUS_GOOD) {
- kDebug() << m_optDesc->name << "sane_control_option returned" << status;
+ qDebug() << m_optDesc->name << "sane_control_option returned" << status;
return false;
}
return true;
@@ -249,15 +246,15 @@ KSaneOption::KSaneOptType KSaneOption::optionType(const SANE_Option_Descriptor *
return TYPE_CHECKBOX;
case SANE_TYPE_INT:
if (optDesc->size == sizeof(SANE_Word)) return TYPE_SLIDER;
- kDebug() << "Can not handle:"<< optDesc->title;
- kDebug() << "SANE_CONSTRAINT_NONE && SANE_TYPE_INT";
- kDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
+ qDebug() << "Can not handle:"<< optDesc->title;
+ qDebug() << "SANE_CONSTRAINT_NONE && SANE_TYPE_INT";
+ qDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
break;
case SANE_TYPE_FIXED:
if (optDesc->size == sizeof(SANE_Word)) return TYPE_F_SLIDER;
- kDebug() << "Can not handle:"<< optDesc->title;
- kDebug() << "SANE_CONSTRAINT_NONE && SANE_TYPE_FIXED";
- kDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
+ qDebug() << "Can not handle:"<< optDesc->title;
+ qDebug() << "SANE_CONSTRAINT_NONE && SANE_TYPE_FIXED";
+ qDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
break;
case SANE_TYPE_BUTTON:
return TYPE_BUTTON;
@@ -281,20 +278,20 @@ KSaneOption::KSaneOptType KSaneOption::optionType(const SANE_Option_Descriptor *
{
return TYPE_GAMMA;
}
- kDebug() << "Can not handle:"<< optDesc->title;
- kDebug() << "SANE_CONSTRAINT_RANGE && SANE_TYPE_INT && !SANE_NAME_GAMMA_VECTOR...";
- kDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
+ qDebug() << "Can not handle:"<< optDesc->title;
+ qDebug() << "SANE_CONSTRAINT_RANGE && SANE_TYPE_INT && !SANE_NAME_GAMMA_VECTOR...";
+ qDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
break;
case SANE_TYPE_FIXED:
if (optDesc->size == sizeof(SANE_Word)) return TYPE_F_SLIDER;
- kDebug() << "Can not handle:"<< optDesc->title;
- kDebug() << "SANE_CONSTRAINT_RANGE && SANE_TYPE_FIXED";
- kDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
- kDebug() << "Analog Gamma vector?";
+ qDebug() << "Can not handle:"<< optDesc->title;
+ qDebug() << "SANE_CONSTRAINT_RANGE && SANE_TYPE_FIXED";
+ qDebug() << "size" << optDesc->size<< "!= sizeof(SANE_Word)";
+ qDebug() << "Analog Gamma vector?";
break;
case SANE_TYPE_STRING:
- kDebug() << "Can not handle:" << optDesc->title;
- kDebug() << "SANE_CONSTRAINT_RANGE && SANE_TYPE_STRING";
+ qDebug() << "Can not handle:" << optDesc->title;
+ qDebug() << "SANE_CONSTRAINT_RANGE && SANE_TYPE_STRING";
return TYPE_DETECT_FAIL;
case SANE_TYPE_BUTTON:
return TYPE_BUTTON;
diff --git a/libksane/splittercollapser.cpp b/libksane/splittercollapser.cpp
index e4395d0..5cdaabe 100644
--- a/libksane/splittercollapser.cpp
+++ b/libksane/splittercollapser.cpp
@@ -23,9 +23,7 @@ License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "splittercollapser.h"
-#include "splittercollapser.moc"
-// Qt
#include <QApplication>
#include <QEvent>
#include <QMouseEvent>
@@ -34,10 +32,8 @@ License along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QStylePainter>
#include <QTimeLine>
-// KDE
-#include <kdebug.h>
+#include <QDebug>
-// Local
namespace KSaneIface {
diff --git a/libksane/widgets/ksane_button.cpp b/libksane/widgets/ksane_button.cpp
index 74f9e9a..662ff8f 100644
--- a/libksane/widgets/ksane_button.cpp
+++ b/libksane/widgets/ksane_button.cpp
@@ -22,13 +22,9 @@
*
* ============================================================ */
-// Local includes
#include "ksane_button.h"
#include "ksane_button.moc"
-// Qt includes
-#include <KDebug>
-
namespace KSaneIface
{
diff --git a/libksane/widgets/ksane_option_widget.cpp b/libksane/widgets/ksane_option_widget.cpp
index 25c4863..af1b475 100644
--- a/libksane/widgets/ksane_option_widget.cpp
+++ b/libksane/widgets/ksane_option_widget.cpp
@@ -24,13 +24,10 @@
*
* ============================================================ */
-// Local includes
#include "ksane_option_widget.h"
#include "ksane_option_widget.moc"
-// Qt includes
-#include <KDebug>
-#include <KLocale>
+#include <KLocalizedString>
namespace KSaneIface
{
diff --git a/libksane/widgets/labeled_combo.cpp b/libksane/widgets/labeled_combo.cpp
index 6ac958d..73fec69 100644
--- a/libksane/widgets/labeled_combo.cpp
+++ b/libksane/widgets/labeled_combo.cpp
@@ -27,12 +27,9 @@
#include "labeled_combo.h"
#include "labeled_combo.moc"
-// Qt includes
#include <QLabel>
-// KDE includes
-#include <KComboBox>
-#include <KDebug>
+#include <QComboBox>
namespace KSaneIface
{
@@ -40,7 +37,7 @@ namespace KSaneIface
LabeledCombo::LabeledCombo(QWidget *parent, const QString& ltext, const QStringList& list)
: KSaneOptionWidget(parent, ltext)
{
- m_combo = new KComboBox(this);
+ m_combo = new QComboBox(this);
m_combo->addItems(list);
m_label->setBuddy(m_combo);
@@ -97,5 +94,8 @@ void LabeledCombo::setCurrentIndex(int i)
{
m_combo->setCurrentIndex(i);
}
+void LabeledCombo::clear() {
+ m_combo->clear();
+}
} // NameSpace KSaneIface
diff --git a/libksane/widgets/labeled_combo.h b/libksane/widgets/labeled_combo.h
index 4600b00..12716c9 100644
--- a/libksane/widgets/labeled_combo.h
+++ b/libksane/widgets/labeled_combo.h
@@ -29,8 +29,7 @@
#include "ksane_option_widget.h"
-// KDE includes
-#include <KComboBox>
+class QComboBox;
namespace KSaneIface
{
@@ -62,7 +61,7 @@ public Q_SLOTS:
/**
* Remove all string entries
*/
- void clear() { m_combo->clear(); }
+ void clear();
/**
* If the given string can be found in the comobox, activate that entry.
@@ -92,7 +91,7 @@ Q_SIGNALS:
void activated(int);
private:
- KComboBox *m_combo;
+ QComboBox *m_combo;
};
} // NameSpace KSaneIface
diff --git a/libksane/widgets/labeled_entry.cpp b/libksane/widgets/labeled_entry.cpp
index e6c164e..b6a29da 100644
--- a/libksane/widgets/labeled_entry.cpp
+++ b/libksane/widgets/labeled_entry.cpp
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2007-2011 by Kare Sars <kare.sars@iki .fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -32,17 +33,18 @@
// Qt includes
#include <QHBoxLayout>
#include <QLabel>
-#include <KLineEdit>
-#include <KLocale>
+#include <QLineEdit>
#include <QPushButton>
+#include <KLocalizedString>
+
namespace KSaneIface
{
LabeledEntry::LabeledEntry(QWidget *parent, const QString& ltext)
: KSaneOptionWidget(parent, ltext)
{
- m_entry = new KLineEdit(this);
+ m_entry = new QLineEdit(this);
m_reset = new QPushButton(this);
m_reset->setText(i18nc("Label for button to reset text in a KLineEdit", "Reset"));
m_set = new QPushButton(this);
diff --git a/libksane/widgets/labeled_entry.h b/libksane/widgets/labeled_entry.h
index 78aa4a1..c1e1367 100644
--- a/libksane/widgets/labeled_entry.h
+++ b/libksane/widgets/labeled_entry.h
@@ -6,6 +6,7 @@
* Description : Sane interface for KDE
*
* Copyright (C) 2007-2011 by Kare Sars <kare.sars@iki .fi>
+ * Copyright (C) 2014 by Gregor Mitsch: port to KDE5 frameworks
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -35,7 +36,7 @@
*/
class QPushButton;
-class KLineEdit;
+class QLineEdit;
namespace KSaneIface
{
@@ -70,7 +71,7 @@ Q_SIGNALS:
private:
- KLineEdit *m_entry;
+ QLineEdit *m_entry;
QPushButton *m_set;
QPushButton *m_reset;
QString m_eText;
diff --git a/libksane/widgets/labeled_fslider.cpp b/libksane/widgets/labeled_fslider.cpp
index 2f2dad1..9ba0fec 100644
--- a/libksane/widgets/labeled_fslider.cpp
+++ b/libksane/widgets/labeled_fslider.cpp
@@ -100,8 +100,8 @@ void LabeledFSlider::setSuffix(const QString &text)
void LabeledFSlider::setRange(float min, float max)
{
- //kDebug() << "min,max(" << m_spinb->minimum() << " - " << m_spinb->maximum();
- //kDebug() << ") -> (" << min << " - " << max << ")" << std::endl;
+ //qDebug() << "min,max(" << m_spinb->minimum() << " - " << m_spinb->maximum();
+ //qDebug() << ") -> (" << min << " - " << max << ")" << std::endl;
int imin=TO_FIX(min);
int imax=TO_FIX(max);
m_slider->setRange(imin, imax);