From e8b5127dacf0ba6251d913555ec9746986ff43b6 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Fri, 3 Jul 2015 00:05:55 -0700 Subject: [PATCH] Qt: Configurable display driver (requires restart) --- CHANGES | 1 + src/platform/qt/SettingsView.cpp | 21 +++++++++ src/platform/qt/SettingsView.h | 1 + src/platform/qt/SettingsView.ui | 79 +++++++++++++++++++------------- 4 files changed, 71 insertions(+), 31 deletions(-) diff --git a/CHANGES b/CHANGES index a64f20a8e..bdc51e5e6 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,7 @@ Features: - Ability to boot directly into the BIOS - Preliminary support for yanking out the game pak while a game is running - Thumb-drive mode by putting a file called portable.ini in the same folder + - Configurable display driver, between software and OpenGL Bugfixes: - ARM7: Fix SWI and IRQ timings - GBA Audio: Force audio FIFOs to 32-bit diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index b8fa8e9cf..5f288da37 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -7,6 +7,7 @@ #include "AudioProcessor.h" #include "ConfigController.h" +#include "Display.h" #include "GBAApp.h" using namespace QGBA; @@ -59,6 +60,19 @@ SettingsView::SettingsView(ConfigController* controller, QWidget* parent) } #endif + QVariant displayDriver = m_controller->getQtOption("displayDriver"); + m_ui.displayDriver->addItem(tr("Software (Qt)"), static_cast(Display::Driver::QT)); + if (!displayDriver.isNull() && displayDriver.toInt() == static_cast(Display::Driver::QT)) { + m_ui.displayDriver->setCurrentIndex(m_ui.displayDriver->count() - 1); + } + +#ifdef BUILD_GL + m_ui.displayDriver->addItem(tr("OpenGL"), static_cast(Display::Driver::OPENGL)); + if (displayDriver.isNull() || displayDriver.toInt() == static_cast(Display::Driver::OPENGL)) { + m_ui.displayDriver->setCurrentIndex(m_ui.displayDriver->count() - 1); + } +#endif + connect(m_ui.biosBrowse, SIGNAL(clicked()), this, SLOT(selectBios())); connect(m_ui.buttonBox, SIGNAL(accepted()), this, SLOT(updateConfig())); } @@ -108,6 +122,13 @@ void SettingsView::updateConfig() { emit audioDriverChanged(); } + QVariant displayDriver = m_ui.displayDriver->itemData(m_ui.displayDriver->currentIndex()); + if (displayDriver != m_controller->getQtOption("displayDriver")) { + m_controller->setQtOption("displayDriver", displayDriver); + Display::setDriver(static_cast(displayDriver.toInt())); + emit displayDriverChanged(); + } + m_controller->write(); emit biosLoaded(m_ui.bios->text()); diff --git a/src/platform/qt/SettingsView.h b/src/platform/qt/SettingsView.h index bf480272e..782e20e63 100644 --- a/src/platform/qt/SettingsView.h +++ b/src/platform/qt/SettingsView.h @@ -23,6 +23,7 @@ public: signals: void biosLoaded(const QString&); void audioDriverChanged(); + void displayDriverChanged(); private slots: void selectBios(); diff --git a/src/platform/qt/SettingsView.ui b/src/platform/qt/SettingsView.ui index 077ebf807..9de1f76e4 100644 --- a/src/platform/qt/SettingsView.ui +++ b/src/platform/qt/SettingsView.ui @@ -6,7 +6,7 @@ 0 0 - 673 + 698 366 @@ -140,30 +140,12 @@ - + - Sync: + Display driver: - - - - - - Video - - - - - - - Audio - - - - - @@ -230,27 +212,52 @@ + + + + Sync: + + + + + + + + Video + + + + + + + Audio + + + + + + Lock aspect ratio - + Resample video - - - - Suspend screensaver - - - true + + + + + 0 + 0 + @@ -387,14 +394,24 @@ - + + + + Suspend screensaver + + + true + + + + Idle loops - +