File indexing completed on 2024-04-21 05:54:06

0001 /**
0002  * SPDX-FileCopyrightText: 2021 by Alexander Stippich <a.stippich@gmx.net>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef DOCUMENT_PRINTER_H
0008 #define DOCUMENT_PRINTER_H
0009 
0010 #include <memory>
0011 
0012 #include <QObject>
0013 #include <QString>
0014 #include <QFuture>
0015 
0016 #include "SkanpageUtils.h"
0017 
0018 class QPrinter;
0019 
0020 class DocumentPrinter : public QObject
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025 
0026     explicit DocumentPrinter(QObject *parent = nullptr);
0027     ~DocumentPrinter();
0028 
0029     void printDocument(const SkanpageUtils::DocumentPages &document);
0030 
0031 Q_SIGNALS:
0032     void showUserMessage(SkanpageUtils::MessageLevel level, const QString &text);
0033 
0034 private:
0035     void print(const SkanpageUtils::DocumentPages &document);
0036 
0037     std::unique_ptr<QPrinter> m_printer;
0038     QFuture<void> m_future;
0039 };
0040 
0041 #endif // DOCUMENT_PRINTER_H