mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 19:37:09 +02:00
Merge remote branch 'origin' into phonon
This commit is contained in:
@@ -11,6 +11,7 @@ using namespace Tomahawk;
|
||||
|
||||
DatabaseCollection::DatabaseCollection( const source_ptr& src, QObject* parent )
|
||||
: Collection( src, QString( "dbcollection:%1" ).arg( src->userName() ), parent )
|
||||
, m_loadedTracks( false )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -45,6 +46,8 @@ void
|
||||
DatabaseCollection::loadTracks()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << source()->userName();
|
||||
|
||||
m_loadedTracks = true;
|
||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
|
||||
|
||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ),
|
||||
@@ -107,7 +110,7 @@ DatabaseCollection::tracks()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( Collection::tracks().isEmpty() )
|
||||
if ( !m_loadedTracks )
|
||||
{
|
||||
loadTracks();
|
||||
}
|
||||
|
@@ -32,6 +32,9 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void dynamicPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
|
||||
|
||||
private:
|
||||
bool m_loadedTracks;
|
||||
};
|
||||
|
||||
#endif // DATABASECOLLECTION_H
|
||||
|
@@ -24,8 +24,9 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
|
||||
qDebug() << "Using result-hint to speed up resolving:" << m_query->resultHint();
|
||||
|
||||
Tomahawk::result_ptr result = lib->result( m_query->resultHint() );
|
||||
if ( !result.isNull() )
|
||||
if ( !result.isNull() && result->collection()->source()->isOnline() )
|
||||
{
|
||||
res << result;
|
||||
emit results( m_query->id(), res );
|
||||
return;
|
||||
}
|
||||
|
@@ -459,7 +459,7 @@ DatabaseImpl::result( const QString& url )
|
||||
{
|
||||
TomahawkSqlQuery query = newquery();
|
||||
Tomahawk::source_ptr s;
|
||||
Tomahawk::result_ptr res;
|
||||
Tomahawk::result_ptr res = Tomahawk::result_ptr( new Tomahawk::Result() );
|
||||
QString fileUrl;
|
||||
|
||||
if ( url.contains( "servent://" ) )
|
||||
@@ -539,6 +539,7 @@ DatabaseImpl::result( const QString& url )
|
||||
res->setAlbumPos( query.value( 14 ).toUInt() );
|
||||
res->setRID( uuid() );
|
||||
res->setId( query.value( 9 ).toUInt() );
|
||||
res->setCollection( s->collection() );
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@@ -37,7 +37,8 @@ ControlConnection::~ControlConnection()
|
||||
|
||||
delete m_pingtimer;
|
||||
m_servent->unregisterControlConnection(this);
|
||||
if( m_dbsyncconn ) m_dbsyncconn->deleteLater();
|
||||
if( m_dbsyncconn )
|
||||
m_dbsyncconn->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
@@ -96,15 +97,15 @@ ControlConnection::registerSource()
|
||||
// .. but we'll use the shared pointer we've already made:
|
||||
|
||||
m_registered = true;
|
||||
setupDbSyncConnection();
|
||||
m_servent->registerControlConnection( this );
|
||||
setupDbSyncConnection();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ControlConnection::setupDbSyncConnection( bool ondemand )
|
||||
{
|
||||
if( m_dbsyncconn != NULL || !m_registered )
|
||||
if ( m_dbsyncconn || !m_registered )
|
||||
return;
|
||||
|
||||
qDebug() << Q_FUNC_INFO << ondemand << m_source->id();
|
||||
@@ -151,15 +152,20 @@ ControlConnection::dbSyncConnFinished( QObject* c )
|
||||
//qDebug() << "Setting m_dbsyncconn to NULL";
|
||||
m_dbsyncconn = NULL;
|
||||
}
|
||||
else
|
||||
qDebug() << "Old DbSyncConn destroyed?!";
|
||||
}
|
||||
|
||||
|
||||
DBSyncConnection*
|
||||
ControlConnection::dbSyncConnection()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( m_dbsyncconn == NULL )
|
||||
qDebug() << Q_FUNC_INFO << m_source->id();
|
||||
if ( !m_dbsyncconn )
|
||||
{
|
||||
setupDbSyncConnection( true );
|
||||
Q_ASSERT( m_dbsyncconn );
|
||||
}
|
||||
|
||||
return m_dbsyncconn;
|
||||
}
|
||||
|
@@ -422,6 +422,7 @@ TomahawkApp::initLocalCollection()
|
||||
|
||||
src->addCollection( coll );
|
||||
SourceList::instance()->setLocal( src );
|
||||
src->collection()->tracks();
|
||||
|
||||
// to make the stats signal be emitted by our local source
|
||||
// this will update the sidebar, etc.
|
||||
|
Reference in New Issue
Block a user