Permalink
Browse files
Qt: Disable "New multiplayer window" when MAX_GBAS is reached.
- Loading branch information...
Showing
with
12 additions
and
3 deletions.
-
+6
−0
src/platform/qt/GBAApp.cpp
-
+3
−3
src/platform/qt/Window.cpp
-
+3
−0
src/platform/qt/Window.h
|
|
@@ -127,13 +127,19 @@ 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);
|
|
|
w->loadConfig();
|
|
|
w->show();
|
|
|
w->controller()->setMultiplayerController(&m_multiplayer);
|
|
|
w->multiplayerChanged();
|
|
|
+ for (Window* w : m_windows) {
|
|
|
+ w->updateMultiplayerStatus(m_windows.count() < MAX_GBAS);
|
|
|
+ }
|
|
|
return w;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1088,11 +1088,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();
|
|
|
|
|
|
@@ -49,6 +49,8 @@ Q_OBJECT |
|
|
|
|
|
void resizeFrame(const QSize& size);
|
|
|
|
|
|
+ void updateMultiplayerStatus(bool canOpenAnother) { m_multiWindow->setEnabled(canOpenAnother); }
|
|
|
+
|
|
|
signals:
|
|
|
void startDrawing(mCoreThread*);
|
|
|
void shutdown();
|
|
|
@@ -160,6 +162,7 @@ private slots: |
|
|
#ifdef M_CORE_GBA
|
|
|
QList<QAction*> m_gbaActions;
|
|
|
#endif
|
|
|
+ QAction* m_multiWindow;
|
|
|
QMap<int, QAction*> m_frameSizes;
|
|
|
LogController m_log;
|
|
|
LogView* m_logView;
|
|
|
|
0 comments on commit
11afd59