Changeset View
Changeset View
Standalone View
Standalone View
ui/pageview.h
Show All 28 Lines | |||||
29 | #include "core/area.h" | 29 | #include "core/area.h" | ||
30 | #include "core/observer.h" | 30 | #include "core/observer.h" | ||
31 | #include "core/view.h" | 31 | #include "core/view.h" | ||
32 | 32 | | |||
33 | class KActionCollection; | 33 | class KActionCollection; | ||
34 | 34 | | |||
35 | namespace Okular { | 35 | namespace Okular { | ||
36 | class Action; | 36 | class Action; | ||
37 | class Part; | ||||
37 | class Document; | 38 | class Document; | ||
38 | class DocumentViewport; | 39 | class DocumentViewport; | ||
39 | class FormFieldSignature; | 40 | class FormFieldSignature; | ||
40 | class Annotation; | 41 | class Annotation; | ||
41 | class MovieAction; | 42 | class MovieAction; | ||
42 | class RenditionAction; | 43 | class RenditionAction; | ||
43 | } | 44 | } | ||
44 | 45 | | |||
Show All 18 Lines | 60 | public: | |||
63 | // Zoom mode ( last 4 are internally used only! ) | 64 | // Zoom mode ( last 4 are internally used only! ) | ||
64 | enum ZoomMode { ZoomFixed = 0, ZoomFitWidth = 1, ZoomFitPage = 2, ZoomFitAuto = 3, | 65 | enum ZoomMode { ZoomFixed = 0, ZoomFitWidth = 1, ZoomFitPage = 2, ZoomFitAuto = 3, | ||
65 | ZoomIn, ZoomOut, ZoomRefreshCurrent, ZoomActual }; | 66 | ZoomIn, ZoomOut, ZoomRefreshCurrent, ZoomActual }; | ||
66 | 67 | | |||
67 | enum ClearMode { ClearAllSelection, ClearOnlyDividers }; | 68 | enum ClearMode { ClearAllSelection, ClearOnlyDividers }; | ||
68 | 69 | | |||
69 | // create actions that interact with this widget | 70 | // create actions that interact with this widget | ||
70 | void setupBaseActions( KActionCollection * collection ); | 71 | void setupBaseActions( KActionCollection * collection ); | ||
71 | void setupViewerActions( KActionCollection * collection ); | 72 | void setupViewerActions( KActionCollection * collection, Okular::Part * part ); | ||
davidhurka: Adding a link to Part is neccessary, because Part controls m_embedMode, which is used to access… | |||||
In the meantime I learned more about this. The Color Mode menu will stay here in PageView::setupViewerActions(), because it is needed only in viewer modes, and is page view related. m_embedMode is not needed, that’s handled by Part. But I still don’t like the parameter part, any comments? davidhurka: In the meantime I learned more about this.
The Color Mode menu will stay here in PageView… | |||||
You can add an action in Part::setupActions similar to options_configure_annotations. Then in you can access it with something similar to QAction * aConfigColors = actionCollection()->action( QStringLiteral("options_configure_colors") ); d->aColorModeMenu->addAction( aConfigColors ); simgunz: You can add an action in `Part::setupActions` similar to `options_configure_annotations`. Then… | |||||
72 | void setupActions( KActionCollection * collection ); | 73 | void setupActions( KActionCollection * collection ); | ||
73 | void updateActionState( bool docHasPages, bool docChanged, bool docHasFormWidgets ); | 74 | void updateActionState( bool docHasPages, bool docChanged, bool docHasFormWidgets ); | ||
74 | 75 | | |||
75 | // misc methods (from RMB menu/children) | 76 | // misc methods (from RMB menu/children) | ||
76 | bool canFitPageWidth() const; | 77 | bool canFitPageWidth() const; | ||
77 | void fitPageWidth( int page ); | 78 | void fitPageWidth( int page ); | ||
78 | // keep in sync with pageviewutils | 79 | // keep in sync with pageviewutils | ||
79 | void displayMessage( const QString & message, const QString & details = QString(), PageViewMessage::Icon icon=PageViewMessage::Info, int duration=-1 ); | 80 | void displayMessage( const QString & message, const QString & details = QString(), PageViewMessage::Icon icon=PageViewMessage::Info, int duration=-1 ); | ||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | 163 | private: | |||
205 | // called from slots to turn off trim modes mutually exclusive to id | 206 | // called from slots to turn off trim modes mutually exclusive to id | ||
206 | void updateTrimMode( int except_id ); | 207 | void updateTrimMode( int except_id ); | ||
207 | 208 | | |||
208 | // handle link clicked | 209 | // handle link clicked | ||
209 | bool mouseReleaseOverLink( const Okular::ObjectRect * rect ) const; | 210 | bool mouseReleaseOverLink( const Okular::ObjectRect * rect ) const; | ||
210 | 211 | | |||
211 | void createAnnotationsVideoWidgets(PageViewItem *item, const QLinkedList< Okular::Annotation * > &annotations); | 212 | void createAnnotationsVideoWidgets(PageViewItem *item, const QLinkedList< Okular::Annotation * > &annotations); | ||
212 | 213 | | |||
214 | /** | ||||
215 | * Updates the default action and the checked states of the color mode menu. | ||||
216 | * | ||||
217 | * Call this when the color mode was changed or Change Colors was toggled. | ||||
218 | */ | ||||
219 | void updateColorModeMenu(); | ||||
220 | | ||||
213 | // don't want to expose classes in here | 221 | // don't want to expose classes in here | ||
214 | class PageViewPrivate * d; | 222 | class PageViewPrivate * d; | ||
215 | 223 | | |||
216 | private Q_SLOTS: | 224 | private Q_SLOTS: | ||
217 | // used to decouple the notifyViewportChanged calle | 225 | // used to decouple the notifyViewportChanged calle | ||
218 | void slotRealNotifyViewportChanged(bool smoothMove); | 226 | void slotRealNotifyViewportChanged(bool smoothMove); | ||
219 | // activated either directly or via queued connection on notifySetup | 227 | // activated either directly or via queued connection on notifySetup | ||
220 | void slotRelayoutPages(); | 228 | void slotRelayoutPages(); | ||
Show All 37 Lines | |||||
258 | void slotScrollUp( bool singleStep = false ); | 266 | void slotScrollUp( bool singleStep = false ); | ||
259 | void slotScrollDown( bool singleStep = false ); | 267 | void slotScrollDown( bool singleStep = false ); | ||
260 | void slotRotateClockwise(); | 268 | void slotRotateClockwise(); | ||
261 | void slotRotateCounterClockwise(); | 269 | void slotRotateCounterClockwise(); | ||
262 | void slotRotateOriginal(); | 270 | void slotRotateOriginal(); | ||
263 | void slotPageSizes( int ); | 271 | void slotPageSizes( int ); | ||
264 | void slotTrimMarginsToggled( bool ); | 272 | void slotTrimMarginsToggled( bool ); | ||
265 | void slotTrimToSelectionToggled( bool ); | 273 | void slotTrimToSelectionToggled( bool ); | ||
274 | | ||||
275 | /** | ||||
276 | * Sets the color mode (render mode) to the one represented by @p action. | ||||
277 | * | ||||
278 | * If @p action represents the current mode, toggles the Change Colors feature. | ||||
279 | */ | ||||
280 | void slotColorModeActionTriggered(QAction * action); | ||||
281 | | ||||
266 | void slotToggleForms(); | 282 | void slotToggleForms(); | ||
267 | void slotFormChanged( int pageNumber ); | 283 | void slotFormChanged( int pageNumber ); | ||
268 | void slotRefreshPage(); | 284 | void slotRefreshPage(); | ||
269 | #ifdef HAVE_SPEECH | 285 | #ifdef HAVE_SPEECH | ||
270 | void slotSpeakDocument(); | 286 | void slotSpeakDocument(); | ||
271 | void slotSpeakCurrentPage(); | 287 | void slotSpeakCurrentPage(); | ||
272 | void slotStopSpeaks(); | 288 | void slotStopSpeaks(); | ||
273 | #endif | 289 | #endif | ||
Show All 11 Lines |
Adding a link to Part is neccessary, because Part controls m_embedMode, which is used to access the configuration dialog.
However, the whole Change Colors menu is probably better in Part instead of PageView. Currently, every PageView creates a new menu, and with multible tabs their checked states get out of sync.
m_embedMode gives another question: should I check m_embedMode before creating this menu? In the print preview mode, Change Colors does not make much sense.