From 5933bfb3b95f584e5762e10ff3dcbfed21504023 Mon Sep 17 00:00:00 2001 From: saker Date: Sat, 13 Jan 2024 21:46:13 -0500 Subject: [PATCH] Fix AFP playback indicator not shown when dragging and dropping samples The issue occurred because `AudioFileProcessorWaveView::updateSampleRange` was not being called in `AudioFileProcessorWaveView::dropEvent`. --- .../AudioFileProcessor/AudioFileProcessor.cpp | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/plugins/AudioFileProcessor/AudioFileProcessor.cpp b/plugins/AudioFileProcessor/AudioFileProcessor.cpp index ce3c9c07b90..f99d9370a20 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessor.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessor.cpp @@ -611,29 +611,26 @@ void AudioFileProcessorView::newWaveView() void AudioFileProcessorView::dropEvent( QDropEvent * _de ) { - QString type = StringPairDrag::decodeKey( _de ); - QString value = StringPairDrag::decodeValue( _de ); - if( type == "samplefile" ) + const auto type = StringPairDrag::decodeKey(_de); + const auto value = StringPairDrag::decodeValue(_de); + + if (type == "samplefile") { castModel()->setAudioFile(value); } + else if (type == QString("clip_%1").arg(static_cast(Track::Type::Sample))) { - castModel()->setAudioFile( value ); - _de->accept(); - newWaveView(); - return; + DataFile dataFile(value.toUtf8()); + castModel()->setAudioFile(dataFile.content().firstChild().toElement().attribute("src")); } - else if( type == QString( "clip_%1" ).arg( static_cast(Track::Type::Sample) ) ) + else { - DataFile dataFile( value.toUtf8() ); - castModel()->setAudioFile( dataFile.content().firstChild().toElement().attribute( "src" ) ); - _de->accept(); + _de->ignore(); return; } - _de->ignore(); + m_waveView->updateSampleRange(); + Engine::getSong()->setModified(); + _de->accept(); } - - - void AudioFileProcessorView::paintEvent( QPaintEvent * ) { QPainter p( this );