From f70ecc6dc7f15632d7bbc4514a60575de73fa609 Mon Sep 17 00:00:00 2001 From: Felix Kauselmann <2039670+selmf@users.noreply.github.com> Date: Thu, 3 Dec 2015 12:22:19 +0100 Subject: [PATCH] Add new fitmode FitToPage --- YACReader/main_window_viewer.cpp | 18 ++++++++++++++++++ YACReader/main_window_viewer.h | 2 ++ shortcuts_management/shortcuts_manager.h | 1 + 3 files changed, 21 insertions(+) diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 37980bbf..c25e3b9f 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -109,6 +109,7 @@ MainWindowViewer::~MainWindowViewer() delete showDictionaryAction; delete alwaysOnTopAction; delete adjustToFullSizeAction; + delete fitToPageAction; delete showFlowAction; } @@ -410,6 +411,12 @@ void MainWindowViewer::createActions() adjustToFullSizeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_TO_FULL_SIZE_ACTION_Y)); connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch())); + fitToPageAction = new QAction(tr("Fit to page"),this); + fitToPageAction->setDisabled(true); + fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y); + fitToPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(FIT_TO_PAGE_ACTION_Y)); + connect(fitToPageAction,SIGNAL(triggered()),this,SLOT(fitToPageSwitch())); + increasePageZoomAction = new QAction(tr("Zoom+"),this); increasePageZoomAction->setDisabled(true); increasePageZoomAction->setData(ZOOM_PLUS_ACTION_Y); @@ -537,6 +544,7 @@ void MainWindowViewer::createToolBars() comicToolBar->addAction(adjustWidthAction); comicToolBar->addAction(adjustHeightAction); comicToolBar->addAction(adjustToFullSizeAction); + comicToolBar->addAction(fitToPageAction); comicToolBar->addAction(leftRotationAction); comicToolBar->addAction(rightRotationAction); comicToolBar->addAction(doublePageAction); @@ -587,6 +595,7 @@ void MainWindowViewer::createToolBars() viewer->addAction(adjustHeightAction); viewer->addAction(adjustWidthAction); viewer->addAction(adjustToFullSizeAction); + viewer->addAction(fitToPageAction); viewer->addAction(leftRotationAction); viewer->addAction(rightRotationAction); viewer->addAction(doublePageAction); @@ -838,6 +847,8 @@ void MainWindowViewer::enableActions() doublePageAction->setDisabled(false); doubleMangaPageAction->setDisabled(false); adjustToFullSizeAction->setDisabled(false); + adjustToFullSizeAction->setDisabled(false); + fitToPageAction->setDisabled(false); increasePageZoomAction->setDisabled(false); decreasePageZoomAction->setDisabled(false); //setBookmark->setDisabled(false); @@ -1389,6 +1400,13 @@ void MainWindowViewer::adjustToFullSizeSwitch() viewer->updatePage(); } +void MainWindowViewer::fitToPageSwitch() +{ + Configuration::getConfiguration().setFitMode(YACReader::FitMode::FullPage); + viewer->setZoomFactor(1); + viewer->updatePage(); +} + void MainWindowViewer::increasePageZoomLevel() { viewer->increaseZoomFactor(); diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index ee7e3d16..e9277162 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -54,6 +54,7 @@ class EditShortcutsDialog; void openFolderFromPath(QString pathFile, QString atFileName); void alwaysOnTopSwitch(); void adjustToFullSizeSwitch(); + void fitToPageSwitch(); void increasePageZoomLevel(); void decreasePageZoomLevel(); void reloadOptions(); @@ -126,6 +127,7 @@ class EditShortcutsDialog; QAction *showDictionaryAction; QAction *alwaysOnTopAction; QAction *adjustToFullSizeAction; + QAction *fitToPageAction; QAction *increasePageZoomAction; QAction *decreasePageZoomAction; QAction *showFlowAction; diff --git a/shortcuts_management/shortcuts_manager.h b/shortcuts_management/shortcuts_manager.h index 7b6e3d5e..2a1780fa 100644 --- a/shortcuts_management/shortcuts_manager.h +++ b/shortcuts_management/shortcuts_manager.h @@ -110,6 +110,7 @@ public: #define SHOW_DICTIONARY_ACTION_Y "SHOW_DICTIONARY_ACTION_Y" #define ALWAYS_ON_TOP_ACTION_Y "ALWAYS_ON_TOP_ACTION_Y" #define ADJUST_TO_FULL_SIZE_ACTION_Y "ADJUST_TO_FULL_SIZE_ACTION_Y" +#define FIT_TO_PAGE_ACTION_Y "FIT_TO_PAGE_ACTION_Y" #define SHOW_FLOW_ACTION_Y "SHOW_FLOW_ACTION_Y" #define SHOW_EDIT_SHORTCUTS_ACTION_Y "SHOW_EDIT_SHORTCUTS_ACTION_Y"