Qt: Allow overrides to be saved before a game is loaded
Vicki Pfau vi@endrift.com
Wed, 20 Sep 2017 22:39:45 -0700
3 files changed,
15 insertions(+),
5 deletions(-)
M
CHANGES
→
CHANGES
@@ -54,6 +54,7 @@ - Python: Integrate tests from cinema test suite
- Util: Don't build crc32 if the function already exists - GBA: Detect hardware for Pokémon FireRed ROM hacks - CMake: Fix CPack dependencies for libpng 1.6 + - Qt: Allow overrides to be saved before a game is loaded 0.6.0: (2017-07-16) Features:
M
src/platform/qt/OverrideView.cpp
→
src/platform/qt/OverrideView.cpp
@@ -85,7 +85,6 @@ #endif
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &OverrideView::saveOverride); connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close); - m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(false); } void OverrideView::setController(std::shared_ptr<CoreController> controller) {@@ -96,10 +95,16 @@ updateOverrides();
} void OverrideView::saveOverride() { - if (!m_config || !m_controller) { + if (!m_controller) { + m_savePending = true; return; } - m_config->saveOverride(*m_controller->override()); + + Override* override = m_controller->override(); + if (!override) { + return; + } + m_config->saveOverride(*override); } void OverrideView::updateOverrides() {@@ -176,7 +181,6 @@ CoreController::Interrupter interrupter(m_controller);
mCoreThread* thread = m_controller->thread(); m_ui.tabWidget->setEnabled(false); - m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(true); switch (thread->core->platform(thread->core)) { #ifdef M_CORE_GBA@@ -221,6 +225,11 @@ #endif
case PLATFORM_NONE: break; } + + if (m_savePending) { + m_savePending = false; + saveOverride(); + } } void OverrideView::gameStopped() {@@ -228,7 +237,6 @@ m_controller.reset();
m_ui.tabWidget->setEnabled(true); m_ui.savetype->setCurrentIndex(0); m_ui.idleLoop->clear(); - m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(false); m_ui.mbc->setCurrentIndex(0); m_ui.gbModel->setCurrentIndex(0);
M
src/platform/qt/OverrideView.h
→
src/platform/qt/OverrideView.h
@@ -47,6 +47,7 @@ Ui::OverrideView m_ui;
std::shared_ptr<CoreController> m_controller; ConfigController* m_config; + bool m_savePending = false; #ifdef M_CORE_GB uint32_t m_gbColors[4]{};