aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2014-11-12 22:57:21 +0100
committerMontel Laurent <[email protected]>2014-11-12 22:57:21 +0100
commite57454290aaaac2efa8d46ae84d82845907643da (patch)
tree0c8ac810e7283831944a48be5eee10b1b6d786d8
parenta576e1f3f5b8d8fdc12fb5149b819ccf58ff904e (diff)
Minor clean
-rw-r--r--src/ksane_device_dialog.cpp10
-rw-r--r--src/ksane_device_dialog.h4
-rw-r--r--src/options/ksane_opt_button.cpp5
-rw-r--r--src/options/ksane_opt_button.h2
-rw-r--r--src/options/ksane_opt_checkbox.cpp5
-rw-r--r--src/options/ksane_opt_checkbox.h2
-rw-r--r--src/options/ksane_opt_combo.cpp5
-rw-r--r--src/options/ksane_opt_combo.h2
-rw-r--r--src/options/ksane_opt_entry.cpp5
-rw-r--r--src/options/ksane_opt_entry.h2
-rw-r--r--src/options/ksane_opt_fslider.cpp5
-rw-r--r--src/options/ksane_opt_fslider.h6
-rw-r--r--src/options/ksane_opt_gamma.cpp5
-rw-r--r--src/options/ksane_opt_gamma.h2
-rw-r--r--src/options/ksane_opt_slider.cpp5
-rw-r--r--src/options/ksane_opt_slider.h8
-rw-r--r--src/options/ksane_option.cpp6
-rw-r--r--src/options/ksane_option.h6
-rw-r--r--src/widgets/gamma_disp.h2
-rw-r--r--src/widgets/ksane_option_widget.cpp2
-rw-r--r--src/widgets/labeled_checkbox.cpp3
-rw-r--r--src/widgets/labeled_combo.cpp12
-rw-r--r--src/widgets/labeled_combo.h2
-rw-r--r--src/widgets/labeled_fslider.cpp4
-rw-r--r--src/widgets/labeled_fslider.h4
-rw-r--r--src/widgets/labeled_gamma.cpp4
-rw-r--r--src/widgets/labeled_gamma.h4
27 files changed, 83 insertions, 39 deletions
diff --git a/src/ksane_device_dialog.cpp b/src/ksane_device_dialog.cpp
index 87dedac..1693aa7 100644
--- a/src/ksane_device_dialog.cpp
+++ b/src/ksane_device_dialog.cpp
@@ -130,12 +130,12 @@ void KSaneDeviceDialog::setAvailable(bool isAvailable)
}
}
-void KSaneDeviceDialog::setDefault(QString defaultBackend)
+void KSaneDeviceDialog::setDefault(const QString &defaultBackend)
{
m_selectedDevice = defaultBackend;
}
-QString KSaneDeviceDialog::getSelectedName() {
+QString KSaneDeviceDialog::getSelectedName() const {
QAbstractButton *selectedButton = m_btnGroupDevices->checkedButton();
if(selectedButton) {
return selectedButton->objectName();
@@ -165,11 +165,11 @@ void KSaneDeviceDialog::updateDevicesList()
m_gbDevices->layout()->itemAt(0)->widget()->hide(); // explanation
m_gbDevices->layout()->itemAt(1)->widget()->show(); // scroll area
- for (int i=0; i< list.size(); i++) {
+ for (int i=0; i< list.size(); ++i) {
QRadioButton *b = new QRadioButton(this);
b->setObjectName(list[i].name);
b->setToolTip(list[i].name);
- b->setText(QString(QLatin1String("%1 : %2\n%3"))
+ b->setText(QStringLiteral("%1 : %2\n%3")
.arg(list[i].vendor)
.arg(list[i].model)
.arg(list[i].name));
@@ -177,7 +177,7 @@ void KSaneDeviceDialog::updateDevicesList()
m_btnLayout->addWidget(b);
m_btnGroupDevices->addButton(b);
connect(b, &QRadioButton::clicked, this, &KSaneDeviceDialog::setAvailable);
- if((i==0) || (list[i].name == m_selectedDevice)) {
+ if((i==0) || (list.at(i).name == m_selectedDevice)) {
b->setChecked(true);
setAvailable(true);
}
diff --git a/src/ksane_device_dialog.h b/src/ksane_device_dialog.h
index fe4a8b1..b852935 100644
--- a/src/ksane_device_dialog.h
+++ b/src/ksane_device_dialog.h
@@ -53,8 +53,8 @@ public:
KSaneDeviceDialog(QWidget *parent=0);
~KSaneDeviceDialog();
- QString getSelectedName();
- void setDefault(QString);
+ QString getSelectedName() const;
+ void setDefault(const QString &);
public Q_SLOTS:
void reloadDevicesList();
diff --git a/src/options/ksane_opt_button.cpp b/src/options/ksane_opt_button.cpp
index b921cc0..e4f5e3d 100644
--- a/src/options/ksane_opt_button.cpp
+++ b/src/options/ksane_opt_button.cpp
@@ -60,6 +60,11 @@ void KSaneOptButton::createWidget(QWidget *parent)
readValue();
}
+bool KSaneOptButton::hasGui()
+{
+ return true;
+}
+
void KSaneOptButton::buttonClicked()
{
unsigned char data[4];
diff --git a/src/options/ksane_opt_button.h b/src/options/ksane_opt_button.h
index 5196825..4022721 100644
--- a/src/options/ksane_opt_button.h
+++ b/src/options/ksane_opt_button.h
@@ -44,7 +44,7 @@ public:
void createWidget(QWidget *parent);
- bool hasGui() {return true;}
+ bool hasGui();
private Q_SLOTS:
void buttonClicked();
diff --git a/src/options/ksane_opt_checkbox.cpp b/src/options/ksane_opt_checkbox.cpp
index ee4d97c..d81565e 100644
--- a/src/options/ksane_opt_checkbox.cpp
+++ b/src/options/ksane_opt_checkbox.cpp
@@ -132,5 +132,10 @@ bool KSaneOptCheckBox::setValue(const QString &val)
return true;
}
+bool KSaneOptCheckBox::hasGui()
+{
+ return true;
+}
+
} // NameSpace KSaneIface
diff --git a/src/options/ksane_opt_checkbox.h b/src/options/ksane_opt_checkbox.h
index 0a6fba2..5b34b2e 100644
--- a/src/options/ksane_opt_checkbox.h
+++ b/src/options/ksane_opt_checkbox.h
@@ -50,7 +50,7 @@ public:
bool setValue(float val);
bool getValue(QString &val);
bool setValue(const QString &val);
- bool hasGui() {return true;}
+ bool hasGui();
private Q_SLOTS:
void checkboxChanged(bool toggled);
diff --git a/src/options/ksane_opt_combo.cpp b/src/options/ksane_opt_combo.cpp
index 7568ecf..3fcb2e3 100644
--- a/src/options/ksane_opt_combo.cpp
+++ b/src/options/ksane_opt_combo.cpp
@@ -373,5 +373,10 @@ bool KSaneOptCombo::setValue(const QString &val)
return true;
}
+bool KSaneOptCombo::hasGui()
+{
+ return true;
+}
+
} // NameSpace KSaneIface
diff --git a/src/options/ksane_opt_combo.h b/src/options/ksane_opt_combo.h
index 2fb1844..66671ec 100644
--- a/src/options/ksane_opt_combo.h
+++ b/src/options/ksane_opt_combo.h
@@ -52,7 +52,7 @@ public:
bool setValue(float val);
bool getValue(QString &val);
bool setValue(const QString &val);
- bool hasGui() {return true;}
+ bool hasGui();
private Q_SLOTS:
void comboboxChangedIndex(int val);
diff --git a/src/options/ksane_opt_entry.cpp b/src/options/ksane_opt_entry.cpp
index 65942e6..0e31d1b 100644
--- a/src/options/ksane_opt_entry.cpp
+++ b/src/options/ksane_opt_entry.cpp
@@ -109,4 +109,9 @@ bool KSaneOptEntry::setValue(const QString &val)
return true;
}
+bool KSaneOptEntry::hasGui()
+{
+ return true;
+}
+
} // NameSpace KSaneIface
diff --git a/src/options/ksane_opt_entry.h b/src/options/ksane_opt_entry.h
index 9dc68d3..c8212e4 100644
--- a/src/options/ksane_opt_entry.h
+++ b/src/options/ksane_opt_entry.h
@@ -50,7 +50,7 @@ public:
bool setValue(float val);
bool getValue(QString &val);
bool setValue(const QString &val);
- bool hasGui() {return true;}
+ bool hasGui();
private Q_SLOTS:
void entryChanged(const QString &text);
diff --git a/src/options/ksane_opt_fslider.cpp b/src/options/ksane_opt_fslider.cpp
index 125dce4..5deb41a 100644
--- a/src/options/ksane_opt_fslider.cpp
+++ b/src/options/ksane_opt_fslider.cpp
@@ -170,5 +170,10 @@ bool KSaneOptFSlider::setValue(const QString &val)
return true;
}
+bool KSaneOptFSlider::hasGui()
+{
+ return true;
+}
+
} // NameSpace KSaneIface
diff --git a/src/options/ksane_opt_fslider.h b/src/options/ksane_opt_fslider.h
index 793b80e..33e923c 100644
--- a/src/options/ksane_opt_fslider.h
+++ b/src/options/ksane_opt_fslider.h
@@ -53,10 +53,10 @@ public:
bool setValue(float val);
bool getValue(QString &val);
bool setValue(const QString &val);
- bool hasGui() {return true;}
+ bool hasGui();
- Q_SIGNALS:
- void fValueRead(float);
+Q_SIGNALS:
+ void fValueRead(float);
private Q_SLOTS:
void sliderChanged(float val);
diff --git a/src/options/ksane_opt_gamma.cpp b/src/options/ksane_opt_gamma.cpp
index 08d86a0..540ae12 100644
--- a/src/options/ksane_opt_gamma.cpp
+++ b/src/options/ksane_opt_gamma.cpp
@@ -102,4 +102,9 @@ bool KSaneOptGamma::setValue(const QString &val)
return true;
}
+bool KSaneOptGamma::hasGui()
+{
+ return true;
+}
+
} // NameSpace KSaneIface
diff --git a/src/options/ksane_opt_gamma.h b/src/options/ksane_opt_gamma.h
index a0b48c1..44ee7e4 100644
--- a/src/options/ksane_opt_gamma.h
+++ b/src/options/ksane_opt_gamma.h
@@ -50,7 +50,7 @@ public:
bool setValue(float val);
bool getValue(QString &val);
bool setValue(const QString &val);
- bool hasGui() {return true;}
+ bool hasGui();
private Q_SLOTS:
void gammaTableChanged(const QVector<int> &gam_tbl);
diff --git a/src/options/ksane_opt_slider.cpp b/src/options/ksane_opt_slider.cpp
index 6c02692..8772f65 100644
--- a/src/options/ksane_opt_slider.cpp
+++ b/src/options/ksane_opt_slider.cpp
@@ -157,5 +157,10 @@ bool KSaneOptSlider::setValue(const QString &val)
return true;
}
+bool KSaneOptSlider::hasGui()
+{
+ return true;
+}
+
} // NameSpace KSaneIface
diff --git a/src/options/ksane_opt_slider.h b/src/options/ksane_opt_slider.h
index 8e73e0c..245a768 100644
--- a/src/options/ksane_opt_slider.h
+++ b/src/options/ksane_opt_slider.h
@@ -53,11 +53,11 @@ public:
bool setValue(float val);
bool getValue(QString &val);
bool setValue(const QString &val);
- bool hasGui() {return true;}
+ bool hasGui();
- Q_SIGNALS:
- void fValueRead(float);
-
+Q_SIGNALS:
+ void fValueRead(float);
+
private Q_SLOTS:
void sliderChanged(int val);
diff --git a/src/options/ksane_option.cpp b/src/options/ksane_option.cpp
index 7219af0..1165358 100644
--- a/src/options/ksane_option.cpp
+++ b/src/options/ksane_option.cpp
@@ -87,7 +87,7 @@ void KSaneOption::updateVisibility()
}
}
-KSaneOption::KSaneOptWState KSaneOption::state()
+KSaneOption::KSaneOptWState KSaneOption::state() const
{
if (!m_optDesc) return STATE_HIDDEN;
@@ -103,7 +103,7 @@ KSaneOption::KSaneOptWState KSaneOption::state()
return STATE_SHOWN;
}
-bool KSaneOption::needsPolling()
+bool KSaneOption::needsPolling() const
{
if (!m_optDesc) return false;
@@ -115,7 +115,7 @@ bool KSaneOption::needsPolling()
return false;
}
-QString KSaneOption::name()
+QString KSaneOption::name() const
{
if (m_optDesc == 0) return QString("");
return QString(m_optDesc->name);
diff --git a/src/options/ksane_option.h b/src/options/ksane_option.h
index 51e8422..116bdee 100644
--- a/src/options/ksane_option.h
+++ b/src/options/ksane_option.h
@@ -78,9 +78,9 @@ public:
KSaneOptionWidget *widget() {return m_widget;}
virtual bool hasGui() {return false;}
- bool needsPolling();
- KSaneOptWState state();
- QString name();
+ bool needsPolling() const;
+ KSaneOptWState state() const;
+ QString name() const;
virtual void createWidget(QWidget *parent);
diff --git a/src/widgets/gamma_disp.h b/src/widgets/gamma_disp.h
index ebefff8..b8146bd 100644
--- a/src/widgets/gamma_disp.h
+++ b/src/widgets/gamma_disp.h
@@ -52,7 +52,7 @@ public:
* \param parent parent widget
*/
GammaDisp(QWidget *parent, QVector<int> *tbl);
- ~GammaDisp() {};
+ ~GammaDisp() {}
QSize sizeHint() const;
QSize minimumSizeHint() const;
diff --git a/src/widgets/ksane_option_widget.cpp b/src/widgets/ksane_option_widget.cpp
index 34c0378..ee4548d 100644
--- a/src/widgets/ksane_option_widget.cpp
+++ b/src/widgets/ksane_option_widget.cpp
@@ -51,7 +51,7 @@ KSaneOptionWidget::~KSaneOptionWidget()
void KSaneOptionWidget::setLabelText(const QString &text)
{
if (text.isEmpty()) {
- m_label->setText(QString());
+ m_label->clear();
} else {
m_label->setText(i18nc("Label for a scanner option", "%1:", text));
}
diff --git a/src/widgets/labeled_checkbox.cpp b/src/widgets/labeled_checkbox.cpp
index 05a3109..8231774 100644
--- a/src/widgets/labeled_checkbox.cpp
+++ b/src/widgets/labeled_checkbox.cpp
@@ -47,7 +47,8 @@ LabeledCheckbox::~LabeledCheckbox()
void LabeledCheckbox::setChecked(bool is_checked)
{
- if (is_checked != chbx->isChecked()) chbx->setChecked(is_checked);
+ if (is_checked != chbx->isChecked())
+ chbx->setChecked(is_checked);
}
bool LabeledCheckbox::isChecked()
diff --git a/src/widgets/labeled_combo.cpp b/src/widgets/labeled_combo.cpp
index 0aa09cd..5e2817c 100644
--- a/src/widgets/labeled_combo.cpp
+++ b/src/widgets/labeled_combo.cpp
@@ -56,7 +56,7 @@ void LabeledCombo::addItems(const QStringList &list)
m_combo->addItems(list);
QString tmp;
- for (int i=0; i<m_combo->count(); i++) {
+ for (int i=0; i<m_combo->count(); ++i) {
tmp = m_combo->itemText(i);
m_combo->setItemData(i, tmp, Qt::ToolTipRole);
}
@@ -65,15 +65,14 @@ void LabeledCombo::addItems(const QStringList &list)
void LabeledCombo::setCurrentText(const QString &t)
{
- int i;
- for (i=0; i<m_combo->count(); i++) {
+ for (int i=0; i<m_combo->count(); ++i) {
if (m_combo->itemText(i) == t) {
m_combo->setCurrentIndex(i);
}
}
}
-QString LabeledCombo::currentText()
+QString LabeledCombo::currentText() const
{
return m_combo->currentText();
}
@@ -81,7 +80,7 @@ QString LabeledCombo::currentText()
bool LabeledCombo::setIcon(const QIcon &icon, const QString& str)
{
- for (int i=0; i < m_combo->count(); i++) {
+ for (int i=0; i < m_combo->count(); ++i) {
if (m_combo->itemText(i) == str) {
m_combo->setItemIcon(i, icon);
return true;
@@ -94,7 +93,8 @@ void LabeledCombo::setCurrentIndex(int i)
{
m_combo->setCurrentIndex(i);
}
-void LabeledCombo::clear() {
+void LabeledCombo::clear()
+{
m_combo->clear();
}
diff --git a/src/widgets/labeled_combo.h b/src/widgets/labeled_combo.h
index 12716c9..be24bea 100644
--- a/src/widgets/labeled_combo.h
+++ b/src/widgets/labeled_combo.h
@@ -72,7 +72,7 @@ public Q_SLOTS:
/**
* This function is used to read the current string of the combobox
*/
- QString currentText();
+ QString currentText() const;
/**
* set the current item of the combobox.
diff --git a/src/widgets/labeled_fslider.cpp b/src/widgets/labeled_fslider.cpp
index 5af1686..d511da8 100644
--- a/src/widgets/labeled_fslider.cpp
+++ b/src/widgets/labeled_fslider.cpp
@@ -93,6 +93,10 @@ LabeledFSlider::~LabeledFSlider()
{
}
+float LabeledFSlider::value() const {return (float)m_spinb->value();}
+
+float LabeledFSlider::step() const {return m_fstep;}
+
void LabeledFSlider::setSuffix(const QString &text)
{
m_spinb->setSuffix(text);
diff --git a/src/widgets/labeled_fslider.h b/src/widgets/labeled_fslider.h
index 2fdb71c..3bf9b59 100644
--- a/src/widgets/labeled_fslider.h
+++ b/src/widgets/labeled_fslider.h
@@ -68,8 +68,8 @@ public:
/**
* \return the slider value.
*/
- float value() const {return (float)m_spinb->value();}
- float step() const {return m_fstep;}
+ float value() const;
+ float step() const;
public Q_SLOTS:
diff --git a/src/widgets/labeled_gamma.cpp b/src/widgets/labeled_gamma.cpp
index fe5e356..16532d4 100644
--- a/src/widgets/labeled_gamma.cpp
+++ b/src/widgets/labeled_gamma.cpp
@@ -162,6 +162,10 @@ void LabeledGamma::setSize(int size)
m_gam_slider->setValue(0);
}
+const QVector<int> &LabeledGamma::gammaTablePtr() { return m_gam_tbl; }
+
+int LabeledGamma::size() {return (int)(m_max_val+1);}
+
void LabeledGamma::calculateGT()
{
diff --git a/src/widgets/labeled_gamma.h b/src/widgets/labeled_gamma.h
index b3aa8d6..5d09750 100644
--- a/src/widgets/labeled_gamma.h
+++ b/src/widgets/labeled_gamma.h
@@ -59,8 +59,8 @@ public:
void setColor(const QColor &color);
void setSize(int size);
- const QVector<int> &gammaTablePtr() { return m_gam_tbl; }
- int size() {return (int)(m_max_val+1);}
+ const QVector<int> &gammaTablePtr();
+ int size();
bool getValues(int &bri, int &con, int &gam);