mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-10 10:10:02 -04:00
Added universal codebase for dragging plugin-specific presets
Added new stringPairDrag type "pluginpresetfile", allowing to drag and drop any kind of plugin-specific preset files everywhere in the program. Adopted changes in ZynAddSubFX plugin.
This commit is contained in:
@@ -291,7 +291,7 @@ void zynAddSubFxView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
stringPairDrag::mimeType() );
|
||||
if( txt.section( ':', 0, 0 ) == "presetfile" )
|
||||
if( txt.section( ':', 0, 0 ) == "pluginpresetfile" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
}
|
||||
@@ -313,7 +313,7 @@ void zynAddSubFxView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
const QString type = stringPairDrag::decodeKey( _de );
|
||||
const QString value = stringPairDrag::decodeValue( _de );
|
||||
if( type == "presetfile" )
|
||||
if( type == "pluginpresetfile" )
|
||||
{
|
||||
castModel<zynAddSubFx>()->loadFile( value );
|
||||
_de->accept();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* file_browser.cpp - implementation of the project-, preset- and
|
||||
* sample-file-browser
|
||||
*
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -474,38 +474,28 @@ void fileBrowserTreeWidget::mouseMoveEvent( QMouseEvent * _me )
|
||||
switch( f->type() )
|
||||
{
|
||||
case fileItem::PresetFile:
|
||||
new stringPairDrag( "presetfile",
|
||||
f->fullName(),
|
||||
embed::getIconPixmap(
|
||||
"preset_file" ),
|
||||
this );
|
||||
new stringPairDrag( f->handling() == fileItem::LoadAsPreset ?
|
||||
"presetfile" : "pluginpresetfile",
|
||||
f->fullName(),
|
||||
embed::getIconPixmap( "preset_file" ), this );
|
||||
break;
|
||||
|
||||
case fileItem::SampleFile:
|
||||
new stringPairDrag( "samplefile",
|
||||
f->fullName(),
|
||||
embed::getIconPixmap(
|
||||
"sample_file" ),
|
||||
this );
|
||||
new stringPairDrag( "samplefile", f->fullName(),
|
||||
embed::getIconPixmap( "sample_file" ), this );
|
||||
break;
|
||||
|
||||
case fileItem::MidiFile:
|
||||
// don't allow dragging FLP-files as FLP import filter clears project
|
||||
// without asking
|
||||
// case fileItem::FlpFile:
|
||||
new stringPairDrag( "importedproject",
|
||||
f->fullName(),
|
||||
embed::getIconPixmap(
|
||||
"midi_file" ),
|
||||
this );
|
||||
new stringPairDrag( "importedproject", f->fullName(),
|
||||
embed::getIconPixmap( "midi_file" ), this );
|
||||
break;
|
||||
|
||||
case fileItem::VstPluginFile:
|
||||
new stringPairDrag( "vstplugin",
|
||||
f->fullName(),
|
||||
embed::getIconPixmap(
|
||||
"sample_file" ),
|
||||
this );
|
||||
new stringPairDrag( "vstplugin", f->fullName(),
|
||||
embed::getIconPixmap( "sample_file" ), this );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* track_container_view.cpp - view-component for trackContainer
|
||||
*
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -363,7 +363,7 @@ void trackContainerView::redoStep( journalEntry & _je )
|
||||
void trackContainerView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
stringPairDrag::processDragEnterEvent( _dee,
|
||||
QString( "presetfile,sampledata,samplefile,instrument,"
|
||||
QString( "presetfile,pluginpresetfile,samplefile,instrument,"
|
||||
"importedproject,track_%1,track_%2" ).
|
||||
arg( track::InstrumentTrack ).
|
||||
arg( track::SampleTrack ) );
|
||||
@@ -386,16 +386,14 @@ void trackContainerView::dropEvent( QDropEvent * _de )
|
||||
//it->toggledInstrumentTrackButton( true );
|
||||
_de->accept();
|
||||
}
|
||||
else if( /*type == "sampledata" || */type == "samplefile" )
|
||||
else if( type == "samplefile" || type == "pluginpresetfile" )
|
||||
{
|
||||
instrumentTrack * it = dynamic_cast<instrumentTrack *>(
|
||||
track::create( track::InstrumentTrack,
|
||||
m_tc ) );
|
||||
const QString iname = /*( type == "sampledata" ) ?
|
||||
"audiofileprocessor" :*/
|
||||
instrument * i = it->loadInstrument(
|
||||
engine::pluginFileHandling()[fileItem::extension(
|
||||
value )];
|
||||
instrument * i = it->loadInstrument( iname );
|
||||
value )]);
|
||||
i->loadFile( value );
|
||||
//it->toggledInstrumentTrackButton( true );
|
||||
_de->accept();
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "effect_rack_view.h"
|
||||
#include "embed.h"
|
||||
#include "engine.h"
|
||||
#include "file_browser.h"
|
||||
#include "fx_mixer.h"
|
||||
#include "fx_mixer_view.h"
|
||||
#include "instrument_sound_shaping.h"
|
||||
@@ -1447,7 +1448,8 @@ void instrumentTrackWindow::focusInEvent( QFocusEvent * )
|
||||
|
||||
void instrumentTrackWindow::dragEnterEventGeneric( QDragEnterEvent * _dee )
|
||||
{
|
||||
stringPairDrag::processDragEnterEvent( _dee, "instrument,presetfile" );
|
||||
stringPairDrag::processDragEnterEvent( _dee, "instrument,presetfile,"
|
||||
"pluginpresetfile" );
|
||||
}
|
||||
|
||||
|
||||
@@ -1480,6 +1482,18 @@ void instrumentTrackWindow::dropEvent( QDropEvent * _de )
|
||||
engine::getSong()->setModified();
|
||||
_de->accept();
|
||||
}
|
||||
else if( type == "pluginpresetfile" )
|
||||
{
|
||||
const QString ext = fileItem::extension( value );
|
||||
instrument * i = m_track->getInstrument();
|
||||
if( !i->getDescriptor()->supportsFileType( ext ) )
|
||||
{
|
||||
i = m_track->loadInstrument(
|
||||
engine::pluginFileHandling()[ext] );
|
||||
}
|
||||
i->loadFile( value );
|
||||
_de->accept();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user