File indexing completed on 2024-04-14 14:35:55
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 KOOKA_H 0033 #define KOOKA_H 0034 0035 #include <kxmlguiwindow.h> 0036 0037 #include "kookaview.h" 0038 0039 class KConfigGroup; 0040 class KToggleAction; 0041 class QAction; 0042 class KActionMenu; 0043 0044 0045 /** 0046 * This class serves as the main window for Kooka. It handles the 0047 * menus, toolbars, and status bars. 0048 * 0049 * @short Main window class 0050 * @author Klaas Freitag <freitag@suse.de> 0051 * @version 0.1 0052 */ 0053 class Kooka : public KXmlGuiWindow 0054 { 0055 Q_OBJECT 0056 0057 public: 0058 /** 0059 * Default Constructor 0060 */ 0061 explicit Kooka(const QByteArray &deviceToUse); 0062 0063 /** 0064 * Default Destructor 0065 */ 0066 ~Kooka() override; 0067 0068 /** 0069 * Startup, loads (at the moment) only the last displayed image 0070 **/ 0071 void startup(); 0072 0073 protected: 0074 void closeEvent(QCloseEvent *ev) override; 0075 0076 /** 0077 * Overridden virtuals for Qt drag 'n drop (XDND) 0078 */ 0079 void dragEnterEvent(QDragEnterEvent *ev) override; 0080 // virtual void dropEvent(QDropEvent *event); 0081 0082 /** 0083 * This function is called when it is time for the app to save its 0084 * properties for session management purposes. 0085 */ 0086 void saveProperties(KConfigGroup &grp) override; 0087 0088 /** 0089 * This function is called when this app is restored. The KConfig 0090 * object points to the session management config file that was saved 0091 * with @ref saveProperties 0092 */ 0093 void readProperties(const KConfigGroup &grp) override; 0094 0095 void applyMainWindowSettings(const KConfigGroup &grp) override; 0096 0097 protected slots: 0098 void slotUpdateScannerActions(bool haveConnection); 0099 void slotUpdateRectangleActions(bool haveSelection); 0100 void slotUpdateViewActions(KookaView::StateFlags state); 0101 void slotUpdateOcrResultActions(bool haveText); 0102 void slotOpenWithMenu(); 0103 void slotUpdateReadOnlyActions(bool ro); 0104 void slotUpdateAutoSelectActions(bool isAvailable, bool isOn); 0105 0106 private slots: 0107 void filePrint(); 0108 0109 void optionsPreferences(); 0110 void optionsOcrPreferences(); 0111 0112 private: 0113 void setupAccel(); 0114 void setupActions(); 0115 0116 private: 0117 KookaView *m_view; 0118 0119 KToggleAction *m_scanParamsAction; 0120 KToggleAction *m_previewerAction; 0121 0122 QAction *m_saveOCRTextAction; 0123 int m_prefDialogIndex; 0124 0125 QAction *scanAction; 0126 QAction *previewAction; 0127 QAction *paramsAction; 0128 KToggleAction *autoselAction; 0129 QAction *ocrAction; 0130 QAction *ocrSelectAction; 0131 QAction *ocrSpellAction; 0132 0133 QAction *newFromSelectionAction; 0134 QAction *scaleToWidthAction; 0135 QAction *scaleToHeightAction; 0136 QAction *scaleToOriginalAction; 0137 QAction *scaleToZoomAction; 0138 KToggleAction *keepZoomAction; 0139 QAction *mirrorVerticallyAction; 0140 QAction *mirrorHorizontallyAction; 0141 QAction *rotateCwAction; 0142 QAction *rotateAcwAction; 0143 QAction *rotate180Action; 0144 0145 QAction *createFolderAction; 0146 QAction *saveImageAction; 0147 QAction *printImageAction; 0148 QAction *importImageAction; 0149 QAction *deleteImageAction; 0150 QAction *renameImageAction; 0151 QAction *unloadImageAction; 0152 QAction *propsImageAction; 0153 0154 QAction *selectDeviceAction; 0155 QAction *addDeviceAction; 0156 0157 KActionMenu *openWithMenu; 0158 0159 bool m_imageChangeAllowed; 0160 }; 0161 0162 #endif // KOOKA_H