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.
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.
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.
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
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.
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.
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
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.