Preserve FX channel when replacing track (#5957)
* Preserve FX channel when replacing track * Add comment
This commit is contained in:
@@ -232,6 +232,8 @@ public:
|
||||
{
|
||||
return m_previewMode;
|
||||
}
|
||||
|
||||
void replaceInstrument(DataFile dataFile);
|
||||
|
||||
void autoAssignMidiDevice( bool );
|
||||
|
||||
|
||||
@@ -776,15 +776,11 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it)
|
||||
break;
|
||||
}
|
||||
|
||||
case FileItem::LoadAsPreset:
|
||||
{
|
||||
DataFile dataFile( f->fullName() );
|
||||
InstrumentTrack::removeMidiPortNode( dataFile );
|
||||
it->setSimpleSerializing();
|
||||
it->loadSettings( dataFile.content().toElement() );
|
||||
case FileItem::LoadAsPreset: {
|
||||
DataFile dataFile(f->fullName());
|
||||
it->replaceInstrument(dataFile);
|
||||
break;
|
||||
}
|
||||
|
||||
case FileItem::ImportAsProject:
|
||||
ImportFilter::import( f->fullName(),
|
||||
Engine::getSong() );
|
||||
|
||||
@@ -954,6 +954,22 @@ void InstrumentTrack::setPreviewMode( const bool value )
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::replaceInstrument(DataFile dataFile)
|
||||
{
|
||||
// loadSettings clears the FX channel, so we save it here and set it back later
|
||||
int effectChannel = effectChannelModel()->value();
|
||||
|
||||
InstrumentTrack::removeMidiPortNode(dataFile);
|
||||
setSimpleSerializing();
|
||||
loadSettings(dataFile.content().toElement());
|
||||
|
||||
m_effectChannelModel.setValue(effectChannel);
|
||||
Engine::getSong()->setModified();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString InstrumentTrack::getSavedInstrumentName(const QDomElement &thisElement) const
|
||||
{
|
||||
QDomElement elem = thisElement.firstChildElement("instrument");
|
||||
@@ -1835,13 +1851,8 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event )
|
||||
}
|
||||
else if( type == "presetfile" )
|
||||
{
|
||||
DataFile dataFile( value );
|
||||
InstrumentTrack::removeMidiPortNode( dataFile );
|
||||
m_track->setSimpleSerializing();
|
||||
m_track->loadSettings( dataFile.content().toElement() );
|
||||
|
||||
Engine::getSong()->setModified();
|
||||
|
||||
DataFile dataFile(value);
|
||||
m_track->replaceInstrument(dataFile);
|
||||
event->accept();
|
||||
setFocus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user