Qt: Hook up HostInterface::Report{Error,Message}

This commit is contained in:
Connor McLaughlin 2020-01-24 14:51:30 +10:00
parent 19cd91a684
commit 2694181811
4 changed files with 23 additions and 2 deletions

View File

@ -30,6 +30,16 @@ MainWindow::~MainWindow()
m_host_interface->displayWidgetDestroyed();
}
void MainWindow::reportError(QString message)
{
QMessageBox::critical(nullptr, tr("DuckStation Error"), message, QMessageBox::Ok);
}
void MainWindow::reportMessage(QString message)
{
m_ui.statusBar->showMessage(message, 2000);
}
void MainWindow::onEmulationStarting()
{
switchToEmulationView();
@ -292,6 +302,9 @@ void MainWindow::connectSignals()
connect(m_ui.actionIssueTracker, &QAction::triggered, this, &MainWindow::onIssueTrackerActionTriggered);
connect(m_ui.actionAbout, &QAction::triggered, this, &MainWindow::onAboutActionTriggered);
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::emulationStarting, this, &MainWindow::onEmulationStarting);
connect(m_host_interface, &QtHostInterface::emulationStarted, this, &MainWindow::onEmulationStarted);
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);

View File

@ -21,6 +21,8 @@ public:
~MainWindow();
private Q_SLOTS:
void reportError(QString message);
void reportMessage(QString message);
void onEmulationStarting();
void onEmulationStarted();
void onEmulationStopped();

View File

@ -38,12 +38,16 @@ QtHostInterface::~QtHostInterface()
void QtHostInterface::ReportError(const char* message)
{
// QMessageBox::critical(nullptr, tr("DuckStation Error"), message, QMessageBox::Ok);
HostInterface::ReportError(message);
emit errorReported(QString::fromLocal8Bit(message));
}
void QtHostInterface::ReportMessage(const char* message)
{
// QMessageBox::information(nullptr, tr("DuckStation Information"), message, QMessageBox::Ok);
HostInterface::ReportMessage(message);
emit messageReported(QString::fromLocal8Bit(message));
}
void QtHostInterface::setDefaultSettings()

View File

@ -62,6 +62,8 @@ public:
std::vector<HotkeyInfo> getHotkeyList() const;
Q_SIGNALS:
void errorReported(QString message);
void messageReported(QString message);
void emulationStarting();
void emulationStarted();
void emulationStopped();