2021-04-30 20:12:10 +02:00
|
|
|
// Copyright (C) 2020-2021 Jakub Melka
|
2020-02-08 18:09:46 +01:00
|
|
|
//
|
2020-12-20 19:03:58 +01:00
|
|
|
// This file is part of Pdf4Qt.
|
2020-02-08 18:09:46 +01:00
|
|
|
//
|
2020-12-20 19:03:58 +01:00
|
|
|
// Pdf4Qt is free software: you can redistribute it and/or modify
|
2020-02-08 18:09:46 +01:00
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
2021-04-30 20:12:10 +02:00
|
|
|
// with the written consent of the copyright owner, any later version.
|
2020-02-08 18:09:46 +01:00
|
|
|
//
|
2020-12-20 19:03:58 +01:00
|
|
|
// Pdf4Qt is distributed in the hope that it will be useful,
|
2020-02-08 18:09:46 +01:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
2020-12-20 19:03:58 +01:00
|
|
|
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
|
2020-02-08 18:09:46 +01:00
|
|
|
|
|
|
|
#ifndef PDFRENDERTOIMAGESDIALOG_H
|
|
|
|
#define PDFRENDERTOIMAGESDIALOG_H
|
|
|
|
|
2020-02-09 17:17:14 +01:00
|
|
|
#include "pdfcms.h"
|
2020-02-08 18:09:46 +01:00
|
|
|
#include "pdfrenderer.h"
|
|
|
|
|
|
|
|
#include <QDialog>
|
2020-02-09 17:17:14 +01:00
|
|
|
#include <QFutureWatcher>
|
2020-02-08 18:09:46 +01:00
|
|
|
|
2020-02-09 16:06:29 +01:00
|
|
|
class QAbstractButton;
|
|
|
|
|
2020-02-08 18:09:46 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class PDFRenderToImagesDialog;
|
|
|
|
}
|
|
|
|
|
2020-02-09 16:06:29 +01:00
|
|
|
namespace pdf
|
|
|
|
{
|
|
|
|
class PDFProgress;
|
|
|
|
class PDFDrawWidgetProxy;
|
|
|
|
}
|
|
|
|
|
2020-02-08 18:09:46 +01:00
|
|
|
namespace pdfviewer
|
|
|
|
{
|
|
|
|
|
|
|
|
class PDFRenderToImagesDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-02-09 16:06:29 +01:00
|
|
|
explicit PDFRenderToImagesDialog(const pdf::PDFDocument* document,
|
|
|
|
pdf::PDFDrawWidgetProxy* proxy,
|
|
|
|
pdf::PDFProgress* progress,
|
|
|
|
QWidget* parent);
|
2020-02-08 18:09:46 +01:00
|
|
|
virtual ~PDFRenderToImagesDialog() override;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_selectDirectoryButton_clicked();
|
2020-02-09 16:06:29 +01:00
|
|
|
void on_buttonBox_clicked(QAbstractButton* button);
|
2020-02-08 18:09:46 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Loads image writer settings to the ui
|
|
|
|
void loadImageWriterSettings();
|
|
|
|
|
|
|
|
/// Load image export settigns to the ui
|
|
|
|
void loadImageExportSettings();
|
|
|
|
|
|
|
|
void onFormatChanged();
|
|
|
|
void onSubtypeChanged();
|
|
|
|
void onPagesButtonClicked(bool checked);
|
|
|
|
void onSelectedPagesChanged(const QString& text);
|
|
|
|
void onDirectoryChanged(const QString& text);
|
|
|
|
void onFileTemplateChanged(const QString& text);
|
|
|
|
void onResolutionButtonClicked(bool checked);
|
|
|
|
void onResolutionDPIChanged(int value);
|
|
|
|
void onResolutionPixelsChanged(int value);
|
|
|
|
void onCompressionChanged(int value);
|
|
|
|
void onQualityChanged(int value);
|
|
|
|
void onGammaChanged(double value);
|
|
|
|
void onOptimizedWriteChanged(bool value);
|
|
|
|
void onProgressiveScanWriteChanged(bool value);
|
2020-10-28 16:35:16 +01:00
|
|
|
void onRenderError(pdf::PDFInteger pageIndex, pdf::PDFRenderError error);
|
2020-02-09 17:17:14 +01:00
|
|
|
void onRenderingFinished();
|
2020-02-08 18:09:46 +01:00
|
|
|
|
|
|
|
Ui::PDFRenderToImagesDialog* ui;
|
2020-02-09 16:06:29 +01:00
|
|
|
const pdf::PDFDocument* m_document;
|
|
|
|
pdf::PDFDrawWidgetProxy* m_proxy;
|
|
|
|
pdf::PDFProgress* m_progress;
|
2020-02-08 18:09:46 +01:00
|
|
|
pdf::PDFImageWriterSettings m_imageWriterSettings;
|
|
|
|
pdf::PDFPageImageExportSettings m_imageExportSettings;
|
|
|
|
bool m_isLoadingData;
|
2020-02-09 17:17:14 +01:00
|
|
|
QFutureWatcher<void> m_watcher;
|
|
|
|
|
|
|
|
std::vector<pdf::PDFInteger> m_pageIndices;
|
|
|
|
pdf::PDFOptionalContentActivity* m_optionalContentActivity;
|
|
|
|
pdf::PDFCMSPointer m_cms;
|
|
|
|
pdf::PDFRasterizerPool* m_rasterizerPool;
|
2020-02-08 18:09:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pdfviewer
|
|
|
|
|
2020-02-09 18:44:11 +01:00
|
|
|
Q_DECLARE_METATYPE(pdf::PDFRenderError)
|
|
|
|
|
2020-02-08 18:09:46 +01:00
|
|
|
#endif // PDFRENDERTOIMAGESDIALOG_H
|