|
|
|
/** @id $Id$
|
|
|
|
|
|
|
|
This file has been added:
|
|
|
|
- by bootstrap.sh
|
|
|
|
- on Tue, 10 November 2015 20:45:44 +0100
|
|
|
|
|
|
|
|
*/
|
|
|
|
// 1 2 3 4 5 6 7 8
|
|
|
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
|
|
|
|
|
|
#ifndef PDFSIGN_HXX
|
|
|
|
#define PDFSIGN_HXX
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <ui_pdfsign.hxx>
|
|
|
|
#include <poppler/qt5/poppler-qt5.h>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
/// Main Window
|
|
|
|
/** Main window for pdfsign */
|
|
|
|
class PdfSign: public QMainWindow, protected Ui::Pdfsign {
|
|
|
|
Q_OBJECT;
|
|
|
|
public:
|
|
|
|
explicit PdfSign(QWidget *parent = 0): QMainWindow(parent) {
|
|
|
|
setupUi(this);
|
|
|
|
}
|
|
|
|
virtual ~PdfSign() {}
|
|
|
|
public slots:
|
|
|
|
void on_actionOpen_triggered() {
|
|
|
|
QString fileName(QFileDialog::getOpenFileName(this, tr("Open PDF File"), QString(),
|
|
|
|
tr("PDF-Document (*.pdf)")));
|
|
|
|
if (fileName.isEmpty()) return;
|
|
|
|
_pdf = std::shared_ptr<Poppler::Document>(Poppler::Document::load(fileName));
|
|
|
|
showPage();
|
|
|
|
}
|
|
|
|
public:
|
|
|
|
void showPage(int pageNumber=0) {
|
|
|
|
if (!_pdf) return;
|
|
|
|
std::shared_ptr<Poppler::Page> pdfPage(_pdf->page(pageNumber));
|
|
|
|
if (!pdfPage) return;
|
|
|
|
_pdfDisplay->setPixmap(QPixmap::fromImage(pdfPage->renderToImage()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
std::shared_ptr<Poppler::Document> _pdf;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|