• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

libs/libksane/libksane

  • sources
  • kde-4.14
  • kdegraphics
  • libs
  • libksane
  • libksane
ksane.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is part of the KDE project
4  *
5  * Date : 2007-09-13
6  * Description : Sane interface for KDE
7  *
8  * Copyright (C) 2007-2010 by Kare Sars <kare dot sars at iki dot fi>
9  * Copyright (C) 2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) version 3, or any
15  * later version accepted by the membership of KDE e.V. (or its
16  * successor approved by the membership of KDE e.V.), which shall
17  * act as a proxy defined in Section 6 of version 3 of the license.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  * ============================================================ */
28 
29 #ifndef KSANE_H
30 #define KSANE_H
31 
32 // Qt includes
33 #include <QtGui/QWidget>
34 
35 // Local includes
36 #include "libksane_export.h"
37 
39 namespace KSaneIface
40 {
41 
42 class KSaneWidgetPrivate;
43 
48 class LIBKSANE_EXPORT KSaneWidget : public QWidget
49 {
50  Q_OBJECT
51  friend class KSaneWidgetPrivate;
52 
53 public:
56  typedef enum
57  {
58  FormatBlackWhite,
59  FormatGrayScale8,
60  FormatGrayScale16,
62  FormatRGB_8_C,
64  FormatRGB_16_C,
67  FormatBMP,
68  FormatNone = 0xFFFF
69  } ImageFormat;
70 
72  typedef enum
73  {
74  NoError,
75  ErrorCannotSegment,
78  ErrorGeneral,
79  Information
80  } ScanStatus;
81 
82  struct DeviceInfo
83  {
84  QString name; /* unique device name */
85  QString vendor; /* device vendor string */
86  QString model; /* device model name */
87  QString type; /* device type (e.g., "flatbed scanner") */
88  };
89 
92  KSaneWidget(QWidget* parent=0);
93 
95  ~KSaneWidget();
96 
99  QString selectDevice(QWidget* parent=0);
100 
105  void initGetDeviceList() const;
106 
111  bool openDevice(const QString &device_name);
112 
115  bool closeDevice();
116 
117  KDE_DEPRECATED bool makeQImage(const QByteArray &, int, int, int, ImageFormat, QImage &);
118 
132  QImage toQImage(const QByteArray &data,
133  int width,
134  int height,
135  int bytes_per_line,
136  ImageFormat format);
137 
151  QImage toQImageSilent(const QByteArray &data,
152  int width,
153  int height,
154  int bytes_per_line,
155  ImageFormat format);
156 
158  QString vendor() const;
160  QString make() const;
162  QString model() const;
163 
169  float currentDPI();
170 
173  float scanAreaWidth();
174 
177  float scanAreaHeight();
178 
183  void setSelection(QPointF topLeft, QPointF bottomRight);
184 
189  void setPreviewResolution(float dpi);
190 
194  void getOptVals(QMap <QString, QString> &opts);
195 
199  int setOptVals(const QMap <QString, QString> &opts);
200 
205  bool getOptVal(const QString &optname, QString &value);
206 
211  bool setOptVal(const QString &optname, const QString &value);
212 
215  void setScanButtonText(const QString &scanLabel);
216 
219  void setPreviewButtonText(const QString &previewLabel);
220 
224  void enableAutoSelect(bool enable);
225 
228  void setOptionsCollapsed(bool collapse);
229 
232  void setScanButtonHidden(bool hidden);
233 
234 public Q_SLOTS:
236  void scanCancel();
237 
242  void scanFinal();
243 
244 Q_SIGNALS:
253  void imageReady(QByteArray &data, int width, int height,
254  int bytes_per_line, int format);
255 
261  void scanDone(int status, const QString &strStatus);
262 
269  void userMessage(int type, const QString &strStatus);
270 
276  void scanProgress(int percent);
277 
286  void availableDevices(const QList<KSaneWidget::DeviceInfo> &deviceList);
287 
298  void buttonPressed(const QString &optionName, const QString &optionLabel, bool pressed);
299 
300 private:
301 
302  KSaneWidgetPrivate * const d;
303 };
304 
305 } // NameSpace KSaneIface
306 
307 #endif // SANE_WIDGET_H
KSaneIface::KSaneWidget::ImageFormat
ImageFormat
This enumeration describes the type of the returned data.
Definition: ksane.h:56
QWidget
QByteArray
KSaneIface::KSaneWidget::NoError
The scanning was finished successfully.
Definition: ksane.h:74
QMap
KSaneIface::KSaneWidgetPrivate
Definition: ksane_widget_private.h:70
QPointF
KSaneIface::KSaneWidget::DeviceInfo::vendor
QString vendor
Definition: ksane.h:85
KSaneIface::KSaneWidget::FormatBlackWhite
One bit per pixel 1 = black 0 = white.
Definition: ksane.h:58
libksane_export.h
KSaneIface::KSaneWidget::DeviceInfo::type
QString type
Definition: ksane.h:87
LIBKSANE_EXPORT
#define LIBKSANE_EXPORT
Definition: libksane_export.h:32
QString
QList
KSaneIface::KSaneWidget::ErrorGeneral
The error string should contain an error message.
Definition: ksane.h:78
KSaneIface::KSaneWidget::FormatGrayScale8
Grayscale with one byte per pixel 0 = black 255 = white.
Definition: ksane.h:59
QImage
KSaneIface::KSaneWidget::FormatBMP
The image data is returned as a BMP.
Definition: ksane.h:67
KSaneIface::KSaneWidget::DeviceInfo::name
QString name
Definition: ksane.h:84
KSaneIface::KSaneWidget::DeviceInfo::model
QString model
Definition: ksane.h:86
KSaneIface::KSaneWidget
This class provides the widget containing the scan options and the preview.
Definition: ksane.h:48
KSaneIface::KSaneWidget::DeviceInfo
Definition: ksane.h:82
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libs/libksane/libksane

Skip menu "libs/libksane/libksane"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal