Qt: Show warning if XQ audio is toggled while loaded (fixes #2295)

This commit is contained in:
Vicki Pfau 2022-02-20 20:37:22 -08:00
parent 7c8a06816b
commit 5b26099eac
5 changed files with 34 additions and 2 deletions

View File

@ -60,6 +60,7 @@ Misc:
- Qt: Add QOpenGLWidget cross-thread codepath for macOS (fixes mgba.io/i/1754)
- Qt: Enable -b for Boot BIOS menu option (fixes mgba.io/i/2074)
- Qt: Add tile range selection to tile viewer (closes mgba.io/i/2455)
- Qt: Show warning if XQ audio is toggled while loaded (fixes mgba.io/i/2295)
- Windows: Attach to console if present
- Vita: Add bilinear filtering option (closes mgba.io/i/344)

View File

@ -483,7 +483,6 @@ void SettingsView::updateConfig() {
saveSetting("logToStdout", m_ui.logToStdout);
saveSetting("logFile", m_ui.logFile);
saveSetting("useDiscordPresence", m_ui.useDiscordPresence);
saveSetting("gba.audioHle", m_ui.audioHle);
saveSetting("dynamicTitle", m_ui.dynamicTitle);
saveSetting("videoScale", m_ui.videoScale);
saveSetting("gba.forceGbp", m_ui.forceGbp);
@ -577,6 +576,12 @@ void SettingsView::updateConfig() {
emit languageChanged();
}
bool oldAudioHle = m_controller->getOption("gba.audioHle", "0") != "0";
if (oldAudioHle != m_ui.audioHle->isChecked()) {
saveSetting("gba.audioHle", m_ui.audioHle);
emit audioHleChanged();
}
if (m_ui.multiplayerAudioAll->isChecked()) {
m_controller->setQtOption("multiplayerAudio", "all");
} else if (m_ui.multiplayerAudio1->isChecked()) {

View File

@ -62,6 +62,7 @@ signals:
void pathsChanged();
void languageChanged();
void libraryCleared();
void audioHleChanged();
public slots:
void selectPage(Page);

View File

@ -156,6 +156,8 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi
m_focusCheck.setInterval(200);
m_mustRestart.setInterval(MUST_RESTART_TIMEOUT);
m_mustRestart.setSingleShot(true);
m_mustReset.setInterval(MUST_RESTART_TIMEOUT);
m_mustReset.setSingleShot(true);
m_shortcutController->setConfigController(m_config);
m_shortcutController->setActionMapper(&m_actions);
@ -534,11 +536,20 @@ void Window::openSettingsWindow(SettingsView::Page page) {
#endif
connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::reloadDisplayDriver);
connect(settingsWindow, &SettingsView::audioDriverChanged, this, &Window::reloadAudioDriver);
connect(settingsWindow, &SettingsView::cameraDriverChanged, this, &Window::mustRestart);
connect(settingsWindow, &SettingsView::cameraDriverChanged, this, &Window::mustReset);
connect(settingsWindow, &SettingsView::cameraChanged, &m_inputController, &InputController::setCamera);
connect(settingsWindow, &SettingsView::videoRendererChanged, this, &Window::changeRenderer);
connect(settingsWindow, &SettingsView::languageChanged, this, &Window::mustRestart);
connect(settingsWindow, &SettingsView::pathsChanged, this, &Window::reloadConfig);
connect(settingsWindow, &SettingsView::audioHleChanged, this, [this]() {
if (!m_controller) {
return;
}
if (m_controller->platform() != mPLATFORM_GBA) {
return;
}
mustReset();
});
#ifdef USE_SQLITE3
connect(settingsWindow, &SettingsView::libraryCleared, m_libraryView, &LibraryController::clear);
#endif
@ -1082,6 +1093,18 @@ void Window::mustRestart() {
dialog->show();
}
void Window::mustReset() {
if (m_mustReset.isActive() || !m_controller) {
return;
}
m_mustReset.start();
QMessageBox* dialog = new QMessageBox(QMessageBox::Warning, tr("Reset needed"),
tr("Some changes will not take effect until the game is reset."),
QMessageBox::Ok, this, Qt::Sheet);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
void Window::recordFrame() {
m_frameList.append(m_frameTimer.nsecsElapsed());
m_frameTimer.restart();

View File

@ -142,6 +142,7 @@ private slots:
void tryMakePortable();
void mustRestart();
void mustReset();
void recordFrame();
void showFPS();
@ -215,6 +216,7 @@ private:
QElapsedTimer m_frameTimer;
QTimer m_fpsTimer;
QTimer m_mustRestart;
QTimer m_mustReset;
QList<QString> m_mruFiles;
ShortcutController* m_shortcutController;
#if defined(BUILD_GL) || defined(BUILD_GLES2)