File indexing completed on 2024-04-21 15:12:14

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) 2008-2016 Jonathan Marten <jjm@keelhaul.me.uk>    *
0007  *                                  *
0008  *  Kooka is free software; you can redistribute it and/or modify it    *
0009  *  under the terms of the GNU Library General Public License as    *
0010  *  published by the Free Software Foundation and appearing in the  *
0011  *  file COPYING included in the packaging of this file;  either    *
0012  *  version 2 of the License, or (at your option) any later version.    *
0013  *                                  *
0014  *  As a special exception, permission is given to link this program    *
0015  *  with any version of the KADMOS OCR/ICR engine (a product of     *
0016  *  reRecognition GmbH, Kreuzlingen), and distribute the resulting  *
0017  *  executable without including the source code for KADMOS in the  *
0018  *  source distribution.                        *
0019  *                                  *
0020  *  This program is distributed in the hope that it will be useful, *
0021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *
0022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
0023  *  GNU General Public License for more details.            *
0024  *                                  *
0025  *  You should have received a copy of the GNU General Public       *
0026  *  License along with this program;  see the file COPYING.  If     *
0027  *  not, see <http://www.gnu.org/licenses/>.                *
0028  *                                  *
0029  ************************************************************************/
0030 
0031 #ifndef SCANSIZESELECTOR_H
0032 #define SCANSIZESELECTOR_H
0033 
0034 #include "kookascan_export.h"
0035 
0036 #include <qframe.h>
0037 #include <qsize.h>
0038 #include <qrect.h>
0039 
0040 
0041 class QComboBox;
0042 class QRadioButton;
0043 
0044 class PaperSize;
0045 
0046 class KOOKASCAN_EXPORT ScanSizeSelector : public QFrame
0047 {
0048     Q_OBJECT
0049 
0050 public:
0051     explicit ScanSizeSelector(QWidget *parent, const QSize &bedSize);
0052     ~ScanSizeSelector();
0053 
0054     void selectCustomSize(const QRect &rect);
0055     void selectSize(const QRect &rect);
0056 
0057 protected slots:
0058     void slotSizeSelected(int idx);
0059     void slotPortraitLandscape(int id);
0060 
0061 signals:
0062     void sizeSelected(const QRect &size);
0063 
0064 private:
0065     void newScanSize(int width, int height);
0066     void implementPortraitLandscape(const PaperSize *sp);
0067     void implementSizeSetting(const PaperSize *sp);
0068 
0069     int bedWidth, bedHeight;
0070 
0071     QRect m_customSize;
0072     int m_prevSelected;
0073 
0074     QComboBox *m_sizeCb;
0075     QRadioButton *m_portraitRb;
0076     QRadioButton *m_landscapeRb;
0077 };
0078 
0079 #endif                          // SCANSIZESELECTOR_H