HostInterface: Add a ConfirmMessage() method

This commit is contained in:
Connor McLaughlin
2020-02-26 19:25:57 +10:00
parent 8ffdcf1b7e
commit e9dea6e0f7
8 changed files with 62 additions and 3 deletions

View File

@ -35,7 +35,7 @@ MainWindow::~MainWindow()
void MainWindow::reportError(const QString& message)
{
QMessageBox::critical(nullptr, tr("DuckStation Error"), message, QMessageBox::Ok);
QMessageBox::critical(this, tr("DuckStation"), message, QMessageBox::Ok);
}
void MainWindow::reportMessage(const QString& message)
@ -43,6 +43,11 @@ void MainWindow::reportMessage(const QString& message)
m_ui.statusBar->showMessage(message, 2000);
}
bool MainWindow::confirmMessage(const QString& message)
{
return (QMessageBox::question(this, tr("DuckStation"), message) == QMessageBox::Yes);
}
void MainWindow::createDisplayWindow(QThread* worker_thread, bool use_debug_device)
{
DebugAssert(!m_display_widget);
@ -336,12 +341,14 @@ void MainWindow::connectSignals()
connect(m_host_interface, &QtHostInterface::errorReported, this, &MainWindow::reportError,
Qt::BlockingQueuedConnection);
connect(m_host_interface, &QtHostInterface::messageReported, this, &MainWindow::reportMessage);
connect(m_host_interface, &QtHostInterface::messageConfirmed, this, &MainWindow::confirmMessage,
Qt::BlockingQueuedConnection);
connect(m_host_interface, &QtHostInterface::createDisplayWindowRequested, this, &MainWindow::createDisplayWindow,
Qt::BlockingQueuedConnection);
connect(m_host_interface, &QtHostInterface::destroyDisplayWindowRequested, this, &MainWindow::destroyDisplayWindow);
connect(m_host_interface, &QtHostInterface::setFullscreenRequested, this, &MainWindow::setFullscreen);
connect(m_host_interface, &QtHostInterface::toggleFullscreenRequested, this, &MainWindow::toggleFullscreen);
connect(m_host_interface, &QtHostInterface::messageReported, this, &MainWindow::reportMessage);
connect(m_host_interface, &QtHostInterface::emulationStarted, this, &MainWindow::onEmulationStarted);
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);
connect(m_host_interface, &QtHostInterface::emulationPaused, this, &MainWindow::onEmulationPaused);