diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2021-04-25 00:38:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-25 00:38:42 -0500 |
| commit | 2379c5aaff7c1b49e94eda155226bd388271dfe1 (patch) | |
| tree | 1a3c3f6a471b775d58dadef59a941c30d554e01c | |
| parent | 0a1a47c920a10fe5960f990c48102d8bde08a6fe (diff) | |
| parent | 6e3435ddba0bc9a2ca71109cb75aa4edbaedfce2 (diff) | |
Merge pull request #541 from AttorneyOnline/feature/default-scaling-option
Add setting for default scaling method
| -rw-r--r-- | include/aoapplication.h | 3 | ||||
| -rw-r--r-- | include/aooptionsdialog.h | 2 | ||||
| -rw-r--r-- | src/aooptionsdialog.cpp | 18 | ||||
| -rw-r--r-- | src/text_file_functions.cpp | 8 |
4 files changed, 31 insertions, 0 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index 493f1c92..16bbb9f2 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -490,6 +490,9 @@ public: // Get if the theme is animated bool get_animated_theme(); + // Get the default scaling method + QString get_default_scaling(); + // Currently defined subtheme QString subtheme; diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index e88ce542..45fc86ca 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -85,6 +85,8 @@ private: QCheckBox *ui_discord_cb; QLabel *ui_language_label; QComboBox *ui_language_combobox; + QLabel *ui_scaling_label; + QComboBox *ui_scaling_combobox; QLabel *ui_shake_lbl; QCheckBox *ui_shake_cb; diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index a0d2e7d1..1eb99ba3 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -382,6 +382,20 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_language_combobox); row += 1; + ui_scaling_label = new QLabel(ui_form_layout_widget); + ui_scaling_label->setText(tr("Scaling:")); + ui_scaling_label->setToolTip( + tr("Sets the default scaling method, if there is not one already defined " + "specifically for the character.")); + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_scaling_label); + + ui_scaling_combobox = new QComboBox(ui_form_layout_widget); + // Corresponds with Qt::TransformationMode enum. Please don't change the order. + ui_scaling_combobox->addItem(tr("Pixel"), "fast"); + ui_scaling_combobox->addItem(tr("Smooth"), "smooth"); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_scaling_combobox); + + row += 1; ui_shake_lbl = new QLabel(ui_form_layout_widget); ui_shake_lbl->setText(tr("Allow Screenshake:")); ui_shake_lbl->setToolTip( @@ -896,6 +910,9 @@ void AOOptionsDialog::update_values() { break; } } + Qt::TransformationMode scaling = ao_app->get_scaling(ao_app->get_default_scaling()); + ui_scaling_combobox->setCurrentIndex(scaling); + // Let's fill the callwords text edit with the already present callwords. ui_callwords_textbox->document()->clear(); foreach (QString callword, ao_app->get_call_words()) { @@ -973,6 +990,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("master", ui_ms_textbox->text()); configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); + configini->setValue("default_scaling", ui_scaling_combobox->currentData()); configini->setValue("shake", ui_shake_cb->isChecked()); configini->setValue("effects", ui_effects_cb->isChecked()); configini->setValue("framenetwork", ui_framenetwork_cb->isChecked()); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index cd6802e3..1f349459 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -290,6 +290,9 @@ QString AOApplication::read_design_ini(QString p_identifier, Qt::TransformationMode AOApplication::get_scaling(QString p_scaling) { + if (p_scaling.isEmpty()) + p_scaling = get_default_scaling(); + if (p_scaling == "smooth") return Qt::SmoothTransformation; return Qt::FastTransformation; @@ -1085,3 +1088,8 @@ bool AOApplication::get_animated_theme() configini->value("animated_theme", "true").value<QString>(); return result.startsWith("true"); } + +QString AOApplication::get_default_scaling() +{ + return configini->value("default_scaling", "fast").value<QString>(); +} |
