Commit graph

1718 commits

Author SHA1 Message Date
David Edmundson 1a3dc7d8e0 Fix highlight/annotation clipping with Qt scaling
Summary:
pixelValue/pixelValue will give us a normalised value.

Normalised values shouldn't be modified by a device pixel ratio.
We want scaledRect not dScaledRect.

BUG: 386110

Test Plan:
Searched for text. Zoomed in, panned about
Created annotations, they still seemed to work

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8832
2017-11-23 23:04:16 +00:00
Albert Astals Cid 19b7e3c112 The work in this branch was sponsored by LiMux
give them some credit in the headers
2017-11-16 09:58:31 +01:00
Albert Astals Cid 0da737a92b Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-11-03 10:03:00 +01:00
Alexey Demennikov d679b3c9f2 Set the columns in "Overview" mode to match the amount of pages if document is small
Summary:
FEATURE: 355283

The principle is simple. This patch enables overriding the default columns for Overview mode, if the document is small. For example, if document has 1 or 2 pages and the default columns in Okular settings is 3, Overview mode will enable 1 or 2 columns for better UX

Reviewers: #okular, rkflx, ngraham

Reviewed By: rkflx, ngraham

Subscribers: ltoscano, aacid, rkflx, ngraham

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8385
2017-10-28 21:20:10 +02:00
Albert Astals Cid ca5422d0e9 Implement swapBackingFile for the PDF backend
How does it work:
 * What it does is really closing and opening the file again through poppler
 * This means that things that are generated in "open" time like Page, Rects, Annotations, Forms need to be updated
	* For Page what we do is swap the PagePrivate so that other classes that hold Page* don't break
		* Since some parts of the PagePrivate can be reused, we move them in PagePrivate::adoptGeneratedContents
	* For all the commands in the undo stack we need to update the annotations/forms it refers to, added a new function to do that
	* The annotationmodel needs updating it's pointers
	* The widgets for the forms are reused and their form* updated
	* the widgets for the videos are recreased since videos don't really hold much content (you lose the playing status on save but i think that's acceptable)

TODO: Make this work for .okular files
TODO: For files with password we will need to reload the file, asking for the password again and thus losing the undo stack, warn the user
TODO: autotests
2017-10-26 15:30:44 +02:00
Albert Astals Cid 423dd010e0 Remove m_formButtons
We don't need it, so it's one less thing to make sure we need to maintain in sync
2017-10-25 16:08:13 +02:00
Albert Astals Cid 5c9edea430 Don't store the form twice in the formwidget classes
Just use m_ff and cast it when needed.

This will make it easy in the future when the given form for a widget may change so we only need to update one value
2017-10-25 15:12:35 +02:00
Albert Astals Cid ba02656646 Make m_annowindows a set instead of a hash
Will make it for easier maintainance when we need to reuse the windows and annotation pointers change
2017-10-25 14:59:17 +02:00
Albert Astals Cid 3435eb6df8 Convert m_formWidgets from hash to set
We don't use the key for anything
2017-10-25 14:51:58 +02:00
Albert Astals Cid 54bcb44559 Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-10-23 16:03:18 +02:00
Lukas Hetzenecker ecc1141e02 HiDPI Support for Okular
Summary:
This patch enables HiDPI throughout the application

Every pixmap is multiplied by the devicePixelRatioF
QPainter code is ajusted to take the DPR value into account

All pixmaps get cached with the highest DPR of all screens. When moving the application to another screen, the cache doesn't have to be invalidated.

BUGS: 362856 383589
REVIEW: D6268
2017-10-14 14:47:20 +02:00
Renato Araujo Oliveira Filho 6d7403ff13 Interact with hyperlinks in TextSelect mode
Allow user to click on url while on any selection mode

Based on https://git.reviewboard.kde.org/r/124961/ by Jake Linder <JakeLinder@mail.com>

Includes several autotests to try to minimize possible regressions as much as possible

BUGS: 318078
REVIEW: 130246
2017-10-11 15:03:36 +02:00
Albert Freeman 1f6e8a4782 Custom background color
Summary:
BUG: 182994

Adds an option to the config dialog that enables background color (the color around the displayed page) to be changed (while by default preserving the Qt toolkit selection as not to affect existing users).

Reasons for this change:
Accessibility, eye strain, aesthetic reasons, color displayed on monitor can affect power consumption (how: depends on display technology).
Many people want this change occording to Bugzilla and other sources.

Maintenance: Nearly no additional maintenance:
This is no new subsystem but a trivial feature with no complex code dependencies, and we are already showing a colour selection dialog and setting colours in other places in Okular.

{F4257766}

Other less important information:
https://git.reviewboard.kde.org/r/130219/
https://mail.kde.org/pipermail/okular-devel/2017-September/025520.html

Test Plan:
Tested everything, it all works:
Toggled the custom background color, changed custom background color, removed okular settings file (with: "rm ~/.config/okular*") to verify it uses the usual qt theme colour by default (where the settings file remembered the custom color).

Reviewers: #okular, aacid, elvisangelaccio, rkflx, ngraham

Reviewed By: ngraham

Subscribers: aacid, ltoscano, ngraham

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8051
2017-10-01 11:31:59 +02:00
Luigi Toscano d176914e63 Revert "Custom background color"
Wrong authorship for the commit. Commit it again with the correct
information.

CCMAIL: pointedstick@zoho.com
This reverts commit 6b5a7c9a1a.
2017-10-01 11:27:53 +02:00
Nathaniel Graham 6b5a7c9a1a Custom background color
Summary:
BUG: 182994

Adds an option to the config dialog that enables background color (the color around the displayed page) to be changed (while by default preserving the Qt toolkit selection as not to affect existing users).

Reasons for this change:
Accessibility, eye strain, aesthetic reasons, color displayed on monitor can affect power consumption (how: depends on display technology).
Many people want this change occording to Bugzilla and other sources.

Maintenance: Nearly no additional maintenance:
This is no new subsystem but a trivial feature with no complex code dependencies, and we are already showing a colour selection dialog and setting colours in other places in Okular.

{F4257766}

Other less important information:
https://git.reviewboard.kde.org/r/130219/
https://mail.kde.org/pipermail/okular-devel/2017-September/025520.html

Test Plan:
Tested everything, it all works:
Toggled the custom background color, changed custom background color, removed okular settings file (with: "rm ~/.config/okular*") to verify it uses the usual qt theme colour by default (where the settings file remembered the custom color).

Reviewers: #okular, aacid, elvisangelaccio, rkflx, ngraham

Reviewed By: ngraham

Subscribers: aacid, ltoscano, ngraham

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8051
2017-09-30 19:45:24 -06:00
Albert Astals Cid 878ef9623b Merge remote-tracking branch 'origin/Applications/17.08' 2017-09-30 00:41:51 +02:00
Albert Astals Cid e31bea047c Show tooltip for annotations without handle too
Summary: BUG: 384147

Reviewers: rkflx

Reviewed By: rkflx

Subscribers: ngraham, rkflx, tobiasdeiminger, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7874
2017-09-30 00:41:19 +02:00
Albert Astals Cid a93661e892 Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-09-27 15:01:57 +02:00
Elvis Angelaccio ca12fe50d5 Merge branch 'Applications/17.08' 2017-09-26 23:55:00 +02:00
Albert Astals Cid ef7c9c67bf Implement continuous search
Show non-intrusive info messages whenever the search start over from the
beginning or the bottom of the document, instead of asking the user if
s/he wants to continue the search. This is consistent with search in
KWrite/Kate and with web browsers.

Based on work of and reviewed by Elvis Angelaccio
2017-09-26 23:27:25 +02:00
Elvis Angelaccio 1364d0e97b Properly create KPixmapSequence
Summary:
The KPixmapSequence constructor needs the full path of the icon, so the
current code doesn't work and generates a "Invalid pixmap specified"
warning at runtime. By using KIconLoader we can fix this issue.

Test Plan: Search something and reach the end of document to make the animation start.

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7996
2017-09-26 19:12:39 +02:00
Nathaniel Graham 15917a4260 Merge remote-tracking branch 'origin/Applications/17.08' 2017-09-22 09:39:45 -06:00
Nathaniel Graham e80972e189 Fix sidebar labels being unreadable when selected or hovered over
Summary:
BUG: 382139

Previously these labels were white-on-light-blue with light themes; now they use the correct theme color property, and become black appropriately.

Test Plan:
Tested on KDE Neon (dev unstable). Verified that with the default Breeze color scheme, tab text is more readable when hovered over and then active but not in focus. See before and after:

{F3909142}

{F3909143}

Also tested these changes with all standard color schemes as well as the Oxygen theme to make sure that there were no visual regressions.

Reviewers: aacid, #okular, #kde_applications, broulik, sander, rkflx

Reviewed By: aacid, #okular, #kde_applications, rkflx

Subscribers: rkflx

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7793
2017-09-22 09:38:48 -06:00
Albert Astals Cid 04ed10d3ea Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-09-11 19:51:51 +02:00
Kevin Funk a53a2402ca clang-tidy: modernize-use-nullptr run
Semi-ACK'd by Albert :)
2017-09-06 00:19:48 +02:00
Oliver Sander 024d25cdec Simplify the drawing of buffered highlight rectangles
Previously, they were drawn by modifying individual pixels
of the QImage.  With this patch we simply use a QPainter.

REVIEW: 130214
2017-08-08 14:55:53 +02:00
Albert Astals Cid 026d3d104d Fix small warning 2017-07-28 11:21:56 +02:00
Albert Astals Cid a44b015761 Make newer gcc happier about fallthrough 2017-07-28 11:21:52 +02:00
Albert Astals Cid 18cb1e5659 Add missing break to switch case
May potentially cause a crash
2017-07-28 11:11:50 +02:00
Alexander Schlarb a2b7ce74b2 Support Forward and Backward mouse buttons in presentation mode
REVIEW: 130172
2017-07-08 12:27:46 +02:00
Tobias Deiminger 574fad92c8 Initialize cursor in PageView scrollbars with ArrowCursor
BUG: 334798
REVIEW: 130131
2017-05-21 23:37:04 +02:00
Tobias Deiminger 69dca1e7dd Fix segfault when document is closed while annotation is selected
Prevent MouseAnnotation from accessing PageViewItem widgets any longer
after PageView deletes them in PageView::notifySetup().

BUGS: 378696
REVIEW: 130087
2017-04-13 19:17:56 +02:00
Gilbert Assaf a2aceadc13 Allow to create bookmarks from the TOC
BUGS: 190203
REVIEWS: 129999
2017-03-23 01:22:08 +01:00
Albert Astals Cid 7a9209569c Fix regression in previous commit about going to next page 2017-03-20 00:35:05 +01:00
Oliver Sander 618072f8a2 Change pages in presentation mode by swiping on touch screen
REVIEW: 130012
BUGS: 354012
2017-03-20 00:32:53 +01:00
Tobias Deiminger 0957abc39a Add annotation resize functionality
Usage:
If you left-click an annotation, it gets selected. Resize handles appear on the selection rectangle. When cursor is moved over one of the 8 resize handles on the corners/edges, the cursor shape changes to indicate resize mode. Everywhere else on the annotation means "move", just as it was before resize feature was added. Pressing ESC or clicking an area outside the annotation cancels a selection. Pressing Del deletes a selected annotation.

Feature is only applicable for annotation types AText, AStamp and AGeom.

Implementation:
It works by eventually changing AnnotationPrivate::m_boundary and notifying generator (i.e. poppler) about that change. Annotation state handling is shifted out of PageView into a new class MouseAnnotation (ui/pageviewmouseannotation.cpp). Some functionality not related to resizing but to annotation interaction in general is also shifted to class MouseAnnotation, to build a single place of responsiblity.

Other changes:
Add method Document::adjustPageAnnotation, backed by a QUndoCommand.
class Okular::AdjustAnnotationCommand.
Add Annotation::adjust and Annotation::canBeResized methods.
Draw resize handles in PagePainter::paintCroppedPageOnPainter.

Resize and move work
-for types AText, AStamp and AGeom
-on all pages of document
-when viewport position changes
-when zoom level changes
-for all page rotations (0°, 90°, 180°, 270°)

Selection is canceled
-when currently selected annotation is deleted
-on mouse click outside of currently selected annotation
-ESC is pressed

Viewport is shifted when mouse cursor during move/resize comes close to viewport border.
Resize to negative is prevented.
Tiny annotations are still selectable.
If mouse is moved over an annotation type that we can focus, and the annotation is not yet focused, mouse cursor shape changes to arrow.
If mouse cursor rests over an annotation A, while annotation B is focused, a tooltip for annotation A is shown.
Selected Annotation is deleted when Del is pressed.

Test for regressions:
-Annotation interaction (focus, move, resize, start playback, ...) are only done in mode EnumMouseMode::Browse.
-If mouse is moved over an annotation type where we can start an action, mouse cursor shape changes to pointing hand.
-If mouse is moved over an annotation type that we can't interact with, mouse cursor shape stays a open hand.
-If mouse cursor rests over an annotation of any type, a tooltip for that annotation is shown.
-Grab/move scroll area (on left click + mouse move) is prevented, if mouse is over focused annotation, or over AMovie/AScreen/AFileAttachment annotation.
-A double click on a annotation starts the "annotator".

REVIEW: 127366
BUG: 177778
BUG: 314843
BUG: 358060
2017-03-19 23:18:17 +01:00
Marco Scarpetta fa315eb59c Allow to disable automatic search while typing
BUGS: 326522
REVIEW: 129956
2017-03-14 00:31:42 +01:00
Oliver Sander 54436672fb Allow to rotate the page view using two-finger pinches on a touchscreen
REVIEW: 126809
2017-03-11 18:33:59 +01:00
Miklós Máté 59dd04766c Set viewport only once
REVIEW: 129287
2017-03-11 18:10:53 +01:00
Albert Astals Cid d3b5e13dad Reset d->mousePressPos correctly in mousePress after popup exec
BUGS: 363776
2017-03-09 00:38:00 +01:00
Yuri Chornoivan 506e51d461 Fix minor word repetition 2017-03-05 21:05:28 +02:00
Albert Astals Cid 7d1cf88263 Merge remote-tracking branch 'origin/Applications/16.12' 2017-03-03 23:57:34 +01:00
Albert Astals Cid 7a50ce0edf Accumulate Control+Wheel Deltas until they reach QWheelEvent::DefaultDeltasPerStep
This way zooming in/out with a touchpad is easier to control

BUGS: 377128
2017-03-03 23:56:28 +01:00
Albert Astals Cid ce1c882d7e Make slotFormChanged store multiple pages in the timer and not just one
It's hard the user edits forms in more than one page in less than a second (though possible)
but once we introduce JS parsing that will be defenitely possible so need to store more than one page
2017-03-02 22:42:50 +01:00
Albert Astals Cid 1fd2004aa3 Don't show widgets for non editable forms
What's the point of showing a form if we don't let the user do anything with it?
2017-03-02 22:34:25 +01:00
Albert Astals Cid e72d2f5357 virtual override -> override 2017-03-02 20:40:09 +01:00
Albert Astals Cid 191a37fb52 Q_DECL_OVERRIDE -> override 2017-03-02 20:39:24 +01:00
Albert Astals Cid 4072eb0c3a Add override 2017-03-02 20:38:50 +01:00
Albert Astals Cid b50aff3ed7 Q_NULLPTR -> nullptr 2017-03-02 20:09:32 +01:00
Albert Astals Cid ac345ba4dc Merge remote-tracking branch 'origin/Applications/16.12' 2017-02-20 01:08:01 +01:00