[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [libksane] src: Use nullptr
From: Alexander Volkov <null () kde ! org>
Date: 2018-08-20 16:31:26
Message-ID: E1frn5S-0007wu-0S () code ! kde ! org
[Download RAW message or body]
Git commit 114d7e8b35d9c544e58b32c67bb07d60d2ef484d by Alexander Volkov.
Committed on 20/08/2018 at 15:20.
Pushed by volkov into branch 'master'.
Use nullptr
M +2 -2 src/ksaneauth.cpp
M +1 -1 src/ksanedevicedialog.h
M +4 -4 src/ksanefinddevicesthread.cpp
M +1 -1 src/ksaneviewer.cpp
M +1 -1 src/ksaneviewer.h
M +7 -7 src/ksanewidget.cpp
M +2 -2 src/ksanewidget.h
M +97 -97 src/ksanewidget_p.cpp
M +1 -1 src/options/ksaneoptbutton.cpp
M +1 -1 src/options/ksaneoptcheckbox.cpp
M +7 -7 src/options/ksaneoptcombo.cpp
M +2 -2 src/options/ksaneoptentry.cpp
M +2 -2 src/options/ksaneoptfslider.cpp
M +1 -1 src/options/ksaneoptgamma.cpp
M +8 -8 src/options/ksaneoption.cpp
M +2 -2 src/options/ksaneoptslider.cpp
M +1 -1 src/widgets/labeledgamma.cpp
https://commits.kde.org/libksane/114d7e8b35d9c544e58b32c67bb07d60d2ef484d
diff --git a/src/ksaneauth.cpp b/src/ksaneauth.cpp
index 5192e10..eff4820 100644
--- a/src/ksaneauth.cpp
+++ b/src/ksaneauth.cpp
@@ -36,7 +36,7 @@
namespace KSaneIface
{
-static KSaneAuth *s_instance = 0;
+static KSaneAuth *s_instance = nullptr;
static QMutex s_mutex;
struct KSaneAuth::Private {
@@ -53,7 +53,7 @@ KSaneAuth *KSaneAuth::getInstance()
{
s_mutex.lock();
- if (s_instance == 0) {
+ if (s_instance == nullptr) {
s_instance = new KSaneAuth();
}
s_mutex.unlock();
diff --git a/src/ksanedevicedialog.h b/src/ksanedevicedialog.h
index 52e7a43..f981188 100644
--- a/src/ksanedevicedialog.h
+++ b/src/ksanedevicedialog.h
@@ -50,7 +50,7 @@ class KSaneDeviceDialog : public QDialog
Q_OBJECT
public:
- KSaneDeviceDialog(QWidget *parent = 0);
+ KSaneDeviceDialog(QWidget *parent = nullptr);
~KSaneDeviceDialog();
QString getSelectedName() const;
diff --git a/src/ksanefinddevicesthread.cpp b/src/ksanefinddevicesthread.cpp
index c3f3432..96afe6f 100644
--- a/src/ksanefinddevicesthread.cpp
+++ b/src/ksanefinddevicesthread.cpp
@@ -42,14 +42,14 @@ extern "C"
namespace KSaneIface
{
-static FindSaneDevicesThread *s_instancesane = 0;
+static FindSaneDevicesThread *s_instancesane = nullptr;
static QMutex s_mutexsane;
FindSaneDevicesThread *FindSaneDevicesThread::getInstance()
{
s_mutexsane.lock();
- if (s_instancesane == 0) {
+ if (s_instancesane == nullptr) {
s_instancesane = new FindSaneDevicesThread();
}
s_mutexsane.unlock();
@@ -57,7 +57,7 @@ FindSaneDevicesThread *FindSaneDevicesThread::getInstance()
return s_instancesane;
}
-FindSaneDevicesThread::FindSaneDevicesThread() : QThread(0)
+FindSaneDevicesThread::FindSaneDevicesThread() : QThread(nullptr)
{
}
@@ -83,7 +83,7 @@ void FindSaneDevicesThread::run()
int i = 0;
KSaneWidget::DeviceInfo deviceInfo;
- while (devList[i] != 0) {
+ while (devList[i] != nullptr) {
deviceInfo.name = QString::fromUtf8(devList[i]->name);
deviceInfo.vendor = QString::fromUtf8(devList[i]->vendor);
deviceInfo.model = QString::fromUtf8(devList[i]->model);
diff --git a/src/ksaneviewer.cpp b/src/ksaneviewer.cpp
index 37a738e..ec90f02 100644
--- a/src/ksaneviewer.cpp
+++ b/src/ksaneviewer.cpp
@@ -169,7 +169,7 @@ KSaneViewer::~KSaneViewer()
// ------------------------------------------------------------------------
void KSaneViewer::setQImage(QImage *img)
{
- if (img == 0) {
+ if (img == nullptr) {
return;
}
diff --git a/src/ksaneviewer.h b/src/ksaneviewer.h
index ed21e26..c7f6067 100644
--- a/src/ksaneviewer.h
+++ b/src/ksaneviewer.h
@@ -38,7 +38,7 @@ class KSaneViewer : public QGraphicsView
{
Q_OBJECT
public:
- explicit KSaneViewer(QImage *img, QWidget *parent = 0);
+ explicit KSaneViewer(QImage *img, QWidget *parent = nullptr);
~KSaneViewer();
void setQImage(QImage *img);
diff --git a/src/ksanewidget.cpp b/src/ksanewidget.cpp
index 428c992..786789f 100644
--- a/src/ksanewidget.cpp
+++ b/src/ksanewidget.cpp
@@ -322,7 +322,7 @@ bool KSaneWidget::openDevice(const QString &deviceName)
QString myFolderName = QStringLiteral("ksane");
QMap<QString, QString> wallet_entry;
- if (d->m_saneHandle != 0) {
+ if (d->m_saneHandle != nullptr) {
// this KSaneWidget already has an open device
return false;
}
@@ -415,7 +415,7 @@ bool KSaneWidget::openDevice(const QString &deviceName)
// Read the options (start with option 0 the number of parameters)
optDesc = sane_get_option_descriptor(d->m_saneHandle, 0);
- if (optDesc == 0) {
+ if (optDesc == nullptr) {
d->m_auth->clearDeviceAuth(d->m_devName);
d->m_devName.clear();
return false;
@@ -529,7 +529,7 @@ bool KSaneWidget::closeDevice()
d->m_auth->clearDeviceAuth(d->m_devName);
// else
sane_close(d->m_saneHandle);
- d->m_saneHandle = 0;
+ d->m_saneHandle = nullptr;
d->clearDeviceOptions();
// disable the interface until a new device is opened.
@@ -685,7 +685,7 @@ bool KSaneWidget::getOptVal(const QString &optname, QString \
&value) {
KSaneOption *option;
- if ((option = d->getOption(optname)) != 0) {
+ if ((option = d->getOption(optname)) != nullptr) {
return option->getValue(value);
}
// Special handling for non sane option
@@ -748,7 +748,7 @@ bool KSaneWidget::setOptVal(const QString &option, const QString \
&value) {
KSaneOption *opt;
- if ((opt = d->getOption(option)) != 0) {
+ if ((opt = d->getOption(option)) != nullptr) {
if (opt->setValue(value)) {
if ((d->m_splitGamChB) &&
(d->m_optGamR) &&
@@ -793,7 +793,7 @@ bool KSaneWidget::setOptVal(const QString &option, const QString \
&value)
void KSaneWidget::setScanButtonText(const QString &scanLabel)
{
- if (d->m_scanBtn == 0) {
+ if (d->m_scanBtn == nullptr) {
qCritical() << "setScanButtonText was called before KSaneWidget was \
initialized"; return;
}
@@ -802,7 +802,7 @@ void KSaneWidget::setScanButtonText(const QString &scanLabel)
void KSaneWidget::setPreviewButtonText(const QString &previewLabel)
{
- if (d->m_scanBtn == 0) {
+ if (d->m_scanBtn == nullptr) {
qCritical() << "setPreviewButtonText was called before KSaneWidget was \
initialized"; return;
}
diff --git a/src/ksanewidget.h b/src/ksanewidget.h
index 75f7d5c..49d9666 100644
--- a/src/ksanewidget.h
+++ b/src/ksanewidget.h
@@ -85,14 +85,14 @@ public:
/** This constructor initializes the private class variables, but the widget is \
left empty.
* The options and the preview are added with the call to openDevice(). */
- KSaneWidget(QWidget *parent = 0);
+ KSaneWidget(QWidget *parent = nullptr);
/** Standard destructor */
~KSaneWidget();
/** This helper method displays a dialog for selecting a scanner. The libsane
* device name of the selected scanner device is returned. */
- QString selectDevice(QWidget *parent = 0);
+ QString selectDevice(QWidget *parent = nullptr);
/**
* Get the list of available scanning devices. Connect to availableDevices()
diff --git a/src/ksanewidget_p.cpp b/src/ksanewidget_p.cpp
index 2785219..e3d6f58 100644
--- a/src/ksanewidget_p.cpp
+++ b/src/ksanewidget_p.cpp
@@ -49,34 +49,34 @@ KSaneWidgetPrivate::KSaneWidgetPrivate(KSaneWidget *parent):
q(parent)
{
// Device independent UI variables
- m_optsTabWidget = 0;
- m_basicOptsTab = 0;
- m_otherOptsTab = 0;
- m_zInBtn = 0;
- m_zOutBtn = 0;
- m_zSelBtn = 0;
- m_zFitBtn = 0;
- m_clearSelBtn = 0;
- m_prevBtn = 0;
- m_scanBtn = 0;
- m_cancelBtn = 0;
- m_previewViewer = 0;
+ m_optsTabWidget = nullptr;
+ m_basicOptsTab = nullptr;
+ m_otherOptsTab = nullptr;
+ m_zInBtn = nullptr;
+ m_zOutBtn = nullptr;
+ m_zSelBtn = nullptr;
+ m_zFitBtn = nullptr;
+ m_clearSelBtn = nullptr;
+ m_prevBtn = nullptr;
+ m_scanBtn = nullptr;
+ m_cancelBtn = nullptr;
+ m_previewViewer = nullptr;
m_autoSelect = true;
m_selIndex = ActiveSelection;
- m_warmingUp = 0;
- m_progressBar = 0;
+ m_warmingUp = nullptr;
+ m_progressBar = nullptr;
// scanning variables
m_isPreview = false;
- m_saneHandle = 0;
- m_previewThread = 0;
- m_scanThread = 0;
+ m_saneHandle = nullptr;
+ m_previewThread = nullptr;
+ m_scanThread = nullptr;
- m_splitGamChB = 0;
- m_commonGamma = 0;
+ m_splitGamChB = nullptr;
+ m_commonGamma = nullptr;
m_previewDPI = 0;
- m_invertColors = 0;
+ m_invertColors = nullptr;
m_previewWidth = 0;
m_previewHeight = 0;
@@ -94,24 +94,24 @@ KSaneWidgetPrivate::KSaneWidgetPrivate(KSaneWidget *parent):
void KSaneWidgetPrivate::clearDeviceOptions()
{
- m_optSource = 0;
- m_colorOpts = 0;
- m_optNegative = 0;
- m_optFilmType = 0;
- m_optMode = 0;
- m_optDepth = 0;
- m_optRes = 0;
- m_optResX = 0;
- m_optResY = 0;
- m_optTlX = 0;
- m_optTlY = 0;
- m_optBrX = 0;
- m_optBrY = 0;
- m_optGamR = 0;
- m_optGamG = 0;
- m_optGamB = 0;
- m_optPreview = 0;
- m_optWaitForBtn = 0;
+ m_optSource = nullptr;
+ m_colorOpts = nullptr;
+ m_optNegative = nullptr;
+ m_optFilmType = nullptr;
+ m_optMode = nullptr;
+ m_optDepth = nullptr;
+ m_optRes = nullptr;
+ m_optResX = nullptr;
+ m_optResY = nullptr;
+ m_optTlX = nullptr;
+ m_optTlY = nullptr;
+ m_optBrX = nullptr;
+ m_optBrY = nullptr;
+ m_optGamR = nullptr;
+ m_optGamG = nullptr;
+ m_optGamB = nullptr;
+ m_optPreview = nullptr;
+ m_optWaitForBtn = nullptr;
m_scanOngoing = false;
m_closeDevicePending = false;
@@ -124,16 +124,16 @@ void KSaneWidgetPrivate::clearDeviceOptions()
// remove the remaining layouts/widgets and read thread
delete m_basicOptsTab;
- m_basicOptsTab = 0;
+ m_basicOptsTab = nullptr;
delete m_otherOptsTab;
- m_otherOptsTab = 0;
+ m_otherOptsTab = nullptr;
delete m_previewThread;
- m_previewThread = 0;
+ m_previewThread = nullptr;
delete m_scanThread;
- m_scanThread = 0;
+ m_scanThread = nullptr;
m_devName.clear();
}
@@ -222,7 +222,7 @@ KSaneOption *KSaneWidgetPrivate::getOption(const QString &name)
return option;
}
}
- return 0;
+ return nullptr;
}
void KSaneWidgetPrivate::createOptInterface()
@@ -233,48 +233,48 @@ void KSaneWidgetPrivate::createOptInterface()
QVBoxLayout *basic_layout = new QVBoxLayout(m_basicOptsTab);
KSaneOption *option;
// Scan Source
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_SOURCE))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_SOURCE))) != nullptr) {
m_optSource = option;
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
connect(m_optSource, SIGNAL(valueChanged()), this, SLOT(checkInvert()), \
Qt::QueuedConnection); }
// film-type (note: No translation)
- if ((option = getOption(QStringLiteral("film-type"))) != 0) {
+ if ((option = getOption(QStringLiteral("film-type"))) != nullptr) {
m_optFilmType = option;
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
connect(m_optFilmType, SIGNAL(valueChanged()), this, SLOT(checkInvert()), \
Qt::QueuedConnection);
- } else if ((option = getOption(QStringLiteral(SANE_NAME_NEGATIVE))) != 0) {
+ } else if ((option = getOption(QStringLiteral(SANE_NAME_NEGATIVE))) != nullptr) \
{ m_optNegative = option;
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
}
// Scan mode
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_MODE))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_MODE))) != nullptr) {
m_optMode = option;
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
}
// Bitdepth
- if ((option = getOption(QStringLiteral(SANE_NAME_BIT_DEPTH))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_BIT_DEPTH))) != nullptr) {
m_optDepth = option;
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
}
// Threshold
- if ((option = getOption(QStringLiteral(SANE_NAME_THRESHOLD))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_THRESHOLD))) != nullptr) {
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
}
// Resolution
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_RESOLUTION))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_RESOLUTION))) != nullptr) \
{ m_optRes = option;
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
}
// These two next resolution options are a bit tricky.
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_X_RESOLUTION))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_X_RESOLUTION))) != \
nullptr) { m_optResX = option;
if (!m_optRes) {
m_optRes = m_optResX;
@@ -282,36 +282,36 @@ void KSaneWidgetPrivate::createOptInterface()
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
}
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_Y_RESOLUTION))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_Y_RESOLUTION))) != \
nullptr) { m_optResY = option;
option->createWidget(m_basicOptsTab);
basic_layout->addWidget(option->widget());
}
// save a pointer to the preview option if possible
- if ((option = getOption(QStringLiteral(SANE_NAME_PREVIEW))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_PREVIEW))) != nullptr) {
m_optPreview = option;
}
// save a pointer to the "wait-for-button" option if possible (Note: No \
translation)
- if ((option = getOption(QStringLiteral("wait-for-button"))) != 0) {
+ if ((option = getOption(QStringLiteral("wait-for-button"))) != nullptr) {
m_optWaitForBtn = option;
}
// scan area (Do not add the widgets)
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_TL_X))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_TL_X))) != nullptr) {
m_optTlX = option;
connect(option, SIGNAL(fValueRead(float)), this, SLOT(setTLX(float)));
}
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_TL_Y))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_TL_Y))) != nullptr) {
m_optTlY = option;
connect(option, SIGNAL(fValueRead(float)), this, SLOT(setTLY(float)));
}
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_BR_X))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_BR_X))) != nullptr) {
m_optBrX = option;
connect(option, SIGNAL(fValueRead(float)), this, SLOT(setBRX(float)));
}
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_BR_Y))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_BR_Y))) != nullptr) {
m_optBrY = option;
connect(option, SIGNAL(fValueRead(float)), this, SLOT(setBRY(float)));
}
@@ -323,11 +323,11 @@ void KSaneWidgetPrivate::createOptInterface()
color_lay->setContentsMargins(0, 0, 0, 0);
// Add Color correction to the color "frame"
- if ((option = getOption(QStringLiteral(SANE_NAME_BRIGHTNESS))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_BRIGHTNESS))) != nullptr) {
option->createWidget(m_colorOpts);
color_lay->addWidget(option->widget());
}
- if ((option = getOption(QStringLiteral(SANE_NAME_CONTRAST))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_CONTRAST))) != nullptr) {
option->createWidget(m_colorOpts);
color_lay->addWidget(option->widget());
}
@@ -338,23 +338,23 @@ void KSaneWidgetPrivate::createOptInterface()
QVBoxLayout *gam_frm_l = new QVBoxLayout(gamma_frm);
gam_frm_l->setContentsMargins(0, 0, 0, 0);
- if ((option = getOption(QStringLiteral(SANE_NAME_GAMMA_VECTOR_R))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_GAMMA_VECTOR_R))) != nullptr) {
m_optGamR = option;
option->createWidget(gamma_frm);
gam_frm_l->addWidget(option->widget());
}
- if ((option = getOption(QStringLiteral(SANE_NAME_GAMMA_VECTOR_G))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_GAMMA_VECTOR_G))) != nullptr) {
m_optGamG = option;
option->createWidget(gamma_frm);
gam_frm_l->addWidget(option->widget());
}
- if ((option = getOption(QStringLiteral(SANE_NAME_GAMMA_VECTOR_B))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_GAMMA_VECTOR_B))) != nullptr) {
m_optGamB = option;
option->createWidget(gamma_frm);
gam_frm_l->addWidget(option->widget());
}
- if ((m_optGamR != 0) && (m_optGamG != 0) && (m_optGamB != 0)) {
+ if ((m_optGamR != nullptr) && (m_optGamG != nullptr) && (m_optGamB != nullptr)) \
{
LabeledGamma *gamma = reinterpret_cast<LabeledGamma *>(m_optGamR->widget());
m_commonGamma = new LabeledGamma(m_colorOpts, i18n(SANE_TITLE_GAMMA_VECTOR), \
gamma->size());
@@ -375,11 +375,11 @@ void KSaneWidgetPrivate::createOptInterface()
gamma_frm->hide();
}
- if ((option = getOption(QStringLiteral(SANE_NAME_BLACK_LEVEL))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_BLACK_LEVEL))) != nullptr) {
option->createWidget(m_colorOpts);
color_lay->addWidget(option->widget());
}
- if ((option = getOption(QStringLiteral(SANE_NAME_WHITE_LEVEL))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_WHITE_LEVEL))) != nullptr) {
option->createWidget(m_colorOpts);
color_lay->addWidget(option->widget());
}
@@ -401,7 +401,7 @@ void KSaneWidgetPrivate::createOptInterface()
// add the remaining parameters
for (int i = 0; i < m_optList.size(); ++i) {
KSaneOption *option = m_optList.at(i);
- if ((option->widget() == 0) &&
+ if ((option->widget() == nullptr) &&
(option->name() != QStringLiteral(SANE_NAME_SCAN_TL_X)) &&
(option->name() != QStringLiteral(SANE_NAME_SCAN_TL_Y)) &&
(option->name() != QStringLiteral(SANE_NAME_SCAN_BR_X)) &&
@@ -487,17 +487,17 @@ void KSaneWidgetPrivate::setDefaultValues()
KSaneOption *option;
// Try to get Color mode by default
- if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_MODE))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_SCAN_MODE))) != nullptr) {
option->setValue(i18n(SANE_VALUE_SCAN_MODE_COLOR));
}
// Try to set 8 bit color
- if ((option = getOption(QStringLiteral(SANE_NAME_BIT_DEPTH))) != 0) {
+ if ((option = getOption(QStringLiteral(SANE_NAME_BIT_DEPTH))) != nullptr) {
option->setValue(8);
}
// Try to set Scan resolution to 600 DPI
- if (m_optRes != 0) {
+ if (m_optRes != nullptr) {
m_optRes->setValue(600);
}
}
@@ -552,7 +552,7 @@ void KSaneWidgetPrivate::valReload()
void KSaneWidgetPrivate::handleSelection(float tl_x, float tl_y, float br_x, float \
br_y) {
- if ((m_optTlX == 0) || (m_optTlY == 0) || (m_optBrX == 0) || (m_optBrY == 0)) {
+ if ((m_optTlX == nullptr) || (m_optTlY == nullptr) || (m_optBrX == nullptr) || \
(m_optBrY == nullptr)) { // clear the selection since we can not set one
m_previewViewer->setTLX(0);
m_previewViewer->setTLY(0);
@@ -674,10 +674,10 @@ void KSaneWidgetPrivate::updatePreviewSize()
int x, y;
// check if an update is necessary
- if (m_optBrX != 0) {
+ if (m_optBrX != nullptr) {
m_optBrX->getMaxValue(max_x);
}
- if (m_optBrY != 0) {
+ if (m_optBrY != nullptr) {
m_optBrY->getMaxValue(max_y);
}
if ((max_x == m_previewWidth) && (max_y == m_previewHeight)) {
@@ -691,17 +691,17 @@ void KSaneWidgetPrivate::updatePreviewSize()
// set the scan area to the whole area
m_previewViewer->clearSelections();
- if (m_optTlX != 0) {
+ if (m_optTlX != nullptr) {
m_optTlX->setValue(0);
}
- if (m_optTlY != 0) {
+ if (m_optTlY != nullptr) {
m_optTlY->setValue(0);
}
- if (m_optBrX != 0) {
+ if (m_optBrX != nullptr) {
m_optBrX->setValue(max_x);
}
- if (m_optBrY != 0) {
+ if (m_optBrY != nullptr) {
m_optBrY->setValue(max_y);
}
@@ -734,25 +734,25 @@ void KSaneWidgetPrivate::startPreviewScan()
float dpi;
// store the current settings of parameters to be changed
- if (m_optDepth != 0) {
+ if (m_optDepth != nullptr) {
m_optDepth->storeCurrentData();
}
- if (m_optRes != 0) {
+ if (m_optRes != nullptr) {
m_optRes->storeCurrentData();
}
- if (m_optResX != 0) {
+ if (m_optResX != nullptr) {
m_optResX->storeCurrentData();
}
- if (m_optResY != 0) {
+ if (m_optResY != nullptr) {
m_optResY->storeCurrentData();
}
- if (m_optPreview != 0) {
+ if (m_optPreview != nullptr) {
m_optPreview->storeCurrentData();
}
// check if we can modify the selection
- if ((m_optTlX != 0) && (m_optTlY != 0) &&
- (m_optBrX != 0) && (m_optBrY != 0)) {
+ if ((m_optTlX != nullptr) && (m_optTlY != nullptr) &&
+ (m_optBrX != nullptr) && (m_optBrY != nullptr)) {
// get maximums
m_optBrX->getMaxValue(max_x);
m_optBrY->getMaxValue(max_y);
@@ -767,10 +767,10 @@ void KSaneWidgetPrivate::startPreviewScan()
m_autoSelect = false;
}
- if (m_optRes != 0) {
+ if (m_optRes != nullptr) {
if (m_previewDPI >= 25.0) {
m_optRes->setValue(m_previewDPI);
- if ((m_optResY != 0) && (m_optRes->name() == \
QStringLiteral(SANE_NAME_SCAN_X_RESOLUTION))) { + if ((m_optResY != \
nullptr) && (m_optRes->name() == QStringLiteral(SANE_NAME_SCAN_X_RESOLUTION))) { \
m_optResY->setValue(m_previewDPI); }
} else {
@@ -779,7 +779,7 @@ void KSaneWidgetPrivate::startPreviewScan()
m_optRes->getMinValue(dpi);
do {
m_optRes->setValue(dpi);
- if ((m_optResY != 0) && (m_optRes->name() == \
QStringLiteral(SANE_NAME_SCAN_X_RESOLUTION))) { + if ((m_optResY != \
nullptr) && (m_optRes->name() == QStringLiteral(SANE_NAME_SCAN_X_RESOLUTION))) { \
m_optResY->setValue(dpi); }
//check what image size we would get in a scan
@@ -808,7 +808,7 @@ void KSaneWidgetPrivate::startPreviewScan()
}
// set preview option to true if possible
- if (m_optPreview != 0) {
+ if (m_optPreview != nullptr) {
m_optPreview->setValue(SANE_TRUE);
}
@@ -841,26 +841,26 @@ void KSaneWidgetPrivate::previewScanDone()
if (m_closeDevicePending) {
setBusy(false);
sane_close(m_saneHandle);
- m_saneHandle = 0;
+ m_saneHandle = nullptr;
clearDeviceOptions();
emit(q->scanDone(KSaneWidget::NoError, QStringLiteral("")));
return;
}
// restore the original settings of the changed parameters
- if (m_optDepth != 0) {
+ if (m_optDepth != nullptr) {
m_optDepth->restoreSavedData();
}
- if (m_optRes != 0) {
+ if (m_optRes != nullptr) {
m_optRes->restoreSavedData();
}
- if (m_optResX != 0) {
+ if (m_optResX != nullptr) {
m_optResX->restoreSavedData();
}
- if (m_optResY != 0) {
+ if (m_optResY != nullptr) {
m_optResY->restoreSavedData();
}
- if (m_optPreview != 0) {
+ if (m_optPreview != nullptr) {
m_optPreview->restoreSavedData();
}
@@ -895,7 +895,7 @@ void KSaneWidgetPrivate::startFinalScan()
m_selIndex = 0;
- if ((m_optTlX != 0) && (m_optTlY != 0) && (m_optBrX != 0) && (m_optBrY != 0)) {
+ if ((m_optTlX != nullptr) && (m_optTlY != nullptr) && (m_optBrX != nullptr) && \
(m_optBrY != nullptr)) { // get maximums
m_optBrX->getMaxValue(max_x);
m_optBrY->getMaxValue(max_y);
@@ -936,7 +936,7 @@ void KSaneWidgetPrivate::oneFinalScanDone()
if (m_closeDevicePending) {
setBusy(false);
sane_close(m_saneHandle);
- m_saneHandle = 0;
+ m_saneHandle = nullptr;
clearDeviceOptions();
return;
}
@@ -993,7 +993,7 @@ void KSaneWidgetPrivate::oneFinalScanDone()
//qDebug() << "index=" << m_selIndex << "size=" << \
m_previewViewer->selListSize(); // check if we have multiple selections.
if (m_previewViewer->selListSize() > m_selIndex) {
- if ((m_optTlX != 0) && (m_optTlY != 0) && (m_optBrX != 0) && (m_optBrY \
!= 0)) { + if ((m_optTlX != nullptr) && (m_optTlY != nullptr) && (m_optBrX \
!= nullptr) && (m_optBrY != nullptr)) { float x1 = 0, y1 = 0, x2 = 0, y2 = 0, max_x, \
max_y;
// get maximums
diff --git a/src/options/ksaneoptbutton.cpp b/src/options/ksaneoptbutton.cpp
index f285355..f44a0a4 100644
--- a/src/options/ksaneoptbutton.cpp
+++ b/src/options/ksaneoptbutton.cpp
@@ -36,7 +36,7 @@ namespace KSaneIface
{
KSaneOptButton::KSaneOptButton(const SANE_Handle handle, const int index)
- : KSaneOption(handle, index), m_button(0)
+ : KSaneOption(handle, index), m_button(nullptr)
{
}
diff --git a/src/options/ksaneoptcheckbox.cpp b/src/options/ksaneoptcheckbox.cpp
index 7bb40b7..c9296ac 100644
--- a/src/options/ksaneoptcheckbox.cpp
+++ b/src/options/ksaneoptcheckbox.cpp
@@ -38,7 +38,7 @@ namespace KSaneIface
{
KSaneOptCheckBox::KSaneOptCheckBox(const SANE_Handle handle, const int index)
- : KSaneOption(handle, index), m_checkbox(0), m_checked(false)
+ : KSaneOption(handle, index), m_checkbox(nullptr), m_checked(false)
{
}
diff --git a/src/options/ksaneoptcombo.cpp b/src/options/ksaneoptcombo.cpp
index 262a85b..65539bf 100644
--- a/src/options/ksaneoptcombo.cpp
+++ b/src/options/ksaneoptcombo.cpp
@@ -40,7 +40,7 @@ namespace KSaneIface
static const char tmp_binary[] = "Binary";
KSaneOptCombo::KSaneOptCombo(const SANE_Handle handle, const int index)
- : KSaneOption(handle, index), m_combo(0)
+ : KSaneOption(handle, index), m_combo(nullptr)
{
}
@@ -73,7 +73,7 @@ void KSaneOptCombo::readValue()
}
m_currentText = getSaneComboString(data.data());
- if (m_combo != 0) {
+ if (m_combo != nullptr) {
if (m_combo->currentText() != m_currentText) {
m_combo->setCurrentText(m_currentText);
emit valueChanged();
@@ -126,7 +126,7 @@ QStringList &KSaneOptCombo::genComboStringList()
break;
case SANE_TYPE_STRING:
i = 0;
- while (m_optDesc->constraint.string_list[i] != 0) {
+ while (m_optDesc->constraint.string_list[i] != nullptr) {
m_strList += getSaneComboString((unsigned char \
*)m_optDesc->constraint.string_list[i]); i++;
}
@@ -169,7 +169,7 @@ QString KSaneOptCombo::getSaneComboString(float fval)
QString KSaneOptCombo::getSaneComboString(unsigned char *data)
{
QString tmp;
- if (data == 0) {
+ if (data == nullptr) {
return QString();
}
@@ -333,7 +333,7 @@ bool KSaneOptCombo::setValue(const QString &val)
}
unsigned char data[4];
- void* data_ptr = 0;
+ void* data_ptr = nullptr;
SANE_Word fixed;
int i;
float f;
@@ -363,7 +363,7 @@ bool KSaneOptCombo::setValue(const QString &val)
break;
case SANE_TYPE_STRING:
i = 0;
- while (m_optDesc->constraint.string_list[i] != 0) {
+ while (m_optDesc->constraint.string_list[i] != nullptr) {
tmp = getSaneComboString((unsigned char \
*)m_optDesc->constraint.string_list[i]); if (val == tmp) {
data_ptr = (void *)m_optDesc->constraint.string_list[i];
@@ -371,7 +371,7 @@ bool KSaneOptCombo::setValue(const QString &val)
}
i++;
}
- if (m_optDesc->constraint.string_list[i] == 0) {
+ if (m_optDesc->constraint.string_list[i] == nullptr) {
return false;
}
break;
diff --git a/src/options/ksaneoptentry.cpp b/src/options/ksaneoptentry.cpp
index be4e7c0..c793575 100644
--- a/src/options/ksaneoptentry.cpp
+++ b/src/options/ksaneoptentry.cpp
@@ -38,7 +38,7 @@ namespace KSaneIface
{
KSaneOptEntry::KSaneOptEntry(const SANE_Handle handle, const int index)
- : KSaneOption(handle, index), m_entry(0)
+ : KSaneOption(handle, index), m_entry(nullptr)
{
}
@@ -89,7 +89,7 @@ void KSaneOptEntry::readValue()
}
m_string = QString::fromUtf8(reinterpret_cast<char *>(data.data()));
- if (m_entry != 0) {
+ if (m_entry != nullptr) {
m_entry->setText(m_string);
}
}
diff --git a/src/options/ksaneoptfslider.cpp b/src/options/ksaneoptfslider.cpp
index 92c652d..5ab8b99 100644
--- a/src/options/ksaneoptfslider.cpp
+++ b/src/options/ksaneoptfslider.cpp
@@ -41,7 +41,7 @@ namespace KSaneIface
{
KSaneOptFSlider::KSaneOptFSlider(const SANE_Handle handle, const int index)
- : KSaneOption(handle, index), m_slider(0), m_fVal(0), \
m_minChange(MIN_FIXED_STEP) + : KSaneOption(handle, index), m_slider(nullptr), \
m_fVal(0), m_minChange(MIN_FIXED_STEP) {
}
@@ -100,7 +100,7 @@ void KSaneOptFSlider::readValue()
}
m_fVal = SANE_UNFIX(toSANE_Word(data.data()));
- if (m_slider != 0) {
+ if (m_slider != nullptr) {
if (((m_slider->value() - m_fVal) >= m_minChange) ||
((m_fVal - m_slider->value()) >= m_minChange)) {
m_slider->setValue(m_fVal);
diff --git a/src/options/ksaneoptgamma.cpp b/src/options/ksaneoptgamma.cpp
index 65183df..ec67f1f 100644
--- a/src/options/ksaneoptgamma.cpp
+++ b/src/options/ksaneoptgamma.cpp
@@ -38,7 +38,7 @@ namespace KSaneIface
{
KSaneOptGamma::KSaneOptGamma(const SANE_Handle handle, const int index)
- : KSaneOption(handle, index), m_gamma(0)
+ : KSaneOption(handle, index), m_gamma(nullptr)
{
}
diff --git a/src/options/ksaneoption.cpp b/src/options/ksaneoption.cpp
index 6cdf177..a812e77 100644
--- a/src/options/ksaneoption.cpp
+++ b/src/options/ksaneoption.cpp
@@ -38,8 +38,8 @@ namespace KSaneIface
KSaneOption::KSaneOption(const SANE_Handle handle, const int index)
: QObject(), m_handle(handle), m_index(index)
{
- m_widget = 0;
- m_data = 0;
+ m_widget = nullptr;
+ m_data = nullptr;
readOption();
}
@@ -47,11 +47,11 @@ KSaneOption::~KSaneOption()
{
if (m_data) {
free(m_data);
- m_data = 0;
+ m_data = nullptr;
}
// delete the frame, just in case if no parent is set
delete m_widget;
- m_widget = 0;
+ m_widget = nullptr;
}
void KSaneOption::createWidget(QWidget *parent)
@@ -120,7 +120,7 @@ bool KSaneOption::needsPolling() const
QString KSaneOption::name() const
{
- if (m_optDesc == 0) {
+ if (m_optDesc == nullptr) {
return QStringLiteral("");
}
return QString::fromUtf8(m_optDesc->name);
@@ -142,7 +142,7 @@ bool KSaneOption::writeData(void *data)
readValue();
return false;
}
- if ((res & SANE_INFO_INEXACT) && (m_widget != 0)) {
+ if ((res & SANE_INFO_INEXACT) && (m_widget != nullptr)) {
//qDebug() << "write was inexact. Reload value just in case...";
readValue();
}
@@ -237,7 +237,7 @@ bool KSaneOption::storeCurrentData()
}
// read that current value
- if (m_data != 0) {
+ if (m_data != nullptr) {
free(m_data);
}
m_data = (unsigned char *)malloc(m_optDesc->size);
@@ -252,7 +252,7 @@ bool KSaneOption::storeCurrentData()
bool KSaneOption::restoreSavedData()
{
// check if we have saved any data
- if (m_data == 0) {
+ if (m_data == nullptr) {
return false;
}
diff --git a/src/options/ksaneoptslider.cpp b/src/options/ksaneoptslider.cpp
index 0052a32..91ca47c 100644
--- a/src/options/ksaneoptslider.cpp
+++ b/src/options/ksaneoptslider.cpp
@@ -41,7 +41,7 @@ namespace KSaneIface
{
KSaneOptSlider::KSaneOptSlider(const SANE_Handle handle, const int index)
- : KSaneOption(handle, index), m_slider(0), m_iVal(0)
+ : KSaneOption(handle, index), m_slider(nullptr), m_iVal(0)
{
}
@@ -74,7 +74,7 @@ void KSaneOptSlider::readValue()
}
m_iVal = toSANE_Word(data.data());
- if ((m_slider != 0) && (m_slider->value() != m_iVal)) {
+ if ((m_slider != nullptr) && (m_slider->value() != m_iVal)) {
m_slider->setValue(m_iVal);
}
emit fValueRead((float)m_iVal);
diff --git a/src/widgets/labeledgamma.cpp b/src/widgets/labeledgamma.cpp
index 56b648c..de2e97e 100644
--- a/src/widgets/labeledgamma.cpp
+++ b/src/widgets/labeledgamma.cpp
@@ -89,7 +89,7 @@ LabeledGamma::~LabeledGamma()
void LabeledGamma::setColor(const QColor &color)
{
- if (m_gamma_disp != 0) {
+ if (m_gamma_disp != nullptr) {
m_gamma_disp->setColor(color);
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic