Skip to content

Commit

Permalink
Qt: Fix settings window focusing
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Dec 17, 2023
1 parent bf85692 commit aef8bfc
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions pcsx2-qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit aef8bfc

Please sign in to comment.