Qt: Fix regression with sensor view not getting attached
Vicki Pfau vi@endrift.com
Sat, 29 Jul 2017 21:59:30 -0700
3 files changed,
20 insertions(+),
5 deletions(-)
M
src/platform/qt/SensorView.cpp
→
src/platform/qt/SensorView.cpp
@@ -68,6 +68,7 @@ });
connect(m_ui.timeFakeEpoch, &QRadioButton::clicked, [controller, this] () { controller->setFakeEpoch(m_ui.time->dateTime()); }); + m_ui.timeButtons->checkedButton()->clicked(); connect(controller.get(), &CoreController::stopping, [this]() { m_controller.reset();
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -147,7 +147,6 @@ }
Window::~Window() { delete m_logView; - delete m_overrideView; #ifdef USE_FFMPEG delete m_videoView;@@ -1414,18 +1413,27 @@
QAction* overrides = new QAction(tr("Game &overrides..."), toolsMenu); connect(overrides, &QAction::triggered, [this]() { if (!m_overrideView) { - m_overrideView = new OverrideView(m_config); + m_overrideView = std::move(std::make_unique<OverrideView>(m_config)); if (m_controller) { m_overrideView->setController(m_controller); } - connect(this, &Window::shutdown, m_overrideView, &QWidget::close); + connect(this, &Window::shutdown, m_overrideView.get(), &QWidget::close); } m_overrideView->show(); }); addControlledAction(toolsMenu, overrides, "overrideWindow"); QAction* sensors = new QAction(tr("Game &Pak sensors..."), toolsMenu); - connect(sensors, &QAction::triggered, openTView<SensorView, InputController*>(&m_inputController)); + connect(sensors, &QAction::triggered, [this]() { + if (!m_sensorView) { + m_sensorView = std::move(std::make_unique<SensorView>(&m_inputController)); + if (m_controller) { + m_sensorView->setController(m_controller); + } + connect(this, &Window::shutdown, m_sensorView.get(), &QWidget::close); + } + m_sensorView->show(); + }); addControlledAction(toolsMenu, sensors, "sensorWindow"); QAction* cheats = new QAction(tr("&Cheats..."), toolsMenu);@@ -1784,6 +1792,10 @@ if (m_videoView) {
m_videoView->setController(m_controller); } #endif + + if (m_sensorView) { + m_sensorView->setController(m_controller); + } if (m_overrideView) { m_overrideView->setController(m_controller);
M
src/platform/qt/Window.h
→
src/platform/qt/Window.h
@@ -34,6 +34,7 @@ class GIFView;
class LibraryController; class LogView; class OverrideView; +class SensorView; class ShaderSelector; class ShortcutController; class VideoView;@@ -200,7 +201,8 @@ QString m_pendingPatch;
bool m_hitUnimplementedBiosCall; - OverrideView* m_overrideView = nullptr; + std::unique_ptr<OverrideView> m_overrideView; + std::unique_ptr<SensorView> m_sensorView; #ifdef USE_FFMPEG VideoView* m_videoView = nullptr;