diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-05-25 22:14:55 -0400 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-06-01 17:22:06 -0400 |
commit | c17e1bd7a8df8c26ca1334faec3e41ce239a5650 (patch) | |
tree | a7c58c2c58c2b8f5971e8ec473267266c07ef320 /src/yuzu/configuration/configure_general.cpp | |
parent | 4a3d57e469c5604631b5768c4fa917f199ce7854 (diff) |
yuzu qt: Use lambda and std::function for reset callback
Also makes use of std::move, and performs a clang-format cleanup.
This addresses review comments.
Co-authored-by: LC <mathew1800@gmail.com>
Diffstat (limited to 'src/yuzu/configuration/configure_general.cpp')
-rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 28aaf47be..38edb4d8d 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <functional> +#include <utility> #include <QCheckBox> #include <QMessageBox> #include <QSpinBox> @@ -57,10 +59,8 @@ void ConfigureGeneral::SetConfiguration() { } // Called to set the callback when resetting settings to defaults -void ConfigureGeneral::SetResetCallback(void (*callback)(ConfigureDialog*), - ConfigureDialog* param) { - ResetCallback = callback; - reset_callback_param = param; +void ConfigureGeneral::SetResetCallback(std::function<void()> callback) { + reset_callback = std::move(callback); } void ConfigureGeneral::ResetDefaults() { @@ -69,11 +69,12 @@ void ConfigureGeneral::ResetDefaults() { tr("This reset all settings and remove all per-game configurations. This will not delete " "game directories, profiles, or input profiles. Proceed?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); - if (answer == QMessageBox::No) + if (answer == QMessageBox::No) { return; + } UISettings::values.reset_to_defaults = true; UISettings::values.is_game_list_reload_pending.exchange(true); - (*ResetCallback)(reset_callback_param); + reset_callback(); } void ConfigureGeneral::ApplyConfiguration() { |