Reader: Add option to stop enlarging images in fit to width and height

This commit is contained in:
Felix Kauselmann
2020-09-02 09:15:29 +02:00
parent 5f0889f332
commit 232181eef7
8 changed files with 30 additions and 41 deletions

View File

@ -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);