mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-19 23:41:51 +02:00
more crash fixes.....
This commit is contained in:
parent
34fe17a3e6
commit
1c409e40f2
@ -1,5 +1,5 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@ -49,18 +49,18 @@ DynamicView::DynamicView( QWidget* parent )
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
setFrameShape( QFrame::NoFrame );
|
||||
setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
|
||||
|
||||
m_fadeOutAnim.setDuration( FADE_LENGTH );
|
||||
m_fadeOutAnim.setCurveShape( QTimeLine::LinearCurve );
|
||||
m_fadeOutAnim.setFrameRange( 100, 0 );
|
||||
m_fadeOutAnim.setUpdateInterval( 5 );
|
||||
|
||||
|
||||
QEasingCurve curve( QEasingCurve::OutBounce );
|
||||
curve.setAmplitude( .25 );
|
||||
m_slideAnim.setEasingCurve( curve );
|
||||
m_slideAnim.setDirection( QTimeLine::Forward );
|
||||
m_fadeOutAnim.setUpdateInterval( 5 );
|
||||
|
||||
|
||||
connect( &m_fadeOutAnim, SIGNAL( frameChanged( int ) ), viewport(), SLOT( update() ) );
|
||||
connect( &m_fadeOutAnim, SIGNAL( finished() ), this, SLOT( animFinished() ) );
|
||||
}
|
||||
@ -70,12 +70,12 @@ DynamicView::~DynamicView()
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::setDynamicModel( DynamicModel* model)
|
||||
{
|
||||
m_model = model;
|
||||
PlaylistView::setModel( m_model );
|
||||
|
||||
PlaylistView::setPlaylistModel( m_model );
|
||||
|
||||
connect( m_model, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) );
|
||||
connect( m_model, SIGNAL( checkForOverflow() ), this, SLOT( checkForOverflow() ) );
|
||||
}
|
||||
@ -84,37 +84,37 @@ void
|
||||
DynamicView::setOnDemand( bool onDemand )
|
||||
{
|
||||
m_onDemand = onDemand;
|
||||
|
||||
|
||||
if( m_onDemand )
|
||||
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
else
|
||||
setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::setReadOnly( bool readOnly )
|
||||
{
|
||||
m_readOnly = readOnly;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::showMessageTimeout( const QString& title, const QString& body )
|
||||
{
|
||||
m_title = title;
|
||||
m_body = body;
|
||||
|
||||
|
||||
overlay()->setText( QString( "%1:\n\n%2" ).arg( m_title, m_body ) );
|
||||
overlay()->show( 10 );
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::showMessage(const QString& message)
|
||||
{
|
||||
overlay()->setText( message );
|
||||
overlay()->show();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::setDynamicWorking(bool working)
|
||||
{
|
||||
m_working = working;
|
||||
@ -125,7 +125,7 @@ DynamicView::setDynamicWorking(bool working)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::onTrackCountChanged( unsigned int tracks )
|
||||
{
|
||||
if ( tracks == 0 && !m_working )
|
||||
@ -173,7 +173,7 @@ DynamicView::checkForOverflow()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::collapseEntries( int startRow, int num, int numToKeep )
|
||||
{
|
||||
qDebug() << "BEGINNING TO COLLAPSE FROM" << startRow << num << numToKeep;
|
||||
@ -192,7 +192,7 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep )
|
||||
} else {
|
||||
m_fadeOnly = false;
|
||||
}
|
||||
|
||||
|
||||
// we capture the image of the rows we're going to collapse
|
||||
// then we capture the image of the target row we're going to animate downwards
|
||||
// then we fade the first image out while sliding the second image up.
|
||||
@ -204,7 +204,7 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep )
|
||||
QRect fadingRectViewport = fadingRect; // all values that we use in paintEvent() have to be in viewport coords
|
||||
fadingRect.moveTo( viewport()->mapTo( this, fadingRect.topLeft() ) );
|
||||
//fadingRect.setBottom( qMin( fadingRect.bottom(), viewport()->mapTo( this, viewport()->rect().bottomLeft() ).y() ) ); // limit what we capture to the viewport rect, if the last item is partially obscured
|
||||
|
||||
|
||||
m_fadingIndexes = QPixmap::grabWidget( this, fadingRect ); // but all values we use to grab the widgetr have to be in scrollarea coords :(
|
||||
m_fadingPointAnchor = QPoint( 0, fadingRectViewport.topLeft().y() );
|
||||
|
||||
@ -212,7 +212,7 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep )
|
||||
m_bg = backgroundBetween( m_fadingIndexes.rect(), startRow );
|
||||
|
||||
m_fadeOutAnim.start();
|
||||
|
||||
|
||||
qDebug() << "Grabbed fading indexes from rect:" << fadingRect << m_fadingIndexes.size() << "ANCHORED:" << m_fadingPointAnchor;
|
||||
|
||||
if( !m_fadeOnly ) {
|
||||
@ -233,7 +233,7 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep )
|
||||
QRect slidingRectViewport = slidingRect;
|
||||
// map internal view coord to external qscrollarea
|
||||
slidingRect.moveTo( viewport()->mapTo( this, slidingRect.topLeft() ) );
|
||||
|
||||
|
||||
m_slidingIndex = QPixmap::grabWidget( this, slidingRect );
|
||||
m_bottomAnchor = QPoint( 0, slidingRectViewport.topLeft().y() );
|
||||
m_bottomOfAnim = QPoint( 0, slidingRectViewport.bottomLeft().y() );
|
||||
@ -246,7 +246,7 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep )
|
||||
|
||||
QTimer::singleShot( SLIDE_OFFSET, &m_slideAnim, SLOT( start() ) );
|
||||
}
|
||||
|
||||
|
||||
// delete the actual indices
|
||||
QModelIndexList todel;
|
||||
for( int i = 0; i < num; i++ ) {
|
||||
@ -294,11 +294,11 @@ DynamicView::animFinished()
|
||||
m_checkOnCollapse = false;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
DynamicView::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
TrackView::paintEvent(event);
|
||||
|
||||
|
||||
QPainter p( viewport() );
|
||||
if( m_fadeOutAnim.state() == QTimeLine::Running ) { // both run together
|
||||
p.save();
|
||||
@ -316,8 +316,8 @@ DynamicView::paintEvent( QPaintEvent* event )
|
||||
// qDebug() << "FAST SETOPACITY:" << p.paintEngine()->hasFeature(QPaintEngine::ConstantOpacity);
|
||||
p.setOpacity( 1 - m_fadeOutAnim.currentValue() );
|
||||
p.drawPixmap( m_fadingPointAnchor, m_fadingIndexes );
|
||||
p.restore();
|
||||
|
||||
p.restore();
|
||||
|
||||
if( m_slideAnim.state() == QTimeLine::Running ) {
|
||||
// draw the collapsing entry
|
||||
p.drawPixmap( 0, m_slideAnim.currentFrame(), m_slidingIndex );
|
||||
|
@ -65,7 +65,7 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
|
||||
|
||||
m_model = new DynamicModel( this );
|
||||
m_view = new DynamicView( this );
|
||||
m_view->setModel( m_model );
|
||||
m_view->setDynamicModel( m_model );
|
||||
m_view->setContentsMargins( 0, 0, 0, 0 );
|
||||
m_layout->addWidget( m_view, 1 );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user