Skip to content

Commit

Permalink
Fix for LMMS#3926
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0e5b06 committed Oct 31, 2017
1 parent 5af6d95 commit 8a10c52
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 32 deletions.
65 changes: 33 additions & 32 deletions plugins/audio_file_processor/audio_file_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,24 @@ audioFileProcessor::audioFileProcessor( InstrumentTrack * _instrument_track ) :
m_nextPlayBackwards( false )
{
connect( &m_reverseModel, SIGNAL( dataChanged() ),
this, SLOT( reverseModelChanged() ) );
this, SLOT( reverseModelChanged() ) );
connect( &m_ampModel, SIGNAL( dataChanged() ),
this, SLOT( ampModelChanged() ) );
this, SLOT( ampModelChanged() ) );
connect( &m_startPointModel, SIGNAL( dataChanged() ),
this, SLOT( startPointChanged() ) );
this, SLOT( startPointChanged() ) );
connect( &m_endPointModel, SIGNAL( dataChanged() ),
this, SLOT( endPointChanged() ) );
this, SLOT( endPointChanged() ) );
connect( &m_loopPointModel, SIGNAL( dataChanged() ),
this, SLOT( loopPointChanged() ) );
this, SLOT( loopPointChanged() ) );
connect( &m_stutterModel, SIGNAL( dataChanged() ),
this, SLOT( stutterModelChanged() ) );
//interpolation modes
this, SLOT( stutterModelChanged() ) );

//interpolation modes
m_interpolationModel.addItem( tr( "None" ) );
m_interpolationModel.addItem( tr( "Linear" ) );
m_interpolationModel.addItem( tr( "Sinc" ) );
m_interpolationModel.setValue( 1 );

pointChanged();
}

Expand Down Expand Up @@ -795,6 +795,7 @@ AudioFileProcessorWaveView::AudioFileProcessorWaveView( QWidget * _parent, int _

m_graph.fill( Qt::transparent );
update();
updateCursor();
}


Expand All @@ -809,20 +810,34 @@ void AudioFileProcessorWaveView::isPlaying( f_cnt_t _current_frame )



void AudioFileProcessorWaveView::updateCursor( QMouseEvent * _me )
{
if( !m_isDragging &&
(_me != NULL ) &&
( isCloseTo( _me->x(), m_startFrameX ) ||
isCloseTo( _me->x(), m_endFrameX ) ||
isCloseTo( _me->x(), m_loopFrameX ) ))
setCursor(Qt::SizeHorCursor);
else
if( m_isDragging && (m_draggingType == wave) )
setCursor(Qt::ClosedHandCursor);
else
setCursor(Qt::ArrowCursor);
}



void AudioFileProcessorWaveView::enterEvent( QEvent * _e )
{
QApplication::setOverrideCursor( Qt::OpenHandCursor );
updateCursor();
}




void AudioFileProcessorWaveView::leaveEvent( QEvent * _e )
{
while( QApplication::overrideCursor() )
{
QApplication::restoreOverrideCursor();
}
updateCursor();
}


Expand Down Expand Up @@ -850,7 +865,7 @@ void AudioFileProcessorWaveView::mousePressEvent( QMouseEvent * _me )
else
{
m_draggingType = wave;
QApplication::setOverrideCursor( Qt::ClosedHandCursor );
updateCursor(_me);
}
}

Expand All @@ -862,7 +877,7 @@ void AudioFileProcessorWaveView::mouseReleaseEvent( QMouseEvent * _me )
m_isDragging = false;
if( m_draggingType == wave )
{
QApplication::restoreOverrideCursor();
updateCursor(_me);
}
}

Expand All @@ -873,22 +888,7 @@ void AudioFileProcessorWaveView::mouseMoveEvent( QMouseEvent * _me )
{
if( ! m_isDragging )
{
const bool is_size_cursor =
QApplication::overrideCursor()->shape() == Qt::SizeHorCursor;

if( isCloseTo( _me->x(), m_startFrameX ) ||
isCloseTo( _me->x(), m_endFrameX ) ||
isCloseTo( _me->x(), m_loopFrameX ) )
{
if( ! is_size_cursor )
{
QApplication::setOverrideCursor( Qt::SizeHorCursor );
}
}
else if( is_size_cursor )
{
QApplication::restoreOverrideCursor();
}
updateCursor(_me);
return;
}

Expand Down Expand Up @@ -948,6 +948,7 @@ void AudioFileProcessorWaveView::mouseDoubleClickEvent ( QMouseEvent * _me )
default:
break;
};
updateCursor(_me);
};


Expand Down
1 change: 1 addition & 0 deletions plugins/audio_file_processor/audio_file_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class AudioFileProcessorWaveView : public QWidget
{
Q_OBJECT
protected:
virtual void updateCursor( QMouseEvent * _me = NULL );
virtual void enterEvent( QEvent * _e );
virtual void leaveEvent( QEvent * _e );
virtual void mousePressEvent( QMouseEvent * _me );
Expand Down

0 comments on commit 8a10c52

Please sign in to comment.