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

@ -987,8 +987,7 @@ bool MainWindow::shouldAbortForMemcardBusy(const VMLock& lock)
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?")
);
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)
{
@ -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,18 +2414,20 @@ void MainWindow::openDebugger()
void MainWindow::doControllerSettings(ControllerSettingsWindow::Category category)
{
if (m_controller_settings_window)
{
if (m_controller_settings_window->isVisible())
m_controller_settings_window->raise();
else
m_controller_settings_window->show();
}
else
{
if (!m_controller_settings_window)
m_controller_settings_window = new ControllerSettingsWindow();
if (!m_controller_settings_window->isVisible())
{
m_controller_settings_window->show();
}
else
{
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);