Add shortcuts to control the double page mode offset

This commit is contained in:
Luis Ángel San Martín 2023-07-09 10:44:43 +02:00
parent a77a704d48
commit f3249e4053
5 changed files with 44 additions and 1 deletions

View File

@ -1252,6 +1252,11 @@ void MainWindowViewer::setUpShortcutsManagement()
auto *const goToLastPageAction = addActionWithShortcut(tr("Go to the last page"), GO_TO_LAST_PAGE_ACTION_Y);
connect(goToLastPageAction, &QAction::triggered, viewer, &Viewer::goToLastPage);
auto *const offsetDoublePageToTheLeft = addActionWithShortcut(tr("Offset double page to the left"), OFFSET_DOUBLE_PAGE_TO_THE_LEFT_Y);
connect(offsetDoublePageToTheLeft, &QAction::triggered, viewer, &Viewer::offsetDoublePageToTheLeft);
auto *const offsetDoublePageToTheRight = addActionWithShortcut(tr("Offset double page to the right"), OFFSET_DOUBLE_PAGE_TO_THE_RIGHT_Y);
connect(offsetDoublePageToTheRight, &QAction::triggered, viewer, &Viewer::offsetDoublePageToTheRight);
loadedComicActions = { autoScrollForwardAction,
autoScrollBackwardAction,
autoScrollForwardHorizontalFirstAction,
@ -1263,7 +1268,9 @@ void MainWindowViewer::setUpShortcutsManagement()
moveLeftAction,
moveRightAction,
goToFirstPageAction,
goToLastPageAction };
goToLastPageAction,
offsetDoublePageToTheLeft,
offsetDoublePageToTheRight };
editShortcutsDialog->addActionsGroup(tr("Reading"), QIcon(":/images/shortcuts_group_reading.svg"),
tmpList = QList<QAction *>()

View File

@ -1083,6 +1083,36 @@ void Viewer::setBookmarks()
bd->setBookmarks(*render->getBookmarks());
}
void Viewer::offsetDoublePageToTheLeft()
{
if (!doublePage) {
return;
}
if (doubleMangaPage) {
render->previousPage();
} else {
render->nextPage();
}
updateInformation();
}
void Viewer::offsetDoublePageToTheRight()
{
if (!doublePage) {
return;
}
if (doubleMangaPage) {
render->nextPage();
} else {
render->previousPage();
}
updateInformation();
}
void Viewer::showIsCoverMessage()
{
if (!shouldOpenPrevious) {

View File

@ -101,6 +101,8 @@ public slots:
void showMessageErrorOpening(QString);
void processCRCError(QString message);
void setBookmarks();
void offsetDoublePageToTheLeft();
void offsetDoublePageToTheRight();
// deprecated
void updateImageOptions();
void updateFilters(int brightness, int contrast, int gamma);

View File

@ -69,6 +69,8 @@ void ShortcutsManager::initDefaultShorcuts()
defaultShorcuts.insert(MOVE_UP_ACTION_Y, Qt::Key_Up);
defaultShorcuts.insert(GO_TO_FIRST_PAGE_ACTION_Y, Qt::Key_Home);
defaultShorcuts.insert(GO_TO_LAST_PAGE_ACTION_Y, Qt::Key_End);
defaultShorcuts.insert(OFFSET_DOUBLE_PAGE_TO_THE_LEFT_Y, Qt::CTRL | Qt::SHIFT | Qt::Key_Left);
defaultShorcuts.insert(OFFSET_DOUBLE_PAGE_TO_THE_RIGHT_Y, Qt::CTRL | Qt::SHIFT | Qt::Key_Right);
// mglass
defaultShorcuts.insert(SIZE_UP_MGLASS_ACTION_Y, Qt::Key_Plus);
defaultShorcuts.insert(SIZE_DOWN_MGLASS_ACTION_Y, Qt::Key_Minus);

View File

@ -152,6 +152,8 @@ public:
#define MOVE_RIGHT_ACTION_Y "MOVE_RIGHT_ACTION_Y"
#define GO_TO_FIRST_PAGE_ACTION_Y "GO_TO_FIRST_PAGE_ACTION_Y"
#define GO_TO_LAST_PAGE_ACTION_Y "GO_TO_LAST_PAGE_ACTION_Y"
#define OFFSET_DOUBLE_PAGE_TO_THE_LEFT_Y "OFFSET_DOUBLE_PAGE_TO_THE_LEFT_Y"
#define OFFSET_DOUBLE_PAGE_TO_THE_RIGHT_Y "OFFSET_DOUBLE_PAGE_TO_THE_RIGHT_Y"
// mglass
#define SIZE_UP_MGLASS_ACTION_Y "SIZE_UP_MGLASS_ACTION_Y"
#define SIZE_DOWN_MGLASS_ACTION_Y "SIZE_DOWN_MGLASS_ACTION_Y"