Commit graph

202 commits

Author SHA1 Message Date
Laurent Montel 486e05b270 If include is define in .h remove it if it's defined in .cpp too (scripted) 2020-10-23 07:32:28 +02:00
Albert Astals Cid 19d98d6a74 Run clang-format
find . \( -name "*.cpp" -or -name "*.h"  -or -name "*.c"  -or -name "*.cc" \) -exec clang-format -i {} \;

If you reached this file doing a git blame, please see README.clang-format (added 2 commits in the future of this one)
2020-07-11 09:17:33 +02:00
Albert Astals Cid 4964e7e42d Merge remote-tracking branch 'origin/release/19.12' 2020-03-02 22:22:06 +01:00
Albert Astals Cid 81c005710c Fix re-rendering of images when using partial updates
Partial updates trigger when the page is taking "too much" to render (>
500 ms).

When this happens we store a pixmap for the page, this meant that
Page::hasPixmap returned true, so when moving the viewport around we
would think that that page was already rendered, and thus needed no
rendering so we didn't add it to the list of requested pixmaps.

Then on document when seeing the new list of requested pixmaps we would
go and check and say "oh there's one request going on that we don't want
anymore, let's cancel it", so we would cancel the page that we actually
wanted (and clear the partial pixmap)

Then on the next scroll we would realize we did not have that page
pixmap and then request it again which since it's the current page would
immediately stop all other renders and start this one.

Then we would get a temporary pixmap and the loop of cancellations and
requesting again would keep happening as long as the user moved the
viewport.

We fix that my making hasPixmap return false if the pixmap we have is a
partial one, because that's what the function meant "forever" until we
recently introduced partial updates so all the calls to hasPixmap
actually mean "hasNonPartialPixmap"

BUGS: 418086
2020-03-02 21:06:03 +00:00
Albert Astals Cid eddbe03128 enable clazy strict-iterators 2020-02-20 10:15:24 +01:00
Albert Astals Cid 2da1cd736a CI: Enable clang-tidy modernize-loop-convert 2020-01-24 17:23:39 +01:00
Albert Astals Cid 0a2287be19 CI: Enable two readability clang-tidy checks
Use jq to filter compile_commands.json to not include the compilation of
autogenerated files, we don't want to check those

Also filter out the synctex folder, since that is imported code
2019-12-23 12:06:49 +01:00
Ahmad Samir ccf3a384c3 [core/*] replace foreach, deprecated, with range-for
The code compiles and okular seems to load and work as before, all unit
tests pass except (parttest and epubgeneratortest, but they fail on master
too).
2019-12-09 13:16:55 +00:00
David Hurka c61a9587ec Improve documentation of TextEntity stuff
Summary:
This adds some important documentation on TextEntity and other classes, and improves some of the existing documentation.

This includes changing parameter names from ‘rect’ to ‘area’, because I found ‘rect’ misleading.

Test Plan: Run doxygen

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: aacid, yurchor, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21271
2019-07-21 10:49:51 +02:00
Yuri Chornoivan 5478b2ec92 Fix minor typos 2018-11-14 21:12:15 +02:00
Yuri Chornoivan c04ca1fa96 Fix minor EBN issues 2018-08-31 12:23:45 +03:00
Ahmad Osama 6a2ed4f314 [Okular] Bug 387282: Highlighting of search results lost when rotating page
Summary:
The highlights were removed when rotating the page, also the RotaionJob::rotationMatrix function was not rotating the Highlihgts correctly.
I removed the deletion and modified the rotaionMatrix function by making it shorter and adding a translation after the rotatin. I tried different rotations and they are working fine.
BUG: 387282

Reviewers: #okular

Subscribers: aacid, ngraham, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D11901
2018-04-17 00:39:02 +02:00
Albert Astals Cid 2d8b2c7e95 Add support for cancellable image rendering and text extraction
Summary:
Only supported by the pdf backend if using poppler >= 0.63

Sadly had to change the generator API

Text cancellation is a bit wobbly still since poppler has large parts
of the code where doesn't check for the cancellation flag, but that
is something that will get automagically fixed for us if the poppler
side is improved

Test Plan: Needs https://bugs.freedesktop.org/show_bug.cgi?id=104263

Reviewers: ervin, rkflx

Reviewed By: ervin, rkflx

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D9328
2018-02-01 22:53:28 +01:00
Albert Astals Cid 4e6c9f8f7a Fix crash when accessing text page after save
text page was storing a pointer to a PagePrivate pointer but those die
after saving so we need to store a Page pointer since those are stable.

BUGS: 387247
2017-12-05 23:07:10 +01:00
Albert Astals Cid 3957683d76 Merge branch 'dont-use-docdata-for-annots-and-forms' into Applications/17.12 2017-11-16 15:00:23 +01: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 a2f5560c00 PDF: Support the poppler 0.62 renderToImage with update callback
Summary:
This way pages that take more than 500ms to render get updated every so often so that the
user can see that the program didn't hang, it's just that it's taking long to render

Tags:
incremental rendering, partial updates

BUGS: 344081

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8379
2017-11-09 17:28:54 +01: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 8690497be7 Add Page::annotation
Will use it later
2017-10-25 15:21:46 +02: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
Albert Astals Cid 2ca1779feb Add a way to get the PagePrivate if you have the Page 2017-03-03 00:32:08 +01:00
Martin T. H. Sandsmark f05d42eac3 core: Fix build without implicit cast to/from ascii
See previous commits for details.
2016-07-11 22:07:57 +02:00
Montel Laurent 466eb79615 Use QStringLiteral 2015-10-29 13:37:11 +01:00
Frederik Gladhorn 6c602bf0e7 Use categorized logging even more 2014-09-16 23:38:25 +02:00
Frederik Gladhorn 9d89739972 Use categorized logging 2014-09-16 23:24:36 +02:00
Frederik Gladhorn 83d3f1f6b7 Revert "Some more kDebug->qDebug"
Seems like kDebug doesn't spam the user, so this needs to use qCDebug.

This reverts commit 34fbdf8c85.
2014-09-11 02:03:46 +02:00
Fabio D'Urso e059d2652c core: support for migration of annots and forms out of docdata/ 2014-09-10 12:18:34 +02:00
Frederik Gladhorn 34fbdf8c85 Some more kDebug->qDebug 2014-09-09 18:17:36 +02:00
Fabio D'Urso 57c9cae257 Don't save form contents to docdata/
But existing saved form from previous Okular versions are preserved
2014-05-11 18:52:15 +02:00
Michal Humpula c07ee043a3 Multiple Tiles Managers per Page
It's straighforward implementation. Every single place, where there were call for (or with) TilesManager, now has a DocumentObserver as companion. The m_tiledManager reference in PagePrivate was changed to QMap<DocumentObserver, TilesManager>.

REVIEW: 113986
2014-02-19 23:41:22 +01:00
Jon Mease 43246c563b Viewport transition refinements for Find and Undo/Redo actions
REVIEW: 114060

This patch introduces viewport transitions for undo/redo actions on annotations and forms.  When an annotation/form action is undone/redone but the associated annotation/form is not currently visible, the viewport is updated to center on the undo/redo action. If the annotation/form is visible, the viewport is not updated.

The viewport transitions for the Find action have also been updated to this same algorithm.  Previously the viewport was moved to center on each matching search term even if the search term was already visible in the viewport. This lead to unnecessary viewport transitions if the search term matched several items in a single paragraph for example.

These proposed changes to the viewport transition behavior are consistent with the find and undo behavior of many existing applications including Kate, Open Office, and Foxit PDF Reader.
2013-12-29 23:27:30 +01:00
Fabio D'Urso a556126816 Fix the issue exposed by the previous patch
The patch de-singletons the PageController class.

The PageController is now per-document and it gets deleted when the
document is closed.

As consequence of this, the RotationJob's done signal will not be
delivered if the document has been closed, and thus this fixes the
crash.
2013-07-30 20:40:40 +02:00
Fabio D'Urso 3c65f81fb9 Prefer annotations in the foreground in Page::objectRect 2013-07-01 22:06:46 +02:00
Peter Grasch 4d4dd68ca2 Fix usability issues with selecting annotations
REVIEW: 109627
2013-06-23 19:22:21 +02:00
Jon Mease 3c6140b616 Fix Undo / Redo of annotation creation doesn't properly handle page rotation and adds undo unit tests
BUG: 318091
REVIEW: 109989
2013-04-13 22:54:47 +02:00
Jon Mease 78faf1e68f Add undo/redo support for annotations
REVIEW: 107442
2013-04-06 00:22:48 +02:00
Albert Astals Cid 541650a4f4 Remove the concept of observer/view id
Just use the pointer as id :-)

This is BIC and SIC, increase the soversion now to makes sure we don't forget in the future

Patch based in an earlier patch by Bogdan Cristea <cristeab@gmail.com>
REVIEW: 109115
2013-02-24 23:01:02 +01:00
Mailson Menezes 7528fb8c88 Change TilesManager::tilesAt use
- The second parameter has changed to an enum
 - Now Page::tilesAt only returns tiles with pixmaps
2012-11-15 20:41:17 -03:00
Fabio D'Urso d3eb739814 Merged TilesManager::setWidth and setHeight into a single setSize method 2012-11-11 21:39:23 +01:00
Mailson Menezes f56c5a8ac9 Merge branch 'master' into tiled-rendering 2012-11-08 20:51:01 -03:00
Fabio D'Urso 437ddad588 Hide tiles manager within okularcore
Only the Tile class (tile.h) is visible from the outside
2012-11-08 20:26:17 -03:00
Fabio D'Urso e12966b259 Removed possibility to have a tiles manager per observer
Now only the PageView can have a tiles manager.
2012-11-08 20:52:01 +01:00
Jan Binder aa6ed8afc0 Replace deprecated QMatrix by QTransform
REVIEW: 105737
2012-09-08 17:06:02 +02:00
Mailson Menezes 0053b9c015 Remove unused property from PixmapObject
This property was added before the tiles manager was created.
2012-08-24 14:02:07 -03:00
Mailson Menezes 2d5b51ff88 Fix crash when changing between memory profiles 2012-08-24 14:01:54 -03:00
Mailson Menezes 851a503e81 Move tiles manager to a private header 2012-08-17 15:23:58 -03:00
Mailson Menezes 401c3f7e5d Add rotation support to tiles manager 2012-08-17 14:30:53 -03:00
Tobias Koenig 58eb957f26 Support multiple annotations in RMB menu
Provide the actions for all annotations in the RMB menu, if multiple
annotations are located on top of each other.

BUGS: 300942
REVIEW: 106035
FIXED-IN: 4.10.0
2012-08-15 17:24:11 +02:00
Mailson Menezes 3c09b93713 Merge branch 'master' into tiled-rendering
Conflicts:
	core/document.cpp
2012-08-15 11:44:22 -03:00