Skip to content
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

Pref > Controller: allow creating a new mapping with 'No Mapping' selected #4905

Merged
merged 6 commits into from
Sep 17, 2022

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Aug 20, 2022

  • 'Learning Wizard' button and in/output tabs are now enabled/disabled after applying a mapping (previously this was only in slotUpdate() when re-opening the preferences)
  • this also allows starting the Wizard with 'No Mapping' selected
  • fix creating a new mapping with the wizard by creating the I/O table models & assigning them to the new, empty mapping
  • fix false-positive isDirty when starting the Wizard with 'No Mapping' selected after opening the peferences

Copy link
Contributor

@ferranpujolcamins ferranpujolcamins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is unfortunately not consistent with the behavior of the button after changing a mapping. The learning wizard button has already the pop up to ask for apply when the mapping has changed, this is bypassing the gray out state AFTER apply:

  • open the mapping pane
  • Select No Mapping
  • Click Learn Assistant
  • Confirm Applying Popup
  • Now the leaning Wizzart has "No Mapping" to modify.

Solutions

  • Remove Graying out and add a Pop up "Select an existing mapping to modify frist";
  • Gray out the Learn assistant if the "No Mapping" is selected (before apply)

@ronso0
Copy link
Member Author

ronso0 commented Aug 24, 2022

Thanks for testing!

  • open the mapping pane
  • Select No Mapping
  • Click Learn Assistant
  • Confirm Applying Popup
  • Now the leaning Wizzart has "No Mapping" to modify.

Well, this fixes #10540
(uuuh yeah, 'Issues' are imported 🎉 )
So we only need to take care of the "No mapping" case in saveMapping() IINM

Btw there is also the issue that enumerateMappings overrides the mapping selection:

  • ("Mapping123" selected)
  • make changes (don't apply)
  • select "MappinXY"
  • "Apply?" yes, choose Overwrite or Save as new..
  • "Mapping123" selected

@ronso0
Copy link
Member Author

ronso0 commented Aug 24, 2022

Thanks for testing!

  • open the mapping pane
  • Select No Mapping
  • Click Learn Assistant
  • Confirm Applying Popup
  • Now the leaning Wizzart has "No Mapping" to modify.

Well, this fixes #10540 .. So we only need to take care of the "No mapping" case in saveMapping() IINM

That could fix #10540 though there's much more to it.
I'll simply disable the Wizard + IO tabs when 'No Mapping' is selected.

Prior to that I added two fixup commits. @daschuer Please give me a ✔️ when you reviewed those so I can squash them.

@ronso0 ronso0 marked this pull request as draft August 24, 2022 23:57
@ronso0 ronso0 force-pushed the pref-controller-apply-wizard branch 2 times, most recently from 8fa2c5d to ca57abf Compare August 25, 2022 00:03
Comment on lines 170 to 171
// shortuct to create and assign required IO table models (no GUI changes)
slotShowMapping(m_pMapping);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... otherwise there's no input table the recorded mappings can be applied to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may as well split the table model creation into a separate function, though for the 'new mapping' case there's no overhead in using slotShowMapping (it just updates the mapping info section, which is empty anyway)

// creating a new, empty mapping LegacyMidiControllerMapping with the wizard
if (m_pJSEngine) {
callFunctionOnObjects(m_scriptFunctionPrefixes, "shutdown");
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise we'd hit debug assertions in callFunctionOnObjects and ControllerScriptEngineBase::shutdown() when the new mapping applied.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(peviously/2.3 both methods simly returned when there was no js engine)

@daschuer
Copy link
Member

Just tested the current state of this PR:

  • After restart with "No Mapping" the Learn wizzard is active.

Is it intended to allow to learn a new mapping from the scratch with this PR?
Do we want to create a new Entry "Create New Mapping"?
What is the use case for "No Mapping" by the way? Just the default after new installation? In this case we may replaces it with a Dummy Item "Select Mapping ..." which can be removed after the user has selected one.

@daschuer
Copy link
Member

Is there a reason the we show the populated IO Tabs grayed out after selection a mapping? You cannot even adjust the columns to make the content fully visible and they are hard to read. I propose to just gray out the edit buttons, if required.

Maybe we should consider to auto adjust the columns width.

@daschuer
Copy link
Member

This PR has a creeping scope. Did you consider to polish the original bug-fix for 2.3 and move the features into another branch?
Just an idea ...

@ronso0 ronso0 force-pushed the pref-controller-apply-wizard branch from ca57abf to 06ac0df Compare August 25, 2022 10:45
@ronso0
Copy link
Member Author

ronso0 commented Aug 25, 2022

Did you consider to polish the original bug-fix for 2.3

No problem, I extracted some fixes for 2.3, see #10821
This branch is now cleaner.

@ronso0
Copy link
Member Author

ronso0 commented Aug 25, 2022

About greying out the I/O tabs, I'm not sure what the intention is. I don't mind if we remove that entirely.
The 'Add ...' buttons don't work with no mapping anyway, so I don't see a it's just a minor UX regression. Need to double-check.

Auto-adjust columns is a nice-to-have item for later on.

@ronso0
Copy link
Member Author

ronso0 commented Aug 25, 2022

Just tested the current state of this PR:
* After restart with "No Mapping" the Learn wizzard is active.

Is it intended to allow to learn a new mapping from the scratch with this PR?

This PR just fixes the behaviour of 2.3 which was broken because the Wizard button was disabled with 'No Mapping' and the I/O table models were not linked to the mapping when starting the wizard with 'No Mapping'.

Do we want to create a new Entry "Create New Mapping"? What is the use case for "No Mapping" by the way? Just the default after new installation? In this case we may replaces it with a Dummy Item "Select Mapping ..." which can be removed after the user has selected one.

IMO "No Mapping" serves these cases:

  • no mapping selected (none selected, or configured mapping not found / invalid)
  • clear UI to be 100% sure there is no mapping loaded
  • create a new mapping from scratch

Thus, I'm not tempted to make the code & UX more complex.
As long as the Wizard button is available with 'No Mapping' I think it's obvious that it should be clicked to start a new mapping.

@ronso0 ronso0 changed the title Pref > Controller: update GUI after mapping was applied Pref > Controller: update GUI after applying mapping, fix new mapping with 'No Mapping' Aug 25, 2022
@ronso0 ronso0 marked this pull request as ready for review August 25, 2022 12:55
@ronso0 ronso0 changed the title Pref > Controller: update GUI after applying mapping, fix new mapping with 'No Mapping' Pref > Controller: allow creating a new mapping with 'No Mapping' selected Aug 30, 2022
@ronso0
Copy link
Member Author

ronso0 commented Sep 1, 2022

  • open the mapping pane
  • Select No Mapping
  • Click Learn Assistant
  • Confirm Applying Popup
  • Now the leaning Wizzart has "No Mapping" to modify.

Btw this is also fixed, the name field is empty.

@ronso0
Copy link
Member Author

ronso0 commented Sep 11, 2022

Do we want to create a new Entry "Create New Mapping"?

When "No mapping" is selected we could show a hint where the mapping description is displayed:
"You can use the MIDI Wizard to create a new mapping from scratch"

  • links to the manual or wiki maybe

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, works good now.

@daschuer daschuer merged commit eddade7 into mixxxdj:main Sep 17, 2022
@ronso0 ronso0 deleted the pref-controller-apply-wizard branch September 21, 2022 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can't create new mapping with wizard from scratch midi mapping inputs/outputs not appearing in preferences
4 participants