Debian Codegraph @

qt6/demos/viewer.h

raw
1 /*
2 * Copyright (C) 2008, Pino Toscano <[email protected]>
3 * Copyright (C) 2021, Mahmoud Khalil <[email protected]>
4 * Copyright (C) 2021, Oliver Sander <[email protected]>
5 * Copyright (C) 2021, Albert Astals Cid <[email protected]>
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
27 class QAction;
28 class QActionGroup;
29 class QLabel;
30 class DocumentObserver;
31 namespace Poppler {
32 class Document;
33 }
34
35 class PdfViewer : public QMainWindow
36 {
37 Q_OBJECT
38
39 friend class DocumentObserver;
40
41 public:
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
50 private:
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
59 void setPage(int page);
60 int page() const;
61 void xrefReconstructedHandler();
62
63 int m_currentPage;
64 bool xrefReconstructed;
65
66 QAction *m_fileOpenAct;
67 QAction *m_fileSaveCopyAct;
68 QAction *m_settingsTextAAAct;
69 QAction *m_settingsGfxAAAct;
70 QActionGroup *m_settingsRenderBackendGrp;
71
72 QList<DocumentObserver *> m_observers;
73
74 std::unique_ptr<Poppler::Document> m_doc;
75 };
76
77 #endif