Skip to content

Commit 60dae51

Browse files
Merge remote-tracking branch 'origin/feature/default-scaling-option' into 2.9.1-ea
2 parents f1d6ee8 + 6e3435d commit 60dae51

4 files changed

Lines changed: 31 additions & 0 deletions

File tree

include/aoapplication.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ class AOApplication : public QApplication {
493493
// Get if the theme is animated
494494
bool get_animated_theme();
495495

496+
// Get the default scaling method
497+
QString get_default_scaling();
498+
496499
// Currently defined subtheme
497500
QString subtheme;
498501

include/aooptionsdialog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class AOOptionsDialog : public QDialog {
8585
QCheckBox *ui_discord_cb;
8686
QLabel *ui_language_label;
8787
QComboBox *ui_language_combobox;
88+
QLabel *ui_scaling_label;
89+
QComboBox *ui_scaling_combobox;
8890

8991
QLabel *ui_shake_lbl;
9092
QCheckBox *ui_shake_cb;

src/aooptionsdialog.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,20 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
381381
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole,
382382
ui_language_combobox);
383383

384+
row += 1;
385+
ui_scaling_label = new QLabel(ui_form_layout_widget);
386+
ui_scaling_label->setText(tr("Scaling:"));
387+
ui_scaling_label->setToolTip(
388+
tr("Sets the default scaling method, if there is not one already defined "
389+
"specifically for the character."));
390+
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_scaling_label);
391+
392+
ui_scaling_combobox = new QComboBox(ui_form_layout_widget);
393+
// Corresponds with Qt::TransformationMode enum. Please don't change the order.
394+
ui_scaling_combobox->addItem(tr("Pixel"), "fast");
395+
ui_scaling_combobox->addItem(tr("Smooth"), "smooth");
396+
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_scaling_combobox);
397+
384398
row += 1;
385399
ui_shake_lbl = new QLabel(ui_form_layout_widget);
386400
ui_shake_lbl->setText(tr("Allow Screenshake:"));
@@ -896,6 +910,9 @@ void AOOptionsDialog::update_values() {
896910
break;
897911
}
898912
}
913+
Qt::TransformationMode scaling = ao_app->get_scaling(ao_app->get_default_scaling());
914+
ui_scaling_combobox->setCurrentIndex(scaling);
915+
899916
// Let's fill the callwords text edit with the already present callwords.
900917
ui_callwords_textbox->document()->clear();
901918
foreach (QString callword, ao_app->get_call_words()) {
@@ -973,6 +990,7 @@ void AOOptionsDialog::save_pressed()
973990
configini->setValue("master", ui_ms_textbox->text());
974991
configini->setValue("discord", ui_discord_cb->isChecked());
975992
configini->setValue("language", ui_language_combobox->currentText().left(2));
993+
configini->setValue("default_scaling", ui_scaling_combobox->currentData());
976994
configini->setValue("shake", ui_shake_cb->isChecked());
977995
configini->setValue("effects", ui_effects_cb->isChecked());
978996
configini->setValue("framenetwork", ui_framenetwork_cb->isChecked());

src/text_file_functions.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ QString AOApplication::read_design_ini(QString p_identifier,
290290

291291
Qt::TransformationMode AOApplication::get_scaling(QString p_scaling)
292292
{
293+
if (p_scaling.isEmpty())
294+
p_scaling = get_default_scaling();
295+
293296
if (p_scaling == "smooth")
294297
return Qt::SmoothTransformation;
295298
return Qt::FastTransformation;
@@ -1098,3 +1101,8 @@ bool AOApplication::get_animated_theme()
10981101
configini->value("animated_theme", "true").value<QString>();
10991102
return result.startsWith("true");
11001103
}
1104+
1105+
QString AOApplication::get_default_scaling()
1106+
{
1107+
return configini->value("default_scaling", "fast").value<QString>();
1108+
}

0 commit comments

Comments
 (0)