mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Merged luisangelsm/yacreader into default
This commit is contained in:
commit
690d45f6e6
@ -33,26 +33,31 @@ void Configuration::load(QSettings * settings)
|
|||||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||||
if(!settings->contains(ZOOM_LEVEL))
|
if(!settings->contains(ZOOM_LEVEL))
|
||||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||||
if(!settings->contains(FIT))
|
//if(!settings->contains(FIT))
|
||||||
settings->setValue(FIT,false);
|
// settings->setValue(FIT,false);
|
||||||
if(!settings->contains(FLOW_TYPE))
|
if(!settings->contains(FLOW_TYPE))
|
||||||
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))
|
||||||
settings->setValue(MAXIMIZED,false);
|
settings->setValue(MAXIMIZED,false);
|
||||||
if(!settings->contains(DOUBLE_PAGE))
|
if(!settings->contains(DOUBLE_PAGE))
|
||||||
settings->setValue(DOUBLE_PAGE,false);
|
settings->setValue(DOUBLE_PAGE,false);
|
||||||
if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
//if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
||||||
settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
// settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
||||||
if(!settings->contains(BACKGROUND_COLOR))
|
if(!settings->contains(BACKGROUND_COLOR))
|
||||||
settings->setValue(BACKGROUND_COLOR,QColor(40,40,40));
|
settings->setValue(BACKGROUND_COLOR,QColor(40,40,40));
|
||||||
if(!settings->contains(ALWAYS_ON_TOP))
|
if(!settings->contains(ALWAYS_ON_TOP))
|
||||||
settings->setValue(ALWAYS_ON_TOP,false);
|
settings->setValue(ALWAYS_ON_TOP,false);
|
||||||
if(!settings->contains(SHOW_TOOLBARS))
|
if(!settings->contains(SHOW_TOOLBARS))
|
||||||
settings->setValue(SHOW_TOOLBARS, true);
|
settings->setValue(SHOW_TOOLBARS, true);
|
||||||
|
if(!settings->contains(FITMODE))
|
||||||
|
settings->setValue(FITMODE, "full_page");
|
||||||
}
|
}
|
@ -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;
|
||||||
@ -60,8 +60,21 @@ using namespace YACReader;
|
|||||||
void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}
|
void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}
|
||||||
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
|
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
|
||||||
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
||||||
|
float getPageZoomLevel() { return settings->value(PAGE_ZOOM_LEVEL).toFloat();}
|
||||||
|
void setPageZoomLevel(float zl) { settings->setValue(PAGE_ZOOM_LEVEL,zl);}
|
||||||
|
/*
|
||||||
|
//Old fitting modes
|
||||||
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
||||||
void setAdjustToWidth(bool atw=true) {settings->setValue(FIT,atw);}
|
void setAdjustToWidth(bool atw=true) {settings->setValue(FIT,atw);}
|
||||||
|
bool getFitToPage() {return settings->value(PAGEFIT).toBool();}
|
||||||
|
void setFitToPage(bool b=true) {settings->setValue(PAGEFIT,b);}
|
||||||
|
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||||
|
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||||
|
*/
|
||||||
|
|
||||||
|
QString getFitMode() { return settings->value(FITMODE).toString(); }
|
||||||
|
void setFitMode ( QString fitMode ){settings->setValue(FITMODE, fitMode);}
|
||||||
|
|
||||||
FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}
|
FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}
|
||||||
void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}
|
void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}
|
||||||
bool getFullScreen(){return settings->value(FULLSCREEN).toBool();}
|
bool getFullScreen(){return settings->value(FULLSCREEN).toBool();}
|
||||||
@ -78,8 +91,6 @@ using namespace YACReader;
|
|||||||
void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}
|
void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}
|
||||||
bool getDoubleMangaPage(){return settings->value(DOUBLE_MANGA_PAGE).toBool();}
|
bool getDoubleMangaPage(){return settings->value(DOUBLE_MANGA_PAGE).toBool();}
|
||||||
void setDoubleMangaPage(bool b){settings->setValue(DOUBLE_MANGA_PAGE,b);}
|
void setDoubleMangaPage(bool b){settings->setValue(DOUBLE_MANGA_PAGE,b);}
|
||||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
|
||||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
|
||||||
QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value<QColor>();}
|
QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value<QColor>();}
|
||||||
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);}
|
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);}
|
||||||
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();}
|
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();}
|
||||||
|
@ -107,6 +107,7 @@ MainWindowViewer::~MainWindowViewer()
|
|||||||
delete showDictionaryAction;
|
delete showDictionaryAction;
|
||||||
delete alwaysOnTopAction;
|
delete alwaysOnTopAction;
|
||||||
delete adjustToFullSizeAction;
|
delete adjustToFullSizeAction;
|
||||||
|
delete fitToPageAction;
|
||||||
delete showFlowAction;
|
delete showFlowAction;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -261,7 +262,7 @@ void MainWindowViewer::createActions()
|
|||||||
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
||||||
//adjustWidth->setCheckable(true);
|
//adjustWidth->setCheckable(true);
|
||||||
adjustHeightAction->setDisabled(true);
|
adjustHeightAction->setDisabled(true);
|
||||||
adjustHeightAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
//adjustHeightAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||||
adjustHeightAction->setToolTip(tr("Fit image to height"));
|
adjustHeightAction->setToolTip(tr("Fit image to height"));
|
||||||
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||||
adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y);
|
adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y);
|
||||||
@ -272,7 +273,7 @@ void MainWindowViewer::createActions()
|
|||||||
adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
|
adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
|
||||||
//adjustWidth->setCheckable(true);
|
//adjustWidth->setCheckable(true);
|
||||||
adjustWidthAction->setDisabled(true);
|
adjustWidthAction->setDisabled(true);
|
||||||
adjustWidthAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
//adjustWidthAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||||
adjustWidthAction->setToolTip(tr("Fit image to width"));
|
adjustWidthAction->setToolTip(tr("Fit image to width"));
|
||||||
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||||
adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y);
|
adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y);
|
||||||
@ -405,12 +406,38 @@ void MainWindowViewer::createActions()
|
|||||||
|
|
||||||
adjustToFullSizeAction = new QAction(tr("Show full size"),this);
|
adjustToFullSizeAction = new QAction(tr("Show full size"),this);
|
||||||
adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
|
adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
|
||||||
adjustToFullSizeAction->setCheckable(true);
|
//adjustToFullSizeAction->setCheckable(true);
|
||||||
adjustToFullSizeAction->setDisabled(true);
|
adjustToFullSizeAction->setDisabled(true);
|
||||||
adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize());
|
//adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize());
|
||||||
adjustToFullSizeAction->setData(ADJUST_TO_FULL_SIZE_ACTION_Y);
|
adjustToFullSizeAction->setData(ADJUST_TO_FULL_SIZE_ACTION_Y);
|
||||||
adjustToFullSizeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_TO_FULL_SIZE_ACTION_Y));
|
adjustToFullSizeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_TO_FULL_SIZE_ACTION_Y));
|
||||||
connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch()));
|
connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch()));
|
||||||
|
|
||||||
|
fitToPageAction = new QAction(tr("Fit to page"),this);
|
||||||
|
//fitToPageAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
|
||||||
|
//fitToPageAction->setCheckable(true);
|
||||||
|
fitToPageAction->setDisabled(true);
|
||||||
|
//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);
|
||||||
|
//increasePageZoomAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
|
||||||
|
increasePageZoomAction->setDisabled(true);
|
||||||
|
increasePageZoomAction->setData(ZOOM_PLUS_ACTION_Y);
|
||||||
|
increasePageZoomAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_PLUS_ACTION_Y));
|
||||||
|
|
||||||
|
connect(increasePageZoomAction,SIGNAL(triggered()),this,SLOT(increasePageZoomLevel()));
|
||||||
|
|
||||||
|
decreasePageZoomAction = new QAction(tr("Zoom-"),this);
|
||||||
|
//decreasePageZoomAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
|
||||||
|
decreasePageZoomAction->setDisabled(true);
|
||||||
|
decreasePageZoomAction->setData(ZOOM_MINUS_ACTION_Y);
|
||||||
|
decreasePageZoomAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_MINUS_ACTION_Y));
|
||||||
|
//decreasePageZoomAction->setShortcut(QKeySequence::ZoomOut);
|
||||||
|
|
||||||
|
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);
|
||||||
showFlowAction->setIcon(QIcon(":/images/viewer_toolbar/flow.png"));
|
showFlowAction->setIcon(QIcon(":/images/viewer_toolbar/flow.png"));
|
||||||
@ -525,6 +552,7 @@ void MainWindowViewer::createToolBars()
|
|||||||
|
|
||||||
comicToolBar->addAction(adjustHeightAction);
|
comicToolBar->addAction(adjustHeightAction);
|
||||||
comicToolBar->addAction(adjustToFullSizeAction);
|
comicToolBar->addAction(adjustToFullSizeAction);
|
||||||
|
comicToolBar->addAction(fitToPageAction);
|
||||||
comicToolBar->addAction(leftRotationAction);
|
comicToolBar->addAction(leftRotationAction);
|
||||||
comicToolBar->addAction(rightRotationAction);
|
comicToolBar->addAction(rightRotationAction);
|
||||||
comicToolBar->addAction(doublePageAction);
|
comicToolBar->addAction(doublePageAction);
|
||||||
@ -533,7 +561,8 @@ void MainWindowViewer::createToolBars()
|
|||||||
comicToolBar->addSeparator();
|
comicToolBar->addSeparator();
|
||||||
|
|
||||||
comicToolBar->addAction(showMagnifyingGlassAction);
|
comicToolBar->addAction(showMagnifyingGlassAction);
|
||||||
|
comicToolBar->addAction(increasePageZoomAction);
|
||||||
|
comicToolBar->addAction(decreasePageZoomAction);
|
||||||
|
|
||||||
comicToolBar->addSeparator();
|
comicToolBar->addSeparator();
|
||||||
|
|
||||||
@ -575,6 +604,7 @@ void MainWindowViewer::createToolBars()
|
|||||||
viewer->addAction(adjustHeightAction);
|
viewer->addAction(adjustHeightAction);
|
||||||
viewer->addAction(adjustWidthAction);
|
viewer->addAction(adjustWidthAction);
|
||||||
viewer->addAction(adjustToFullSizeAction);
|
viewer->addAction(adjustToFullSizeAction);
|
||||||
|
viewer->addAction(fitToPageAction);
|
||||||
viewer->addAction(leftRotationAction);
|
viewer->addAction(leftRotationAction);
|
||||||
viewer->addAction(rightRotationAction);
|
viewer->addAction(rightRotationAction);
|
||||||
viewer->addAction(doublePageAction);
|
viewer->addAction(doublePageAction);
|
||||||
@ -811,6 +841,9 @@ void MainWindowViewer::enableActions()
|
|||||||
doublePageAction->setDisabled(false);
|
doublePageAction->setDisabled(false);
|
||||||
doubleMangaPageAction->setDisabled(false);
|
doubleMangaPageAction->setDisabled(false);
|
||||||
adjustToFullSizeAction->setDisabled(false);
|
adjustToFullSizeAction->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
|
||||||
@ -832,6 +865,7 @@ void MainWindowViewer::disableActions()
|
|||||||
doublePageAction->setDisabled(true);
|
doublePageAction->setDisabled(true);
|
||||||
doubleMangaPageAction->setDisabled(true);
|
doubleMangaPageAction->setDisabled(true);
|
||||||
adjustToFullSizeAction->setDisabled(true);
|
adjustToFullSizeAction->setDisabled(true);
|
||||||
|
fitToPageAction->setDisabled(true);
|
||||||
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
|
||||||
@ -943,21 +977,30 @@ void MainWindowViewer::showToolBars()
|
|||||||
}
|
}
|
||||||
void MainWindowViewer::fitToWidth()
|
void MainWindowViewer::fitToWidth()
|
||||||
{
|
{
|
||||||
|
Configuration::getConfiguration().setFitMode("to_width");
|
||||||
|
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||||
|
viewer->updatePage();
|
||||||
|
/*
|
||||||
Configuration & conf = Configuration::getConfiguration();
|
Configuration & conf = Configuration::getConfiguration();
|
||||||
if(!conf.getAdjustToWidth())
|
if(!conf.getAdjustToWidth())
|
||||||
{
|
{
|
||||||
conf.setAdjustToWidth(true);
|
conf.setAdjustToWidth(true);
|
||||||
viewer->updatePage();
|
viewer->updatePage();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
void MainWindowViewer::fitToHeight()
|
void MainWindowViewer::fitToHeight()
|
||||||
{
|
{
|
||||||
|
Configuration::getConfiguration().setFitMode("to_height");
|
||||||
|
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||||
|
viewer->updatePage();
|
||||||
|
/*
|
||||||
Configuration & conf = Configuration::getConfiguration();
|
Configuration & conf = Configuration::getConfiguration();
|
||||||
if(conf.getAdjustToWidth())
|
if(conf.getAdjustToWidth())
|
||||||
{
|
{
|
||||||
conf.setAdjustToWidth(false);
|
conf.setAdjustToWidth(false);
|
||||||
viewer->updatePage();
|
viewer->updatePage();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindowViewer::checkNewVersion()
|
void MainWindowViewer::checkNewVersion()
|
||||||
@ -1085,7 +1128,8 @@ void MainWindowViewer::setUpShortcutsManagement()
|
|||||||
<< rightRotationAction
|
<< rightRotationAction
|
||||||
<< doublePageAction
|
<< doublePageAction
|
||||||
<< doubleMangaPageAction
|
<< doubleMangaPageAction
|
||||||
<< adjustToFullSizeAction);
|
<< adjustToFullSizeAction
|
||||||
|
<< fitToPageAction);
|
||||||
|
|
||||||
allActions << tmpList;
|
allActions << tmpList;
|
||||||
|
|
||||||
@ -1160,8 +1204,9 @@ void MainWindowViewer::toggleFitToWidthSlider()
|
|||||||
|
|
||||||
void MainWindowViewer::changeFit()
|
void MainWindowViewer::changeFit()
|
||||||
{
|
{
|
||||||
|
//TODO: this is depreceated
|
||||||
Configuration & conf = Configuration::getConfiguration();
|
Configuration & conf = Configuration::getConfiguration();
|
||||||
conf.setAdjustToWidth(!conf.getAdjustToWidth());
|
//conf.setAdjustToWidth(!conf.getAdjustToWidth());
|
||||||
viewer->updatePage();
|
viewer->updatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1374,7 +1419,29 @@ void MainWindowViewer::alwaysOnTopSwitch()
|
|||||||
|
|
||||||
void MainWindowViewer::adjustToFullSizeSwitch()
|
void MainWindowViewer::adjustToFullSizeSwitch()
|
||||||
{
|
{
|
||||||
Configuration::getConfiguration().setAdjustToFullSize(!Configuration::getConfiguration().getAdjustToFullSize());
|
//Configuration::getConfiguration().setAdjustToFullSize(!Configuration::getConfiguration().getAdjustToFullSize());
|
||||||
|
Configuration::getConfiguration().setFitMode("full_size");
|
||||||
|
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||||
|
viewer->updatePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindowViewer::fitToPageSwitch()
|
||||||
|
{
|
||||||
|
//Configuration::getConfiguration().setFitToPage(!Configuration::getConfiguration().getFitToPage());
|
||||||
|
Configuration::getConfiguration().setFitMode("full_page");
|
||||||
|
Configuration::getConfiguration().setPageZoomLevel(1);
|
||||||
|
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();
|
viewer->updatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,9 @@ class EditShortcutsDialog;
|
|||||||
void openFolderFromPath(QString pathFile, QString atFileName);
|
void openFolderFromPath(QString pathFile, QString atFileName);
|
||||||
void alwaysOnTopSwitch();
|
void alwaysOnTopSwitch();
|
||||||
void adjustToFullSizeSwitch();
|
void adjustToFullSizeSwitch();
|
||||||
|
void fitToPageSwitch();
|
||||||
|
void increasePageZoomLevel();
|
||||||
|
void decreasePageZoomLevel();
|
||||||
void reloadOptions();
|
void reloadOptions();
|
||||||
void fitToWidth();
|
void fitToWidth();
|
||||||
void fitToHeight();
|
void fitToHeight();
|
||||||
@ -122,6 +125,9 @@ class EditShortcutsDialog;
|
|||||||
QAction *showDictionaryAction;
|
QAction *showDictionaryAction;
|
||||||
QAction *alwaysOnTopAction;
|
QAction *alwaysOnTopAction;
|
||||||
QAction *adjustToFullSizeAction;
|
QAction *adjustToFullSizeAction;
|
||||||
|
QAction *fitToPageAction;
|
||||||
|
QAction *increasePageZoomAction;
|
||||||
|
QAction *decreasePageZoomAction;
|
||||||
QAction *showFlowAction;
|
QAction *showFlowAction;
|
||||||
|
|
||||||
QAction *showEditShortcutsAction;
|
QAction *showEditShortcutsAction;
|
||||||
|
@ -321,14 +321,28 @@ void Viewer::updateContentSize()
|
|||||||
//there is an image to resize
|
//there is an image to resize
|
||||||
if(currentPage !=0 && !currentPage->isNull())
|
if(currentPage !=0 && !currentPage->isNull())
|
||||||
{
|
{
|
||||||
if(Configuration::getConfiguration().getAdjustToFullSize())
|
if(!Configuration::getConfiguration().getFitMode().isNull())
|
||||||
{
|
{
|
||||||
content->resize(currentPage->width(),currentPage->height());
|
if(Configuration::getConfiguration().getFitMode()=="full_size")
|
||||||
}
|
{
|
||||||
else
|
content->resize(currentPage->size());
|
||||||
{
|
}
|
||||||
float aspectRatio = (float)currentPage->width()/currentPage->height();
|
else if(Configuration::getConfiguration().getFitMode()=="full_page")
|
||||||
|
{
|
||||||
|
QSize pagefit=currentPage->size();
|
||||||
|
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||||
|
content->resize(pagefit);
|
||||||
|
}
|
||||||
|
|
||||||
|
//float aspectRatio = (float)currentPage->width()/currentPage->height();
|
||||||
//Fit to width
|
//Fit to width
|
||||||
|
else if(Configuration::getConfiguration().getFitMode()=="to_width")
|
||||||
|
{
|
||||||
|
QSize pagefit=currentPage->size();
|
||||||
|
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||||
|
content->resize(pagefit);
|
||||||
|
}
|
||||||
|
/*
|
||||||
if(Configuration::getConfiguration().getAdjustToWidth())
|
if(Configuration::getConfiguration().getAdjustToWidth())
|
||||||
{
|
{
|
||||||
adjustToWidthRatio = Configuration::getConfiguration().getFitToWidthRatio();
|
adjustToWidthRatio = Configuration::getConfiguration().getFitToWidthRatio();
|
||||||
@ -340,6 +354,7 @@ void Viewer::updateContentSize()
|
|||||||
else
|
else
|
||||||
content->resize(width()*adjustToWidthRatio,static_cast<int>(width()*adjustToWidthRatio/aspectRatio));
|
content->resize(width()*adjustToWidthRatio,static_cast<int>(width()*adjustToWidthRatio/aspectRatio));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fit to height or fullsize/custom size
|
//Fit to height or fullsize/custom size
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -347,9 +362,31 @@ void Viewer::updateContentSize()
|
|||||||
content->resize(width(),static_cast<int>(width()/aspectRatio));
|
content->resize(width(),static_cast<int>(width()/aspectRatio));
|
||||||
else
|
else
|
||||||
content->resize(static_cast<int>(height()*aspectRatio),height());
|
content->resize(static_cast<int>(height()*aspectRatio),height());
|
||||||
|
}*/
|
||||||
|
else if(Configuration::getConfiguration().getFitMode()=="to_height")
|
||||||
|
{
|
||||||
|
QSize pagefit=currentPage->size();
|
||||||
|
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||||
|
content->resize(pagefit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else //if everything else fails use full_page
|
||||||
|
{
|
||||||
|
Configuration::getConfiguration().setFitMode("full_page");
|
||||||
|
QSize pagefit=currentPage->size();
|
||||||
|
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||||
|
content->resize(pagefit);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Configuration::getConfiguration().getPageZoomLevel())
|
||||||
|
{
|
||||||
|
QSize pagesize=content->size();
|
||||||
|
pagesize.scale(content->width()*Configuration::getConfiguration().getPageZoomLevel(), 0, Qt::KeepAspectRatioByExpanding);
|
||||||
|
content->resize(pagesize);
|
||||||
|
}
|
||||||
|
|
||||||
if(devicePixelRatio()>1)//only in retina display
|
if(devicePixelRatio()>1)//only in retina display
|
||||||
{
|
{
|
||||||
QPixmap page = currentPage->scaled(content->width()*devicePixelRatio(), content->height()*devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
QPixmap page = currentPage->scaled(content->width()*devicePixelRatio(), content->height()*devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
@ -883,7 +920,8 @@ void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
|||||||
|
|
||||||
void Viewer::updateFitToWidthRatio(float ratio)
|
void Viewer::updateFitToWidthRatio(float ratio)
|
||||||
{
|
{
|
||||||
Configuration::getConfiguration().setAdjustToWidth(true);
|
//Configuration::getConfiguration().setAdjustToWidth(true);
|
||||||
|
Configuration::getConfiguration().setFitMode("to_width");
|
||||||
adjustToWidthRatio = ratio;
|
adjustToWidthRatio = ratio;
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,13 @@
|
|||||||
#define PATH "PATH"
|
#define PATH "PATH"
|
||||||
#define MAG_GLASS_SIZE "MAG_GLASS_SIZE"
|
#define MAG_GLASS_SIZE "MAG_GLASS_SIZE"
|
||||||
#define ZOOM_LEVEL "ZOOM_LEVEL"
|
#define ZOOM_LEVEL "ZOOM_LEVEL"
|
||||||
|
#define PAGE_ZOOM_LEVEL "PAGE_ZOOM_LEVEL"
|
||||||
#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 FITMODE "FITMODE"
|
||||||
#define FLOW_TYPE "FLOW_TYPE"
|
#define FLOW_TYPE "FLOW_TYPE"
|
||||||
#define FULLSCREEN "FULLSCREEN"
|
#define FULLSCREEN "FULLSCREEN"
|
||||||
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
|
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
|
||||||
@ -27,7 +30,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"
|
||||||
|
@ -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);
|
||||||
|
@ -110,6 +110,9 @@ public:
|
|||||||
#define SHOW_DICTIONARY_ACTION_Y "SHOW_DICTIONARY_ACTION_Y"
|
#define SHOW_DICTIONARY_ACTION_Y "SHOW_DICTIONARY_ACTION_Y"
|
||||||
#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 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"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user