Commit Graph

3383 Commits

Author SHA1 Message Date
f48201fb91 Initialize fields to nullptr 2022-01-19 21:12:37 +01:00
2d741140e6 Add nullptr check 2022-01-19 21:12:26 +01:00
4bb227aff2 Fix trace message 2022-01-19 21:12:00 +01:00
1b54a407b8 Move common initialization code to the parent class 2022-01-19 19:16:27 +01:00
ab927d791b Avoid code duplication 2022-01-19 18:30:38 +01:00
a6a812d8e5 Update CHANGELOG 2022-01-19 18:29:40 +01:00
8d0beee195 Use parent instead of id 2022-01-19 18:29:09 +01:00
24ad06e839 Remove icon 2022-01-19 18:28:49 +01:00
d73a9a2207 Move DropShadow block 2022-01-19 18:28:38 +01:00
26b4a85928 Rename id 2022-01-19 18:27:22 +01:00
6892a28d0a Check for undefined and null values in QML
Conditional chaining is not available in Qt5.15, so this is uglier than it should be.
2022-01-19 18:24:29 +01:00
68dbd90413 Update listeners definitions 2022-01-19 18:22:04 +01:00
1a25fd0740 Update listeners definitions 2022-01-19 18:20:05 +01:00
f3e08a04d7 Add some initial values for context variables 2022-01-19 18:17:53 +01:00
27383da945 Configure the initial size of the covers 2022-01-19 18:17:04 +01:00
59ae6c5e51 Extract method 2022-01-19 18:16:13 +01:00
2ae9b83bbf Make sure that opengl is used
QQuickWidget requires opengl.
2022-01-19 18:15:36 +01:00
b841aff4a3 Wrap booleans in QVariant when updating the qml context 2022-01-19 18:14:29 +01:00
768d7ee73c Set initial dummy values for some context references 2022-01-19 18:13:20 +01:00
e80f5a9f64 Move common initialization to the parent class 2022-01-19 18:12:40 +01:00
c948ee70cb Add some system info to the help/about dialog
I'll see what other info can be useful.
2022-01-16 11:19:19 +01:00
be684514e3 Merge pull request #189 from vedgy/enable-shortcuts-in-other-layouts
Fix keyboard shortcuts with alternative layouts; always limit Magnifying glass height; clean up related code
2022-01-16 11:18:24 +01:00
662b5c99fd Don't leak "orphan" actions at exit
The original reason to orphan these actions is likely obsolete now.

Extract MainWindowViewer::addActionWithShortcut() to reduce code
duplication.
2022-01-15 18:02:31 +02:00
482c19b358 Allow triggering Open latest comic action when the toolbar is hidden
This action is added to the toolbar but not to the viewer. Thus it
cannot be triggered when the toolbar is hidden. Adding it to
MainWindowViewer makes it available at all times.
2022-01-15 18:02:31 +02:00
24e42f76d2 Make Magnifying glass shortcuts work with non-Latin layouts
Viewer::keyPressEvent()'s and MagnifyingGlass::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.

The Magnifying glass actions are now enabled/disabled when
loadedComicActions are enabled/disabled - for the same reason (see the
recent "Reader: make 12 keyboard shortcuts work with non-Latin layouts"
commit). In addition, Viewer::keyPressEvent() propagated the Magnifying
glass shortcuts to MagnifyingGlass only when it was visible. Therefore
showing/hiding Magnifying glass also enables/disables these actions.
Note that Viewer::showMagnifyingGlass() shows Magnifying glass only if
render->hasLoadedComic() returns true, so
MainWindowViewer::setMglassActionsEnabled slot can be connected directly
to Viewer::magnifyingGlassVisibilityChanged signal without checking this
condition again.
2022-01-15 18:02:31 +02:00
5254e66da3 Fix a typo in Viewer::magnifyingGlassShowed name
Make Viewer::magnifyingGlassIsVisible() const.
2022-01-15 18:02:30 +02:00
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
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
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
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
0fad89dc03 Simplify code that disables previous/next comic actions 2022-01-15 18:02:30 +02:00
f030a7fb0c Remove deprecated and always disabled alwaysOnTopAction 2022-01-15 18:02:30 +02:00
b3c99823eb MainWindowViewer::createActions(): deduplicate setDisabled 2022-01-15 18:02:30 +02:00
3bb475b47a MainWindowViewer: deduplicate enabling/disabling actions 2022-01-15 18:02:30 +02:00
feaee915bc Extract Viewer::(vertical|horizontal)ScrollStep() 2022-01-15 18:02:30 +02:00
133b547e7a Remove unused *Step* data members from Viewer 2022-01-15 18:02:30 +02:00
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
77c96de0ea Remove unused resources 2022-01-15 15:51:59 +01:00
e452178adb Log the device pixel ratio used while rendering 2022-01-15 11:54:40 +01:00
08021ba9a8 Take care of QToolButton not handling hdpi properly 2022-01-15 11:32:32 +01:00
565bc3a5d0 Replace all uses of devicePixelRatio with devicePixelRatioF 2022-01-14 19:22:50 +01:00
380aea2a66 Enable Qt::HighDpiScaleFactorRoundingPolicy::PassThrough 2022-01-14 19:21:43 +01:00
e532fa4439 Use devicePixelRatioF instead of devicePixelRatio when rendering pages 2022-01-13 23:12:05 +01:00
c414761be7 Update CHANGELOG 2022-01-13 23:06:39 +01:00
fce1f163aa Check that double click is done using the left button before toggling full-screen mode 2022-01-13 23:06:24 +01:00
d20958c14f Make forward and backward mouse buttons turn pages 2022-01-13 23:05:49 +01:00
dcb7e6e0c6 Add settings to control the page turn behavior on scroll 2022-01-13 23:04:22 +01:00
a1e0340b3d Fix some warnings 2021-12-29 17:58:40 +01:00
d8f224645d Remove YACReader::SearchModifiers
They are no longer used
2021-12-29 14:58:03 +01:00
1cf4ef97ea Merge pull request #215 from vedgy/exit-search-mode-before-creating-folder
Library: exit search mode before creating a folder
2021-12-29 12:48:42 +01:00