Commit graph

1625 commits

Author SHA1 Message Date
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
l10n daemon script 53a6cde141 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-02-04 06:23:35 +01:00
Albert Astals Cid 91f092cdf4 Merge remote-tracking branch 'origin/Applications/16.12' 2017-02-01 00:50:29 +01:00
Albert Astals Cid 96d8953878 Fix Enter turning the thumbnail filter bar into a regular search bar
BUGS: 375755
2017-02-01 00:49:21 +01:00
Albert Astals Cid 021cc986a8 Merge remote-tracking branch 'origin/Applications/16.12' 2017-01-31 22:52:45 +01:00
Albert Astals Cid be6b0b6f48 Fix porting bug regarding the font extraction progress
BUGS: 375782
2017-01-31 22:50:54 +01:00
Elvis Angelaccio 3b610bd86a Fix wrong apidox
The duration argument is used as input of QTimer::start(),
which requires milliseconds and not seconds.

REVIEW: 129894
2017-01-29 18:30:03 +01:00
Martin T. H. Sandsmark 7f3eebd9f3 Only show warning messages by default
REVIEW: 129832
2017-01-16 18:41:33 +01:00
Albert Astals Cid ed4a9f42f4 Merge remote-tracking branch 'origin/Applications/16.12' 2017-01-16 00:37:25 +01:00
Albert Astals Cid f467807506 Remove #ifdefs for Qt we require in cmake anyway 2017-01-16 00:36:08 +01:00
Martin T. H. Sandsmark 033f21c826 Port some missing debug output to categorized logging 2017-01-14 19:15:26 +01:00
Antonio Rojas 84c9910da9 Avoid duplicates in the available backends list
If a generator can open multiple mime types that match the same file, avoid showing a backend chooser dialog with multiple instances of the same
backend

REVIEW: 129791
BUG: 374650
2017-01-08 19:48:10 +01:00
Antonio Rojas f3f077e1a6 Avoid duplicates in the available backends list
If a generator can open multiple mime types that match the same file, avoid showing a backend chooser dialog with multiple instances of the same
backend

REVIEW: 129791
BUG: 374650
2017-01-08 19:38:42 +01:00
l10n daemon script fb77e0d1fd 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"
2016-12-20 13:06:28 +01:00
Albert Astals Cid ef860fb1d8 Merge remote-tracking branch 'origin/Applications/16.12' 2016-12-08 23:39:47 +01:00
Albert Astals Cid ecf54e4203 Try other generators if opening fails with one generator
This is not very common but would happen so be a bit stubborner
2016-12-08 23:35:04 +01:00
Miklós Máté e81fb3d639 Check all supported mime types the generator supports
Stopping on the first inherit match can prevent finding a perfect match, and thus we might enter a competition of inherit matches from other generators.

Example: spectre supports application/postscript and image/x-eps. When opening an eps the app/ps is an inherit match, but so is text/plain from the txt generator. Thanks to stable_sort() the txt generator is deterministically selected from the above two inherit matches. Unless we continue and find the perfect match, which is spectre:image/x-eps.

REVIEW: 129610
2016-12-08 22:42:44 +01:00
Albert Astals Cid 2868e3e5ca Support SetOCGState links
Needs a very recent poppler

BUGS: 368402
REVIEW: 129216
2016-11-26 16:00:46 +01:00
Albert Vaca 3c93b2523e Added missing overrides found by clang-tidy 2016-10-29 17:07:10 +02:00
Albert Vaca c71f308252 Fixes suggested by Clazy 2016-10-29 16:33:05 +02:00
Albert Vaca dd126149d6 Use Qt to detect the paper type and name. 2016-10-29 16:33:05 +02:00
Aleix Pol ebeeac8d72 Set the version to 1.0
Remove redundant version.h file in favor of the ecm-generated.
Use minor version from KDE_APPLICATIONS_VERSION_*

Reviewed by Albert Astals
2016-10-29 12:42:59 +02:00
Albert Astals Cid 62eea3336b Merge remote-tracking branch 'origin/master' into frameworks 2016-10-29 11:13:24 +02:00
Albert Astals Cid f943f9ee8b Remove the !this checks
It's not part of the standard and GCC recently removed support for it

Looking at the code it seems we only need one external check, let's hope i'm right :D
2016-10-17 13:02:49 +02:00
Albert Astals Cid 75c387c62c increase version in master 2016-10-07 01:00:49 +02:00
Albert Astals Cid 7003eff75e Increase version
We had the cbr fix

GIT_SILENT
2016-10-07 00:59:46 +02:00
Albert Astals Cid 744a6901d6 Increase version
Meh i forgot to update it for .0

GIT_SILENT
2016-08-23 00:22:33 +02:00
Olivier CHURLAUD 411bdee0eb Open relative path again
REVIEW: 128507
2016-08-03 16:01:30 +02:00
Martin T. H. Sandsmark f87a306ec1 Fix warning about incompatible pointers in synctex parser 2016-07-24 22:30:39 +02:00
Martin T. H. Sandsmark d2f4f1c2d7 Remove outdated compiler message 2016-07-24 22:11:46 +02:00
Martin T. H. Sandsmark a6ec5ea9de Fix parsing of lilypond URLs 2016-07-24 20:27:04 +02:00
Albert Astals Cid ea607664d2 Beta version for KDE Applications 16.08 2016-07-21 23:46:24 +02:00
Olivier CHURLAUD 33122dd825 Uncomment printing option pdf2ps 2016-07-21 20:33:04 +02:00
Olivier CHURLAUD dd8fa351ce Fonts are scanned again by poppler5
Fonts are filtered as well to only appear once.

REVIEW: 128441
2016-07-13 23:46:43 +02:00
Olivier CHURLAUD ec0b68a756 Update deprecated KArchive method + remove unused variable in
generator_pdf

Reviewer: sandsmark
2016-07-13 21:00:35 +02:00
Martin T. H. Sandsmark 89e5f17542 Improve matching of generators
Instead of trying to use the plain text generator for everything, try to
find a more specialized one first.

BUG: 323213
2016-07-13 03:23:09 +02:00
Martin T. H. Sandsmark 3985577c90 Unbreak fetching of supporting generators 2016-07-13 02:27:55 +02:00
Martin T. H. Sandsmark f0323c26d0 Fix duplicate mimetype elimination 2016-07-13 01:57:26 +02:00
Martin T. H. Sandsmark d5bdca64d2 Fix low hanging unused parameters warnings 2016-07-11 22:57:11 +02:00
Martin T. H. Sandsmark 25a1915daf Fix source file encoding 2016-07-11 22:45:39 +02:00
Martin T. H. Sandsmark d29ec08007 remove invalid null pointer checks 2016-07-11 22:29:20 +02: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
Martin T. H. Sandsmark 439ced872d Port away from signal/slot keyword
When building okular without kdelibs4support it apparently builds with
-DQT_NO_SIGNALS_SLOTS_KEYWORDS.
2016-07-11 19:34:08 +02:00
Aleix Pol 32b62e919a Remove most KDELibs4Support linking
Ports away from KFileDialog.
Stops linking to KDELibs4Support from objects that don't need it.

REVIEW: 127021
2016-05-31 00:13:36 +02:00
Albert Astals Cid 445b9f383d Increase version for KDE Applications 16.04
GIT_SILENT
2016-04-13 22:08:21 +02:00
Albert Astals Cid 852e9586d1 Increase version for KDE Applications 16.04 RC 2016-04-06 23:03:56 +02:00
Krzysztof Pyrkosz 14c936ea1b Fix for CUPS printing
Okular was checking for Q_WS_X11 definition (which is not available since Qt 5) to detect CUPS, so detection always fails making CUPS parameters ignored.

REVIEW: 127036
2016-02-16 01:27:29 +01:00
Aleix Pol a704fbce94 Fix porting QUrl issues
Reviewed by Albert Astals
2016-01-30 20:00:25 +01:00
Aleix Pol f42a3bad65 Drop libkscreen dependency
Drops the x11 fallback. We were falling back to QX11Extras that were in
fact using QScreen internally.
Also remove the QDesktopWidget fallbacks for the same reason.
Drops some API for fetching the dpi and unifies it with ::realDpi(QWidget).

Based on Sebas's patch.
Reviewed by Albert.

REVIEW: 126913
2016-01-30 18:15:07 +01:00
Alex Richardson 1b2de0d1d0 Fix mainshelltest (and as a side-effect docdata saving)
Try fixing mainshelltest: one more passes now

QUrl is not automatically exposed to DBus so the DBus call would fail.
Changed the parameter to QString instead so that DBus invocation works.

mainshelltest: set QStandardPaths to test mode

Parse command line flags with a single dash as a long option

Unlike KCmdLineArgs QCommandLineParser treats options starting with a
single minus as multiple short options by default.

Previously okular -unique would fail with the following error:
Unknown options: u, n, i, q, u, e.

Also changed mainshelltest to use two dashes in case this behaviour
should change in the future.

mainshelltest failures have been reduced from 15 to 4 by this commit.

Fix docdata saving and added a warning message if it fails

If the ~/.local/okular/docdata directory didn't exist previously
creating the docdata file would fail as there are missing paths.

It seems that KStandardDirs used to create the okular/docdata directory
automatically, with QStandardPaths we have to create it manually.

mainshelltest is down to one failed test now

Fix final test case in mainshelltest

as we call QProcess::terminate the exit code will not be 0

REVIEW: 126192
2016-01-30 17:31:57 +01:00
Alex Richardson 2f9246ae42 Port to new JSON plugin loading system
This means Okular can now work without ksycoca and KDELibs4Support.

REVIEW: 126193
2016-01-04 15:59:07 +01:00
Albert Astals Cid fd203820f7 Increase version for master 2015-11-18 00:35:59 +01:00
Albert Astals Cid 50b70c51de Increase version for beta 2015-11-18 00:34:57 +01:00
Montel Laurent 466eb79615 Use QStringLiteral 2015-10-29 13:37:11 +01:00
Montel Laurent 8805760ccf Merge remote-tracking branch 'origin/master' into frameworks 2015-10-29 13:24:05 +01:00
Albert Astals Cid c743eceb3d Optimize all those SettingsCore::paperColor().rgb() calls
Maybe the compiler can do it, but i can do it as well :D
2015-10-21 00:07:35 +02:00
Lauri Lyly 9d7533d28e Fix trimming margins when paperColor not white
REVIEW: 125721
2015-10-21 00:05:37 +02:00
Albert Astals Cid 8445660539 Merge remote-tracking branch 'origin/master' into frameworks 2015-10-18 22:29:00 +02:00
Gleb Popov b8d22401f2 Implement qHash() for Okular::NormalizedRect. 2015-10-17 15:10:16 +03:00
Arseniy Lartsev 76c1e944a8 Support for non-integer transition durations in PDF presentations
REVIEW: 125329
2015-10-15 00:16:55 +02:00
Arseniy Lartsev e9e5cb6317 Repeat videos in PDFs automatically when needed
REVIEW: 125341
BUGS: 353171
2015-09-26 17:30:04 +02:00
Albert Astals Cid d52a07c9d2 Merge remote-tracking branch 'origin/gsoc2015_layer_feature' 2015-09-16 22:54:42 +02:00
Albert Astals Cid 1cd101b480 Small cleanup of the layer support feature
Tab replacing, function naming, include removal, @since addition, etc
2015-09-15 01:38:09 +02:00