Commit Graph

232 Commits

Author SHA1 Message Date
Igor Kushnir
c8697ccd2d Always limit Magnifying glass's height
MagnifyingGlass::sizeUp() and MagnifyingGlass::sizeDown() grow/shrink
both width and height, but check only width's limits. Thus the user can
first increase Magnifying glass's height, then increase its size and
make the height greater than the main window's height. The user can also
first increase the width, then decrease the size until the height
shrinks to 0 and Magnifying glass disappears.

When Magnifying glass disappears, the only way to make it visible again
is to restore its default size by restarting YACReader, because the
invisible MagnifyingGlass widget does not receive wheel events and
Viewer::keyPressEvent() propagates shortcuts to mglass only if it is
visible. And even this workaround is possible only because YACReader
does not save/restore Magnifying glass's size (should it?).

Always checking both width and height limits fixes the bug. If one of
the dimensions reaches a limit, only the other dimension is modified. If
both dimensions reach their limits, neither is modified.
2022-01-15 18:02:30 +02:00
Igor Kushnir
efe9a1b995 MagnifyingGlass: get rid of C-style casts to Viewer*
qobject_cast<const Viewer *> improves const correctness.
QLabel::pixmap() is const-qualified => make Viewer::pixmap() const too.

Return non-const QPixmap from Viewer::pixmap() to let compiler move the
return value at the function's call sites.

Introduce a named constant maxRelativeDimension. Change its type from
float to double, which usually multiplies faster on x86-64.

Remove redundant parentheses to improve readability.
2022-01-15 18:02:30 +02:00
Igor Kushnir
fdba938fe8 MagnifyingGlass: don't updateImage() needlessly
Not all possible keyboard modifiers of a wheel event change
MagnifyingGlass's pixmap. So in case of e.g. MetaModifier or more than
one modifier, MagnifyingGlass::wheelEvent() calls updateImage() to no
avail.

Move the updateImage() call into the public slots to make them
self-sufficient. This also allows not to call updateImage() when the
pixmap is not changed in case the adjusted parameter has reached its
minimum or maximum value already.
2022-01-15 18:02:30 +02:00
Igor Kushnir
a1bb7735d2 Reader: make 12 keyboard shortcuts work with non-Latin layouts
Viewer::keyPressEvent()'s custom matching of these shortcuts is the same
as MainWindowViewer::keyPressEvent()'s before the recent commit
"Reader: make 3 keyboard shortcuts work with non-Latin layouts". That
commit's message details the issues with the custom code.

render->hasLoadedComic() condition in Viewer::keyPressEvent() becomes
true when Comic::_loaded is set to true. This always happens right after
Comic emits its numPages() signal. That is why the 12 fixed actions are
now enabled when Viewer emits its comicLoaded() signal, which is
connected to Render::numPages, which in turn is connected to
Comic::numPages signal.

The 12 fixed actions are now disabled when most other actions are
disabled: before a comic is opened and on comic opening error.
2022-01-15 18:02:30 +02:00
Igor Kushnir
0fad89dc03 Simplify code that disables previous/next comic actions 2022-01-15 18:02:30 +02:00
Igor Kushnir
f030a7fb0c Remove deprecated and always disabled alwaysOnTopAction 2022-01-15 18:02:30 +02:00
Igor Kushnir
b3c99823eb MainWindowViewer::createActions(): deduplicate setDisabled 2022-01-15 18:02:30 +02:00
Igor Kushnir
3bb475b47a MainWindowViewer: deduplicate enabling/disabling actions 2022-01-15 18:02:30 +02:00
Igor Kushnir
feaee915bc Extract Viewer::(vertical|horizontal)ScrollStep() 2022-01-15 18:02:30 +02:00
Igor Kushnir
133b547e7a Remove unused *Step* data members from Viewer 2022-01-15 18:02:30 +02:00
Igor Kushnir
88e0f5513a Reader: make 3 keyboard shortcuts work with non-Latin layouts
MainWindowViewer::keyPressEvent()'s custom matching of these shortcuts
does not leverage all the features of standard Qt shortcut matching. As
a result, the corresponding actions cannot be triggered when their
assigned shortcuts consist of a single Latin letter without modifiers
and e.g. Ukrainian keyboard layout is active.

Furthermore, some key presses (e.g. Scroll Lock in my customized
keyboard layout) set QKeyEvent::key() to 0, which the custom matching
considers equal to an unassigned shortcut. So an action without shortcut
is triggered by such a key press.

Adding these 3 actions to MainWindowViewer and connecting the
corresponding slots to their triggered() signals allows to remove the
custom matching code and thus eliminates both of its issues.
2022-01-15 18:02:30 +02:00
Luis Ángel San Martín
77c96de0ea Remove unused resources 2022-01-15 15:51:59 +01:00
Luis Ángel San Martín
e452178adb Log the device pixel ratio used while rendering 2022-01-15 11:54:40 +01:00
Luis Ángel San Martín
565bc3a5d0 Replace all uses of devicePixelRatio with devicePixelRatioF 2022-01-14 19:22:50 +01:00
Luis Ángel San Martín
380aea2a66 Enable Qt::HighDpiScaleFactorRoundingPolicy::PassThrough 2022-01-14 19:21:43 +01:00
Luis Ángel San Martín
e532fa4439 Use devicePixelRatioF instead of devicePixelRatio when rendering pages 2022-01-13 23:12:05 +01:00
Luis Ángel San Martín
fce1f163aa Check that double click is done using the left button before toggling full-screen mode 2022-01-13 23:06:24 +01:00
Luis Ángel San Martín
d20958c14f Make forward and backward mouse buttons turn pages 2022-01-13 23:05:49 +01:00
Luis Ángel San Martín
dcb7e6e0c6 Add settings to control the page turn behavior on scroll 2022-01-13 23:04:22 +01:00
Igor Kushnir
b0b0849cbc Extract DEFINES += NOMINMAX into common config.pri 2021-12-29 09:36:44 +01:00
spinningthelock
5971aacda0
Enable using integrated GPU in Dual GPU Macs
Currently YACReader will default to higher-end discrete GPU for OpenGL calls. This increases the battery usage while having no need for such high performance. This Flag tells MacOS to switching to integrated GPU is oky in this app. 

References:
https://developer.apple.com/library/archive/qa/qa1734/_index.html
https://developer.apple.com/documentation/bundleresources/information_property_list/nssupportsautomaticgraphicsswitching?language=objc
2021-12-25 11:30:04 -05:00
Joan Karadimov
6aeed9ae90 Include some missing headers 2021-11-02 11:02:32 +01:00
Joan Karadimov
1c3fd4d16f Do not pass MSVC arguments to mingw/gcc 2021-11-02 11:02:32 +01:00
Luis Ángel San Martín
4bee296096 Strict qt5.15 breaks poppler 2021-10-23 17:11:50 +02:00
Luis Ángel San Martín
81ff663acd Use qt5.15 2021-10-19 00:00:09 +02:00
Luis Ángel San Martín
2cdd53c316 Replace forward declaration with import 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
e91481d0c3 Fix QMediaPlayer usage in Qt6 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
75060d4f24 Do not use QTextCodec in Qt6 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
a7e3c41f34 QLabel QPixmap *pixmap() method is deprecated
const QPixmap should perform as fast as a pointer
there is a replacement version for Qt5 but it requires Qt5.15, so we are using indirection witch is unsafer but it should be ok as all the action is happen in the main thread
2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
8207f75297 Replace setMargin with setContentsMargins 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
5e1e0b1d4a Add include 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
088ccdf094 Remove setMargin usage 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
09e85e48bf Remove unused include 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
100e1c40a1 Use QTransform instead of QMatrix 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
154f215c38 Use 4 args connect 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
567c00102d Use fully qualified names 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
f5035b4bac Use fully qualified names 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
d5e6623e33 Fix connections
signals can be chained and setCenter was an slot not a signal
2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
ae43f23c85 Use angleDelta
pixelDelta is only provided in systems that support it
2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
052e7ffba0 Add override annotation 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
740eab5025 Update QWheelEvent delta usage 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
1c144d950d Use fully qualified names 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
474689e24b Replace deprecated QPalette role 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
1012ec37c7 Use setContentsMargins instead of setMargin 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
2a90b1c6ef Stop using availableGeometry 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
2de4b26b71 Start supporting Qt6
Everything is broken but we want to start fixing as much as possible
2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
5f55dab0cc Do not write unused values 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
0a2f7bd2af Proper use of QString::arg 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
32b4e420a2 Fix emit calls 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
cc927de7de Use ints for colors instead of string literals 2021-10-19 00:00:07 +02:00
Luis Ángel San Martín
e1ed292a91 Convert emit(signal()) calls to emit signal() 2021-10-19 00:00:07 +02:00
Luis Ángel San Martín
5aa02a19bb clang-format 2021-10-18 21:56:52 +02:00
Luis Ángel San Martín
0dbad65f7f Don't use the wheel stop in full page mode 2021-09-28 16:21:43 +02:00
Luis Ángel San Martín
2717f755bb Fix signal name 2021-09-26 09:02:41 +02:00
Luis Ángel San Martín
b8ad2b540b
Merge branch 'develop' into clazy_autorefactoring 2021-09-26 08:52:23 +02:00
Luis Ángel San Martín
53f92ba1f6 Enable hdpi scaling 2021-09-13 17:34:15 +02:00
Felix Kauselmann
22c2431cc5 Render: Remove obsolete debug messages 2021-07-30 08:58:39 +02:00
Felix Kauselmann
abcb4b1f26 GoTo flow: Sync slide and page index in quick navigation mode 2021-07-30 08:58:39 +02:00
Felix Kauselmann
40d4d224be Viewer: Always start GoTo flow on correct page 2021-07-30 08:58:39 +02:00
Felix Kauselmann
df32cf01fb GoTo dialogs: Restrict input values to existing pages 2021-07-30 08:58:39 +02:00
Felix Kauselmann
54b9952253 YACReader: Show error when opening nonexistent open recent entry 2021-07-30 08:58:39 +02:00
Felix Kauselmann
5b66153390 YACReader/viewer: Convert a bunch of loosely related signals to new syntax 2021-06-29 13:53:12 +02:00
Felix Kauselmann
5dbbaad73b GoTo flows: Untangle and refactor goTo signal to new syntax 2021-06-29 13:53:12 +02:00
Felix Kauselmann
47324e7f22 Comic/Render: Use overloads refactor some SIGNAL/SLOT connections to new syntax 2021-06-29 13:53:12 +02:00
Felix Kauselmann
f813a018d2 Comic: Virtual prototype for process(), fix signal/slot 2021-06-29 13:53:12 +02:00
Felix Kauselmann
8377de7c3e Clazy: Use fixits to refactor some old style signal connections 2021-06-29 13:53:12 +02:00
Vítor Galvão
82a94113e1 macOS Info.plis: remove deprecated CFBundleGetInfoString 2021-06-26 00:39:05 +01:00
Luis Ángel San Martín
3683ace654 Remove message box used during development 2021-05-29 10:34:42 +02:00
Luis Ángel San Martín
4fc60c72aa Update YACReaderLibrary <-> YACReader communication to support reading lists 2021-05-27 18:56:31 +02:00
Ruoh-Shoei LIN
dbe1da58dc Update Simplified Chinese GUI translation for YACReader &
YACReaderLibrary
2021-05-09 11:55:52 +02:00
Igor Kushnir
497894c5bf Allow to configure Fit to page action shortcut in the UI 2021-03-11 11:14:24 +02:00
Igor Kushnir
3c9ed6ef8f Deprecated qSort => std::sort
This change gets rid of some GCC's -Wdeprecated-declarations warnings.
2021-03-09 21:32:23 +01:00
Felix Kauselmann
81b4d25b5c Remove unneeded QtOpenGL dependency
Qt OpenGL in Qt5 is a deprecated module that is discouraged for
new code usage. We have been including this module in our builds
despite not relying on its functionality for a long time now -
probably an oversight from porting to the newer functions.

Time to remove it.

IMPORTANT INFORMATION: In Qt6, a lot of functionality that was
provided by Qt GUI was moved into the 'new' Qt6 Qt OpenGL module.
Thus, even if it makes perfectly sense to remove it for Qt5 builds
we will likely have to restore it for Qt6 builds at a later time.
2021-03-09 18:26:01 +01:00
Felix Kauselmann
92be3addda Sync and update translation files
In the past, translation files provided by the community
mostly came as pregenerated .qm files missing the corresponding
.ts sources. This has led to a situation where the translations
are out of sync with the sources and the sources have not been
updated for several release iterations.

To improve the situation, this commit syncs all .qm files back to
the sources by using the lconvert tool to create .ts files and
updating these files against our sources using lupdate.

For future updates, a CI solution would be preferable.
2021-03-09 18:22:52 +01:00
Felix Kauselmann
a315021a22 Update qmake files 2021-03-09 18:22:52 +01:00
Felix Kauselmann
e5526de0af
Render: Protect against race condition in setNumPages (#220)
* Render: Use sendPostedEvents to force processing of queued events when removing old comic objects
2021-03-04 16:45:52 +01:00
Igor Kushnir
6f182b2bb3 Extract CONFIG += c++11 into common config.pri 2021-02-18 19:49:43 +01:00
Luis Ángel San Martín
74840f9914 Enable SVG explicitly 2021-01-22 10:48:13 +01:00
Luis Ángel San Martín
58fdf0af23 Add what's new dialog 2021-01-21 21:39:22 +01:00
Luis Ángel San Martín
dee557c518 Use a constant reference for passing QKeySequence to moveAction 2021-01-17 11:11:25 +01:00
Stefan Malewski
08ce8c3c65 Fixed move action shortcuts 2021-01-17 11:06:45 +01:00
Stefan Malewski
c73f28cca1 KeySequence passed by reference 2021-01-17 11:06:45 +01:00
Stefan Malewski
fccf9ab0af Fixed shortcuts for move actions 2021-01-17 11:06:45 +01:00
Luis Ángel San Martín
a911a4fc53 Update action names in macos menus 2021-01-16 18:45:47 +01:00
Luis Ángel San Martín
2a3f7668ba Rename method 2021-01-16 18:27:16 +01:00
Luis Ángel San Martín
d07de8fb2e Rename prev/next actions to reflect its positional behaviour 2021-01-16 14:59:37 +01:00
Luis Ángel San Martín
c7cf012d51 Remove commented code 2021-01-16 14:34:28 +01:00
Luis Ángel San Martín
611d4c5e26 Add support for detecting manga issues in YACReader
When an issues is open from YACReaderLibrary we can check if it is a manga an update the UI to enable manga reading.

This also fixes going previous/next from the ui/shortcuts
2021-01-16 14:29:00 +01:00
Heimen Stoffels
ccf1e4cb56 Updated Dutch translation 2020-10-01 11:56:35 +02:00
Luis Ángel San Martín
4739376f5b Use new methods 2020-09-07 18:13:55 +02:00
Luis Ángel San Martín
6738827798 Add methods to access ENLARGE_IMAGES setting 2020-09-07 18:13:43 +02:00
Felix Kauselmann
acce89ef78
Update viewer.cpp 2020-09-07 08:54:23 +02:00
Felix Kauselmann
5bb6ab276a Reader: Add option to show covers as single pages in double page mode 2020-09-03 15:32:45 +02:00
Felix Kauselmann
232181eef7 Reader: Add option to stop enlarging images in fit to width and height 2020-09-02 09:27:53 +02:00
Luis Ángel San Martín
a2b4b88801 Format 2020-08-31 16:04:26 +02:00
Igor Kushnir
0da59285cf Reader: fix QTimer-related memory leaks 2020-08-31 15:44:50 +02:00
Igor Kushnir
b0082101d3 Reader: don't forget comic info visibility
The timer used to time out and invoke Viewer::informationSwitch() twice
before getting destroyed. This caused the following bug:
    1. Press 'I' to Show Info in YACReader.
    2. Restart YACReader (exit and run again). Info is visible.
    3. Restart YACReader one more time. Info is hidden.

Apparently, when informationSwitch() was called a second time soon after
the first one, informationLabel didn't hide for some reason, but the
wrong value (false) was stored at the SHOW_INFO key in Configuration.
2020-08-31 15:44:50 +02:00
Felix Kauselmann
fc8c1080da Add a message handler
This ensures that Qt debug messages actually end up in our logfiles,
even if we didn't use QsLog to create them.
2020-08-20 17:41:56 +02:00
Felix Kauselmann
56e6f8fdcc Allow setting YACReader loglevel from console 2020-08-20 17:41:56 +02:00
Felix Kauselmann
ac4d2f4804 Fix QsLog integration in reader too. 2020-08-20 17:41:56 +02:00