File indexing completed on 2024-04-14 14:35:58

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) 2000-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 PREFSPAGES_H
0033 #define PREFSPAGES_H
0034 
0035 #include <qwidget.h>
0036 #include <qmap.h>
0037 
0038 #include "abstractplugin.h"
0039 
0040 
0041 class QCheckBox;
0042 class QComboBox;
0043 class QPushButton;
0044 class QRadioButton;
0045 class QLabel;
0046 class QVBoxLayout;
0047 
0048 class KUrlRequester;
0049 class KPageDialog;
0050 
0051 
0052 class KookaPrefsPage : public QWidget
0053 {
0054     Q_OBJECT
0055 
0056 public:
0057     explicit KookaPrefsPage(KPageDialog *parent);
0058     virtual ~KookaPrefsPage() = default;
0059 
0060     virtual void saveSettings() = 0;
0061     virtual void defaultSettings() = 0;
0062 
0063 protected:
0064     QVBoxLayout *mLayout;
0065 };
0066 
0067 class KookaGeneralPage : public KookaPrefsPage
0068 {
0069     Q_OBJECT
0070 
0071 public:
0072     explicit KookaGeneralPage(KPageDialog *parent);
0073 
0074     void saveSettings() override;
0075     void defaultSettings() override;
0076 
0077 private slots:
0078     void slotEnableWarnings();
0079 
0080 private:
0081     QPushButton *mEnableMessagesButton;
0082 };
0083 
0084 
0085 class KookaStartupPage : public KookaPrefsPage
0086 {
0087     Q_OBJECT
0088 
0089 public:
0090     explicit KookaStartupPage(KPageDialog *parent);
0091 
0092     void saveSettings() override;
0093     void defaultSettings() override;
0094 
0095 private:
0096     void applySettings();
0097 
0098     QCheckBox *mNetQueryCheck;
0099     QCheckBox *mSelectScannerCheck;
0100     QCheckBox *mRestoreImageCheck;
0101 };
0102 
0103 
0104 class KookaSavingPage : public KookaPrefsPage
0105 {
0106     Q_OBJECT
0107 
0108 public:
0109     explicit KookaSavingPage(KPageDialog *parent);
0110 
0111     void saveSettings() override;
0112     void defaultSettings() override;
0113 
0114 private:
0115     void applySettings();
0116 
0117     QCheckBox *mAskSaveFormat;
0118     QCheckBox *mAskFileName;
0119     QRadioButton *mAskBeforeScan;
0120     QRadioButton *mAskAfterScan;
0121 };
0122 
0123 
0124 class KookaThumbnailPage : public KookaPrefsPage
0125 {
0126     Q_OBJECT
0127 
0128 public:
0129     KookaThumbnailPage(KPageDialog *parent);
0130 
0131     void saveSettings() override;
0132     void defaultSettings() override;
0133 
0134 private slots:
0135     void slotCustomThumbBgndToggled(bool state);
0136 
0137 private:
0138     void applySettings();
0139 
0140     QCheckBox *mAllowRenameCheck;
0141     QComboBox *mGalleryLayoutCombo;
0142     KUrlRequester *mTileSelector;
0143     QComboBox *mThumbSizeCombo;
0144     QCheckBox *mCustomBackgroundCheck;
0145 };
0146 
0147 
0148 class KookaOcrPage : public KookaPrefsPage
0149 {
0150     Q_OBJECT
0151 
0152 public:
0153     KookaOcrPage(KPageDialog *parent);
0154 
0155     void saveSettings() override;
0156     void defaultSettings() override;
0157 
0158 private slots:
0159     void slotEngineSelected(int i);
0160     void slotOcrAdvanced();
0161 
0162 private:
0163     void applySettings();
0164 
0165     QComboBox *mEngineCombo;
0166     QLabel *mDescLabel;
0167     QPushButton *mOcrAdvancedButton;
0168     QMap<QString,AbstractPluginInfo> mOcrPlugins;
0169 };
0170 
0171 #endif                          // PREFSPAGES_H