821 changed to use sockets/ slots

This commit is contained in:
Dave French
2015-01-21 11:55:30 +00:00
parent b3d943920c
commit 1cf9300f72
5 changed files with 36 additions and 28 deletions

View File

@@ -129,6 +129,11 @@ public:
m_ppt / MidiTime::ticksPerTact() );
}
signals:
void regionSelectedFromPixels( int, int );
void selectionFinished();
public slots:
void updatePosition( const MidiTime & );
@@ -172,7 +177,6 @@ private:
TextFloat * m_hint;
SongEditor *m_songEditor;
int m_initalXSelect;

View File

@@ -92,26 +92,6 @@ public:
return( QVector<selectableObject *>() );
}
///
/// \brief selectRegionFromPixels
/// \param x
/// \param y
/// Use the rubber band to select TCO from all tracks using x, y pixels
void selectRegionFromPixels(int x, int y)
{
m_rubberBand->setEnabled( true );
m_rubberBand->show();
m_rubberBand->setGeometry( min( x, y ), 0, max( x, y ) - min( x, y ), std::numeric_limits<int>::max() );
}
///
/// \brief stopRubberBand
/// Removes the rubber band from display when finished with.
void stopRubberBand()
{
m_rubberBand->hide();
m_rubberBand->setEnabled( false );
}
TrackContainer* model()
{
@@ -146,6 +126,17 @@ public slots:
virtual void dropEvent( QDropEvent * _de );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
///
/// \brief selectRegionFromPixels
/// \param x
/// \param y
/// Use the rubber band to select TCO from all tracks using x, y pixels
void selectRegionFromPixels(int x, int y);
///
/// \brief stopRubberBand
/// Removes the rubber band from display when finished with.
void stopRubberBand();
protected:
static const int DEFAULT_PIXELS_PER_TACT = 16;

View File

@@ -106,7 +106,6 @@ TimeLineWidget::TimeLineWidget( const int _xoff, const int _yoff, const float _p
connect( update_timer, SIGNAL( timeout() ),
this, SLOT( updatePosition() ) );
update_timer->start( 50 );
m_songEditor = dynamic_cast<SongEditor*>(_parent);
}
@@ -294,7 +293,7 @@ void TimeLineWidget::mousePressEvent( QMouseEvent* event )
m_moveXOff = s_posMarkerPixmap->width() / 2;
}
}
else if( event->button() == Qt::LeftButton && (event->modifiers() & Qt::ShiftModifier) && m_songEditor )
else if( event->button() == Qt::LeftButton && (event->modifiers() & Qt::ShiftModifier) )
{
m_action = SelectSongTCO;
m_initalXSelect = event->x();
@@ -381,10 +380,7 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
break;
}
case SelectSongTCO:
if( m_songEditor )
{
m_songEditor->selectRegionFromPixels( m_initalXSelect , event->x() );
}
emit regionSelectedFromPixels( m_initalXSelect , event->x() );
break;
default:
@@ -399,7 +395,7 @@ void TimeLineWidget::mouseReleaseEvent( QMouseEvent* event )
{
delete m_hint;
m_hint = NULL;
if(m_action == SelectSongTCO && m_songEditor ) { m_songEditor->stopRubberBand(); }
if ( m_action == SelectSongTCO ) { emit selectionFinished(); }
m_action = NoAction;
}

View File

@@ -313,6 +313,19 @@ void TrackContainerView::dragEnterEvent( QDragEnterEvent * _dee )
arg( Track::SampleTrack ) );
}
void TrackContainerView::selectRegionFromPixels(int x, int y)
{
m_rubberBand->setEnabled( true );
m_rubberBand->show();
m_rubberBand->setGeometry( min( x, y ), 0, max( x, y ) - min( x, y ), std::numeric_limits<int>::max() );
}
void TrackContainerView::stopRubberBand()
{
m_rubberBand->hide();
m_rubberBand->setEnabled( false );
}

View File

@@ -98,6 +98,10 @@ SongEditor::SongEditor( Song * _song ) :
SLOT( updatePosition( const MidiTime & ) ) );
connect( m_timeLine, SIGNAL( positionChanged( const MidiTime & ) ),
this, SLOT( updatePosition( const MidiTime & ) ) );
connect( m_timeLine, SIGNAL( regionSelectedFromPixels( int, int ) ),
this, SLOT( selectRegionFromPixels( int, int ) ) );
connect( m_timeLine, SIGNAL( selectionFinished() ),
this, SLOT( stopRubberBand() ) );
m_positionLine = new positionLine( this );