mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Reader: Add option to stop enlarging images in fit to width and height
This commit is contained in:
parent
5f0889f332
commit
232181eef7
@ -7,6 +7,9 @@ spanish only. Sorry for the mess.
|
||||
Version counting is based on semantic versioning (Major.Feature.Patch)
|
||||
|
||||
## 9.7.0 (unreleased)
|
||||
### YACReader
|
||||
* Image enlargement/stretching can now be disabled for fit
|
||||
to width and height
|
||||
|
||||
### YACReaderLibrary
|
||||
* update QsLog logger to version 2.1, snapshot 46b643d5bcbc
|
||||
|
@ -47,14 +47,6 @@ void Configuration::load(QSettings *settings)
|
||||
settings->setValue(SHOW_TOOLBARS, true);
|
||||
if (!settings->contains(QUICK_NAVI_MODE))
|
||||
settings->setValue(QUICK_NAVI_MODE, false);
|
||||
//old fit stuff
|
||||
/*if(!settings->contains(FIT))
|
||||
settings->setValue(FIT,false);
|
||||
if(!settings->contains(FIT_TO_WIDTH_RATIO))
|
||||
settings->setValue(FIT_TO_WIDTH_RATIO,1);
|
||||
if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
||||
settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
||||
*/
|
||||
}
|
||||
void Configuration::updateOpenRecentList(QString path)
|
||||
{
|
||||
|
@ -51,16 +51,6 @@ public:
|
||||
void updateOpenRecentList(QString path);
|
||||
void clearOpenRecentList() { settings->remove("recentFiles"); }
|
||||
|
||||
//Old fitmodes
|
||||
/*
|
||||
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
||||
void setAdjustToWidth(bool atw=true) {settings->setValue(FIT,atw);}
|
||||
float getFitToWidthRatio(){return settings->value(FIT_TO_WIDTH_RATIO).toFloat();}
|
||||
void setFitToWidthRatio(float r){settings->setValue(FIT_TO_WIDTH_RATIO,r);}
|
||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||
*/
|
||||
|
||||
FlowType getFlowType() { return (FlowType)settings->value(FLOW_TYPE_SW).toInt(); }
|
||||
void setFlowType(FlowType type) { settings->setValue(FLOW_TYPE_SW, type); }
|
||||
bool getFullScreen() { return settings->value(FULLSCREEN).toBool(); }
|
||||
|
@ -156,6 +156,7 @@ void MainWindowViewer::setupUI()
|
||||
connect(optionsDialog, SIGNAL(accepted()), viewer, SLOT(updateOptions()));
|
||||
connect(optionsDialog, SIGNAL(optionsChanged()), this, SLOT(reloadOptions()));
|
||||
connect(optionsDialog, SIGNAL(changedFilters(int, int, int)), viewer, SLOT(updateFilters(int, int, int)));
|
||||
connect(optionsDialog, &OptionsDialog::changedImageOptions, viewer, &Viewer::updatePage);
|
||||
|
||||
optionsDialog->restoreOptions(settings);
|
||||
//shortcutsDialog = new ShortcutsDialog(this);
|
||||
|
@ -55,18 +55,6 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
|
||||
connect(pathFindButton, SIGNAL(clicked()), this, SLOT(findFolder()));
|
||||
|
||||
//fitToWidthRatioLabel = new QLabel(tr("Page width stretch"),this);
|
||||
/*QGroupBox *fitBox = new QGroupBox(tr("Page width stretch"));
|
||||
fitToWidthRatioS = new QSlider(this);
|
||||
fitToWidthRatioS->setMinimum(50);
|
||||
fitToWidthRatioS->setMaximum(100);
|
||||
fitToWidthRatioS->setPageStep(5);
|
||||
fitToWidthRatioS->setOrientation(Qt::Horizontal);
|
||||
//connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
QHBoxLayout * fitLayout = new QHBoxLayout;
|
||||
fitLayout->addWidget(fitToWidthRatioS);
|
||||
fitBox->setLayout(fitLayout);*/
|
||||
|
||||
auto colorSelection = new QHBoxLayout;
|
||||
backgroundColor = new QLabel();
|
||||
QPalette pal = backgroundColor->palette();
|
||||
@ -145,6 +133,19 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
QGroupBox *imageBox = new QGroupBox(tr("Image options"));
|
||||
imageBox->setLayout(layoutImage);
|
||||
layoutImageV->addWidget(imageBox);
|
||||
|
||||
auto scaleBox = new QGroupBox(tr("Fit options"));
|
||||
auto scaleLayout = new QVBoxLayout();
|
||||
scaleCheckbox = new QCheckBox(tr("Enlarge images to fit width/height"));
|
||||
connect(scaleCheckbox, &QCheckBox::clicked,
|
||||
[=](bool checked) {
|
||||
settings->setValue(ENLARGE_IMAGES, checked);
|
||||
emit(changedImageOptions());
|
||||
});
|
||||
|
||||
scaleLayout->addWidget(scaleCheckbox);
|
||||
scaleBox->setLayout(scaleLayout);
|
||||
layoutImageV->addWidget(scaleBox);
|
||||
layoutImageV->addStretch();
|
||||
|
||||
pageGeneral->setLayout(layoutGeneral);
|
||||
@ -233,6 +234,8 @@ void OptionsDialog::restoreOptions(QSettings *settings)
|
||||
brightnessS->setValue(settings->value(BRIGHTNESS, 0).toInt());
|
||||
contrastS->setValue(settings->value(CONTRAST, 100).toInt());
|
||||
gammaS->setValue(settings->value(GAMMA, 100).toInt());
|
||||
|
||||
scaleCheckbox->setChecked(settings->value(ENLARGE_IMAGES, true).toBool());
|
||||
}
|
||||
|
||||
void OptionsDialog::updateColor(const QColor &color)
|
||||
@ -248,12 +251,6 @@ void OptionsDialog::updateColor(const QColor &color)
|
||||
emit(changedOptions());
|
||||
}
|
||||
|
||||
/*void OptionsDialog::fitToWidthRatio(int value)
|
||||
{
|
||||
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
|
||||
emit(fitToWidthRatioChanged(value/100.0));
|
||||
}*/
|
||||
|
||||
void OptionsDialog::brightnessChanged(int value)
|
||||
{
|
||||
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
|
@ -25,6 +25,7 @@ private:
|
||||
QPushButton *pathFindButton;
|
||||
QCheckBox *quickNavi;
|
||||
QCheckBox *disableShowOnMouseOver;
|
||||
QCheckBox *scaleCheckbox;
|
||||
|
||||
QLabel *magGlassSizeLabel;
|
||||
|
||||
|
@ -316,24 +316,27 @@ void Viewer::updateContentSize()
|
||||
{
|
||||
//there is an image to resize
|
||||
if (currentPage != nullptr && !currentPage->isNull()) {
|
||||
QSize pagefit;
|
||||
QSize pagefit = currentPage->size();
|
||||
bool stretchImages = Configuration::getConfiguration().getSettings()->value(ENLARGE_IMAGES).toBool();
|
||||
YACReader::FitMode fitmode = Configuration::getConfiguration().getFitMode();
|
||||
switch (fitmode) {
|
||||
case YACReader::FitMode::FullRes:
|
||||
pagefit = currentPage->size();
|
||||
break;
|
||||
case YACReader::FitMode::ToWidth:
|
||||
pagefit = currentPage->size();
|
||||
if (!stretchImages && width() > pagefit.width()) {
|
||||
break;
|
||||
}
|
||||
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
case YACReader::FitMode::ToHeight:
|
||||
pagefit = currentPage->size();
|
||||
if (!stretchImages && height() > pagefit.height()) {
|
||||
break;
|
||||
}
|
||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
//if everything fails showing the full page is a good idea
|
||||
case YACReader::FitMode::FullPage:
|
||||
default:
|
||||
pagefit = currentPage->size();
|
||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||
break;
|
||||
}
|
||||
|
@ -69,6 +69,8 @@
|
||||
#define USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW"
|
||||
#define DISPLAY_CONTINUE_READING_IN_GRID_VIEW "DISPLAY_CONTINUE_READING_IN_GRID_VIEW"
|
||||
|
||||
#define ENLARGE_IMAGES "ENLARGE_IMAGES"
|
||||
|
||||
namespace YACReader {
|
||||
|
||||
static const QString YACReaderLibrarComiscSelectionMimeDataFormat = "application/yacreaderlibrary-comics-ids";
|
||||
|
Loading…
Reference in New Issue
Block a user