From 2694181811f3725e0d05cfed92d3def47e0af874 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 24 Jan 2020 14:51:30 +1000 Subject: [PATCH] Qt: Hook up HostInterface::Report{Error,Message} --- src/duckstation-qt/mainwindow.cpp | 13 +++++++++++++ src/duckstation-qt/mainwindow.h | 2 ++ src/duckstation-qt/qthostinterface.cpp | 8 ++++++-- src/duckstation-qt/qthostinterface.h | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 3e01f0f12..46727a669 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -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); diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 316134301..e79bae1fd 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -21,6 +21,8 @@ public: ~MainWindow(); private Q_SLOTS: + void reportError(QString message); + void reportMessage(QString message); void onEmulationStarting(); void onEmulationStarted(); void onEmulationStopped(); diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index a14aedf46..e485a717e 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -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() diff --git a/src/duckstation-qt/qthostinterface.h b/src/duckstation-qt/qthostinterface.h index 26dd5613d..9e69ad844 100644 --- a/src/duckstation-qt/qthostinterface.h +++ b/src/duckstation-qt/qthostinterface.h @@ -62,6 +62,8 @@ public: std::vector getHotkeyList() const; Q_SIGNALS: + void errorReported(QString message); + void messageReported(QString message); void emulationStarting(); void emulationStarted(); void emulationStopped();