Qt: Fix settings window focusing

This commit is contained in:
Stenzek 2023-12-17 13:53:47 +10:00 committed by Connor McLaughlin
parent 9436a823ba
commit 4afe14dff7
1 changed files with 23 additions and 16 deletions

View File

@ -985,11 +985,10 @@ bool MainWindow::shouldAbortForMemcardBusy(const VMLock& lock)
if (MemcardBusy::IsBusy() && !GSDumpReplayer::IsReplayingDump())
{
const QMessageBox::StandardButton res = QMessageBox::question(
lock.getDialogParent(),
tr("WARNING: Memory Card Busy"),
tr("WARNING: Your memory card is still writing data. Shutting down now will IRREVERSIBLY DESTROY YOUR MEMORY CARD. It is strongly recommended to resume your game and let it finish writing to your memory card.\n\nDo you wish to shutdown anyways and IRREVERSIBLY DESTROY YOUR MEMORY CARD?")
);
lock.getDialogParent(),
tr("WARNING: Memory Card Busy"),
tr("WARNING: Your memory card is still writing data. Shutting down now will IRREVERSIBLY DESTROY YOUR MEMORY CARD. It is strongly recommended to resume your game and let it finish writing to your memory card.\n\nDo you wish to shutdown anyways and IRREVERSIBLY DESTROY YOUR MEMORY CARD?"));
if (res != QMessageBox::Yes)
{
return true;
@ -1097,7 +1096,7 @@ bool MainWindow::requestShutdown(bool allow_confirm, bool allow_save_to_state, b
{
return false;
}
// Only confirm on UI thread because we need to display a msgbox.
if (!m_is_closing && allow_confirm && !GSDumpReplayer::IsReplayingDump() && Host::GetBoolSettingValue("UI", "ConfirmShutdown", true))
{
@ -2383,10 +2382,16 @@ SettingsWindow* MainWindow::getSettingsWindow()
void MainWindow::doSettings(const char* category /* = nullptr */)
{
SettingsWindow* dlg = getSettingsWindow();
if (dlg->isVisible())
dlg->raise();
else
if (!dlg->isVisible())
{
dlg->show();
}
else
{
dlg->raise();
dlg->activateWindow();
dlg->setFocus();
}
if (category)
dlg->setCategory(category);
@ -2409,19 +2414,21 @@ void MainWindow::openDebugger()
void MainWindow::doControllerSettings(ControllerSettingsWindow::Category category)
{
if (m_controller_settings_window)
if (!m_controller_settings_window)
m_controller_settings_window = new ControllerSettingsWindow();
if (!m_controller_settings_window->isVisible())
{
if (m_controller_settings_window->isVisible())
m_controller_settings_window->raise();
else
m_controller_settings_window->show();
m_controller_settings_window->show();
}
else
{
m_controller_settings_window = new ControllerSettingsWindow();
m_controller_settings_window->show();
m_controller_settings_window->raise();
m_controller_settings_window->activateWindow();
m_controller_settings_window->setFocus();
}
if (category != ControllerSettingsWindow::Category::Count)
m_controller_settings_window->setCategory(category);
}