use new signals slots syntax

This commit is contained in:
2026-04-24 22:29:13 +02:00
parent 409ec93d7d
commit b21fc352b4
5 changed files with 35 additions and 34 deletions

View File

@@ -41,43 +41,43 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir, QWidget* p
bottomLayout->addWidget(m_buildButtonGrid, 1);
// Signals: game world → other panels
connect(m_gameWorldView, SIGNAL(selectionChanged(std::vector<EntityId>)),
m_selectedBuildingPanel, SLOT(onSelectionChanged(std::vector<EntityId>)));
connect(m_gameWorldView, &GameWorldView::selectionChanged,
m_selectedBuildingPanel, &SelectedBuildingPanel::onSelectionChanged);
connect(m_gameWorldView, SIGNAL(stateUpdated(Tick, int, double)),
m_headerBar, SLOT(onStateUpdated(Tick, int, double)));
connect(m_gameWorldView, &GameWorldView::stateUpdated,
m_headerBar, &HeaderBar::onStateUpdated);
connect(m_gameWorldView, SIGNAL(stateUpdated(Tick, int, double)),
this, SLOT(onStateUpdated(Tick, int, double))); // for affordability
connect(m_gameWorldView, &GameWorldView::stateUpdated,
this, &MainWindow::onStateUpdated); // for affordability
connect(m_gameWorldView, SIGNAL(stateUpdated(Tick, int, double)),
m_selectedBuildingPanel, SLOT(onStateUpdated(Tick, int, double)));
connect(m_gameWorldView, &GameWorldView::stateUpdated,
m_selectedBuildingPanel, &SelectedBuildingPanel::onStateUpdated);
connect(m_gameWorldView, SIGNAL(gameOver()),
this, SLOT(onGameOver()));
connect(m_gameWorldView, &GameWorldView::gameOver,
this, &MainWindow::onGameOver);
connect(m_gameWorldView, SIGNAL(escapeMenuRequested()),
this, SLOT(onEscapeMenuRequested()));
connect(m_gameWorldView, &GameWorldView::escapeMenuRequested,
this, &MainWindow::onEscapeMenuRequested);
// Signals: build grid → game world
connect(m_buildButtonGrid, SIGNAL(buildingTypeSelected(BuildingType)),
m_gameWorldView, SLOT(enterBuilderMode(BuildingType)));
connect(m_buildButtonGrid, &BuildButtonGrid::buildingTypeSelected,
m_gameWorldView, &GameWorldView::enterBuilderMode);
connect(m_buildButtonGrid, SIGNAL(builderModeExited()),
m_gameWorldView, SLOT(exitBuilderMode()));
connect(m_buildButtonGrid, &BuildButtonGrid::builderModeExited,
m_gameWorldView, &GameWorldView::exitBuilderMode);
connect(m_gameWorldView, SIGNAL(builderModeExited()),
m_buildButtonGrid, SLOT(clearActiveButton()));
connect(m_gameWorldView, &GameWorldView::builderModeExited,
m_buildButtonGrid, &BuildButtonGrid::clearActiveButton);
connect(m_buildButtonGrid, SIGNAL(demolishModeToggleRequested()),
m_gameWorldView, SLOT(toggleDemolishMode()));
connect(m_buildButtonGrid, &BuildButtonGrid::demolishModeToggleRequested,
m_gameWorldView, &GameWorldView::toggleDemolishMode);
connect(m_gameWorldView, SIGNAL(demolishModeChanged(bool)),
m_buildButtonGrid, SLOT(setDemolishModeActive(bool)));
connect(m_gameWorldView, &GameWorldView::demolishModeChanged,
m_buildButtonGrid, &BuildButtonGrid::setDemolishModeActive);
// Signals: header bar → game world
connect(m_headerBar, SIGNAL(speedChanged(double)),
m_gameWorldView, SLOT(setGameSpeed(double)));
connect(m_headerBar, &HeaderBar::speedChanged,
m_gameWorldView, &GameWorldView::setGameSpeed);
m_gameWorldView->setFocus();