Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apply button to settings dialog #7545

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions rpcs3/rpcs3qt/game_list_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,15 +1059,16 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
connect(configure, &QAction::triggered, [=, this]()
{
settings_dialog dlg(m_gui_settings, m_emu_settings, 0, this, &currGame);
if (dlg.exec() == QDialog::Accepted)
connect(&dlg, &settings_dialog::EmuSettingsApplied, [this, gameinfo]()
{
if (!gameinfo->hasCustomConfig)
{
gameinfo->hasCustomConfig = true;
ShowCustomConfigIcon(gameinfo);
}
Q_EMIT NotifyEmuSettingsChange();
}
});
dlg.exec();
});
connect(pad_configure, &QAction::triggered, [=, this]()
{
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/rpcs3qt/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,8 @@ void main_window::CreateConnects()
connect(&dlg, &settings_dialog::GuiSettingsSyncRequest, this, &main_window::ConfigureGuiFromSettings);
connect(&dlg, &settings_dialog::GuiStylesheetRequest, this, &main_window::RequestGlobalStylesheetChange);
connect(&dlg, &settings_dialog::GuiRepaintRequest, this, &main_window::RepaintGui);
connect(&dlg, &settings_dialog::accepted, this, &main_window::NotifyEmuSettingsChange);
connect(&dlg, &settings_dialog::accepted, m_logFrame, &log_frame::LoadSettings);
connect(&dlg, &settings_dialog::EmuSettingsApplied, this, &main_window::NotifyEmuSettingsChange);
connect(&dlg, &settings_dialog::EmuSettingsApplied, m_logFrame, &log_frame::LoadSettings);
dlg.exec();
};

Expand Down
25 changes: 22 additions & 3 deletions rpcs3/rpcs3qt/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
m_discord_state = xgui_settings->GetValue(gui::m_discordState).toString();

// Various connects
connect(ui->buttonBox, &QDialogButtonBox::accepted, [this, use_discord_old = m_use_discord, discord_state_old = m_discord_state]

const auto apply_configs = [this, use_discord_old = m_use_discord, discord_state_old = m_discord_state](bool do_exit)
{
std::set<std::string> selectedlle;
for (int i = 0; i<ui->lleList->count(); ++i)
for (int i = 0; i < ui->lleList->count(); ++i)
{
const auto& item = ui->lleList->item(i);
if (item->checkState() != Qt::CheckState::Unchecked)
Expand All @@ -106,7 +107,13 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
std::vector<std::string> selected_ls = std::vector<std::string>(selectedlle.begin(), selectedlle.end());
xemu_settings->SaveSelectedLibraries(selected_ls);
xemu_settings->SaveSettings();
accept();

if (do_exit)
{
accept();
}

Q_EMIT EmuSettingsApplied();

// Discord Settings can be saved regardless of WITH_DISCORD_RPC
xgui_settings->SetValue(gui::m_richPresence, m_use_discord);
Expand All @@ -130,6 +137,18 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
discord::update_presence(sstr(m_discord_state), "Idle", false);
}
#endif
};

connect(ui->buttonBox, &QDialogButtonBox::clicked, [=, this](QAbstractButton* button)
{
if (button == ui->buttonBox->button(QDialogButtonBox::Save))
{
apply_configs(true);
}
else if (button == ui->buttonBox->button(QDialogButtonBox::Apply))
{
apply_configs(false);
}
});

connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
Expand Down
1 change: 1 addition & 0 deletions rpcs3/rpcs3qt/settings_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class settings_dialog : public QDialog
void GuiStylesheetRequest(const QString& path);
void GuiSettingsSaveRequest();
void GuiRepaintRequest();
void EmuSettingsApplied();
private Q_SLOTS:
void OnBackupCurrentConfig();
void OnApplyConfig();
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/rpcs3qt/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3220,7 +3220,7 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
Expand Down