mirror of
https://github.com/YACReader/yacreader
synced 2026-03-01 18:33:09 -05:00
Add toolbar and background theming to YACReader
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <QLabel>
|
||||
#include <QColorDialog>
|
||||
#include <QCheckBox>
|
||||
#include "theme_manager.h"
|
||||
|
||||
#include "yacreader_spin_slider_widget.h"
|
||||
#include "yacreader_3d_flow_config_widget.h"
|
||||
@ -65,10 +66,12 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
// backgroundColor->setMinimumWidth(100);
|
||||
colorSelection->addWidget(backgroundColor);
|
||||
colorSelection->addWidget(selectBackgroundColorButton = new QPushButton(tr("Choose")));
|
||||
colorSelection->addWidget(clearBackgroundColorButton = new QPushButton(tr("Clear")));
|
||||
colorSelection->setStretchFactor(backgroundColor, 1);
|
||||
colorSelection->setStretchFactor(selectBackgroundColorButton, 0);
|
||||
// colorSelection->addStretch();
|
||||
connect(selectBackgroundColorButton, &QAbstractButton::clicked, this, &OptionsDialog::showColorDialog);
|
||||
connect(clearBackgroundColorButton, &QAbstractButton::clicked, this, &OptionsDialog::clearBackgroundColor);
|
||||
colorBox->setLayout(colorSelection);
|
||||
|
||||
auto scrollBox = new QGroupBox(tr("Scroll behaviour"));
|
||||
@ -278,7 +281,7 @@ void OptionsDialog::restoreOptions(QSettings *settings)
|
||||
|
||||
showTimeInInformationLabel->setChecked(Configuration::getConfiguration().getShowTimeInInformation());
|
||||
|
||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||
updateColor(settings->value(BACKGROUND_COLOR, ThemeManager::instance().getCurrentTheme().viewer.defaultBackgroundColor).value<QColor>());
|
||||
// fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
|
||||
quickNavi->setChecked(settings->value(QUICK_NAVI_MODE).toBool());
|
||||
@ -324,8 +327,6 @@ void OptionsDialog::updateColor(const QColor &color)
|
||||
backgroundColor->setAutoFillBackground(true);
|
||||
currentColor = color;
|
||||
|
||||
settings->setValue(BACKGROUND_COLOR, color);
|
||||
|
||||
emit changedOptions();
|
||||
}
|
||||
|
||||
@ -392,3 +393,10 @@ void OptionsDialog::setFilters(int brightness, int contrast, int gamma)
|
||||
else
|
||||
gammaS->setValue(100);
|
||||
}
|
||||
|
||||
void OptionsDialog::clearBackgroundColor()
|
||||
{
|
||||
settings->remove(BACKGROUND_COLOR);
|
||||
|
||||
updateColor(ThemeManager::instance().getCurrentTheme().viewer.defaultBackgroundColor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user