mirror of https://github.com/mgba-emu/mgba.git
Qt: Error dialog if a game fails to load
This commit is contained in:
parent
78002b4df7
commit
087810a125
|
@ -204,6 +204,7 @@ void GameController::openGame() {
|
||||||
|
|
||||||
if (!GBAThreadStart(&m_threadContext)) {
|
if (!GBAThreadStart(&m_threadContext)) {
|
||||||
m_gameOpen = false;
|
m_gameOpen = false;
|
||||||
|
emit gameFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ signals:
|
||||||
void gamePaused(GBAThread*);
|
void gamePaused(GBAThread*);
|
||||||
void gameUnpaused(GBAThread*);
|
void gameUnpaused(GBAThread*);
|
||||||
void gameCrashed(const QString& errorMessage);
|
void gameCrashed(const QString& errorMessage);
|
||||||
|
void gameFailed();
|
||||||
void stateLoaded(GBAThread*);
|
void stateLoaded(GBAThread*);
|
||||||
|
|
||||||
void postLog(int level, const QString& log);
|
void postLog(int level, const QString& log);
|
||||||
|
|
|
@ -83,6 +83,7 @@ Window::Window(ConfigController* config, QWidget* parent)
|
||||||
connect(m_controller, SIGNAL(postLog(int, const QString&)), m_logView, SLOT(postLog(int, const QString&)));
|
connect(m_controller, SIGNAL(postLog(int, const QString&)), m_logView, SLOT(postLog(int, const QString&)));
|
||||||
connect(m_controller, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(recordFrame()));
|
connect(m_controller, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(recordFrame()));
|
||||||
connect(m_controller, SIGNAL(gameCrashed(const QString&)), this, SLOT(gameCrashed(const QString&)));
|
connect(m_controller, SIGNAL(gameCrashed(const QString&)), this, SLOT(gameCrashed(const QString&)));
|
||||||
|
connect(m_controller, SIGNAL(gameFailed()), this, SLOT(gameFailed()));
|
||||||
connect(m_logView, SIGNAL(levelsSet(int)), m_controller, SLOT(setLogLevel(int)));
|
connect(m_logView, SIGNAL(levelsSet(int)), m_controller, SLOT(setLogLevel(int)));
|
||||||
connect(m_logView, SIGNAL(levelsEnabled(int)), m_controller, SLOT(enableLogLevel(int)));
|
connect(m_logView, SIGNAL(levelsEnabled(int)), m_controller, SLOT(enableLogLevel(int)));
|
||||||
connect(m_logView, SIGNAL(levelsDisabled(int)), m_controller, SLOT(disableLogLevel(int)));
|
connect(m_logView, SIGNAL(levelsDisabled(int)), m_controller, SLOT(disableLogLevel(int)));
|
||||||
|
@ -384,6 +385,14 @@ void Window::gameCrashed(const QString& errorMessage) {
|
||||||
crash->show();
|
crash->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::gameFailed() {
|
||||||
|
QMessageBox* fail = new QMessageBox(QMessageBox::Warning, tr("Couldn't Load"),
|
||||||
|
tr("Could not load game. Are you sure it's in the correct format?"),
|
||||||
|
QMessageBox::Ok, this, Qt::Sheet);
|
||||||
|
fail->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
fail->show();
|
||||||
|
}
|
||||||
|
|
||||||
void Window::redoLogo() {
|
void Window::redoLogo() {
|
||||||
if (m_controller->isLoaded()) {
|
if (m_controller->isLoaded()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -96,6 +96,7 @@ private slots:
|
||||||
void gameStarted(GBAThread*);
|
void gameStarted(GBAThread*);
|
||||||
void gameStopped();
|
void gameStopped();
|
||||||
void gameCrashed(const QString&);
|
void gameCrashed(const QString&);
|
||||||
|
void gameFailed();
|
||||||
void redoLogo();
|
void redoLogo();
|
||||||
|
|
||||||
void recordFrame();
|
void recordFrame();
|
||||||
|
|
Loading…
Reference in New Issue