Engauge Digitizer  2
DlgImportCroppingPdf.h
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 
14 namespace Poppler {
15  class Document;
16 }
17 class PdfCropping;
18 class QGraphicsPixmapItem;
19 class QGridLayout;
20 class QGraphicsScene;
21 class QRectF;
22 class QSpinBox;
23 class QString;
24 class QTimer;
25 class ViewPreview;
26 
28 class DlgImportCroppingPdf : public QDialog
29 {
30  Q_OBJECT;
31 
32 public:
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 
44 private slots:
45 
47  void slotCancel();
48 
50  void slotOk ();
51 
53  void slotPage (int);
54 
56  void slotTimeout ();
57 
58 private:
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
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window...
Definition: ViewPreview.h:14
This class shows a frame around the selected portion of the pdf import preview window.
Definition: PdfCropping.h:24
Storage of one imported image and the data attached to that image.
Definition: Document.h:41
Dialog for selecting a page and frame on that page when importing an image from a pdf file...