mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 17:29:42 +01:00
Add a lot more debugging
This commit is contained in:
parent
d24ff66696
commit
be2847740e
@ -27,17 +27,16 @@
|
||||
|
||||
JobStatusSortModel::JobStatusSortModel( QObject* parent )
|
||||
: QSortFilterProxyModel( parent )
|
||||
, m_subModel( this )
|
||||
, m_sourceModel( this )
|
||||
{
|
||||
setDynamicSortFilter( true );
|
||||
|
||||
connect( &m_subModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SIGNAL( rowsInserted( QModelIndex, int, int ) ) );
|
||||
connect( &m_subModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SIGNAL( rowsRemoved( QModelIndex, int, int ) ) );
|
||||
connect( &m_subModel, SIGNAL( modelReset() ), this, SIGNAL( modelReset() ) );
|
||||
|
||||
connect( &m_subModel, SIGNAL( customDelegateJobInserted( int, JobStatusItem* ) ), this, SLOT( customDelegateJobInsertedSlot( int, JobStatusItem* ) ) );
|
||||
connect( &m_subModel, SIGNAL( customDelegateJobRemoved( int ) ), this, SLOT( customDelegateJobRemovedSlot( int ) ) );
|
||||
connect( &m_subModel, SIGNAL( refreshDelegates() ), this, SLOT( refreshDelegatesSlot() ) );
|
||||
connect( &m_sourceModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( rowsInsertedSlot( QModelIndex, int, int ) ) );
|
||||
connect( &m_sourceModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( rowsRemovedSlot( QModelIndex, int, int ) ) );
|
||||
connect( &m_sourceModel, SIGNAL( modelReset() ), this, SLOT( modelResetSlot() ) );
|
||||
connect( &m_sourceModel, SIGNAL( customDelegateJobInserted( int, JobStatusItem* ) ), this, SLOT( customDelegateJobInsertedSlot( int, JobStatusItem* ) ) );
|
||||
connect( &m_sourceModel, SIGNAL( customDelegateJobRemoved( int ) ), this, SLOT( customDelegateJobRemovedSlot( int ) ) );
|
||||
connect( &m_sourceModel, SIGNAL( refreshDelegates() ), this, SLOT( refreshDelegatesSlot() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -49,27 +48,55 @@ JobStatusSortModel::~JobStatusSortModel()
|
||||
void
|
||||
JobStatusSortModel::addJob( JobStatusItem* item )
|
||||
{
|
||||
m_subModel.addJob( item );
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
m_sourceModel.addJob( item );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusSortModel::rowsInsertedSlot( const QModelIndex& index, int start, int end )
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
emit checkCount();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusSortModel::rowsRemovedSlot( const QModelIndex& index, int start, int end )
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
emit checkCount();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusSortModel::modelResetSlot()
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
emit checkCount();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusSortModel::customDelegateJobInsertedSlot( int row, JobStatusItem* item )
|
||||
{
|
||||
emit customDelegateJobInserted( mapFromSource( m_subModel.index( row ) ).row(), item );
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
emit customDelegateJobInserted( mapFromSource( m_sourceModel.index( row ) ).row(), item );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusSortModel::customDelegateJobRemovedSlot( int row )
|
||||
{
|
||||
emit customDelegateJobRemoved( mapFromSource( m_subModel.index( row ) ).row() );
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
emit customDelegateJobRemoved( mapFromSource( m_sourceModel.index( row ) ).row() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JobStatusSortModel::refreshDelegatesSlot()
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
emit refreshDelegates();
|
||||
}
|
||||
|
||||
@ -77,6 +104,7 @@ JobStatusSortModel::refreshDelegatesSlot()
|
||||
bool
|
||||
JobStatusSortModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
QVariant leftVar = left.data( JobStatusModel::JobDataRole );
|
||||
JobStatusItem* leftItem = leftVar.value< JobStatusItem* >();
|
||||
QVariant rightVar = right.data( JobStatusModel::JobDataRole );
|
||||
@ -216,6 +244,7 @@ JobStatusModel::rowCount( const QModelIndex& parent ) const
|
||||
void
|
||||
JobStatusModel::itemFinished()
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
JobStatusItem* item = qobject_cast< JobStatusItem* >( sender() );
|
||||
Q_ASSERT( item );
|
||||
|
||||
@ -293,6 +322,7 @@ JobStatusModel::itemFinished()
|
||||
void
|
||||
JobStatusModel::itemUpdated()
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
JobStatusItem* item = qobject_cast< JobStatusItem* >( sender() );
|
||||
Q_ASSERT( item );
|
||||
|
||||
|
@ -76,12 +76,16 @@ public:
|
||||
virtual ~JobStatusSortModel();
|
||||
|
||||
signals:
|
||||
void checkCount();
|
||||
void customDelegateJobInserted( int row, JobStatusItem* item );
|
||||
void customDelegateJobRemoved( int row );
|
||||
void refreshDelegates();
|
||||
|
||||
public slots:
|
||||
void addJob( JobStatusItem* item );
|
||||
void rowsInsertedSlot( const QModelIndex& index, int start, int end );
|
||||
void rowsRemovedSlot( const QModelIndex& index, int start, int end );
|
||||
void modelResetSlot();
|
||||
void customDelegateJobInsertedSlot( int row, JobStatusItem* item);
|
||||
void customDelegateJobRemovedSlot( int row );
|
||||
void refreshDelegatesSlot();
|
||||
@ -90,7 +94,7 @@ protected:
|
||||
virtual bool lessThan( const QModelIndex & left, const QModelIndex & right ) const;
|
||||
|
||||
private:
|
||||
JobStatusModel m_subModel;
|
||||
JobStatusModel m_sourceModel;
|
||||
};
|
||||
|
||||
#endif // JOBSTATUSMODEL_H
|
||||
|
@ -89,9 +89,9 @@ JobStatusView::setModel( JobStatusSortModel* m )
|
||||
m_view->setModel( m );
|
||||
m_view->setItemDelegate( new JobStatusDelegate( m_view ) );
|
||||
|
||||
connect( m_view->model(), SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( checkCount() ) );
|
||||
connect( m_view->model(), SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( checkCount() ) );
|
||||
connect( m_view->model(), SIGNAL( modelReset() ), this, SLOT( checkCount() ) );
|
||||
connect( m_view->model(), SIGNAL( checkCount() ), this, SLOT( checkCount() ) );
|
||||
connect( m_view->model(), SIGNAL( checkCount() ), this, SLOT( checkCount() ) );
|
||||
connect( m_view->model(), SIGNAL( checkCount() ), 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() ) );
|
||||
@ -160,6 +160,7 @@ JobStatusView::refreshDelegates()
|
||||
void
|
||||
JobStatusView::checkCount()
|
||||
{
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
m_cachedHeight = -1;
|
||||
if ( m_view->model()->rowCount() == 0 && !isHidden() )
|
||||
emit hideWidget();
|
||||
|
Loading…
x
Reference in New Issue
Block a user