mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 08:04:25 +02:00
* Fixed issue with obsolete TransferView items.
This commit is contained in:
@@ -51,8 +51,8 @@ TransferView::fileTransferFinished( FileTransferConnection* ftc )
|
|||||||
if ( !m_index.contains( ftc ) )
|
if ( !m_index.contains( ftc ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int i = m_index.take( ftc );
|
QPersistentModelIndex i = m_index.take( ftc );
|
||||||
delete m_tree->invisibleRootItem()->takeChild( i );
|
delete m_tree->invisibleRootItem()->takeChild( i.row() );
|
||||||
|
|
||||||
if ( m_tree->invisibleRootItem()->childCount() > 0 )
|
if ( m_tree->invisibleRootItem()->childCount() > 0 )
|
||||||
emit showWidget();
|
emit showWidget();
|
||||||
@@ -71,7 +71,8 @@ void
|
|||||||
TransferView::onTransferUpdate()
|
TransferView::onTransferUpdate()
|
||||||
{
|
{
|
||||||
FileTransferConnection* ftc = (FileTransferConnection*)sender();
|
FileTransferConnection* ftc = (FileTransferConnection*)sender();
|
||||||
qDebug() << Q_FUNC_INFO << ftc->track().isNull() << ftc->source().isNull();
|
// qDebug() << Q_FUNC_INFO << ftc->track().isNull() << ftc->source().isNull();
|
||||||
|
|
||||||
if ( ftc->track().isNull() || ftc->source().isNull() )
|
if ( ftc->track().isNull() || ftc->source().isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -79,13 +80,13 @@ TransferView::onTransferUpdate()
|
|||||||
|
|
||||||
if ( m_index.contains( ftc ) )
|
if ( m_index.contains( ftc ) )
|
||||||
{
|
{
|
||||||
int i = m_index.value( ftc );
|
QPersistentModelIndex i = m_index.value( ftc );
|
||||||
ti = m_tree->invisibleRootItem()->child( i );
|
ti = m_tree->invisibleRootItem()->child( i.row() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ti = new QTreeWidgetItem( m_tree );
|
ti = new QTreeWidgetItem( m_tree );
|
||||||
m_index.insert( ftc, m_tree->invisibleRootItem()->childCount() - 1 );
|
m_index.insert( ftc, QPersistentModelIndex( m_tree->model()->index( m_tree->invisibleRootItem()->childCount() - 1, 0 ) ) );
|
||||||
emit showWidget();
|
emit showWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ private slots:
|
|||||||
void onTransferUpdate();
|
void onTransferUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash< FileTransferConnection*, int > m_index;
|
QHash< FileTransferConnection*, QPersistentModelIndex > m_index;
|
||||||
QTreeWidget* m_tree;
|
QTreeWidget* m_tree;
|
||||||
AnimatedSplitter* m_parent;
|
AnimatedSplitter* m_parent;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user