File indexing completed on 2025-01-12 12:39:36
0001 /* This file is part of the KDE Project -*- mode:c++; -*- 0002 Copyright (C) 1999 Klaas Freitag <freitag@suse.de> 0003 Copyright (C) 2009 Jonathan Marten <jjm@keelhaul.me.uk> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef SCANDEVICES_H 0022 #define SCANDEVICES_H 0023 0024 #include "kookascan_export.h" 0025 0026 #include <qbytearray.h> 0027 #include <qlist.h> 0028 #include <qhash.h> 0029 0030 extern "C" { 0031 #include <sane/sane.h> // to define SANE_Device 0032 } 0033 0034 class KOOKASCAN_EXPORT ScanDevices 0035 { 0036 public: 0037 static ScanDevices *self(); 0038 0039 /** 0040 * returns the names of all existing Scan Devices in the system. 0041 */ 0042 const QList<QByteArray> &allDevices() const 0043 { 0044 return (mScannerNames); 0045 } 0046 0047 /** 0048 * returns the SANE device information for a Scan Device. 0049 */ 0050 const SANE_Device *deviceInfo(const QByteArray &backend) const; 0051 0052 /** 0053 * returns a readable device description for a Scan Device. 0054 */ 0055 QString deviceDescription(const QByteArray &backend) const; 0056 0057 /** 0058 * Add an explicitly specified device to the list of known ones. 0059 * @param backend the device name+parameters of the backend to add 0060 * @param description a readable description for it 0061 * @param dontSave if @c true, don't save the new device in the permanent configuration 0062 */ 0063 void addUserSpecifiedDevice(const QByteArray &backend, 0064 const QString &description, 0065 const QByteArray &type = "", 0066 bool dontSave = false); 0067 0068 private: 0069 explicit ScanDevices(); 0070 ~ScanDevices(); 0071 0072 private: 0073 QList<QByteArray> mScannerNames; 0074 QHash<QByteArray, const SANE_Device *> mScannerDevices; 0075 0076 class ScanDevicesPrivate; 0077 ScanDevicesPrivate *d; 0078 }; 0079 0080 #endif // SCANDEVICES_H