mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Get rid of query_ptrs in Collection.
This commit is contained in:
@@ -68,7 +68,6 @@ Collection::addPlaylist( const Tomahawk::playlist_ptr& p )
|
|||||||
|
|
||||||
QList<playlist_ptr> toadd;
|
QList<playlist_ptr> toadd;
|
||||||
toadd << p;
|
toadd << p;
|
||||||
// qDebug() << "Inserted playlist with guid:" << p->guid();
|
|
||||||
m_playlists.insert( p->guid(), p );
|
m_playlists.insert( p->guid(), p );
|
||||||
|
|
||||||
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
||||||
@@ -83,7 +82,6 @@ Collection::addAutoPlaylist( const Tomahawk::dynplaylist_ptr& p )
|
|||||||
{
|
{
|
||||||
QList<dynplaylist_ptr> toadd;
|
QList<dynplaylist_ptr> toadd;
|
||||||
toadd << p;
|
toadd << p;
|
||||||
// qDebug() << "Inserted dynamic playlist with guid:" << p->guid();
|
|
||||||
m_autoplaylists.insert( p->guid(), p );
|
m_autoplaylists.insert( p->guid(), p );
|
||||||
|
|
||||||
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
||||||
@@ -98,7 +96,6 @@ Collection::addStation( const dynplaylist_ptr& s )
|
|||||||
{
|
{
|
||||||
QList<dynplaylist_ptr> toadd;
|
QList<dynplaylist_ptr> toadd;
|
||||||
toadd << s;
|
toadd << s;
|
||||||
// qDebug() << "Inserted station with guid:" << s->guid();
|
|
||||||
m_stations.insert( s->guid(), s );
|
m_stations.insert( s->guid(), s );
|
||||||
|
|
||||||
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
||||||
@@ -167,7 +164,6 @@ Collection::autoPlaylist( const QString& guid )
|
|||||||
dynplaylist_ptr
|
dynplaylist_ptr
|
||||||
Collection::station( const QString& guid )
|
Collection::station( const QString& guid )
|
||||||
{
|
{
|
||||||
|
|
||||||
return m_stations.value( guid, dynplaylist_ptr() );
|
return m_stations.value( guid, dynplaylist_ptr() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +171,6 @@ Collection::station( const QString& guid )
|
|||||||
void
|
void
|
||||||
Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << plists.count();
|
|
||||||
foreach ( const playlist_ptr& p, plists )
|
foreach ( const playlist_ptr& p, plists )
|
||||||
{
|
{
|
||||||
// qDebug() << "Batch inserting playlist:" << p->guid();
|
// qDebug() << "Batch inserting playlist:" << p->guid();
|
||||||
@@ -190,8 +185,6 @@ Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
|||||||
void
|
void
|
||||||
Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << plists.count();
|
|
||||||
|
|
||||||
foreach ( const dynplaylist_ptr& p, plists )
|
foreach ( const dynplaylist_ptr& p, plists )
|
||||||
{
|
{
|
||||||
// qDebug() << "Batch inserting dynamic playlist:" << p->guid();
|
// qDebug() << "Batch inserting dynamic playlist:" << p->guid();
|
||||||
@@ -204,8 +197,6 @@ Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
|||||||
void
|
void
|
||||||
Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << stations.count();
|
|
||||||
|
|
||||||
foreach ( const dynplaylist_ptr& s, stations )
|
foreach ( const dynplaylist_ptr& s, stations )
|
||||||
{
|
{
|
||||||
// qDebug() << "Batch inserting station:" << s->guid();
|
// qDebug() << "Batch inserting station:" << s->guid();
|
||||||
@@ -216,56 +207,29 @@ Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Collection::setTracks( const QList<Tomahawk::query_ptr>& tracks )
|
Collection::setTracks( const QList<unsigned int>& ids )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << tracks.count() << name();
|
qDebug() << Q_FUNC_INFO << ids.count() << name();
|
||||||
|
|
||||||
emit tracksAdded( tracks );
|
emit tracksAdded( ids );
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Collection::delTracks( const QStringList& files )
|
Collection::delTracks( const QList<unsigned int>& ids )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << files.count() << name();
|
qDebug() << Q_FUNC_INFO << ids.count() << name();
|
||||||
|
|
||||||
|
emit tracksRemoved( ids );
|
||||||
emit changed();
|
emit changed();
|
||||||
|
|
||||||
/* QList<Tomahawk::query_ptr> tracks;
|
|
||||||
int i = 0;
|
|
||||||
foreach ( const query_ptr& query, m_tracks )
|
|
||||||
{
|
|
||||||
foreach ( const QString& file, files )
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
foreach ( const result_ptr& result, query->results() )
|
|
||||||
{
|
|
||||||
if ( file == result->url() )
|
|
||||||
{
|
|
||||||
// qDebug() << Q_FUNC_INFO << "Found deleted result:" << file;
|
|
||||||
tracks << query;
|
|
||||||
m_tracks.removeAt( i );
|
|
||||||
i--;
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( found )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
tDebug() << "Emitting tracks removed:" << tracks.size();
|
|
||||||
emit tracksRemoved( tracks );*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Collection::moveAutoToStation( const QString& guid )
|
Collection::moveAutoToStation( const QString& guid )
|
||||||
{
|
{
|
||||||
if( m_autoplaylists.contains( guid ) )
|
if ( m_autoplaylists.contains( guid ) )
|
||||||
m_stations.insert( guid, m_autoplaylists.take( guid ) );
|
m_stations.insert( guid, m_autoplaylists.take( guid ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +237,6 @@ Collection::moveAutoToStation( const QString& guid )
|
|||||||
void
|
void
|
||||||
Collection::moveStationToAuto( const QString& guid )
|
Collection::moveStationToAuto( const QString& guid )
|
||||||
{
|
{
|
||||||
if( m_stations.contains( guid ) )
|
if ( m_stations.contains( guid ) )
|
||||||
m_autoplaylists.insert( guid, m_stations.take( guid ) );
|
m_autoplaylists.insert( guid, m_stations.take( guid ) );
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
#include "functimeout.h"
|
#include "functimeout.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||||
#include "query.h"
|
|
||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
@@ -79,8 +78,8 @@ public:
|
|||||||
unsigned int lastmodified() const { return m_lastmodified; }
|
unsigned int lastmodified() const { return m_lastmodified; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
|
void tracksAdded( const QList<unsigned int>& ids );
|
||||||
void tracksRemoved( const QList<Tomahawk::query_ptr>& tracks );
|
void tracksRemoved( const QList<unsigned int>& ids );
|
||||||
|
|
||||||
void playlistsAdded( const QList<Tomahawk::playlist_ptr>& );
|
void playlistsAdded( const QList<Tomahawk::playlist_ptr>& );
|
||||||
void playlistsDeleted( const QList<Tomahawk::playlist_ptr>& );
|
void playlistsDeleted( const QList<Tomahawk::playlist_ptr>& );
|
||||||
@@ -101,8 +100,8 @@ public slots:
|
|||||||
void setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& autoplists );
|
void setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& autoplists );
|
||||||
void setStations( const QList< Tomahawk::dynplaylist_ptr >& stations );
|
void setStations( const QList< Tomahawk::dynplaylist_ptr >& stations );
|
||||||
|
|
||||||
void setTracks( const QList<Tomahawk::query_ptr>& tracks );
|
void setTracks( const QList<unsigned int>& ids );
|
||||||
void delTracks( const QStringList& files );
|
void delTracks( const QList<unsigned int>& ids );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
@@ -56,7 +56,6 @@ DatabaseCommand_AddFiles::files() const
|
|||||||
void
|
void
|
||||||
DatabaseCommand_AddFiles::postCommitHook()
|
DatabaseCommand_AddFiles::postCommitHook()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
if ( source().isNull() || source()->collection().isNull() )
|
if ( source().isNull() || source()->collection().isNull() )
|
||||||
{
|
{
|
||||||
qDebug() << "Source has gone offline, not emitting to GUI.";
|
qDebug() << "Source has gone offline, not emitting to GUI.";
|
||||||
@@ -67,13 +66,13 @@ DatabaseCommand_AddFiles::postCommitHook()
|
|||||||
// collection browser will update/fade in etc.
|
// collection browser will update/fade in etc.
|
||||||
Collection* coll = source()->collection().data();
|
Collection* coll = source()->collection().data();
|
||||||
|
|
||||||
connect( this, SIGNAL( notify( QList<Tomahawk::query_ptr> ) ),
|
connect( this, SIGNAL( notify( QList<unsigned int> ) ),
|
||||||
coll, SLOT( setTracks( QList<Tomahawk::query_ptr> ) ),
|
coll, SLOT( setTracks( QList<unsigned int> ) ),
|
||||||
Qt::QueuedConnection );
|
Qt::QueuedConnection );
|
||||||
|
|
||||||
emit notify( m_queries );
|
emit notify( m_ids );
|
||||||
|
|
||||||
if( source()->isLocal() )
|
if ( source()->isLocal() )
|
||||||
{
|
{
|
||||||
Servent::instance()->triggerDBSync();
|
Servent::instance()->triggerDBSync();
|
||||||
|
|
||||||
@@ -185,7 +184,7 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
|
|||||||
query_trackattr.bindValue( 2, year );
|
query_trackattr.bindValue( 2, year );
|
||||||
query_trackattr.exec();
|
query_trackattr.exec();
|
||||||
|
|
||||||
QVariantMap attr;
|
/* QVariantMap attr;
|
||||||
Tomahawk::query_ptr query = Tomahawk::Query::get( artist, track, album );
|
Tomahawk::query_ptr query = Tomahawk::Query::get( artist, track, album );
|
||||||
attr["releaseyear"] = m.value( "year" );
|
attr["releaseyear"] = m.value( "year" );
|
||||||
|
|
||||||
@@ -210,12 +209,13 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
|
|||||||
results << result;
|
results << result;
|
||||||
query->addResults( results );
|
query->addResults( results );
|
||||||
|
|
||||||
m_queries << query;
|
m_queries << query;*/
|
||||||
|
|
||||||
|
m_ids << trackid;
|
||||||
added++;
|
added++;
|
||||||
}
|
}
|
||||||
qDebug() << "Inserted" << added << "tracks to database";
|
qDebug() << "Inserted" << added << "tracks to database";
|
||||||
|
|
||||||
// TODO building the index could be a separate job, outside this transaction
|
|
||||||
if ( added )
|
if ( added )
|
||||||
source()->updateIndexWhenSynced();
|
source()->updateIndexWhenSynced();
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -55,11 +55,11 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done( const QList<QVariant>&, const Tomahawk::collection_ptr& );
|
void done( const QList<QVariant>&, const Tomahawk::collection_ptr& );
|
||||||
void notify( const QList<Tomahawk::query_ptr>& );
|
void notify( const QList<unsigned int>& ids );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantList m_files;
|
QVariantList m_files;
|
||||||
QList<Tomahawk::query_ptr> m_queries;
|
QList<unsigned int> m_ids;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATABASECOMMAND_ADDFILES_H
|
#endif // DATABASECOMMAND_ADDFILES_H
|
||||||
|
@@ -45,11 +45,14 @@ DatabaseCommand_DeleteFiles::postCommitHook()
|
|||||||
// collection browser will update/fade in etc.
|
// collection browser will update/fade in etc.
|
||||||
Collection* coll = source()->collection().data();
|
Collection* coll = source()->collection().data();
|
||||||
|
|
||||||
connect( this, SIGNAL( notify( QStringList ) ),
|
connect( this, SIGNAL( notify( QList<unsigned int> ) ),
|
||||||
coll, SLOT( delTracks( QStringList ) ), Qt::QueuedConnection );
|
coll, SLOT( delTracks( QList<unsigned int> ) ), Qt::QueuedConnection );
|
||||||
|
|
||||||
tDebug() << "Notifying of deleted tracks: " << m_files.size() << " from source " << source()->id();
|
tDebug() << "Notifying of deleted tracks:" << m_ids.size() << "from source" << source()->id();
|
||||||
emit notify( m_files );
|
QList<unsigned int> ids;
|
||||||
|
foreach ( QVariant id, m_ids )
|
||||||
|
ids << id.toUInt();
|
||||||
|
emit notify( ids );
|
||||||
|
|
||||||
if( source()->isLocal() )
|
if( source()->isLocal() )
|
||||||
Servent::instance()->triggerDBSync();
|
Servent::instance()->triggerDBSync();
|
||||||
@@ -59,7 +62,6 @@ DatabaseCommand_DeleteFiles::postCommitHook()
|
|||||||
void
|
void
|
||||||
DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO;
|
|
||||||
Q_ASSERT( !source().isNull() );
|
Q_ASSERT( !source().isNull() );
|
||||||
|
|
||||||
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
||||||
@@ -68,7 +70,6 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
|
|
||||||
if ( source()->isLocal() )
|
if ( source()->isLocal() )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << " source is local";
|
|
||||||
if ( m_dir.path() != QString( "." ) )
|
if ( m_dir.path() != QString( "." ) )
|
||||||
{
|
{
|
||||||
tDebug() << "Deleting" << m_dir.path() << "from db for localsource" << srcid;
|
tDebug() << "Deleting" << m_dir.path() << "from db for localsource" << srcid;
|
||||||
@@ -95,7 +96,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
}
|
}
|
||||||
else if ( !m_ids.isEmpty() )
|
else if ( !m_ids.isEmpty() )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << " deleting given ids";
|
tDebug() << Q_FUNC_INFO << "deleting given ids";
|
||||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||||
|
|
||||||
QString idstring;
|
QString idstring;
|
||||||
@@ -104,23 +105,19 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
idstring.chop( 2 ); //remove the trailing ", "
|
idstring.chop( 2 ); //remove the trailing ", "
|
||||||
|
|
||||||
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL AND id IN ( %1 )" ).arg( idstring ) );
|
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL AND id IN ( %1 )" ).arg( idstring ) );
|
||||||
|
|
||||||
dirquery.exec();
|
dirquery.exec();
|
||||||
while ( dirquery.next() )
|
while ( dirquery.next() )
|
||||||
{
|
{
|
||||||
//tDebug() << Q_FUNC_INFO << " found dirquery value 0: " << dirquery.value( 0 ).toString() << " and value 1: " << dirquery.value( 1 ).toString();
|
|
||||||
m_files << dirquery.value( 1 ).toString();
|
m_files << dirquery.value( 1 ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//tDebug() << Q_FUNC_INFO << " executed query was: " << dirquery.executedQuery();
|
|
||||||
//tDebug() << Q_FUNC_INFO << " files selected for delete: " << m_files;
|
|
||||||
}
|
}
|
||||||
else if ( m_deleteAll )
|
else if ( m_deleteAll )
|
||||||
{
|
{
|
||||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||||
|
|
||||||
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL" ) );
|
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL" ) );
|
||||||
|
|
||||||
dirquery.exec();
|
dirquery.exec();
|
||||||
while ( dirquery.next() )
|
while ( dirquery.next() )
|
||||||
{
|
{
|
||||||
@@ -134,10 +131,10 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
if ( m_deleteAll )
|
if ( m_deleteAll )
|
||||||
{
|
{
|
||||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||||
|
|
||||||
dirquery.prepare( QString( "SELECT url FROM file WHERE source = %1" ).arg( source()->id() ) );
|
dirquery.prepare( QString( "SELECT url FROM file WHERE source = %1" ).arg( source()->id() ) );
|
||||||
|
|
||||||
dirquery.exec();
|
dirquery.exec();
|
||||||
|
|
||||||
while ( dirquery.next() )
|
while ( dirquery.next() )
|
||||||
m_ids << dirquery.value( 0 ).toString();
|
m_ids << dirquery.value( 0 ).toString();
|
||||||
}
|
}
|
||||||
@@ -151,43 +148,28 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
if ( !m_ids.isEmpty() )
|
if ( !m_ids.isEmpty() )
|
||||||
{
|
{
|
||||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1" )
|
delquery.prepare( QString( "DELETE FROM file WHERE source %1" )
|
||||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
||||||
|
|
||||||
if( !delquery.exec() )
|
delquery.exec();
|
||||||
{
|
|
||||||
qDebug() << "Failed to delete file:"
|
|
||||||
<< delquery.lastError().databaseText()
|
|
||||||
<< delquery.lastError().driverText()
|
|
||||||
<< delquery.boundValues();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !m_ids.isEmpty() )
|
else if ( !m_ids.isEmpty() )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << " executing delete";
|
|
||||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND %2 IN ( ? )" )
|
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND %2 IN ( ? )" )
|
||||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
|
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
|
||||||
.arg( source()->isLocal() ? "id" : "url" ) );
|
.arg( source()->isLocal() ? "id" : "url" ) );
|
||||||
|
|
||||||
QString idstring;
|
QString idstring;
|
||||||
foreach( const QVariant& id, m_ids )
|
foreach( const QVariant& id, m_ids )
|
||||||
idstring.append( id.toString() + ", " );
|
idstring.append( id.toString() + ", " );
|
||||||
idstring.chop( 2 ); //remove the trailing ", "
|
idstring.chop( 2 ); //remove the trailing ", "
|
||||||
|
|
||||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND %2 IN ( %3 )" )
|
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND %2 IN ( %3 )" )
|
||||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
|
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
|
||||||
.arg( source()->isLocal() ? "id" : "url" )
|
.arg( source()->isLocal() ? "id" : "url" )
|
||||||
.arg( idstring ) );
|
.arg( idstring ) );
|
||||||
|
|
||||||
if( !delquery.exec() )
|
|
||||||
{
|
|
||||||
qDebug() << "Failed to delete file:"
|
|
||||||
<< delquery.lastError().databaseText()
|
|
||||||
<< delquery.lastError().driverText()
|
|
||||||
<< delquery.boundValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
//tDebug() << Q_FUNC_INFO << " executed query was: " << delquery.executedQuery();
|
delquery.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit done( m_files, source()->collection() );
|
emit done( m_files, source()->collection() );
|
||||||
|
@@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done( const QStringList&, const Tomahawk::collection_ptr& );
|
void done( const QStringList&, const Tomahawk::collection_ptr& );
|
||||||
void notify( const QStringList& );
|
void notify( const QList<unsigned int>& ids );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_files;
|
QStringList m_files;
|
||||||
|
@@ -502,6 +502,7 @@ TomahawkApp::initServent()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkApp::initSIP()
|
TomahawkApp::initSIP()
|
||||||
{
|
{
|
||||||
@@ -518,6 +519,7 @@ TomahawkApp::initSIP()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkApp::spotifyApiCheckFinished()
|
TomahawkApp::spotifyApiCheckFinished()
|
||||||
{
|
{
|
||||||
@@ -543,7 +545,6 @@ TomahawkApp::activate()
|
|||||||
bool
|
bool
|
||||||
TomahawkApp::loadUrl( const QString& url )
|
TomahawkApp::loadUrl( const QString& url )
|
||||||
{
|
{
|
||||||
activate();
|
|
||||||
if ( url.startsWith( "tomahawk://" ) )
|
if ( url.startsWith( "tomahawk://" ) )
|
||||||
return GlobalActionManager::instance()->parseTomahawkLink( url );
|
return GlobalActionManager::instance()->parseTomahawkLink( url );
|
||||||
else if ( url.contains( "open.spotify.com" ) || url.contains( "spotify:track" ) )
|
else if ( url.contains( "open.spotify.com" ) || url.contains( "spotify:track" ) )
|
||||||
@@ -561,7 +562,8 @@ TomahawkApp::loadUrl( const QString& url )
|
|||||||
l->load( QUrl::fromUserInput( url ) );
|
l->load( QUrl::fromUserInput( url ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if ( info.suffix() == "jspf" )
|
}
|
||||||
|
else if ( info.suffix() == "jspf" )
|
||||||
{
|
{
|
||||||
JSPFLoader* l = new JSPFLoader( true, this );
|
JSPFLoader* l = new JSPFLoader( true, this );
|
||||||
tDebug( LOGINFO ) << "Loading j-spiff:" << url;
|
tDebug( LOGINFO ) << "Loading j-spiff:" << url;
|
||||||
@@ -580,10 +582,9 @@ TomahawkApp::instanceStarted( KDSingleApplicationGuard::Instance instance )
|
|||||||
{
|
{
|
||||||
tDebug( LOGINFO ) << "Instance started!" << instance.pid << instance.arguments;
|
tDebug( LOGINFO ) << "Instance started!" << instance.pid << instance.arguments;
|
||||||
|
|
||||||
|
activate();
|
||||||
if ( instance.arguments.size() < 2 )
|
if ( instance.arguments.size() < 2 )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QString arg1 = instance.arguments[ 1 ];
|
QString arg1 = instance.arguments[ 1 ];
|
||||||
loadUrl( arg1 );
|
loadUrl( arg1 );
|
||||||
|
@@ -137,7 +137,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE( QPersistentModelIndex )
|
Q_DECLARE_METATYPE( QPersistentModelIndex )
|
||||||
Q_DECLARE_METATYPE(PairList)
|
Q_DECLARE_METATYPE( PairList )
|
||||||
|
|
||||||
#endif // TOMAHAWKAPP_H
|
#endif // TOMAHAWKAPP_H
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user