Merge pull request #8468 from CookiePLMonster/exit-dialog-fix
UI: Fixes for exit dialog
This commit is contained in:
commit
b2cc3af350
|
@ -30,6 +30,7 @@
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "Common/ScopeGuard.h"
|
||||||
#include "Common/Version.h"
|
#include "Common/Version.h"
|
||||||
#include "Common/WindowSystemInfo.h"
|
#include "Common/WindowSystemInfo.h"
|
||||||
|
|
||||||
|
@ -785,6 +786,11 @@ bool MainWindow::RequestStop()
|
||||||
|
|
||||||
if (SConfig::GetInstance().bConfirmStop)
|
if (SConfig::GetInstance().bConfirmStop)
|
||||||
{
|
{
|
||||||
|
if (std::exchange(m_stop_confirm_showing, true))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Common::ScopeGuard confirm_lock([this] { m_stop_confirm_showing = false; });
|
||||||
|
|
||||||
const Core::State state = Core::GetState();
|
const Core::State state = Core::GetState();
|
||||||
|
|
||||||
// Only pause the game, if NetPlay is not running
|
// Only pause the game, if NetPlay is not running
|
||||||
|
@ -798,7 +804,8 @@ bool MainWindow::RequestStop()
|
||||||
m_stop_requested ? tr("A shutdown is already in progress. Unsaved data "
|
m_stop_requested ? tr("A shutdown is already in progress. Unsaved data "
|
||||||
"may be lost if you stop the current emulation "
|
"may be lost if you stop the current emulation "
|
||||||
"before it completes. Force stop?") :
|
"before it completes. Force stop?") :
|
||||||
tr("Do you want to stop the current emulation?"));
|
tr("Do you want to stop the current emulation?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, Qt::ApplicationModal);
|
||||||
|
|
||||||
if (confirm != QMessageBox::Yes)
|
if (confirm != QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,6 +198,7 @@ private:
|
||||||
GameList* m_game_list;
|
GameList* m_game_list;
|
||||||
RenderWidget* m_render_widget = nullptr;
|
RenderWidget* m_render_widget = nullptr;
|
||||||
bool m_rendering_to_main;
|
bool m_rendering_to_main;
|
||||||
|
bool m_stop_confirm_showing = false;
|
||||||
bool m_stop_requested = false;
|
bool m_stop_requested = false;
|
||||||
bool m_exit_requested = false;
|
bool m_exit_requested = false;
|
||||||
bool m_fullscreen_requested = false;
|
bool m_fullscreen_requested = false;
|
||||||
|
|
|
@ -19,9 +19,10 @@ ModalMessageBox::ModalMessageBox(QWidget* parent, Qt::WindowModality modality)
|
||||||
|
|
||||||
static inline int ExecMessageBox(ModalMessageBox::Icon icon, QWidget* parent, const QString& title,
|
static inline int ExecMessageBox(ModalMessageBox::Icon icon, QWidget* parent, const QString& title,
|
||||||
const QString& text, ModalMessageBox::StandardButtons buttons,
|
const QString& text, ModalMessageBox::StandardButtons buttons,
|
||||||
ModalMessageBox::StandardButton default_button)
|
ModalMessageBox::StandardButton default_button,
|
||||||
|
Qt::WindowModality modality)
|
||||||
{
|
{
|
||||||
ModalMessageBox msg(parent);
|
ModalMessageBox msg(parent, modality);
|
||||||
msg.setIcon(icon);
|
msg.setIcon(icon);
|
||||||
msg.setWindowTitle(title);
|
msg.setWindowTitle(title);
|
||||||
msg.setText(text);
|
msg.setText(text);
|
||||||
|
@ -32,25 +33,33 @@ static inline int ExecMessageBox(ModalMessageBox::Icon icon, QWidget* parent, co
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModalMessageBox::critical(QWidget* parent, const QString& title, const QString& text,
|
int ModalMessageBox::critical(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons, StandardButton default_button)
|
StandardButtons buttons, StandardButton default_button,
|
||||||
|
Qt::WindowModality modality)
|
||||||
{
|
{
|
||||||
return ExecMessageBox(QMessageBox::Critical, parent, title, text, buttons, default_button);
|
return ExecMessageBox(QMessageBox::Critical, parent, title, text, buttons, default_button,
|
||||||
|
modality);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModalMessageBox::information(QWidget* parent, const QString& title, const QString& text,
|
int ModalMessageBox::information(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons, StandardButton default_button)
|
StandardButtons buttons, StandardButton default_button,
|
||||||
|
Qt::WindowModality modality)
|
||||||
{
|
{
|
||||||
return ExecMessageBox(QMessageBox::Information, parent, title, text, buttons, default_button);
|
return ExecMessageBox(QMessageBox::Information, parent, title, text, buttons, default_button,
|
||||||
|
modality);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModalMessageBox::question(QWidget* parent, const QString& title, const QString& text,
|
int ModalMessageBox::question(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons, StandardButton default_button)
|
StandardButtons buttons, StandardButton default_button,
|
||||||
|
Qt::WindowModality modality)
|
||||||
{
|
{
|
||||||
return ExecMessageBox(QMessageBox::Warning, parent, title, text, buttons, default_button);
|
return ExecMessageBox(QMessageBox::Warning, parent, title, text, buttons, default_button,
|
||||||
|
modality);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModalMessageBox::warning(QWidget* parent, const QString& title, const QString& text,
|
int ModalMessageBox::warning(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons, StandardButton default_button)
|
StandardButtons buttons, StandardButton default_button,
|
||||||
|
Qt::WindowModality modality)
|
||||||
{
|
{
|
||||||
return ExecMessageBox(QMessageBox::Warning, parent, title, text, buttons, default_button);
|
return ExecMessageBox(QMessageBox::Warning, parent, title, text, buttons, default_button,
|
||||||
|
modality);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,15 @@ public:
|
||||||
explicit ModalMessageBox(QWidget* parent, Qt::WindowModality modality = Qt::WindowModal);
|
explicit ModalMessageBox(QWidget* parent, Qt::WindowModality modality = Qt::WindowModal);
|
||||||
|
|
||||||
static int critical(QWidget* parent, const QString& title, const QString& text,
|
static int critical(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
|
StandardButtons buttons = Ok, StandardButton default_button = NoButton,
|
||||||
|
Qt::WindowModality modality = Qt::WindowModal);
|
||||||
static int information(QWidget* parent, const QString& title, const QString& text,
|
static int information(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
|
StandardButtons buttons = Ok, StandardButton default_button = NoButton,
|
||||||
|
Qt::WindowModality modality = Qt::WindowModal);
|
||||||
static int question(QWidget* parent, const QString& title, const QString& text,
|
static int question(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons = Yes | No, StandardButton default_button = NoButton);
|
StandardButtons buttons = Yes | No, StandardButton default_button = NoButton,
|
||||||
|
Qt::WindowModality modality = Qt::WindowModal);
|
||||||
static int warning(QWidget* parent, const QString& title, const QString& text,
|
static int warning(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
|
StandardButtons buttons = Ok, StandardButton default_button = NoButton,
|
||||||
|
Qt::WindowModality modality = Qt::WindowModal);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue