Commit graph

546 commits

Author SHA1 Message Date
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 1d2dd42c67 no need for & here 2017-03-02 22:45:45 +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 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
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
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 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
Albert Astals Cid 62eea3336b Merge remote-tracking branch 'origin/master' into frameworks 2016-10-29 11:13:24 +02:00
Olivier CHURLAUD 411bdee0eb Open relative path again
REVIEW: 128507
2016-08-03 16:01:30 +02:00
Martin T. H. Sandsmark d2f4f1c2d7 Remove outdated compiler message 2016-07-24 22:11:46 +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 f05d42eac3 core: Fix build without implicit cast to/from ascii
See previous commits for details.
2016-07-11 22:07:57 +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
Aleix Pol a704fbce94 Fix porting QUrl issues
Reviewed by Albert Astals
2016-01-30 20:00:25 +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
Montel Laurent 466eb79615 Use QStringLiteral 2015-10-29 13:37:11 +01:00
Albert Astals Cid 8445660539 Merge remote-tracking branch 'origin/master' into frameworks 2015-10-18 22:29:00 +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
Montel Laurent 2f95249a58 Merge remote-tracking branch 'origin/master' into frameworks 2015-08-16 10:52:13 +02:00
Alex Richardson 22b6d4551d Remove copy of qpagesize.cpp
No longer needed with Qt5
2015-08-15 19:28:06 +01:00
Albert Astals Cid 29b2b92d02 Merge remote-tracking branch 'origin/Applications/15.08' 2015-08-12 22:43:26 +02:00
Tobias Koenig b683889c3a Fix play back of video with rendition link
Process the operations of the rendition link independently of whether
there is a JS script or not. Most of the time the JS script won't be
executed correctly anyway, since Okular is missing most of the JS API,
so we should fall back on the given operations.

BUGS: 324167
FIXED-IN: KDE Applications 15.08.0
2015-08-12 22:42:00 +02:00
Montel Laurent 49ce3fc4d2 Merge remote-tracking branch 'origin/master' into frameworks
Conflicts:
	core/version.h
2015-08-03 09:44:50 +02:00
David Faure 94b95d8fda Print out better error message if a plugin can't be loaded.
(turns out that poppler installs into lib/ rather than lib64/)
2015-07-31 12:15:09 +02:00
Albert Astals Cid f063b94be3 More TODOs 2015-07-30 12:57:51 +02:00
Albert Astals Cid 1de97322e7 Bring QPageSize from Qt5
Allows us to not use a dummy printer for knowing page size
Which is nice since it won't block because Qt4 QPrinter is a bit weird sometimes

BUGS: 334708
FIXED-IN: KDE Applications 15.08
2015-07-30 12:47:22 +02:00
Albert Astals Cid dafd8f6972 Bring QPageSize from Qt5
Allows us to not use a dummy printer for knowing page size
Which is nice since it won't block because Qt4 QPrinter is a bit weird sometimes

BUGS: 334708
FIXED-IN: KDE Applications 15.08
2015-07-30 12:45:55 +02:00
Albert Astals Cid 1da3c424d1 Allow for the deletion of Caret annotations
Seems poppler just renders them fine, so we set them to externally rendered and allow annotation
FIXED-IN: KDE Applications 15.08
BUGS: 350740
2015-07-30 10:49:00 +02:00
Michel Ludwig f98eb936d5 Fix url creation in 'Document::processSourceReference'
This commit fixes the error message "<url> is not a local file" when processing
source references. 'giveAbsolutePath(QString)' returns a local file name, so we
create the corresponding url using 'QUrl::fromLocalFile'.
2015-07-21 21:29:14 +02:00
Jan Kundrát abd30fb774 s/auto_ptr/unique_ptr/
The old auto_ptr was used for simple RAII. None of the auto_ptr flaws
were apparent in that context, but given that that class is actively
deprecated and that compilers warn about its use, it's better to switch
to its drop-in replacement.

My reason for not using QScopedPointer is that the C++11 version works
well enough, Okular is being built in C++11 mode anyway, unique_ptr
works on the KF5-minimal-mandated-compilers according to their docs, and
therefore there's no point in using something with a different API
(QScopedPointer) just because its name begins with a Q.

REVIEW: 124027
2015-07-20 16:14:01 +02:00
Saheb Preet Singh 19e4a9abd6 refreshing pixmaps in the correct order 2015-07-12 21:22:33 +05:30
Albert Astals Cid 3e77904f31 Compile++ 2015-07-10 00:15:40 +02:00
Albert Astals Cid b088001a7c Increase the per request limit from ~80M to ~800M
Unless you're in greedy mode that we won't protect you from yourself :D
CCMAIL: 349863
2015-07-10 00:04:42 +02:00
Saheb Preet Singh bf673495fb added layers on the left sidebar 2015-05-27 19:26:56 +05:30
Alex Richardson c2fc0199b8 Use KPluginFactory::createInstance<Okular::Generator>()
Now that all generators have the necessary Q_INTERFACES() it works again
This restores the behaviour from before commit e4a4d400c3

REVIEW: 123466
2015-05-22 16:33:09 +01:00
Montel Laurent 04943508cf Merge remote-tracking branch 'origin/master' into frameworks
Conflicts:
	core/document.cpp
	core/version.h
2015-03-04 07:55:32 +01:00