-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix #302714: make chord symbol playback settings available in Edit Style dialog #5889
Fix #302714: make chord symbol playback settings available in Edit Style dialog #5889
Conversation
Tests are failing. You named the voicing widget |
Huh, it compiled just fine on my machine. Weird. Update pushed. |
0780eb0
to
c431a3c
Compare
Looks great! |
voicingSelectWidget->durationBox->clear(); | ||
voicingSelectWidget->durationBox->addItem(tr("Until Next Chord Symbol"), int(HDuration::UNTIL_NEXT_CHORD_SYMBOL)); | ||
voicingSelectWidget->durationBox->addItem(tr("Until End of Measure"), int(HDuration::STOP_AT_MEASURE_END)); | ||
voicingSelectWidget->durationBox->addItem(tr("Chord/Rest Duration"), int(HDuration::SEGMENT_DURATION)); |
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.
Can't you just take the strings from that ui file rather than having them here again, as duplicates?
Like replacing tr("...")
with qApp->translate("VoicingSelect","...")
. Would still need to be the 100% identical strings, but at least would prevent them from the need to get translated twice.
Maybe even refer to the index of those strings in that dialog rather than having the strings themselves, like voicingSelectWidget->interpretBox->itemText(i)
, then those won't ever go out of sync.
But maybe none of those are needed at all? Like no need for the lines 427-447 at all?
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.
I think they are needed, as with all the other combobox initializations just above in the same file. Without these lines, for whatever reason, the comboboxes appear empty.
Getting the index sounds like it would be ideal, but I can't seem to get it to work. Using qApp->translate()
works (I'd be interested to know exactly what it does differently), so if using the index is not an option I'll switch to that.
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.
It refers to translations done elsewhere (defined via context, the 1st arg)
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.
With the index method, I could conceivably do these initializations in fewer lines by making a vector for each enum (e.g. vector<HDuration> HDurations
) and then use a loop (e.g. for auto hDuration : HDurations
) to add all the items.
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.
Yes. Seems better anyhow, to prevent the strings from getting out of sync
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.
It would be like voicingSelectWidget->voicingBox->addItem(voicingSelectWidget->voicingBox->itemText(0), int(Voicing::AUTO));
, no?
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.
I would guess so, yes.
Well, no. You're deleting them first
voicingSelectWidget->durationBox->clear();
The items are (or should be) there already, just not connected?
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.
Aha! Hold that thought.
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.
Okay, I'm baffled. It appears I was mistaken earlier when I said "Without these lines, for whatever reason, the comboboxes appear empty." In fact, the comboboxes are filled automatically, but they appear empty because no option is selected. So I triedsetCurrentIndex()
, but it has no effect.
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.
Actually these indexes (indices?) need to get set as per the current score setting.
But I guess that is what setValues()
and getValue()
are doing furter down?
voicingSelectWidget->voicingBox->addItem(tr("Automatic"), int(Voicing::AUTO)); | ||
voicingSelectWidget->voicingBox->addItem(tr("Root Only"), int(Voicing::ROOT_ONLY)); | ||
voicingSelectWidget->voicingBox->addItem(tr("Close"), int(Voicing::CLOSE)); | ||
voicingSelectWidget->voicingBox->addItem(tr("Drop 2"), int(Voicing::DROP_2)); |
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.
My PR changes this to "Drop Two"
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.
Noted, thanks
|
||
voicingSelectWidget->interpretBox->clear(); | ||
voicingSelectWidget->interpretBox->addItem(tr("Jazz"), int(0)); // two-item combobox for boolean style variant | ||
voicingSelectWidget->interpretBox->addItem(tr("Literal"), int(1)); // true = literal |
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.
Why those 2 casts to int
?
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.
I started out with false
and true
there and wanted to be clear.
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.
but Jazz isn't false ;-)
0 and 1 are int
already (or turned into that), so the cast seems superfluous, even more so as that method really calls for a QVariant
.
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.
According to @peterhieuvu it is ;-)
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.
Ah yeah, Jazz and Literal should probably have been a char/boolean enum instead of true
or false
to improve readability
{ Sid::harmonyPlay, false, harmonyPlay, 0 }, | ||
{ Sid::harmonyVoiceLiteral, false, voicingSelectWidget->interpretBox, 0 }, | ||
{ Sid::harmonyVoicing, false, voicingSelectWidget->voicingBox, 0 }, | ||
{ Sid::harmonyDuration, false, voicingSelectWidget->durationBox, 0 }, |
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.
No reset buttons?
In Inspector at least voicingBox has a reset button
Oh, I see, that reset and set to style button applies to all 3 settings in one go
So, to recap: this PR tries to reuse an external widget, which is more than can be said for most of the Style dialog. Trying to use the strings provided in that widget I encounter problems of one kind or another (the closest I got was having the comboboxes appear empty with no option selected, and adding |
Rebase needed |
@IsaacWeiss this still needs a rebase and a 3.x version |
c431a3c
to
fec330b
Compare
This has been rebased against 3.x and passed all tests. @anatoly-os mentioned on Telegram that he could merge changes from 3.x to master, but that might be difficult with the UI file, so I am happy to take care of that with a second PR if necessary. In resolving changes to editstyle.ui I noticed a whole section of style settings in 3.x currently missing in master, with measure number position above and below. Did this fall through the cracks or is the difference on purpose? |
It is because #6208 hasn't yet been merged to master I guess |
Resolves: https://musescore.org/en/node/302714
As suggested by @Jojo-Schmitz in his PR #5852, this reuses voicing_select.ui from the Inspector. This creates no merge conflicts, and it will work perfectly well if merged independently, but it will look a lot nicer (as in the above screenshot) if his PR is merged first.