mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-20 13:52:44 +01:00
common,yuzu-qt: GCC warning silences
Fixes -Wshadow, -Wdeprecated, and catch by copy rather than by ref.
This commit is contained in:
parent
916c6cd1a0
commit
ee32b17782
9 changed files with 37 additions and 34 deletions
|
@ -178,7 +178,7 @@ public:
|
|||
*
|
||||
* @returns The setting's category
|
||||
*/
|
||||
[[nodiscard]] Category Category() const;
|
||||
[[nodiscard]] enum Category Category() const;
|
||||
|
||||
/**
|
||||
* Returns the label this setting was created with.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <typeindex>
|
||||
#include <typeinfo>
|
||||
|
@ -169,7 +170,7 @@ public:
|
|||
} else {
|
||||
this->SetValue(static_cast<Type>(std::stoll(input)));
|
||||
}
|
||||
} catch (std::invalid_argument) {
|
||||
} catch (std::invalid_argument& e) {
|
||||
this->SetValue(this->GetDefault());
|
||||
}
|
||||
}
|
||||
|
@ -229,9 +230,10 @@ public:
|
|||
* @param category_ Category of the setting AKA INI group
|
||||
*/
|
||||
explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name,
|
||||
Category category, bool save = true, bool runtime_modifiable = false)
|
||||
Category category_, bool save_ = true,
|
||||
bool runtime_modifiable_ = false)
|
||||
requires(!ranged)
|
||||
: Setting<Type, false>{linkage, default_val, name, category, save, runtime_modifiable} {
|
||||
: Setting<Type, false>{linkage, default_val, name, category_, save_, runtime_modifiable_} {
|
||||
linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); });
|
||||
}
|
||||
virtual ~SwitchableSetting() = default;
|
||||
|
@ -247,11 +249,11 @@ public:
|
|||
* @param category_ Category of the setting AKA INI group
|
||||
*/
|
||||
explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val,
|
||||
const Type& max_val, const std::string& name, Category category,
|
||||
bool save = true, bool runtime_modifiable = false)
|
||||
const Type& max_val, const std::string& name, Category category_,
|
||||
bool save_ = true, bool runtime_modifiable_ = false)
|
||||
requires(ranged)
|
||||
: Setting<Type, true>{linkage, default_val, min_val, max_val,
|
||||
name, category, save, runtime_modifiable} {
|
||||
name, category_, save_, runtime_modifiable_} {
|
||||
linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); });
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
|
||||
ConfigureAudio::ConfigureAudio(
|
||||
const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
||||
const ConfigurationShared::TranslationMap& translations_,
|
||||
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||
: Tab(group, parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_},
|
||||
: Tab(group_, parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_},
|
||||
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||
ui->setupUi(this);
|
||||
Setup();
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
|
||||
ConfigureCpu::ConfigureCpu(
|
||||
const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
||||
const ConfigurationShared::TranslationMap& translations_,
|
||||
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureCpu>()}, system{system_},
|
||||
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureCpu>()}, system{system_},
|
||||
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
ConfigureGeneral::ConfigureGeneral(
|
||||
const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
||||
const ConfigurationShared::TranslationMap& translations_,
|
||||
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_},
|
||||
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_},
|
||||
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
|
|
|
@ -80,10 +80,10 @@ static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode)
|
|||
ConfigureGraphics::ConfigureGraphics(
|
||||
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_,
|
||||
const std::function<void()>& expose_compute_option_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
||||
const ConfigurationShared::TranslationMap& translations_,
|
||||
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||
: ConfigurationShared::Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
|
||||
: ConfigurationShared::Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
|
||||
records{records_}, expose_compute_option{expose_compute_option_}, system{system_},
|
||||
translations{translations_}, combobox_translations{combobox_translations_},
|
||||
shader_mapping{combobox_translations.at(typeid(Settings::ShaderBackend))} {
|
||||
|
@ -275,7 +275,7 @@ void ConfigureGraphics::Setup() {
|
|||
|
||||
if (!Settings::IsConfiguringGlobal()) {
|
||||
QObject::connect(api_restore_global_button, &QAbstractButton::clicked,
|
||||
[=](bool) { UpdateAPILayout(); });
|
||||
[this](bool) { UpdateAPILayout(); });
|
||||
|
||||
// Detach API's restore button and place it where we want
|
||||
// Lets us put it on the side, and it will automatically scale if there's a
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
|
||||
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(
|
||||
const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
||||
const ConfigurationShared::TranslationMap& translations_,
|
||||
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_},
|
||||
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_},
|
||||
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||
|
||||
ui->setupUi(this);
|
||||
|
|
|
@ -45,10 +45,10 @@ static bool IsValidLocale(u32 region_index, u32 language_index) {
|
|||
}
|
||||
|
||||
ConfigureSystem::ConfigureSystem(
|
||||
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
||||
const ConfigurationShared::TranslationMap& translations_,
|
||||
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_},
|
||||
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_},
|
||||
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -128,7 +128,7 @@ void ConfigureSystem::Setup() {
|
|||
}
|
||||
|
||||
[[maybe_unused]] std::string label = setting->GetLabel();
|
||||
ConfigurationShared::Widget* widget = [=]() {
|
||||
ConfigurationShared::Widget* widget = [this, setting, runtime_lock]() {
|
||||
if (setting->Id() == Settings::values.custom_rtc.Id()) {
|
||||
// custom_rtc needs a DateTimeEdit (default is LineEdit), and a checkbox to manage
|
||||
// it and custom_rtc_enabled
|
||||
|
|
|
@ -276,7 +276,7 @@ QWidget* Widget::CreateHexEdit(std::function<std::string()>& serializer,
|
|||
line_edit->setMaxLength(8);
|
||||
line_edit->setValidator(regex);
|
||||
|
||||
auto hex_to_dec = [=]() -> std::string {
|
||||
auto hex_to_dec = [this]() -> std::string {
|
||||
return std::to_string(std::stoul(line_edit->text().toStdString(), nullptr, 16));
|
||||
};
|
||||
|
||||
|
@ -307,8 +307,8 @@ QWidget* Widget::CreateDateTimeEdit(bool disabled, bool restrict,
|
|||
serializer = [this]() { return std::to_string(date_time_edit->dateTime().toSecsSinceEpoch()); };
|
||||
|
||||
if (!Settings::IsConfiguringGlobal()) {
|
||||
auto get_clear_val = [=]() {
|
||||
return QDateTime::fromSecsSinceEpoch([=]() {
|
||||
auto get_clear_val = [this, restrict, current_time]() {
|
||||
return QDateTime::fromSecsSinceEpoch([this, restrict, current_time]() {
|
||||
if (restrict && checkbox->checkState() == Qt::Checked) {
|
||||
return std::stoll(setting.ToStringGlobal());
|
||||
}
|
||||
|
@ -316,13 +316,14 @@ QWidget* Widget::CreateDateTimeEdit(bool disabled, bool restrict,
|
|||
}());
|
||||
};
|
||||
|
||||
restore_func = [=]() { date_time_edit->setDateTime(get_clear_val()); };
|
||||
restore_func = [this, get_clear_val]() { date_time_edit->setDateTime(get_clear_val()); };
|
||||
|
||||
QObject::connect(date_time_edit, &QDateTimeEdit::editingFinished, [=]() {
|
||||
if (date_time_edit->dateTime() != get_clear_val()) {
|
||||
touch();
|
||||
}
|
||||
});
|
||||
QObject::connect(date_time_edit, &QDateTimeEdit::editingFinished,
|
||||
[this, get_clear_val, touch]() {
|
||||
if (date_time_edit->dateTime() != get_clear_val()) {
|
||||
touch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return date_time_edit;
|
||||
|
@ -528,11 +529,11 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati
|
|||
this->setToolTip(tooltip);
|
||||
}
|
||||
|
||||
Widget::Widget(Settings::BasicSetting* setting, const TranslationMap& translations,
|
||||
const ComboboxTranslationMap& combobox_translations, QWidget* parent,
|
||||
bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_,
|
||||
Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_,
|
||||
const ComboboxTranslationMap& combobox_translations, QWidget* parent_,
|
||||
bool runtime_lock_, std::forward_list<std::function<void(bool)>>& apply_funcs_,
|
||||
Settings::BasicSetting* other_setting, RequestType request, const QString& string)
|
||||
: Widget(setting, translations, combobox_translations, parent, runtime_lock, apply_funcs_,
|
||||
: Widget(setting_, translations_, combobox_translations, parent_, runtime_lock_, apply_funcs_,
|
||||
request, true, 1.0f, other_setting, string) {}
|
||||
|
||||
} // namespace ConfigurationShared
|
||||
|
|
Loading…
Reference in a new issue