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