diff options
author | joe berner <stackyjoe@gmail.com> | 2018-12-18 10:59:15 -0600 |
---|---|---|
committer | joe berner <stackyjoe@gmail.com> | 2018-12-18 10:59:15 -0600 |
commit | e42bc7e16e6d9f813b5c712261dffbef6b1bddb2 (patch) | |
tree | 0c9e39d7e3f425691f854288a733b8d56c5f6ed3 /src-qt5/desktop-utils/lumina-pdf/mainUI.h | |
parent | Merge pull request #640 from lumina-desktop/q5sys-patch-1 (diff) | |
download | lumina-e42bc7e16e6d9f813b5c712261dffbef6b1bddb2.tar.gz lumina-e42bc7e16e6d9f813b5c712261dffbef6b1bddb2.tar.bz2 lumina-e42bc7e16e6d9f813b5c712261dffbef6b1bddb2.zip |
Changes the UI interface so that only the current page is rendered on screen at a time. This has significant memory benefits for large PDF files. This also implements a least-recently used cache of tunable size, which improves responsiveness if you're hopping between two specific pages.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-pdf/mainUI.h')
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.h | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.h b/src-qt5/desktop-utils/lumina-pdf/mainUI.h index 10f2d2e4..61467811 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.h +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.h @@ -7,31 +7,31 @@ #ifndef _LUMINA_PDF_VIEWER_MAIN_WINDOW_H #define _LUMINA_PDF_VIEWER_MAIN_WINDOW_H -#include <QPrintPreviewWidget> +#include <QApplication> +#include <QDebug> +#include <QKeyEvent> +#include <QLabel> +#include <QMainWindow> +#include <QMenu> #include <QPrintDialog> +#include <QPrintPreviewWidget> #include <QPrinter> -#include <QMainWindow> #include <QProgressBar> -#include <QLabel> -#include <QKeyEvent> -#include <QDebug> -#include <QWheelEvent> -#include <QApplication> -#include <QMenu> #include <QTimer> +#include <QWheelEvent> -#include "Renderer.h" #include "BookmarkMenu.h" #include "PresentationLabel.h" -#include "PropDialog.h" #include "PrintWidget.h" +#include "PropDialog.h" +#include "Renderer.h" #include "TextData.h" -namespace Ui{ - class MainUI; +namespace Ui { +class MainUI; }; -class MainUI : public QMainWindow{ +class MainUI : public QMainWindow { Q_OBJECT public: MainUI(); @@ -48,23 +48,23 @@ private: QPrintDialog *PrintDLG; QString lastdir; bool matchCase; - QList<TextData*> results; + QList<TextData *> results; QList<int> loadingQueue; int currentHighlight; - //Other Interface elements + // Other Interface elements QProgressBar *progress; - QAction *progAct; //action associated with the progressbar + QAction *progAct; // action associated with the progressbar QTimer *clockTimer; QMenu *contextMenu; - //QFrame *frame_presenter; + // QFrame *frame_presenter; QLabel *label_clock, *label_page; QAction *clockAct, *pageAct; - //PDF Page Loading cache variables + // PDF Page Loading cache variables Renderer *BACKEND; - //Functions/variables for the presentation mode + // Functions/variables for the presentation mode PresentationLabel *presentationLabel; QScreen *getScreen(bool current, bool &cancelled); int CurrentPage; @@ -74,35 +74,40 @@ private: private slots: void startLoadingPages(int degrees = 0); - void slotPageLoaded(int); - - //Simplification routines - void nextPage(){ ShowPage( WIDGET->currentPage()+1 ); } //currentPage() starts at 1 rather than 0 - void prevPage(){ ShowPage( WIDGET->currentPage()-1 ); } //currentPage() starts at 1 rather than 0 - void firstPage(){ ShowPage(1); } - void lastPage(){ ShowPage(BACKEND->numPages()); } - void startPresentationHere(){ startPresentation(false); } - void startPresentationBeginning(){ startPresentation(true); } - void closePresentation(){ endPresentation(); } + void slotPageLoaded(); + void slotSetProgress(int); + + // Simplification routines + void nextPage() { + ShowPage(WIDGET->currentPage() + 1); + } // currentPage() starts at 1 rather than 0 + void prevPage() { + ShowPage(WIDGET->currentPage() - 1); + } // currentPage() starts at 1 rather than 0 + void firstPage() { ShowPage(1); } + void lastPage() { ShowPage(BACKEND->numPages()); } + void startPresentationHere() { startPresentation(false); } + void startPresentationBeginning() { startPresentation(true); } + void closePresentation() { endPresentation(); } void find(QString text, bool forward); void paintToPrinter(QPrinter *PRINTER); - //Button Slots + // Button Slots void OpenNewFile(); - //Other interface slots + // Other interface slots void updateClock(); void updatePageNumber(); - void showContextMenu(const QPoint&){ contextMenu->popup(QCursor::pos()); } + void showContextMenu(const QPoint &) { contextMenu->popup(QCursor::pos()); } void updateContextMenu(); - //void setScroll(bool); + // void setScroll(bool); protected: - void keyPressEvent(QKeyEvent*); - void wheelEvent(QWheelEvent*); - void closeEvent(QCloseEvent *ev){ + void keyPressEvent(QKeyEvent *); + void wheelEvent(QWheelEvent *); + void closeEvent(QCloseEvent *ev) { endPresentation(); QMainWindow::closeEvent(ev); } |