Commit 94015db0 authored by Alexander Stippich's avatar Alexander Stippich
Browse files

name the options more generic

parent 3777d843
......@@ -33,13 +33,13 @@ set(ksane_SRCS
splittercollapser.cpp
ksaneauth.cpp
options/ksaneoption.cpp
options/ksaneoptbutton.cpp
options/ksaneoptcheckbox.cpp
options/ksaneoptentry.cpp
options/ksaneoptgamma.cpp
options/ksaneoptslider.cpp
options/ksaneoptfslider.cpp
options/ksaneoptcombo.cpp
options/ksaneactionoption.cpp
options/ksanebooloption.cpp
options/ksanestringoption.cpp
options/ksanegammaoption.cpp
options/ksaneintegeroption.cpp
options/ksanefloatoption.cpp
options/ksanelistoption.cpp
options/ksaneinvertoption.cpp
)
......
......@@ -35,13 +35,13 @@
#endif
#include "ksaneoption.h"
#include "ksaneoptbutton.h"
#include "ksaneoptcheckbox.h"
#include "ksaneoptcombo.h"
#include "ksaneoptentry.h"
#include "ksaneoptfslider.h"
#include "ksaneoptgamma.h"
#include "ksaneoptslider.h"
#include "ksaneactionoption.h"
#include "ksanebooloption.h"
#include "ksanelistoption.h"
#include "ksanestringoption.h"
#include "ksanefloatoption.h"
#include "ksanegammaoption.h"
#include "ksaneintegeroption.h"
#include "ksanedevicedialog.h"
#include "labeledgamma.h"
#include "ksaneinvertoption.h"
......@@ -439,25 +439,25 @@ bool KSaneWidget::openDevice(const QString &deviceName)
d->m_optList.append(new KSaneOption(d->m_saneHandle, i));
break;
case KSaneOption::TypeBool:
d->m_optList.append(new KSaneOptCheckBox(d->m_saneHandle, i));
d->m_optList.append(new KSaneBoolOption(d->m_saneHandle, i));
break;
case KSaneOption::TypeInteger:
d->m_optList.append(new KSaneOptSlider(d->m_saneHandle, i));
d->m_optList.append(new KSaneIntegerOption(d->m_saneHandle, i));
break;
case KSaneOption::TypeFloat:
d->m_optList.append(new KSaneOptFSlider(d->m_saneHandle, i));
d->m_optList.append(new KSaneFloatOption(d->m_saneHandle, i));
break;
case KSaneOption::TypeValueList:
d->m_optList.append(new KSaneOptCombo(d->m_saneHandle, i));
d->m_optList.append(new KSaneListOption(d->m_saneHandle, i));
break;
case KSaneOption::TypeString:
d->m_optList.append(new KSaneOptEntry(d->m_saneHandle, i));
d->m_optList.append(new KSaneStringOption(d->m_saneHandle, i));
break;
case KSaneOption::TypeGamma:
d->m_optList.append(new KSaneOptGamma(d->m_saneHandle, i));
d->m_optList.append(new KSaneGammaOption(d->m_saneHandle, i));
break;
case KSaneOption::TypeAction:
d->m_optList.append(new KSaneOptButton(d->m_saneHandle, i));
d->m_optList.append(new KSaneActionOption(d->m_saneHandle, i));
break;
}
}
......
......@@ -12,20 +12,20 @@
*
* ============================================================ */
#include "ksaneoptbutton.h"
#include "ksaneactionoption.h"
#include <ksane_debug.h>
namespace KSaneIface
{
KSaneOptButton::KSaneOptButton(const SANE_Handle handle, const int index)
KSaneActionOption::KSaneActionOption(const SANE_Handle handle, const int index)
: KSaneOption(handle, index)
{
m_optionType = KSaneOption::TypeAction;
}
bool KSaneOptButton::setValue(const QVariant &)
bool KSaneActionOption::setValue(const QVariant &)
{
unsigned char data[4];
writeData(data);
......
......@@ -19,12 +19,12 @@
namespace KSaneIface
{
class KSaneOptButton : public KSaneOption
class KSaneActionOption : public KSaneOption
{
Q_OBJECT
public:
KSaneOptButton(const SANE_Handle handle, const int index);
KSaneActionOption(const SANE_Handle handle, const int index);
public Q_SLOTS:
bool setValue(const QVariant &value) override;
......
......@@ -12,7 +12,7 @@
*
* ============================================================ */
// Local includes
#include "ksaneoptcheckbox.h"
#include "ksanebooloption.h"
#include <QtCore/QVarLengthArray>
......@@ -21,13 +21,13 @@
namespace KSaneIface
{
KSaneOptCheckBox::KSaneOptCheckBox(const SANE_Handle handle, const int index)
KSaneBoolOption::KSaneBoolOption(const SANE_Handle handle, const int index)
: KSaneOption(handle, index), m_checked(false)
{
m_optionType = KSaneOption::TypeBool;
}
bool KSaneOptCheckBox::setValue(const QVariant &value)
bool KSaneBoolOption::setValue(const QVariant &value)
{
if (state() == StateHidden) {
return false;
......@@ -46,7 +46,7 @@ bool KSaneOptCheckBox::setValue(const QVariant &value)
return true;
}
void KSaneOptCheckBox::readValue()
void KSaneBoolOption::readValue()
{
if (state() == StateHidden) {
return;
......@@ -68,7 +68,7 @@ void KSaneOptCheckBox::readValue()
}
}
QVariant KSaneOptCheckBox::getValue() const
QVariant KSaneBoolOption::getValue() const
{
if (state() == StateHidden) {
return QVariant();
......@@ -76,7 +76,7 @@ QVariant KSaneOptCheckBox::getValue() const
return m_checked;
}
QString KSaneOptCheckBox::getValueAsString() const
QString KSaneBoolOption::getValueAsString() const
{
if (state() == StateHidden) {
return QString();
......
......@@ -19,12 +19,12 @@
namespace KSaneIface
{
class KSaneOptCheckBox : public KSaneOption
class KSaneBoolOption : public KSaneOption
{
Q_OBJECT
public:
KSaneOptCheckBox(const SANE_Handle handle, const int index);
KSaneBoolOption(const SANE_Handle handle, const int index);
void readValue() override;
......
......@@ -12,7 +12,7 @@
*
* ============================================================ */
// Local includes
#include "ksaneoptfslider.h"
#include "ksanefloatoption.h"
#include <QVarLengthArray>
......@@ -24,13 +24,13 @@ static const float MIN_FIXED_STEP = 0.0001;
namespace KSaneIface
{
KSaneOptFSlider::KSaneOptFSlider(const SANE_Handle handle, const int index)
KSaneFloatOption::KSaneFloatOption(const SANE_Handle handle, const int index)
: KSaneOption(handle, index), m_fVal(0), m_minChange(MIN_FIXED_STEP)
{
m_optionType = KSaneOption::TypeFloat;
}
void KSaneOptFSlider::readOption()
void KSaneFloatOption::readOption()
{
KSaneOption::readOption();
......@@ -44,7 +44,7 @@ void KSaneOptFSlider::readOption()
m_minChange = step;
}
void KSaneOptFSlider::readValue()
void KSaneFloatOption::readValue()
{
if (state() == StateHidden) {
return;
......@@ -64,7 +64,7 @@ void KSaneOptFSlider::readValue()
Q_EMIT valueChanged(m_fVal);
}
bool KSaneOptFSlider::setValue(const QVariant &value)
bool KSaneFloatOption::setValue(const QVariant &value)
{
if (state() == StateHidden) {
return false;
......@@ -84,7 +84,7 @@ bool KSaneOptFSlider::setValue(const QVariant &value)
return ok;
}
QVariant KSaneOptFSlider::getMinValue() const
QVariant KSaneFloatOption::getMinValue() const
{
QVariant value;
if (m_optDesc->constraint_type == SANE_CONSTRAINT_RANGE) {
......@@ -95,7 +95,7 @@ QVariant KSaneOptFSlider::getMinValue() const
return value;
}
QVariant KSaneOptFSlider::getMaxValue() const
QVariant KSaneFloatOption::getMaxValue() const
{
QVariant value;
if (m_optDesc->constraint_type == SANE_CONSTRAINT_RANGE) {
......@@ -106,7 +106,7 @@ QVariant KSaneOptFSlider::getMaxValue() const
return value;
}
QVariant KSaneOptFSlider::getStepValue() const
QVariant KSaneFloatOption::getStepValue() const
{
QVariant value;
if (m_optDesc->constraint_type == SANE_CONSTRAINT_RANGE) {
......@@ -117,7 +117,7 @@ QVariant KSaneOptFSlider::getStepValue() const
return value;
}
QVariant KSaneOptFSlider::getValue() const
QVariant KSaneFloatOption::getValue() const
{
if (state() == StateHidden) {
return QVariant();
......@@ -125,7 +125,7 @@ QVariant KSaneOptFSlider::getValue() const
return QVariant(m_fVal);
}
QString KSaneOptFSlider::getValueAsString() const
QString KSaneFloatOption::getValueAsString() const
{
if (state() == StateHidden) {
return QString();
......
......@@ -19,12 +19,12 @@
namespace KSaneIface
{
class KSaneOptFSlider : public KSaneOption
class KSaneFloatOption : public KSaneOption
{
Q_OBJECT
public:
KSaneOptFSlider(const SANE_Handle handle, const int index);
KSaneFloatOption(const SANE_Handle handle, const int index);
void readValue() override;
void readOption() override;
......
......@@ -12,7 +12,7 @@
*
* ============================================================ */
#include "ksaneoptgamma.h"
#include "ksanegammaoption.h"
#include <QVarLengthArray>
......@@ -23,13 +23,13 @@
namespace KSaneIface
{
KSaneOptGamma::KSaneOptGamma(const SANE_Handle handle, const int index)
KSaneGammaOption::KSaneGammaOption(const SANE_Handle handle, const int index)
: KSaneOption(handle, index)
{
m_optionType = KSaneOption::TypeGamma;
}
bool KSaneOptGamma::setValue(const QVariant &value)
bool KSaneGammaOption::setValue(const QVariant &value)
{
if (state() == StateHidden) {
return false;
......@@ -79,7 +79,7 @@ bool KSaneOptGamma::setValue(const QVariant &value)
return false;
}
void KSaneOptGamma::readOption()
void KSaneGammaOption::readOption()
{
KSaneOption::readOption();
......@@ -92,13 +92,13 @@ void KSaneOptGamma::readOption()
}
}
void KSaneOptGamma::readValue()
void KSaneGammaOption::readValue()
{
// Unfortunately gamma table to brightness, contrast and gamma is
// not easy nor fast.. ergo not done
}
QVariant KSaneOptGamma::getValue() const
QVariant KSaneGammaOption::getValue() const
{
if (state() == StateHidden) {
return QVariant();
......@@ -106,7 +106,7 @@ QVariant KSaneOptGamma::getValue() const
return QVariant::fromValue(QVector<int>{ m_brightness, m_contrast, m_gamma });
}
QVariant KSaneOptGamma::getMaxValue() const
QVariant KSaneGammaOption::getMaxValue() const
{
QVariant value;
if (m_optDesc) {
......@@ -116,7 +116,7 @@ QVariant KSaneOptGamma::getMaxValue() const
return value;
}
QString KSaneOptGamma::getValueAsString() const
QString KSaneGammaOption::getValueAsString() const
{
if (state() == StateHidden) {
return QString();
......@@ -125,7 +125,7 @@ QString KSaneOptGamma::getValueAsString() const
return QString::asprintf("%d:%d:%d", m_brightness, m_contrast, m_gamma);
}
void KSaneOptGamma::calculateGTwriteData()
void KSaneGammaOption::calculateGTwriteData()
{
double maxValue = m_optDesc->constraint.range->max;
double gamma = 100.0 / m_gamma;
......
......@@ -19,12 +19,12 @@
namespace KSaneIface
{
class KSaneOptGamma : public KSaneOption
class KSaneGammaOption : public KSaneOption
{
Q_OBJECT
public:
KSaneOptGamma(const SANE_Handle handle, const int index);
KSaneGammaOption(const SANE_Handle handle, const int index);
void readValue() override;
void readOption() override;
......
......@@ -12,7 +12,7 @@
*
* ============================================================ */
#include "ksaneoptslider.h"
#include "ksaneintegeroption.h"
#include <QVarLengthArray>
......@@ -22,13 +22,13 @@ static const int KSW_INT_MIN = -2147483647 - 1; // prevent warning
namespace KSaneIface
{
KSaneOptSlider::KSaneOptSlider(const SANE_Handle handle, const int index)
KSaneIntegerOption::KSaneIntegerOption(const SANE_Handle handle, const int index)
: KSaneOption(handle, index), m_iVal(0)
{
m_optionType = KSaneOption::TypeInteger;
}
void KSaneOptSlider::readValue()
void KSaneIntegerOption::readValue()
{
if (state() == StateHidden) {
return;
......@@ -48,7 +48,7 @@ void KSaneOptSlider::readValue()
Q_EMIT valueChanged(m_iVal);
}
QVariant KSaneOptSlider::getMinValue() const
QVariant KSaneIntegerOption::getMinValue() const
{
QVariant value;
if (m_optDesc->constraint_type == SANE_CONSTRAINT_RANGE) {
......@@ -59,7 +59,7 @@ QVariant KSaneOptSlider::getMinValue() const
return value;
}
QVariant KSaneOptSlider::getMaxValue() const
QVariant KSaneIntegerOption::getMaxValue() const
{
QVariant value;
if (m_optDesc->constraint_type == SANE_CONSTRAINT_RANGE) {
......@@ -70,7 +70,7 @@ QVariant KSaneOptSlider::getMaxValue() const
return value;
}
QVariant KSaneOptSlider::getStepValue() const
QVariant KSaneIntegerOption::getStepValue() const
{
QVariant value;
if (m_optDesc->constraint_type == SANE_CONSTRAINT_RANGE) {
......@@ -81,7 +81,7 @@ QVariant KSaneOptSlider::getStepValue() const
return value;
}
QVariant KSaneOptSlider::getValue() const
QVariant KSaneIntegerOption::getValue() const
{
QVariant value;
if (state() == StateHidden) {
......@@ -91,7 +91,7 @@ QVariant KSaneOptSlider::getValue() const
return value;
}
QString KSaneOptSlider::getValueAsString() const
QString KSaneIntegerOption::getValueAsString() const
{
if (state() == StateHidden) {
return QString();
......@@ -99,7 +99,7 @@ QString KSaneOptSlider::getValueAsString() const
return QString::number(m_iVal);
}
bool KSaneOptSlider::setValue(const QVariant &val)
bool KSaneIntegerOption::setValue(const QVariant &val)
{
bool ok;
int newValue = val.toInt(&ok);
......
......@@ -19,12 +19,12 @@
namespace KSaneIface
{
class KSaneOptSlider : public KSaneOption
class KSaneIntegerOption : public KSaneOption
{
Q_OBJECT
public:
KSaneOptSlider(const SANE_Handle handle, const int index);
KSaneIntegerOption(const SANE_Handle handle, const int index);
void readValue() override;
......
......@@ -12,7 +12,7 @@
*
* ============================================================ */
#include "ksaneoptcombo.h"
#include "ksanelistoption.h"
#include <QVarLengthArray>
#include <QLocale>
......@@ -22,13 +22,13 @@
namespace KSaneIface
{
KSaneOptCombo::KSaneOptCombo(const SANE_Handle handle, const int index)
KSaneListOption::KSaneListOption(const SANE_Handle handle, const int index)
: KSaneOption(handle, index)
{
m_optionType = KSaneOption::TypeValueList;
}
void KSaneOptCombo::readValue()
void KSaneListOption::readValue()
{
if (state() == StateHidden) {
return;
......@@ -64,7 +64,7 @@ void KSaneOptCombo::readValue()
}
}
QVariantList KSaneOptCombo::getEntryList() const
QVariantList KSaneListOption::getEntryList() const
{
int i;
QVariantList list;
......@@ -94,7 +94,7 @@ QVariantList KSaneOptCombo::getEntryList() const
return list;
}
bool KSaneOptCombo::setValue(const QVariant &value)
bool KSaneListOption::setValue(const QVariant &value)
{
bool success = false;
if (static_cast<QMetaType::Type>(value.type()) == QMetaType::QString) {
......@@ -106,7 +106,7 @@ bool KSaneOptCombo::setValue(const QVariant &value)
return success;
}
QVariant KSaneOptCombo::getMinValue() const
QVariant KSaneListOption::getMinValue() const
{
QVariant value;
if (state() == StateHidden) {
......@@ -136,7 +136,7 @@ QVariant KSaneOptCombo::getMinValue() const
return value;
}
QVariant KSaneOptCombo::getValue() const
QVariant KSaneListOption::getValue() const
{
if (state() == StateHidden) {
return QVariant();
......@@ -144,7 +144,7 @@ QVariant KSaneOptCombo::getValue() const
return m_currentValue;
}
bool KSaneOptCombo::setValue(float value)
bool KSaneListOption::setValue(float value)
{
unsigned char data[4];
float tmp;
......@@ -188,7 +188,7 @@ bool KSaneOptCombo::setValue(float value)
return false;
}
QString KSaneOptCombo::getValueAsString() const
QString KSaneListOption::getValueAsString() const
{
if (state() == StateHidden) {
return QString();
......@@ -196,7 +196,7 @@ QString KSaneOptCombo::getValueAsString() const
return m_currentValue.toString();
}
bool KSaneOptCombo::setValue(const QString &value)
bool KSaneListOption::setValue(const QString &value)
{
if (state() == StateHidden) {
return false;
......
......@@ -21,12 +21,12 @@
namespace KSaneIface
{
class KSaneOptCombo : public KSaneOption
class KSaneListOption : public KSaneOption
{
Q_OBJECT
public:
KSaneOptCombo(const SANE_Handle handle, const int index);
KSaneListOption(const SANE_Handle handle, const int index);
void readValue() override;
......
......@@ -12,7 +12,7 @@
*
* ============================================================ */
// Local includes
#include "ksaneoptentry.h"
#include "ksanestringoption.h"
#include <QVarLengthArray>
......@@ -21,13 +21,13 @@
namespace KSaneIface
{
KSaneOptEntry::KSaneOptEntry(const SANE_Handle handle, const int index)
KSaneStringOption::KSaneStringOption(const SANE_Handle handle, const int index)
: KSaneOption(handle, index)
{
m_optionType = KSaneOption::TypeString;
}
bool KSaneOptEntry::setValue(const QVariant &val)
bool KSaneStringOption::setValue(const QVariant &val)
{
if (state() == StateHidden) {
return false;
......@@ -42,7 +42,7 @@ bool KSaneOptEntry::setValue(const QVariant &val)
return true;
}
void KSaneOptEntry::readValue()
void KSaneStringOption::readValue()
{
if (state() == StateHidden) {
return;
......@@ -62,12 +62,12 @@ void KSaneOptEntry::readValue()
Q_EMIT valueChanged(m_string);
}
QVariant KSaneOptEntry::getValue() const
QVariant KSaneStringOption::getValue() const
{
return QVariant(m_string);
}
QString KSaneOptEntry::getValueAsString() const
QString KSaneStringOption::getValueAsString() const
{
if (state() == StateHidden) {
return QString();
......
......@@ -19,12 +19,12 @@
namespace KSaneIface
{
class KSaneOptEntry : public KSaneOption
class KSaneStringOption : public KSaneOption
{
Q_OBJECT