blob: 911456aacc2b72f4e17a71bc2e5e206fdca70244 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
//===========================================
// 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 <QPrintPreviewWidget>
#include <QPrintDialog>
#include <QPrinter>
#include <QMainWindow>
#include <QProgressBar>
#include <QLabel>
#include <QKeyEvent>
#include <QDebug>
#include <QWheelEvent>
#include <QApplication>
#include <QMenu>
#include "Renderer.h"
#include "PresentationLabel.h"
#include "propDialog.h"
#include "PrintWidget.h"
#include "textData.h"
namespace Ui{
class MainUI;
};
class MainUI : public QMainWindow{
Q_OBJECT
public:
MainUI();
~MainUI();
void loadFile(QString path);
private:
QSizeF pageSize;
PrintWidget *WIDGET;
Ui::MainUI *ui;
PropDialog *PROPDIALOG;
QPrintDialog *PrintDLG;
QString lastdir;
bool matchCase;
QList<TextData*> results;
int currentHighlight;
//Other Interface elements
QProgressBar *progress;
QAction *progAct; //action associated with the progressbar
QTimer *clockTimer;
QMenu *contextMenu;
//QFrame *frame_presenter;
QLabel *label_clock, *label_page;
QAction *clockAct, *pageAct;
//PDF Page Loading cache variables
Renderer *BACKEND;
QHash<int, QImage> loadingHash;
void loadPage(int num, MainUI *obj, QSize dpi);
//Functions/variables for the presentation mode
PresentationLabel *presentationLabel;
QScreen *getScreen(bool current, bool &cancelled);
int CurrentPage;
void startPresentation(bool atStart);
void ShowPage(int page);
void endPresentation();
private slots:
void startLoadingPages();
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 find(QString text, bool forward);
void showBookmarks();
void paintToPrinter(QPrinter *PRINTER);
//Button Slots
void OpenNewFile();
//Other interface slots
void updateClock();
void updatePageNumber();
void showContextMenu(const QPoint&){ contextMenu->popup(QCursor::pos()); }
void updateContextMenu();
//void setScroll(bool);
signals:
void PageLoaded(int);
protected:
void keyPressEvent(QKeyEvent*);
void wheelEvent(QWheelEvent*);
void closeEvent(QCloseEvent *ev){
endPresentation();
QMainWindow::closeEvent(ev);
}
};
#endif
|