mirror of https://github.com/mgba-emu/mgba.git
Qt: Only allow one Frame Inspector to be open
This commit is contained in:
parent
42818c764d
commit
f2134e6b62
|
@ -1470,7 +1470,21 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
addGameAction(tr("View &map..."), "mapWindow", openControllerTView<MapView>(), "tools");
|
addGameAction(tr("View &map..."), "mapWindow", openControllerTView<MapView>(), "tools");
|
||||||
|
|
||||||
#ifdef M_CORE_GBA
|
#ifdef M_CORE_GBA
|
||||||
Action* frameWindow = addGameAction(tr("&Frame inspector..."), "frameWindow", openControllerTView<FrameView>(), "tools");
|
Action* frameWindow = addGameAction(tr("&Frame inspector..."), "frameWindow", [this]() {
|
||||||
|
if (!m_frameView) {
|
||||||
|
m_frameView = new FrameView(m_controller);
|
||||||
|
connect(this, &Window::shutdown, this, [this]() {
|
||||||
|
if (m_frameView) {
|
||||||
|
m_frameView->close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(m_frameView, &QObject::destroyed, this, [this]() {
|
||||||
|
m_frameView = nullptr;
|
||||||
|
});
|
||||||
|
m_frameView->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
}
|
||||||
|
m_frameView->show();
|
||||||
|
}, "tools");
|
||||||
m_platformActions.insert(PLATFORM_GBA, frameWindow);
|
m_platformActions.insert(PLATFORM_GBA, frameWindow);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ class CoreController;
|
||||||
class CoreManager;
|
class CoreManager;
|
||||||
class DebuggerConsoleController;
|
class DebuggerConsoleController;
|
||||||
class Display;
|
class Display;
|
||||||
|
class FrameView;
|
||||||
class GDBController;
|
class GDBController;
|
||||||
class GIFView;
|
class GIFView;
|
||||||
class LibraryController;
|
class LibraryController;
|
||||||
|
@ -215,6 +216,7 @@ private:
|
||||||
|
|
||||||
std::unique_ptr<OverrideView> m_overrideView;
|
std::unique_ptr<OverrideView> m_overrideView;
|
||||||
std::unique_ptr<SensorView> m_sensorView;
|
std::unique_ptr<SensorView> m_sensorView;
|
||||||
|
FrameView* m_frameView = nullptr;
|
||||||
|
|
||||||
#ifdef USE_FFMPEG
|
#ifdef USE_FFMPEG
|
||||||
VideoView* m_videoView = nullptr;
|
VideoView* m_videoView = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue