Resolve "implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20" warning

This commit is contained in:
Zopolis4 2022-08-08 11:25:19 +10:00
parent e638bb658f
commit e54818e60d
No known key found for this signature in database
GPG Key ID: C1117D56FBC82774
10 changed files with 29 additions and 23 deletions

View File

@ -33,8 +33,9 @@ AdvancedWidget::AdvancedWidget(GraphicsWindow* parent)
AddDescriptions();
connect(parent, &GraphicsWindow::BackendChanged, this, &AdvancedWidget::OnBackendChanged);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
OnBackendChanged();
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);

View File

@ -41,8 +41,9 @@ GeneralWidget::GeneralWidget(X11Utils::XRRConfiguration* xrr_config, GraphicsWin
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
connect(parent, &GraphicsWindow::BackendChanged, this, &GeneralWidget::OnBackendChanged);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
}

View File

@ -34,8 +34,9 @@ SoftwareRendererWidget::SoftwareRendererWidget(GraphicsWindow* parent)
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
connect(parent, &GraphicsWindow::BackendChanged, [this] { LoadSettings(); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
}

View File

@ -357,7 +357,7 @@ void MainWindow::ShutdownControllers()
void MainWindow::InitCoreCallbacks()
{
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [=](Core::State state) {
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
if (state == Core::State::Uninitialized)
OnStopComplete();
if (state != Core::State::Uninitialized && NetPlay::IsNetPlayRunning() && m_controllers_window)
@ -374,7 +374,7 @@ void MainWindow::InitCoreCallbacks()
// Handle file open events
auto* filter = new FileOpenEventFilter(QGuiApplication::instance());
connect(filter, &FileOpenEventFilter::fileOpened, this, [=](const QString& file_name) {
connect(filter, &FileOpenEventFilter::fileOpened, this, [this](const QString& file_name) {
StartGame(BootParameters::GenerateFromFile(file_name.toStdString()));
});
}

View File

@ -85,7 +85,7 @@ MenuBar::MenuBar(QWidget* parent) : QMenuBar(parent)
AddHelpMenu();
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state); });
[=, this](Core::State state) { OnEmulationStateChanged(state); });
connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this,
[this] { OnEmulationStateChanged(Core::GetState()); });
@ -338,7 +338,7 @@ void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
{
QAction* action = m_state_load_slots_menu->addAction(QString{});
connect(action, &QAction::triggered, this, [=]() { emit StateLoadSlotAt(i); });
connect(action, &QAction::triggered, this, [=, this]() { emit StateLoadSlotAt(i); });
}
}
@ -355,7 +355,7 @@ void MenuBar::AddStateSaveMenu(QMenu* emu_menu)
{
QAction* action = m_state_save_slots_menu->addAction(QString{});
connect(action, &QAction::triggered, this, [=]() { emit StateSaveSlotAt(i); });
connect(action, &QAction::triggered, this, [=, this]() { emit StateSaveSlotAt(i); });
}
}
@ -372,7 +372,7 @@ void MenuBar::AddStateSlotMenu(QMenu* emu_menu)
if (Settings::Instance().GetStateSlot() == i)
action->setChecked(true);
connect(action, &QAction::triggered, this, [=]() { emit SetStateSlot(i); });
connect(action, &QAction::triggered, this, [=, this]() { emit SetStateSlot(i); });
}
}

View File

@ -368,7 +368,7 @@ void NetPlayDialog::ConnectWidgets()
}
});
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [=](Core::State state) {
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
if (isVisible())
{
GameStatusChanged(state != Core::State::Uninitialized);

View File

@ -35,8 +35,9 @@ AudioPane::AudioPane()
ConnectWidgets();
connect(&Settings::Instance(), &Settings::VolumeChanged, this, &AudioPane::OnVolumeChanged);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
}

View File

@ -213,8 +213,9 @@ void InterfacePane::ConnectLayout()
connect(m_checkbox_disable_screensaver, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_combobox_theme, qOverload<int>(&QComboBox::currentIndexChanged), this,
[=](int index) { Settings::Instance().SetThemeName(m_combobox_theme->itemText(index)); });
connect(
m_combobox_theme, qOverload<int>(&QComboBox::currentIndexChanged), this,
[this](int index) { Settings::Instance().SetThemeName(m_combobox_theme->itemText(index)); });
connect(m_combobox_userstyle, qOverload<int>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig);
connect(m_combobox_language, qOverload<int>(&QComboBox::currentIndexChanged), this,

View File

@ -196,7 +196,7 @@ QGridLayout* PathPane::MakePathsLayout()
m_dump_edit = new QLineEdit(QString::fromStdString(File::GetUserPath(D_DUMP_IDX)));
connect(m_dump_edit, &QLineEdit::editingFinished,
[=] { Config::SetBase(Config::MAIN_DUMP_PATH, m_dump_edit->text().toStdString()); });
[this] { Config::SetBase(Config::MAIN_DUMP_PATH, m_dump_edit->text().toStdString()); });
QPushButton* dump_open = new NonDefaultQPushButton(QStringLiteral("..."));
connect(dump_open, &QPushButton::clicked, this, &PathPane::BrowseDump);
layout->addWidget(new QLabel(tr("Dump Path:")), 2, 0);
@ -205,7 +205,7 @@ QGridLayout* PathPane::MakePathsLayout()
m_load_edit = new QLineEdit(QString::fromStdString(File::GetUserPath(D_LOAD_IDX)));
connect(m_load_edit, &QLineEdit::editingFinished,
[=] { Config::SetBase(Config::MAIN_LOAD_PATH, m_load_edit->text().toStdString()); });
[this] { Config::SetBase(Config::MAIN_LOAD_PATH, m_load_edit->text().toStdString()); });
QPushButton* load_open = new NonDefaultQPushButton(QStringLiteral("..."));
connect(load_open, &QPushButton::clicked, this, &PathPane::BrowseLoad);
layout->addWidget(new QLabel(tr("Load Path:")), 3, 0);
@ -214,7 +214,7 @@ QGridLayout* PathPane::MakePathsLayout()
m_resource_pack_edit =
new QLineEdit(QString::fromStdString(File::GetUserPath(D_RESOURCEPACK_IDX)));
connect(m_resource_pack_edit, &QLineEdit::editingFinished, [=] {
connect(m_resource_pack_edit, &QLineEdit::editingFinished, [this] {
Config::SetBase(Config::MAIN_RESOURCEPACK_PATH, m_resource_pack_edit->text().toStdString());
});
QPushButton* resource_pack_open = new NonDefaultQPushButton(QStringLiteral("..."));
@ -225,7 +225,7 @@ QGridLayout* PathPane::MakePathsLayout()
m_wfs_edit = new QLineEdit(QString::fromStdString(File::GetUserPath(D_WFSROOT_IDX)));
connect(m_load_edit, &QLineEdit::editingFinished,
[=] { Config::SetBase(Config::MAIN_WFS_PATH, m_wfs_edit->text().toStdString()); });
[this] { Config::SetBase(Config::MAIN_WFS_PATH, m_wfs_edit->text().toStdString()); });
QPushButton* wfs_open = new NonDefaultQPushButton(QStringLiteral("..."));
connect(wfs_open, &QPushButton::clicked, this, &PathPane::BrowseWFS);
layout->addWidget(new QLabel(tr("WFS Path:")), 5, 0);

View File

@ -107,8 +107,9 @@ void WiiPane::ConnectLayout()
connect(m_wiimote_motor, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
// Emulation State
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
}
void WiiPane::CreateMisc()