MCPcopy Create free account
hub / github.com/LMMS/lmms / handleFile

Method handleFile

src/gui/FileBrowser.cpp:561–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559
560
561void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it )
562{
563 Engine::mixer()->requestChangeInModel();
564 switch( f->handling() )
565 {
566 case FileItem::LoadAsProject:
567 if( gui->mainWindow()->mayChangeProject(true) )
568 {
569 Engine::getSong()->loadProject( f->fullName() );
570 }
571 break;
572
573 case FileItem::LoadByPlugin:
574 {
575 const QString e = f->extension();
576 Instrument * i = it->instrument();
577 if( i == NULL ||
578 !i->descriptor()->supportsFileType( e ) )
579 {
580 i = it->loadInstrument(
581 pluginFactory->pluginSupportingExtension(e).name() );
582 }
583 i->loadFile( f->fullName() );
584 break;
585 }
586
587 case FileItem::LoadAsPreset:
588 {
589 DataFile dataFile( f->fullName() );
590 InstrumentTrack::removeMidiPortNode( dataFile );
591 it->setSimpleSerializing();
592 it->loadSettings( dataFile.content().toElement() );
593 break;
594 }
595
596 case FileItem::ImportAsProject:
597 ImportFilter::import( f->fullName(),
598 Engine::getSong() );
599 break;
600
601 case FileItem::NotSupported:
602 default:
603 break;
604
605 }
606 Engine::mixer()->doneChangeInModel();
607}
608
609
610

Callers

nothing calls this directly

Calls 15

mixerFunction · 0.85
getSongFunction · 0.85
requestChangeInModelMethod · 0.80
handlingMethod · 0.80
mayChangeProjectMethod · 0.80
loadProjectMethod · 0.80
extensionMethod · 0.80
supportsFileTypeMethod · 0.80
loadInstrumentMethod · 0.80
doneChangeInModelMethod · 0.80
fullNameMethod · 0.45

Tested by

no test coverage detected