void TrackContainerView::dropEvent( QDropEvent * _de ) { QString type = StringPairDrag::decodeKey( _de ); QString value = StringPairDrag::decodeValue( _de ); if( type == "instrument" ) { InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( Track::create( Track::InstrumentTrack, m_tc ) ); InstrumentLoaderThread *ilt = new InstrumentLoaderThread( this, it, value ); ilt->start(); //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( type == "samplefile" || type == "pluginpresetfile" || type == "soundfontfile" || type == "vstpluginfile") { InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( Track::create( Track::InstrumentTrack, m_tc ) ); Instrument * i = it->loadInstrument( pluginFactory->pluginSupportingExtension(FileItem::extension(value)).name()); i->loadFile( value ); //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( type == "presetfile" ) { DataFile dataFile( value ); InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( Track::create( Track::InstrumentTrack, m_tc ) ); it->setSimpleSerializing(); it->loadSettings( dataFile.content().toElement() ); //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( type == "importedproject" ) { ImportFilter::import( value, m_tc ); _de->accept(); } else if( type == "projectfile") { if( gui->mainWindow()->mayChangeProject(true) ) { Engine::getSong()->loadProject( value ); } _de->accept(); } else if( type.left( 6 ) == "track_" ) { DataFile dataFile( value.toUtf8() ); Track::create( dataFile.content().firstChild().toElement(), m_tc ); _de->accept(); } }
void TrackContainerView::dropEvent( QDropEvent * _de ) { QString type = stringPairDrag::decodeKey( _de ); QString value = stringPairDrag::decodeValue( _de ); if( type == "instrument" ) { InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( track::create( track::InstrumentTrack, m_tc ) ); it->loadInstrument( value ); //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( type == "samplefile" || type == "pluginpresetfile" || type == "soundfontfile" || type == "vstpluginfile") { InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( track::create( track::InstrumentTrack, m_tc ) ); Instrument * i = it->loadInstrument( engine::pluginFileHandling()[fileItem::extension( value )]); i->loadFile( value ); //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( type == "presetfile" ) { DataFile dataFile( value ); InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( track::create( track::InstrumentTrack, m_tc ) ); it->setSimpleSerializing(); it->loadSettings( dataFile.content().toElement() ); //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( type == "importedproject" ) { ImportFilter::import( value, m_tc ); _de->accept(); } else if( type.left( 6 ) == "track_" ) { DataFile dataFile( value.toUtf8() ); track::create( dataFile.content().firstChild().toElement(), m_tc ); _de->accept(); } }