mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 07:39:45 -06:00
Merge pull request #11088 from JosJuice/uicommon-set-enable-alert
Move a SetEnableAlert call to UICommon
This commit is contained in:
@ -120,6 +120,13 @@ void SetBaseOrCurrent(const Info<T>& info, const std::common_type_t<T>& value)
|
||||
Set<T>(LayerType::CurrentRun, info, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DeleteKey(LayerType layer, const Info<T>& info)
|
||||
{
|
||||
if (GetLayer(layer)->DeleteKey(info.GetLocation()))
|
||||
OnConfigChanged();
|
||||
}
|
||||
|
||||
// Used to defer OnConfigChanged until after the completion of many config changes.
|
||||
class ConfigChangeCallbackGuard
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no
|
||||
|
||||
if (button == QMessageBox::Ignore)
|
||||
{
|
||||
Common::SetEnableAlert(false);
|
||||
Config::SetCurrent(Config::MAIN_USE_PANIC_HANDLERS, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -548,8 +548,7 @@ void MenuBar::AddOptionsMenu()
|
||||
m_reset_ignore_panic_handler = options_menu->addAction(tr("Reset Ignore Panic Handler"));
|
||||
|
||||
connect(m_reset_ignore_panic_handler, &QAction::triggered, this, []() {
|
||||
if (Config::Get(Config::MAIN_USE_PANIC_HANDLERS))
|
||||
Common::SetEnableAlert(true);
|
||||
Config::DeleteKey(Config::LayerType::CurrentRun, Config::MAIN_USE_PANIC_HANDLERS);
|
||||
});
|
||||
|
||||
m_change_font = options_menu->addAction(tr("&Font..."), this, &MenuBar::ChangeDebugFont);
|
||||
|
@ -309,8 +309,6 @@ void InterfacePane::OnSaveConfig()
|
||||
Config::SetBase(Config::MAIN_SHOW_ACTIVE_TITLE, m_checkbox_show_active_title->isChecked());
|
||||
Config::SetBase(Config::MAIN_PAUSE_ON_FOCUS_LOST, m_checkbox_pause_on_focus_lost->isChecked());
|
||||
|
||||
Common::SetEnableAlert(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
|
||||
|
||||
auto new_language = m_combobox_language->currentData().toString().toStdString();
|
||||
if (new_language != Config::Get(Config::MAIN_INTERFACE_LANGUAGE))
|
||||
{
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
namespace UICommon
|
||||
{
|
||||
static size_t s_config_changed_callback_id;
|
||||
|
||||
static void CreateDumpPath(std::string path)
|
||||
{
|
||||
if (!path.empty())
|
||||
@ -108,6 +110,12 @@ static void InitCustomPaths()
|
||||
#endif
|
||||
}
|
||||
|
||||
static void RefreshConfig()
|
||||
{
|
||||
Common::SetEnableAlert(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
|
||||
Common::SetAbortOnPanicAlert(Config::Get(Config::MAIN_ABORT_ON_PANIC_ALERT));
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
Core::RestoreWiiSettings(Core::RestoreReason::CrashRecovery);
|
||||
@ -120,12 +128,14 @@ void Init()
|
||||
Common::Log::LogManager::Init();
|
||||
VideoBackendBase::ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
|
||||
|
||||
Common::SetEnableAlert(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
|
||||
Common::SetAbortOnPanicAlert(Config::Get(Config::MAIN_ABORT_ON_PANIC_ALERT));
|
||||
s_config_changed_callback_id = Config::AddConfigChangedCallback(RefreshConfig);
|
||||
RefreshConfig();
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
Config::RemoveConfigChangedCallback(s_config_changed_callback_id);
|
||||
|
||||
GCAdapter::Shutdown();
|
||||
WiimoteReal::Shutdown();
|
||||
Common::Log::LogManager::Shutdown();
|
||||
|
Reference in New Issue
Block a user