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.
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.
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.
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.
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
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
Qt documentation recommends calling saveGeometry() in closeEvent().
This commit fixes the following bug on my GNU/Linux with Xfce system:
1. Move the top of the YACReader window to the top of the screen.
2. Restart YACReader (exit and run again).
2. Enter full screen mode.
4. Restart YACReader.
5. Exit full screen mode.
At this point YACReader's title bar is hidden beyond the top of the
screen, i.e. the window has moved up.
closeEvent is accepted by default, so this commit does not change the
application behavior. But Qt documentation recommends not relying on the
default value as subclasses may choose to clear it in their constructor.
signal is emitted so it is actually processed and we don't get dangling pointers.
Use modern signal slot syntax so that the compiler and source check tools can
verify we actually fixed the problem.