1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/* This file is part of the KDE Project
Copyright (C) 2000 Klaas Freitag <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PREVIEWER_H
#define PREVIEWER_H
#include <qwidget.h>
#include <qimage.h>
#include <qrect.h>
#include <qbuttongroup.h>
#include <qpoint.h>
#include <kruler.h>
#include <qmemarray.h>
/**
*@author Klaas Freitag
*/
class ImageCanvas;
class QCheckBox;
class QSlider;
class KScanDevice;
class QComboBox;
class QRadioButton;
class QHBoxLayout;
class Previewer : public QWidget
{
Q_OBJECT
public:
Previewer(QWidget *parent=0, const char *name=0);
~Previewer();
ImageCanvas *getImageCanvas( void ){ return( img_canvas ); }
/**
* Static function that returns the image gallery base dir.
*/
static QString galleryRoot();
bool setPreviewImage( const QImage &image );
void findSelection();
public slots:
void newImage( QImage* );
void slFormatChange( int id );
void slOrientChange(int);
void slSetDisplayUnit( KRuler::MetricStyle unit );
void setScanSize( int w, int h, KRuler::MetricStyle unit );
void slCustomChange( void );
void slNewDimen(QRect r);
void slNewScanResolutions( int, int );
void recalcFileSize( void );
void slSetAutoSelThresh(int);
void slSetAutoSelDustsize(int);
void slSetScannerBgIsWhite(bool b);
void slConnectScanner( KScanDevice *scan );
protected slots:
void slScaleToWidth();
void slScaleToHeight();
void slAutoSelToggled(bool);
void slScanBackgroundChanged(int);
signals:
void newRect( QRect );
void noRect( void );
void setScanWidth(const QString&);
void setScanHeight(const QString&);
void setSelectionSize( long );
private:
void checkForScannerBg();
QPoint calcPercent( int, int );
QHBoxLayout *layout;
ImageCanvas *img_canvas;
QComboBox *pre_format_combo;
QMemArray<QCString> format_ids;
QButtonGroup * bgroup;
QRadioButton * rb1;
QRadioButton * rb2;
QImage m_previewImage;
bool imagePiece( QMemArray<long> src,
int& start,
int& end );
int landscape_id, portrait_id;
double overallWidth, overallHeight;
KRuler::MetricStyle sizeUnit;
KRuler::MetricStyle displayUnit;
bool isCustom;
int scanResX, scanResY;
int pix_per_byte;
double selectionWidthMm;
double selectionHeightMm;
class PreviewerPrivate;
PreviewerPrivate *d;
};
#endif
|