Skip to content

Commit 642d2d9

Browse files
author
Milkii Brewster
committed
fix controller wizard menu not updating after startup
Connect to ControllerManager::mappingApplied in addition to devicesChanged. devicesChanged is only emitted once on startup (per the comment in controllermanager.cpp); mappingApplied fires after a controller is opened when a mapping is applied post-startup, so the menu now updates correctly when controllers are enabled. Also simplify openLearningWizard loop to range-for per review.
1 parent b15a152 commit 642d2d9

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/controllers/dlgprefcontrollers.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,8 @@ void DlgPrefControllers::openLearningWizard(Controller* pController) {
294294
}
295295

296296
// Find the DlgPrefController for this controller by matching the controller pointer
297-
for (int i = 0; i < m_controllerPages.size(); ++i) {
298-
DlgPrefController* pControllerDlg = m_controllerPages.at(i);
299-
if (pControllerDlg && pControllerDlg->controller() == pController) {
300-
// Pass true to suppress preferences dialog when wizard closes
297+
for (auto* pControllerDlg : m_controllerPages) {
298+
if (pControllerDlg->controller() == pController) {
301299
pControllerDlg->showLearningWizard(true);
302300
return;
303301
}

src/mixxxmainwindow.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,13 @@ void MixxxMainWindow::connectMenuBar() {
956956
this,
957957
&MixxxMainWindow::slotControllersChanged,
958958
Qt::UniqueConnection);
959+
// mappingApplied fires after a controller is opened post-startup
960+
// (devicesChanged is only emitted once, on startup)
961+
connect(m_pCoreServices->getControllerManager().get(),
962+
&ControllerManager::mappingApplied,
963+
this,
964+
&MixxxMainWindow::slotUpdateControllerLearningMenu,
965+
Qt::UniqueConnection);
959966
connect(m_pMenuBar,
960967
&WMainMenuBar::openControllerLearningWizard,
961968
this,

0 commit comments

Comments
 (0)