Rename prev/next actions to reflect its positional behaviour

This commit is contained in:
Luis Ángel San Martín
2021-01-16 14:59:37 +01:00
parent c7cf012d51
commit d07de8fb2e
2 changed files with 80 additions and 68 deletions

View File

@ -86,10 +86,10 @@ MainWindowViewer::~MainWindowViewer()
delete openFolderAction; delete openFolderAction;
delete openLatestComicAction; delete openLatestComicAction;
delete saveImageAction; delete saveImageAction;
delete openPreviousComicAction; delete openComicOnTheLeftAction;
delete openNextComicAction; delete openComicOnTheRightAction;
delete prevAction; delete goToPageOnTheLeftAction;
delete nextAction; delete goToPageOnTheRightAction;
delete adjustHeightAction; delete adjustHeightAction;
delete adjustWidthAction; delete adjustWidthAction;
delete leftRotationAction; delete leftRotationAction;
@ -259,39 +259,39 @@ void MainWindowViewer::createActions()
saveImageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SAVE_IMAGE_ACTION_Y)); saveImageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SAVE_IMAGE_ACTION_Y));
connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage())); connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage()));
openPreviousComicAction = new QAction(tr("Previous Comic"), this); openComicOnTheLeftAction = new QAction(tr("Previous Comic"), this);
openPreviousComicAction->setIcon(QIcon(":/images/viewer_toolbar/openPrevious.png")); openComicOnTheLeftAction->setIcon(QIcon(":/images/viewer_toolbar/openPrevious.png"));
openPreviousComicAction->setToolTip(tr("Open previous comic")); openComicOnTheLeftAction->setToolTip(tr("Open previous comic"));
openPreviousComicAction->setDisabled(true); openComicOnTheLeftAction->setDisabled(true);
openPreviousComicAction->setData(OPEN_PREVIOUS_COMIC_ACTION_Y); openComicOnTheLeftAction->setData(OPEN_PREVIOUS_COMIC_ACTION_Y);
openPreviousComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_PREVIOUS_COMIC_ACTION_Y)); openComicOnTheLeftAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_PREVIOUS_COMIC_ACTION_Y));
connect(openPreviousComicAction, &QAction::triggered, this, &MainWindowViewer::openLeftComic); connect(openComicOnTheLeftAction, &QAction::triggered, this, &MainWindowViewer::openLeftComic);
openNextComicAction = new QAction(tr("Next Comic"), this); openComicOnTheRightAction = new QAction(tr("Next Comic"), this);
openNextComicAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png")); openComicOnTheRightAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png"));
openNextComicAction->setToolTip(tr("Open next comic")); openComicOnTheRightAction->setToolTip(tr("Open next comic"));
openNextComicAction->setDisabled(true); openComicOnTheRightAction->setDisabled(true);
openNextComicAction->setData(OPEN_NEXT_COMIC_ACTION_Y); openComicOnTheRightAction->setData(OPEN_NEXT_COMIC_ACTION_Y);
openNextComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_NEXT_COMIC_ACTION_Y)); openComicOnTheRightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_NEXT_COMIC_ACTION_Y));
connect(openNextComicAction, &QAction::triggered, this, &MainWindowViewer::openRightComic); connect(openComicOnTheRightAction, &QAction::triggered, this, &MainWindowViewer::openRightComic);
prevAction = new QAction(tr("&Previous"), this); goToPageOnTheLeftAction = new QAction(tr("&Previous"), this);
prevAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png")); goToPageOnTheLeftAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png"));
prevAction->setShortcutContext(Qt::WidgetShortcut); goToPageOnTheLeftAction->setShortcutContext(Qt::WidgetShortcut);
prevAction->setToolTip(tr("Go to previous page")); goToPageOnTheLeftAction->setToolTip(tr("Go to previous page"));
prevAction->setDisabled(true); goToPageOnTheLeftAction->setDisabled(true);
prevAction->setData(PREV_ACTION_Y); goToPageOnTheLeftAction->setData(PREV_ACTION_Y);
prevAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(PREV_ACTION_Y)); goToPageOnTheLeftAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(PREV_ACTION_Y));
connect(prevAction, SIGNAL(triggered()), viewer, SLOT(left())); connect(goToPageOnTheLeftAction, SIGNAL(triggered()), viewer, SLOT(left()));
nextAction = new QAction(tr("&Next"), this); goToPageOnTheRightAction = new QAction(tr("&Next"), this);
nextAction->setIcon(QIcon(":/images/viewer_toolbar/next.png")); goToPageOnTheRightAction->setIcon(QIcon(":/images/viewer_toolbar/next.png"));
nextAction->setShortcutContext(Qt::WidgetShortcut); goToPageOnTheRightAction->setShortcutContext(Qt::WidgetShortcut);
nextAction->setToolTip(tr("Go to next page")); goToPageOnTheRightAction->setToolTip(tr("Go to next page"));
nextAction->setDisabled(true); goToPageOnTheRightAction->setDisabled(true);
nextAction->setData(NEXT_ACTION_Y); goToPageOnTheRightAction->setData(NEXT_ACTION_Y);
nextAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEXT_ACTION_Y)); goToPageOnTheRightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEXT_ACTION_Y));
connect(nextAction, SIGNAL(triggered()), viewer, SLOT(right())); connect(goToPageOnTheRightAction, SIGNAL(triggered()), viewer, SLOT(right()));
adjustHeightAction = new QAction(tr("Fit Height"), this); adjustHeightAction = new QAction(tr("Fit Height"), this);
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png")); adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
@ -553,13 +553,13 @@ void MainWindowViewer::createToolBars()
#endif #endif
comicToolBar->addAction(saveImageAction); comicToolBar->addAction(saveImageAction);
comicToolBar->addAction(openPreviousComicAction); comicToolBar->addAction(openComicOnTheLeftAction);
comicToolBar->addAction(openNextComicAction); comicToolBar->addAction(openComicOnTheRightAction);
comicToolBar->addSeparator(); comicToolBar->addSeparator();
comicToolBar->addAction(prevAction); comicToolBar->addAction(goToPageOnTheLeftAction);
comicToolBar->addAction(nextAction); comicToolBar->addAction(goToPageOnTheRightAction);
comicToolBar->addAction(goToPageAction); comicToolBar->addAction(goToPageAction);
comicToolBar->addSeparator(); comicToolBar->addSeparator();
@ -616,12 +616,12 @@ void MainWindowViewer::createToolBars()
viewer->addAction(openAction); viewer->addAction(openAction);
viewer->addAction(openFolderAction); viewer->addAction(openFolderAction);
viewer->addAction(saveImageAction); viewer->addAction(saveImageAction);
viewer->addAction(openPreviousComicAction); viewer->addAction(openComicOnTheLeftAction);
viewer->addAction(openNextComicAction); viewer->addAction(openComicOnTheRightAction);
YACReader::addSperator(viewer); YACReader::addSperator(viewer);
viewer->addAction(prevAction); viewer->addAction(goToPageOnTheLeftAction);
viewer->addAction(nextAction); viewer->addAction(goToPageOnTheRightAction);
viewer->addAction(goToPageAction); viewer->addAction(goToPageAction);
viewer->addAction(adjustHeightAction); viewer->addAction(adjustHeightAction);
viewer->addAction(adjustWidthAction); viewer->addAction(adjustWidthAction);
@ -969,8 +969,8 @@ void MainWindowViewer::saveImage()
void MainWindowViewer::enableActions() void MainWindowViewer::enableActions()
{ {
saveImageAction->setDisabled(false); saveImageAction->setDisabled(false);
prevAction->setDisabled(false); goToPageOnTheLeftAction->setDisabled(false);
nextAction->setDisabled(false); goToPageOnTheRightAction->setDisabled(false);
adjustHeightAction->setDisabled(false); adjustHeightAction->setDisabled(false);
adjustWidthAction->setDisabled(false); adjustWidthAction->setDisabled(false);
goToPageAction->setDisabled(false); goToPageAction->setDisabled(false);
@ -1001,8 +1001,8 @@ void MainWindowViewer::enableActions()
void MainWindowViewer::disableActions() void MainWindowViewer::disableActions()
{ {
saveImageAction->setDisabled(true); saveImageAction->setDisabled(true);
prevAction->setDisabled(true); goToPageOnTheLeftAction->setDisabled(true);
nextAction->setDisabled(true); goToPageOnTheRightAction->setDisabled(true);
adjustHeightAction->setDisabled(true); adjustHeightAction->setDisabled(true);
adjustWidthAction->setDisabled(true); adjustWidthAction->setDisabled(true);
goToPageAction->setDisabled(true); goToPageAction->setDisabled(true);
@ -1021,8 +1021,8 @@ void MainWindowViewer::disableActions()
setBookmarkAction->setDisabled(true); setBookmarkAction->setDisabled(true);
showBookmarksAction->setDisabled(true); showBookmarksAction->setDisabled(true);
showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
openPreviousComicAction->setDisabled(true); openComicOnTheLeftAction->setDisabled(true);
openNextComicAction->setDisabled(true); openComicOnTheRightAction->setDisabled(true);
showDictionaryAction->setDisabled(true); showDictionaryAction->setDisabled(true);
showFlowAction->setDisabled(true); showFlowAction->setDisabled(true);
} }
@ -1219,11 +1219,11 @@ void MainWindowViewer::processReset()
{ {
if (isClient) { if (isClient) {
if (siblingComics.count() > 1) { if (siblingComics.count() > 1) {
bool openNextB = openNextComicAction->isEnabled(); bool openNextB = openComicOnTheRightAction->isEnabled();
bool openPrevB = openPreviousComicAction->isEnabled(); bool openPrevB = openComicOnTheLeftAction->isEnabled();
disableActions(); disableActions();
openNextComicAction->setEnabled(openNextB); openComicOnTheRightAction->setEnabled(openNextB);
openPreviousComicAction->setEnabled(openPrevB); openComicOnTheLeftAction->setEnabled(openPrevB);
} else } else
disableActions(); disableActions();
} else } else
@ -1243,8 +1243,8 @@ void MainWindowViewer::setUpShortcutsManagement()
openLatestComicAction, openLatestComicAction,
openFolderAction, openFolderAction,
saveImageAction, saveImageAction,
openPreviousComicAction, openComicOnTheLeftAction,
openNextComicAction }); openComicOnTheRightAction });
allActions << tmpList; allActions << tmpList;
@ -1374,8 +1374,8 @@ void MainWindowViewer::setUpShortcutsManagement()
editShortcutsDialog->addActionsGroup(tr("Reading"), QIcon(":/images/shortcuts_group_reading.png"), editShortcutsDialog->addActionsGroup(tr("Reading"), QIcon(":/images/shortcuts_group_reading.png"),
tmpList = QList<QAction *>() tmpList = QList<QAction *>()
<< nextAction << goToPageOnTheRightAction
<< prevAction << goToPageOnTheLeftAction
<< setBookmarkAction << setBookmarkAction
<< showBookmarksAction << showBookmarksAction
<< autoScrollForwardAction << autoScrollForwardAction
@ -1694,29 +1694,41 @@ void MainWindowViewer::updateOpenPrevNextActions(bool thereIsPrevious, bool ther
{ {
if (thereIsPrevious) { if (thereIsPrevious) {
if (viewer->getIsMangaMode()) { if (viewer->getIsMangaMode()) {
openNextComicAction->setDisabled(false); openComicOnTheRightAction->setDisabled(false);
} else { } else {
openPreviousComicAction->setDisabled(false); openComicOnTheLeftAction->setDisabled(false);
} }
} else { } else {
if (viewer->getIsMangaMode()) { if (viewer->getIsMangaMode()) {
openNextComicAction->setDisabled(true); openComicOnTheRightAction->setDisabled(true);
} else { } else {
openPreviousComicAction->setDisabled(true); openComicOnTheLeftAction->setDisabled(true);
} }
} }
if (thereIsNext) { if (thereIsNext) {
if (viewer->getIsMangaMode()) { if (viewer->getIsMangaMode()) {
openPreviousComicAction->setDisabled(false); openComicOnTheLeftAction->setDisabled(false);
} else { } else {
openNextComicAction->setDisabled(false); openComicOnTheRightAction->setDisabled(false);
} }
} else { } else {
if (viewer->getIsMangaMode()) { if (viewer->getIsMangaMode()) {
openPreviousComicAction->setDisabled(true); openComicOnTheLeftAction->setDisabled(true);
} else { } else {
openNextComicAction->setDisabled(true); openComicOnTheRightAction->setDisabled(true);
} }
} }
if (viewer->getIsMangaMode()) {
openComicOnTheLeftAction->setToolTip(tr("Open next comic"));
openComicOnTheRightAction->setToolTip(tr("Open previous comic"));
goToPageOnTheLeftAction->setToolTip(tr("Go to next page"));
goToPageOnTheRightAction->setToolTip(tr("Go to previous page"));
} else {
openComicOnTheLeftAction->setToolTip(tr("Open previous comic"));
openComicOnTheRightAction->setToolTip(tr("Open next comic"));
goToPageOnTheLeftAction->setToolTip(tr("Go to previous page"));
goToPageOnTheRightAction->setToolTip(tr("Go to next page"));
}
} }

View File

@ -117,10 +117,10 @@ private:
QList<QAction *> recentFilesActionList; QList<QAction *> recentFilesActionList;
QAction *clearRecentFilesAction; QAction *clearRecentFilesAction;
QAction *saveImageAction; QAction *saveImageAction;
QAction *openPreviousComicAction; QAction *openComicOnTheLeftAction;
QAction *openNextComicAction; QAction *openComicOnTheRightAction;
QAction *nextAction; QAction *goToPageOnTheRightAction;
QAction *prevAction; QAction *goToPageOnTheLeftAction;
QAction *adjustWidthAction; QAction *adjustWidthAction;
QAction *adjustHeightAction; QAction *adjustHeightAction;
QAction *goToPageAction; QAction *goToPageAction;