mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 23:39:42 +01:00
Merge branch 'master' into privatelistening
This commit is contained in:
commit
cf649cdafe
31
ChangeLog
31
ChangeLog
@ -1,58 +1,53 @@
|
||||
Version 0.3.0:
|
||||
* Fixed bug where we would download http:// tracks twice.
|
||||
* Make artist names in the album view clickable.
|
||||
* Don't start playing if a tomahawk:// link was clicked while Tomahawk
|
||||
is paused.
|
||||
* 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 CD placeholder in jewel
|
||||
case.
|
||||
* Added a drop shadow to cover images, and put placeholder in jewel case.
|
||||
* Added shuffle and repeat support to tree view.
|
||||
* Draw a speaker next to the currently playing playlist.
|
||||
* Refresh station previews whenever a filter is changed.
|
||||
* Support and show official releases on album and track pages.
|
||||
* Filter out duplicates from station previews and upcoming tracks.
|
||||
* Resolve lists top-down.
|
||||
* Added YouTube resolver.
|
||||
* Fixed bug where going offline then online would not re-connect to many
|
||||
peers.
|
||||
* Added support for auto-updating live xspf playlists.
|
||||
* Don't show an age of 41 for tracks that have no age information.
|
||||
* Show config UI for resolvers that have them as so on as you add the resolver.
|
||||
* Added support for auto-updating live XSPF playlists.
|
||||
* Don't show an age of 41 years for tracks that have no age information.
|
||||
* 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
|
||||
your catalog with The Echo Nest and enable personal recommendations
|
||||
from you and your friends.
|
||||
* 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.
|
||||
* 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
|
||||
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
|
||||
current jobs such as resolving, parsing playlists, and loading from
|
||||
database.
|
||||
* 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
|
||||
UI, greatly increasing responsiveness of Tomahawk while resolving.
|
||||
* Fixed no playlists overlay not disappearing when playlists were added.
|
||||
* Add support for parsing itunes track, artist and album links.
|
||||
* Fixed crash when syncing playlists with peers.
|
||||
* Add support for browsing, downloading and rating resolvers
|
||||
from inside Tomahawk directly.
|
||||
* Add support for browsing, downloading and rating resolvers from within
|
||||
Tomahawk directly.
|
||||
* Support multi-folder selection and scanning.
|
||||
* Actually remove deleted files from the collection.
|
||||
* Fixed handling of special characters in tomahawk:// links
|
||||
* Improve sidebar performance by caching pixmaps and shrinking them.
|
||||
* Send updated playlists to peers when tracks are moved/copied.
|
||||
* Remove splitter handles in sidebar
|
||||
* Fixed Tomahawk preventing system shutdown / logut.
|
||||
* Remove splitter handles in sidebar.
|
||||
* Fixed Tomahawk preventing system shutdown / logout.
|
||||
* Ignore leading 'The' when sorting artists.
|
||||
* Added Charts page, which shows various sources' top hits & artists.
|
||||
* The Collection tree-views can now be filtered.
|
||||
* 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.
|
||||
* Show recently added playlists in dashboard rather than recently opened
|
||||
playlists.
|
||||
|
@ -13,8 +13,8 @@ QT4_WRAP_UI( crashreporter_UI_HEADERS ${crashreporter_UI} )
|
||||
QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} )
|
||||
|
||||
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_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 )
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include <QDateTime>
|
||||
#include <QHttp>
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
|
||||
#define RESPATH ":/data/"
|
||||
|
||||
|
||||
@ -40,7 +43,6 @@ CrashReporter::CrashReporter( const QStringList& args )
|
||||
ui.progressLabel->setPalette( Qt::gray );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
// macify++
|
||||
QFont f = ui.bottomLabel->font();
|
||||
f.setPointSize( 10 );
|
||||
ui.bottomLabel->setFont( f );
|
||||
@ -55,12 +57,14 @@ CrashReporter::CrashReporter( const QStringList& args )
|
||||
ui.bottomLabel->setIndent( 1 );
|
||||
|
||||
// adjust the spacer since we adjusted the spacing above
|
||||
for (int x = 0; x < ui.vboxLayout->count(); ++x)
|
||||
if (QSpacerItem* spacer = ui.vboxLayout->itemAt( x )->spacerItem())
|
||||
for ( int x = 0; x < ui.vboxLayout->count(); ++x )
|
||||
{
|
||||
if ( QSpacerItem* spacer = ui.vboxLayout->itemAt( x )->spacerItem() )
|
||||
{
|
||||
spacer->changeSize( 6, 2, QSizePolicy::Minimum, QSizePolicy::Fixed );
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif //Q_WS_MAC
|
||||
|
||||
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_product_name = args.value( 3 );
|
||||
|
||||
QTimer::singleShot( 0, this, SLOT(send()) );
|
||||
|
||||
setFixedSize( sizeHint() );
|
||||
|
||||
QTimer::singleShot( 0, this, SLOT( send() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +98,7 @@ CrashReporter::send()
|
||||
|
||||
// socorro expects a 10 digit build id
|
||||
QRegExp rx( "(\\d+\\.\\d+\\.\\d+).(\\d+)" );
|
||||
rx.exactMatch( "0.2.99" );
|
||||
rx.exactMatch( TomahawkUtils::appFriendlyVersion() );
|
||||
QString const version = rx.cap( 1 );
|
||||
QString const buildId = rx.cap( 2 ).leftJustified( 10, '0' );
|
||||
|
||||
@ -103,7 +107,7 @@ CrashReporter::send()
|
||||
QList<Pair> pairs;
|
||||
pairs << Pair( "BuildID", buildId.toUtf8() )
|
||||
<< Pair( "ProductName", m_product_name.toUtf8() )
|
||||
<< Pair( "Version", version.toUtf8() )
|
||||
<< Pair( "Version", TomahawkUtils::appFriendlyVersion().toLocal8Bit() )
|
||||
<< Pair( "Vendor", "Tomahawk" )
|
||||
<< Pair( "timestamp", QByteArray::number( QDateTime::currentDateTime().toTime_t() ) );
|
||||
|
||||
@ -126,14 +130,13 @@ CrashReporter::send()
|
||||
|
||||
// add logfile
|
||||
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 += "\r\n";
|
||||
// body += qCompress( contents( "Tomahawk.log" ) );
|
||||
body += qCompress( contents( LOGFILE ) );
|
||||
body += "\r\n";
|
||||
body += "--thkboundary--\r\n";
|
||||
|
||||
//////
|
||||
QHttpRequestHeader header( "POST", "/addreport.php" );
|
||||
header.setContentType( "multipart/form-data; boundary=thkboundary" );
|
||||
header.setValue( "HOST", "oops.tomahawk-player.org" );
|
||||
@ -179,5 +182,5 @@ CrashReporter::onFail( int error, const QString& errorString )
|
||||
{
|
||||
ui.button->setText( tr( "Close" ) );
|
||||
ui.progressLabel->setText( tr( "Failed to send crash info." ) );
|
||||
qDebug() << "Error: " << error << errorString;
|
||||
qDebug() << "Error:" << error << errorString;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ set( libSources
|
||||
database/databasecommand_deletefiles.cpp
|
||||
database/databasecommand_dirmtimes.cpp
|
||||
database/databasecommand_filemtimes.cpp
|
||||
database/databasecommand_loadfile.cpp
|
||||
database/databasecommand_loadfiles.cpp
|
||||
database/databasecommand_logplayback.cpp
|
||||
database/databasecommand_addsource.cpp
|
||||
database/databasecommand_sourceoffline.cpp
|
||||
@ -298,7 +298,7 @@ set( libHeaders
|
||||
database/databasecommand_deletefiles.h
|
||||
database/databasecommand_dirmtimes.h
|
||||
database/databasecommand_filemtimes.h
|
||||
database/databasecommand_loadfile.h
|
||||
database/databasecommand_loadfiles.h
|
||||
database/databasecommand_logplayback.h
|
||||
database/databasecommand_addsource.h
|
||||
database/databasecommand_sourceoffline.h
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "database/database.h"
|
||||
#include "database/databasecommand_genericselect.h"
|
||||
#include "database/databasecommand_setcollectionattributes.h"
|
||||
#include "database/databasecommand_loadfiles.h"
|
||||
#include "tomahawksettings.h"
|
||||
#include "sourcelist.h"
|
||||
#include "query.h"
|
||||
@ -41,8 +42,8 @@ EchonestCatalogSynchronizer::EchonestCatalogSynchronizer( QObject *parent )
|
||||
qRegisterMetaType<QList<QStringList> >("QList<QStringList>");
|
||||
|
||||
connect( TomahawkSettings::instance(), SIGNAL( changed() ), this, SLOT( checkSettingsChanged() ) );
|
||||
connect( SourceList::instance()->getLocal()->collection().data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksAdded( QList<Tomahawk::query_ptr> ) ), Qt::QueuedConnection );
|
||||
connect( SourceList::instance()->getLocal()->collection().data(), SIGNAL( tracksRemoved( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksRemoved( QList<Tomahawk::query_ptr> ) ), Qt::QueuedConnection );
|
||||
connect( SourceList::instance()->getLocal()->collection().data(), SIGNAL( tracksAdded( QList<unsigned int> ) ), this, SLOT( tracksAdded( QList<unsigned int> ) ), Qt::QueuedConnection );
|
||||
connect( SourceList::instance()->getLocal()->collection().data(), SIGNAL( tracksRemoved( QList<unsigned int> ) ), this, SLOT( tracksRemoved( QList<unsigned int> ) ), Qt::QueuedConnection );
|
||||
|
||||
const QByteArray artist = TomahawkSettings::instance()->value( "collection/artistCatalog" ).toByteArray();
|
||||
const QByteArray song = TomahawkSettings::instance()->value( "collection/songCatalog" ).toByteArray();
|
||||
@ -81,7 +82,7 @@ EchonestCatalogSynchronizer::checkSettingsChanged()
|
||||
} else if ( !TomahawkSettings::instance()->enableEchonestCatalogs() && m_syncing )
|
||||
{
|
||||
|
||||
tDebug() << "FOund echonest change, doing catalog deletes!";
|
||||
tDebug() << "Found echonest change, doing catalog deletes!";
|
||||
// delete all track nums and catalog ids from our peers
|
||||
{
|
||||
DatabaseCommand_SetTrackAttributes* cmd = new DatabaseCommand_SetTrackAttributes( DatabaseCommand_SetTrackAttributes::EchonestCatalogId );
|
||||
@ -123,7 +124,9 @@ EchonestCatalogSynchronizer::catalogDeleted()
|
||||
// If we didn't throw, no errors, so clear our config
|
||||
TomahawkSettings::instance()->setValue( toDel, QString() );
|
||||
} catch ( const Echonest::ParseError& e )
|
||||
{}
|
||||
{
|
||||
tLog() << "Error in libechonest parsing catalog delete:" << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -293,60 +296,60 @@ EchonestCatalogSynchronizer::checkTicket()
|
||||
}
|
||||
|
||||
void
|
||||
EchonestCatalogSynchronizer::tracksAdded( const QList< query_ptr >& tracks )
|
||||
EchonestCatalogSynchronizer::tracksAdded( const QList< unsigned int >& tracks )
|
||||
{
|
||||
if ( !m_syncing || m_songCatalog.id().isEmpty() || tracks.isEmpty() )
|
||||
return;
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Got tracks added from db, fetching metadata" << tracks;
|
||||
// Get the result_ptrs from the tracks
|
||||
DatabaseCommand_LoadFiles* cmd = new DatabaseCommand_LoadFiles( tracks );
|
||||
connect( cmd, SIGNAL( results( QList<Tomahawk::result_ptr> ) ), this, SLOT( loadedResults( QList<Tomahawk::result_ptr> ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchonestCatalogSynchronizer::loadedResults( const QList<result_ptr>& results )
|
||||
{
|
||||
QList< QStringList > rawTracks;
|
||||
foreach( const query_ptr& track, tracks )
|
||||
qDebug() << Q_FUNC_INFO << "Got track metadata..." << results.size();
|
||||
|
||||
foreach( const result_ptr& result, results )
|
||||
{
|
||||
// DatabaseCommand_AddFiles sets the track id on the result
|
||||
int id = -1;
|
||||
if ( track->results().size() == 1 )
|
||||
id = track->results().first()->dbid();
|
||||
else
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "No dbid for track we got in tracksAdded()!";
|
||||
if ( result.isNull() )
|
||||
continue;
|
||||
}
|
||||
rawTracks << ( QStringList() << QString::number( id ) << track->track() << track->artist() << track->album() );
|
||||
|
||||
qDebug() << "Metadata for item:" << result->fileId();
|
||||
|
||||
const QString artist = result->artist().isNull() ? QString() : result->artist()->name();
|
||||
const QString album = result->album().isNull() ? QString() : result->album()->name();
|
||||
rawTracks << ( QStringList() << QString::number( result->fileId() ) << result->track() << artist << album );
|
||||
}
|
||||
rawTracksAdd( rawTracks );
|
||||
}
|
||||
|
||||
void
|
||||
EchonestCatalogSynchronizer::tracksRemoved( const QList< query_ptr >& tracks )
|
||||
EchonestCatalogSynchronizer::tracksRemoved( const QList< unsigned int >& trackIds )
|
||||
{
|
||||
|
||||
if ( !m_syncing || m_songCatalog.id().isEmpty() || tracks.isEmpty() )
|
||||
if ( !m_syncing || m_songCatalog.id().isEmpty() || trackIds.isEmpty() )
|
||||
return;
|
||||
|
||||
|
||||
Echonest::CatalogUpdateEntries entries;
|
||||
entries.reserve( tracks.size() );
|
||||
entries.reserve( trackIds.size() );
|
||||
|
||||
foreach ( const query_ptr& q, tracks )
|
||||
foreach ( unsigned int id, trackIds )
|
||||
{
|
||||
QByteArray itemId;
|
||||
if ( q->results().size() > 0 )
|
||||
{
|
||||
// Should always be the case, should have the local result from the db that we are deleting!
|
||||
itemId = QString::number( q->results().first()->dbid() ).toLatin1();
|
||||
}
|
||||
else
|
||||
{
|
||||
tLog() << "Got deleted query_ptr with no local result! Wtf!" << q->track() << q->artist() << q->results();
|
||||
continue;
|
||||
}
|
||||
|
||||
tDebug() << "Deleting item with id:" << itemId;
|
||||
tDebug() << "Deleting item with id:" << id;
|
||||
Echonest::CatalogUpdateEntry e( Echonest::CatalogTypes::Delete );
|
||||
e.setItemId( itemId );
|
||||
e.setItemId( QString::number( id ).toLatin1() );
|
||||
entries.append( e );
|
||||
}
|
||||
|
||||
m_songCatalog.update( entries );
|
||||
QNetworkReply* reply = m_songCatalog.update( entries );
|
||||
connect( reply, SIGNAL( finished() ), this, SLOT( songUpdateFinished() ) );
|
||||
}
|
||||
|
||||
QByteArray
|
||||
|
@ -54,8 +54,10 @@ signals:
|
||||
|
||||
private slots:
|
||||
void checkSettingsChanged();
|
||||
void tracksAdded( const QList<Tomahawk::query_ptr>& );
|
||||
void tracksRemoved( const QList<Tomahawk::query_ptr>& );
|
||||
void tracksAdded( const QList<unsigned int>& );
|
||||
void tracksRemoved( const QList<unsigned int>& );
|
||||
|
||||
void loadedResults( const QList<Tomahawk::result_ptr>& results );
|
||||
|
||||
// Echonest slots
|
||||
void songCreateFinished();
|
||||
|
@ -68,7 +68,6 @@ Collection::addPlaylist( const Tomahawk::playlist_ptr& p )
|
||||
|
||||
QList<playlist_ptr> toadd;
|
||||
toadd << p;
|
||||
// qDebug() << "Inserted playlist with guid:" << p->guid();
|
||||
m_playlists.insert( p->guid(), p );
|
||||
|
||||
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
||||
@ -83,7 +82,6 @@ Collection::addAutoPlaylist( const Tomahawk::dynplaylist_ptr& p )
|
||||
{
|
||||
QList<dynplaylist_ptr> toadd;
|
||||
toadd << p;
|
||||
// qDebug() << "Inserted dynamic playlist with guid:" << p->guid();
|
||||
m_autoplaylists.insert( p->guid(), p );
|
||||
|
||||
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
||||
@ -98,7 +96,6 @@ Collection::addStation( const dynplaylist_ptr& s )
|
||||
{
|
||||
QList<dynplaylist_ptr> toadd;
|
||||
toadd << s;
|
||||
// qDebug() << "Inserted station with guid:" << s->guid();
|
||||
m_stations.insert( s->guid(), s );
|
||||
|
||||
/* qDebug() << Q_FUNC_INFO << "Collection name" << name()
|
||||
@ -167,7 +164,6 @@ Collection::autoPlaylist( const QString& guid )
|
||||
dynplaylist_ptr
|
||||
Collection::station( const QString& guid )
|
||||
{
|
||||
|
||||
return m_stations.value( guid, dynplaylist_ptr() );
|
||||
}
|
||||
|
||||
@ -175,7 +171,6 @@ Collection::station( const QString& guid )
|
||||
void
|
||||
Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << plists.count();
|
||||
foreach ( const playlist_ptr& p, plists )
|
||||
{
|
||||
// qDebug() << "Batch inserting playlist:" << p->guid();
|
||||
@ -190,8 +185,6 @@ Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
||||
void
|
||||
Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << plists.count();
|
||||
|
||||
foreach ( const dynplaylist_ptr& p, plists )
|
||||
{
|
||||
// qDebug() << "Batch inserting dynamic playlist:" << p->guid();
|
||||
@ -204,8 +197,6 @@ Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
||||
void
|
||||
Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << stations.count();
|
||||
|
||||
foreach ( const dynplaylist_ptr& s, stations )
|
||||
{
|
||||
// qDebug() << "Batch inserting station:" << s->guid();
|
||||
@ -216,56 +207,29 @@ Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
|
||||
/* 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
|
||||
Collection::moveAutoToStation( const QString& guid )
|
||||
{
|
||||
if( m_autoplaylists.contains( guid ) )
|
||||
if ( m_autoplaylists.contains( guid ) )
|
||||
m_stations.insert( guid, m_autoplaylists.take( guid ) );
|
||||
}
|
||||
|
||||
@ -273,6 +237,6 @@ Collection::moveAutoToStation( const QString& guid )
|
||||
void
|
||||
Collection::moveStationToAuto( const QString& guid )
|
||||
{
|
||||
if( m_stations.contains( guid ) )
|
||||
if ( m_stations.contains( guid ) )
|
||||
m_autoplaylists.insert( guid, m_stations.take( guid ) );
|
||||
}
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "functimeout.h"
|
||||
#include "playlist.h"
|
||||
#include "playlist/dynamic/DynamicPlaylist.h"
|
||||
#include "query.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
@ -79,8 +78,8 @@ public:
|
||||
unsigned int lastmodified() const { return m_lastmodified; }
|
||||
|
||||
signals:
|
||||
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks );
|
||||
void tracksRemoved( const QList<Tomahawk::query_ptr>& tracks );
|
||||
void tracksAdded( const QList<unsigned int>& fileids );
|
||||
void tracksRemoved( const QList<unsigned int>& fileids );
|
||||
|
||||
void playlistsAdded( 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 setStations( const QList< Tomahawk::dynplaylist_ptr >& stations );
|
||||
|
||||
void setTracks( const QList<Tomahawk::query_ptr>& tracks );
|
||||
void delTracks( const QStringList& files );
|
||||
void setTracks( const QList<unsigned int>& fileids );
|
||||
void delTracks( const QList<unsigned int>& fileids );
|
||||
|
||||
protected:
|
||||
QString m_name;
|
||||
|
@ -56,7 +56,6 @@ DatabaseCommand_AddFiles::files() const
|
||||
void
|
||||
DatabaseCommand_AddFiles::postCommitHook()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( source().isNull() || source()->collection().isNull() )
|
||||
{
|
||||
qDebug() << "Source has gone offline, not emitting to GUI.";
|
||||
@ -67,13 +66,13 @@ DatabaseCommand_AddFiles::postCommitHook()
|
||||
// collection browser will update/fade in etc.
|
||||
Collection* coll = source()->collection().data();
|
||||
|
||||
connect( this, SIGNAL( notify( QList<Tomahawk::query_ptr> ) ),
|
||||
coll, SLOT( setTracks( QList<Tomahawk::query_ptr> ) ),
|
||||
connect( this, SIGNAL( notify( QList<unsigned int> ) ),
|
||||
coll, SLOT( setTracks( QList<unsigned int> ) ),
|
||||
Qt::QueuedConnection );
|
||||
|
||||
emit notify( m_queries );
|
||||
emit notify( m_ids );
|
||||
|
||||
if( source()->isLocal() )
|
||||
if ( source()->isLocal() )
|
||||
{
|
||||
Servent::instance()->triggerDBSync();
|
||||
|
||||
@ -185,7 +184,7 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
|
||||
query_trackattr.bindValue( 2, year );
|
||||
query_trackattr.exec();
|
||||
|
||||
QVariantMap attr;
|
||||
/* QVariantMap attr;
|
||||
Tomahawk::query_ptr query = Tomahawk::Query::get( artist, track, album );
|
||||
attr["releaseyear"] = m.value( "year" );
|
||||
|
||||
@ -210,12 +209,13 @@ DatabaseCommand_AddFiles::exec( DatabaseImpl* dbi )
|
||||
results << result;
|
||||
query->addResults( results );
|
||||
|
||||
m_queries << query;
|
||||
m_queries << query;*/
|
||||
|
||||
m_ids << fileid;
|
||||
added++;
|
||||
}
|
||||
qDebug() << "Inserted" << added << "tracks to database";
|
||||
|
||||
// TODO building the index could be a separate job, outside this transaction
|
||||
if ( added )
|
||||
source()->updateIndexWhenSynced();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@ -55,11 +55,11 @@ public:
|
||||
|
||||
signals:
|
||||
void done( const QList<QVariant>&, const Tomahawk::collection_ptr& );
|
||||
void notify( const QList<Tomahawk::query_ptr>& );
|
||||
void notify( const QList<unsigned int>& ids );
|
||||
|
||||
private:
|
||||
QVariantList m_files;
|
||||
QList<Tomahawk::query_ptr> m_queries;
|
||||
QList<unsigned int> m_ids;
|
||||
};
|
||||
|
||||
#endif // DATABASECOMMAND_ADDFILES_H
|
||||
|
@ -120,7 +120,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( query.value( 12 ).toUInt(), artist );
|
||||
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( query.value( 13 ).toUInt(), album, artistptr );
|
||||
|
||||
result->setId( query.value( 14 ).toUInt() );
|
||||
result->setTrackId( query.value( 14 ).toUInt() );
|
||||
result->setArtist( artistptr );
|
||||
result->setAlbum( albumptr );
|
||||
result->setTrack( query.value( 3 ).toString() );
|
||||
@ -137,7 +137,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
QVariantMap attr;
|
||||
|
||||
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
||||
attrQuery.bindValue( 0, result->dbid() );
|
||||
attrQuery.bindValue( 0, result->trackId() );
|
||||
attrQuery.exec();
|
||||
while ( attrQuery.next() )
|
||||
{
|
||||
|
@ -45,11 +45,14 @@ DatabaseCommand_DeleteFiles::postCommitHook()
|
||||
// collection browser will update/fade in etc.
|
||||
Collection* coll = source()->collection().data();
|
||||
|
||||
connect( this, SIGNAL( notify( QStringList ) ),
|
||||
coll, SLOT( delTracks( QStringList ) ), Qt::QueuedConnection );
|
||||
connect( this, SIGNAL( notify( QList<unsigned int> ) ),
|
||||
coll, SLOT( delTracks( QList<unsigned int> ) ), Qt::QueuedConnection );
|
||||
|
||||
tDebug() << "Notifying of deleted tracks: " << m_files.size() << " from source " << source()->id();
|
||||
emit notify( m_files );
|
||||
tDebug() << "Notifying of deleted tracks:" << m_ids.size() << "from source" << source()->id();
|
||||
QList<unsigned int> ids;
|
||||
foreach ( QVariant id, m_ids )
|
||||
ids << id.toUInt();
|
||||
emit notify( ids );
|
||||
|
||||
if( source()->isLocal() )
|
||||
Servent::instance()->triggerDBSync();
|
||||
@ -59,7 +62,6 @@ DatabaseCommand_DeleteFiles::postCommitHook()
|
||||
void
|
||||
DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO;
|
||||
Q_ASSERT( !source().isNull() );
|
||||
|
||||
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
||||
@ -68,7 +70,6 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
|
||||
if ( source()->isLocal() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << " source is local";
|
||||
if ( m_dir.path() != QString( "." ) )
|
||||
{
|
||||
tDebug() << "Deleting" << m_dir.path() << "from db for localsource" << srcid;
|
||||
@ -95,7 +96,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
}
|
||||
else if ( !m_ids.isEmpty() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << " deleting given ids";
|
||||
tDebug() << Q_FUNC_INFO << "deleting given ids";
|
||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||
|
||||
QString idstring;
|
||||
@ -104,23 +105,19 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
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.exec();
|
||||
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();
|
||||
}
|
||||
|
||||
//tDebug() << Q_FUNC_INFO << " executed query was: " << dirquery.executedQuery();
|
||||
//tDebug() << Q_FUNC_INFO << " files selected for delete: " << m_files;
|
||||
}
|
||||
else if ( m_deleteAll )
|
||||
{
|
||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||
|
||||
|
||||
dirquery.prepare( QString( "SELECT id, url FROM file WHERE source IS NULL" ) );
|
||||
|
||||
|
||||
dirquery.exec();
|
||||
while ( dirquery.next() )
|
||||
{
|
||||
@ -134,10 +131,10 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
if ( m_deleteAll )
|
||||
{
|
||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||
|
||||
|
||||
dirquery.prepare( QString( "SELECT url FROM file WHERE source = %1" ).arg( source()->id() ) );
|
||||
|
||||
dirquery.exec();
|
||||
|
||||
while ( dirquery.next() )
|
||||
m_ids << dirquery.value( 0 ).toString();
|
||||
}
|
||||
@ -151,43 +148,28 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
if ( !m_ids.isEmpty() )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
qDebug() << "Failed to delete file:"
|
||||
<< delquery.lastError().databaseText()
|
||||
<< delquery.lastError().driverText()
|
||||
<< delquery.boundValues();
|
||||
}
|
||||
delquery.exec();
|
||||
}
|
||||
}
|
||||
else if ( !m_ids.isEmpty() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << " executing delete";
|
||||
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() ? "id" : "url" ) );
|
||||
|
||||
QString idstring;
|
||||
foreach( const QVariant& id, m_ids )
|
||||
idstring.append( id.toString() + ", " );
|
||||
idstring.append( id.toString() + ", " );
|
||||
idstring.chop( 2 ); //remove the trailing ", "
|
||||
|
||||
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() ? "id" : "url" )
|
||||
.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() );
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
signals:
|
||||
void done( const QStringList&, const Tomahawk::collection_ptr& );
|
||||
void notify( const QStringList& );
|
||||
void notify( const QList<unsigned int>& ids );
|
||||
|
||||
private:
|
||||
QStringList m_files;
|
||||
|
@ -16,34 +16,43 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "databasecommand_loadfile.h"
|
||||
#include "databasecommand_loadfiles.h"
|
||||
|
||||
#include "databaseimpl.h"
|
||||
#include "collection.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
|
||||
DatabaseCommand_LoadFile::DatabaseCommand_LoadFile( const QString& id, QObject* parent )
|
||||
DatabaseCommand_LoadFiles::DatabaseCommand_LoadFiles( unsigned int id, QObject* parent )
|
||||
: DatabaseCommand( parent )
|
||||
, m_id( id )
|
||||
, m_single( true )
|
||||
{
|
||||
m_ids << id;
|
||||
}
|
||||
|
||||
DatabaseCommand_LoadFiles::DatabaseCommand_LoadFiles( const QList<unsigned int>& ids, QObject* parent )
|
||||
: DatabaseCommand( parent )
|
||||
, m_single( false )
|
||||
, m_ids( ids )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DatabaseCommand_LoadFile::exec( DatabaseImpl* dbi )
|
||||
DatabaseCommand_LoadFiles::exec( DatabaseImpl* dbi )
|
||||
{
|
||||
Tomahawk::result_ptr r;
|
||||
QList<Tomahawk::result_ptr> resultList;
|
||||
// file ids internally are really ints, at least for now:
|
||||
bool ok;
|
||||
do
|
||||
foreach ( unsigned int id, m_ids )
|
||||
{
|
||||
unsigned int fid = m_id.toInt( &ok );
|
||||
if( !ok )
|
||||
break;
|
||||
qDebug() << "Loading file from db with id:" << id;
|
||||
resultList << dbi->file( id );
|
||||
}
|
||||
|
||||
r = dbi->file( fid );
|
||||
} while( false );
|
||||
Q_ASSERT( !m_single || resultList.size() <= 1 );
|
||||
|
||||
emit result( r );
|
||||
if ( m_single && !resultList.isEmpty() )
|
||||
emit result( resultList.first() );
|
||||
else
|
||||
emit results( resultList );
|
||||
}
|
@ -16,32 +16,42 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DATABASECOMMAND_LOADFILE_H
|
||||
#define DATABASECOMMAND_LOADFILE_H
|
||||
#ifndef DATABASECOMMAND_LOADFILES_H
|
||||
#define DATABASECOMMAND_LOADFILES_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
|
||||
#include "databasecommand.h"
|
||||
#include "result.h"
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT DatabaseCommand_LoadFile : public DatabaseCommand
|
||||
/**
|
||||
Loads a result_ptr from the database from a track dbid.
|
||||
|
||||
If use use the QStringList constructor, isten to results() instead of result()
|
||||
*/
|
||||
class DLLEXPORT DatabaseCommand_LoadFiles : public DatabaseCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DatabaseCommand_LoadFile( const QString& id, QObject* parent = 0 );
|
||||
explicit DatabaseCommand_LoadFiles( unsigned int id, QObject* parent = 0 );
|
||||
explicit DatabaseCommand_LoadFiles( const QList<unsigned int>& ids, QObject* parent = 0 );
|
||||
|
||||
virtual void exec( DatabaseImpl* );
|
||||
virtual bool doesMutates() const { return false; }
|
||||
virtual QString commandname() const { return "loadfile"; }
|
||||
virtual QString commandname() const { return "loadfiles"; }
|
||||
|
||||
signals:
|
||||
void result( const Tomahawk::result_ptr& result );
|
||||
void results( const QList<Tomahawk::result_ptr>& results );
|
||||
|
||||
private:
|
||||
QString m_id;
|
||||
bool m_single;
|
||||
QList<unsigned int> m_ids;
|
||||
};
|
||||
|
||||
#endif // DATABASECOMMAND_LOADFILE_H
|
@ -156,14 +156,14 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib )
|
||||
result->setTrack( files_query.value( 12 ).toString() );
|
||||
result->setRID( uuid() );
|
||||
result->setAlbumPos( files_query.value( 14 ).toUInt() );
|
||||
result->setId( files_query.value( 9 ).toUInt() );
|
||||
result->setTrackId( files_query.value( 9 ).toUInt() );
|
||||
result->setYear( files_query.value( 17 ).toUInt() );
|
||||
|
||||
TomahawkSqlQuery attrQuery = lib->newquery();
|
||||
QVariantMap attr;
|
||||
|
||||
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
||||
attrQuery.bindValue( 0, result->dbid() );
|
||||
attrQuery.bindValue( 0, result->trackId() );
|
||||
attrQuery.exec();
|
||||
while ( attrQuery.next() )
|
||||
{
|
||||
@ -268,12 +268,12 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
|
||||
result->setTrack( files_query.value( 12 ).toString() );
|
||||
result->setRID( uuid() );
|
||||
result->setAlbumPos( files_query.value( 14 ).toUInt() );
|
||||
result->setId( files_query.value( 9 ).toUInt() );
|
||||
result->setTrackId( files_query.value( 9 ).toUInt() );
|
||||
result->setYear( files_query.value( 17 ).toUInt() );
|
||||
|
||||
for ( int k = 0; k < tracks.count(); k++ )
|
||||
{
|
||||
if ( tracks.at( k ).first == (int)result->dbid() )
|
||||
if ( tracks.at( k ).first == (int)result->trackId() )
|
||||
{
|
||||
result->setScore( tracks.at( k ).second );
|
||||
break;
|
||||
@ -284,7 +284,7 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
|
||||
QVariantMap attr;
|
||||
|
||||
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
||||
attrQuery.bindValue( 0, result->dbid() );
|
||||
attrQuery.bindValue( 0, result->trackId() );
|
||||
attrQuery.exec();
|
||||
while ( attrQuery.next() )
|
||||
{
|
||||
|
@ -249,9 +249,10 @@ DatabaseImpl::file( int fid )
|
||||
r->setArtist( artist );
|
||||
r->setAlbum( album );
|
||||
r->setTrack( query.value( 12 ).toString() );
|
||||
r->setId( query.value( 9 ).toUInt() );
|
||||
r->setTrackId( query.value( 9 ).toUInt() );
|
||||
r->setCollection( s->collection() );
|
||||
r->setScore( 1.0 );
|
||||
r->setFileId( fid );
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -608,7 +609,7 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
||||
res->setTrack( query.value( 12 ).toString() );
|
||||
res->setAlbumPos( query.value( 14 ).toUInt() );
|
||||
res->setRID( uuid() );
|
||||
res->setId( query.value( 9 ).toUInt() );
|
||||
res->setTrackId( query.value( 9 ).toUInt() );
|
||||
res->setCollection( s->collection() );
|
||||
res->setYear( query.value( 17 ).toUInt() );
|
||||
}
|
||||
|
@ -52,17 +52,6 @@ RoviPlugin::~RoviPlugin()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
RoviPlugin::namChangedSlot( QNetworkAccessManager* nam )
|
||||
{
|
||||
if ( !nam )
|
||||
return;
|
||||
|
||||
m_nam = nam;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RoviPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
@ -194,7 +183,7 @@ RoviPlugin::makeRequest( QUrl url )
|
||||
url.addEncodedQueryItem( "sig", generateSig() );
|
||||
|
||||
qDebug() << "Rovi request url:" << url.toString();
|
||||
return m_nam->get( QNetworkRequest( url ) );
|
||||
return TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,6 @@ public:
|
||||
virtual ~RoviPlugin();
|
||||
|
||||
protected:
|
||||
virtual void namChangedSlot( QNetworkAccessManager* nam );
|
||||
virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
virtual void pushInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant )
|
||||
@ -54,8 +53,6 @@ private:
|
||||
QNetworkReply* makeRequest( QUrl url );
|
||||
QByteArray generateSig() const;
|
||||
|
||||
QNetworkAccessManager* m_nam;
|
||||
|
||||
QByteArray m_apiKey;
|
||||
QByteArray m_secret;
|
||||
};
|
||||
|
@ -52,6 +52,22 @@ ChartsPlugin::ChartsPlugin()
|
||||
m_chartResources << "billboard" << "itunes" << "rdio" << "wearehunted";
|
||||
m_supportedGetTypes << InfoChart << InfoChartCapabilities;
|
||||
|
||||
|
||||
/// Then get each chart from resource
|
||||
/// We want to prepopulate the breadcrumb to fetch them before they are asked for
|
||||
if ( !m_chartResources.isEmpty() && m_allChartsMap.isEmpty() )
|
||||
{
|
||||
tDebug() << "ChartsPlugin: InfoChart fetching possible resources";
|
||||
foreach ( QVariant resource, m_chartResources )
|
||||
{
|
||||
QUrl url = QUrl( QString( CHART_URL "source/%1" ).arg(resource.toString() ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
tDebug() << "fetching:" << url;
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartTypes() ) );
|
||||
|
||||
m_chartsFetchJobs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -61,38 +77,6 @@ ChartsPlugin::~ChartsPlugin()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ChartsPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
{
|
||||
tDebug() << "ChartsPlugin: namChangedSLot";
|
||||
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !nam )
|
||||
return;
|
||||
|
||||
m_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||
|
||||
/// Then get each chart from resource
|
||||
/// We want to prepopulate the breadcrumb to fetch them before they are asked for
|
||||
|
||||
if ( !m_chartResources.isEmpty() && m_nam && m_allChartsMap.isEmpty() )
|
||||
{
|
||||
|
||||
tDebug() << "ChartsPlugin: InfoChart fetching possible resources";
|
||||
foreach ( QVariant resource, m_chartResources )
|
||||
{
|
||||
QUrl url = QUrl( QString( CHART_URL "source/%1" ).arg(resource.toString() ) );
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
tDebug() << "fetching:" << url;
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartTypes() ) );
|
||||
|
||||
m_chartsFetchJobs++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ChartsPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
@ -202,14 +186,6 @@ ChartsPlugin::fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData requ
|
||||
void
|
||||
ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
if ( !m_nam.data() )
|
||||
{
|
||||
tLog() << "Have a null QNAM, uh oh";
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch ( requestData.type )
|
||||
{
|
||||
case InfoChart:
|
||||
@ -218,7 +194,7 @@ ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSy
|
||||
QUrl url = QUrl( QString( CHART_URL "source/%1/chart/%2" ).arg( criteria["chart_source"] ).arg( criteria["chart_id"] ) );
|
||||
qDebug() << Q_FUNC_INFO << "Getting chart url" << url;
|
||||
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartReturned() ) );
|
||||
|
@ -53,7 +53,6 @@ public:
|
||||
public slots:
|
||||
void chartReturned();
|
||||
void chartTypes();
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
@ -37,35 +37,12 @@ EchoNestPlugin::EchoNestPlugin()
|
||||
m_supportedGetTypes << Tomahawk::InfoSystem::InfoArtistBiography << Tomahawk::InfoSystem::InfoArtistFamiliarity << Tomahawk::InfoSystem::InfoArtistHotttness << Tomahawk::InfoSystem::InfoArtistTerms << Tomahawk::InfoSystem::InfoMiscTopTerms;
|
||||
}
|
||||
|
||||
|
||||
EchoNestPlugin::~EchoNestPlugin()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !nam )
|
||||
return;
|
||||
|
||||
QNetworkAccessManager* currNam = Echonest::Config::instance()->nam();
|
||||
TomahawkUtils::NetworkProxyFactory* oldProxyFactory = dynamic_cast< TomahawkUtils::NetworkProxyFactory* >( nam->proxyFactory() );
|
||||
|
||||
if ( !oldProxyFactory )
|
||||
{
|
||||
qDebug() << "Could not get old proxyFactory!";
|
||||
return;
|
||||
}
|
||||
|
||||
currNam->setConfiguration( nam->configuration() );
|
||||
currNam->setNetworkAccessible( nam->networkAccessible() );
|
||||
TomahawkUtils::NetworkProxyFactory* newProxyFactory = new TomahawkUtils::NetworkProxyFactory();
|
||||
newProxyFactory->setNoProxyHosts( oldProxyFactory->noProxyHosts() );
|
||||
QNetworkProxy newProxy( oldProxyFactory->proxy() );
|
||||
newProxyFactory->setProxy( newProxy );
|
||||
currNam->setProxyFactory( newProxyFactory );
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
@ -92,6 +69,7 @@ EchoNestPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getSongProfile( const Tomahawk::InfoSystem::InfoRequestData &requestData, const QString &item )
|
||||
{
|
||||
@ -109,6 +87,7 @@ EchoNestPlugin::getSongProfile( const Tomahawk::InfoSystem::InfoRequestData &req
|
||||
// connect(reply, SIGNAL(finished()), SLOT(getArtistBiographySlot()));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistBiography( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||
{
|
||||
@ -122,6 +101,7 @@ EchoNestPlugin::getArtistBiography( const Tomahawk::InfoSystem::InfoRequestData
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistBiographySlot() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistFamiliarity( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||
{
|
||||
@ -136,6 +116,7 @@ EchoNestPlugin::getArtistFamiliarity( const Tomahawk::InfoSystem::InfoRequestDat
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistFamiliaritySlot() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistHotttnesss( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||
{
|
||||
@ -149,6 +130,7 @@ EchoNestPlugin::getArtistHotttnesss( const Tomahawk::InfoSystem::InfoRequestData
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistHotttnesssSlot() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistTerms( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||
{
|
||||
@ -162,6 +144,7 @@ EchoNestPlugin::getArtistTerms( const Tomahawk::InfoSystem::InfoRequestData &req
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistTermsSlot() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getMiscTopTerms( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||
{
|
||||
@ -194,6 +177,7 @@ EchoNestPlugin::getArtistBiographySlot()
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistFamiliaritySlot()
|
||||
{
|
||||
@ -205,6 +189,7 @@ EchoNestPlugin::getArtistFamiliaritySlot()
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistHotttnesssSlot()
|
||||
{
|
||||
@ -216,6 +201,7 @@ EchoNestPlugin::getArtistHotttnesssSlot()
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistTermsSlot()
|
||||
{
|
||||
@ -234,6 +220,7 @@ EchoNestPlugin::getArtistTermsSlot()
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchoNestPlugin::getMiscTopSlot()
|
||||
{
|
||||
@ -251,6 +238,7 @@ EchoNestPlugin::getMiscTopSlot()
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
EchoNestPlugin::isValidArtistData( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||
{
|
||||
@ -268,6 +256,7 @@ EchoNestPlugin::isValidArtistData( const Tomahawk::InfoSystem::InfoRequestData &
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
EchoNestPlugin::isValidTrackData( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||
{
|
||||
@ -290,6 +279,7 @@ EchoNestPlugin::isValidTrackData( const Tomahawk::InfoSystem::InfoRequestData &r
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Artist
|
||||
EchoNestPlugin::artistFromReply( QNetworkReply* reply )
|
||||
{
|
||||
|
@ -61,9 +61,6 @@ protected slots:
|
||||
Q_UNUSED( requestData );
|
||||
}
|
||||
|
||||
public slots:
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
private:
|
||||
void getSongProfile( const Tomahawk::InfoSystem::InfoRequestData &requestData, const QString &item = QString() );
|
||||
void getArtistBiography( const Tomahawk::InfoSystem::InfoRequestData &requestData );
|
||||
|
@ -102,20 +102,6 @@ hypemPlugin::~hypemPlugin()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hypemPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
{
|
||||
tDebug() << "hypemPlugin: namChangedSLot";
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !nam )
|
||||
return;
|
||||
|
||||
m_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hypemPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
@ -207,14 +193,6 @@ hypemPlugin::fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData reque
|
||||
void
|
||||
hypemPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
if ( !m_nam.data() )
|
||||
{
|
||||
tLog() << "Have a null QNAM, uh oh";
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch ( requestData.type )
|
||||
{
|
||||
case InfoChart:
|
||||
@ -224,7 +202,7 @@ hypemPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSys
|
||||
QUrl url = QUrl( QString( HYPEM_URL "%1/%2" ).arg( criteria["chart_id"].toLower() ).arg(HYPEM_END_URL) );
|
||||
qDebug() << Q_FUNC_INFO << "Getting chart url" << url;
|
||||
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartReturned() ) );
|
||||
return;
|
||||
|
@ -53,7 +53,6 @@ public:
|
||||
public slots:
|
||||
void chartReturned();
|
||||
void chartTypes();
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
@ -82,8 +81,6 @@ private:
|
||||
QList< InfoRequestData > m_cachedRequests;
|
||||
|
||||
QHash< QString, QString > m_cachedCountries;
|
||||
|
||||
QWeakPointer< QNetworkAccessManager > m_nam;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -94,34 +94,6 @@ LastFmPlugin::~LastFmPlugin()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
{
|
||||
if ( !nam )
|
||||
return;
|
||||
|
||||
TomahawkUtils::NetworkProxyFactory* oldProxyFactory = dynamic_cast< TomahawkUtils::NetworkProxyFactory* >( nam->proxyFactory() );
|
||||
if ( !oldProxyFactory )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Could not get old proxyFactory!";
|
||||
return;
|
||||
}
|
||||
|
||||
//WARNING: there's a chance liblastfm2 will clobber the application proxy factory it if it constructs a nam due to the below call
|
||||
//but it is unsafe to re-set it here
|
||||
QNetworkAccessManager* currNam = lastfm::nam();
|
||||
|
||||
currNam->setConfiguration( nam->configuration() );
|
||||
currNam->setNetworkAccessible( nam->networkAccessible() );
|
||||
TomahawkUtils::NetworkProxyFactory* newProxyFactory = new TomahawkUtils::NetworkProxyFactory();
|
||||
newProxyFactory->setNoProxyHosts( oldProxyFactory->noProxyHosts() );
|
||||
QNetworkProxy newProxy( oldProxyFactory->proxy() );
|
||||
newProxyFactory->setProxy( newProxy );
|
||||
currNam->setProxyFactory( newProxyFactory );
|
||||
settingsChanged(); // to get the scrobbler set up
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
|
@ -53,8 +53,6 @@ public slots:
|
||||
void topTracksReturned();
|
||||
void chartReturned();
|
||||
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
@ -41,15 +41,6 @@ MusicBrainzPlugin::~MusicBrainzPlugin()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MusicBrainzPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
{
|
||||
if ( !nam )
|
||||
return;
|
||||
|
||||
m_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||
}
|
||||
|
||||
void
|
||||
MusicBrainzPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
@ -107,7 +98,7 @@ MusicBrainzPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requ
|
||||
QString requestString( "http://musicbrainz.org/ws/2/artist" );
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "query", criteria["artist"] );
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( artistSearchSlot() ) );
|
||||
@ -119,7 +110,7 @@ MusicBrainzPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requ
|
||||
QString requestString( "http://musicbrainz.org/ws/2/artist" );
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "query", criteria["artist"] );
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( albumSearchSlot() ) );
|
||||
@ -182,7 +173,7 @@ MusicBrainzPlugin::artistSearchSlot()
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "artist", artist_id );
|
||||
|
||||
QNetworkReply* newReply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* newReply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
newReply->setProperty( "requestData", oldReply->property( "requestData" ) );
|
||||
connect( newReply, SIGNAL( finished() ), SLOT( albumFoundSlot() ) );
|
||||
}
|
||||
@ -209,7 +200,7 @@ MusicBrainzPlugin::albumSearchSlot()
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "artist", artist_id );
|
||||
|
||||
QNetworkReply* newReply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* newReply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
newReply->setProperty( "requestData", oldReply->property( "requestData" ) );
|
||||
connect( newReply, SIGNAL( finished() ), SLOT( tracksSearchSlot() ) );
|
||||
}
|
||||
@ -252,7 +243,7 @@ MusicBrainzPlugin::tracksSearchSlot()
|
||||
QString requestString = QString( "http://musicbrainz.org/ws/2/release/%1?inc=recordings" ).arg( release_id );
|
||||
QUrl url( requestString );
|
||||
|
||||
QNetworkReply* newReply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* newReply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
newReply->setProperty( "requestData", oldReply->property( "requestData" ) );
|
||||
connect( newReply, SIGNAL( finished() ), SLOT( tracksFoundSlot() ) );
|
||||
}
|
||||
|
@ -38,9 +38,6 @@ public:
|
||||
MusicBrainzPlugin();
|
||||
virtual ~MusicBrainzPlugin();
|
||||
|
||||
public slots:
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
virtual void notInCacheSlot( InfoStringHash criteria, InfoRequestData requestData );
|
||||
@ -63,8 +60,6 @@ private slots:
|
||||
|
||||
private:
|
||||
bool isValidTrackData( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
QWeakPointer< QNetworkAccessManager > m_nam;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -42,21 +42,11 @@ MusixMatchPlugin::~MusixMatchPlugin()
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
void
|
||||
MusixMatchPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !nam )
|
||||
return;
|
||||
|
||||
m_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||
}
|
||||
|
||||
void
|
||||
MusixMatchPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !isValidTrackData( requestData ) || !requestData.input.canConvert< QVariantMap >() || m_nam.isNull() || requestData.type != Tomahawk::InfoSystem::InfoTrackLyrics )
|
||||
if( !isValidTrackData( requestData ) || !requestData.input.canConvert< QVariantMap >() || requestData.type != Tomahawk::InfoSystem::InfoTrackLyrics )
|
||||
return;
|
||||
QVariantMap hash = requestData.input.value< QVariantMap >();
|
||||
QString artist = hash["artistName"].toString();
|
||||
@ -72,7 +62,7 @@ MusixMatchPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
url.addQueryItem( "apikey", m_apiKey );
|
||||
url.addQueryItem( "q_artist", artist );
|
||||
url.addQueryItem( "q_track", track );
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( trackSearchSlot() ) );
|
||||
@ -126,7 +116,7 @@ MusixMatchPlugin::trackSearchSlot()
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "apikey", m_apiKey );
|
||||
url.addQueryItem( "track_id", track_id );
|
||||
QNetworkReply* newReply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* newReply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
newReply->setProperty( "requestData", oldReply->property( "requestData" ) );
|
||||
connect( newReply, SIGNAL( finished() ), SLOT( trackLyricsSlot() ) );
|
||||
}
|
||||
|
@ -42,8 +42,6 @@ public slots:
|
||||
void trackSearchSlot();
|
||||
void trackLyricsSlot();
|
||||
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
@ -64,8 +62,6 @@ private:
|
||||
bool isValidTrackData( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
QString m_apiKey;
|
||||
|
||||
QWeakPointer< QNetworkAccessManager > m_nam;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -47,26 +47,7 @@ SpotifyPlugin::SpotifyPlugin()
|
||||
|
||||
m_supportedGetTypes << InfoChart << InfoChartCapabilities;
|
||||
|
||||
}
|
||||
|
||||
|
||||
SpotifyPlugin::~SpotifyPlugin()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
{
|
||||
tDebug() << "SpotifyPlugin: namChangedSLot";
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !nam )
|
||||
return;
|
||||
|
||||
m_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||
|
||||
// we never need to re-fetch
|
||||
// we never need to re-fetch
|
||||
if ( !m_allChartsMap.isEmpty() )
|
||||
return;
|
||||
|
||||
@ -74,7 +55,7 @@ SpotifyPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
tDebug() << "SpotifyPlugin: InfoChart fetching possible resources";
|
||||
|
||||
QUrl url = QUrl( QString( SPOTIFY_API_URL "toplist/charts" ) );
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
tDebug() << Q_FUNC_INFO << "fetching:" << url;
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartTypes() ) );
|
||||
m_chartsFetchJobs++;
|
||||
@ -82,6 +63,12 @@ SpotifyPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
}
|
||||
|
||||
|
||||
SpotifyPlugin::~SpotifyPlugin()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
@ -164,14 +151,6 @@ SpotifyPlugin::fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData req
|
||||
void
|
||||
SpotifyPlugin::notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
if ( !m_nam.data() )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Have a null QNAM, uh oh";
|
||||
emit info( requestData, QVariant() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch ( requestData.type )
|
||||
{
|
||||
|
||||
@ -181,7 +160,7 @@ SpotifyPlugin::notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, To
|
||||
QUrl url = QUrl( QString( SPOTIFY_API_URL "toplist/%1/" ).arg( criteria["chart_id"] ) );
|
||||
qDebug() << Q_FUNC_INFO << "Getting chart url" << url;
|
||||
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( chartReturned() ) );
|
||||
return;
|
||||
|
@ -53,7 +53,6 @@ public:
|
||||
public slots:
|
||||
void chartReturned();
|
||||
void chartTypes();
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
@ -70,7 +69,6 @@ private:
|
||||
QVariantMap m_allChartsMap;
|
||||
uint m_chartsFetchJobs;
|
||||
QList< InfoRequestData > m_cachedRequests;
|
||||
QWeakPointer< QNetworkAccessManager > m_nam;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -160,11 +160,6 @@ AdiumPlugin::pushInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVar
|
||||
m_pauseTimer->stop();
|
||||
}
|
||||
|
||||
void
|
||||
AdiumPlugin::namChangedSlot( QNetworkAccessManager* nam )
|
||||
{
|
||||
Q_UNUSED( nam )
|
||||
}
|
||||
|
||||
/** Audio state slots */
|
||||
void
|
||||
|
@ -49,8 +49,6 @@ protected slots:
|
||||
void pushInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input );
|
||||
|
||||
public slots:
|
||||
void namChangedSlot( QNetworkAccessManager* nam );
|
||||
|
||||
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
Q_UNUSED( criteria );
|
||||
|
@ -35,8 +35,6 @@ public:
|
||||
FdoNotifyPlugin();
|
||||
virtual ~FdoNotifyPlugin();
|
||||
|
||||
virtual void namChangedSlot( QNetworkAccessManager* ) {}
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
|
@ -117,8 +117,6 @@ public:
|
||||
void setVolume( double value );
|
||||
|
||||
public slots:
|
||||
void namChangedSlot( QNetworkAccessManager* /*nam*/ ) {} // unused
|
||||
|
||||
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
Q_UNUSED( criteria );
|
||||
|
@ -72,8 +72,6 @@ InfoSystem::InfoSystem( QObject *parent )
|
||||
|
||||
QMetaObject::invokeMethod( m_worker.data(), "init", Qt::QueuedConnection, Q_ARG( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache >, m_cache ) );
|
||||
|
||||
connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( newNam() ) );
|
||||
|
||||
connect( m_cache.data(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
|
||||
m_worker.data(), SLOT( infoSlot( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), Qt::UniqueConnection );
|
||||
|
||||
@ -115,14 +113,6 @@ InfoSystem::~InfoSystem()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoSystem::newNam() const
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QMetaObject::invokeMethod( m_worker.data(), "newNam", Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoSystem::getInfo( const InfoRequestData &requestData )
|
||||
{
|
||||
|
@ -185,8 +185,6 @@ protected slots:
|
||||
virtual void pushInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant data ) = 0;
|
||||
virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData ) = 0;
|
||||
|
||||
virtual void namChangedSlot( QNetworkAccessManager *nam ) = 0;
|
||||
|
||||
protected:
|
||||
InfoType m_type;
|
||||
QSet< InfoType > m_supportedGetTypes;
|
||||
@ -251,9 +249,6 @@ signals:
|
||||
void finished( QString target );
|
||||
void finished( QString target, Tomahawk::InfoSystem::InfoType type );
|
||||
|
||||
public slots:
|
||||
void newNam() const;
|
||||
|
||||
private:
|
||||
QWeakPointer< InfoSystemCache > m_cache;
|
||||
QWeakPointer< InfoSystemWorker > m_worker;
|
||||
|
@ -141,15 +141,7 @@ InfoSystemWorker::init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache> cac
|
||||
cache.data(),
|
||||
SLOT( updateCacheSlot( Tomahawk::InfoSystem::InfoStringHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) )
|
||||
);
|
||||
connect(
|
||||
this,
|
||||
SIGNAL( namChanged( QNetworkAccessManager* ) ),
|
||||
plugin.data(),
|
||||
SLOT( namChangedSlot( QNetworkAccessManager* ) )
|
||||
);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod( this, "newNam" );
|
||||
}
|
||||
|
||||
|
||||
@ -348,73 +340,6 @@ InfoSystemWorker::checkTimeoutsTimerFired()
|
||||
}
|
||||
|
||||
|
||||
QNetworkAccessManager*
|
||||
InfoSystemWorker::nam() const
|
||||
{
|
||||
if ( m_nam.isNull() )
|
||||
return 0;
|
||||
|
||||
return m_nam.data();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoSystemWorker::newNam()
|
||||
{
|
||||
QNetworkAccessManager *oldNam = TomahawkUtils::nam();
|
||||
if ( oldNam && oldNam->thread() == thread() )
|
||||
{
|
||||
if ( m_nam.data() != oldNam )
|
||||
{
|
||||
m_nam = QWeakPointer< QNetworkAccessManager >( oldNam );
|
||||
emit namChanged( m_nam.data() );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
oldNam &&
|
||||
!m_nam.isNull() &&
|
||||
oldNam->configuration() == m_nam.data()->configuration() &&
|
||||
oldNam->networkAccessible() == m_nam.data()->networkAccessible()
|
||||
)
|
||||
{
|
||||
TomahawkUtils::NetworkProxyFactory fac1 = *( dynamic_cast< TomahawkUtils::NetworkProxyFactory * >( oldNam->proxyFactory() ) );
|
||||
TomahawkUtils::NetworkProxyFactory fac2 = *( dynamic_cast< TomahawkUtils::NetworkProxyFactory * >( m_nam.data()->proxyFactory() ) );
|
||||
if ( fac1 == fac2 )
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkAccessManager* newNam;
|
||||
#ifdef LIBLASTFM_FOUND
|
||||
newNam = new lastfm::NetworkAccessManager( this );
|
||||
#else
|
||||
newNam = new QNetworkAccessManager( this );
|
||||
#endif
|
||||
if ( !m_nam.isNull() )
|
||||
delete m_nam.data();
|
||||
|
||||
if ( !oldNam )
|
||||
oldNam = new QNetworkAccessManager();
|
||||
|
||||
TomahawkUtils::NetworkProxyFactory* oldProxyFactory = TomahawkUtils::proxyFactory();
|
||||
if ( !oldProxyFactory )
|
||||
oldProxyFactory = new TomahawkUtils::NetworkProxyFactory();
|
||||
|
||||
newNam->setConfiguration( oldNam->configuration() );
|
||||
newNam->setNetworkAccessible( oldNam->networkAccessible() );
|
||||
TomahawkUtils::NetworkProxyFactory* newProxyFactory = new TomahawkUtils::NetworkProxyFactory();
|
||||
newProxyFactory->setNoProxyHosts( oldProxyFactory->noProxyHosts() );
|
||||
newProxyFactory->setProxy( oldProxyFactory->proxy() );
|
||||
newNam->setProxyFactory( newProxyFactory );
|
||||
m_nam = QWeakPointer< QNetworkAccessManager >( newNam );
|
||||
|
||||
emit namChanged( m_nam.data() );
|
||||
|
||||
//FIXME: Currently leaking nam/proxyfactory above -- how to change in a thread-safe way?
|
||||
}
|
||||
|
||||
} //namespace InfoSystem
|
||||
|
||||
} //namespace Tomahawk
|
||||
|
@ -54,8 +54,6 @@ signals:
|
||||
void finished( QString target );
|
||||
void finished( QString target, Tomahawk::InfoSystem::InfoType type );
|
||||
|
||||
void namChanged( QNetworkAccessManager* );
|
||||
|
||||
public slots:
|
||||
void init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > cache );
|
||||
void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
@ -63,8 +61,6 @@ public slots:
|
||||
|
||||
void infoSlot( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||
|
||||
void newNam();
|
||||
|
||||
private slots:
|
||||
void checkTimeoutsTimerFired();
|
||||
|
||||
@ -84,8 +80,6 @@ private:
|
||||
QMap< InfoType, QList< InfoPluginPtr > > m_infoGetMap;
|
||||
QMap< InfoType, QList< InfoPluginPtr > > m_infoPushMap;
|
||||
|
||||
QWeakPointer< QNetworkAccessManager> m_nam;
|
||||
|
||||
QTimer m_checkTimeoutsTimer;
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "bufferiodevice.h"
|
||||
#include "network/controlconnection.h"
|
||||
#include "network/servent.h"
|
||||
#include "database/databasecommand_loadfile.h"
|
||||
#include "database/databasecommand_loadfiles.h"
|
||||
#include "database/database.h"
|
||||
#include "sourcelist.h"
|
||||
#include "utils/logger.h"
|
||||
@ -158,7 +158,7 @@ StreamConnection::setup()
|
||||
|
||||
qDebug() << "in TX mode, fid:" << m_fid;
|
||||
|
||||
DatabaseCommand_LoadFile* cmd = new DatabaseCommand_LoadFile( m_fid );
|
||||
DatabaseCommand_LoadFiles* cmd = new DatabaseCommand_LoadFiles( m_fid.toUInt() );
|
||||
connect( cmd, SIGNAL( result( Tomahawk::result_ptr ) ), SLOT( startSending( Tomahawk::result_ptr ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
||||
albumpos1 = r->albumpos();
|
||||
bitrate1 = r->bitrate();
|
||||
mtime1 = r->modificationTime();
|
||||
id1 = r->dbid();
|
||||
id1 = r->trackId();
|
||||
size1 = r->size();
|
||||
}
|
||||
if ( q2->numResults() )
|
||||
@ -343,7 +343,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
||||
albumpos2 = r->albumpos();
|
||||
bitrate2 = r->bitrate();
|
||||
mtime2 = r->modificationTime();
|
||||
id2 = r->dbid();
|
||||
id2 = r->trackId();
|
||||
size2 = r->size();
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@ TreeModel::addAllCollections()
|
||||
QList<Tomahawk::source_ptr> sources = SourceList::instance()->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" );
|
||||
@ -668,7 +668,7 @@ TreeModel::addCollection( const collection_ptr& collection )
|
||||
|
||||
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() )
|
||||
setIcon( collection->source()->avatar() );
|
||||
@ -708,7 +708,7 @@ TreeModel::addFilteredCollection( const collection_ptr& collection, unsigned int
|
||||
void
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "database/databasecommand_resolve.h"
|
||||
#include "database/databasecommand_alltracks.h"
|
||||
#include "database/databasecommand_addfiles.h"
|
||||
#include "database/databasecommand_loadfile.h"
|
||||
#include "database/databasecommand_loadsocialactions.h"
|
||||
|
||||
#include "utils/logger.h"
|
||||
@ -61,7 +60,8 @@ Result::Result( const QString& url )
|
||||
, m_modtime( 0 )
|
||||
, m_year( 0 )
|
||||
, m_score( 0 )
|
||||
, m_id( 0 )
|
||||
, m_trackId( 0 )
|
||||
, m_fileId( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,8 @@ public:
|
||||
QList< Tomahawk::SocialAction > allSocialActions();
|
||||
|
||||
void setScore( float score ) { m_score = score; }
|
||||
void setId( unsigned int id ) { m_id = id; }
|
||||
void setTrackId( unsigned int id ) { m_trackId = id; }
|
||||
void setFileId( unsigned int id ) { m_fileId = id; }
|
||||
void setRID( RID id ) { m_rid = id; }
|
||||
void setCollection( const Tomahawk::collection_ptr& collection );
|
||||
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
||||
@ -104,7 +105,8 @@ public:
|
||||
QVariantMap attributes() const { return m_attributes; }
|
||||
void setAttributes( const QVariantMap& map ) { m_attributes = map; updateAttributes(); }
|
||||
|
||||
unsigned int dbid() const { return m_id; }
|
||||
unsigned int trackId() const { return m_trackId; }
|
||||
unsigned int fileId() const { return m_fileId; }
|
||||
|
||||
public slots:
|
||||
void onSocialActionsLoaded();
|
||||
@ -148,7 +150,7 @@ private:
|
||||
|
||||
QVariantMap m_attributes;
|
||||
|
||||
unsigned int m_id;
|
||||
unsigned int m_trackId, m_fileId;
|
||||
|
||||
QHash< QString, QVariant > m_currentSocialActions;
|
||||
QList< SocialAction > m_allSocialActions;
|
||||
|
@ -489,32 +489,35 @@ TomahawkSettings::setVerboseNotifications( bool notifications )
|
||||
setValue( "ui/notifications/verbose", notifications );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TomahawkSettings::showOfflineSources() const
|
||||
{
|
||||
return value( "collection/sources/showoffline", false ).toBool();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::setShowOfflineSources( bool show )
|
||||
{
|
||||
setValue( "collection/sources/showoffline", show );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TomahawkSettings::enableEchonestCatalogs() const
|
||||
{
|
||||
return value( "collection/enable_catalogs", false ).toBool();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::setEnableEchonestCatalogs( bool enable )
|
||||
{
|
||||
setValue( "collection/enable_catalogs", enable );
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
QByteArray
|
||||
TomahawkSettings::playlistColumnSizes( const QString& playlistid ) const
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
|
||||
#define LOGFILE_SIZE 1024 * 512
|
||||
#define LOGFILE_SIZE 1024 * 256
|
||||
|
||||
#define RELEASE_LEVEL_THRESHOLD 0
|
||||
#define DEBUG_LEVEL_THRESHOLD LOGEXTRA
|
||||
|
@ -539,7 +539,7 @@ setProxyFactory( NetworkProxyFactory* factory )
|
||||
s_proxyFactory = factory;
|
||||
NetworkProxyFactory::setApplicationProxyFactory( s_proxyFactory );
|
||||
//nam takes ownership so set a copy, not the global one
|
||||
if ( s_nam )
|
||||
if ( !s_nam.isNull() )
|
||||
{
|
||||
TomahawkUtils::NetworkProxyFactory* newProxyFactory = new TomahawkUtils::NetworkProxyFactory();
|
||||
newProxyFactory->setNoProxyHosts( factory->noProxyHosts() );
|
||||
|
@ -415,21 +415,9 @@ SettingsDialog::testLastFmLogin()
|
||||
query[ "username" ] = ui->lineEditLastfmUsername->text().toLower();
|
||||
query[ "authToken" ] = authToken;
|
||||
|
||||
TomahawkUtils::NetworkProxyFactory* oldProxyFactory = TomahawkUtils::proxyFactory();
|
||||
QNetworkAccessManager* nam = TomahawkUtils::nam();
|
||||
|
||||
//WARNING: there's a chance liblastfm2 will clobber the application proxy factory it if it constructs a nam due to the below call
|
||||
//but it is unsafe to re-set it here
|
||||
QNetworkAccessManager* currNam = lastfm::nam();
|
||||
|
||||
currNam->setConfiguration( nam->configuration() );
|
||||
currNam->setNetworkAccessible( nam->networkAccessible() );
|
||||
TomahawkUtils::NetworkProxyFactory* newProxyFactory = new TomahawkUtils::NetworkProxyFactory();
|
||||
newProxyFactory->setNoProxyHosts( oldProxyFactory->noProxyHosts() );
|
||||
QNetworkProxy newProxy( oldProxyFactory->proxy() );
|
||||
newProxyFactory->setProxy( newProxy );
|
||||
currNam->setProxyFactory( newProxyFactory );
|
||||
|
||||
// ensure they have up-to-date settings
|
||||
lastfm::setNetworkAccessManager( TomahawkUtils::nam() );
|
||||
|
||||
QNetworkReply* authJob = lastfm::ws::post( query );
|
||||
|
||||
connect( authJob, SIGNAL( finished() ), SLOT( onLastFmFinished() ) );
|
||||
|
@ -156,18 +156,18 @@ TomahawkApp::init()
|
||||
QFontMetrics fm( f );
|
||||
TomahawkUtils::setHeaderHeight( fm.height() + 8 );
|
||||
|
||||
registerMetaTypes();
|
||||
|
||||
new TomahawkSettings( this );
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
new ActionCollection( this );
|
||||
|
||||
tDebug( LOGINFO ) << "Setting NAM.";
|
||||
#ifdef LIBLASTFM_FOUND
|
||||
TomahawkUtils::setNam( lastfm::nam() );
|
||||
#else
|
||||
#ifndef LIBLASTFM_FOUND
|
||||
TomahawkUtils::setNam( new QNetworkAccessManager() );
|
||||
#else
|
||||
TomahawkUtils::setNam( lastfm::nam() );
|
||||
//Ensure that liblastfm2 won't delete the nam out from under us, even though they created it
|
||||
lastfm::setNetworkAccessManager( TomahawkUtils::nam() );
|
||||
#endif
|
||||
|
||||
TomahawkUtils::NetworkProxyFactory* proxyFactory = new TomahawkUtils::NetworkProxyFactory();
|
||||
@ -183,6 +183,7 @@ TomahawkApp::init()
|
||||
proxyFactory->setNoProxyHosts( s->proxyNoProxyHosts().split( ',', QString::SkipEmptyParts ) );
|
||||
|
||||
TomahawkUtils::setProxyFactory( proxyFactory );
|
||||
|
||||
|
||||
m_audioEngine = QWeakPointer<AudioEngine>( new AudioEngine );
|
||||
m_scanManager = QWeakPointer<ScanManager>( new ScanManager( this ) );
|
||||
@ -362,11 +363,12 @@ void
|
||||
TomahawkApp::registerMetaTypes()
|
||||
{
|
||||
qRegisterMetaType< QSharedPointer<DatabaseCommand> >("QSharedPointer<DatabaseCommand>");
|
||||
qRegisterMetaType< QList<QVariantMap> >("QList<QVariantMap>");
|
||||
qRegisterMetaType< DBSyncConnection::State >("DBSyncConnection::State");
|
||||
qRegisterMetaType< msg_ptr >("msg_ptr");
|
||||
qRegisterMetaType< QList<dbop_ptr> >("QList<dbop_ptr>");
|
||||
qRegisterMetaType< QList<QVariantMap> >("QList<QVariantMap>");
|
||||
qRegisterMetaType< QList<QString> >("QList<QString>");
|
||||
qRegisterMetaType< QList<uint> >("QList<uint>");
|
||||
qRegisterMetaType< Connection* >("Connection*");
|
||||
qRegisterMetaType< QAbstractSocket::SocketError >("QAbstractSocket::SocketError");
|
||||
qRegisterMetaType< QTcpSocket* >("QTcpSocket*");
|
||||
@ -505,6 +507,7 @@ TomahawkApp::initServent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkApp::initSIP()
|
||||
{
|
||||
@ -521,6 +524,7 @@ TomahawkApp::initSIP()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkApp::spotifyApiCheckFinished()
|
||||
{
|
||||
@ -546,7 +550,6 @@ TomahawkApp::activate()
|
||||
bool
|
||||
TomahawkApp::loadUrl( const QString& url )
|
||||
{
|
||||
activate();
|
||||
if ( url.startsWith( "tomahawk://" ) )
|
||||
return GlobalActionManager::instance()->parseTomahawkLink( url );
|
||||
else if ( url.contains( "open.spotify.com" ) || url.contains( "spotify:track" ) )
|
||||
@ -564,7 +567,8 @@ TomahawkApp::loadUrl( const QString& url )
|
||||
l->load( QUrl::fromUserInput( url ) );
|
||||
|
||||
return true;
|
||||
} else if ( info.suffix() == "jspf" )
|
||||
}
|
||||
else if ( info.suffix() == "jspf" )
|
||||
{
|
||||
JSPFLoader* l = new JSPFLoader( true, this );
|
||||
tDebug( LOGINFO ) << "Loading j-spiff:" << url;
|
||||
@ -583,10 +587,9 @@ TomahawkApp::instanceStarted( KDSingleApplicationGuard::Instance instance )
|
||||
{
|
||||
tDebug( LOGINFO ) << "Instance started!" << instance.pid << instance.arguments;
|
||||
|
||||
activate();
|
||||
if ( instance.arguments.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString arg1 = instance.arguments[ 1 ];
|
||||
loadUrl( arg1 );
|
||||
|
@ -137,7 +137,7 @@ private:
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( QPersistentModelIndex )
|
||||
Q_DECLARE_METATYPE(PairList)
|
||||
Q_DECLARE_METATYPE( PairList )
|
||||
|
||||
#endif // TOMAHAWKAPP_H
|
||||
|
||||
|
5
thirdparty/liblastfm2/src/ws/ws.cpp
vendored
5
thirdparty/liblastfm2/src/ws/ws.cpp
vendored
@ -160,7 +160,12 @@ lastfm::setNetworkAccessManager( QNetworkAccessManager* nam )
|
||||
oldNam = threadNamHash[thread];
|
||||
|
||||
if ( oldNam == nam )
|
||||
{
|
||||
// If we're being passed back our own NAM, assume they want to
|
||||
// ensure that we don't delete it out from under them
|
||||
ourNamSet.remove( thread );
|
||||
return;
|
||||
}
|
||||
|
||||
threadNamHash[thread] = nam;
|
||||
ourNamSet.remove( thread );
|
||||
|
Loading…
x
Reference in New Issue
Block a user