1 /*
2  * Copyright (C) Pedram Pourang (aka Tsu Jan) 2020 <tsujan2000@gmail.com>
3  *
4  * FeatherPad is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * FeatherPad is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  * @license GPL-3.0+ <https://spdx.org/licenses/GPL-3.0+.html>
18  */
19 
20 #ifndef PRINTING_H
21 #define PRINTING_H
22 
23 #include <QThread>
24 #include <QColor>
25 #include <QTextDocument>
26 #include <QPrinter>
27 
28 namespace FeatherPad {
29 
30 class Printing : public QThread {
31     Q_OBJECT
32 
33 public:
34     Printing (QTextDocument *document, const QString &fileName,
35               const QColor &textColor, int darkValue,
36               qreal sourceDpiX, qreal sourceDpiY);
37     ~Printing();
38 
printer()39     QPrinter* printer() const {
40         return printer_;
41     }
42 
43 private:
44     void run();
45 
46     QTextDocument *document_;
47     QPrinter *printer_;
48     QColor textColor_;
49     QColor darkColor_;
50     qreal sourceDpiX_;
51     qreal sourceDpiY_;
52 };
53 
54 }
55 
56 #endif // PRINTING_H
57