Commit graph

105 commits

Author SHA1 Message Date
Alexis Murzeau 3e10990eb0 When doing Ctrl+Wheel, zoom on pointer instead of the center of the screen
The zoom is implemented using zoomWithFixedCenter so it zooms into the
current mouse pointer location instead of zooming on the viewport center.

BUGS: 421484
2024-07-03 18:21:41 +00:00
Alexis Murzeau 83d2dcd7b1 Rearrange PageView::wheelEvent to separate Ctrl+Wheel handling from scrolling
This commit changes the "if / else" into "if return" so most of the
scrolling implemententation is not indented and the Ctrl+Wheel case is
handled as a special case at the beginning of the function.
2024-07-03 18:21:41 +00:00
Sune Vuorela d211a6a9e9 More cppcheck fixes 2024-06-26 12:48:44 +00:00
Sune Vuorela a9bb5b7c95 Replace unsigned open document with signed
Rather than opening a new window/tab with an extra document when signing
a document, replace current active unsigned document with the signed
version.

At least for some users, including me when testing,
it gives annoyance or confusion.
2024-06-19 12:05:45 +00:00
Sune Vuorela 0bae96a5c0 Fix minor bits from cppcheck 2024-06-13 16:56:24 +02:00
Sune Vuorela 4509b7bc42 Various minor fixes
Mostly derived from cppcheck runs
2024-04-16 15:44:19 +02:00
GI GI caeb12efd1 When pressing shift, hjkl scroll 10 times faster 2024-03-14 15:33:43 +00:00
Zentino zylsjsp 7d603a4572 Fix configure web shortcuts popup in kcmshell6
After updating to plasma6, the kcmshell5 changed name to kcmshell6, which caused okular's popup configure menus fail to appear.

This single commit should fix the issue.
2024-03-08 18:40:51 +00:00
Sune Vuorela 56a2a8d3bd cleanups: Sprinkle in a bit unique_ptr
Document memory ownership with unique_ptr's and do a bit of code
cleanups.
2024-03-06 21:57:08 +00:00
Sune Vuorela 717751a1f1 Fix multiline selection
In qt6, QRect::normalized changed it's meaning and it now has a 'span'
that preserves the old meaning.

Use the old span to get the old version of normalized so we can match on
the corners once again.

see https://codereview.qt-project.org/c/qt/qtbase/+/309932 for details.

BUG: 482249
2024-03-05 21:07:10 +00:00
Carl Schwan 7f639c2826 Fix crash when in embedded dummy mode
This is an issue for Kile as they use Okular in the "dummy mode" which
doesn't include the annotation tool.

BUG: 476207
2024-03-05 15:11:36 +00:00
Sune Vuorela 246f6bee79 Fix PAGEVIEW_DEBUG build 2024-03-04 23:42:48 +00:00
Sune Vuorela 2e008d437c Simplify textentity memory management
After trying to measure the effect of switching TinyTextEntity from a
custom SBO string type to just QString and getting a barely measurable
gain, TinyTextEntity kind of looked like TextEntity, so merge those two.

Also reduce the amount of new/deletes around TextEntities

Implement a string pool for some tiny strings, and various memory optimizations
2024-02-07 14:07:08 +00:00
Sune Vuorela e26731b4fc Port deprecated event positions
Most stuff are in floating point numbers, not rects, nowadays.
2024-01-03 15:49:54 +00:00
Sune Vuorela a3f0181848 Fix zoom select
There is a surprising api change in KSelectAction that has renamed
triggered, but a base class is still having a different triggered, so
code still compiles.

Rename the signal to the new version

BUG: 479108
2024-01-02 11:21:31 +01:00
Sune Vuorela 792425fc77 s/qAsConst/std::as_const/
We now definitely has std::as_const available and Qt has started nagging
about converting to std::as_const.

Implementation is the same for both functions, and qAsConst was a
stop-gap measure until std::as_const was sufficiently available.
2023-12-19 11:46:24 +00:00
Sune Vuorela a72ad046f7 Remove ifdef'ed out code 2023-12-18 22:56:22 +00:00
Sune Vuorela 8a1ef0cc84 Minor last fixes 2023-12-18 22:56:22 +00:00
Nicolas Fella 1b479dfb7b Port away from deprecated KRun 2023-12-06 09:22:16 +00:00
Nicolas Fella b5303248f0 Add missing includes 2023-09-11 16:47:17 +02:00
Nicolas Fella 3306e4f35d Hold zoom center below fingers on pinch zoom
Which feels more natural than always zooming towards the center of the window.

Co-authored-by: Steffen Hartleib <sh033@gmx.de>

Co-authored-by: Oliver Sander <oliver.sander@tu-dresden.de>

BUG: 390707
2023-08-11 11:27:26 +00:00
Albert Astals Cid 532cb0cdcd Initial implementation of app.popUpMenuEx
It is defenitely not a full implementation but it's enough for the one
file we have that needs it for now

BUGS: 472764
2023-08-05 18:20:54 +00:00
Emir SARI ad97329acd Apply i18n to percent values
This commit allows localizing the percent values for the languages,
that use a different percent format.
2023-07-23 16:16:24 +00:00
Nicolas Fella db68662372 Avoid accidental scrolling when performing pinch gesture
When starting a pinch the user first touches with one finger. That causes the QScroller to enter the pressed state.
Then when the second finger touches and moves this causes the QScroller to interpret it as a scroll. This causes
the view position of the document to move

To avoid this send InputRelease to the scroller when a pinch starts to make sure it is no longer in pressed state.
Also don't send any input to the scroller while the pinch is ongoing to avoid it entering the pressed state again.

BUG: 421755
2023-07-08 12:04:08 +00:00
Sune Vuorela 62767b7c8c Convert QtSpeech to config.h 2023-05-25 21:43:43 +00:00
Kai Uwe Broulik a6eeddf892 PageView: Set InstantPopup mode for View Mode menu
Fixes typo.
2023-05-16 17:35:53 +02:00
Sune Vuorela 5c9e0e2585 Rename setViewportWithHistory to setViewport and remove the old setViewport 2023-05-12 10:39:41 +00:00
Sune Vuorela b32ae775b4 Remove virtual methods from signature and certificate info
This is an abi break, but it menas we can extend signature and
certificate info in the future without breaking the abi again.

While we are at it, there is no need to hand around pointers to
certificate/signature info any longer, so clean up that. Fix memleaks as
side effect.
2023-05-03 09:15:42 +00:00
Kai Uwe Broulik 7d53ef7c74 Allow copying annotation text to clipboard
Adds a "Copy Text to Clipboard" context menu which copies the
annotation text to the clipboard as plain text.

When an annotation is selected in "Browse" mode, its text is copied.
2023-04-30 08:11:16 +00:00
Sune Vuorela b932f4289e Simple deprecation. Qt::MidButton 2023-04-27 10:36:01 +00:00
Sune Vuorela 63053419b9 setDelayed deprecation 2023-04-19 14:57:55 +00:00
Friso Smit 0b25a83cd5 Do continous scrolling when there is high resolution scroll 2023-02-20 01:07:11 +00:00
Friso Smit 30969b490c Move continuous zoom to a function 2023-02-20 01:07:11 +00:00
Albert Astals Cid 91afa74342 Set minimum requirement to Ubuntu 22.04 2022-11-19 09:48:15 +00:00
Nikola Nikolic e6002e798d Fix: Involuntary scrolling when annotations encounter the edge of the page
There are three reasons why scrolling happens (first two cases of scrolling are actually due to
viewport transition that is triggered by annotation being traslated/created):

1. VisiblePageRect are NormalizedRect and should be represented by four values in [0, 1] interval.
   Due to rounding errors caused by using QRect, they only reach the [0, 0.999] interval.
   That means that right and bottom edge of the page are never visible so if annotation
   is translated along the right/bottom edge viewport transition occurs (fixed in
   PageView::slotRequestVisiblePixmaps)

2. For freehand line there are some constants (dX, dY) that make a line to be drawn outside
   the page borders causing viewport transition. Removing these constants solves the problem (fixed
   in SmoothPathEngine::event)

3. Browse mode is activated as soon as the cursor is moved outside the viewport.
   Instead, we should forward the move event to the annotation which than can ignore the event (fixed
   in PageView::mouseMoveEvent)

BUG: 436742
2022-11-15 13:30:55 +00:00
Eugene Popov 40aa5fadb6 Increase scrolling speed with the touchpad
Currently, scrolling through a document using the touchpad is quite slow compared to scrolling through the standard Qt controls. This MR increases the speed of scrolling with the touchpad by removing the "magic" divider.

CCBUG: 455014
2022-11-13 18:12:25 +00:00
Eduardo Cruz ea04c61faf Add a configuration option to disable drag-scrolling beyond screen edges
The mouse cursor wrap feature while drag-scrolling can be undesirable in some
cases; for example it can be annoying to have the cursor jump accidentally to
the distant edge of a big screen. Now users can disable this feature if they
prefer.

BUG: 421040
FIXED-IN: 22.12
2022-09-28 00:10:56 +00:00
Albert Astals Cid 0d40301d50 Add a few definitions that will come with ECM 5.85
Better enforce them now, so that the work to port doesn't increase over
time

Not a super fan of this for regular applications, but oh well the ship
has sailed
2022-04-07 23:02:12 +00:00
Albert Astals Cid 252236d413 Port a few more QLinkedList to QList
We don't need the special properties of QLinkedList in any of those and
QLinkedList is deprecated, so move away from it
2022-03-31 17:08:01 +02:00
Albert Astals Cid 0741ef1838 Port away from more QLinkedLists
QLinkedList is gone from Qt6

The almost 1:1 port is std::list but we don't need iterator stability on
removal/insertion so just port to QList
2022-03-22 12:58:59 +01:00
Albert Astals Cid 8941e43488 Port away from more QLinkedLists
QLinkedList is gone from Qt6

The 1:1 port is std::list but we don't need iterator stability on
removal/insertion so just port to QList (one case to std::vector since
QList needs a copy constructor)
2022-03-22 00:11:55 +01:00
Albert Astals Cid 6767b8739e Port a few QLinkedList to QList
QLinkedList is deprecated in later Qt5 and gone in Qt6

The 1:1 port is std::list but in this cases all we ever do
is create the lists, push back to them, and pass then around
to be read, for that a QList is more than enough
2022-03-19 11:22:55 +00:00
Albert Astals Cid ba35bbd9e6 emit -> Q_EMIT
A future ECM is going to force that on us, so do it early
2022-03-19 10:58:47 +00:00
Albert Astals Cid ec1ed42dca Make clang-format happier 2022-03-12 10:59:53 +01:00
Jonathan Marten 1489c9aacb Fix clang-format brace layout introduced in adc7a758 2022-03-11 10:06:13 +00:00
Jonathan Marten adc7a75803 Fix a missing brace if HAVE_SPEECH is not defined
Possibly introduced by commit 50d0703a.

part/pageview.cpp: In member function 'virtual void PageView::mouseReleaseEvent(QMouseEvent*)':
part/pageview.cpp:3077: error: expected '}' before 'else'
part/pageview.cpp:3069: note: to match this '{'
2022-03-11 09:49:26 +00:00
Volker Krause 50d0703ae0 Enable readability-braces-around-statements 2022-03-09 23:29:56 +01:00
Nicolas Fella 1d64fea660 Port away from KToolInvokation 2022-03-03 21:54:28 +01:00
Albert Astals Cid 4cd6bfd30e mobile: Add Signature Viewing UI
Move a few files from part/ to gui/ since they are also used by the
mobile/ frontend
2022-02-18 08:32:13 +00:00
Yuri Chornoivan 28e362b6a1 Simplify the string for the 'Search for...' action
BUG: 450334
2022-02-17 15:09:42 +02:00