1 /* 2 dspdfviewer - Dual Screen PDF Viewer for LaTeX-Beamer 3 Copyright (C) 2012 Danny Edel <mail@danny-edel.de> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License along 16 with this program; if not, write to the Free Software Foundation, Inc., 17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 21 #ifndef PDFVIEWERWINDOW_H 22 #define PDFVIEWERWINDOW_H 23 24 #include "renderedpage.h" 25 #include "pdfrenderfactory.h" 26 #include "runtimeconfiguration.h" 27 #include "hyperlinkarea.h" 28 #include "windowrole.h" 29 30 #include "ui_pdfviewerwindow.h" 31 32 /** Shared base class for both windows (primary and secondary) 33 * 34 */ 35 class PDFViewerWindow : public QWidget 36 { 37 Q_OBJECT 38 private: 39 Ui::Form ui; 40 bool m_enabled; 41 unsigned int m_monitor; 42 QImage currentImage; 43 bool blank; 44 bool informationLineVisible; 45 46 uint currentPageNumber; 47 uint minimumPageNumber; 48 uint maximumPageNumber; 49 bool correctImageRendered; 50 PagePart myPart; 51 52 const WindowRole windowRole; 53 // Reference to the runtime configuration object. 54 const RuntimeConfiguration& runtimeConfiguration; 55 56 /** Display this image 57 */ 58 void displayImage(QImage image); 59 60 virtual void wheelEvent(QWheelEvent* e); 61 62 virtual void keyPressEvent(QKeyEvent* e); 63 64 virtual void mousePressEvent(QMouseEvent* e); 65 66 void addThumbnail(uint pageNumber, QImage thumbnail); 67 68 69 QString timeToString(const QTime& time) const; 70 QString timeToString(int milliseconds) const; 71 72 void keybindingsPopup(); 73 void changePageNumberDialog(); 74 75 void parseLinks( QList< AdjustedLink > links); 76 QList< HyperlinkArea* > linkAreas; 77 78 public: 79 /** Standard constructor 80 * @param monitor monitor to start on (usually 0 for primary) 81 */ 82 explicit PDFViewerWindow(unsigned int monitor, PagePart myPart, bool showInformationLine, const RuntimeConfiguration& r, const WindowRole& windowRole, bool enabled=true); 83 84 /** Sets the monitor to display this window on 85 * Automatically calls reposition 86 */ 87 void setMonitor(const unsigned int monitor); 88 89 /** Gets the current monitor setting 90 */ 91 unsigned int getMonitor() const; 92 93 /** Reposition the window (for example after a monitor change) 94 */ 95 void reposition(); 96 97 QSize getTargetImageSize() const; 98 99 QSize getPreviewImageSize(); 100 101 PagePart getMyPagePart() const; 102 103 void showInformationLine(); 104 105 void hideInformationLine(); 106 107 bool isInformationLineVisible() const; 108 109 bool isBlank() const; 110 111 void showLoadingScreen(uint pageNumberToWaitFor); 112 113 public slots: 114 void renderedPageIncoming( QSharedPointer<RenderedPage> renderedPage); 115 116 void resizeEvent(QResizeEvent* resizeEvent); 117 118 void updateWallClock(const QTime& wallClock); 119 void updateSlideClock(const QTime& slideClock); 120 void updatePresentationClock(const QTime& presentationClock); 121 122 void setPageNumberLimits(uint minimumPageNumber, uint maximumPageNumber); 123 124 void setBlank(const bool blank); 125 126 void setMyPagePart(const PagePart& newPagePart); 127 128 signals: 129 void nextPageRequested(); 130 void previousPageRequested(); 131 void pageRequested(unsigned requestedPageNumber); 132 void restartRequested(); 133 134 void screenSwapRequested(); 135 136 void rerenderRequested(); 137 138 void quitRequested(); 139 void secondScreenFunctionToggleRequested(); 140 void secondScreenDuplicateRequested(); 141 142 void blankToggleRequested(); 143 private slots: 144 void linkClicked(uint targetNumber); 145 }; 146 147 #endif // PDFVIEWERWINDOW_H 148