/** * @RDE_HEADER@ * Handle PDF output for thp * $Id$ * $HeadURL$ * $Author$ */ #include "thp_pdf_widget.h" #include "ui_thp_pdf_widget.h" namespace THP { PdfWidget::PdfWidget(QWidget *parent) : QWidget(parent) , ui(new Ui::PdfWidget) { ui->setupUi(this); connect(ui->previousPage, &QToolButton::clicked, this, &PdfWidget::onPreviousPage); connect(ui->nextPage, &QToolButton::clicked, this, &PdfWidget::onNextPage); connect(ui->pdfDocument, &NGL::PDFDocument::currentPageChanged, this, &PdfWidget::pageChanged); } PdfWidget::~PdfWidget() { delete ui; } bool PdfWidget::showPDF(const QUrl &pdf) { return ui->pdfDocument->showPDF(pdf); } void PdfWidget::setZoomFactor(double newZoomFactor) { ui->pdfDocument->setZoomFactor(newZoomFactor); } void PdfWidget::onPreviousPage() { ui->pdfDocument->previousPage(); } void PdfWidget::onNextPage() { ui->pdfDocument->nextPage(); } QVector PdfWidget::getPrintableImages(int resolution) { return ui->pdfDocument->getPrintableImages(resolution); } void PdfWidget::resizePdfToWidth() { ui->pdfDocument->resizePdfToWidth(); } void PdfWidget::pageChanged(int cur, int max) { ui->pageLabel->setText(tr("Page %1 of %2").arg(cur).arg(max)); ui->nextPage->setEnabled(cur < max); ui->previousPage->setEnabled(cur > 1); } } // namespace THP