1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Merge branch 'master' into accounts

This commit is contained in:
Jeff Mitchell
2011-11-06 12:37:40 -05:00
13 changed files with 81 additions and 137 deletions

View File

@@ -1,58 +1,53 @@
Version 0.3.0: Version 0.3.0:
* Fixed bug where we would download http:// tracks twice.
* Make artist names in the album view clickable. * Make artist names in the album view clickable.
* Don't start playing if a tomahawk:// link was clicked while Tomahawk * Don't start playing if a tomahawk:// link was clicked while Tomahawk
is paused. is paused.
* Make artist name clickable in header of Album pages. * Make artist name clickable in header of Album pages.
* Fixed adding social actions such as loved tracks from other sources. * Added a drop shadow to cover images, and put placeholder in jewel case.
* Added a drop shadow to cover images, and put CD placeholder in jewel
case.
* Added shuffle and repeat support to tree view. * Added shuffle and repeat support to tree view.
* Draw a speaker next to the currently playing playlist. * Draw a speaker next to the currently playing playlist.
* Refresh station previews whenever a filter is changed. * Refresh station previews whenever a filter is changed.
* Support and show official releases on album and track pages. * Support and show official releases on album and track pages.
* Filter out duplicates from station previews and upcoming tracks. * Filter out duplicates from station previews and upcoming tracks.
* Resolve lists top-down.
* Added YouTube resolver. * Added YouTube resolver.
* Fixed bug where going offline then online would not re-connect to many * Fixed bug where going offline then online would not re-connect to many
peers. peers.
* Added support for auto-updating live xspf playlists. * Added support for auto-updating live XSPF playlists.
* Don't show an age of 41 for tracks that have no age information. * Don't show an age of 41 years for tracks that have no age information.
* Show config UI for resolvers that have them as so on as you add the resolver. * Show config UI for resolvers that have them as soon as you add them.
* Add support for Echo Nest Personal Catalogs and User Radio. Synchronize * Add support for Echo Nest Personal Catalogs and User Radio. Synchronize
your catalog with The Echo Nest and enable personal recommendations your catalog with The Echo Nest and enable personal recommendations
from you and your friends. from you and your friends.
* Added support for Grooveshark resolver (requires Grooveshark Anywhere). * Added support for Grooveshark resolver (requires Grooveshark Anywhere).
* Fixed re-resolving when resolvers or sources go offline. * Fixed re-resolving when resolvers or sources go off- / online.
* Correctly sort recently played tracks on the Dashboard. * Correctly sort recently played tracks on the Dashboard.
* Show a Lion full-screen toggle button if running on Lion. * Show a Lion full-screen toggle button if running on Lion.
* Display list of who is currently listening along to you. * Show a list of users who are currently listening along to you.
* Show headphone icon in source item to allow users to listen along; paint * Show headphone icon in source item to allow users to listen along; paint
headphones red on a source if the user is listening along to it. headphones red on a source if you are currently listening along to it.
* Added new job status view in the bottom of the source list that displays * Added new job status view in the bottom of the source list that displays
current jobs such as resolving, parsing playlists, and loading from current jobs such as resolving, parsing playlists, and loading from
database. database.
* Parse and convert a Spotify playlist url when dropped anywhere on the * Parse and convert a Spotify playlist url when dropped anywhere on the
sidebar sidebar.
* Convert resolvers to use asynchronous calls to avoid blocking Tomahawk's * Convert resolvers to use asynchronous calls to avoid blocking Tomahawk's
UI, greatly increasing responsiveness of Tomahawk while resolving. UI, greatly increasing responsiveness of Tomahawk while resolving.
* Fixed no playlists overlay not disappearing when playlists were added. * Fixed no playlists overlay not disappearing when playlists were added.
* Add support for parsing itunes track, artist and album links. * Add support for parsing itunes track, artist and album links.
* Fixed crash when syncing playlists with peers. * Fixed crash when syncing playlists with peers.
* Add support for browsing, downloading and rating resolvers * Add support for browsing, downloading and rating resolvers from within
from inside Tomahawk directly. Tomahawk directly.
* Support multi-folder selection and scanning. * Support multi-folder selection and scanning.
* Actually remove deleted files from the collection.
* Fixed handling of special characters in tomahawk:// links * Fixed handling of special characters in tomahawk:// links
* Improve sidebar performance by caching pixmaps and shrinking them. * Improve sidebar performance by caching pixmaps and shrinking them.
* Send updated playlists to peers when tracks are moved/copied. * Send updated playlists to peers when tracks are moved/copied.
* Remove splitter handles in sidebar * Remove splitter handles in sidebar.
* Fixed Tomahawk preventing system shutdown / logut. * Fixed Tomahawk preventing system shutdown / logout.
* Ignore leading 'The' when sorting artists. * Ignore leading 'The' when sorting artists.
* Added Charts page, which shows various sources' top hits & artists. * Added Charts page, which shows various sources' top hits & artists.
* The Collection tree-views can now be filtered. * The Collection tree-views can now be filtered.
* Fixed crash when pressing enter in an empty playlist. * Fixed crash when pressing enter in an empty playlist.
* Moved the song queue below to the left, below the sidebar. * Moved the song queue to the bottom of the sidebar.
* Added Footnotes, a contextual view that you can slide it. * Added Footnotes, a contextual view that you can slide it.
* Show recently added playlists in dashboard rather than recently opened * Show recently added playlists in dashboard rather than recently opened
playlists. playlists.

View File

@@ -13,8 +13,8 @@ QT4_WRAP_UI( crashreporter_UI_HEADERS ${crashreporter_UI} )
QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} ) QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} )
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src ../../libtomahawk )
ADD_DEFINITIONS( ${QT_DEFINITIONS} ) ADD_DEFINITIONS( ${QT_DEFINITIONS} )
ADD_EXECUTABLE( CrashReporter ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} ) ADD_EXECUTABLE( CrashReporter ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} )
TARGET_LINK_LIBRARIES( CrashReporter ${QT_LIBRARIES} ) TARGET_LINK_LIBRARIES( CrashReporter ${QT_LIBRARIES} tomahawklib )

View File

@@ -25,6 +25,9 @@
#include <QDateTime> #include <QDateTime>
#include <QHttp> #include <QHttp>
#include "utils/tomahawkutils.h"
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
#define RESPATH ":/data/" #define RESPATH ":/data/"
@@ -40,7 +43,6 @@ CrashReporter::CrashReporter( const QStringList& args )
ui.progressLabel->setPalette( Qt::gray ); ui.progressLabel->setPalette( Qt::gray );
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// macify++
QFont f = ui.bottomLabel->font(); QFont f = ui.bottomLabel->font();
f.setPointSize( 10 ); f.setPointSize( 10 );
ui.bottomLabel->setFont( f ); ui.bottomLabel->setFont( f );
@@ -55,12 +57,14 @@ CrashReporter::CrashReporter( const QStringList& args )
ui.bottomLabel->setIndent( 1 ); ui.bottomLabel->setIndent( 1 );
// adjust the spacer since we adjusted the spacing above // adjust the spacer since we adjusted the spacing above
for (int x = 0; x < ui.vboxLayout->count(); ++x) for ( int x = 0; x < ui.vboxLayout->count(); ++x )
if (QSpacerItem* spacer = ui.vboxLayout->itemAt( x )->spacerItem()) {
if ( QSpacerItem* spacer = ui.vboxLayout->itemAt( x )->spacerItem() )
{ {
spacer->changeSize( 6, 2, QSizePolicy::Minimum, QSizePolicy::Fixed ); spacer->changeSize( 6, 2, QSizePolicy::Minimum, QSizePolicy::Fixed );
break; break;
} }
}
#endif //Q_WS_MAC #endif //Q_WS_MAC
m_http = new QHttp( "oops.tomahawk-player.org", 80, this ); m_http = new QHttp( "oops.tomahawk-player.org", 80, this );
@@ -72,9 +76,9 @@ CrashReporter::CrashReporter( const QStringList& args )
m_minidump = m_dir + '/' + args.value( 2 ) + ".dmp"; m_minidump = m_dir + '/' + args.value( 2 ) + ".dmp";
m_product_name = args.value( 3 ); m_product_name = args.value( 3 );
QTimer::singleShot( 0, this, SLOT(send()) );
setFixedSize( sizeHint() ); setFixedSize( sizeHint() );
QTimer::singleShot( 0, this, SLOT( send() ) );
} }
@@ -94,7 +98,7 @@ CrashReporter::send()
// socorro expects a 10 digit build id // socorro expects a 10 digit build id
QRegExp rx( "(\\d+\\.\\d+\\.\\d+).(\\d+)" ); QRegExp rx( "(\\d+\\.\\d+\\.\\d+).(\\d+)" );
rx.exactMatch( "0.2.99" ); rx.exactMatch( TomahawkUtils::appFriendlyVersion() );
QString const version = rx.cap( 1 ); QString const version = rx.cap( 1 );
QString const buildId = rx.cap( 2 ).leftJustified( 10, '0' ); QString const buildId = rx.cap( 2 ).leftJustified( 10, '0' );
@@ -103,7 +107,7 @@ CrashReporter::send()
QList<Pair> pairs; QList<Pair> pairs;
pairs << Pair( "BuildID", buildId.toUtf8() ) pairs << Pair( "BuildID", buildId.toUtf8() )
<< Pair( "ProductName", m_product_name.toUtf8() ) << Pair( "ProductName", m_product_name.toUtf8() )
<< Pair( "Version", version.toUtf8() ) << Pair( "Version", TomahawkUtils::appFriendlyVersion().toLocal8Bit() )
<< Pair( "Vendor", "Tomahawk" ) << Pair( "Vendor", "Tomahawk" )
<< Pair( "timestamp", QByteArray::number( QDateTime::currentDateTime().toTime_t() ) ); << Pair( "timestamp", QByteArray::number( QDateTime::currentDateTime().toTime_t() ) );
@@ -126,14 +130,13 @@ CrashReporter::send()
// add logfile // add logfile
body += "--thkboundary\r\n"; body += "--thkboundary\r\n";
body += "Content-Disposition: form-data; name=\"upload_file_containerlog\"; filename=\"container.log\"\r\n"; body += "Content-Disposition: form-data; name=\"upload_file_tomahawklog\"; filename=\"Tomahawk.log\"\r\n";
body += "Content-Type: application/x-gzip\r\n"; body += "Content-Type: application/x-gzip\r\n";
body += "\r\n"; body += "\r\n";
// body += qCompress( contents( "Tomahawk.log" ) ); body += qCompress( contents( LOGFILE ) );
body += "\r\n"; body += "\r\n";
body += "--thkboundary--\r\n"; body += "--thkboundary--\r\n";
//////
QHttpRequestHeader header( "POST", "/addreport.php" ); QHttpRequestHeader header( "POST", "/addreport.php" );
header.setContentType( "multipart/form-data; boundary=thkboundary" ); header.setContentType( "multipart/form-data; boundary=thkboundary" );
header.setValue( "HOST", "oops.tomahawk-player.org" ); header.setValue( "HOST", "oops.tomahawk-player.org" );
@@ -179,5 +182,5 @@ CrashReporter::onFail( int error, const QString& errorString )
{ {
ui.button->setText( tr( "Close" ) ); ui.button->setText( tr( "Close" ) );
ui.progressLabel->setText( tr( "Failed to send crash info." ) ); ui.progressLabel->setText( tr( "Failed to send crash info." ) );
qDebug() << "Error: " << error << errorString; qDebug() << "Error:" << error << errorString;
} }

View File

@@ -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 ) );
} }

View File

@@ -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;

View File

@@ -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();

View File

@@ -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

View File

@@ -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() );

View File

@@ -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;

View File

@@ -559,7 +559,7 @@ TreeModel::addAllCollections()
QList<Tomahawk::source_ptr> sources = SourceList::instance()->sources(); QList<Tomahawk::source_ptr> sources = SourceList::instance()->sources();
foreach ( const source_ptr& source, sources ) foreach ( const source_ptr& source, sources )
{ {
connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) ); connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
} }
m_title = tr( "All Artists" ); m_title = tr( "All Artists" );
@@ -668,7 +668,7 @@ TreeModel::addCollection( const collection_ptr& collection )
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) ); Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) ); connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
if ( !collection->source()->avatar().isNull() ) if ( !collection->source()->avatar().isNull() )
setIcon( collection->source()->avatar() ); setIcon( collection->source()->avatar() );
@@ -708,7 +708,7 @@ TreeModel::addFilteredCollection( const collection_ptr& collection, unsigned int
void void
TreeModel::onSourceAdded( const Tomahawk::source_ptr& source ) TreeModel::onSourceAdded( const Tomahawk::source_ptr& source )
{ {
connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) ); connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
} }

View File

@@ -31,7 +31,7 @@
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit() #define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
#define LOGFILE_SIZE 1024 * 512 #define LOGFILE_SIZE 1024 * 256
#define RELEASE_LEVEL_THRESHOLD 0 #define RELEASE_LEVEL_THRESHOLD 0
#define DEBUG_LEVEL_THRESHOLD LOGEXTRA #define DEBUG_LEVEL_THRESHOLD LOGEXTRA

View File

@@ -507,6 +507,7 @@ TomahawkApp::initServent()
} }
} }
void void
TomahawkApp::initSIP() TomahawkApp::initSIP()
{ {
@@ -532,6 +533,7 @@ TomahawkApp::initSIP()
} }
} }
void void
TomahawkApp::spotifyApiCheckFinished() TomahawkApp::spotifyApiCheckFinished()
{ {
@@ -557,7 +559,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" ) )
@@ -575,7 +576,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;
@@ -594,10 +596,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 );

View File

@@ -143,7 +143,7 @@ private:
}; };
Q_DECLARE_METATYPE( QPersistentModelIndex ) Q_DECLARE_METATYPE( QPersistentModelIndex )
Q_DECLARE_METATYPE(PairList) Q_DECLARE_METATYPE( PairList )
#endif // TOMAHAWKAPP_H #endif // TOMAHAWKAPP_H