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

0001 /************************************************************************
0002  *                                  *
0003  *  This file is part of Kooka, a scanning/OCR application using    *
0004  *  Qt <http://www.qt.io> and KDE Frameworks <http://www.kde.org>.  *
0005  *                                  *
0006  *  Copyright (C) 2016 Jonathan Marten <jjm@keelhaul.me.uk>     *
0007  *                                  *
0008  *  Kooka is free software; you can redistribute it and/or modify it    *
0009  *  under the terms of the GNU Library General Public License as    *
0010  *  published by the Free Software Foundation and appearing in the  *
0011  *  file COPYING included in the packaging of this file;  either    *
0012  *  version 2 of the License, or (at your option) any later version.    *
0013  *                                  *
0014  *  As a special exception, permission is given to link this program    *
0015  *  with any version of the KADMOS OCR/ICR engine (a product of     *
0016  *  reRecognition GmbH, Kreuzlingen), and distribute the resulting  *
0017  *  executable without including the source code for KADMOS in the  *
0018  *  source distribution.                        *
0019  *                                  *
0020  *  This program is distributed in the hope that it will be useful, *
0021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *
0022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
0023  *  GNU General Public License for more details.            *
0024  *                                  *
0025  *  You should have received a copy of the GNU General Public       *
0026  *  License along with this program;  see the file COPYING.  If     *
0027  *  not, see <http://www.gnu.org/licenses/>.                *
0028  *                                  *
0029  ************************************************************************/
0030 
0031 #ifndef SCANICONS_H
0032 #define SCANICONS_H
0033 
0034 #include "kookascan_export.h"
0035 
0036 #include <qicon.h>
0037 
0038 
0039 /**
0040  * @short Access to scanner icons.
0041  *
0042  * This class provides access to icons and pixmaps representing an scan
0043  * or an image type.
0044  *
0045  * @author Jonathan Marten
0046  **/
0047 
0048 class KOOKASCAN_EXPORT ScanIcons
0049 {
0050 public:
0051     /**
0052      * Access to the singleton object.
0053      *
0054      * @return the object
0055      **/
0056     static ScanIcons *self();
0057 
0058     /**
0059      * An icon type.
0060      **/
0061     enum IconType
0062     {
0063         BlackWhite,             ///< Black/white bitmap
0064         Greyscale,              ///< Grey scale
0065         Halftone,               ///< Halftone
0066         Colour                  ///< Colour
0067     };
0068 
0069     /**
0070      * Get an icon for the specified scan or image type.
0071      *
0072      * @param type The required type
0073      * @return The requested icon
0074      **/
0075     QIcon icon(ScanIcons::IconType type);
0076 
0077     /**
0078      * Get an icon for the specified SANE scan mode.
0079      *
0080      * @param scanMode The SANE mode setting
0081      * @return The requested icon.
0082      **/
0083     QIcon icon(const QByteArray &scanMode);
0084 
0085     /**
0086      * Retrieve a list of all known SANE scan mode strings.
0087      *
0088      * @return A list of all known modes.
0089      **/
0090     QList<QByteArray> allModes() const;
0091 
0092 private:
0093     explicit ScanIcons();
0094 
0095 private:
0096     QIcon mBlackWhiteIcon;
0097     QIcon mGreyscaleIcon;
0098     QIcon mHalftoneIcon;
0099     QIcon mColourIcon;
0100 };
0101 
0102 #endif                          // SCANICONS_H