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) 2000-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 PREFSPAGES_H 33 #define PREFSPAGES_H 34 35 #include <qwidget.h> 36 #include <qmap.h> 37 38 #include "abstractplugin.h" 39 40 41 class QCheckBox; 42 class QComboBox; 43 class QPushButton; 44 class QRadioButton; 45 class QLabel; 46 class QVBoxLayout; 47 48 class KUrlRequester; 49 class KPageDialog; 50 51 52 class KookaPrefsPage : public QWidget 53 { 54 Q_OBJECT 55 56 public: 57 explicit KookaPrefsPage(KPageDialog *parent); 58 virtual ~KookaPrefsPage() = default; 59 60 virtual void saveSettings() = 0; 61 virtual void defaultSettings() = 0; 62 63 protected: 64 QVBoxLayout *mLayout; 65 }; 66 67 class KookaGeneralPage : public KookaPrefsPage 68 { 69 Q_OBJECT 70 71 public: 72 explicit KookaGeneralPage(KPageDialog *parent); 73 74 void saveSettings() override; 75 void defaultSettings() override; 76 77 private slots: 78 void slotEnableWarnings(); 79 80 private: 81 QPushButton *mEnableMessagesButton; 82 }; 83 84 85 class KookaStartupPage : public KookaPrefsPage 86 { 87 Q_OBJECT 88 89 public: 90 explicit KookaStartupPage(KPageDialog *parent); 91 92 void saveSettings() override; 93 void defaultSettings() override; 94 95 private: 96 void applySettings(); 97 98 QCheckBox *mNetQueryCheck; 99 QCheckBox *mSelectScannerCheck; 100 QCheckBox *mRestoreImageCheck; 101 }; 102 103 104 class KookaSavingPage : public KookaPrefsPage 105 { 106 Q_OBJECT 107 108 public: 109 explicit KookaSavingPage(KPageDialog *parent); 110 111 void saveSettings() override; 112 void defaultSettings() override; 113 114 private: 115 void applySettings(); 116 117 QCheckBox *mAskSaveFormat; 118 QCheckBox *mAskFileName; 119 QRadioButton *mAskBeforeScan; 120 QRadioButton *mAskAfterScan; 121 }; 122 123 124 class KookaThumbnailPage : public KookaPrefsPage 125 { 126 Q_OBJECT 127 128 public: 129 KookaThumbnailPage(KPageDialog *parent); 130 131 void saveSettings() override; 132 void defaultSettings() override; 133 134 private slots: 135 void slotCustomThumbBgndToggled(bool state); 136 137 private: 138 void applySettings(); 139 140 QCheckBox *mAllowRenameCheck; 141 QComboBox *mGalleryLayoutCombo; 142 KUrlRequester *mTileSelector; 143 QComboBox *mThumbSizeCombo; 144 QCheckBox *mCustomBackgroundCheck; 145 }; 146 147 148 class KookaOcrPage : public KookaPrefsPage 149 { 150 Q_OBJECT 151 152 public: 153 KookaOcrPage(KPageDialog *parent); 154 155 void saveSettings() override; 156 void defaultSettings() override; 157 158 private slots: 159 void slotEngineSelected(int i); 160 void slotOcrAdvanced(); 161 162 private: 163 void applySettings(); 164 165 QComboBox *mEngineCombo; 166 QLabel *mDescLabel; 167 QPushButton *mOcrAdvancedButton; 168 QMap<QString,AbstractPluginInfo> mOcrPlugins; 169 }; 170 171 #endif // PREFSPAGES_H 172