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.
This commit is contained in:
Igor Kushnir
2021-03-06 18:48:25 +02:00
parent 0fad89dc03
commit a1bb7735d2
4 changed files with 73 additions and 78 deletions

View File

@ -148,6 +148,8 @@ private:
QAction *showEditShortcutsAction;
QList<QAction *> loadedComicActions;
YACReaderSlider *zoomSliderAction;
HttpVersionChecker *versionChecker;
@ -161,6 +163,7 @@ private:
void clearRecentFiles();
void getSiblingComics(QString path, QString currentComic);
void setActionsEnabled(bool enabled);
void setLoadedComicActionsEnabled(bool enabled);
//! Manejadores de evento:
// void resizeEvent(QResizeEvent * event);