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 <QDate>
|
||||||
|
|
||||||
#include "yacreader_global_gui.h"
|
#include "yacreader_global_gui.h"
|
||||||
|
#include "resize_image.h"
|
||||||
|
|
||||||
#define CONF_FILE_PATH "."
|
#define CONF_FILE_PATH "."
|
||||||
#define SLIDE_ASPECT_RATIO 1.585
|
#define SLIDE_ASPECT_RATIO 1.585
|
||||||
@ -117,6 +118,9 @@ public:
|
|||||||
|
|
||||||
MouseMode getMouseMode() { return static_cast<MouseMode>(settings->value(MOUSE_MODE, MouseMode::Normal).toInt()); }
|
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)); }
|
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 <QLabel>
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QComboBox>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "theme_manager.h"
|
#include "theme_manager.h"
|
||||||
#include "theme_factory.h"
|
#include "theme_factory.h"
|
||||||
@ -198,6 +199,23 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
doublePageBoxLayout->addWidget(coverSPCheckBox);
|
doublePageBoxLayout->addWidget(coverSPCheckBox);
|
||||||
doublePageBox->setLayout(doublePageBoxLayout);
|
doublePageBox->setLayout(doublePageBoxLayout);
|
||||||
layoutImageV->addWidget(doublePageBox);
|
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();
|
layoutImageV->addStretch();
|
||||||
|
|
||||||
// IMAGE ADJUSTMENTS END -----------------------------
|
// IMAGE ADJUSTMENTS END -----------------------------
|
||||||
@ -294,6 +312,9 @@ void OptionsDialog::saveOptions()
|
|||||||
}
|
}
|
||||||
Configuration::getConfiguration().setMouseMode(mouseMode);
|
Configuration::getConfiguration().setMouseMode(mouseMode);
|
||||||
|
|
||||||
|
Configuration::getConfiguration().setScalingMethod(static_cast<ScaleMethod>(scalingMethodCombo->currentIndex()));
|
||||||
|
emit changedImageOptions();
|
||||||
|
|
||||||
YACReaderOptionsDialog::saveOptions();
|
YACReaderOptionsDialog::saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,6 +351,11 @@ void OptionsDialog::restoreOptions(QSettings *settings)
|
|||||||
#endif
|
#endif
|
||||||
disableScrollAnimations->setChecked(settings->value(DISABLE_SCROLL_ANIMATION, defaultDisableScrollAnimationsValue).toBool());
|
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();
|
auto mouseMode = Configuration::getConfiguration().getMouseMode();
|
||||||
|
|
||||||
switch (mouseMode) {
|
switch (mouseMode) {
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
class QComboBox;
|
||||||
class QDialog;
|
class QDialog;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
@ -62,6 +63,8 @@ private:
|
|||||||
|
|
||||||
QColor currentColor;
|
QColor currentColor;
|
||||||
|
|
||||||
|
QComboBox *scalingMethodCombo;
|
||||||
|
|
||||||
QRadioButton *normalMouseModeRadioButton;
|
QRadioButton *normalMouseModeRadioButton;
|
||||||
QRadioButton *leftRightNavigationMouseModeRadioButton;
|
QRadioButton *leftRightNavigationMouseModeRadioButton;
|
||||||
QRadioButton *hotAreasMouseModeRadioButton;
|
QRadioButton *hotAreasMouseModeRadioButton;
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
#define USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE "USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE"
|
#define USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE "USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE"
|
||||||
#define DISABLE_SCROLL_ANIMATION "DISABLE_SCROLL_ANIMATION"
|
#define DISABLE_SCROLL_ANIMATION "DISABLE_SCROLL_ANIMATION"
|
||||||
#define MOUSE_MODE "MOUSE_MODE"
|
#define MOUSE_MODE "MOUSE_MODE"
|
||||||
|
#define SCALING_METHOD "SCALING_METHOD"
|
||||||
|
|
||||||
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
||||||
#define Y_POSITION "Y_POSITION"
|
#define Y_POSITION "Y_POSITION"
|
||||||
|
|||||||
Reference in New Issue
Block a user