| 358 | |
| 359 | |
| 360 | void TrackContainerView::dropEvent( QDropEvent * _de ) |
| 361 | { |
| 362 | QString type = StringPairDrag::decodeKey( _de ); |
| 363 | QString value = StringPairDrag::decodeValue( _de ); |
| 364 | if( type == "instrument" ) |
| 365 | { |
| 366 | InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( |
| 367 | Track::create( Track::InstrumentTrack, |
| 368 | m_tc ) ); |
| 369 | InstrumentLoaderThread *ilt = new InstrumentLoaderThread( |
| 370 | this, it, value ); |
| 371 | ilt->start(); |
| 372 | //it->toggledInstrumentTrackButton( true ); |
| 373 | _de->accept(); |
| 374 | } |
| 375 | else if( type == "samplefile" || type == "pluginpresetfile" |
| 376 | || type == "soundfontfile" || type == "vstpluginfile" |
| 377 | || type == "patchfile" ) |
| 378 | { |
| 379 | InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( |
| 380 | Track::create( Track::InstrumentTrack, |
| 381 | m_tc ) ); |
| 382 | Instrument * i = it->loadInstrument( |
| 383 | pluginFactory->pluginSupportingExtension(FileItem::extension(value)).name()); |
| 384 | i->loadFile( value ); |
| 385 | //it->toggledInstrumentTrackButton( true ); |
| 386 | _de->accept(); |
| 387 | } |
| 388 | else if( type == "presetfile" ) |
| 389 | { |
| 390 | DataFile dataFile( value ); |
| 391 | InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( |
| 392 | Track::create( Track::InstrumentTrack, |
| 393 | m_tc ) ); |
| 394 | it->setSimpleSerializing(); |
| 395 | it->loadSettings( dataFile.content().toElement() ); |
| 396 | //it->toggledInstrumentTrackButton( true ); |
| 397 | _de->accept(); |
| 398 | } |
| 399 | else if( type == "importedproject" ) |
| 400 | { |
| 401 | ImportFilter::import( value, m_tc ); |
| 402 | _de->accept(); |
| 403 | } |
| 404 | |
| 405 | else if( type == "projectfile") |
| 406 | { |
| 407 | if( gui->mainWindow()->mayChangeProject(true) ) |
| 408 | { |
| 409 | Engine::getSong()->loadProject( value ); |
| 410 | } |
| 411 | _de->accept(); |
| 412 | } |
| 413 | |
| 414 | else if( type.left( 6 ) == "track_" ) |
| 415 | { |
| 416 | DataFile dataFile( value.toUtf8() ); |
| 417 | Track::create( dataFile.content().firstChild().toElement(), m_tc ); |
nothing calls this directly
no test coverage detected