diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index a0d0c857..30b9aebb 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -262,7 +262,7 @@ void MainWindowViewer::createActions() adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png")); //adjustWidth->setCheckable(true); adjustHeightAction->setDisabled(true); - //adjustHeightAction->setChecked(Configuration::getConfiguration().getAdjustToWidth()); + adjustHeightAction->setChecked(Configuration::getConfiguration().getAdjustToWidth()); adjustHeightAction->setToolTip(tr("Fit image to height")); //adjustWidth->setIcon(QIcon(":/images/fitWidth.png")); adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y); @@ -273,7 +273,7 @@ void MainWindowViewer::createActions() adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png")); //adjustWidth->setCheckable(true); adjustWidthAction->setDisabled(true); - //adjustWidthAction->setChecked(Configuration::getConfiguration().getAdjustToWidth()); + adjustWidthAction->setChecked(Configuration::getConfiguration().getAdjustToWidth()); adjustWidthAction->setToolTip(tr("Fit image to width")); //adjustWidth->setIcon(QIcon(":/images/fitWidth.png")); adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y); @@ -406,9 +406,9 @@ void MainWindowViewer::createActions() adjustToFullSizeAction = new QAction(tr("Show full size"),this); adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); - //adjustToFullSizeAction->setCheckable(true); + adjustToFullSizeAction->setCheckable(true); adjustToFullSizeAction->setDisabled(true); - //adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize()); + adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize()); adjustToFullSizeAction->setData(ADJUST_TO_FULL_SIZE_ACTION_Y); adjustToFullSizeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_TO_FULL_SIZE_ACTION_Y)); connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch())); @@ -417,26 +417,10 @@ void MainWindowViewer::createActions() //fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); fitToPageAction->setCheckable(true); fitToPageAction->setDisabled(true); - //fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage()); + fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage()); 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); - //fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); - //fitToPageAction->setDisabled(true); - //fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage()); - //fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y); - increasePageZoomAction->setShortcut(QKeySequence::ZoomIn); - connect(increasePageZoomAction,SIGNAL(triggered()),this,SLOT(increasePageZoomLevel())); - - decreasePageZoomAction = new QAction(tr("Zoom-"),this); - //fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); - //fitToPageAction->setDisabled(true); - //fitToPageAction->setChecked(Configuration::getConfiguration().getFitToPage()); - //fitToPageAction->setData(FIT_TO_PAGE_ACTION_Y); - decreasePageZoomAction->setShortcut(QKeySequence::ZoomOut); - connect(decreasePageZoomAction,SIGNAL(triggered()),this,SLOT(decreasePageZoomLevel())); showFlowAction = new QAction(tr("Show go to flow"),this); showFlowAction->setIcon(QIcon(":/images/viewer_toolbar/flow.png")); @@ -560,8 +544,7 @@ void MainWindowViewer::createToolBars() comicToolBar->addSeparator(); comicToolBar->addAction(showMagnifyingGlassAction); - comicToolBar->addAction(increasePageZoomAction); - comicToolBar->addAction(decreasePageZoomAction); + comicToolBar->addSeparator(); @@ -1425,18 +1408,6 @@ void MainWindowViewer::fitToPageSwitch() viewer->updatePage(); } -void MainWindowViewer::increasePageZoomLevel() -{ - Configuration::getConfiguration().setPageZoomLevel(Configuration::getConfiguration().getPageZoomLevel() + 0.1); - viewer->updatePage(); -} - -void MainWindowViewer::decreasePageZoomLevel() -{ - Configuration::getConfiguration().setPageZoomLevel(Configuration::getConfiguration().getPageZoomLevel() - 0.1); - viewer->updatePage(); -} - void MainWindowViewer::sendComic() { YACReaderLocalClient * client = new YACReaderLocalClient; diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index 00bf9f77..f16be0ab 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -56,8 +56,6 @@ class EditShortcutsDialog; void alwaysOnTopSwitch(); void adjustToFullSizeSwitch(); void fitToPageSwitch(); - void increasePageZoomLevel(); - void decreasePageZoomLevel(); void reloadOptions(); void fitToWidth(); void fitToHeight(); @@ -129,8 +127,6 @@ class EditShortcutsDialog; QAction *alwaysOnTopAction; QAction *adjustToFullSizeAction; QAction *fitToPageAction; - QAction *increasePageZoomAction; - QAction *decreasePageZoomAction; QAction *showFlowAction; QAction *showEditShortcutsAction; diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 6842c7ae..2427708c 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -340,16 +340,9 @@ void Viewer::updateContentSize() } else { - //float aspectRatio = (float)currentPage->width()/currentPage->height(); + float aspectRatio = (float)currentPage->width()/currentPage->height(); //Fit to width if(Configuration::getConfiguration().getAdjustToWidth()) - { - QSize pagefit=currentPage->size(); - pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding); - content->resize(pagefit); - } - /* - if(Configuration::getConfiguration().getAdjustToWidth()) { adjustToWidthRatio = Configuration::getConfiguration().getFitToWidthRatio(); if(static_cast(width()*adjustToWidthRatio/aspectRatio)resize(width()*adjustToWidthRatio,static_cast(width()*adjustToWidthRatio/aspectRatio)); } - //Fit to height or fullsize/custom size else { @@ -368,26 +360,18 @@ void Viewer::updateContentSize() content->resize(width(),static_cast(width()/aspectRatio)); else content->resize(static_cast(height()*aspectRatio),height()); - }*/ - else - { - QSize pagefit=currentPage->size(); - pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding); - content->resize(pagefit); } - } if(Configuration::getConfiguration().getPageZoomLevel()) { QSize pagesize=content->size(); - pagesize.scale(content->width()*Configuration::getConfiguration().getPageZoomLevel(), 0, Qt::KeepAspectRatioByExpanding); + pagesize.scale(content->width()*Configuration::getConfiguration().getPageZoomLevel(), content->height(), Qt::KeepAspectRatio); content->resize(pagesize); } if(devicePixelRatio()>1)//only in retina display { - qDebug() << "Retina Display detected" << "devicePixelRatio:" << devicePixelRatio(); QPixmap page = currentPage->scaled(content->width()*devicePixelRatio(), content->height()*devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation); page.setDevicePixelRatio(devicePixelRatio()); content->setPixmap(page);