File indexing completed on 2024-05-12 15:55:07

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) 2003-2016 Klaas Freitag <freitag@suse.de>     *
0007  *                          Jonathan Marten <jjm@keelhaul.me.uk>    *
0008  *                                  *
0009  *  Kooka is free software; you can redistribute it and/or modify it    *
0010  *  under the terms of the GNU Library General Public License as    *
0011  *  published by the Free Software Foundation and appearing in the  *
0012  *  file COPYING included in the packaging of this file;  either    *
0013  *  version 2 of the License, or (at your option) any later version.    *
0014  *                                  *
0015  *  As a special exception, permission is given to link this program    *
0016  *  with any version of the KADMOS OCR/ICR engine (a product of     *
0017  *  reRecognition GmbH, Kreuzlingen), and distribute the resulting  *
0018  *  executable without including the source code for KADMOS in the  *
0019  *  source distribution.                        *
0020  *                                  *
0021  *  This program is distributed in the hope that it will be useful, *
0022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *
0023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
0024  *  GNU General Public License for more details.            *
0025  *                                  *
0026  *  You should have received a copy of the GNU General Public       *
0027  *  License along with this program;  see the file COPYING.  If     *
0028  *  not, see <http://www.gnu.org/licenses/>.                *
0029  *                                  *
0030  ************************************************************************/
0031 
0032 #ifndef OCROCRADDIALOG_H
0033 #define OCROCRADDIALOG_H
0034 
0035 #include "abstractocrdialogue.h"
0036 
0037 
0038 /**
0039   *@author Klaas Freitag
0040   */
0041 
0042 class QWidget;
0043 class QComboBox;
0044 
0045 class KUrlRequester;
0046 
0047 class KScanSlider;
0048 
0049 
0050 class OcrOcradDialog : public AbstractOcrDialogue
0051 {
0052     Q_OBJECT
0053 
0054 public:
0055     explicit OcrOcradDialog(AbstractOcrEngine *plugin, QWidget *pnt);
0056     ~OcrOcradDialog() override = default;
0057 
0058     bool setupGui() override;
0059 
0060     QString getOCRCmd() const               { return (m_ocrCmd); }
0061 
0062     /*
0063      * returns the numeric version of the ocrad program.
0064      * Attention: This method returns 10 for ocrad v. 0.10 and 8 for ocrad-0.8
0065      */
0066     int getNumVersion() const               { return (m_versionNum); }
0067 
0068     QString orfUrl() const;
0069 
0070 protected:
0071     void enableFields(bool enable) override;
0072 
0073 protected slots:
0074     void slotWriteConfig() override;
0075 
0076 private:
0077     void getVersion(const QString &bin);
0078     QStringList getValidValues(const QString &opt);
0079 
0080 private:
0081     QWidget *m_setupWidget;
0082     KUrlRequester *m_orfUrlRequester;
0083     QComboBox *m_layoutMode;
0084     QComboBox *m_characterSet;
0085     QComboBox *m_filter;
0086     QComboBox *m_transform;
0087     QCheckBox *m_invert;
0088     QCheckBox *m_thresholdEnable;
0089     KScanSlider *m_thresholdSlider;
0090 
0091     QString m_ocrCmd;
0092     int m_versionNum;
0093     QString m_versionStr;
0094 };
0095 
0096 #endif                          // OCROCRADDIALOG_H