all repos — mgba @ 4dbebe870295b1d222f9df9672c2aa614ebda418

mGBA Game Boy Advance Emulator

Qt: Open a message box for Qt frontend errors
Vicki Pfau vi@endrift.com
Sat, 04 May 2019 16:03:18 -0700
commit

4dbebe870295b1d222f9df9672c2aa614ebda418

parent

46c135b4f90d2ad312f5129db15fbbac7bf083d7

3 files changed, 11 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -52,6 +52,7 @@ - Qt: Cap window size on start to monitor size

- GBA BIOS: Add timings for HLE BIOS math functions (fixes mgba.io/i/1396) - Debugger: Make tracing compatible with breakpoints/watchpoints - Debugger: Print breakpoint/watchpoint number when inserting + - Qt: Open a message box for Qt frontend errors 0.7.1: (2019-02-24) Bugfixes:
M src/platform/qt/LogController.cppsrc/platform/qt/LogController.cpp

@@ -5,11 +5,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this

* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "LogController.h" +#include <QMessageBox> + #include "ConfigController.h" using namespace QGBA; LogController LogController::s_global(mLOG_ALL); +int LogController::s_qtCat{-1}; LogController::LogController(int levels, QObject* parent) : QObject(parent)

@@ -18,6 +21,7 @@ mLogFilterInit(&m_filter);

mLogFilterSet(&m_filter, "gba.bios", mLOG_STUB | mLOG_FATAL); mLogFilterSet(&m_filter, "core.status", mLOG_ALL & ~mLOG_DEBUG); m_filter.defaultLevels = levels; + s_qtCat = mLogCategoryById("platform.qt"); if (this != &s_global) { connect(&s_global, &LogController::logPosted, this, &LogController::postLog);

@@ -64,6 +68,11 @@ }

if (m_logToFile && m_logStream) { *m_logStream << line << endl; } + } + if (category == s_qtCat && level == mLOG_ERROR && this == &s_global) { + QMessageBox* dialog = new QMessageBox(QMessageBox::Critical, tr("An error occurred"), string, QMessageBox::Ok); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); } emit logPosted(level, category, string); }
M src/platform/qt/LogController.hsrc/platform/qt/LogController.h

@@ -85,6 +85,7 @@ std::unique_ptr<QFile> m_logFile;

std::unique_ptr<QTextStream> m_logStream; static LogController s_global; + static int s_qtCat; }; #define LOG(C, L) (*LogController::global())(mLOG_ ## L, _mLOG_CAT_ ## C)