Ability to undo changes to Song (restore deleted tracks)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 1.3k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 7
Description
This is essentially a roadmap to undo deletion of tracks.
At the moment trying to restore a checkpoint of Song will result in a crash. That's why we can't undo track deletion and why undo of copy-paste is implemented in such a weird way right now.
I've identified what needs to be done to fix this. In theory it will enable us to undo deleted tracks. In reality the journal system is a terrible solution.
Here are the things that need to be fixed:
-
Usage of
PatternTrack::s_infoMap- Problem: Using the
[ ]operator to lookup map values may add invalid values to the map. - Solution: create a correct getter function - makes it more readable too.
- Problem: Using the
-
MidiPortMenu(gui) stored insideMidiPort(core)- Background: The
InstrumentTrackWindowstores a menu in theInstrumentso theTrackOperationsWidgetcan reuse it. - Problem: When the window is deleted it will try to remove the menu from the instrument, but if the instrument has been deleted first it will crash.
- Solution: don't share the menu, store it locally or create it on-demand.
- Background: The
-
Order of deletion for models and views (optional)
- Background: Sometimes the view deletes the model, sometimes the model emits a signal that deletes the view.
- Problem: This is a source of confusion that perhaps led to the two bugs above.
- Solution: Agree on best approach and clean up code.
-
Optimize undo of
Song(optional)- Problem: Undoing
Songcauses the whole project to be reloaded. - Hacker's solution: Only reload tracks that have changed.
- Real solution: Rework the entire codebase to use
QUndoCommand
- Problem: Undoing
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing PatternTrack::s_infoMap and the MidiPortMenu relationship between MidiPort, InstrumentTrackWindow, Instrument, and TrackOperationsWidget. Review how Song checkpoints are restored and how QUndoCommand is currently used. Done would require resolving the listed crash causes and establishing a clear approach for undoing deleted tracks; the optional cleanup is not defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100