Engauge Digitizer 2
Loading...
Searching...
No Matches
NonPdf.cpp
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
9#include "NonPdf.h"
10#include <QApplication>
11#include <QImage>
12#include <QString>
13
15{
16}
17
19 QImage &image,
20 ImportCropping importCropping,
22{
25 importCropping);
26
28 QApplication::setOverrideCursor(Qt::BusyCursor); // Since loading can be slow
29 if (cropping) {
30
31 rtn = loadWithCropping (fileName,
32 image);
33
34 } else {
35
36 rtn = loadWithoutCropping (fileName,
37 image);
38
39 }
40 QApplication::restoreOverrideCursor();
41
42 return rtn;
43}
44
45NonPdfReturn NonPdf::loadWithCropping (const QString &fileName,
46 QImage &image) const
47{
49
50 // Get page and extent. At this point it is always true that the image can be read
52 if (dlg.exec() == QDialog::Accepted) {
53
54 // Returned image is null if it could not be read
55 image = dlg.image ();
56
57 if (!image.isNull()) {
59 }
60
61 } else {
63 }
64
65 return nonPdfReturn;
66}
67
68NonPdfReturn NonPdf::loadWithoutCropping (const QString &fileName,
69 QImage &image) const
70{
72
73 if (image.load (fileName)) {
75 }
76
77 return nonPdfReturn;
78}
const int INNER_RADIUS_MIN
ImportCropping
NonPdfReturn
Return values from load operation.
Definition NonPdf.h:19
@ NON_PDF_RETURN_FAILED
Definition NonPdf.h:21
@ NON_PDF_RETURN_CANCELED
Definition NonPdf.h:20
@ NON_PDF_RETURN_SUCCESS
Definition NonPdf.h:22
Dialog for selecting a page and frame on that page when importing an image from a non-pdf file.
bool applyImportCropping(bool isRegression, ImportCropping importCropping) const
Skip cropping dialog during regression testing, otherwise crop if it is always turned on.
NonPdfReturn load(const QString &fileName, QImage &image, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
Definition NonPdf.cpp:18
NonPdf()
Single constructor.
Definition NonPdf.cpp:14