mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Add a setting to control the scaling method used
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
#include <QDate>
|
||||
|
||||
#include "yacreader_global_gui.h"
|
||||
#include "resize_image.h"
|
||||
|
||||
#define CONF_FILE_PATH "."
|
||||
#define SLIDE_ASPECT_RATIO 1.585
|
||||
@ -117,6 +118,9 @@ public:
|
||||
|
||||
MouseMode getMouseMode() { return static_cast<MouseMode>(settings->value(MOUSE_MODE, MouseMode::Normal).toInt()); }
|
||||
void setMouseMode(MouseMode mouseMode) { settings->setValue(MOUSE_MODE, static_cast<int>(mouseMode)); }
|
||||
|
||||
ScaleMethod getScalingMethod() { return static_cast<ScaleMethod>(settings->value(SCALING_METHOD, static_cast<int>(ScaleMethod::Lanczos)).toInt()); }
|
||||
void setScalingMethod(ScaleMethod method) { settings->setValue(SCALING_METHOD, static_cast<int>(method)); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include <QLabel>
|
||||
#include <QColorDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QMessageBox>
|
||||
#include "theme_manager.h"
|
||||
#include "theme_factory.h"
|
||||
@ -198,6 +199,23 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
doublePageBoxLayout->addWidget(coverSPCheckBox);
|
||||
doublePageBox->setLayout(doublePageBoxLayout);
|
||||
layoutImageV->addWidget(doublePageBox);
|
||||
|
||||
auto scalingBox = new QGroupBox(tr("Scaling"));
|
||||
auto scalingLayout = new QHBoxLayout();
|
||||
scalingLayout->addWidget(new QLabel(tr("Scaling method")));
|
||||
scalingMethodCombo = new QComboBox();
|
||||
scalingMethodCombo->addItem(tr("Nearest (fast, low quality)"));
|
||||
scalingMethodCombo->addItem(tr("Bilinear"));
|
||||
scalingMethodCombo->addItem(tr("Lanczos (better quality)"));
|
||||
connect(scalingMethodCombo, &QComboBox::currentIndexChanged, this, [this](int index) {
|
||||
Configuration::getConfiguration().setScalingMethod(static_cast<ScaleMethod>(index));
|
||||
emit changedImageOptions();
|
||||
});
|
||||
scalingLayout->addWidget(scalingMethodCombo);
|
||||
scalingLayout->addStretch();
|
||||
scalingBox->setLayout(scalingLayout);
|
||||
layoutImageV->addWidget(scalingBox);
|
||||
|
||||
layoutImageV->addStretch();
|
||||
|
||||
// IMAGE ADJUSTMENTS END -----------------------------
|
||||
@ -294,6 +312,9 @@ void OptionsDialog::saveOptions()
|
||||
}
|
||||
Configuration::getConfiguration().setMouseMode(mouseMode);
|
||||
|
||||
Configuration::getConfiguration().setScalingMethod(static_cast<ScaleMethod>(scalingMethodCombo->currentIndex()));
|
||||
emit changedImageOptions();
|
||||
|
||||
YACReaderOptionsDialog::saveOptions();
|
||||
}
|
||||
|
||||
@ -330,6 +351,11 @@ void OptionsDialog::restoreOptions(QSettings *settings)
|
||||
#endif
|
||||
disableScrollAnimations->setChecked(settings->value(DISABLE_SCROLL_ANIMATION, defaultDisableScrollAnimationsValue).toBool());
|
||||
|
||||
{
|
||||
QSignalBlocker blocker(scalingMethodCombo);
|
||||
scalingMethodCombo->setCurrentIndex(static_cast<int>(Configuration::getConfiguration().getScalingMethod()));
|
||||
}
|
||||
|
||||
auto mouseMode = Configuration::getConfiguration().getMouseMode();
|
||||
|
||||
switch (mouseMode) {
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class QComboBox;
|
||||
class QDialog;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
@ -62,6 +63,8 @@ private:
|
||||
|
||||
QColor currentColor;
|
||||
|
||||
QComboBox *scalingMethodCombo;
|
||||
|
||||
QRadioButton *normalMouseModeRadioButton;
|
||||
QRadioButton *leftRightNavigationMouseModeRadioButton;
|
||||
QRadioButton *hotAreasMouseModeRadioButton;
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#define USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE "USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE"
|
||||
#define DISABLE_SCROLL_ANIMATION "DISABLE_SCROLL_ANIMATION"
|
||||
#define MOUSE_MODE "MOUSE_MODE"
|
||||
#define SCALING_METHOD "SCALING_METHOD"
|
||||
|
||||
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
||||
#define Y_POSITION "Y_POSITION"
|
||||
|
||||
Reference in New Issue
Block a user