Commit graph

1806 commits

Author SHA1 Message Date
João Netto f3c8bb9299 Changed button code to be transparent when there's no text. 2019-07-20 12:04:59 +02:00
João Netto cc10164d34 Implemented initial support for animatedPDF
When refreshing, widgets must check if they should be visible

Implemented unit tests to the JavaScript functions.
2019-07-20 12:04:45 +02:00
Oliver Sander 8e1d9aa480 Fix page boundary gradients on scaled displays
The code that draws a thin gradient at the right and bottom
boundaries of a page implicitly assumed that the display was
not scaled, i.e., that logical pixel where identical to
physical pixels.  Nobody really noticed because that gradient
was so thin.  Anyway, this patch fixes the gradient for
scaled displays.

I considered using a QLinearGradient, but decided against it:
The code would have been longer, and the manual code in the
patch can exploit the fact that all lines are horizontal
or vertical.  Therefore, expensive scan-conversion can be
avoided.
2019-07-17 19:46:59 +00:00
Oliver Sander a0bd9c4d1c Make the page outline one physical pixel wide
Pages get a black rectangle around them as 'outline' after
being rendered.  This rendering was not pixel-perfect at
fractional scalings: apparently, fractional line widths and
positions get rounded differently.  The result was that
sometimes there was a small gap between outline and page.

This pages fixes the problem by making the pen for the
outline 'cosmetic', i.e., one physical pixel wide.
With that, its position can be such that it encloses
the page without any gap.
2019-07-17 19:46:59 +00:00
Oliver Sander 9b34bfb45e Make page boundary rendering more robust
Okular renders a simple 'shadow' at the right and the bottom of each
page.  The code for this is a bit fragile:  After the page is rendered,
Okular paints a black outline, and then the shadow.  The shadow is
a hand-implemented gradient, painted line by line.  Finally, the
remaining area is painted in the background color.  No pixel is
ever touched twice.  Unfortunately, the code is buggy, and in hidpi /
fractional scaling situations, some pixels are never touched.
This results in rendering glitches as reported in

  https://bugs.kde.org/show_bug.cgi?id=383943

Instead of trying to fix the previous approach, this patch makes the
code more robust by changing the order of the painting operations.
After painting the page, the code now first paints the background,
which is now enlarged to cover everything off the page.  Finally,
the black outline and shadow are drawn on the previously drawn
background.  This makes sures that no pixel is ever left uninitialized.
It also allows to simplify the shadow drawing operation a bit.

BUG: 383943
2019-07-17 19:46:59 +00:00
Oliver Sander f681fb0eb2 Use range-based for to iterate over a QRegion
According to

  https://doc.qt.io/qt-5/qregion-obsolete.html#rects

the method QRegion::rects is obsolete and should be avoided.
Let's do that by moving to a range-based for over the QRegion.
That is easier to read anyway.
2019-07-17 19:46:59 +00:00
Albert Astals Cid 2e4212ad80 Partially revert "Fix two easy deprecation warnings"
QFontMetrincs::horizontalAdvance is only available in Qt 5.11

This reverts commit 69ec17554a.
2019-07-04 00:31:15 +02:00
Albert Astals Cid 69ec17554a Fix two easy deprecation warnings
width -> horizontalAdvance

background -> window
2019-07-04 00:06:19 +02:00
Simone Gaiarin a33cb321df Improve layout of annotation configuration dialogs
Summary:
The config dialog of each annotation tool is now a form layout without group boxes. Everything is aligned.

Reviewers: #okular, #vdg, ngraham, aacid

Reviewed By: #okular, #vdg, ngraham, aacid

Subscribers: sander, davidhurka, aacid, okular-devel, knambiar, ngraham

Tags: #okular

Maniphest Tasks: T8076

Differential Revision: https://phabricator.kde.org/D10859
2019-06-24 07:36:21 +02:00
Oliver Sander 19f22098e6 Mind the devicePixelRatio when drawing on-screen in presentation mode
Previously, when using a screen scaling factor larger than 1, the
drawings by mouse or stylus in presentation mode were slightly blocky.
The underlying cause was
a) a few integer types used for non-integer coordinates
b) the intermediate use of a QPixmap without the correct
   devicePixelRatio

Additionally, this patch uses a QPainterPath to draw the path,
rather than a sequence of individual lines.  This improves
the line quality a tiny bit, because the lines are properly
joined.

BUG: 384143

Differential Revision: https://phabricator.kde.org/D21836
2019-06-22 21:55:30 +02:00
Albert Astals Cid 073f50cab8 Merge remote-tracking branch 'origin/Applications/19.04' 2019-06-22 12:40:20 +02:00
Albert Astals Cid f3f7ca79fc Fix crash for rects that don't have an action
It shouldn't really happen, but in some cases it does, so be protective

BUGS: 408849
2019-06-22 12:35:17 +02:00
Noah Davis 2c39981b21 Change Text Selection icon to edit-select-text
Summary:
The current icon (draw-text) is semantically incorrect. This patch makes the Text Selection tool use the icons added in D21632.

BUG: 408391
FIXED-IN: 1.8.0

Test Plan: {F6874885, size=full}

Reviewers: #vdg, #okular, ngraham

Reviewed By: #vdg, ngraham

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21633
2019-06-06 14:58:40 -04:00
Noah Davis 9310bed616 Change Browse icon back to the hand shape
Summary: I changed the `input-mouse` icon so that it would look more like a real mouse. In order to keep the proper icon for the Browse tool, I have to change the icon to `transform-browse`.

Test Plan: {F6874739, size=full}

Reviewers: #okular, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21630
2019-06-06 13:48:05 -04:00
Nate Graham e84733549d In Toolbar's selection mode menu, show "Text Selection" tool by default
Summary:
Currently, the Toolbar's selection mode menu shows the rectangular selection mode
by default, which is not the most useful or commonly used selection mode.

This patch makes the Text Selection tool the one that's shown by default, since that's
the kind of selection that's the most useful given the sort of document that Okular
is typically used to view.

Test Plan:
- Delete `~/.config/okularrc` and `~/.config/okularpartrc`
- Open Okular
- See that the selection mode toolbar button shows Text Selection by default:
{F6874497, size=full}

Reviewers: #okular, #vdg, ndavis

Reviewed By: #vdg, ndavis

Subscribers: ndavis, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21624
2019-06-06 11:26:15 -06:00
Nate Graham c792444550 Use a more conventional dropdown menu style instead of press-and-hold
Summary:
Currently, `ToolAction` menus (of which there is only one, the selection tool menu)
activate the current tool on click, and require a click-and-hold to choose a new tool.
This is a somewhat unfamiliar user interface that I myself struggled with when initially
encountering it, and I've encountered user complaints about it as well.

This patch adjusts the behavior so that clicking on the arrow on the right side of the
button will open the pop-up and allow choosing another tool, which is a more common
method of implementing the feature. The patch also adjusts the tooltop accordingly.

Test Plan: {F6874466, size=full}

Reviewers: #okular, #vdg, ndavis

Reviewed By: #vdg, ndavis

Subscribers: ndavis, abetts, filipf, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21622
2019-06-06 11:40:02 -06:00
Nate Graham c325cb4161 Regularize tool names
Summary:
Currently, some of the items in the {nav Tools} menu have "tool" in the name, and some
do not. This is in any event redundant since they're in a menu with that word in it
already. In the toolbar, these actions become more inconsistent since their names change
and can even differ between what's shown in the pop-up menu and what's shown on the
button text.

This patch regularizes the names, stops changing the names for the toolbar versions, and
updates the docbook accordingly.

Test Plan:
{F6874459, size=full}

{F6874458, size=full}

Reviewers: #okular, #vdg, filipf

Reviewed By: #vdg, filipf

Subscribers: filipf, okular-devel, kde-doc-english

Tags: #okular, #documentation

Differential Revision: https://phabricator.kde.org/D21621
2019-06-06 09:12:14 -06:00
Laurent Montel 9f90e14dd1 Fix forward declaration 2019-06-03 08:48:32 +02:00
Tobias Deiminger d084641c2d Fix narrowing conversion in LineAnnotationWidget::endStyleIcon
Summary:
Windows MSVC Qt5.11 build fails:
```
conversion from 'initializer list' to 'QSizeF' requires a narrowing conversion
```

Pass QSize, and let QSizeF Ctor `QSizeF(const QSize &)` do the conversion.

Test Plan: - build on Windows MSVC

Reviewers: aacid

Reviewed By: aacid

Subscribers: aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21543
2019-06-02 22:07:28 +02:00
Tobias Deiminger 1b89f220ef Add icons for line annotation arrow styles to combo box
Summary:
Use `LineAnnotPainter` to generate accurate icons.

Looks like this:
{F6852054}

Depends on D21248

Test Plan:
- open "Edit annotation tool" for straight line and check combo box items for start and stop style
- test on HiDPI

Reviewers: #okular, sander

Reviewed By: sander

Subscribers: davidhurka, knambiar, ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21416
2019-06-01 17:38:23 +02:00
Tobias Deiminger d0e3a77de2 Add line annotation ending arrows for non PDF documents
Summary:
This implements drawing the various line ending styles for 2 point lines in non-PDF documents.

Looks like this:
{F6833437}

CCBUG: 381629

Test Plan:
- open a *.txt document
- draw line annotations with different arrow styles: Square, Diamond, OpenArrow, ClosedArrow, ROpenArrow, RClosedArrow, Butt, Slash, Circle
- ... as start and as end style (start needs D21238 to be configurable in GUI)
- ... filled or not (fill color can't be configured in GUI yet)
- ... with different leader line settings
- ... at various angles
- rotate and scale page
- leader line with setting 100 gives 100 pixel line at 100% zoom (use kruler to verify)

Reviewers: #okular, aacid, sander

Reviewed By: sander

Subscribers: ngraham, sander, knambiar, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21248
2019-06-01 17:28:48 +02:00
Laurent Montel cb691f70dc Fix some clazy warning
Summary: fix clazy warning

Reviewers: aacid

Reviewed By: aacid

Subscribers: nicolasfella, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D20832
2019-05-27 08:02:57 +02:00
Rajeesh K Nambiar b1c30cd0ed Okular Annotation: add line start/end style config only for Straight Line tool
Summary:
“Inner Color” configuration of Polygon tool was overlapping with the line start/end styles intended for only Straight Line tool. Fix it.

CCBUG: 381629

Test Plan:
1. Configure annotations
2. Create/Edit Polygon tool
3. Observe that no Line Start/End styles are visible
4. Create/Edit Straight Line tool
5. Observe that line start/end styles can be configured

Reviewers: #okular, tobiasdeiminger

Reviewed By: tobiasdeiminger

Subscribers: tobiasdeiminger, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21332
2019-05-26 10:15:06 +02:00
Kezi Olio e971c67ce1 Make selection scrolling go at 60 fps
Summary:
When you select a square with the right mouse button, and you go past the margin of the window (but where there is still space to go), okular scrolls the document so you can select more.
With this patch this automatic scrolling goes at 60 fps instead of 10, I made it so that the speed of the scroll is the same

Reviewers: #okular, aacid, sander, ngraham

Reviewed By: sander, ngraham

Subscribers: sander, ngraham, aacid, ahmedbilal, okular-devel, kezik

Tags: #okular

Differential Revision: https://phabricator.kde.org/D20437
2019-05-21 15:15:23 -06:00
Rajeesh K Nambiar 59a86c3f14 Okular Annotation: add support for line start style for Straight Line tool
Summary: Similar to the line ending style, add support for line start style for the Straight Line annotation tool

Test Plan:
1. Go to Configure annotations
2. Create (or edit existing) Straight Line tool
3. Set the ‘Line Start’ option on Style and Apply
4. Use the Straight Line tool to draw a line and check the line starting style.

Reviewers: #okular, tobiasdeiminger

Reviewed By: tobiasdeiminger

Subscribers: ngraham, tobiasdeiminger, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21238
2019-05-19 09:08:02 +02:00
Tobias Deiminger 5c5e5fceb5 Merge remote-tracking branch 'origin/Applications/19.04' 2019-05-14 23:44:41 +02:00
Tobias Deiminger a0045a97a2 Fix line annotation leader line angle
Summary:
For "Straight Line" annotations, the "Leader Lines" (if any) shall be perpendicular to the main line segment. Current code missed to consider page aspect ratio when calculating the main segment angle, which caused non-perpendicular leader lines.

Note: Bug is only visible with non-PDF documents (i.e. where Okular draws line annotation, instead of generator).

Before:
{F6818453}

After:
{F6818452}

Test Plan:
- open a txt file, the generated page will have aspect ratio 3:4
- configure a "Straight Line" annotation with long leader line
- create a line annotation at 45 degree angle
- check the leader line, it shall be perpendicular to the main line

Reviewers: sander

Reviewed By: sander

Subscribers: aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21136
2019-05-14 23:36:33 +02:00
Rajeesh K Nambiar 745e8dfa8b use the new signal-slot connect syntax
Differential Revision: https://phabricator.kde.org/D21092
2019-05-12 21:01:13 +02:00
Rajeesh K Nambiar db2dcdade3 Okular Annotation: add support for line ending style for Straight Line tool
Summary:
Poppler and Okular already have support for specifying Line End style (`TermStyle`) for the Straight Line tool. Expose the functionality in configuration and hook up the correct slots.

Configure annotations (before):
{F6788150}

Configure annotations (after):
{F6788151}

Straight Line tool with Open Arrow end in action:
{F6788153}

Test Plan:
1. Open a PDF in Okular
2. Enable Review
3. Right click on Review toolbar and Configure annotations
4. Create (or edit existing) Straight Line tool
5. Set the ‘Line End’ option on Style and Apply
6. Use the Straight Line tool to draw a line and check the line ending style.

Reviewers: #okular, #vdg, sander, ngraham

Reviewed By: #vdg, sander, ngraham

Subscribers: pino, sander, davidhurka, tobiasdeiminger, ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D20760
2019-05-07 11:06:14 +02:00
Shubham Jangra f788b5a384 Add action in Edit menu to select the text on current page
BUG: 358868

Test Plan: Click on "Select All Text on Current Page" entry in Edit menu to select the entire page. The selected text can then be copied via Edit menu item "Copy"

Reviewers: aacid, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: yurchor, michaelweghorn, kde-doc-english, davidhurka, abetts, loh.tar, alexde, ngraham, okular-devel

Tags: #okular, #documentation

Differential Revision: https://phabricator.kde.org/D18744
2019-04-22 01:11:27 +02:00
Joao Netto b669398404 Add buttons to collapse and expand all elements
Summary:
Adds two buttons on the bottom right to expand and collapse all elements in annotations
BUG: 377024
T8553

With latest breeze-icons:
{F6687517}

Without it:

{F6687519}

{F6687518}

Reviewers: #okular, #vdg, ngraham

Subscribers: ndavis, aacid, ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D18358
2019-04-01 00:16:09 +02:00
Oliver Sander f34ebf659f Replace some iterator loops by range-based for
Summary: As the title says.  In my humble opinion this makes the code *much* easier to read.

Test Plan: No functional changes.

Reviewers: #okular

Subscribers: aacid, davidhurka, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D19539
2019-03-26 23:47:26 +01:00
Oliver Sander 4094745e7e Page changes triggered by mouse clicks should all happen on button release
Summary: Previously this was inconsistent: left button clicks triggered page changes at release, but right button and forward/backward button clicks triggered directly at the mousePressEvent.

Reviewers: #okular, ngraham, aacid

Reviewed By: ngraham

Subscribers: aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D19702
2019-03-26 21:50:05 +01:00
Shubham Jangra 4610929e0c Use logically correct icon for direction arrows
Test Plan:
Before:
{F6626036}
After:
{F6626027}

Reviewers: #vdg, ngraham, #okular

Reviewed By: #vdg, ngraham

Subscribers: aacid, abetts, davidhurka, ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D19183
2019-03-13 19:24:42 +05:30
Laurent Montel 2406bf9c4c Use not deprecated methods 2019-03-13 06:58:11 +01:00
Laurent Montel 5a3a49c310 Port qSort to std::sort 2019-03-12 13:13:53 +01:00
Oliver Sander 50bfd9fe86 Presentation: optionally go to prev. page when touching left half of the page
This patch makes switching presentation slides using touch screen taps
more flexible.  It introduces a new configuration option
'Touch navigation' with three possible values:
* 'Tap left/right side to go back/forward':
   Tapping on the left(right) half of the screen
  makes the presentation go to the previous(next) slide.
* 'Tap anywhere to go forward':
  Tapping on the screen makes the presentation go to the
  next slide, no matter where the screen is being tapped
* 'Disabled':
  Screen tapping doesn't do anything.

Previously, only 'Tap anywhere...' was implemented.

This patch does not change the behavior of mouse clicks.

Differential Revision: https://phabricator.kde.org/D18118
2019-03-11 21:09:30 +01:00
Laurent Montel c3db297225 Remove deprecated method 2019-02-27 07:50:47 +01:00
Joao Netto 716b234100 Implemented find function from console
Summary:
Implemented feature request to find from console.

BUG: 362038

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: ngraham, aacid, yurchor, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D18144
2019-02-13 23:59:52 +01:00
Nate Graham 259961f6d1 Add icons for the Trim Margins tools
Summary:
New icons were added in D18552.

BUG: 397768
FIXED-IN: 19.04.0

Test Plan: {F6569231, size=full}

Reviewers: #okular, #vdg, ndavis

Reviewed By: #vdg, ndavis

Subscribers: ndavis, trickyricky26, aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D15193
2019-01-26 13:57:29 -07:00
Yuri Chornoivan f22fbca626 Add placeholders for the search lines
Summary:
Some people need them

BUG: 403445

Test Plan: Can be compiled, installed, can be spotted in the GUI.

Reviewers: #okular, ngraham

Reviewed By: ngraham

Subscribers: ngraham, #vdg, GB_2, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D18429
2019-01-21 18:44:23 +02:00
Yuri Chornoivan 614f580b79 Fix minor typos 2019-01-11 09:09:34 +02:00
Chinmoy Ranjan Pradhan a234a902dc Implement digital signature support for PDF
This is a squash of the original branch

It also contains fixes/rework from Albert Astals Cid

If you're interested in its history have a look at the
gsoc2018_digitalsignature branch

The poppler dependency situation is:
 * With 0.51 you get most signature information
 * With 0.68 you also get signature location/reason information
 * With 0.73 you also get signature certificate information
2019-01-10 23:13:54 +01:00
Albert Astals Cid 33b85a74c3 Simplify AnnotPagePair
Use the default destructor, copy constructor, assignment operator
2019-01-10 00:40:23 +01:00
Albert Astals Cid 47d7d04b5e delete copy constructor and assignment operator of some internal classes
they are unused(except the PageViewItem one), but if anyone would use
them things would go wrong, so protect us from it

Actually fixes a bug in PageView::slotFitWindowToPage in which we were
copying constructing PageViewItem and that's bad
2019-01-10 00:28:49 +01:00
Simone Gaiarin 1547c78340 Move "erase drawings" action to last position and change its icon
It is more logical to have the drawing tools first, then the eraser,
and then the action to delete everything. Also the two actions to erase
things are close to each other now.

The icon of "erase drawing" has been changed to draw-eraser-delete-objects
to distinguish it from the "Eraser" tool.

BUG: 399734

Differential Revision: https://phabricator.kde.org/D16171
2018-12-21 12:44:04 +01:00
Albert Astals Cid 991a067aff Merge remote-tracking branch 'origin/Applications/18.12' 2018-12-06 00:25:32 +01:00
Albert Astals Cid ba1c2beb70 Fix regression in Ctrl+Wheel zoom when using the touchpad
For some reason Qt started sending mouse move events after all wheel
events so only reset the delta when the mouse move event represents an
actual move
2018-12-06 00:24:39 +01:00
Tobias Deiminger 09a2d6ed67 Merge remote-tracking branch 'origin/Applications/18.12' 2018-11-29 21:42:35 +01:00
Tobias Deiminger a29e4eaff5 Fix inconsistent viewport positioning in PageView
Summary:
This diff unifies the calculation of the viewport position from a given DocumentViewport. PageView::notifyViewportChanged and PageView::slotRelayoutPages used to handle it differntly, which resulted in viewport jumps for no reason.

It happened in various situations, e.g. when jumping to a page using the footer page navigation, or when reloading the document after presentation mode left, or when resizing the main window after presentation mode left.

The diff selects the notifyViewportChanged way (align viewport top border with page top margin) as golden behavior in case of rePos.enabled == false.

BUGS: 357958
CCBUG: 341939
CCBUG: 400890

341939 and 400890 are fixed partially. These two still suffer from a minor displacement that happens when finished signal arrives from pixmap generation thread.

Test Plan:
- When using the footer page navigation to jump to different pages, new page top is always algined with viewport top.
- After changing page with footer page navigation, press F5 to reload. Page top stays aligned with viewport top.
- When exiting presentation mode, and touching the file, page top stays aligned with viewport top.
- When exiting presentation mode, and changing main window size, page top stays aligned with viewport top.

Reviewers: #okular, sander

Reviewed By: sander

Subscribers: ngraham, sander, aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D16941
2018-11-29 21:41:43 +01:00