Do not save MIDI connections in presets (#7445)
Ensure that no MIDI information (connected inputs, outputs, etc.) is stored in presets. This main fix can be found in `InstrumentTrack::saveTrackSpecificSettings` where the state of the MIDI ports are now only saved if we are not in preset mode. The remaining changes are concered with a refactoring of the code that's related to saving and loading presets. The refactoring mainly revolves around the removal of the member `m_simpleSerializingMode` and the method `setSimpleSerializing` in `Track`. This is accomplished by introducing two new methods `saveTrack` and `loadTrack`. These methods have a similar interface to `saveSettings` and `loadSettings` but they additionally contain a boolean which indicates if a preset is saved/loaded or a whole track. Both new methods contain the previous code of `saveSettings` and `loadSettings`. The latter two now only delegate to the new methods assuming that the full track is to be stored/loaded if called via the overridden methods `saveSettings` and `loadSettings`. The methods `savePreset` and `loadPreset` are added as well. They call `saveTrack` and `loadTrack` with the preset boolean set to `true`. These methods are now used by all places in the code where presets are saved or loaded which makes the code more readable. Clients also do not need to know any implementation details of `Track`, e.g. like having to call `setSimpleSerializing`. Adjust `saveTrackSpecificSettings` so that it also passes information of whether a preset or a whole track is stored. This leads to changes in the interfaces of `AutomationTrack`, `InstrumentTrack`, `PatternTrack` and `SampleTrack`. Only the implementation of `InstrumentTrack` uses the new information though.
This commit is contained in:
committed by
GitHub
parent
5e697f01c8
commit
88ee83bb4a
@@ -50,8 +50,7 @@ public:
|
||||
gui::TrackView * createView( gui::TrackContainerView* ) override;
|
||||
Clip* createClip(const TimePos & pos) override;
|
||||
|
||||
void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent ) override;
|
||||
void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) override;
|
||||
void loadTrackSpecificSettings( const QDomElement & _this ) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -133,8 +133,7 @@ public:
|
||||
|
||||
|
||||
// called by track
|
||||
void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent ) override;
|
||||
void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) override;
|
||||
void loadTrackSpecificSettings( const QDomElement & _this ) override;
|
||||
|
||||
using Track::setJournalling;
|
||||
|
||||
@@ -57,8 +57,7 @@ public:
|
||||
gui::TrackView * createView( gui::TrackContainerView* tcv ) override;
|
||||
Clip* createClip(const TimePos & pos) override;
|
||||
|
||||
void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent ) override;
|
||||
void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) override;
|
||||
void loadTrackSpecificSettings( const QDomElement & _this ) override;
|
||||
|
||||
static PatternTrack* findPatternTrack(int pattern_num);
|
||||
|
||||
@@ -54,8 +54,7 @@ public:
|
||||
Clip* createClip(const TimePos & pos) override;
|
||||
|
||||
|
||||
void saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent ) override;
|
||||
void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) override;
|
||||
void loadTrackSpecificSettings( const QDomElement & _this ) override;
|
||||
|
||||
inline IntModel * mixerChannelModel()
|
||||
|
||||
@@ -107,19 +107,17 @@ public:
|
||||
virtual gui::TrackView * createView( gui::TrackContainerView * view ) = 0;
|
||||
virtual Clip * createClip( const TimePos & pos ) = 0;
|
||||
|
||||
virtual void saveTrackSpecificSettings( QDomDocument & doc,
|
||||
QDomElement & parent ) = 0;
|
||||
virtual void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) = 0;
|
||||
virtual void loadTrackSpecificSettings( const QDomElement & element ) = 0;
|
||||
|
||||
// Saving and loading of presets which do not necessarily contain all the track information
|
||||
void savePreset(QDomDocument & doc, QDomElement & element);
|
||||
void loadPreset(const QDomElement & element);
|
||||
|
||||
// Saving and loading of full tracks
|
||||
void saveSettings( QDomDocument & doc, QDomElement & element ) override;
|
||||
void loadSettings( const QDomElement & element ) override;
|
||||
|
||||
void setSimpleSerializing()
|
||||
{
|
||||
m_simpleSerializingMode = true;
|
||||
}
|
||||
|
||||
// -- for usage by Clip only ---------------
|
||||
Clip * addClip( Clip * clip );
|
||||
void removeClip( Clip * clip );
|
||||
@@ -209,6 +207,10 @@ public slots:
|
||||
|
||||
void toggleSolo();
|
||||
|
||||
private:
|
||||
void saveTrack(QDomDocument& doc, QDomElement& element, bool presetMode);
|
||||
void loadTrack(const QDomElement& element, bool presetMode);
|
||||
|
||||
private:
|
||||
TrackContainer* m_trackContainer;
|
||||
Type m_type;
|
||||
@@ -222,8 +224,6 @@ private:
|
||||
BoolModel m_soloModel;
|
||||
bool m_mutedBeforeSolo;
|
||||
|
||||
bool m_simpleSerializingMode;
|
||||
|
||||
clipVector m_clips;
|
||||
|
||||
QMutex m_processingLock;
|
||||
|
||||
Reference in New Issue
Block a user