Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/ui/options_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="theme_scaling_factor_sb">
<widget class="QDoubleSpinBox" name="theme_scaling_factor_sb">
<property name="minimum">
<number>1</number>
</property>
Expand Down
8 changes: 4 additions & 4 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ void Options::setTheme(QString value)
config.setValue("theme", value);
}

int Options::themeScalingFactor() const
double Options::themeScalingFactor() const
{
int value = config.value("theme_scaling_factor", "1").toInt();
if (value <= 0)
double value = config.value("theme_scaling_factor", "1").toDouble();
if (value < 0.2)
{
value = 1;
}
return value;
}

void Options::setThemeScalingFactor(int value)
void Options::setThemeScalingFactor(double value)
{
config.setValue("theme_scaling_factor", value);
}
Expand Down
4 changes: 2 additions & 2 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Options
QString theme() const;
void setTheme(QString value);

int themeScalingFactor() const;
void setThemeScalingFactor(int value);
double themeScalingFactor() const;
void setThemeScalingFactor(double value);

// Returns the blip rate from config.ini (once per X symbols)
int blipRate() const;
Expand Down
17 changes: 15 additions & 2 deletions src/widgets/aooptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <bass.h>

#include <QCollator>
#include <QDoubleSpinBox>
#include <QGroupBox>
#include <QResource>
#include <QUiLoader>
Expand Down Expand Up @@ -97,6 +98,18 @@ int AOOptionsDialog::widgetData(QSpinBox *widget) const
return widget->value();
}

template <>
void AOOptionsDialog::setWidgetData(QDoubleSpinBox *widget, const double &value)
{
widget->setValue(value);
}

template <>
double AOOptionsDialog::widgetData(QDoubleSpinBox *widget) const
{
return widget->value();
}

template <>
void AOOptionsDialog::setWidgetData(QComboBox *widget, const QString &value)
{
Expand Down Expand Up @@ -344,7 +357,7 @@ void AOOptionsDialog::setupUI()
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
});

FROM_UI(QSpinBox, theme_scaling_factor_sb);
FROM_UI(QDoubleSpinBox, theme_scaling_factor_sb);
FROM_UI(QCheckBox, animated_theme_cb);
FROM_UI(QSpinBox, stay_time_spinbox);
FROM_UI(QCheckBox, instant_objection_cb);
Expand Down Expand Up @@ -374,7 +387,7 @@ void AOOptionsDialog::setupUI()
FROM_UI(QCheckBox, restoreposition_cb);
FROM_UI(QLineEdit, playerlist_format_edit);

registerOption<QSpinBox, int>("theme_scaling_factor_sb", &Options::themeScalingFactor, &Options::setThemeScalingFactor);
registerOption<QDoubleSpinBox, double>("theme_scaling_factor_sb", &Options::themeScalingFactor, &Options::setThemeScalingFactor);
registerOption<QCheckBox, bool>("animated_theme_cb", &Options::animatedThemeEnabled, &Options::setAnimatedThemeEnabled);
registerOption<QSpinBox, int>("stay_time_spinbox", &Options::textStayTime, &Options::setTextStayTime);
registerOption<QCheckBox, bool>("instant_objection_cb", &Options::objectionSkipQueueEnabled, &Options::setObjectionSkipQueueEnabled);
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/aooptionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AOOptionsDialog : public QDialog
QWidget *ui_settings_widget;
QComboBox *ui_theme_combobox;
QComboBox *ui_subtheme_combobox;
QSpinBox *ui_theme_scaling_factor_sb;
QDoubleSpinBox *ui_theme_scaling_factor_sb;
QPushButton *ui_theme_reload_button;
QPushButton *ui_theme_folder_button;
QCheckBox *ui_evidence_double_click_cb;
Expand Down
Loading