-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add quick access to controller learning wizard via options menu #15577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -286,3 +286,40 @@ void DlgPrefControllers::slotMidiThroughChanged(bool checked) { | |||||||
| } | ||||||||
| #endif | ||||||||
| #endif | ||||||||
|
|
||||||||
| void DlgPrefControllers::openLearningWizard(Controller* pController) { | ||||||||
| if (!pController) { | ||||||||
| return; | ||||||||
| } | ||||||||
|
|
||||||||
| // Find the DlgPrefController for this controller by matching the controller pointer | ||||||||
| for (int i = 0; i < m_controllerPages.size(); ++i) { | ||||||||
| DlgPrefController* pControllerDlg = m_controllerPages.at(i); | ||||||||
| if (pControllerDlg && pControllerDlg->controller() == pController) { | ||||||||
| // Temporarily disconnect the mappingEnded signal to prevent | ||||||||
| // showing the preferences dialog when the wizard closes | ||||||||
| disconnect(pControllerDlg, | ||||||||
| &DlgPrefController::mappingEnded, | ||||||||
| m_pDlgPreferences, | ||||||||
| &DlgPreferences::show); | ||||||||
|
|
||||||||
| // Reconnect after wizard closes to restore normal behavior | ||||||||
| connect( | ||||||||
| pControllerDlg, | ||||||||
|
Comment on lines
+307
to
+308
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| &DlgPrefController::mappingEnded, | ||||||||
| this, | ||||||||
| [this, pControllerDlg]() { | ||||||||
| // Restore the connection for future uses from preferences | ||||||||
| connect(pControllerDlg, | ||||||||
| &DlgPrefController::mappingEnded, | ||||||||
| m_pDlgPreferences, | ||||||||
| &DlgPreferences::show); | ||||||||
| }, | ||||||||
| Qt::SingleShotConnection); | ||||||||
|
Comment on lines
+299
to
+318
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to disconnect this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stops prefs reopening "disconnect only affects UI flow, not saving. prevents preferences dialog popping up when wizard is launched from menu instead of from within preferences. saving/applying happens in 'slotStopLearning()' before maybe there is a more elegant way? |
||||||||
|
|
||||||||
| // Open the learning wizard directly | ||||||||
| pControllerDlg->showLearningWizard(); | ||||||||
| return; | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,8 @@ | |||||||
| #include "widget/winitialglwidget.h" | ||||||||
| #endif | ||||||||
|
|
||||||||
| #include "controllers/controller.h" | ||||||||
| #include "controllers/controllermanager.h" | ||||||||
| #include "controllers/keyboard/keyboardeventfilter.h" | ||||||||
| #include "coreservices.h" | ||||||||
| #include "defs_urls.h" | ||||||||
|
|
@@ -947,6 +949,22 @@ void MixxxMainWindow::connectMenuBar() { | |||||||
| m_pMenuBar->onNumberOfDecksChanged(pPlayerManager->numberOfDecks()); | ||||||||
| } | ||||||||
|
|
||||||||
| // Controller learning wizard menu | ||||||||
| if (m_pCoreServices->getControllerManager()) { | ||||||||
| connect(m_pCoreServices->getControllerManager().get(), | ||||||||
| &ControllerManager::devicesChanged, | ||||||||
| this, | ||||||||
| &MixxxMainWindow::slotUpdateControllerLearningMenu, | ||||||||
| Qt::UniqueConnection); | ||||||||
| connect(m_pMenuBar, | ||||||||
| &WMainMenuBar::openControllerLearningWizard, | ||||||||
| this, | ||||||||
| &MixxxMainWindow::slotOpenControllerLearningWizard, | ||||||||
| Qt::UniqueConnection); | ||||||||
| // Initialize the menu with current controllers | ||||||||
| slotUpdateControllerLearningMenu(); | ||||||||
| } | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work as intended, I don't see updated after startup. mixxx/src/controllers/controllermanager.cpp Lines 191 to 193 in 604b32c
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
|
|
||||||||
| if (m_pCoreServices->getTrackCollectionManager()) { | ||||||||
| connect(m_pMenuBar, | ||||||||
| &WMainMenuBar::rescanLibrary, | ||||||||
|
|
@@ -1147,6 +1165,32 @@ void MixxxMainWindow::slotNoVinylControlInputConfigured() { | |||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| void MixxxMainWindow::slotUpdateControllerLearningMenu() { | ||||||||
| if (!m_pCoreServices->getControllerManager()) { | ||||||||
| return; | ||||||||
| } | ||||||||
| // Only show enabled/opened input controllers | ||||||||
| // Use getControllerList(false, true) to get input devices only | ||||||||
| QList<Controller*> allControllers = | ||||||||
| m_pCoreServices->getControllerManager()->getControllerList( | ||||||||
| false, true); | ||||||||
| QList<Controller*> enabledControllers; | ||||||||
| for (Controller* pController : std::as_const(allControllers)) { | ||||||||
| if (pController && pController->isOpen()) { | ||||||||
| enabledControllers.append(pController); | ||||||||
| } | ||||||||
| } | ||||||||
| m_pMenuBar->onControllersChanged(enabledControllers); | ||||||||
| } | ||||||||
|
|
||||||||
| void MixxxMainWindow::slotOpenControllerLearningWizard(Controller* pController) { | ||||||||
| if (!pController) { | ||||||||
| return; | ||||||||
| } | ||||||||
| // Open the learning wizard directly for this controller | ||||||||
| m_pPrefDlg->openControllerLearningWizard(pController); | ||||||||
| } | ||||||||
|
|
||||||||
| void MixxxMainWindow::slotNoDeckPassthroughInputConfigured() { | ||||||||
| if (m_noPassthroughInputDialog && m_noPassthroughInputDialog->isVisible()) { | ||||||||
| // Don't show redundant dialogs. | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
|
|
||
| #include "config.h" | ||
| #include "control/controlproxy.h" | ||
| #include "controllers/controller.h" | ||
| #include "defs_urls.h" | ||
| #include "moc_wmainmenubar.cpp" | ||
| #include "util/cmdlineargs.h" | ||
|
|
@@ -470,6 +471,17 @@ void WMainMenuBar::initialize() { | |
| pOptionsMenu->addSeparator(); | ||
| #endif | ||
|
|
||
| // Controller Learning submenu | ||
| m_pControllerLearningMenu = new QMenu(tr("&Controller Learning Wizard"), this); | ||
| QString controllerLearningText = tr( | ||
| "Open the MIDI learning wizard for an enabled controller"); | ||
| m_pControllerLearningMenu->setStatusTip(controllerLearningText); | ||
| m_pControllerLearningMenu->setWhatsThis(buildWhatsThis( | ||
| tr("Controller Learning Wizard"), controllerLearningText)); | ||
| // Menu will be populated dynamically with enabled controllers | ||
| pOptionsMenu->addMenu(m_pControllerLearningMenu); | ||
| pOptionsMenu->addSeparator(); | ||
|
|
||
| QString recordTitle = tr("&Record Mix"); | ||
| QString recordText = tr("Record your mix to a file"); | ||
| auto* pOptionsRecord = new QAction(recordTitle, this); | ||
|
|
@@ -998,3 +1010,35 @@ void VisibilityControlConnection::slotActionToggled(bool toggle) { | |
| m_pControl->set(toggle ? 1.0 : 0.0); | ||
| } | ||
| } | ||
|
|
||
| void WMainMenuBar::onControllersChanged(const QList<Controller*>& controllers) { | ||
| // Clear existing actions | ||
| for (QAction* pAction : std::as_const(m_controllerLearningActions)) { | ||
| m_pControllerLearningMenu->removeAction(pAction); | ||
| delete pAction; | ||
| } | ||
| m_controllerLearningActions.clear(); | ||
|
|
||
| // Add menu item for each controller | ||
| for (Controller* pController : controllers) { | ||
| if (!pController) { | ||
| continue; | ||
| } | ||
| QString controllerName = pController->getName(); | ||
| auto* pAction = new QAction(controllerName, this); | ||
| pAction->setStatusTip(tr("Open learning wizard for %1").arg(controllerName)); | ||
| connect(pAction, &QAction::triggered, this, [this, pController]() { | ||
| emit openControllerLearningWizard(pController); | ||
| }); | ||
| m_pControllerLearningMenu->addAction(pAction); | ||
| m_controllerLearningActions.append(pAction); | ||
| } | ||
|
|
||
| // Show "No controllers enabled" if list is empty | ||
| if (m_controllerLearningActions.isEmpty()) { | ||
| auto* pNoControllersAction = new QAction(tr("No controllers enabled"), this); | ||
| pNoControllersAction->setEnabled(false); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem to work (here, with Qt 6.2.3), action is still enabled, can be selected and clicked |
||
| m_pControllerLearningMenu->addAction(pNoControllersAction); | ||
| m_controllerLearningActions.append(pNoControllersAction); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.