1/*
2 * Copyright (C) 2008, Pino Toscano <pino@kde.org>
3 * Copyright (C) 2021, Mahmoud Khalil <mahmoudkhalil11@gmail.com>
4 * Copyright (C) 2021, Oliver Sander <oliver.sander@tu-dresden.de>
5 * Copyright (C) 2021, Albert Astals Cid <aacid@kde.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22#ifndef PDFVIEWER_H
23#define PDFVIEWER_H
24
25#include <QtWidgets/QMainWindow>
26
27class QAction;
28class QActionGroup;
29class QLabel;
30class DocumentObserver;
31namespace Poppler {
32class Document;
33}
34
35class PdfViewer : public QMainWindow
36{
37 Q_OBJECT
38
39 friend class DocumentObserver;
40
41public:
42 explicit PdfViewer(QWidget *parent = nullptr);
43 ~PdfViewer() override;
44
45 QSize sizeHint() const override;
46
47 void loadDocument(const QString &file);
48 void closeDocument();
49
50private Q_SLOTS:
51 void slotOpenFile();
52 void slotSaveCopy();
53 void slotAbout();
54 void slotAboutQt();
55 void slotToggleTextAA(bool value);
56 void slotToggleGfxAA(bool value);
57 void slotRenderBackend(QAction *act);
58
59private:
60 void setPage(int page);
61 int page() const;
62 void xrefReconstructedHandler();
63
64 int m_currentPage;
65 bool xrefReconstructed;
66
67 QAction *m_fileOpenAct;
68 QAction *m_fileSaveCopyAct;
69 QAction *m_settingsTextAAAct;
70 QAction *m_settingsGfxAAAct;
71 QActionGroup *m_settingsRenderBackendGrp;
72
73 QList<DocumentObserver *> m_observers;
74
75 std::unique_ptr<Poppler::Document> m_doc;
76};
77
78#endif
79

source code of poppler/qt6/demos/viewer.h