mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 00:12:06 +02:00
* Sped up collection removal from Super Collection.
This commit is contained in:
parent
245ed98b88
commit
fa1252716e
@ -25,7 +25,7 @@
|
||||
|
||||
// close the dbsync connection after this much inactivity.
|
||||
// it's automatically reestablished as needed.
|
||||
#define IDLE_TIMEOUT 600000
|
||||
#define IDLE_TIMEOUT 300000
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
@ -78,7 +78,7 @@ CollectionFlatModel::addFilteredCollection( const collection_ptr& collection, un
|
||||
cmd->setSortDescending( true );
|
||||
|
||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ),
|
||||
SLOT( onTracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ) );
|
||||
SLOT( onTracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ), Qt::QueuedConnection );
|
||||
|
||||
TomahawkApp::instance()->database()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
}
|
||||
@ -92,6 +92,9 @@ CollectionFlatModel::removeCollection( const collection_ptr& collection )
|
||||
disconnect( collection.data(), SIGNAL( tracksFinished( Tomahawk::collection_ptr ) ),
|
||||
this, SLOT( onTracksAddingFinished( Tomahawk::collection_ptr ) ) );
|
||||
|
||||
QTime timer;
|
||||
timer.start();
|
||||
|
||||
// QList<PlItem*> plitems = m_collectionIndex.values( collection );
|
||||
QList< QPair< int, int > > rows;
|
||||
QList< QPair< int, int > > sortrows;
|
||||
@ -133,7 +136,6 @@ CollectionFlatModel::removeCollection( const collection_ptr& collection )
|
||||
newrows.insertMulti( col, rowf );
|
||||
}
|
||||
}
|
||||
|
||||
m_collectionRows = newrows;
|
||||
|
||||
qDebug() << "Removing rows:" << row.first << row.second;
|
||||
@ -146,7 +148,7 @@ CollectionFlatModel::removeCollection( const collection_ptr& collection )
|
||||
emit endRemoveRows();
|
||||
}
|
||||
|
||||
// m_collectionIndex.remove( collection );
|
||||
qDebug() << "Collection removed, time elapsed:" << timer.elapsed();
|
||||
|
||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
||||
}
|
||||
@ -197,7 +199,7 @@ CollectionFlatModel::onDataChanged()
|
||||
PlItem* p = (PlItem*)sender();
|
||||
// emit itemSizeChanged( p->index );
|
||||
|
||||
if ( p && p->index.isValid() )
|
||||
if ( p )
|
||||
emit dataChanged( p->index, p->index.sibling( p->index.row(), columnCount() - 1 ) );
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ PlItem::~PlItem()
|
||||
// will fail badly!
|
||||
if ( parent && index.isValid() )
|
||||
{
|
||||
parent->children.removeAt( index.row() );
|
||||
parent->children.remove( index.row() );
|
||||
}
|
||||
|
||||
for ( int i = children.count() - 1; i >= 0; i-- )
|
||||
@ -91,12 +91,14 @@ PlItem::setupItem( const Tomahawk::query_ptr& query, PlItem* parent, int row )
|
||||
m_query = query;
|
||||
if ( query->numResults() )
|
||||
onResultsAdded( query->results() );
|
||||
else
|
||||
{
|
||||
connect( query.data(), SIGNAL( resultsAdded( QList<Tomahawk::result_ptr> ) ),
|
||||
SLOT( onResultsAdded( QList<Tomahawk::result_ptr> ) ), Qt::DirectConnection );
|
||||
|
||||
connect( query.data(), SIGNAL( resultsAdded( QList<Tomahawk::result_ptr> ) ),
|
||||
SLOT( onResultsAdded( QList<Tomahawk::result_ptr> ) ), Qt::DirectConnection );
|
||||
|
||||
connect( query.data(), SIGNAL( resultsRemoved( Tomahawk::result_ptr ) ),
|
||||
SLOT( onResultsRemoved( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
||||
connect( query.data(), SIGNAL( resultsRemoved( Tomahawk::result_ptr ) ),
|
||||
SLOT( onResultsRemoved( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
void setIsPlaying( bool b ) { m_isPlaying = b; emit dataChanged(); }
|
||||
|
||||
PlItem* parent;
|
||||
QList<PlItem*> children;
|
||||
QVector<PlItem*> children;
|
||||
QHash<QString, PlItem*> hash;
|
||||
QString caption;
|
||||
int childCount;
|
||||
|
@ -39,9 +39,11 @@ Source::Source( const QString &username )
|
||||
|
||||
Source::~Source()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
qDebug() << Q_FUNC_INFO << friendlyName();
|
||||
|
||||
return;
|
||||
// TODO mark source as offline in database
|
||||
DatabaseCommand_SourceOffline * cmd = new DatabaseCommand_SourceOffline( id() );
|
||||
DatabaseCommand_SourceOffline* cmd = new DatabaseCommand_SourceOffline( id() );
|
||||
APP->database()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,17 @@ SourceTreeItem::SourceTreeItem( const source_ptr& source, QObject* parent )
|
||||
SLOT( onPlaylistsDeleted( QList<Tomahawk::playlist_ptr> ) ) );
|
||||
}
|
||||
|
||||
m_widget = new SourceTreeItemWidget( source, (QWidget*)parent->parent() );
|
||||
m_widget = new SourceTreeItemWidget( source );
|
||||
connect( m_widget, SIGNAL( clicked() ), SLOT( onClicked() ) );
|
||||
}
|
||||
|
||||
|
||||
SourceTreeItem::~SourceTreeItem()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceTreeItem::onClicked()
|
||||
{
|
||||
|
@ -13,10 +13,7 @@ Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SourceTreeItem( const Tomahawk::source_ptr& source, QObject* parent );
|
||||
virtual ~SourceTreeItem()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
virtual ~SourceTreeItem();
|
||||
|
||||
const Tomahawk::source_ptr& source() const { return m_source; };
|
||||
QList<QStandardItem*> columns() const { return m_columns; };
|
||||
|
@ -230,6 +230,7 @@ TomahawkApp::~TomahawkApp()
|
||||
|
||||
delete m_zeroconf;
|
||||
delete m_db;
|
||||
m_db = 0;
|
||||
|
||||
// always last thing, incase other objects save state on exit:
|
||||
delete m_settings;
|
||||
|
Loading…
x
Reference in New Issue
Block a user