1 /************************************************************************
2  *									*
3  *  This file is part of Kooka, a scanning/OCR application using	*
4  *  Qt <http://www.qt.io> and KDE Frameworks <http://www.kde.org>.	*
5  *									*
6  *  Copyright (C) 2003-2016 Klaas Freitag <freitag@suse.de>		*
7  *                          Jonathan Marten <jjm@keelhaul.me.uk>	*
8  *									*
9  *  Kooka is free software; you can redistribute it and/or modify it	*
10  *  under the terms of the GNU Library General Public License as	*
11  *  published by the Free Software Foundation and appearing in the	*
12  *  file COPYING included in the packaging of this file;  either	*
13  *  version 2 of the License, or (at your option) any later version.	*
14  *									*
15  *  As a special exception, permission is given to link this program	*
16  *  with any version of the KADMOS OCR/ICR engine (a product of		*
17  *  reRecognition GmbH, Kreuzlingen), and distribute the resulting	*
18  *  executable without including the source code for KADMOS in the	*
19  *  source distribution.						*
20  *									*
21  *  This program is distributed in the hope that it will be useful,	*
22  *  but WITHOUT ANY WARRANTY; without even the implied warranty of	*
23  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	*
24  *  GNU General Public License for more details.			*
25  *									*
26  *  You should have received a copy of the GNU General Public		*
27  *  License along with this program;  see the file COPYING.  If		*
28  *  not, see <http://www.gnu.org/licenses/>.				*
29  *									*
30  ************************************************************************/
31 
32 #ifndef OCROCRADDIALOG_H
33 #define OCROCRADDIALOG_H
34 
35 #include "abstractocrdialogue.h"
36 
37 
38 /**
39   *@author Klaas Freitag
40   */
41 
42 class QWidget;
43 class QComboBox;
44 
45 class KUrlRequester;
46 
47 class KScanSlider;
48 
49 
50 class OcrOcradDialog : public AbstractOcrDialogue
51 {
52     Q_OBJECT
53 
54 public:
55     explicit OcrOcradDialog(AbstractOcrEngine *plugin, QWidget *pnt);
56     ~OcrOcradDialog() override = default;
57 
58     bool setupGui() override;
59 
getOCRCmd()60     QString getOCRCmd() const				{ return (m_ocrCmd); }
61 
62     /*
63      * returns the numeric version of the ocrad program.
64      * Attention: This method returns 10 for ocrad v. 0.10 and 8 for ocrad-0.8
65      */
getNumVersion()66     int getNumVersion() const				{ return (m_versionNum); }
67 
68     QString orfUrl() const;
69 
70 protected:
71     void enableFields(bool enable) override;
72 
73 protected slots:
74     void slotWriteConfig() override;
75 
76 private:
77     void getVersion(const QString &bin);
78     QStringList getValidValues(const QString &opt);
79 
80 private:
81     QWidget *m_setupWidget;
82     KUrlRequester *m_orfUrlRequester;
83     QComboBox *m_layoutMode;
84     QComboBox *m_characterSet;
85     QComboBox *m_filter;
86     QComboBox *m_transform;
87     QCheckBox *m_invert;
88     QCheckBox *m_thresholdEnable;
89     KScanSlider *m_thresholdSlider;
90 
91     QString m_ocrCmd;
92     int m_versionNum;
93     QString m_versionStr;
94 };
95 
96 #endif							// OCROCRADDIALOG_H
97