Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgImportCroppingPdf.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef DLG_IMPORT_CROPPING_PDF_H
8#define DLG_IMPORT_CROPPING_PDF_H
9
10#include <QDialog>
11#include <QImage>
12#include <QObject>
13
14namespace Poppler {
15 class Document;
16}
17class PdfCropping;
18class QGraphicsPixmapItem;
19class QGridLayout;
20class QGraphicsScene;
21class QRectF;
22class QSpinBox;
23class QString;
24class QTimer;
25class ViewPreview;
26
28class DlgImportCroppingPdf : public QDialog
29{
30 Q_OBJECT;
31
32public:
34 DlgImportCroppingPdf (const Poppler::Document &document,
35 int resolution);
36 virtual ~DlgImportCroppingPdf ();
37
39 QImage image () const;
40
42 virtual void showEvent (QShowEvent *event);
43
44private slots:
45
47 void slotCancel();
48
50 void slotOk ();
51
53 void slotPage (int);
54
56 void slotTimeout ();
57
58private:
60
61 void createPageSpinner (QGridLayout *layout,
62 int &row);
63 void createPdfCropping ();
64 void createPreview (QGridLayout *layout,
65 int &row);
66 void createTimer ();
67 void finishPanel (QWidget *subPanel);
68 void initializeFrameGeometryAndPixmap ();
69 QImage loadImage (int page1Based) const;
70
72 static int MINIMUM_DIALOG_WIDTH;
73
75 static int MINIMUM_PREVIEW_HEIGHT;
76
77 void saveGeometryToSettings ();
78 void updatePreview ();
79
80 QSpinBox *m_spinPage;
81 QPushButton *m_btnCancel;
82 QPushButton *m_btnOk;
83
84 QTimer *m_timer;
85 const Poppler::Document &m_document;
86 int m_resolution;
87 QImage m_image; // Needed so it can be passed to external code when this dialog has finished successfully
88 QGraphicsPixmapItem *m_pixmap; // Needed so old image can be removed just before new one gets added
89
90 QGraphicsScene *m_scenePreview;
91 ViewPreview *m_viewPreview;
92
93 PdfCropping *m_pdfCropping;
94};
95
96#endif // DLG_IMPORT_CROPPING_PDF_H
virtual void showEvent(QShowEvent *event)
Do preparation before dialog is displayed.
QImage image() const
Image that was selected. Value is null if loading failed.
DlgImportCroppingPdf(const Poppler::Document &document, int resolution)
Single constructor.
Storage of one imported image and the data attached to that image.
Definition Document.h:44
This class shows a frame around the selected portion of the pdf import preview window.
Definition PdfCropping.h:25
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window,...
Definition ViewPreview.h:15