File indexing completed on 2024-04-21 15:12:13

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 SCANGLOBAL_H
0022 #define SCANGLOBAL_H
0023 
0024 #include "kookascan_export.h"
0025 
0026 #include <qstring.h>
0027 
0028 class KConfigGroup;
0029 class KScanDevice;
0030 
0031 
0032 class KOOKASCAN_EXPORT ScanGlobal
0033 {
0034 
0035 public:
0036     /**
0037      * Create (if necessary) and return the single instance.
0038      */
0039     static ScanGlobal *self();
0040 
0041     /**
0042      * Calls sane_init() to initialize the SANE library, the first time this
0043      * function is called.  Subsequent calls are ignored.  Sets up to call
0044      * sane_exit() when the application exits.
0045      *
0046      * @return @c true if SANE initialization succeeded
0047      */
0048     bool init();
0049 
0050     /**
0051      * Checks whether SANE initialization succeeded.
0052      *
0053      * @return @c true if @c init() has been called and it did, @c false if it did not. 
0054      * @see init
0055      */
0056     bool available() const;
0057 
0058     /**
0059      * Set the scanner device in use.  If authentication is required, its
0060      * @c authenticate() function will be called which is expected to supply
0061      * or prompt for a username/password.
0062      */
0063     void setScanDevice(KScanDevice *device);
0064 
0065 private:
0066     ScanGlobal();
0067     ~ScanGlobal();
0068 
0069     bool mSaneInitDone;
0070     bool mSaneInitError;
0071 };
0072 
0073 #endif                          // SCANGLOBAL_H