Engauge Digitizer  2
DlgImportCroppingNonPdf.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_NON_PDF_H
8 #define DLG_IMPORT_CROPPING_NON_PDF_H
9 
10 #include <QDialog>
11 #include <QImage>
12 #include <QObject>
13 
14 class NonPdfCropping;
15 class QGraphicsPixmapItem;
16 class QGridLayout;
17 class QGraphicsScene;
18 class QRectF;
19 class QSpinBox;
20 class QString;
21 class ViewPreview;
22 
24 class DlgImportCroppingNonPdf : public QDialog
25 {
26  Q_OBJECT;
27 
28 public:
30  DlgImportCroppingNonPdf (const QString &fileName);
31  virtual ~DlgImportCroppingNonPdf ();
32 
34  QImage image () const;
35 
37  virtual void showEvent (QShowEvent *event);
38 
39 private slots:
40 
42  void slotCancel();
43 
45  void slotOk ();
46 
47 private:
49 
50  void createNonPdfCropping();
51  void createPreview (QGridLayout *layout,
52  int &row);
53  void finishPanel (QWidget *subPanel);
54  void initializeFrameGeometryAndPixmap ();
55  QImage loadImage () const;
56 
58  static int MINIMUM_DIALOG_WIDTH;
59 
61  static int MINIMUM_PREVIEW_HEIGHT;
62 
63  void saveGeometryToSettings ();
64  void updatePreview ();
65 
66  QPushButton *m_btnCancel;
67  QPushButton *m_btnOk;
68 
69  const QString &m_fileName;
70  QImage m_image; // Needed so it can be passed to external code when this dialog has finished successfully
71  QGraphicsPixmapItem *m_pixmap; // Needed so old image can be removed just before new one gets added
72 
73  QGraphicsScene *m_scenePreview;
74  ViewPreview *m_viewPreview;
75 
76  NonPdfCropping *m_nonPdfCropping;
77 };
78 
79 #endif // DLG_IMPORT_CROPPING_NON_PDF_H
This class shows a frame around the selected portion of the import preview window.
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window...
Definition: ViewPreview.h:14
Dialog for selecting a page and frame on that page when importing an image from a non-pdf file...
virtual void showEvent(QShowEvent *event)
Do preparation before dialog is displayed.
QImage image() const
Image that was selected. Value is null if loading failed.