Commit graph

1587 commits

Author SHA1 Message Date
Albert Astals Cid acd3c81e23 Fix regression due to more QTemporaryFile behaviour changes
Make sure we call fileName because otherwise things break
2018-01-31 11:18:09 +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
Henrik Fehlauer dccd83783d Prevent Okular from crashing when synctex logs an error
bd20e48c3c updated Okular's copy of the synctex code to 1.19.
Unfortunately since this version the upstream code logs errors like
`"! SyncTeX Error : Ignored record...` when accessing selected synctex
files created with older versions of synctex.

The upstream `_synctex_log` contains `va_list arg` as a parameter, but
fails to initialize and tear down this properly via `va_start` and
`va_end`. In general this seems to work for the single argument case.
However, once we apply our hardening patch to get rid of the
`gnu_printf format attribute` warning and thus introduce a variadic
argument, things go wrong.

To fix this, we add the missing code. The remaining changes are just
refreshing the patches.

BUG: 383915

Test Plan:
Opening `empty.pdf` with `empty.synctex.gz` from
https://bugs.kde.org/attachment.cgi?id=109116 located
in the same folder does not lead to Okular segfaulting anymore.
2017-11-30 14:57:05 +01:00
Henrik Fehlauer b6573a2713 Change whitespace in synctex patches
15-prevent-leaks-and-segfault.diff did not apply cleanly with quilt.
After fixing this, some of the other patches needed a refresh.
2017-11-30 12:45:58 +01:00
Albert Astals Cid 9c352ca67c Workaround to build with older Qt
As explained in the comment we can do with using an older Qt since what this adds is really a small nicety in a corner case
2017-11-16 15:35:50 +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 e29892fda4 some review tweaks 2017-11-15 11:20:25 +01:00
Albert Astals Cid 2102843273 Use the undo stack to set the modified bit
This way it's much easier to track whether we are modified or not
2017-11-14 14:52:02 +01:00
Albert Astals Cid 8e80a4f570 Account for Okular::PagePrivate::findEquivalentForm failing
It should never fail but it's better if we have the backup for not crashing at least if it does
2017-11-14 09:57:38 +01:00
Albert Astals Cid 302c38672f Make Document::swapBackingFileArchive use swapBackingFile 2017-11-14 09:49:32 +01:00
Albert Astals Cid eea5127e73 We also support opening Okular archive files 2017-11-13 17:30:54 +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 d2d7a880b1 Minor style adjustment 2017-11-06 09:28:04 +01:00
Albert Astals Cid 099d3cfcc8 Update @since to 1.3
Let's see if we can squeeze it in
2017-11-06 06:10:13 +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
Albert Astals Cid 8944660ce7 Unbreak the code, need to register the metatype too ^_^ 2017-11-02 23:41:12 +01:00
Albert Astals Cid c2c1d76a0f Merge remote-tracking branch 'origin/Applications/17.08' 2017-11-02 17:50:02 +01:00
Albert Astals Cid 662fa69a2d Fix crash on rotation jobs
We don't need to delete the threadweaver job, threadweaver does it by itself,
and if we call deleteLater it may happen that the main thread deletes it
and then when the threadweaver thread tries to call the delete things are
gone and it goes kaboom

BUGS: 382725
2017-11-02 17:49:08 +01:00
Albert Astals Cid 453f45e7f7 Start the text generation request via a queued connection
Summary:
so that pixmap generation gets a chance to start before the text generation

This makes that on files where both the text generation and the pixmap generation
are slow at least we see something "as fast as possible" since only either text generation
or pixmap generation threads run at the same time

Reviewers: #okular, mlaurent

Reviewed By: mlaurent

Subscribers: michaelweghorn, dvratil, mlaurent, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8378
2017-10-31 10:04:03 +01:00
Albert Astals Cid cd24ad31c8 Implement missing todo in Document::swapBackingFileArchive
And extend tests to include archive files
2017-10-30 17:01:46 +01:00
Albert Astals Cid 0cb4ff7dad Fix copy&paste mistake 2017-10-26 21:09:21 +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 8690497be7 Add Page::annotation
Will use it later
2017-10-25 15:21:46 +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
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
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
l10n daemon script 62ce3db93b SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-09-16 05:03:07 +02:00
Henrik Fehlauer bd20e48c3c Update to synctex 1.19
Summary:
This should prevent crashes when reloading some synctex-enabled pdf
files created with newer versions of TeXLive. We also gain bugfixes,
features and improved accuracy from the last 6 years of synctex
development.

Procedure followed:
- svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir
- Check out revision 45150
- Update files present in core/synctex/*
- Adapt Okular code to changes
- Review and drop or update/apply old patches using quilt
- Create missing patches for local synctex changes
- New patch: Omit warning message when opening non-synctex pdf
- Two new patches to fix more compiler warnings
- New patch: Plug multiple leaks and prevent a segfault

TODO for later:
- Move sync file detection code to Okular to never call into synctex C code for non-synctex files
- Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library

BUG: 383915
FIXED-IN: 17.12.0

Test Plan:
- No crash in synctex on reloading empty.pdf from bugreport anymore.
- Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line.
- Forward and backward search in Kile seems to work.
- Works with synctex files from both TeXLive 2015 and 2017.
- PartTest::testForwardPDF still passes.
- No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular.

Reviewers: #okular, sander, #kile, aacid

Reviewed By: #okular, aacid

Subscribers: mludwig, aacid

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7594
2017-09-12 21:56:49 +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 a8a79368c7 Fix memory leak in text document settings d-pointers 2017-08-27 13:19:16 +02:00
Albert Astals Cid 0eb2f227b0 Fix memory leak in text document settings d-pointers 2017-08-27 13:18:31 +02:00
Albert Astals Cid afd3a1423a Make it clear that the caller to convert takes ownership 2017-08-25 01:17:31 +02:00
Albert Astals Cid 0919ad87d1 Fix width and height being switched when printing Custom size
BUGS: 383734
2017-08-21 00:09:27 +02:00
Albert Astals Cid fd5cc83e85 Fix warning in newer gcc versions 2017-07-27 16:57:40 +02:00
Oliver Sander 5fdbecf446 Simplify method FilePrinter::psPaperSize
The method FilePrinter::psPaperSize used to contain a long
list of hard-coded paper sizes for the different paper formats.
This patch makes the method get the same information
from QPrinter directly, which is much simpler and more
robust, too.

Note that the method is not actually used anywhere in okular,
though, so this change is purely cosmetic.

REVIEW: 130043
2017-07-05 20:37:36 +02: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
Albert Astals Cid 4573c7a646 Recalculate forms after other are edited
BUGS: 376958
2017-03-03 01:08:44 +01:00
Albert Astals Cid cfc158977f Add the additional action to form 2017-03-03 00:41:06 +01:00
Albert Astals Cid 56bcdad680 Refresh the pixmap of the page that contains the field when setting its text 2017-03-03 00:36:08 +01: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
Albert Astals Cid 1d2dd42c67 no need for & here 2017-03-02 22:45:45 +01:00
Albert Astals Cid 19be15b6a5 Field readOnly applies to the user but not to JS 2017-03-02 22:38:29 +01:00
Albert Astals Cid 519f0acac7 document which variant kind is returned 2017-03-02 22:23:41 +01:00
Albert Astals Cid ec70995895 QString as key is evil, add a nice enum 2017-03-02 21:04:59 +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