From a560b3b1f5ac5931bf1c45f6c3f72d9974ab125a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 10 Aug 2017 22:50:35 -0400 Subject: Get lumina-pdf almost finished. 1) Add Presentation mode 2) Multi-thread the document loading routines --- src-qt5/experimental/lumina-pdf/mainUI.h | 57 +++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'src-qt5/experimental/lumina-pdf/mainUI.h') diff --git a/src-qt5/experimental/lumina-pdf/mainUI.h b/src-qt5/experimental/lumina-pdf/mainUI.h index 1bd1699b..fa1d5a55 100644 --- a/src-qt5/experimental/lumina-pdf/mainUI.h +++ b/src-qt5/experimental/lumina-pdf/mainUI.h @@ -12,6 +12,9 @@ #include #include #include +#include +#include +#include #include @@ -41,12 +44,64 @@ private: QProgressBar *progress; QAction *progAct; //action associated with the progressbar - + //PDF Page Loading cache variables + QHash loadingHash; + int numPages; + + void loadPage(int num, Poppler::Document *doc, MainUI *obj, QSize dpi, QSizeF page); + + //Functions/variables for the presentation mode + QLabel *presentationLabel; + QScreen *getScreen(bool current, bool &cancelled); + int CurrentPage; + void startPresentation(bool atStart); + void ShowPage(int page); + void endPresentation(); + private slots: + void startLoadingPages(QPrinter *printer); + void slotPageLoaded(int); + void slotStartPresentation(QAction *act); + void paintOnWidget(QPrinter *PRINTER); //Button Slots void OpenNewFile(); +signals: + void PageLoaded(int); + +protected: + void keyPressEvent(QKeyEvent *event){ + //See if this is one of the special hotkeys and act appropriately + // NOTE: Some of this is duplicated with the QShortcut definitions (for non-presentation mode) + // This routine does not always work for the main window viewer due to differing widget focus policies + if(presentationLabel!=0 && presentationLabel->isVisible()){ + //qDebug() << "Got Key Press:"; + if( event->key()==Qt::Key_Escape || event->key()==Qt::Key_Backspace){ + //qDebug() << " - Escape/Backspace"; + endPresentation(); + }else if(event->key()==Qt::Key_Right || event->key()==Qt::Key_Down || event->key()==Qt::Key_Space){ + //qDebug() << " - Right/Down/Spacebar"; + ShowPage( CurrentPage+1 ); + }else if(event->key()==Qt::Key_Left || event->key()==Qt::Key_Up){ + //qDebug() << " - Left/Up"; + ShowPage( CurrentPage-1 ); + }else if(event->key()==Qt::Key_Home){ + //qDebug() << " - Home"; + ShowPage(0); //go to the first page + }else if(event->key()==Qt::Key_End){ + //qDebug() << " - End"; + ShowPage( numPages-1 ); //go to the last page + }else if(event->key()==Qt::Key_F11){ + //qDebug() << " - F11"; + endPresentation(); + }else{ + QMainWindow::keyPressEvent(event); + } + }else{ + QMainWindow::keyPressEvent(event); + } + } }; #endif -- cgit From e9d9cc6a2aeaf1cc87bc258d75c56c860a456aca Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 11 Aug 2017 13:57:18 -0400 Subject: Remove the "experimental" lumina-pdf directory. Is included in the desktop-utils builds now. --- src-qt5/experimental/lumina-pdf/mainUI.h | 107 ------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 src-qt5/experimental/lumina-pdf/mainUI.h (limited to 'src-qt5/experimental/lumina-pdf/mainUI.h') diff --git a/src-qt5/experimental/lumina-pdf/mainUI.h b/src-qt5/experimental/lumina-pdf/mainUI.h deleted file mode 100644 index fa1d5a55..00000000 --- a/src-qt5/experimental/lumina-pdf/mainUI.h +++ /dev/null @@ -1,107 +0,0 @@ -//=========================================== -// Lumina Desktop source code -// Copyright (c) 2017, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_PDF_VIEWER_MAIN_WINDOW_H -#define _LUMINA_PDF_VIEWER_MAIN_WINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace Ui{ - class MainUI; -}; - -class MainUI : public QMainWindow{ - Q_OBJECT -public: - MainUI(); - ~MainUI(); - - void loadFile(QString path); - - -private: - Poppler::Document *DOC; - QPrintPreviewWidget *WIDGET; - Ui::MainUI *ui; - QPrinter* Printer; - QPrintDialog *PrintDLG; - - QString lastdir; - - //Other Interface elements - QProgressBar *progress; - QAction *progAct; //action associated with the progressbar - - //PDF Page Loading cache variables - QHash loadingHash; - int numPages; - - void loadPage(int num, Poppler::Document *doc, MainUI *obj, QSize dpi, QSizeF page); - - //Functions/variables for the presentation mode - QLabel *presentationLabel; - QScreen *getScreen(bool current, bool &cancelled); - int CurrentPage; - void startPresentation(bool atStart); - void ShowPage(int page); - void endPresentation(); - -private slots: - void startLoadingPages(QPrinter *printer); - void slotPageLoaded(int); - void slotStartPresentation(QAction *act); - - void paintOnWidget(QPrinter *PRINTER); - - //Button Slots - void OpenNewFile(); - -signals: - void PageLoaded(int); - -protected: - void keyPressEvent(QKeyEvent *event){ - //See if this is one of the special hotkeys and act appropriately - // NOTE: Some of this is duplicated with the QShortcut definitions (for non-presentation mode) - // This routine does not always work for the main window viewer due to differing widget focus policies - if(presentationLabel!=0 && presentationLabel->isVisible()){ - //qDebug() << "Got Key Press:"; - if( event->key()==Qt::Key_Escape || event->key()==Qt::Key_Backspace){ - //qDebug() << " - Escape/Backspace"; - endPresentation(); - }else if(event->key()==Qt::Key_Right || event->key()==Qt::Key_Down || event->key()==Qt::Key_Space){ - //qDebug() << " - Right/Down/Spacebar"; - ShowPage( CurrentPage+1 ); - }else if(event->key()==Qt::Key_Left || event->key()==Qt::Key_Up){ - //qDebug() << " - Left/Up"; - ShowPage( CurrentPage-1 ); - }else if(event->key()==Qt::Key_Home){ - //qDebug() << " - Home"; - ShowPage(0); //go to the first page - }else if(event->key()==Qt::Key_End){ - //qDebug() << " - End"; - ShowPage( numPages-1 ); //go to the last page - }else if(event->key()==Qt::Key_F11){ - //qDebug() << " - F11"; - endPresentation(); - }else{ - QMainWindow::keyPressEvent(event); - } - }else{ - QMainWindow::keyPressEvent(event); - } - } -}; -#endif -- cgit