Change how PatternTrack clones are named #7550
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Instead of naming cloned
PatternTrack
s "Clone of ..." which can quickly build up with "Clone of Clone of Clone of Clone of Clone of ....", this PR changes clones to be named "... 2", and any tracks which have a number at the end to simply increment the number when naming the clone, like "... 3" and "... 4".How it works
When you clone a track, the current name of the track is split by
" "
, and the last substring is checked to see if it can be converted to a number. If it can, then the name of the clone is set to the old name plus the number incremented, else it is set to the old name plus "2" at the end.Notes:
I tried to use
.arg()
instead of string concatenation for inserting the name and number, but I was unsuccessful. I can try again to see if I can get it working if any of you would like.Also, I'm guessing we don't need to translate it anymore? I still have
tr("%1 2")
there, but I can remove thetr
it if you want.