Commit graph

40 commits

Author SHA1 Message Date
Sune Vuorela d211a6a9e9 More cppcheck fixes 2024-06-26 12:48:44 +00:00
Volker Krause 50d0703ae0 Enable readability-braces-around-statements 2022-03-09 23:29:56 +01:00
Albert Astals Cid 8a36e7350d Make Utils::realDpi work on QWindow not on QWidget
Small step towards the goal of okularcore not linking to QWidgets
2022-01-27 19:25:30 +01:00
Albert Astals Cid a2576dc746 Act on core/ TODOs that are not binary compatible
I'm going to need to break binary compatibility to add a new feature
so may as well cleanup all the TODOs regarding that

Changes:
 * Moving a few destructors to the header
 * Removing a few unnecessary & in params
 * Adding a few necessary & in params
 * Making print return an enum instead of a bool and then having another
   function that returns the enum
 * Make Generator::requestFontData be a virtual
 * Remove unused enum
 * Remove a few filePrinter unneeded functions
 * Remove unused TextDocumentGenerator::addMetaData signal
2021-12-29 09:35:25 +00:00
Albert Astals Cid 2002f4e7e9 Relax the check for non square DPI
BUGS: 444168
2021-10-22 22:23:49 +00:00
Alexander Lohnau 2f193a63de Convert license headers to SPDX 2021-06-10 08:11:56 +00:00
David Hurka 93e67cca93 Port away from QDesktopWidget
This ports Shell from QDesktopWidget to QScreen (trivial),
and removes unused QDesktopWidget includes (super-trivial).
2020-08-05 23:24:36 +00: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 93540ac16d Enable most of clazy level2 2020-02-21 14:57:48 +01:00
Yuri Chornoivan c04ca1fa96 Fix minor EBN issues 2018-08-31 12:23:45 +03:00
Sergio Bragin 54c741844b Fix realDpi function for Mac
Summary:
Removes old Utils::realDpi function for Mac. The old code employs functions
CGDisplayCurrentMode and CGDisplayIOServicePort, which are deprecated as
of versions 10.6 and 10.9, respectively. Now Mac uses the same code, as
Linux does, since it works out of the box.

This commit automatically fixes the long-standing bug of having an
implementation of realDpiX() and realDpiY(), which are not declared in
the utils.h file.

Reviewers: #okular, rjvbb

Reviewed By: rjvbb

Subscribers: rjvbb, cullmann, aacid, kde-mac, ltoscano, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D10415
2018-02-18 19:24:19 +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
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
Arnold Dumas d852a7bee0 Use new Q_OS_* macros. 2014-10-06 20:02:48 +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
Frederik Gladhorn 34fbdf8c85 Some more kDebug->qDebug 2014-09-09 18:17:36 +02:00
Albert Astals Cid 39de55eebf If the dpi calculations don't give a reasonably square pixel fallback to other methods
BUGS: 336018
FIXED-IN: 4.14.0
2014-07-20 22:30:49 +02:00
Albert Astals Cid 5002b26ed3 Some more debug 2014-07-17 01:54:54 +02:00
Vadim Zhukov 846e746aa3 Fix compilation on OpenBSD/i386
REVIEW: 118950
2014-07-10 22:37:30 +02:00
Albert Astals Cid 48b711002e Some more debug around this dpi stuff 2014-05-15 20:18:22 +02:00
Eugene Shalygin 88725241b8 Make sure edid and xrand sizes match before using them to calculate DPI
BUGS: 333456
2014-05-02 00:41:06 +02:00
Albert Astals Cid 9252044c0c KScreen::Config::current can return null 2014-05-01 13:27:19 +02:00
Albert Astals Cid a7f3a1ac37 Protect us against broken drivers/screens
Some drivers screens return 0x0 as their screen size so we can't use it
to calculate the dpi

BUGS: 332746
BUGS: 332494
FIXED-IN: 4.13.0
2014-04-02 23:43:38 +01:00
Albert Astals Cid 444f66ac29 Some more output that can be of help 2014-03-31 02:00:09 +02:00
Albert Astals Cid 8814a6fa3d Do not crash if we don't pass down a widget to show on 2014-01-13 01:47:31 +01:00
Eugene Shalygin ed35594627 Use DPI of current screen for PDF rendering
Includes some fixes from Albert:
 * kscreen cmake fixes
   Don't make libkscreen mandatory, give the proper version we need
 * Fix the @since
 * Kill Resolution and use a QSizeF
   I first thought QSizeF didn't make sense, but well what's a dpi if not a number of pixels in width and some others in height?
 * Remove unwanted const
 * Remove unneeded utils.h includes
 * Fix comments on realDPIXY()
 * Make it compile in non X11

REVIEW: 111829
2014-01-13 01:37:56 +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
Pino Toscano 399f64beef Introduce realDpi{X,Y}(), that (on X11) can return the ral DPI values w/o any Xrdb setting.
Otherwise, they return the same as dpi{X,Y}().

svn path=/trunk/KDE/kdegraphics/okular/; revision=979128
2009-06-09 00:45:02 +00:00
Pino Toscano cd6f369fc1 add an internal function to "pump" to the content of a QIODevice to another one
svn path=/trunk/KDE/kdegraphics/okular/; revision=884563
2008-11-15 12:33:05 +00:00
Pino Toscano 9731d3f866 add simple method for white borders detection, patch by by kde2eran@tromer.org, thanks!
CCMAIL: kde2eran@tromer.org

svn path=/trunk/KDE/kdegraphics/okular/; revision=809465
2008-05-18 23:03:17 +00:00
Christian Ehrlicher c5c2da7c89 fix win32 compilation
warnings--

svn path=/trunk/playground/graphics/okular/; revision=643874
2007-03-18 17:14:36 +00:00
Tobias Koenig 57139e3192 API cleanup (utils.h), renamed getDpiX -> dpiX() and getDpiY -> dpiY()
svn path=/trunk/playground/graphics/okular/; revision=608236
2006-11-27 08:13:47 +00:00
Pino Toscano cdf6d44742 forward declaration & apidox fixing
svn path=/trunk/playground/graphics/okular/; revision=600104
2006-10-29 15:21:03 +00:00
Holger Freyther 569e93b929 oKular: Add method(s) to get the DPI of the primary screen
some generators use QX11Info to get the DPI of the display.
    Obviously this is not portable, add a getDpi? method to utils
    which can be used by generators.
    Currently only the DVI converter is converted.
    The CMakeLists.txt change assumes that non existing variables
    gets expanded to empty strings.

svn path=/trunk/playground/graphics/okular/; revision=600099
2006-10-29 15:08:18 +00:00
Tobias Koenig df7d144c10 Moved all classes in core/ into the 'Okular' namespace and removed
nearly all references to kpdf (knewstuff still missing).

svn path=/trunk/playground/graphics/okular/; revision=586993
2006-09-21 08:45:36 +00:00
Pino Toscano 0a9a730f9d const
svn path=/trunk/playground/graphics/okular/; revision=556728
2006-07-01 12:47:48 +00:00
Pino Toscano bca4b9eb77 Create a okularUtils namespace with utility functions for generators (and maybe not only for them).
svn path=/trunk/playground/graphics/okular/; revision=556608
2006-06-30 21:42:41 +00:00