More refactoring. Add zoom actions to shortcut manager.

This commit is contained in:
Felix Kauselmann 2015-01-02 14:30:40 +01:00
parent b199095515
commit c180b6e8a8
6 changed files with 26 additions and 16 deletions

View File

@ -39,8 +39,11 @@ void Configuration::load(QSettings * settings)
settings->setValue(FLOW_TYPE,0); settings->setValue(FLOW_TYPE,0);
if(!settings->contains(FULLSCREEN)) if(!settings->contains(FULLSCREEN))
settings->setValue(FULLSCREEN,false); settings->setValue(FULLSCREEN,false);
//TODO: Replace this with zoom mode
if(!settings->contains(FIT_TO_WIDTH_RATIO)) if(!settings->contains(FIT_TO_WIDTH_RATIO))
settings->setValue(FIT_TO_WIDTH_RATIO,1); settings->setValue(FIT_TO_WIDTH_RATIO,1);
if(!settings->contains(Y_WINDOW_SIZE)) if(!settings->contains(Y_WINDOW_SIZE))
settings->setValue(Y_WINDOW_SIZE,QSize(0,0)); settings->setValue(Y_WINDOW_SIZE,QSize(0,0));
if(!settings->contains(MAXIMIZED)) if(!settings->contains(MAXIMIZED))

View File

@ -27,7 +27,7 @@ using namespace YACReader;
QSize magnifyingGlassSize; QSize magnifyingGlassSize;
QSize gotoSlideSize; QSize gotoSlideSize;
float zoomLevel; float zoomLevel;
bool adjustToWidth; //bool adjustToWidth;
bool fullScreen; bool fullScreen;
FlowType flowType; FlowType flowType;
float fitToWidthRatio; float fitToWidthRatio;

View File

@ -414,7 +414,7 @@ void MainWindowViewer::createActions()
fitToPageAction = new QAction(tr("Fit to page"),this); fitToPageAction = new QAction(tr("Fit to page"),this);
//fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); //fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
fitToPageAction->setCheckable(true); //fitToPageAction->setCheckable(true);
fitToPageAction->setDisabled(true); fitToPageAction->setDisabled(true);
//fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage()); //fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage());
fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y); fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y);
@ -422,19 +422,20 @@ void MainWindowViewer::createActions()
connect(fitToPageAction,SIGNAL(triggered()),this,SLOT(fitToPageSwitch())); connect(fitToPageAction,SIGNAL(triggered()),this,SLOT(fitToPageSwitch()));
increasePageZoomAction = new QAction(tr("Zoom+"),this); increasePageZoomAction = new QAction(tr("Zoom+"),this);
//fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); //increasePageZoomAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
//fitToPageAction->setDisabled(true); increasePageZoomAction->setDisabled(true);
//fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage()); increasePageZoomAction->setData(ZOOM_PLUS_ACTION_Y);
//fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y); increasePageZoomAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_PLUS_ACTION_Y));
increasePageZoomAction->setShortcut(QKeySequence::ZoomIn);
connect(increasePageZoomAction,SIGNAL(triggered()),this,SLOT(increasePageZoomLevel())); connect(increasePageZoomAction,SIGNAL(triggered()),this,SLOT(increasePageZoomLevel()));
decreasePageZoomAction = new QAction(tr("Zoom-"),this); decreasePageZoomAction = new QAction(tr("Zoom-"),this);
//fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); //decreasePageZoomAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
//fitToPageAction->setDisabled(true); decreasePageZoomAction->setDisabled(true);
//fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage()); decreasePageZoomAction->setData(ZOOM_MINUS_ACTION_Y);
//fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y); decreasePageZoomAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_MINUS_ACTION_Y));
decreasePageZoomAction->setShortcut(QKeySequence::ZoomOut); //decreasePageZoomAction->setShortcut(QKeySequence::ZoomOut);
connect(decreasePageZoomAction,SIGNAL(triggered()),this,SLOT(decreasePageZoomLevel())); connect(decreasePageZoomAction,SIGNAL(triggered()),this,SLOT(decreasePageZoomLevel()));
showFlowAction = new QAction(tr("Show go to flow"),this); showFlowAction = new QAction(tr("Show go to flow"),this);
@ -839,6 +840,8 @@ void MainWindowViewer::enableActions()
doubleMangaPageAction->setDisabled(false); doubleMangaPageAction->setDisabled(false);
adjustToFullSizeAction->setDisabled(false); adjustToFullSizeAction->setDisabled(false);
fitToPageAction->setDisabled(false); fitToPageAction->setDisabled(false);
increasePageZoomAction->setDisabled(false);
decreasePageZoomAction->setDisabled(false);
//setBookmark->setDisabled(false); //setBookmark->setDisabled(false);
showBookmarksAction->setDisabled(false); showBookmarksAction->setDisabled(false);
showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited

View File

@ -18,8 +18,8 @@
#define SLIDE_SIZE "SLIDE_SIZE" #define SLIDE_SIZE "SLIDE_SIZE"
#define GO_TO_FLOW_SIZE "GO_TO_FLOW_SIZE" #define GO_TO_FLOW_SIZE "GO_TO_FLOW_SIZE"
#define FLOW_TYPE_SW "FLOW_TYPE_SW" #define FLOW_TYPE_SW "FLOW_TYPE_SW"
#define FIT "FIT" //#define FIT "FIT"
#define PAGEFIT "PAGEFIT" //#define PAGEFIT "PAGEFIT"
#define FITMODE "FITMODE" #define FITMODE "FITMODE"
#define FLOW_TYPE "FLOW_TYPE" #define FLOW_TYPE "FLOW_TYPE"
#define FULLSCREEN "FULLSCREEN" #define FULLSCREEN "FULLSCREEN"
@ -29,7 +29,7 @@
#define MAXIMIZED "MAXIMIZED" #define MAXIMIZED "MAXIMIZED"
#define DOUBLE_PAGE "DOUBLE_PAGE" #define DOUBLE_PAGE "DOUBLE_PAGE"
#define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE" #define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE"
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE" //#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
#define BACKGROUND_COLOR "BACKGROUND_COLOR" #define BACKGROUND_COLOR "BACKGROUND_COLOR"
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP" #define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
#define SHOW_TOOLBARS "SHOW_TOOLBARS" #define SHOW_TOOLBARS "SHOW_TOOLBARS"

View File

@ -52,7 +52,9 @@ void ShortcutsManager::initDefaultShorcuts()
defaultShorcuts.insert(ALWAYS_ON_TOP_ACTION_Y, Qt::Key_Q); //deprecated defaultShorcuts.insert(ALWAYS_ON_TOP_ACTION_Y, Qt::Key_Q); //deprecated
defaultShorcuts.insert(ADJUST_TO_FULL_SIZE_ACTION_Y, Qt::Key_W); defaultShorcuts.insert(ADJUST_TO_FULL_SIZE_ACTION_Y, Qt::Key_W);
defaultShorcuts.insert(SHOW_FLOW_ACTION_Y, Qt::Key_S); defaultShorcuts.insert(SHOW_FLOW_ACTION_Y, Qt::Key_S);
defaultShorcuts.insert(ZOOM_PLUS_ACTION_Y, QKeySequence::ZoomIn);
defaultShorcuts.insert(ZOOM_MINUS_ACTION_Y, QKeySequence::ZoomOut);
//main_window_viewer //main_window_viewer
defaultShorcuts.insert(TOGGLE_FULL_SCREEN_ACTION_Y, Qt::Key_F); defaultShorcuts.insert(TOGGLE_FULL_SCREEN_ACTION_Y, Qt::Key_F);
defaultShorcuts.insert(TOGGLE_TOOL_BARS_ACTION_Y, Qt::Key_H); defaultShorcuts.insert(TOGGLE_TOOL_BARS_ACTION_Y, Qt::Key_H);

View File

@ -109,6 +109,8 @@ public:
#define ALWAYS_ON_TOP_ACTION_Y "ALWAYS_ON_TOP_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 ADJUST_TO_FULL_SIZE_ACTION_Y "ADJUST_TO_FULL_SIZE_ACTION_Y"
#define FIT_TO_PAGE_ACTION_Y "FIT_TO_PAGE_ACTION_Y" #define FIT_TO_PAGE_ACTION_Y "FIT_TO_PAGE_ACTION_Y"
#define ZOOM_PLUS_ACTION_Y "ZOOM_PLUS_ACTION_Y"
#define ZOOM_MINUS_ACTION_Y "ZOOM_MINUS_ACTION_Y"
#define SHOW_FLOW_ACTION_Y "SHOW_FLOW_ACTION_Y" #define SHOW_FLOW_ACTION_Y "SHOW_FLOW_ACTION_Y"
#define SHOW_EDIT_SHORTCUTS_ACTION_Y "SHOW_EDIT_SHORTCUTS_ACTION_Y" #define SHOW_EDIT_SHORTCUTS_ACTION_Y "SHOW_EDIT_SHORTCUTS_ACTION_Y"