1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Always refresh delegates on item finish, not just when that item had a custom delegate, in case it's switched rows

This commit is contained in:
Jeff Mitchell 2012-06-17 23:10:06 -04:00
parent 259e4f3da9
commit 4f1579274e
4 changed files with 12 additions and 0 deletions

@ -187,6 +187,7 @@ JobStatusModel::itemFinished()
// One less to count, but item is still there
const QModelIndex idx = index( indexOf, 0, QModelIndex() );
emit dataChanged( idx, idx );
emit refreshDelegates();
return;
}
}
@ -203,6 +204,7 @@ JobStatusModel::itemFinished()
if ( item->customDelegate() )
emit customDelegateJobRemoved( idx );
emit refreshDelegates();
tLog() << Q_FUNC_INFO << "current jobs of item type: " << m_jobTypeCount[ item->type() ] << ", current queue size of item type: " << m_jobQueue[ item->type() ].size();
if ( item->concurrentJobLimit() > 0 )

@ -49,6 +49,7 @@ public:
signals:
void customDelegateJobInserted( int row, JobStatusItem* item );
void customDelegateJobRemoved( int row );
void refreshDelegates();
public slots:
/// Takes ownership of job

@ -94,6 +94,7 @@ JobStatusView::setModel( JobStatusModel* m )
connect( m_view->model(), SIGNAL( modelReset() ), this, SLOT( checkCount() ) );
connect( m_view->model(), SIGNAL( customDelegateJobInserted( int, JobStatusItem* ) ), this, SLOT( customDelegateJobInserted( int, JobStatusItem* ) ) );
connect( m_view->model(), SIGNAL( customDelegateJobRemoved( int ) ), this, SLOT( customDelegateJobRemoved( int ) ) );
connect( m_view->model(), SIGNAL( refreshDelegates() ), this, SLOT( refreshDelegates() ) );
}
@ -127,6 +128,13 @@ void
JobStatusView::customDelegateJobRemoved( int row )
{
tLog() << Q_FUNC_INFO << "row is " << row;
}
void
JobStatusView::refreshDelegates()
{
tLog() << Q_FUNC_INFO;
int count = m_model->rowCount();
for ( int i = 0; i < count; i++ )
{

@ -55,6 +55,7 @@ private slots:
void checkCount();
void customDelegateJobInserted( int row, JobStatusItem* item );
void customDelegateJobRemoved( int row );
void refreshDelegates();
private:
QListView* m_view;