~kulthauskante/npresenter/main

« back to all changes in this revision

Viewing changes to nPresenter.h

  • Committer: Karsten Krispin
  • Date: 2010-06-20 04:17:18 UTC
  • Revision ID: karsten@nonlimited.org-20100620041718-8ao7jp8fabg3rcsd
plenty of changes:
 * biggest change is rewrite of pdf/Document
  - it now is a singleton class which handles its loaded document by itself
  - caching is done in a seperate thread.
  - Poppler has been made "thread-safe". At least it works with threads now. ;)
  - document understands Viewport Layout.

* nPresenter
 - added help screen on start up
 - you can cycle through Viewport Layouts which Document now provides
 - interaction with new Document-Class is checked in. Could still be cleaned up a bit.

* pdf/Page
 - removed - all done in Document now

* nPresenter.doxygen
 - added configuration for doxygen.
 - We now can generate docs. Hurray! :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
#include <QtGui/QMainWindow>
8
8
 
9
 
#include "pdf/Page.h"
10
9
#include "pdf/Document.h"
11
 
 
12
10
#include "widgets/NotesViewportWidget.h"
13
11
#include "widgets/PresentationViewWidget.h"
14
12
#include "widgets/WaitingIndicator.h"
15
13
 
 
14
 
 
15
/** Main Window for Application
 
16
 * This class handles the main part of the Presenter.
 
17
 * It holds all Widgets and does user interaction by event() and keyReleaseEvent()
 
18
 * @nosubgrouping
 
19
 */
16
20
class nPresenter : public QMainWindow
17
21
{
18
22
    Q_OBJECT
19
23
                
20
 
                
 
24
                /* singleton instance pointer */
21
25
                static nPresenter * _nPresenterInstance;
22
26
                
 
27
                int _updateCount;
 
28
                
23
29
                /* widgets */
24
 
                
25
 
                NotesViewportWidget _notesViewport;
26
 
                PresentationViewportWidget _presentationViewport;
27
 
                
28
30
                QDockWidget _treeDock;
29
31
                QDockWidget _previewCurrentDock;
30
32
                QDockWidget _previewNextDock;
31
33
                QDockWidget _clockDock;
32
34
                QDockWidget _notesDock;
33
 
                
 
35
                NotesViewportWidget _notesViewport;
 
36
                PresentationViewportWidget _presentationViewport;
34
37
                WaitingIndicator * _waitingIndicator;
35
38
                
36
 
 
37
 
                /* pages */
38
 
                Document * _doc;
39
 
                int _currentPage;
40
 
                QHash<int, Page*> _pages;
41
 
                
42
 
                Page _nullPage;
43
 
                
44
 
                /* presentation */
45
 
                
 
39
                /* presentation properties */
 
40
                Document _document;
46
41
                QFutureWatcher<void> _futureWatcher;
47
42
                QFuture<void> _renderFuture;
48
 
 
49
43
                bool _blackoutEnabled;
50
44
                bool _freezeEnabled;
51
 
                
52
 
                
53
 
        private:
54
 
                /** @deprecated just a temp hack */
55
 
                void renderPages();
56
 
                
 
45
                int _currentPage;
 
46
                
 
47
                QStringList _layoutNames;
 
48
                int _layoutNamesCurrent;
 
49
 
57
50
        public:
58
51
    nPresenter(QWidget *parent = 0);
59
 
    ~nPresenter();
60
 
                
61
 
                void setupWidgets();
62
 
                
 
52
    virtual ~nPresenter();
 
53
                
 
54
                /** get the singleton instance of nPresenter */
63
55
                static nPresenter & instance();
64
56
                
65
 
                static Document * document();
66
 
                
67
 
                static Page & currentPage();
68
 
                static Page & nextPage();
69
 
                
70
 
                
71
 
                static QSize notesViewportSize();
72
 
                static QSize presentationViewportSize();
73
 
                
74
 
                static QRectF notesViewport();
75
 
                static QRectF presentationViewport();
 
57
                /** PDF Abstraction Instance */
 
58
                static Document &  document();
 
59
                
 
60
                /** current active Page */
 
61
                static int currentPage();
 
62
                
 
63
                
 
64
                
 
65
                /** gets geometry for viewport
 
66
                 * @returns the viewport geometry or an invalid QRectF if viewport is not defined
 
67
                 */
 
68
                static QRectF viewport(Document::Viewports viewport);
76
69
 
77
70
        protected:      
78
71
                void mouseReleaseEvent(QMouseEvent * event);
81
74
                void hideEvent(QHideEvent * event);
82
75
                bool event(QEvent *event);
83
76
                
84
 
                                
 
77
                
 
78
        private:
 
79
                /** setup widget and connect signals/slots */
 
80
                void setupWidgets();
85
81
                
86
82
        signals:
 
83
                
 
84
                /** the current page changed */
87
85
                void currentPageChanged(int numPage);
 
86
                
 
87
                /** work in progress */
88
88
                void waitingOnPage();
89
 
                void currentPageReady();
90
 
 
 
89
                
 
90
                /** new document loaded */
91
91
                void documentChanged();
92
92
 
 
93
                /** blackout status changed */
93
94
                void blackoutEnabled(bool enabled);
 
95
                /** page freeze status changed */
94
96
                void freezeEnabled(bool enabled);
95
97
                
 
98
        private slots:
 
99
                
 
100
                void sizeChangeTimeout();
 
101
                
 
102
        
96
103
        public slots:
97
104
                
 
105
                /** loads a PDF file */
98
106
                bool loadDocument(QString path);
99
107
                
100
 
                void updatePages();
101
 
 
 
108
                /** called from ViewportWidgets when resized
 
109
                 * Defer update of viewports for a while.
 
110
                 * This prevents constantly updating viewports while resizing ViewportWidget
 
111
                 */
 
112
                void viewportSizesChanged();
 
113
                
 
114
                
 
115
                /** request alls pages and viewports again
 
116
                 * clears Document's image cache and requests all pages.
 
117
                 * @deprecated : should be replaced by a more intelligent caching algorithm
 
118
                 */
 
119
                void requestAllPages();
 
120
                
 
121
                /** @name Page Navigation */
 
122
                /** @{ */
 
123
                /** handles page changes */
102
124
                void toPage(int pageNum);
 
125
                
 
126
                /** go to next page
 
127
                 * @see toPage()
 
128
                 */
103
129
                void toNextPage();
 
130
                
 
131
                /** go to previous page
 
132
                 * @see toPage()
 
133
                 */
104
134
                void toPreviousPage();
105
 
 
 
135
                /** @} */
106
136
};
107
137
 
108
138
#endif // NPRESENTER_H