[Kde-imaging] extragear/libs/libksane/libksane
Kåre Särs
kare.sars at kolumbus.fi
Tue Feb 12 20:22:12 CET 2008
SVN commit 774219 by sars:
Many small changes to satisfy krazy2
(KSaneWidgetPriv is renamed KSaneWidgetPrivate to make krazy2 happy -> users need to recompile)
With this commit I think libksane is ready for the first release.
CC_MAIL:kde-extra-gear at kde.org
CC_MAIL:kde-imaging at kde.org
M +4 -6 gamma_disp.cpp
M +1 -1 gamma_disp.h
M +6 -6 ksane.h
M +2 -4 labeled_checkbox.cpp
M +5 -5 labeled_combo.cpp
M +4 -3 labeled_combo.h
M +3 -5 labeled_entry.cpp
M +3 -2 labeled_entry.h
M +4 -5 labeled_fslider.cpp
M +2 -2 labeled_fslider.h
M +5 -9 labeled_gamma.cpp
M +1 -1 labeled_gamma.h
M +3 -5 labeled_separator.cpp
M +2 -2 labeled_separator.h
M +4 -6 labeled_slider.cpp
M +3 -8 preview_area.cpp
M +4 -4 preview_image.cpp
M +4 -4 radio_select.cpp
M +11 -11 sane_option.cpp
M +9 -12 sane_widget.cpp
--- trunk/extragear/libs/libksane/libksane/gamma_disp.cpp #774218:774219
@@ -26,15 +26,13 @@
*
* ============================================================ */
-// Qt includes.
-
-#include <QPainter>
-
// Local includes.
-
#include "gamma_disp.h"
#include "gamma_disp.moc"
+// Qt includes.
+#include <QPainter>
+
namespace KSaneIface
{
@@ -55,7 +53,7 @@
return QSize(75, 75);
}
-void GammaDisp::setColor(QColor color)
+void GammaDisp::setColor(const QColor &color)
{
gam_color = color;
}
--- trunk/extragear/libs/libksane/libksane/gamma_disp.h #774218:774219
@@ -58,7 +58,7 @@
QSize sizeHint() const;
QSize minimumSizeHint() const;
- void setColor(QColor color);
+ void setColor(const QColor &color);
protected:
--- trunk/extragear/libs/libksane/libksane/ksane.h #774218:774219
@@ -27,12 +27,12 @@
*
* ============================================================ */
-#ifndef SANE_WIDGET_H
-#define SANE_WIDGET_H
+#ifndef KSANE_H
+#define KSANE_H
// Qt includes.
-#include <QWidget>
+#include <QtGui/QWidget>
// Local includes.
@@ -42,7 +42,7 @@
namespace KSaneIface
{
-class KSaneWidgetPriv;
+class KSaneWidgetPrivate;
/**
* This class provides the widget containing the scan options and the preview.
@@ -88,7 +88,7 @@
bool openDevice(const QString &device_name);
/**
- * This is a convinience method that can be used to create a QImage from the image data
+ * This is a convenience method that can be used to create a QImage from the image data
* returned by the imageReady(...) signal.
*
* @param data is the byte data containing the image.
@@ -156,7 +156,7 @@
private:
- KSaneWidgetPriv* d;
+ KSaneWidgetPrivate * const d;
};
} // NameSpace KSaneIface
--- trunk/extragear/libs/libksane/libksane/labeled_checkbox.cpp #774218:774219
@@ -26,13 +26,11 @@
*
* ============================================================ */
-// Qt includes.
-
-
// Local includes.
-
#include "labeled_checkbox.h"
#include "labeled_checkbox.moc"
+
+// Qt includes.
#include <QHBoxLayout>
namespace KSaneIface
--- trunk/extragear/libs/libksane/libksane/labeled_combo.cpp #774218:774219
@@ -25,14 +25,14 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================ */
+#include "labeled_combo.h"
+#include "labeled_combo.moc"
// Qt includes.
-
-#include <QComboBox>
#include <QLabel>
-#include "labeled_combo.h"
-#include "labeled_combo.moc"
+// KDE includes
+#include <KComboBox>
namespace KSaneIface
{
@@ -43,7 +43,7 @@
{
layout = new QGridLayout(this);
label = new QLabel(ltext, this);
- combo = new QComboBox(this);
+ combo = new KComboBox(this);
combo->addItems(list);
connect(combo, SIGNAL(activated(const QString &)),
--- trunk/extragear/libs/libksane/libksane/labeled_combo.h #774218:774219
@@ -30,12 +30,13 @@
#define LABELED_COMBO_H
// Qt includes.
-
#include <QFrame>
-#include <QComboBox>
#include <QLabel>
#include <QGridLayout>
+// KDE includes
+#include <KComboBox>
+
namespace KSaneIface
{
@@ -115,7 +116,7 @@
private:
QLabel *label;
- QComboBox *combo;
+ KComboBox *combo;
QGridLayout *layout;
};
--- trunk/extragear/libs/libksane/libksane/labeled_entry.cpp #774218:774219
@@ -26,13 +26,11 @@
*
* ============================================================ */
-// Qt includes.
-
-
// Local includes.
-
#include "labeled_entry.h"
#include "labeled_entry.moc"
+
+// Qt includes.
#include <QHBoxLayout>
namespace KSaneIface
@@ -45,7 +43,7 @@
hb->setSpacing(2);
hb->setMargin(0);
label = new QLabel(ltext, this);
- entry = new QLineEdit(this);
+ entry = new KLineEdit(this);
reset = new QPushButton(this);
reset->setText("Reset");
set = new QPushButton(this);
--- trunk/extragear/libs/libksane/libksane/labeled_entry.h #774218:774219
@@ -30,12 +30,13 @@
#define LABELED_ENTRY_H
// Qt includes.
-
#include <QFrame>
-#include <QLineEdit>
#include <QPushButton>
#include <QLabel>
+// KDE includes
+#include <KLineEdit>
+
/**
*@author Kåre Särs
*/
--- trunk/extragear/libs/libksane/libksane/labeled_fslider.cpp #774218:774219
@@ -26,15 +26,14 @@
*
* ============================================================ */
-#define FLOAT_MULTIP 32768.0
-#define TO_FLOAT(v) ((float)v / FLOAT_MULTIP)
-#define TO_FIX(v) ((int)(v * FLOAT_MULTIP))
-
// Local includes.
-
#include "labeled_fslider.h"
#include "labeled_fslider.moc"
+#define FLOAT_MULTIP 32768.0
+#define TO_FLOAT(v) ((float)v / FLOAT_MULTIP)
+#define TO_FIX(v) ((int)(v * FLOAT_MULTIP))
+
namespace KSaneIface
{
--- trunk/extragear/libs/libksane/libksane/labeled_fslider.h #774218:774219
@@ -26,8 +26,8 @@
*
* ============================================================ */
-#ifndef LABELED_SFSLIDER_H
-#define LABELED_SFSLIDER_H
+#ifndef LABELED_FSLIDER_H
+#define LABELED_FSLIDER_H
// Qt includes.
--- trunk/extragear/libs/libksane/libksane/labeled_gamma.cpp #774218:774219
@@ -26,23 +26,19 @@
*
* ============================================================ */
-// C++ includes.
+// Local includes.
+#include "labeled_gamma.h"
+#include "labeled_gamma.moc"
+// C++ includes.
#include <cmath>
// Qt includes.
-
#include <QGroupBox>
// KDE includes.
-
#include <klocale.h>
-// Local includes.
-
-#include "labeled_gamma.h"
-#include "labeled_gamma.moc"
-
namespace KSaneIface
{
@@ -113,7 +109,7 @@
{
}
-void LabeledGamma::setColor(QColor color)
+void LabeledGamma::setColor(const QColor &color)
{
if (gamma_disp != 0) {
gamma_disp->setColor(color);
--- trunk/extragear/libs/libksane/libksane/labeled_gamma.h #774218:774219
@@ -62,7 +62,7 @@
LabeledGamma(QWidget *parent, const QString& text, int elements);
~LabeledGamma();
- void setColor(QColor color);
+ void setColor(const QColor &color);
void setSize(int size);
const QVector<int> &gammaTablePtr() { return gam_tbl; }
int size() {return (int)(max_val+1);}
--- trunk/extragear/libs/libksane/libksane/labeled_separator.cpp #774218:774219
@@ -26,14 +26,12 @@
*
* ============================================================ */
-// Qt includes.
-
-#include <QLabel>
-
// Local includes.
-
#include "labeled_separator.h"
#include "labeled_separator.moc"
+
+// Qt includes.
+#include <QLabel>
#include <QHBoxLayout>
namespace KSaneIface
--- trunk/extragear/libs/libksane/libksane/labeled_separator.h #774218:774219
@@ -26,8 +26,8 @@
*
* ============================================================ */
-#ifndef LABELD_SEPARATOR_H
-#define LABELD_SEPARATOR_H
+#ifndef LABELED_SEPARATOR_H
+#define LABELED_SEPARATOR_H
// Qt includes.
--- trunk/extragear/libs/libksane/libksane/labeled_slider.cpp #774218:774219
@@ -26,17 +26,15 @@
*
* ============================================================ */
-// Qt includes.
+// Local includes.
+#include "labeled_slider.h"
+#include "labeled_slider.moc"
+// Qt includes.
#include <QSpinBox>
#include <QLabel>
#include <QSlider>
-// Local includes.
-
-#include "labeled_slider.h"
-#include "labeled_slider.moc"
-
namespace KSaneIface
{
--- trunk/extragear/libs/libksane/libksane/preview_area.cpp #774218:774219
@@ -26,21 +26,16 @@
*
* ============================================================ */
-// C++ includes.
+// Local includes.
+#include "preview_area.h"
+#include "preview_area.moc"
-#include <stdio.h>
-#include <iostream>
-
// Qt includes
#include <QScrollBar>
// KDE includes
#include <KDebug>
-// Local includes.
-#include "preview_area.h"
-#include "preview_area.moc"
-
namespace KSaneIface
{
--- trunk/extragear/libs/libksane/libksane/preview_image.cpp #774218:774219
@@ -29,6 +29,10 @@
#define MIN_SCALE 0.4
#define MAX_SCALE 4.0
+// Local includes.
+#include "preview_image.h"
+#include "preview_image.moc"
+
// C++ includes.
#include <cstdio>
#include <cmath>
@@ -41,10 +45,6 @@
// KDE includes
#include <KDebug>
-// Local includes.
-#include "preview_image.h"
-#include "preview_image.moc"
-
namespace KSaneIface
{
--- trunk/extragear/libs/libksane/libksane/radio_select.cpp #774218:774219
@@ -26,6 +26,10 @@
*
* ============================================================ */
+// Local includes.
+#include "radio_select.h"
+#include "radio_select.moc"
+
// Qt includes.
#include <QRadioButton>
#include <QPushButton>
@@ -36,10 +40,6 @@
#include <KLocale>
#include <KDebug>
-// Local includes.
-#include "radio_select.h"
-#include "radio_select.moc"
-
namespace KSaneIface
{
--- trunk/extragear/libs/libksane/libksane/sane_option.cpp #774218:774219
@@ -25,9 +25,10 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ============================================================ */
+// Local includes.
+#include "sane_option.h"
+#include "sane_option.moc"
-#define MIN_FOAT_STEP 0.001
-
// Sane includes.
extern "C"
{
@@ -43,9 +44,7 @@
#include <KLocale>
#include <kiconloader.h>
-// Local includes.
-#include "sane_option.h"
-#include "sane_option.moc"
+#define MIN_FOAT_STEP 0.001
namespace KSaneIface
{
@@ -258,12 +257,12 @@
switch(sane_option->unit)
{
case SANE_UNIT_NONE: return QString("");
- case SANE_UNIT_PIXEL: return i18n(" Pixel");
- case SANE_UNIT_BIT: return i18n(" Bit");
- case SANE_UNIT_MM: return i18n(" mm");
- case SANE_UNIT_DPI: return i18n(" DPI");
+ case SANE_UNIT_PIXEL: return i18nc("Parameter unit"," Pixel");
+ case SANE_UNIT_BIT: return i18nc("Parameter unit"," Bit");
+ case SANE_UNIT_MM: return i18nc("Parameter unit"," mm");
+ case SANE_UNIT_DPI: return i18nc("Parameter unit"," DPI");
case SANE_UNIT_PERCENT: return QString(" %");
- case SANE_UNIT_MICROSECOND: return i18n(" usec");
+ case SANE_UNIT_MICROSECOND: return i18nc("Parameter unit"," usec");
}
return QString("");
}
@@ -497,6 +496,7 @@
{
float tmp_step;
int tmp_size;
+ static const char tmp_binary[] = "Binary";
sane_option = sane_get_option_descriptor(sane_handle, opt_number);
@@ -530,7 +530,7 @@
lcombx->setIcon(SmallIcon("black-white"),
getSaneComboString((unsigned char*)SANE_VALUE_SCAN_MODE_LINEART));
// The epkowa/epson backend uses "Binary" which is the same as "Lineart"
- lcombx->setIcon(SmallIcon("black-white"), i18n("Binary"));
+ lcombx->setIcon(SmallIcon("black-white"), i18n(tmp_binary));
break;
case SW_SLIDER:
lslider->setRange(sane_option->constraint.range->min,
--- trunk/extragear/libs/libksane/libksane/sane_widget.cpp #774218:774219
@@ -59,7 +59,6 @@
// Local includes.
#include "sane_option.h"
#include "preview_area.h"
-#include "sane_option.h"
#include "labeled_separator.h"
#include "radio_select.h"
#include "labeled_gamma.h"
@@ -82,11 +81,11 @@
} ReadStatus;
-class KSaneWidgetPriv
+class KSaneWidgetPrivate
{
public:
- KSaneWidgetPriv()
+ KSaneWidgetPrivate()
{
optsWidget = 0;
basic_options = 0;
@@ -256,10 +255,8 @@
};
KSaneWidget::KSaneWidget(QWidget* parent)
- : QWidget(parent)
+ : QWidget(parent), d(new KSaneWidgetPrivate)
{
- d = new KSaneWidgetPriv;
-
SANE_Int version;
SANE_Status status;
@@ -324,7 +321,7 @@
// << "model='" << dev_list[i]->model << "' "
// << "type='" << dev_list[i]->type << "'";
tmp = i18n(dev_list[i]->name);
- tmp += "\n" + i18n(dev_list[i]->vendor);
+ tmp += '\n' + i18n(dev_list[i]->vendor);
tmp += " : " + i18n(dev_list[i]->model);
dev_name_list += tmp;
i++;
@@ -334,8 +331,8 @@
// add the debug test scanner to the end
#ifdef ENABLE_DEBUG
tmp = QString("test:0");
- tmp += "\n" + i18n("Tester");
- tmp += " : " + i18n("Model");
+ tmp += '\n' + i18nc("Test backend vendor name", "Tester");
+ tmp += " : " + i18nc("Test backend model name", "Debug");
dev_name_list += tmp;
#endif
@@ -374,7 +371,7 @@
while(dev_list[i] != 0) {
if (QString(dev_list[i]->name) == device_name) {
- d->modelName = i18n(dev_list[i]->vendor) + " " + i18n(dev_list[i]->model);
+ d->modelName = i18n(dev_list[i]->vendor) + ' ' + i18n(dev_list[i]->model);
d->vendor = i18n(dev_list[i]->vendor);
d->model = i18n(dev_list[i]->model);
break;
@@ -385,8 +382,8 @@
if (dev_list[i] == 0) {
#ifdef ENABLE_DEBUG
d->modelName = i18n("Test Scanner");
- d->vendor = i18n("Test");
- d->model = i18n("Debug");
+ d->vendor = i18nc("Test backend vendor name", "Tester");
+ d->model = i18nc("Test backend model name", "Debug");
#else
kDebug() << device_name << "' not found";
return false;
More information about the Kde-imaging
mailing list