-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 #97931: system initial barline type lost on reload #2386
fix #97931: system initial barline type lost on reload #2386
Conversation
Replacing writeProperty by xml.tag doesn't really go in the right direction. No way to make it works without doing this? |
One way I can see would be to define a new P_TYPE - perhaps called "BARLINE_STYLE" - and use this as the type for this property. Then we would modify the switch statement in Xml::tag() to convert this to a string much as is done for some of the other property types. but since we don't do this for the regular barline type, I didn't see a reaosn to introduce it now for system barline type. What's wrong with using xml.tag() directly as I have done? Are you concerned about losing the automatic check against propertyDefault? |
Using xml.tag put one more "sysInitBarLineType" in the wild and by loosing consistency is error prone. After all that one of the goal of using the property system. Let me dig further the issue. |
Saving it as a string and BARLINE_TYPE as a P_TYPE seems the way to go indeed. We can change the read to readProperties probably. If we can reuse it for normal barline, even better ! |
OK, that makes sense, and I can do this. I am not sure about changing the code for for normal barlines, though. We currently use different tags for this: "sysInitBarLineType" versus "subtype". And right now, BarLine::write() always writes the "subtype" tag, even for NORMAL. I think we don't normally try to write normal barlines in the first place, but prlbably we do in some special cases, and changing to writeProperty() would mean we no longer write the tag. Maybe it's not an issue, but still, it seems a little bit dangerous tp be messing with that unnecessarily. I'll look further, though. |
|
bool ok; | ||
const QString& val(e.readElementText()); | ||
int ct = val.toInt(&ok); | ||
if (ok) |
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.
Could you add a comment to explain it used to be written as a 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 didn't see this before, slrry. Should I still add the comment?
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 missed it too. Let me add it.
It's fine for me. Regarding 3) I agree on 4) |
Normal barlines do use P_ID::SUBTYPE in at least some places - that is, getProperty(), setProperty(), and propertyDefault() do implement it, and Barline::drop() uses undoChangeProperty() with that parameter. But the read and write are hard-coded just as I had originally done here, and do not use the property. I believe you are right, there is no compatibility if we create yet another P_ID that re-uses the new P_TYPE I just added. I was thinking of somehow using the same P_ID for both. But even just using the same P_TYPE would allow us to leverage most of the same code, so we should be able to make that change any time we wanted. Oh, and it's squashed now. |
f22e28d
to
3f44c3e
Compare
fix #97931: system initial barline type lost on reload
We were writing the value as an int but reading itexpecting a string. Since regular barlines read and write the type as a string, I changed the code here to be consistent with that.