diff --git a/src/platform/qt/GBAApp.cpp b/src/platform/qt/GBAApp.cpp index 2a4849c49..20c19c027 100644 --- a/src/platform/qt/GBAApp.cpp +++ b/src/platform/qt/GBAApp.cpp @@ -118,6 +118,9 @@ Window* GBAApp::newWindow() { int windowId = m_multiplayer.attached(); connect(w, &Window::destroyed, [this, w]() { m_windows.removeAll(w); + for (Window* w : m_windows) { + w->updateMultiplayerStatus(m_windows.count() < MAX_GBAS); + } }); m_windows.append(w); w->setAttribute(Qt::WA_DeleteOnClose); @@ -125,6 +128,9 @@ Window* GBAApp::newWindow() { w->show(); w->controller()->setMultiplayerController(&m_multiplayer); w->multiplayerChanged(); + for (Window* w : m_windows) { + w->updateMultiplayerStatus(m_windows.count() < MAX_GBAS); + } return w; } diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 755805087..c34f40c4a 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -1024,11 +1024,11 @@ void Window::setupMenu(QMenuBar* menubar) { #endif fileMenu->addSeparator(); - QAction* multiWindow = new QAction(tr("New multiplayer window"), fileMenu); - connect(multiWindow, &QAction::triggered, [this]() { + m_multiWindow = new QAction(tr("New multiplayer window"), fileMenu); + connect(m_multiWindow, &QAction::triggered, [this]() { GBAApp::app()->newWindow(); }); - addControlledAction(fileMenu, multiWindow, "multiWindow"); + addControlledAction(fileMenu, m_multiWindow, "multiWindow"); #ifndef Q_OS_MAC fileMenu->addSeparator(); diff --git a/src/platform/qt/Window.h b/src/platform/qt/Window.h index a2e6ca23d..756293615 100644 --- a/src/platform/qt/Window.h +++ b/src/platform/qt/Window.h @@ -50,6 +50,8 @@ public: void resizeFrame(const QSize& size); + void updateMultiplayerStatus(bool canOpenAnother) { m_multiWindow->setEnabled(canOpenAnother); } + signals: void startDrawing(mCoreThread*); void shutdown(); @@ -160,6 +162,7 @@ private: #ifdef M_CORE_GBA QList m_gbaActions; #endif + QAction* m_multiWindow; QMap m_frameSizes; LogController m_log; LogView* m_logView;