From a8e874601169820b15107aae2396539f212205a2 Mon Sep 17 00:00:00 2001 From: tresf Date: Wed, 28 Feb 2018 21:32:50 -0500 Subject: [PATCH] Add support for .pat previews, drag+drop Closes #4202 --- src/gui/FileBrowser.cpp | 6 +++++- src/gui/TrackContainerView.cpp | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index a9c949c37..b661a9fb2 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -424,7 +424,7 @@ void FileBrowserTreeWidget::mousePressEvent(QMouseEvent * me ) m_previewPlayHandle = s; delete tf; } - else if( ( f->extension ()== "xiz" || f->extension() == "sf2" || f->extension() == "gig" ) && + else if( ( f->extension ()== "xiz" || f->extension() == "sf2" || f->extension() == "gig" || f->extension() == "pat" ) && ! pluginFactory->pluginSupportingExtension(f->extension()).isNull() ) { m_previewPlayHandle = new PresetPreviewPlayHandle( f->fullName(), f->handling() == FileItem::LoadByPlugin ); @@ -489,6 +489,10 @@ void FileBrowserTreeWidget::mouseMoveEvent( QMouseEvent * me ) new StringPairDrag( "soundfontfile", f->fullName(), embed::getIconPixmap( "soundfont_file" ), this ); break; + case FileItem::PatchFile: + new StringPairDrag( "patchfile", f->fullName(), + embed::getIconPixmap( "sample_file" ), this ); + break; case FileItem::VstPluginFile: new StringPairDrag( "vstpluginfile", f->fullName(), embed::getIconPixmap( "vst_plugin_file" ), this ); diff --git a/src/gui/TrackContainerView.cpp b/src/gui/TrackContainerView.cpp index 0f7d43d4c..4c7498ab0 100644 --- a/src/gui/TrackContainerView.cpp +++ b/src/gui/TrackContainerView.cpp @@ -340,7 +340,7 @@ void TrackContainerView::dragEnterEvent( QDragEnterEvent * _dee ) { StringPairDrag::processDragEnterEvent( _dee, QString( "presetfile,pluginpresetfile,samplefile,instrument," - "importedproject,soundfontfile,vstpluginfile,projectfile," + "importedproject,soundfontfile,patchfile,vstpluginfile,projectfile," "track_%1,track_%2" ). arg( Track::InstrumentTrack ). arg( Track::SampleTrack ) ); @@ -378,7 +378,8 @@ void TrackContainerView::dropEvent( QDropEvent * _de ) _de->accept(); } else if( type == "samplefile" || type == "pluginpresetfile" - || type == "soundfontfile" || type == "vstpluginfile") + || type == "soundfontfile" || type == "vstpluginfile" + || type == "patchfile" ) { InstrumentTrack * it = dynamic_cast( Track::create( Track::InstrumentTrack,