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