diff --git a/src/AccountDelegate.cpp b/src/AccountDelegate.cpp index 6f6185708..862a4b8e8 100644 --- a/src/AccountDelegate.cpp +++ b/src/AccountDelegate.cpp @@ -30,6 +30,7 @@ #include "utils/Logger.h" #include "utils/AnimatedSpinner.h" #include "utils/Closure.h" +#include "Source.h" #define CHILD_ACCOUNT_HEIGHT 24 diff --git a/src/AccountFactoryWrapper.cpp b/src/AccountFactoryWrapper.cpp index 72e5ac418..adf5cb41d 100644 --- a/src/AccountFactoryWrapper.cpp +++ b/src/AccountFactoryWrapper.cpp @@ -24,6 +24,7 @@ #include "AccountFactoryWrapperDelegate.h" #include "DelegateConfigWrapper.h" #include "ui_AccountFactoryWrapper.h" +#include "Source.h" using namespace Tomahawk::Accounts; AccountFactoryWrapper::AccountFactoryWrapper( AccountFactory* factory, QWidget* parent ) diff --git a/src/AccountFactoryWrapperDelegate.cpp b/src/AccountFactoryWrapperDelegate.cpp index 833166b84..2b61599c5 100644 --- a/src/AccountFactoryWrapperDelegate.cpp +++ b/src/AccountFactoryWrapperDelegate.cpp @@ -20,6 +20,7 @@ #include "accounts/Account.h" #include "AccountFactoryWrapper.h" #include "utils/TomahawkUtils.h" +#include "Source.h" #include #include diff --git a/src/AudioControls.cpp b/src/AudioControls.cpp index f360305c4..9080753f8 100644 --- a/src/AudioControls.cpp +++ b/src/AudioControls.cpp @@ -42,7 +42,7 @@ using namespace Tomahawk; AudioControls::AudioControls( QWidget* parent ) : QWidget( parent ) , ui( new Ui::AudioControls ) - , m_repeatMode( PlaylistInterface::NoRepeat ) + , m_repeatMode( PlaylistModes::NoRepeat ) , m_shuffled( false ) , m_lastSliderCheck( 0 ) , m_parent( parent ) @@ -212,7 +212,7 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result ) m_sliderTimeLine.setCurveShape( QTimeLine::LinearCurve ); m_sliderTimeLine.setCurrentTime( 0 ); m_seekMsecs = -1; - + ui->seekSlider->setVisible( true ); int updateRate = (double)1000 / ( (double)ui->seekSlider->contentsRect().width() / (double)( duration / 1000 ) ); @@ -374,7 +374,7 @@ AudioControls::onPlaybackTimer( qint64 msElapsed ) ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) ); m_lastTextSecondShown = seconds; } - + //tDebug( LOGEXTRA ) << Q_FUNC_INFO << "msElapsed =" << msElapsed << "and timer current time =" << m_sliderTimeLine.currentTime() << "and m_seekMsecs =" << m_seekMsecs; if ( msElapsed > 0 && msElapsed != m_lastSliderCheck && m_seekMsecs == -1 && msElapsed - 500 < m_lastSliderCheck ) return; @@ -390,7 +390,7 @@ AudioControls::onPlaybackTimer( qint64 msElapsed ) if ( sender() != &m_phononTickCheckTimer ) m_phononTickCheckTimer.start( 1000 ); - + int currentTime = m_sliderTimeLine.currentTime(); if ( m_noTimeChange ) { @@ -430,13 +430,13 @@ AudioControls::onPlaybackTimer( qint64 msElapsed ) void -AudioControls::onRepeatModeChanged( PlaylistInterface::RepeatMode mode ) +AudioControls::onRepeatModeChanged( PlaylistModes::RepeatMode mode ) { m_repeatMode = mode; switch ( m_repeatMode ) { - case PlaylistInterface::NoRepeat: + case PlaylistModes::NoRepeat: { // switch to RepeatOne ui->repeatButton->setPixmap( RESPATH "images/repeat-off-rest.png" ); @@ -444,7 +444,7 @@ AudioControls::onRepeatModeChanged( PlaylistInterface::RepeatMode mode ) } break; - case PlaylistInterface::RepeatOne: + case PlaylistModes::RepeatOne: { // switch to RepeatAll ui->repeatButton->setPixmap( RESPATH "images/repeat-1-on-rest.png" ); @@ -452,7 +452,7 @@ AudioControls::onRepeatModeChanged( PlaylistInterface::RepeatMode mode ) } break; - case PlaylistInterface::RepeatAll: + case PlaylistModes::RepeatAll: { // switch to NoRepeat ui->repeatButton->setPixmap( RESPATH "images/repeat-all-on-rest.png" ); @@ -471,24 +471,24 @@ AudioControls::onRepeatClicked() { switch ( m_repeatMode ) { - case PlaylistInterface::NoRepeat: + case PlaylistModes::NoRepeat: { // switch to RepeatOne - ViewManager::instance()->setRepeatMode( PlaylistInterface::RepeatOne ); + ViewManager::instance()->setRepeatMode( PlaylistModes::RepeatOne ); } break; - case PlaylistInterface::RepeatOne: + case PlaylistModes::RepeatOne: { // switch to RepeatAll - ViewManager::instance()->setRepeatMode( PlaylistInterface::RepeatAll ); + ViewManager::instance()->setRepeatMode( PlaylistModes::RepeatAll ); } break; - case PlaylistInterface::RepeatAll: + case PlaylistModes::RepeatAll: { // switch to NoRepeat - ViewManager::instance()->setRepeatMode( PlaylistInterface::NoRepeat ); + ViewManager::instance()->setRepeatMode( PlaylistModes::NoRepeat ); } break; diff --git a/src/AudioControls.h b/src/AudioControls.h index fb2b2c84c..d454bf2fe 100644 --- a/src/AudioControls.h +++ b/src/AudioControls.h @@ -50,9 +50,9 @@ signals: void pausePressed(); public slots: - void onRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void onRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void onShuffleModeChanged( bool enabled ); - + protected: void changeEvent( QEvent* e ); void dragEnterEvent ( QDragEnterEvent* ); @@ -61,7 +61,7 @@ protected: private slots: void phononTickCheckTimeout(); - + void onPlaybackStarted( const Tomahawk::result_ptr& result ); void onPlaybackLoading( const Tomahawk::result_ptr& result ); void onPlaybackPaused(); @@ -93,7 +93,7 @@ private: Ui::AudioControls* ui; Tomahawk::result_ptr m_currentTrack; - Tomahawk::PlaylistInterface::RepeatMode m_repeatMode; + Tomahawk::PlaylistModes::RepeatMode m_repeatMode; bool m_shuffled; QTimer m_phononTickCheckTimer; @@ -102,7 +102,7 @@ private: qint64 m_lastSliderCheck; bool m_noTimeChange; qint64 m_lastTextSecondShown; - + QWidget* m_parent; }; diff --git a/src/HeadlessCheck.h b/src/HeadlessCheck.h index 046d6d712..9436ae223 100644 --- a/src/HeadlessCheck.h +++ b/src/HeadlessCheck.h @@ -29,7 +29,6 @@ #define TOMAHAWK_APPLICATION QApplication #include -#include "TomahawkWindow.h" #endif diff --git a/src/LoadXSPFDialog.cpp b/src/LoadXSPFDialog.cpp index ec49e4529..eaa2e16b1 100644 --- a/src/LoadXSPFDialog.cpp +++ b/src/LoadXSPFDialog.cpp @@ -18,6 +18,7 @@ #include "LoadXSPFDialog.h" #include "TomahawkSettings.h" +#include "Source.h" #include "ui_LoadXSPFDialog.h" #include diff --git a/src/Scrobbler.cpp b/src/Scrobbler.cpp index dd2f41942..8b5fa5456 100644 --- a/src/Scrobbler.cpp +++ b/src/Scrobbler.cpp @@ -29,6 +29,7 @@ #include "audio/AudioEngine.h" #include "TomahawkSettings.h" #include "infosystem/InfoSystem.h" +#include "Source.h" #include "utils/Logger.h" @@ -80,7 +81,7 @@ Scrobbler::trackStarted( const Tomahawk::result_ptr& track ) } QVariantMap playInfo; - + Tomahawk::InfoSystem::InfoStringHash trackInfo; trackInfo["title"] = track->track(); trackInfo["artist"] = track->artist()->name(); diff --git a/src/SocialWidget.cpp b/src/SocialWidget.cpp index 8c4d518ed..a49992ac6 100644 --- a/src/SocialWidget.cpp +++ b/src/SocialWidget.cpp @@ -25,6 +25,7 @@ #include "GlobalActionManager.h" #include "utils/Logger.h" +#include "Source.h" #define CORNER_ROUNDNESS 8.0 #define FADING_DURATION 500 @@ -63,7 +64,7 @@ SocialWidget::SocialWidget( QWidget* parent ) connect( ui->facebookButton, SIGNAL( clicked( bool ) ), SLOT( onChanged() ) ); connect( ui->twitterButton, SIGNAL( clicked( bool ) ), SLOT( onChanged() ) ); connect( GlobalActionManager::instance(), SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ), SLOT( onShortLinkReady( QUrl, QUrl, QVariant ) ) ); - + onChanged(); } @@ -206,7 +207,7 @@ SocialWidget::setQuery( const Tomahawk::query_ptr& query ) ui->coverImage->setPixmap( query->cover( ui->coverImage->size() ) ); onShortLinkReady( QString(), QString(), QVariant() ); onChanged(); - + QUrl longUrl = GlobalActionManager::instance()->openLinkFromQuery( query ); GlobalActionManager::instance()->shortenLink( longUrl ); } @@ -235,7 +236,7 @@ SocialWidget::charsAvailable() const { if ( ui->twitterButton->isChecked() ) return 140; - + return 420; // facebook max length } @@ -262,6 +263,6 @@ SocialWidget::eventFilter( QObject* object, QEvent* event ) { onGeometryUpdate(); } - + return QObject::eventFilter( object, event ); } diff --git a/src/TomahawkApp.cpp b/src/TomahawkApp.cpp index 5938e60c5..33289da68 100644 --- a/src/TomahawkApp.cpp +++ b/src/TomahawkApp.cpp @@ -471,7 +471,8 @@ TomahawkApp::registerMetaTypes() qRegisterMetaTypeStreamOperators< QList< Tomahawk::InfoSystem::InfoStringHash > >("QList< Tomahawk::InfoSystem::InfoStringHash > "); qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" ); - qRegisterMetaType< Tomahawk::PlaylistInterface::LatchMode >( "Tomahawk::PlaylistInterface::LatchMode" ); + qRegisterMetaType< Tomahawk::PlaylistModes::LatchMode >( "Tomahawk::PlaylistModes::LatchMode" ); + qRegisterMetaType< Tomahawk::PlaylistModes::RepeatMode >( "Tomahawk::PlaylistModes::RepeatMode" ); qRegisterMetaType< TomahawkUtils::CacheData >( "TomahawkUtils::CacheData" ); qRegisterMetaTypeStreamOperators< TomahawkUtils::CacheData >( "TomahawkUtils::CacheData" ); diff --git a/src/TomahawkApp.h b/src/TomahawkApp.h index 09e911d15..a1c6f0724 100644 --- a/src/TomahawkApp.h +++ b/src/TomahawkApp.h @@ -47,6 +47,7 @@ class Servent; class SipHandler; class TomahawkSettings; class XMPPBot; +class AudioControls; namespace Tomahawk { diff --git a/src/TomahawkTrayIcon.cpp b/src/TomahawkTrayIcon.cpp index 9811c2dd3..7fd9955ed 100644 --- a/src/TomahawkTrayIcon.cpp +++ b/src/TomahawkTrayIcon.cpp @@ -27,6 +27,8 @@ #include "TomahawkApp.h" #include "TomahawkWindow.h" #include "Query.h" +#include "Source.h" +#include "Collection.h" #include "utils/Logger.h" #include "utils/TomahawkUtilsGui.h" @@ -46,7 +48,7 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent ) m_contextMenu = new QMenu(); setContextMenu( m_contextMenu ); - + m_stopContinueAfterTrackAction = new QAction( tr( "&Stop Playback after current Track" ), this ); ActionCollection *ac = ActionCollection::instance(); @@ -58,7 +60,7 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent ) m_contextMenu->addAction( ac->getAction( "nextTrack" ) ); m_contextMenu->addSeparator(); m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) ); - + connect( m_stopContinueAfterTrackAction, SIGNAL( triggered(bool) ), this, SLOT( stopContinueAfterTrackActionTriggered() ) ); #ifdef Q_WS_MAC diff --git a/src/TomahawkWindow.cpp b/src/TomahawkWindow.cpp index c17d68b71..10997260d 100644 --- a/src/TomahawkWindow.cpp +++ b/src/TomahawkWindow.cpp @@ -318,8 +318,8 @@ void TomahawkWindow::setupSignals() { // - connect( ViewManager::instance(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - m_audioControls, SLOT( onRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); + connect( ViewManager::instance(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + m_audioControls, SLOT( onRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); connect( ViewManager::instance(), SIGNAL( shuffleModeChanged( bool ) ), m_audioControls, SLOT( onShuffleModeChanged( bool ) ) ); diff --git a/src/accounts/lastfm/LastFmAccount.cpp b/src/accounts/lastfm/LastFmAccount.cpp index 938f66503..25364e3e3 100644 --- a/src/accounts/lastfm/LastFmAccount.cpp +++ b/src/accounts/lastfm/LastFmAccount.cpp @@ -26,6 +26,7 @@ #include "AtticaManager.h" #include "Pipeline.h" #include "accounts/AccountManager.h" +#include "Source.h" using namespace Tomahawk; using namespace InfoSystem; @@ -83,7 +84,7 @@ LastFmAccount::~LastFmAccount() { if ( m_infoPlugin ) Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin() ); - + delete m_resolver.data(); } @@ -168,7 +169,7 @@ LastFmAccount::infoPlugin() { if ( m_infoPlugin.isNull() ) m_infoPlugin = QWeakPointer< LastFmInfoPlugin >( new LastFmInfoPlugin( this ) ); - + return InfoPluginPtr( m_infoPlugin.data() ); } diff --git a/src/accounts/lastfm/LastFmInfoPlugin.cpp b/src/accounts/lastfm/LastFmInfoPlugin.cpp index f016cf312..3217e9d51 100644 --- a/src/accounts/lastfm/LastFmInfoPlugin.cpp +++ b/src/accounts/lastfm/LastFmInfoPlugin.cpp @@ -30,6 +30,8 @@ #include "utils/TomahawkUtils.h" #include "utils/Logger.h" #include "accounts/lastfm/LastFmAccount.h" +#include "Source.h" +#include "TomahawkSettings.h" #include #include @@ -128,7 +130,7 @@ LastFmInfoPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData ) case InfoChartCapabilities: fetchChartCapabilities( requestData ); break; - + case InfoTrackSimilars: fetchSimilarTracks( requestData ); break; diff --git a/src/accounts/twitter/TwitterConfigWidget.cpp b/src/accounts/twitter/TwitterConfigWidget.cpp index 4187b7834..1683df9c8 100644 --- a/src/accounts/twitter/TwitterConfigWidget.cpp +++ b/src/accounts/twitter/TwitterConfigWidget.cpp @@ -24,6 +24,7 @@ #include "TomahawkSettings.h" #include "utils/TomahawkUtils.h" #include "database/Database.h" +#include "Source.h" #include "TomahawkOAuthTwitter.h" #include diff --git a/src/accounts/twitter/TwitterInfoPlugin.cpp b/src/accounts/twitter/TwitterInfoPlugin.cpp index 89d8da763..39e375f0a 100644 --- a/src/accounts/twitter/TwitterInfoPlugin.cpp +++ b/src/accounts/twitter/TwitterInfoPlugin.cpp @@ -27,6 +27,7 @@ #include "GlobalActionManager.h" #include "utils/Logger.h" +#include "Source.h" namespace Tomahawk { @@ -49,7 +50,7 @@ TwitterInfoPlugin::init() tDebug() << "Failure: move to the worker thread before running init"; return; } - + QVariantHash credentials = m_account->credentials(); if ( credentials[ "oauthtoken" ].toString().isEmpty() || credentials[ "oauthtokensecret" ].toString().isEmpty() ) { @@ -128,7 +129,7 @@ TwitterInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) tLog() << Q_FUNC_INFO << "Failed to find QVariantMap!"; return; } - + QVariantMap map = pushInfoPair.second.toMap(); if ( !map.contains( "accountlist" ) || !map[ "accountlist" ].canConvert< QStringList >() ) @@ -142,13 +143,13 @@ TwitterInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Our account not in the list, not tweeting out"; return; } - + if ( !map.contains( "message" ) && ( !map.contains( "trackinfo" ) || !map[ "trackinfo" ].canConvert< Tomahawk::InfoSystem::InfoStringHash >() ) ) { tLog() << Q_FUNC_INFO << "Failed to find message or trackinfo"; return; } - + Tomahawk::InfoSystem::InfoStringHash info; QString msg; if ( !map.contains( "message" ) ) diff --git a/src/accounts/twitter/sip/TwitterSip.cpp b/src/accounts/twitter/sip/TwitterSip.cpp index 075690f78..6bcdcba0d 100644 --- a/src/accounts/twitter/sip/TwitterSip.cpp +++ b/src/accounts/twitter/sip/TwitterSip.cpp @@ -37,6 +37,7 @@ #include #include #include +#include "Source.h" #include "utils/Logger.h" #include "accounts/twitter/TomahawkOAuthTwitter.h" diff --git a/src/accounts/xmpp/XmppInfoPlugin.cpp b/src/accounts/xmpp/XmppInfoPlugin.cpp index b46557cbf..afd637b4b 100644 --- a/src/accounts/xmpp/XmppInfoPlugin.cpp +++ b/src/accounts/xmpp/XmppInfoPlugin.cpp @@ -23,6 +23,7 @@ #include "GlobalActionManager.h" #include "sip/XmppSip.h" #include "utils/Logger.h" +#include "TomahawkSettings.h" // remove now playing status after PAUSE_TIMEOUT seconds @@ -58,7 +59,7 @@ Tomahawk::InfoSystem::XmppInfoPlugin::init() if ( m_sipPlugin.isNull() ) return; - + connect( this, SIGNAL( publishTune( QUrl, Tomahawk::InfoSystem::InfoStringHash ) ), m_sipPlugin.data(), SLOT( publishTune( QUrl, Tomahawk::InfoSystem::InfoStringHash ) ), Qt::QueuedConnection ); } @@ -96,20 +97,20 @@ Tomahawk::InfoSystem::XmppInfoPlugin::audioStarted( const Tomahawk::InfoSystem:: tDebug() << Q_FUNC_INFO << "Failed to convert data to a QVariantMap"; return; } - + QVariantMap map = pushInfoPair.second.toMap(); if ( map.contains( "private" ) && map[ "private" ] == TomahawkSettings::FullyPrivate ) { emit publishTune( QUrl(), Tomahawk::InfoSystem::InfoStringHash() ); return; } - + if ( !map.contains( "trackinfo" ) || !map[ "trackinfo" ].canConvert< Tomahawk::InfoSystem::InfoStringHash >() ) { tDebug() << Q_FUNC_INFO << "did not find an infostringhash"; return; } - + Tomahawk::InfoSystem::InfoStringHash info = map[ "trackinfo" ].value< Tomahawk::InfoSystem::InfoStringHash >(); QUrl url; diff --git a/src/accounts/xmpp/sip/XmppSip.cpp b/src/accounts/xmpp/sip/XmppSip.cpp index c517f72e3..6330d39c8 100644 --- a/src/accounts/xmpp/sip/XmppSip.cpp +++ b/src/accounts/xmpp/sip/XmppSip.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #ifndef ENABLE_HEADLESS #include diff --git a/src/accounts/zeroconf/Zeroconf.cpp b/src/accounts/zeroconf/Zeroconf.cpp index cbe1edd19..dcc14709c 100644 --- a/src/accounts/zeroconf/Zeroconf.cpp +++ b/src/accounts/zeroconf/Zeroconf.cpp @@ -26,6 +26,7 @@ #include "TomahawkSettings.h" #include "utils/Logger.h" #include "ZeroconfAccount.h" +#include "Source.h" using namespace Tomahawk; using namespace Accounts; diff --git a/src/accounts/zeroconf/ZeroconfAccount.cpp b/src/accounts/zeroconf/ZeroconfAccount.cpp index c22515ce9..44d74e057 100644 --- a/src/accounts/zeroconf/ZeroconfAccount.cpp +++ b/src/accounts/zeroconf/ZeroconfAccount.cpp @@ -20,6 +20,7 @@ #include "sip/SipPlugin.h" #include "Zeroconf.h" +#include "Source.h" #include diff --git a/src/infoplugins/generic/charts/ChartsPlugin.cpp b/src/infoplugins/generic/charts/ChartsPlugin.cpp index 52b02624d..3a3433fb4 100644 --- a/src/infoplugins/generic/charts/ChartsPlugin.cpp +++ b/src/infoplugins/generic/charts/ChartsPlugin.cpp @@ -35,6 +35,7 @@ #include "utils/TomahawkUtils.h" #include "utils/Logger.h" #include "utils/TomahawkCache.h" +#include "Source.h" #define CHART_URL "http://charts.tomahawk-player.org/" //#define CHART_URL "http://localhost:8080/" diff --git a/src/infoplugins/generic/hypem/HypemPlugin.cpp b/src/infoplugins/generic/hypem/HypemPlugin.cpp index 2624d4baa..c4c3a23a1 100644 --- a/src/infoplugins/generic/hypem/HypemPlugin.cpp +++ b/src/infoplugins/generic/hypem/HypemPlugin.cpp @@ -31,6 +31,7 @@ #include "TomahawkSettings.h" #include "utils/TomahawkUtils.h" #include "utils/Logger.h" +#include "Source.h" #define HYPEM_URL "http://hypem.com/playlist/" #define HYPEM_END_URL "json/1/data.js" @@ -39,7 +40,7 @@ namespace Tomahawk { - + namespace InfoSystem { diff --git a/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp b/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp index ff7ec2d01..9d3c7cece 100644 --- a/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp +++ b/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp @@ -14,6 +14,7 @@ #include "utils/TomahawkUtils.h" #include "utils/Logger.h" #include "utils/TomahawkCache.h" +#include "Source.h" #include #include diff --git a/src/infoplugins/generic/spotify/SpotifyPlugin.cpp b/src/infoplugins/generic/spotify/SpotifyPlugin.cpp index 922bb8aec..38e38db40 100644 --- a/src/infoplugins/generic/spotify/SpotifyPlugin.cpp +++ b/src/infoplugins/generic/spotify/SpotifyPlugin.cpp @@ -33,6 +33,7 @@ #include "utils/TomahawkUtils.h" #include "utils/Logger.h" #include "CountryUtils.h" +#include "Source.h" #define SPOTIFY_API_URL "http://spotikea.tomahawk-player.org/" #include diff --git a/src/infoplugins/linux/mpris/MprisPlugin.cpp b/src/infoplugins/linux/mpris/MprisPlugin.cpp index f72d19dad..02de7e158 100644 --- a/src/infoplugins/linux/mpris/MprisPlugin.cpp +++ b/src/infoplugins/linux/mpris/MprisPlugin.cpp @@ -31,6 +31,8 @@ #include "GlobalActionManager.h" #include "utils/Logger.h" #include "utils/TomahawkUtils.h" +#include "audio/AudioEngine.h" +#include "Source.h" #include "MprisPlugin.h" #include "MprisPluginRootAdaptor.h" @@ -198,7 +200,7 @@ MprisPlugin::canSeek() const Tomahawk::playlistinterface_ptr p = AudioEngine::instance()->playlist(); if ( p.isNull() ) return false; - return p->seekRestrictions() != PlaylistInterface::NoSeek; + return p->seekRestrictions() != PlaylistModes::NoSeek; } @@ -209,16 +211,16 @@ MprisPlugin::loopStatus() const Tomahawk::playlistinterface_ptr p = AudioEngine::instance()->playlist(); if ( p.isNull() ) return "None"; - PlaylistInterface::RepeatMode mode = p->repeatMode(); + PlaylistModes::RepeatMode mode = p->repeatMode(); switch( mode ) { - case PlaylistInterface::RepeatOne: + case PlaylistModes::RepeatOne: return "Track"; break; - case PlaylistInterface::RepeatAll: + case PlaylistModes::RepeatAll: return "Playlist"; break; - case PlaylistInterface::NoRepeat: + case PlaylistModes::NoRepeat: return "None"; break; default: @@ -237,11 +239,11 @@ MprisPlugin::setLoopStatus( const QString& value ) if ( p.isNull() ) return; if ( value == "Track" ) - p->setRepeatMode( PlaylistInterface::RepeatOne ); + p->setRepeatMode( PlaylistModes::RepeatOne ); else if ( value == "Playlist" ) - p->setRepeatMode( PlaylistInterface::RepeatAll ); + p->setRepeatMode( PlaylistModes::RepeatAll ); else if ( value == "None" ) - p->setRepeatMode( PlaylistInterface::NoRepeat ); + p->setRepeatMode( PlaylistModes::NoRepeat ); } @@ -485,7 +487,7 @@ MprisPlugin::audioStarted( const QVariant& input ) return; QVariantMap map = input.toMap(); - + if ( !map.contains( "trackinfo" ) || !map[ "trackinfo" ].canConvert< Tomahawk::InfoSystem::InfoStringHash >() ) return; diff --git a/src/libtomahawk/AclRegistry.cpp b/src/libtomahawk/AclRegistry.cpp index 78f370ee5..5ae2262c9 100644 --- a/src/libtomahawk/AclRegistry.cpp +++ b/src/libtomahawk/AclRegistry.cpp @@ -24,6 +24,7 @@ #include "TomahawkSettings.h" #include "TomahawkApp.h" +#include "Source.h" #include "utils/Logger.h" #include "jobview/AclJobItem.h" @@ -72,7 +73,7 @@ ACLRegistry::isAuthorizedUser( const QString& dbid, const QString &username, ACL //FIXME: Remove when things are working emit aclResult( dbid, username, ACLRegistry::Stream ); return ACLRegistry::NotFound; - + bool found = false; QMutableListIterator< ACLRegistry::User > i( m_cache ); while ( i.hasNext() ) @@ -87,7 +88,7 @@ ACLRegistry::isAuthorizedUser( const QString& dbid, const QString &username, ACL found = true; } } - + foreach ( QString knownaccountid, user.knownAccountIds ) { if ( username == knownaccountid ) @@ -109,7 +110,7 @@ ACLRegistry::isAuthorizedUser( const QString& dbid, const QString &username, ACL if ( skipEmission ) return ACLRegistry::NotFound; - + // User was not found, create a new user entry ACLRegistry::User user; user.knownDbids.append( dbid ); @@ -158,7 +159,7 @@ ACLRegistry::queueNextJob() { if ( m_jobCount != 0 ) return; - + if ( !m_jobQueue.isEmpty() ) { AclJobItem* job = m_jobQueue.dequeue(); diff --git a/src/libtomahawk/AclRegistry.h b/src/libtomahawk/AclRegistry.h index 1530a843f..373d673a2 100644 --- a/src/libtomahawk/AclRegistry.h +++ b/src/libtomahawk/AclRegistry.h @@ -26,6 +26,9 @@ #include #include #include +#include +#include +#include #include "HeadlessCheck.h" #include "DllMacro.h" @@ -71,7 +74,7 @@ public: signals: void aclResult( QString nodeid, QString username, ACLRegistry::ACL peerStatus ); - + public slots: /** * @brief Checks if peer is authorized; optionally, can authorize peer with given type if not found @@ -90,7 +93,7 @@ public slots: private slots: void userDecision( ACLRegistry::User user ); void queueNextJob(); - + private: /** * @brief Saves the cache. diff --git a/src/libtomahawk/ActionCollection.cpp b/src/libtomahawk/ActionCollection.cpp index b72ae63b2..e69f723bd 100644 --- a/src/libtomahawk/ActionCollection.cpp +++ b/src/libtomahawk/ActionCollection.cpp @@ -22,6 +22,8 @@ #include "TomahawkSettings.h" #include "audio/AudioEngine.h" #include "utils/TomahawkUtils.h" +#include "utils/Logger.h" +#include "Source.h" ActionCollection* ActionCollection::s_instance = 0; ActionCollection* ActionCollection::instance() @@ -77,11 +79,11 @@ ActionCollection::initActions() m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this ); // connect actions to AudioEngine - AudioEngine *ae = AudioEngine::instance(); - connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection ); - connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), Qt::UniqueConnection ); - connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection ); - connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), Qt::UniqueConnection ); +// AudioEngine *ae = AudioEngine::instance(); +// connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection ); +// connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), Qt::UniqueConnection ); +// connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection ); +// connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), Qt::UniqueConnection ); } diff --git a/src/libtomahawk/Album.cpp b/src/libtomahawk/Album.cpp index 3671fc170..dc765460e 100644 --- a/src/libtomahawk/Album.cpp +++ b/src/libtomahawk/Album.cpp @@ -24,6 +24,7 @@ #include "database/Database.h" #include "database/DatabaseImpl.h" #include "Query.h" +#include "Source.h" #include "utils/Logger.h" @@ -215,7 +216,7 @@ Album::playlistInterface( ModelMode mode, const Tomahawk::collection_ptr& collec pli = Tomahawk::playlistinterface_ptr( new Tomahawk::AlbumPlaylistInterface( this, mode, collection ) ); connect( pli.data(), SIGNAL( tracksLoaded( Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), SLOT( onTracksLoaded( Tomahawk::ModelMode, Tomahawk::collection_ptr ) ) ); - + m_playlistInterface[ mode ][ collection ] = pli; } diff --git a/src/libtomahawk/AlbumPlaylistInterface.h b/src/libtomahawk/AlbumPlaylistInterface.h index 1dd133e37..de5c3d440 100644 --- a/src/libtomahawk/AlbumPlaylistInterface.h +++ b/src/libtomahawk/AlbumPlaylistInterface.h @@ -50,16 +50,16 @@ public: virtual bool hasNextItem(); virtual Tomahawk::result_ptr currentItem() const; - virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; } + virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; } virtual bool shuffled() const { return false; } - virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {} + virtual void setRepeatMode( PlaylistModes::RepeatMode ) {} virtual void setShuffled( bool ) {} virtual void setFilter( const QString& /*pattern*/ ) {} signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void trackCountChanged( unsigned int tracks ); @@ -75,13 +75,13 @@ private slots: private: AlbumPlaylistInterface(); - + QList filterTracks( const QList& queries ); QList< Tomahawk::query_ptr > m_queries; result_ptr m_currentItem; unsigned int m_currentTrack; - + bool m_infoSystemLoaded; bool m_databaseLoaded; diff --git a/src/libtomahawk/Artist.cpp b/src/libtomahawk/Artist.cpp index b0d79c1e8..6a413f3b8 100644 --- a/src/libtomahawk/Artist.cpp +++ b/src/libtomahawk/Artist.cpp @@ -25,6 +25,7 @@ #include "database/DatabaseImpl.h" #include "database/DatabaseCommand_AllAlbums.h" #include "database/DatabaseCommand_TrackStats.h" +#include "Source.h" #include "utils/Logger.h" @@ -137,7 +138,7 @@ Artist::albums( ModelMode mode, const Tomahawk::collection_ptr& collection ) con requestData.caller = m_uuid; requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo ); requestData.type = Tomahawk::InfoSystem::InfoArtistReleases; - + connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), Qt::UniqueConnection ); @@ -180,7 +181,7 @@ Artist::similarArtists() const requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo ); requestData.type = Tomahawk::InfoSystem::InfoArtistSimilars; requestData.requestId = TomahawkUtils::infosystemRequestId(); - + connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), Qt::UniqueConnection ); @@ -192,7 +193,7 @@ Artist::similarArtists() const m_infoJobs++; Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData ); } - + return m_similarArtists; } @@ -219,7 +220,7 @@ Artist::playbackHistory( const Tomahawk::source_ptr& source ) const history << log; } } - + return history; } @@ -241,7 +242,7 @@ Artist::playbackCount( const source_ptr& source ) if ( source.isNull() || log.source == source ) count++; } - + return count; } @@ -254,7 +255,7 @@ Artist::onAlbumsFound( const QList< album_ptr >& albums, const QVariant& data ) m_databaseAlbums << albums; m_albumsLoaded.insert( DatabaseMode, true ); } - + emit albumsAdded( albums, DatabaseMode ); } @@ -289,7 +290,7 @@ Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVari break; } - + case Tomahawk::InfoSystem::InfoArtistImages: { if ( !output.isNull() && output.isValid() ) @@ -302,7 +303,7 @@ Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVari emit coverChanged(); } } - + break; } @@ -313,7 +314,7 @@ Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVari { m_similarArtists << Artist::get( artist ); } - + m_simArtistsLoaded = true; emit similarArtistsLoaded(); diff --git a/src/libtomahawk/Artist.h b/src/libtomahawk/Artist.h index 484c17aad..a0a89dbb8 100644 --- a/src/libtomahawk/Artist.h +++ b/src/libtomahawk/Artist.h @@ -30,7 +30,6 @@ #include "Typedefs.h" #include "DllMacro.h" #include "Query.h" -#include "infosystem/InfoSystem.h" namespace Tomahawk { @@ -51,7 +50,7 @@ public: QString sortname() const { return m_sortname; } bool infoLoaded() const { return m_infoLoaded; } - + QList albums( ModelMode mode = Mixed, const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr() ) const; QList similarArtists() const; @@ -103,7 +102,7 @@ private: QList m_databaseAlbums; QList m_officialAlbums; QList m_similarArtists; - + bool m_playbackHistoryLoaded; QList< PlaybackLog > m_playbackHistory; @@ -114,7 +113,7 @@ private: #endif Tomahawk::playlistinterface_ptr m_playlistInterface; - + QWeakPointer< Tomahawk::Artist > m_ownRef; }; diff --git a/src/libtomahawk/ArtistPlaylistInterface.cpp b/src/libtomahawk/ArtistPlaylistInterface.cpp index 4568076bd..e2055dc38 100644 --- a/src/libtomahawk/ArtistPlaylistInterface.cpp +++ b/src/libtomahawk/ArtistPlaylistInterface.cpp @@ -24,6 +24,7 @@ #include "Query.h" #include "database/Database.h" #include "database/DatabaseCommand_AllTracks.h" +#include "Source.h" #include "utils/Logger.h" diff --git a/src/libtomahawk/ArtistPlaylistInterface.h b/src/libtomahawk/ArtistPlaylistInterface.h index c575de55c..d325f6abe 100644 --- a/src/libtomahawk/ArtistPlaylistInterface.h +++ b/src/libtomahawk/ArtistPlaylistInterface.h @@ -49,10 +49,10 @@ public: virtual bool hasNextItem(); virtual Tomahawk::result_ptr currentItem() const; - virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; } + virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; } virtual bool shuffled() const { return false; } - virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {} + virtual void setRepeatMode( PlaylistModes::RepeatMode ) {} virtual void setShuffled( bool ) {} virtual void setFilter( const QString& /*pattern*/ ) {} diff --git a/src/libtomahawk/AtticaManager.cpp b/src/libtomahawk/AtticaManager.cpp index 3bf7740e1..f437bce81 100644 --- a/src/libtomahawk/AtticaManager.cpp +++ b/src/libtomahawk/AtticaManager.cpp @@ -21,6 +21,7 @@ #include "utils/TomahawkUtils.h" #include "TomahawkSettingsGui.h" #include "Pipeline.h" +#include "Source.h" #include diff --git a/src/libtomahawk/ContextMenu.cpp b/src/libtomahawk/ContextMenu.cpp index 4c13a7b6c..60eecc663 100644 --- a/src/libtomahawk/ContextMenu.cpp +++ b/src/libtomahawk/ContextMenu.cpp @@ -27,6 +27,7 @@ #include "Artist.h" #include "Album.h" #include "utils/Logger.h" +#include "audio/AudioEngine.h" using namespace Tomahawk; diff --git a/src/libtomahawk/ExternalResolver.cpp b/src/libtomahawk/ExternalResolver.cpp index f01fc3e5b..639c51da0 100644 --- a/src/libtomahawk/ExternalResolver.cpp +++ b/src/libtomahawk/ExternalResolver.cpp @@ -19,6 +19,7 @@ #include "ExternalResolver.h" #include "utils/Logger.h" +#include "Source.h" Tomahawk::ExternalResolver::ErrorState Tomahawk::ExternalResolver::error() const diff --git a/src/libtomahawk/ExternalResolverGui.cpp b/src/libtomahawk/ExternalResolverGui.cpp index 744b2ab5f..1204a0c29 100644 --- a/src/libtomahawk/ExternalResolverGui.cpp +++ b/src/libtomahawk/ExternalResolverGui.cpp @@ -28,6 +28,8 @@ #include #include "utils/Logger.h" +#include "Source.h" + Tomahawk::ExternalResolverGui::ExternalResolverGui(const QString& filePath) : Tomahawk::ExternalResolver(filePath) { diff --git a/src/libtomahawk/LatchManager.cpp b/src/libtomahawk/LatchManager.cpp index a5a0c772b..ec18dfde7 100644 --- a/src/libtomahawk/LatchManager.cpp +++ b/src/libtomahawk/LatchManager.cpp @@ -85,7 +85,7 @@ LatchManager::playlistChanged( Tomahawk::playlistinterface_ptr ) QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" ); latchOnAction->setText( tr( "&Catch Up" ) ); latchOnAction->setIcon( QIcon() ); - + // If not, then keep waiting return; } @@ -152,7 +152,7 @@ LatchManager::latchModeChangeRequest( const Tomahawk::source_ptr& source, bool r if ( !isLatched( source ) ) return; - source->playlistInterface()->setLatchMode( realtime ? Tomahawk::PlaylistInterface::RealTime : Tomahawk::PlaylistInterface::StayOnSong ); + source->playlistInterface()->setLatchMode( realtime ? Tomahawk::PlaylistModes::RealTime : Tomahawk::PlaylistModes::StayOnSong ); if ( realtime ) catchUpRequest(); } diff --git a/src/libtomahawk/Pipeline.cpp b/src/libtomahawk/Pipeline.cpp index 4adce9a12..205a9e7aa 100644 --- a/src/libtomahawk/Pipeline.cpp +++ b/src/libtomahawk/Pipeline.cpp @@ -25,6 +25,7 @@ #include "ExternalResolver.h" #include "resolvers/ScriptResolver.h" #include "resolvers/QtScriptResolver.h" +#include "Source.h" #include "utils/Logger.h" diff --git a/src/libtomahawk/PlaylistInterface.cpp b/src/libtomahawk/PlaylistInterface.cpp index f965b8613..7dda7ff5c 100644 --- a/src/libtomahawk/PlaylistInterface.cpp +++ b/src/libtomahawk/PlaylistInterface.cpp @@ -25,10 +25,9 @@ using namespace Tomahawk; PlaylistInterface::PlaylistInterface () : QObject() - , m_latchMode( StayOnSong ) + , m_latchMode( PlaylistModes::StayOnSong ) { m_id = uuid(); - qRegisterMetaType( "Tomahawk::PlaylistInterface::RepeatMode" ); } PlaylistInterface::~PlaylistInterface() diff --git a/src/libtomahawk/PlaylistInterface.h b/src/libtomahawk/PlaylistInterface.h index 36671ae26..0c88c2ef9 100644 --- a/src/libtomahawk/PlaylistInterface.h +++ b/src/libtomahawk/PlaylistInterface.h @@ -34,19 +34,11 @@ class DLLEXPORT PlaylistInterface : public QObject Q_OBJECT public: - enum RepeatMode { NoRepeat, RepeatOne, RepeatAll }; - Q_ENUMS( RepeatMode ) - enum ViewMode { Unknown, Tree, Flat, Album }; - enum SeekRestrictions { NoSeekRestrictions, NoSeek }; - enum SkipRestrictions { NoSkipRestrictions, NoSkipForwards, NoSkipBackwards, NoSkip }; - enum RetryMode { NoRetry, Retry }; - enum LatchMode { StayOnSong, RealTime }; - explicit PlaylistInterface(); virtual ~PlaylistInterface(); const QString id() { return m_id; } - + virtual QList< Tomahawk::query_ptr > tracks() = 0; virtual int unfilteredTrackCount() const = 0; @@ -58,21 +50,21 @@ public: virtual Tomahawk::result_ptr nextItem(); virtual Tomahawk::result_ptr siblingItem( int itemsAway ) = 0; - virtual PlaylistInterface::RepeatMode repeatMode() const = 0; + virtual PlaylistModes::RepeatMode repeatMode() const = 0; virtual bool shuffled() const = 0; - virtual PlaylistInterface::ViewMode viewMode() const { return Unknown; } - - virtual PlaylistInterface::SeekRestrictions seekRestrictions() const { return NoSeekRestrictions; } - virtual PlaylistInterface::SkipRestrictions skipRestrictions() const { return NoSkipRestrictions; } + virtual PlaylistModes::ViewMode viewMode() const { return PlaylistModes::Unknown; } - virtual PlaylistInterface::RetryMode retryMode() const { return NoRetry; } + virtual PlaylistModes::SeekRestrictions seekRestrictions() const { return PlaylistModes::NoSeekRestrictions; } + virtual PlaylistModes::SkipRestrictions skipRestrictions() const { return PlaylistModes::NoSkipRestrictions; } + + virtual PlaylistModes::RetryMode retryMode() const { return PlaylistModes::NoRetry; } virtual quint32 retryInterval() const { return 30000; } - virtual PlaylistInterface::LatchMode latchMode() const { return m_latchMode; } - virtual void setLatchMode( PlaylistInterface::LatchMode latchMode ) { m_latchMode = latchMode; } - + virtual PlaylistModes::LatchMode latchMode() const { return m_latchMode; } + virtual void setLatchMode( PlaylistModes::LatchMode latchMode ) { m_latchMode = latchMode; } + virtual QString filter() const { return m_filter; } virtual void setFilter( const QString& pattern ) { m_filter = pattern; } @@ -84,23 +76,21 @@ public: virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr ) { return false; } public slots: - virtual void setRepeatMode( RepeatMode mode ) = 0; + virtual void setRepeatMode( PlaylistModes::RepeatMode mode ) = 0; virtual void setShuffled( bool enabled ) = 0; signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void trackCountChanged( unsigned int tracks ); void sourceTrackCountChanged( unsigned int tracks ); - void latchModeChanged( Tomahawk::PlaylistInterface::LatchMode mode ); + void latchModeChanged( Tomahawk::PlaylistModes::LatchMode mode ); void nextTrackReady(); protected: - LatchMode m_latchMode; - -private: - Q_DISABLE_COPY( PlaylistInterface ) + PlaylistModes::LatchMode m_latchMode; +private: QString m_id; QString m_filter; }; diff --git a/src/libtomahawk/PlaylistPlaylistInterface.h b/src/libtomahawk/PlaylistPlaylistInterface.h index 5881c50ef..4db326431 100644 --- a/src/libtomahawk/PlaylistPlaylistInterface.h +++ b/src/libtomahawk/PlaylistPlaylistInterface.h @@ -52,13 +52,13 @@ public: virtual Tomahawk::result_ptr siblingItem( int /*itemsAway*/ ) { return result_ptr(); } - virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; } + virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; } virtual bool shuffled() const { return false; } virtual void setFilter( const QString& /*pattern*/ ) {} public slots: - virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {} + virtual void setRepeatMode( PlaylistModes::RepeatMode ) {} virtual void setShuffled( bool ) {} private: diff --git a/src/libtomahawk/Resolver.cpp b/src/libtomahawk/Resolver.cpp index 6311a8d53..60c70af9f 100644 --- a/src/libtomahawk/Resolver.cpp +++ b/src/libtomahawk/Resolver.cpp @@ -17,3 +17,5 @@ */ #include "Resolver.h" + +#include "Source.h" \ No newline at end of file diff --git a/src/libtomahawk/SourcePlaylistInterface.cpp b/src/libtomahawk/SourcePlaylistInterface.cpp index c2d818bcc..6b3caf048 100644 --- a/src/libtomahawk/SourcePlaylistInterface.cpp +++ b/src/libtomahawk/SourcePlaylistInterface.cpp @@ -28,14 +28,14 @@ using namespace Tomahawk; -SourcePlaylistInterface::SourcePlaylistInterface( Tomahawk::Source *source, Tomahawk::PlaylistInterface::LatchMode latchMode ) +SourcePlaylistInterface::SourcePlaylistInterface( Tomahawk::Source *source, Tomahawk::PlaylistModes::LatchMode latchMode ) : PlaylistInterface() , m_source( source ) , m_currentItem( 0 ) , m_gotNextItem( false ) { setLatchMode( latchMode ); - + if ( !m_source.isNull() ) connect( m_source.data(), SIGNAL( playbackStarted( const Tomahawk::query_ptr& ) ), SLOT( onSourcePlaybackStarted( const Tomahawk::query_ptr& ) ) ); @@ -75,7 +75,7 @@ SourcePlaylistInterface::nextItem() } m_gotNextItem = false; - + if ( m_source.data()->currentTrack()->numResults() ) m_currentItem = m_source.data()->currentTrack()->results().first(); else @@ -108,7 +108,7 @@ SourcePlaylistInterface::hasNextItem() { if ( !sourceValid() ) return false; - + return m_gotNextItem; } diff --git a/src/libtomahawk/SourcePlaylistInterface.h b/src/libtomahawk/SourcePlaylistInterface.h index dc967510c..cc09e4dc9 100644 --- a/src/libtomahawk/SourcePlaylistInterface.h +++ b/src/libtomahawk/SourcePlaylistInterface.h @@ -36,7 +36,7 @@ class DLLEXPORT SourcePlaylistInterface : public Tomahawk::PlaylistInterface Q_OBJECT public: - SourcePlaylistInterface( Tomahawk::Source *source, Tomahawk::PlaylistInterface::LatchMode latchMode = PlaylistInterface::StayOnSong ); + SourcePlaylistInterface( Tomahawk::Source *source, Tomahawk::PlaylistModes::LatchMode latchMode = PlaylistModes::StayOnSong ); virtual ~SourcePlaylistInterface(); QList tracks(); @@ -50,14 +50,14 @@ public: virtual Tomahawk::result_ptr nextItem(); virtual Tomahawk::result_ptr currentItem() const; - virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; } - virtual PlaylistInterface::SeekRestrictions seekRestrictions() const { return PlaylistInterface::NoSeek; } - virtual PlaylistInterface::SkipRestrictions skipRestrictions() const { return PlaylistInterface::NoSkipBackwards; } - virtual PlaylistInterface::RetryMode retryMode() const { return Retry; } + virtual PlaylistModes::RepeatMode repeatMode() const { return PlaylistModes::NoRepeat; } + virtual PlaylistModes::SeekRestrictions seekRestrictions() const { return PlaylistModes::NoSeek; } + virtual PlaylistModes::SkipRestrictions skipRestrictions() const { return PlaylistModes::NoSkipBackwards; } + virtual PlaylistModes::RetryMode retryMode() const { return PlaylistModes::Retry; } virtual quint32 retryInterval() const { return 5000; } - virtual void setLatchMode( PlaylistInterface::LatchMode latchMode ) { m_latchMode = latchMode; emit latchModeChanged( latchMode ); } - + virtual void setLatchMode( PlaylistModes::LatchMode latchMode ) { m_latchMode = latchMode; emit latchModeChanged( latchMode ); } + virtual bool shuffled() const { return false; } virtual void setFilter( const QString& /*pattern*/ ) {} @@ -66,9 +66,9 @@ public: virtual void reset(); public slots: - virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {} + virtual void setRepeatMode( PlaylistModes::RepeatMode ) {} virtual void setShuffled( bool ) {} - virtual void audioPaused() { setLatchMode( PlaylistInterface::StayOnSong ); } + virtual void audioPaused() { setLatchMode( PlaylistModes::StayOnSong ); } private slots: void onSourcePlaybackStarted( const Tomahawk::query_ptr& query ); diff --git a/src/libtomahawk/TomahawkSettings.cpp b/src/libtomahawk/TomahawkSettings.cpp index cb563ec7a..8489c52f3 100644 --- a/src/libtomahawk/TomahawkSettings.cpp +++ b/src/libtomahawk/TomahawkSettings.cpp @@ -22,6 +22,7 @@ #include +#include "Source.h" #include "sip/SipHandler.h" #include "PlaylistInterface.h" @@ -557,7 +558,7 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion ) endGroup(); - setPlaylistUpdaters( updaters ); +// setPlaylistUpdaters( updaters ); remove( "playlistupdaters" ); } @@ -948,33 +949,16 @@ TomahawkSettings::removePlaylistSettings( const QString& playlistid ) void -TomahawkSettings::setRepeatMode( const QString& playlistid, Tomahawk::PlaylistInterface::RepeatMode mode ) +TomahawkSettings::setRepeatMode( const QString& playlistid, Tomahawk::PlaylistModes::RepeatMode mode ) { setValue( QString( "ui/playlist/%1/repeatMode" ).arg( playlistid ), (int)mode ); } -Tomahawk::PlaylistInterface::RepeatMode +Tomahawk::PlaylistModes::RepeatMode TomahawkSettings::repeatMode( const QString& playlistid ) { - return (PlaylistInterface::RepeatMode)value( QString( "ui/playlist/%1/repeatMode" ).arg( playlistid )).toInt(); -} - - -QList -TomahawkSettings::recentlyPlayedPlaylists() const -{ - QStringList playlist_guids = value( "playlists/recentlyPlayed" ).toStringList(); - - QList playlists; - foreach( const QString& guid, playlist_guids ) - { - playlist_ptr pl = Playlist::load( guid ); - if ( !pl.isNull() ) - playlists << pl; - } - - return playlists; + return (PlaylistModes::RepeatMode)value( QString( "ui/playlist/%1/repeatMode" ).arg( playlistid )).toInt(); } @@ -991,16 +975,16 @@ TomahawkSettings::recentlyPlayedPlaylistGuids( unsigned int amount ) const void -TomahawkSettings::appendRecentlyPlayedPlaylist( const Tomahawk::playlist_ptr& playlist ) +TomahawkSettings::appendRecentlyPlayedPlaylist( const QString& playlistguid, int sourceId ) { QStringList playlist_guids = value( "playlists/recentlyPlayed" ).toStringList(); - playlist_guids.removeAll( playlist->guid() ); - playlist_guids.append( playlist->guid() ); + playlist_guids.removeAll( playlistguid ); + playlist_guids.append( playlistguid ); setValue( "playlists/recentlyPlayed", playlist_guids ); - emit recentlyPlayedPlaylistAdded( playlist ); + emit recentlyPlayedPlaylistAdded( playlistguid, sourceId ); } diff --git a/src/libtomahawk/TomahawkSettings.h b/src/libtomahawk/TomahawkSettings.h index 717da384d..3951e9ec3 100644 --- a/src/libtomahawk/TomahawkSettings.h +++ b/src/libtomahawk/TomahawkSettings.h @@ -1,7 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Christian Muehlhaeuser - * Copyright 2010-2011 Leo Franchi + * Copyright 2010-2012 Leo Franchi * Copyright 2010-2012, Jeff Mitchell * * Tomahawk is free software: you can redistribute it and/or modify @@ -21,14 +21,12 @@ #ifndef TOMAHAWK_SETTINGS_H #define TOMAHAWK_SETTINGS_H -#include "Playlist.h" - -#include "playlist/PlaylistUpdaterInterface.h" +#include "DllMacro.h" +#include "Typedefs.h" #include #include - -#include "DllMacro.h" +#include #define TOMAHAWK_SETTINGS_VERSION 12 @@ -87,14 +85,13 @@ public: QByteArray playlistColumnSizes( const QString& playlistid ) const; void setPlaylistColumnSizes( const QString& playlistid, const QByteArray& state ); - QList recentlyPlayedPlaylists() const; QStringList recentlyPlayedPlaylistGuids( unsigned int amount = 0 ) const; - void appendRecentlyPlayedPlaylist( const Tomahawk::playlist_ptr& playlist ); + void appendRecentlyPlayedPlaylist( const QString& playlistGuid, int sourceId ); bool shuffleState( const QString& playlistid ) const; void setShuffleState( const QString& playlistid, bool state ); - Tomahawk::PlaylistInterface::RepeatMode repeatMode( const QString& playlistid ); - void setRepeatMode( const QString& playlistid, Tomahawk::PlaylistInterface::RepeatMode mode ); + Tomahawk::PlaylistModes::RepeatMode repeatMode( const QString& playlistid ); + void setRepeatMode( const QString& playlistid, Tomahawk::PlaylistModes::RepeatMode mode ); // remove shuffle state and repeat state void removePlaylistSettings( const QString& playlistid ); @@ -207,7 +204,7 @@ public: signals: void changed(); - void recentlyPlayedPlaylistAdded( const Tomahawk::playlist_ptr& playlist ); + void recentlyPlayedPlaylistAdded( const QString& playlistId, int sourceId ); private slots: void updateIndex(); diff --git a/src/libtomahawk/Typedefs.h b/src/libtomahawk/Typedefs.h index 54e705e7c..e442f2328 100644 --- a/src/libtomahawk/Typedefs.h +++ b/src/libtomahawk/Typedefs.h @@ -77,6 +77,128 @@ namespace Tomahawk class ExternalResolver; typedef boost::function ResolverFactoryFunc; + namespace PlaylistModes { + enum RepeatMode { NoRepeat, RepeatOne, RepeatAll }; + enum ViewMode { Unknown, Tree, Flat, Album }; + enum SeekRestrictions { NoSeekRestrictions, NoSeek }; + enum SkipRestrictions { NoSkipRestrictions, NoSkipForwards, NoSkipBackwards, NoSkip }; + enum RetryMode { NoRetry, Retry }; + enum LatchMode { StayOnSong, RealTime }; + } + + + struct SerializedUpdater { + QString type; + QVariantHash customData; + + SerializedUpdater( const QString& t, const QVariantHash cd = QVariantHash() ) : type( t ), customData( cd ) {} + SerializedUpdater() {} + }; + + typedef QMultiHash< QString, SerializedUpdater > SerializedUpdaters; + typedef QList< SerializedUpdater > SerializedUpdaterList; + + + namespace InfoSystem { + + + enum InfoType { // as items are saved in cache, mark them here to not change them + InfoNoInfo = 0, //WARNING: *ALWAYS* keep this first! + InfoTrackID = 1, + InfoTrackArtist = 2, + InfoTrackAlbum = 3, + InfoTrackGenre = 4, + InfoTrackComposer = 5, + InfoTrackDate = 6, + InfoTrackNumber = 7, + InfoTrackDiscNumber = 8, + InfoTrackBitRate = 9, + InfoTrackLength = 10, + InfoTrackSampleRate = 11, + InfoTrackFileSize = 12, + InfoTrackBPM = 13, + InfoTrackReplayGain = 14, + InfoTrackReplayPeakGain = 15, + InfoTrackLyrics = 16, + InfoTrackLocation = 17, + InfoTrackProfile = 18, + InfoTrackEnergy = 19, + InfoTrackDanceability = 20, + InfoTrackTempo = 21, + InfoTrackLoudness = 22, + InfoTrackSimilars = 23, // cached -- do not change + + InfoArtistID = 25, + InfoArtistName = 26, + InfoArtistBiography = 27, + InfoArtistImages = 28, //cached -- do not change + InfoArtistBlog = 29, + InfoArtistFamiliarity = 30, + InfoArtistHotttness = 31, + InfoArtistSongs = 32, //cached -- do not change + InfoArtistSimilars = 33, //cached -- do not change + InfoArtistNews = 34, + InfoArtistProfile = 35, + InfoArtistReviews = 36, + InfoArtistTerms = 37, + InfoArtistLinks = 38, + InfoArtistVideos = 39, + InfoArtistReleases = 40, + + InfoAlbumID = 42, + InfoAlbumCoverArt = 43, //cached -- do not change + InfoAlbumName = 44, + InfoAlbumArtist = 45, + InfoAlbumDate = 46, + InfoAlbumGenre = 47, + InfoAlbumComposer = 48, + InfoAlbumSongs = 49, + + /** \var Tomahawk::InfoSystem::InfoType Tomahawk::InfoSystem::InfoType::InfoChartCapabilities + * Documentation for InfoChartCapabilities + * + * Clients of this InfoType expect a QVariant + * + */ + InfoChartCapabilities = 50, + /** + * Documentation for InfoChartArtists + */ + InfoChart = 51, + + InfoNewReleaseCapabilities = 52, + InfoNewRelease = 53, + + InfoMiscTopHotttness = 60, + InfoMiscTopTerms = 61, + + InfoSubmitNowPlaying = 70, + InfoSubmitScrobble = 71, + + InfoNowPlaying = 80, + InfoNowPaused = 81, + InfoNowResumed = 82, + InfoNowStopped = 83, + InfoTrackUnresolved = 84, + + InfoLove = 90, + InfoUnLove = 91, + InfoShareTrack = 92, + + InfoNotifyUser = 100, + + InfoLastInfo = 101 //WARNING: *ALWAYS* keep this last! + }; + + class InfoPlugin; + + typedef QMap< InfoType, QVariant > InfoTypeMap; + typedef QMap< InfoType, uint > InfoTimeoutMap; + typedef QHash< QString, QString > InfoStringHash; + typedef QPair< QVariantMap, QVariant > PushInfoPair; + + typedef QWeakPointer< InfoPlugin > InfoPluginPtr; + } }; // ns typedef int AudioErrorCode; diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index 1608141e5..245cfa333 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -79,7 +79,7 @@ ViewManager::ViewManager( QObject* parent ) , m_newReleasesWidget( new NewReleasesWidget() ) , m_topLovedWidget( 0 ) , m_recentPlaysWidget( 0 ) - , m_currentMode( PlaylistInterface::Tree ) + , m_currentMode( PlaylistModes::Tree ) , m_loaded( false ) { s_instance = this; @@ -282,7 +282,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection ) qDebug() << Q_FUNC_INFO << m_currentMode; m_currentCollection = collection; ViewPage* shown = 0; - if ( m_currentMode == PlaylistInterface::Flat ) + if ( m_currentMode == PlaylistModes::Flat ) { CollectionView* view; if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() ) @@ -306,7 +306,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection ) setPage( view ); } - if ( m_currentMode == PlaylistInterface::Tree ) + if ( m_currentMode == PlaylistModes::Tree ) { ArtistView* view; if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() ) @@ -330,7 +330,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection ) setPage( view ); } - if ( m_currentMode == PlaylistInterface::Album ) + if ( m_currentMode == PlaylistModes::Album ) { AlbumView* aview; if ( !m_collectionAlbumViews.contains( collection ) || m_collectionAlbumViews.value( collection ).isNull() ) @@ -407,17 +407,17 @@ ViewManager::showSuperCollection() m_superAlbumModel->setTitle( tr( "All available albums" ) ); ViewPage* shown = 0; - if ( m_currentMode == PlaylistInterface::Tree ) + if ( m_currentMode == PlaylistModes::Tree ) { shown = m_superCollectionView; setPage( m_superCollectionView ); } - else if ( m_currentMode == PlaylistInterface::Flat ) + else if ( m_currentMode == PlaylistModes::Flat ) { shown = m_superCollectionView; setPage( m_superCollectionView ); } - else if ( m_currentMode == PlaylistInterface::Album ) + else if ( m_currentMode == PlaylistModes::Album ) { shown = m_superAlbumView; setPage( m_superAlbumView ); @@ -435,13 +435,13 @@ ViewManager::playlistInterfaceChanged( Tomahawk::playlistinterface_ptr interface playlist_ptr pl = playlistForInterface( interface ); if ( !pl.isNull() ) { - TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( pl ); + TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( pl->guid(), pl->author()->id() ); } else { pl = dynamicPlaylistForInterface( interface ); if ( !pl.isNull() ) - TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( pl ); + TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( pl->guid(), pl->author()->id() ); } } @@ -516,7 +516,7 @@ ViewManager::setTableMode() { qDebug() << Q_FUNC_INFO; - m_currentMode = PlaylistInterface::Flat; + m_currentMode = PlaylistModes::Flat; if ( isSuperCollectionVisible() ) showSuperCollection(); @@ -530,7 +530,7 @@ ViewManager::setTreeMode() { qDebug() << Q_FUNC_INFO; - m_currentMode = PlaylistInterface::Tree; + m_currentMode = PlaylistModes::Tree; if ( isSuperCollectionVisible() ) showSuperCollection(); @@ -544,7 +544,7 @@ ViewManager::setAlbumMode() { qDebug() << Q_FUNC_INFO; - m_currentMode = PlaylistInterface::Album; + m_currentMode = PlaylistModes::Album; if ( isSuperCollectionVisible() ) showSuperCollection(); @@ -695,8 +695,8 @@ ViewManager::unlinkPlaylist() disconnect( currentPlaylistInterface().data(), SIGNAL( trackCountChanged( unsigned int ) ), this, SIGNAL( numShownChanged( unsigned int ) ) ); - disconnect( currentPlaylistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - this, SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); + disconnect( currentPlaylistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + this, SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); disconnect( currentPlaylistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ), this, SIGNAL( shuffleModeChanged( bool ) ) ); @@ -734,8 +734,8 @@ ViewManager::updateView() connect( currentPlaylistInterface().data(), SIGNAL( trackCountChanged( unsigned int ) ), SIGNAL( numShownChanged( unsigned int ) ) ); - connect( currentPlaylistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); + connect( currentPlaylistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); connect( currentPlaylistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ), SIGNAL( shuffleModeChanged( bool ) ) ); @@ -857,7 +857,7 @@ ViewManager::onWidgetDestroyed( QWidget* widget ) void -ViewManager::setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode mode ) +ViewManager::setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ) { if ( currentPlaylistInterface() ) currentPlaylistInterface()->setRepeatMode( mode ); @@ -1027,15 +1027,15 @@ ViewManager::showCurrentTrack() // reset the correct mode, if the user has changed it since if ( dynamic_cast< CollectionView* >( page ) ) - m_currentMode = PlaylistInterface::Flat; + m_currentMode = PlaylistModes::Flat; else if ( dynamic_cast< AlbumView* >( page ) ) - m_currentMode = PlaylistInterface::Album; + m_currentMode = PlaylistModes::Album; else if ( dynamic_cast< ArtistView* >( page ) ) - m_currentMode = PlaylistInterface::Tree; + m_currentMode = PlaylistModes::Tree; else return; - emit modeChanged( (PlaylistInterface::ViewMode)m_currentMode ); + emit modeChanged( (PlaylistModes::ViewMode)m_currentMode ); } } diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index d6e796363..2ac07447f 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -119,13 +119,13 @@ signals: void numArtistsChanged( unsigned int artists ); void numShownChanged( unsigned int shown ); - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void statsAvailable( bool b ); void modesAvailable( bool b ); void filterAvailable( bool b ); - void modeChanged( Tomahawk::PlaylistInterface::ViewMode mode ); + void modeChanged( Tomahawk::PlaylistModes::ViewMode mode ); void playClicked(); void pauseClicked(); @@ -169,7 +169,7 @@ public slots: void setTableMode(); void setAlbumMode(); - void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode mode ); + void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ); void setShuffled( bool enabled ); void playlistInterfaceChanged( Tomahawk::playlistinterface_ptr ); diff --git a/src/libtomahawk/ViewPage.cpp b/src/libtomahawk/ViewPage.cpp index 2a1733ba9..6ff2f7ccd 100644 --- a/src/libtomahawk/ViewPage.cpp +++ b/src/libtomahawk/ViewPage.cpp @@ -19,6 +19,7 @@ #include "ViewPage.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/accounts/Account.cpp b/src/libtomahawk/accounts/Account.cpp index b51d7eab1..7ab25d226 100644 --- a/src/libtomahawk/accounts/Account.cpp +++ b/src/libtomahawk/accounts/Account.cpp @@ -19,6 +19,8 @@ #include "Account.h" +#include "TomahawkSettings.h" + namespace Tomahawk { diff --git a/src/libtomahawk/accounts/Account.h b/src/libtomahawk/accounts/Account.h index 48aecefa6..6b8b35cb3 100644 --- a/src/libtomahawk/accounts/Account.h +++ b/src/libtomahawk/accounts/Account.h @@ -26,12 +26,12 @@ #include #include #include +#include #include "Typedefs.h" #include "DllMacro.h" -#include "TomahawkSettings.h" -#include "libtomahawk/infosystem/InfoSystem.h" +// #include "libtomahawk/infosystem/InfoSystem.h" class SipPlugin; diff --git a/src/libtomahawk/accounts/AccountManager.cpp b/src/libtomahawk/accounts/AccountManager.cpp index 1bacf9c30..39d04509b 100644 --- a/src/libtomahawk/accounts/AccountManager.cpp +++ b/src/libtomahawk/accounts/AccountManager.cpp @@ -20,6 +20,7 @@ #include "AccountManager.h" #include "config.h" #include "SourceList.h" +#include "TomahawkSettings.h" #include "ResolverAccount.h" #include diff --git a/src/libtomahawk/accounts/AccountModel.cpp b/src/libtomahawk/accounts/AccountModel.cpp index 677e9c3c6..b5783e54a 100644 --- a/src/libtomahawk/accounts/AccountModel.cpp +++ b/src/libtomahawk/accounts/AccountModel.cpp @@ -23,6 +23,7 @@ #include "AccountManager.h" #include "AtticaManager.h" #include "ResolverAccount.h" +#include "TomahawkSettings.h" #ifndef ENABLE_HEADLESS #include diff --git a/src/libtomahawk/accounts/AccountModel.h b/src/libtomahawk/accounts/AccountModel.h index e383b6ec6..41b39c6d3 100644 --- a/src/libtomahawk/accounts/AccountModel.h +++ b/src/libtomahawk/accounts/AccountModel.h @@ -24,6 +24,7 @@ #include "Account.h" #include +#include namespace Tomahawk { diff --git a/src/libtomahawk/accounts/ResolverAccount.cpp b/src/libtomahawk/accounts/ResolverAccount.cpp index 4446e94e3..799279df8 100644 --- a/src/libtomahawk/accounts/ResolverAccount.cpp +++ b/src/libtomahawk/accounts/ResolverAccount.cpp @@ -21,6 +21,9 @@ #include "ExternalResolver.h" #include "ExternalResolverGui.h" #include "AccountManager.h" +#include "TomahawkSettings.h" +#include "Source.h" + #include #include #include diff --git a/src/libtomahawk/audio/AudioEngine.cpp b/src/libtomahawk/audio/AudioEngine.cpp index 496efaeed..8029c4c5a 100644 --- a/src/libtomahawk/audio/AudioEngine.cpp +++ b/src/libtomahawk/audio/AudioEngine.cpp @@ -180,6 +180,7 @@ AudioEngine::stop() sendWaitingNotification(); Tomahawk::InfoSystem::InfoPushData pushData( s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant(), Tomahawk::InfoSystem::PushNoFlag ); + Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData ); } @@ -215,8 +216,8 @@ AudioEngine::canGoNext() if ( m_playlist.isNull() ) return false; - if ( m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkip || - m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipForwards ) + if ( m_playlist.data()->skipRestrictions() == PlaylistModes::NoSkip || + m_playlist.data()->skipRestrictions() == PlaylistModes::NoSkipForwards ) return false; if ( !m_currentTrack.isNull() && !m_playlist->hasNextItem() && @@ -238,8 +239,8 @@ AudioEngine::canGoPrevious() if ( m_playlist.isNull() ) return false; - if ( m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkip || - m_playlist.data()->skipRestrictions() == PlaylistInterface::NoSkipBackwards ) + if ( m_playlist.data()->skipRestrictions() == PlaylistModes::NoSkip || + m_playlist.data()->skipRestrictions() == PlaylistModes::NoSkipBackwards ) return false; return true; @@ -254,11 +255,10 @@ AudioEngine::canSeek() if ( m_mediaObject && m_mediaObject->isValid() ) phononCanSeek = m_mediaObject->isSeekable(); */ - if ( m_playlist.isNull() ) return phononCanSeek; - return !m_playlist.isNull() && ( m_playlist.data()->seekRestrictions() != PlaylistInterface::NoSeek ) && phononCanSeek; + return !m_playlist.isNull() && ( m_playlist.data()->seekRestrictions() != PlaylistModes::NoSeek ) && phononCanSeek; } @@ -345,7 +345,7 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type ) m_currentTrack->track().isNull() || m_currentTrack->artist().isNull() ) return; - + QVariantMap playInfo; if ( !m_currentTrack->album().isNull() ) @@ -388,7 +388,7 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type ) playInfo["trackinfo"] = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ); playInfo["private"] = TomahawkSettings::instance()->privateListeningMode(); - + Tomahawk::InfoSystem::InfoPushData pushData ( s_aeInfoIdentifier, type, playInfo, Tomahawk::InfoSystem::PushShortUrlFlag ); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "pushing data with type " << type; @@ -474,7 +474,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result ) DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_currentTrack, DatabaseCommand_LogPlayback::Started ); Database::instance()->enqueue( QSharedPointer(cmd) ); } - + sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowPlaying ); } } @@ -545,7 +545,7 @@ AudioEngine::loadNextTrack() } else { - if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistInterface::Retry ) + if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry ) m_waitingOnNewTrack = true; stop(); @@ -568,7 +568,7 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk: { loadTrack( result ); } - else if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == PlaylistInterface::Retry ) + else if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == PlaylistModes::Retry ) { m_waitingOnNewTrack = true; if ( isStopped() ) @@ -631,7 +631,7 @@ void AudioEngine::onPlaylistNextTrackReady() { // If in real-time and you have a few seconds left, you're probably lagging -- finish it up - if ( m_playlist && m_playlist->latchMode() == PlaylistInterface::RealTime && ( m_waitingOnNewTrack || m_currentTrack.isNull() || m_currentTrack->id() == 0 || ( currentTrackTotalTime() - currentTime() > 6000 ) ) ) + if ( m_playlist && m_playlist->latchMode() == PlaylistModes::RealTime && ( m_waitingOnNewTrack || m_currentTrack.isNull() || m_currentTrack->id() == 0 || ( currentTrackTotalTime() - currentTime() > 6000 ) ) ) { m_waitingOnNewTrack = false; loadNextTrack(); @@ -701,7 +701,7 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState ) loadNextTrack(); else { - if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistInterface::Retry ) + if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry ) m_waitingOnNewTrack = true; stop(); } @@ -743,7 +743,7 @@ AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist ) if ( !m_playlist.isNull() ) { - if ( m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry ) + if ( m_playlist.data() && m_playlist.data()->retryMode() == PlaylistModes::Retry ) disconnect( m_playlist.data(), SIGNAL( nextTrackReady() ) ); m_playlist.data()->reset(); } @@ -754,11 +754,11 @@ AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist ) emit playlistChanged( playlist ); return; } - + m_playlist = playlist; m_stopAfterTrack.clear(); - if ( !m_playlist.isNull() && m_playlist.data() && m_playlist.data()->retryMode() == PlaylistInterface::Retry ) + if ( !m_playlist.isNull() && m_playlist.data() && m_playlist.data()->retryMode() == PlaylistModes::Retry ) connect( m_playlist.data(), SIGNAL( nextTrackReady() ), SLOT( onPlaylistNextTrackReady() ) ); emit playlistChanged( playlist ); @@ -772,7 +772,7 @@ AudioEngine::setStopAfterTrack( const query_ptr& query ) { m_stopAfterTrack = query; emit stopAfterTrack_changed(); - } + } } diff --git a/src/libtomahawk/audio/AudioEngine.h b/src/libtomahawk/audio/AudioEngine.h index dc17b4871..e991e7728 100644 --- a/src/libtomahawk/audio/AudioEngine.h +++ b/src/libtomahawk/audio/AudioEngine.h @@ -66,7 +66,7 @@ public: Tomahawk::playlistinterface_ptr playlist() const { return m_playlist; } Tomahawk::result_ptr currentTrack() const { return m_currentTrack; } - + Tomahawk::query_ptr stopAfterTrack() const { return m_stopAfterTrack; } qint64 currentTime() const { return m_mediaObject->currentTime(); } @@ -98,7 +98,7 @@ public slots: void playItem( const Tomahawk::album_ptr& album ); void setPlaylist( Tomahawk::playlistinterface_ptr playlist ); void setQueue( Tomahawk::playlistinterface_ptr queue ) { m_queue = queue; } - + void setStopAfterTrack( const Tomahawk::query_ptr& query ); signals: @@ -108,7 +108,7 @@ signals: void stopped(); void paused(); void resumed(); - + void stopAfterTrack_changed(); void seeked( qint64 ms ); diff --git a/src/libtomahawk/context/ContextWidget.cpp b/src/libtomahawk/context/ContextWidget.cpp index 14f70504a..ce6b69a05 100644 --- a/src/libtomahawk/context/ContextWidget.cpp +++ b/src/libtomahawk/context/ContextWidget.cpp @@ -31,6 +31,7 @@ #include "playlist/ArtistView.h" #include "playlist/TreeModel.h" +#include "Source.h" #include "utils/StyleHelper.h" #include "utils/TomahawkUtilsGui.h" diff --git a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp index 628d47eb0..23f54d2f4 100644 --- a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp +++ b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp @@ -23,6 +23,7 @@ #include "playlist/ArtistView.h" #include "playlist/TreeModel.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/context/pages/TopTracksContext.cpp b/src/libtomahawk/context/pages/TopTracksContext.cpp index 12b8366a8..1b1c40d92 100644 --- a/src/libtomahawk/context/pages/TopTracksContext.cpp +++ b/src/libtomahawk/context/pages/TopTracksContext.cpp @@ -22,6 +22,7 @@ #include "playlist/PlaylistModel.h" #include "playlist/PlaylistView.h" #include "playlist/TrackHeader.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/context/pages/WebContext.cpp b/src/libtomahawk/context/pages/WebContext.cpp index 807bd5775..e9a93a22d 100644 --- a/src/libtomahawk/context/pages/WebContext.cpp +++ b/src/libtomahawk/context/pages/WebContext.cpp @@ -17,6 +17,7 @@ */ #include "WebContext.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/context/pages/WikipediaContext.cpp b/src/libtomahawk/context/pages/WikipediaContext.cpp index 3e89fe5b5..4da16410c 100644 --- a/src/libtomahawk/context/pages/WikipediaContext.cpp +++ b/src/libtomahawk/context/pages/WikipediaContext.cpp @@ -17,6 +17,7 @@ */ #include "WikipediaContext.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/database/Database.cpp b/src/libtomahawk/database/Database.cpp index 2dd9e0ac0..8ed84597f 100644 --- a/src/libtomahawk/database/Database.cpp +++ b/src/libtomahawk/database/Database.cpp @@ -23,6 +23,7 @@ #include "DatabaseImpl.h" #include "DatabaseWorker.h" #include "utils/Logger.h" +#include "Source.h" #define DEFAULT_WORKER_THREADS 4 #define MAX_WORKER_THREADS 16 diff --git a/src/libtomahawk/database/DatabaseCommand_AddClientAuth.cpp b/src/libtomahawk/database/DatabaseCommand_AddClientAuth.cpp index 43c4c5e8f..31b6200e7 100644 --- a/src/libtomahawk/database/DatabaseCommand_AddClientAuth.cpp +++ b/src/libtomahawk/database/DatabaseCommand_AddClientAuth.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2011, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include "DatabaseImpl.h" #include "TomahawkSqlQuery.h" #include "utils/Logger.h" +#include "Source.h" DatabaseCommand_AddClientAuth::DatabaseCommand_AddClientAuth( const QString& clientToken, diff --git a/src/libtomahawk/database/DatabaseCommand_AddSource.cpp b/src/libtomahawk/database/DatabaseCommand_AddSource.cpp index 36a7e9ea7..75056f859 100644 --- a/src/libtomahawk/database/DatabaseCommand_AddSource.cpp +++ b/src/libtomahawk/database/DatabaseCommand_AddSource.cpp @@ -22,6 +22,7 @@ #include "DatabaseImpl.h" #include "utils/Logger.h" +#include "Source.h" DatabaseCommand_addSource::DatabaseCommand_addSource( const QString& username, const QString& fname, QObject* parent ) diff --git a/src/libtomahawk/database/DatabaseCommand_ClientAuthValid.cpp b/src/libtomahawk/database/DatabaseCommand_ClientAuthValid.cpp index 7571b1fd5..1a83a9369 100644 --- a/src/libtomahawk/database/DatabaseCommand_ClientAuthValid.cpp +++ b/src/libtomahawk/database/DatabaseCommand_ClientAuthValid.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2011, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include "DatabaseImpl.h" #include "TomahawkSqlQuery.h" #include "utils/Logger.h" +#include "Source.h" DatabaseCommand_ClientAuthValid::DatabaseCommand_ClientAuthValid( const QString& clientToken, QObject* parent ) diff --git a/src/libtomahawk/database/DatabaseCommand_DirMtimes.cpp b/src/libtomahawk/database/DatabaseCommand_DirMtimes.cpp index ae9ba13a4..6829acc6b 100644 --- a/src/libtomahawk/database/DatabaseCommand_DirMtimes.cpp +++ b/src/libtomahawk/database/DatabaseCommand_DirMtimes.cpp @@ -23,6 +23,7 @@ #include "DatabaseImpl.h" #include "utils/Logger.h" +#include "Source.h" void diff --git a/src/libtomahawk/database/DatabaseCommand_FileMTimes.cpp b/src/libtomahawk/database/DatabaseCommand_FileMTimes.cpp index b314723c7..706fbb65d 100644 --- a/src/libtomahawk/database/DatabaseCommand_FileMTimes.cpp +++ b/src/libtomahawk/database/DatabaseCommand_FileMTimes.cpp @@ -23,6 +23,7 @@ #include "DatabaseImpl.h" #include "utils/Logger.h" +#include "Source.h" void diff --git a/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylist.cpp b/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylist.cpp index 4deb3b93b..f0444ae01 100644 --- a/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylist.cpp +++ b/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylist.cpp @@ -24,6 +24,7 @@ #include "Source.h" #include "dynamic/DynamicPlaylist.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylistEntries.cpp b/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylistEntries.cpp index 29f6eeff7..985b22c67 100644 --- a/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylistEntries.cpp +++ b/src/libtomahawk/database/DatabaseCommand_LoadDynamicPlaylistEntries.cpp @@ -28,6 +28,7 @@ #include "dynamic/GeneratorFactory.h" #include "qjson/parser.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/database/DatabaseCommand_LoadFiles.cpp b/src/libtomahawk/database/DatabaseCommand_LoadFiles.cpp index 52e8ed547..24a89ff23 100644 --- a/src/libtomahawk/database/DatabaseCommand_LoadFiles.cpp +++ b/src/libtomahawk/database/DatabaseCommand_LoadFiles.cpp @@ -21,6 +21,7 @@ #include "DatabaseImpl.h" #include "Collection.h" #include "utils/Logger.h" +#include "Source.h" DatabaseCommand_LoadFiles::DatabaseCommand_LoadFiles( unsigned int id, QObject* parent ) diff --git a/src/libtomahawk/database/DatabaseCommand_LoadPlaylistEntries.cpp b/src/libtomahawk/database/DatabaseCommand_LoadPlaylistEntries.cpp index 6d2f997a0..89a4941b1 100644 --- a/src/libtomahawk/database/DatabaseCommand_LoadPlaylistEntries.cpp +++ b/src/libtomahawk/database/DatabaseCommand_LoadPlaylistEntries.cpp @@ -24,6 +24,7 @@ #include "Query.h" #include "qjson/parser.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/database/DatabaseCommand_ModifyPlaylist.cpp b/src/libtomahawk/database/DatabaseCommand_ModifyPlaylist.cpp index 1a5a34ea3..eb6018f93 100644 --- a/src/libtomahawk/database/DatabaseCommand_ModifyPlaylist.cpp +++ b/src/libtomahawk/database/DatabaseCommand_ModifyPlaylist.cpp @@ -21,6 +21,7 @@ #include "utils/Logger.h" #include "Playlist.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/database/DatabaseCommand_SetTrackAttributes.cpp b/src/libtomahawk/database/DatabaseCommand_SetTrackAttributes.cpp index c7009b0d3..d952c0372 100644 --- a/src/libtomahawk/database/DatabaseCommand_SetTrackAttributes.cpp +++ b/src/libtomahawk/database/DatabaseCommand_SetTrackAttributes.cpp @@ -19,6 +19,7 @@ #include "DatabaseCommand_SetTrackAttributes.h" #include "TomahawkSqlQuery.h" #include "DatabaseImpl.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/database/DatabaseCommand_SourceOffline.cpp b/src/libtomahawk/database/DatabaseCommand_SourceOffline.cpp index f8eb6e902..ed2edf7b0 100644 --- a/src/libtomahawk/database/DatabaseCommand_SourceOffline.cpp +++ b/src/libtomahawk/database/DatabaseCommand_SourceOffline.cpp @@ -21,6 +21,7 @@ #include "DatabaseImpl.h" #include "TomahawkSqlQuery.h" #include "utils/Logger.h" +#include "Source.h" DatabaseCommand_SourceOffline::DatabaseCommand_SourceOffline( int id ) diff --git a/src/libtomahawk/database/DatabaseCommand_TrackAttributes.cpp b/src/libtomahawk/database/DatabaseCommand_TrackAttributes.cpp index 82719a42b..b41e55fe4 100644 --- a/src/libtomahawk/database/DatabaseCommand_TrackAttributes.cpp +++ b/src/libtomahawk/database/DatabaseCommand_TrackAttributes.cpp @@ -18,6 +18,7 @@ #include "DatabaseCommand_TrackAttributes.h" #include "DatabaseImpl.h" +#include "Source.h" using namespace Tomahawk; DatabaseCommand_TrackAttributes::DatabaseCommand_TrackAttributes( DatabaseCommand_SetTrackAttributes::AttributeType type, const QList< Tomahawk::QID > ids ) diff --git a/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp b/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp index 1c11d1c1b..e0bc3558a 100644 --- a/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp +++ b/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2012 Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +25,7 @@ #include "jobview/IndexingJobItem.h" #include "jobview/JobStatusView.h" #include "jobview/JobStatusModel.h" +#include "Source.h" #include diff --git a/src/libtomahawk/database/DatabaseResolver.cpp b/src/libtomahawk/database/DatabaseResolver.cpp index 2825c4851..dcdd3816a 100644 --- a/src/libtomahawk/database/DatabaseResolver.cpp +++ b/src/libtomahawk/database/DatabaseResolver.cpp @@ -22,6 +22,7 @@ #include "network/Servent.h" #include "database/Database.h" #include "database/DatabaseCommand_Resolve.h" +#include "Source.h" #include "utils/Logger.h" diff --git a/src/libtomahawk/database/FuzzyIndex.cpp b/src/libtomahawk/database/FuzzyIndex.cpp index a77ac8801..0a26de604 100644 --- a/src/libtomahawk/database/FuzzyIndex.cpp +++ b/src/libtomahawk/database/FuzzyIndex.cpp @@ -27,6 +27,7 @@ #include "DatabaseImpl.h" #include "utils/TomahawkUtils.h" #include "utils/Logger.h" +#include "Source.h" using namespace lucene::analysis; using namespace lucene::analysis::standard; @@ -198,7 +199,7 @@ FuzzyIndex::search( const Tomahawk::query_ptr& query ) if ( query->isFullTextQuery() ) { QString escapedQuery = QString::fromWCharArray( parser.escape( DatabaseImpl::sortname( query->fullTextQuery() ).toStdWString().c_str() ) ); - + Term* term = _CLNEW Term( _T( "track" ), escapedQuery.toStdWString().c_str() ); Query* fqry = _CLNEW FuzzyQuery( term ); qry->add( fqry, true, BooleanClause::SHOULD ); diff --git a/src/libtomahawk/infosystem/InfoSystem.cpp b/src/libtomahawk/infosystem/InfoSystem.cpp index 925091b56..b72adeee0 100644 --- a/src/libtomahawk/infosystem/InfoSystem.cpp +++ b/src/libtomahawk/infosystem/InfoSystem.cpp @@ -26,6 +26,7 @@ #include "InfoSystemWorker.h" #include "utils/TomahawkUtils.h" #include "utils/Logger.h" +#include "Source.h" namespace Tomahawk { @@ -224,7 +225,7 @@ InfoSystem::addInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin ) tDebug() << Q_FUNC_INFO << "Given plugin is null!"; return; } - + if ( plugin.data()->thread() != m_infoSystemWorkerThreadController->worker()->thread() ) { Q_ASSERT( false ); diff --git a/src/libtomahawk/infosystem/InfoSystem.h b/src/libtomahawk/infosystem/InfoSystem.h index 2ec1429f4..73033f69e 100644 --- a/src/libtomahawk/infosystem/InfoSystem.h +++ b/src/libtomahawk/infosystem/InfoSystem.h @@ -34,6 +34,7 @@ #include "DllMacro.h" #include "utils/TomahawkUtils.h" +#include "Typedefs.h" class QNetworkAccessManager; @@ -49,100 +50,6 @@ enum PushInfoFlags { // must be powers of 2 PushShortUrlFlag = 2 }; -enum InfoType { // as items are saved in cache, mark them here to not change them - InfoNoInfo = 0, //WARNING: *ALWAYS* keep this first! - InfoTrackID = 1, - InfoTrackArtist = 2, - InfoTrackAlbum = 3, - InfoTrackGenre = 4, - InfoTrackComposer = 5, - InfoTrackDate = 6, - InfoTrackNumber = 7, - InfoTrackDiscNumber = 8, - InfoTrackBitRate = 9, - InfoTrackLength = 10, - InfoTrackSampleRate = 11, - InfoTrackFileSize = 12, - InfoTrackBPM = 13, - InfoTrackReplayGain = 14, - InfoTrackReplayPeakGain = 15, - InfoTrackLyrics = 16, - InfoTrackLocation = 17, - InfoTrackProfile = 18, - InfoTrackEnergy = 19, - InfoTrackDanceability = 20, - InfoTrackTempo = 21, - InfoTrackLoudness = 22, - InfoTrackSimilars = 23, // cached -- do not change - - InfoArtistID = 25, - InfoArtistName = 26, - InfoArtistBiography = 27, - InfoArtistImages = 28, //cached -- do not change - InfoArtistBlog = 29, - InfoArtistFamiliarity = 30, - InfoArtistHotttness = 31, - InfoArtistSongs = 32, //cached -- do not change - InfoArtistSimilars = 33, //cached -- do not change - InfoArtistNews = 34, - InfoArtistProfile = 35, - InfoArtistReviews = 36, - InfoArtistTerms = 37, - InfoArtistLinks = 38, - InfoArtistVideos = 39, - InfoArtistReleases = 40, - - InfoAlbumID = 42, - InfoAlbumCoverArt = 43, //cached -- do not change - InfoAlbumName = 44, - InfoAlbumArtist = 45, - InfoAlbumDate = 46, - InfoAlbumGenre = 47, - InfoAlbumComposer = 48, - InfoAlbumSongs = 49, - -/** \var Tomahawk::InfoSystem::InfoType Tomahawk::InfoSystem::InfoType::InfoChartCapabilities - * Documentation for InfoChartCapabilities - * - * Clients of this InfoType expect a QVariant - * - */ - InfoChartCapabilities = 50, - /** - * Documentation for InfoChartArtists - */ - InfoChart = 51, - - InfoNewReleaseCapabilities = 52, - InfoNewRelease = 53, - - InfoMiscTopHotttness = 60, - InfoMiscTopTerms = 61, - - InfoSubmitNowPlaying = 70, - InfoSubmitScrobble = 71, - - InfoNowPlaying = 80, - InfoNowPaused = 81, - InfoNowResumed = 82, - InfoNowStopped = 83, - InfoTrackUnresolved = 84, - - InfoLove = 90, - InfoUnLove = 91, - InfoShareTrack = 92, - - InfoNotifyUser = 100, - - InfoLastInfo = 101 //WARNING: *ALWAYS* keep this last! -}; - - -typedef QMap< InfoType, QVariant > InfoTypeMap; -typedef QMap< InfoType, uint > InfoTimeoutMap; -typedef QHash< QString, QString > InfoStringHash; -typedef QPair< QVariantMap, QVariant > PushInfoPair; - struct InfoRequestData { quint64 requestId; @@ -237,8 +144,6 @@ private: }; -typedef QWeakPointer< InfoPlugin > InfoPluginPtr; - class InfoSystemCacheThread : public QThread { Q_OBJECT diff --git a/src/libtomahawk/infosystem/InfoSystemCache.cpp b/src/libtomahawk/infosystem/InfoSystemCache.cpp index 6fb4837e9..184783cb2 100644 --- a/src/libtomahawk/infosystem/InfoSystemCache.cpp +++ b/src/libtomahawk/infosystem/InfoSystemCache.cpp @@ -19,9 +19,6 @@ #include -#include -#include -#include #ifndef ENABLE_HEADLESS #include @@ -30,7 +27,11 @@ #include "InfoSystemCache.h" #include "TomahawkSettings.h" #include "utils/Logger.h" +#include "Source.h" +#include +#include +#include namespace Tomahawk { diff --git a/src/libtomahawk/infosystem/InfoSystemWorker.cpp b/src/libtomahawk/infosystem/InfoSystemWorker.cpp index 85528b113..d80e3c594 100644 --- a/src/libtomahawk/infosystem/InfoSystemWorker.cpp +++ b/src/libtomahawk/infosystem/InfoSystemWorker.cpp @@ -18,6 +18,17 @@ * along with Tomahawk. If not, see . */ +#include "InfoSystemWorker.h" + +#include "config.h" +#include "HeadlessCheck.h" +#include "InfoSystemCache.h" +#include "GlobalActionManager.h" +#include "utils/TomahawkUtils.h" +#include "utils/Logger.h" +#include "Source.h" + + #include #include #include @@ -25,14 +36,6 @@ #include #include -#include "config.h" -#include "HeadlessCheck.h" -#include "InfoSystemWorker.h" -#include "InfoSystemCache.h" -#include "GlobalActionManager.h" -#include "utils/TomahawkUtils.h" -#include "utils/Logger.h" - namespace Tomahawk { @@ -92,7 +95,7 @@ InfoSystemWorker::addInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin ) tDebug() << Q_FUNC_INFO << "passed-in plugin is null"; return; } - + m_plugins.append( plugin ); registerInfoTypes( plugin, plugin.data()->supportedGetTypes(), plugin.data()->supportedPushTypes() ); @@ -131,12 +134,12 @@ InfoSystemWorker::removeInfoPlugin( Tomahawk::InfoSystem::InfoPluginPtr plugin ) tDebug() << Q_FUNC_INFO << "passed-in plugin is null"; return; } - + foreach ( InfoPluginPtr ptr, m_plugins ) { if ( ptr == plugin ) break; - + tDebug() << Q_FUNC_INFO << "This plugin does not exist in the infosystem."; return; } @@ -196,12 +199,12 @@ InfoSystemWorker::loadInfoPlugins( const QStringList& pluginPaths ) if ( pluginPaths.isEmpty() ) return; - + foreach ( const QString fileName, pluginPaths ) { if ( !QLibrary::isLibrary( fileName ) ) continue; - + tDebug() << Q_FUNC_INFO << "Trying to load plugin:" << fileName; QPluginLoader loader( fileName ); @@ -334,7 +337,7 @@ InfoSystemWorker::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) } tDebug() << Q_FUNC_INFO << "number of matching plugins: " << m_infoPushMap[ pushData.type ].size(); - + Q_FOREACH( InfoPluginPtr ptr, m_infoPushMap[ pushData.type ] ) { if( ptr ) diff --git a/src/libtomahawk/jobview/AclJobItem.cpp b/src/libtomahawk/jobview/AclJobItem.cpp index 45793cbf1..3e67e4ff8 100644 --- a/src/libtomahawk/jobview/AclJobItem.cpp +++ b/src/libtomahawk/jobview/AclJobItem.cpp @@ -21,6 +21,7 @@ #include "JobStatusModel.h" #include "utils/TomahawkUtils.h" +#include "utils/Logger.h" #include #include @@ -61,13 +62,13 @@ AclJobDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co else mainText = QString( tr( "Allow %1 to\nconnect and stream from you?" ) ).arg( item->username() ); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Displaying text:" << mainText; - + const QString text = QString( tr( "Allow %1 to\nconnect and stream from you?" ) ).arg( item->username() ); const int w = fm.width( text ); const QRect rRect( opt.rect.left() + PADDING, ROW_HEIGHT + PADDING, opt.rect.width() - 2*PADDING, opt.rect.height() - 2*PADDING ); painter->drawText( rRect, Qt::AlignCenter, text ); - + /* QStyleOptionViewItemV4 opt = option; initStyleOption( &opt, index ); diff --git a/src/libtomahawk/jobview/JobStatusView.cpp b/src/libtomahawk/jobview/JobStatusView.cpp index 204ae9182..59f823bf1 100644 --- a/src/libtomahawk/jobview/JobStatusView.cpp +++ b/src/libtomahawk/jobview/JobStatusView.cpp @@ -27,6 +27,7 @@ #include "TransferStatusItem.h" #include "LatchedStatusItem.h" #include "utils/Logger.h" +#include "Source.h" #include #include diff --git a/src/libtomahawk/jobview/PipelineStatusItem.cpp b/src/libtomahawk/jobview/PipelineStatusItem.cpp index 39c8d04b3..779287789 100644 --- a/src/libtomahawk/jobview/PipelineStatusItem.cpp +++ b/src/libtomahawk/jobview/PipelineStatusItem.cpp @@ -25,6 +25,7 @@ #include "TomahawkApp.h" #include "JobStatusModel.h" #include "JobStatusView.h" +#include "Source.h" PipelineStatusItem::PipelineStatusItem() diff --git a/src/libtomahawk/network/Connection.cpp b/src/libtomahawk/network/Connection.cpp index 78ec3fef2..286965d88 100644 --- a/src/libtomahawk/network/Connection.cpp +++ b/src/libtomahawk/network/Connection.cpp @@ -19,11 +19,12 @@ #include "Connection.h" -#include -#include - #include "network/Servent.h" #include "utils/Logger.h" +#include "Source.h" + +#include +#include #define PROTOVER "4" // must match remote peer, or we can't talk. diff --git a/src/libtomahawk/network/PortFwdThread.cpp b/src/libtomahawk/network/PortFwdThread.cpp index fe02655b6..0da9a7b8e 100644 --- a/src/libtomahawk/network/PortFwdThread.cpp +++ b/src/libtomahawk/network/PortFwdThread.cpp @@ -19,14 +19,15 @@ #include "PortFwdThread.h" #include "HeadlessCheck.h" +#include "portfwd/portfwd.h" +#include "utils/Logger.h" +#include "Source.h" #include #include #include #include -#include "portfwd/portfwd.h" -#include "utils/Logger.h" PortFwdThread::PortFwdThread( unsigned int port ) diff --git a/src/libtomahawk/playlist/AlbumItem.cpp b/src/libtomahawk/playlist/AlbumItem.cpp index d97b222bf..864292f59 100644 --- a/src/libtomahawk/playlist/AlbumItem.cpp +++ b/src/libtomahawk/playlist/AlbumItem.cpp @@ -20,6 +20,7 @@ #include "utils/TomahawkUtils.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/AlbumItemDelegate.cpp b/src/libtomahawk/playlist/AlbumItemDelegate.cpp index cee016de9..5035a8ea0 100644 --- a/src/libtomahawk/playlist/AlbumItemDelegate.cpp +++ b/src/libtomahawk/playlist/AlbumItemDelegate.cpp @@ -27,6 +27,8 @@ #include "Artist.h" #include "Query.h" #include "Result.h" +#include "Source.h" +#include "audio/AudioEngine.h" #include "utils/TomahawkUtils.h" #include "utils/Logger.h" @@ -105,7 +107,7 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, if ( !item->album().isNull() ) { top = item->album()->name(); - + if ( !item->album()->artist().isNull() ) bottom = item->album()->artist()->name(); } diff --git a/src/libtomahawk/playlist/AlbumModel.h b/src/libtomahawk/playlist/AlbumModel.h index 3a1d80437..2f8d3c7d3 100644 --- a/src/libtomahawk/playlist/AlbumModel.h +++ b/src/libtomahawk/playlist/AlbumModel.h @@ -89,7 +89,7 @@ public: } public slots: - virtual void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode /*mode*/ ) {} + virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode /*mode*/ ) {} virtual void setShuffled( bool /*shuffled*/ ) {} void addAlbums( const QList& albums ); @@ -97,7 +97,7 @@ public slots: void addQueries( const QList& queries ); signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void itemCountChanged( unsigned int items ); diff --git a/src/libtomahawk/playlist/AlbumProxyModel.cpp b/src/libtomahawk/playlist/AlbumProxyModel.cpp index b7d3d8f4f..ff841df7b 100644 --- a/src/libtomahawk/playlist/AlbumProxyModel.cpp +++ b/src/libtomahawk/playlist/AlbumProxyModel.cpp @@ -25,6 +25,7 @@ #include "Artist.h" #include "AlbumItem.h" #include "Query.h" +#include "Source.h" #include "utils/Logger.h" diff --git a/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.cpp index 141d44021..d96e1e311 100644 --- a/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.cpp @@ -23,6 +23,7 @@ #include "Artist.h" #include "AlbumItem.h" #include "Query.h" +#include "Source.h" #include "utils/Logger.h" using namespace Tomahawk; @@ -30,7 +31,7 @@ using namespace Tomahawk; AlbumProxyModelPlaylistInterface::AlbumProxyModelPlaylistInterface( AlbumProxyModel *proxyModel ) : Tomahawk::PlaylistInterface() , m_proxyModel( proxyModel ) - , m_repeatMode( PlaylistInterface::NoRepeat ) + , m_repeatMode( PlaylistModes::NoRepeat ) , m_shuffled( false ) { } diff --git a/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.h b/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.h index 9cf5e9179..c04791306 100644 --- a/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.h +++ b/src/libtomahawk/playlist/AlbumProxyModelPlaylistInterface.h @@ -50,12 +50,12 @@ public: virtual QString filter() const; virtual void setFilter( const QString& pattern ); - virtual Tomahawk::PlaylistInterface::RepeatMode repeatMode() const { return m_repeatMode; } + virtual Tomahawk::PlaylistModes::RepeatMode repeatMode() const { return m_repeatMode; } virtual bool shuffled() const { return m_shuffled; } - virtual Tomahawk::PlaylistInterface::ViewMode viewMode() const { return Tomahawk::PlaylistInterface::Album; } + virtual Tomahawk::PlaylistModes::ViewMode viewMode() const { return Tomahawk::PlaylistModes::Album; } signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void trackCountChanged( unsigned int tracks ); @@ -64,12 +64,12 @@ signals: void nextTrackReady(); public slots: - virtual void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); } + virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); } virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); } private: QWeakPointer< AlbumProxyModel > m_proxyModel; - RepeatMode m_repeatMode; + PlaylistModes::RepeatMode m_repeatMode; bool m_shuffled; }; diff --git a/src/libtomahawk/playlist/CollectionFlatModel.h b/src/libtomahawk/playlist/CollectionFlatModel.h index a93d2f39d..f09365a08 100644 --- a/src/libtomahawk/playlist/CollectionFlatModel.h +++ b/src/libtomahawk/playlist/CollectionFlatModel.h @@ -51,7 +51,7 @@ public: void addFilteredCollection( const Tomahawk::collection_ptr& collection, unsigned int amount, DatabaseCommand_AllTracks::SortOrder order ); signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void loadingStarted(); diff --git a/src/libtomahawk/playlist/CollectionProxyModel.cpp b/src/libtomahawk/playlist/CollectionProxyModel.cpp index 483b95dcb..9d8c5dbc4 100644 --- a/src/libtomahawk/playlist/CollectionProxyModel.cpp +++ b/src/libtomahawk/playlist/CollectionProxyModel.cpp @@ -26,6 +26,7 @@ #include "Album.h" #include "Query.h" #include "utils/Logger.h" +#include "Source.h" CollectionProxyModel::CollectionProxyModel( QObject* parent ) diff --git a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp index b3e0cad67..3676c43e7 100644 --- a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.cpp @@ -22,6 +22,7 @@ #include "CollectionProxyModel.h" #include "Album.h" #include "Query.h" +#include "Source.h" #include "utils/Logger.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h index 1cf5ac727..705ce9bfb 100644 --- a/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h +++ b/src/libtomahawk/playlist/CollectionProxyModelPlaylistInterface.h @@ -38,7 +38,7 @@ public: explicit CollectionProxyModelPlaylistInterface( CollectionProxyModel* proxyModel ); virtual ~CollectionProxyModelPlaylistInterface(); - virtual PlaylistInterface::ViewMode viewMode() const { return PlaylistInterface::Flat; } + virtual PlaylistModes::ViewMode viewMode() const { return PlaylistModes::Flat; } }; } //ns diff --git a/src/libtomahawk/playlist/CollectionView.cpp b/src/libtomahawk/playlist/CollectionView.cpp index a9572682d..3243c86ed 100644 --- a/src/libtomahawk/playlist/CollectionView.cpp +++ b/src/libtomahawk/playlist/CollectionView.cpp @@ -26,6 +26,7 @@ #include "TrackModel.h" #include "widgets/OverlayWidget.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/PlaylistModel.h b/src/libtomahawk/playlist/PlaylistModel.h index 2e5b0a79b..63c538889 100644 --- a/src/libtomahawk/playlist/PlaylistModel.h +++ b/src/libtomahawk/playlist/PlaylistModel.h @@ -74,7 +74,7 @@ public slots: virtual void remove( const QList& indexes ); signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void playlistDeleted(); void playlistChanged(); diff --git a/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp b/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp index 74be0b520..1f8253431 100644 --- a/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp +++ b/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp @@ -18,6 +18,7 @@ #include "PlaylistUpdaterInterface.h" #include "TomahawkSettings.h" +#include "Source.h" namespace Tomahawk { diff --git a/src/libtomahawk/playlist/PlaylistUpdaterInterface.h b/src/libtomahawk/playlist/PlaylistUpdaterInterface.h index 22bf0a566..b05621995 100644 --- a/src/libtomahawk/playlist/PlaylistUpdaterInterface.h +++ b/src/libtomahawk/playlist/PlaylistUpdaterInterface.h @@ -40,16 +40,7 @@ namespace Tomahawk class PlaylistUpdaterFactory; // used when loading/saving from settings -struct SerializedUpdater { - QString type; - QVariantHash customData; - SerializedUpdater( const QString& t, const QVariantHash cd = QVariantHash() ) : type( t ), customData( cd ) {} - SerializedUpdater() {} -}; - -typedef QMultiHash< QString, SerializedUpdater > SerializedUpdaters; -typedef QList< SerializedUpdater > SerializedUpdaterList; class DLLEXPORT PlaylistUpdaterInterface : public QObject { diff --git a/src/libtomahawk/playlist/QueueProxyModel.cpp b/src/libtomahawk/playlist/QueueProxyModel.cpp index b70d4a45a..b1821c68c 100644 --- a/src/libtomahawk/playlist/QueueProxyModel.cpp +++ b/src/libtomahawk/playlist/QueueProxyModel.cpp @@ -23,6 +23,7 @@ #include "playlist/TrackView.h" #include "ViewManager.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/QueueView.cpp b/src/libtomahawk/playlist/QueueView.cpp index 0625684aa..1134f21e0 100644 --- a/src/libtomahawk/playlist/QueueView.cpp +++ b/src/libtomahawk/playlist/QueueView.cpp @@ -26,6 +26,7 @@ #include "widgets/OverlayWidget.h" #include "utils/Logger.h" #include "PlaylistView.h" +#include "Source.h" #include "utils/TomahawkUtilsGui.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/TrackModel.cpp b/src/libtomahawk/playlist/TrackModel.cpp index 9b7c6cc6d..b4688e584 100644 --- a/src/libtomahawk/playlist/TrackModel.cpp +++ b/src/libtomahawk/playlist/TrackModel.cpp @@ -26,6 +26,7 @@ #include "audio/AudioEngine.h" #include "utils/TomahawkUtils.h" +#include "Source.h" #include "Artist.h" #include "Album.h" @@ -265,7 +266,7 @@ TrackModel::updateDetailedInfo( const QModelIndex& index ) { if ( style() != TrackModel::Short && style() != TrackModel::Large ) return; - + TrackModelItem* item = itemFromIndex( index ); if ( item->query().isNull() ) return; @@ -274,7 +275,7 @@ TrackModel::updateDetailedInfo( const QModelIndex& index ) { item->query()->cover( QSize( 0, 0 ) ); } - + if ( style() == TrackModel::Large ) { item->query()->loadSocialActions(); diff --git a/src/libtomahawk/playlist/TrackModel.h b/src/libtomahawk/playlist/TrackModel.h index cf85f9d50..81ab4ede7 100644 --- a/src/libtomahawk/playlist/TrackModel.h +++ b/src/libtomahawk/playlist/TrackModel.h @@ -90,7 +90,7 @@ public: virtual QPersistentModelIndex currentItem() { return m_currentIndex; } virtual Tomahawk::QID currentItemUuid() { return m_currentUuid; } - virtual Tomahawk::PlaylistInterface::RepeatMode repeatMode() const { return Tomahawk::PlaylistInterface::NoRepeat; } + virtual Tomahawk::PlaylistModes::RepeatMode repeatMode() const { return Tomahawk::PlaylistModes::NoRepeat; } virtual bool shuffled() const { return false; } virtual void ensureResolved(); @@ -102,7 +102,7 @@ public: void updateDetailedInfo( const QModelIndex& index ); signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void trackCountChanged( unsigned int tracks ); @@ -128,7 +128,7 @@ public slots: virtual void remove( const QList& indexes ); virtual void remove( const QList& indexes ); - virtual void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode /*mode*/ ) {} + virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode /*mode*/ ) {} virtual void setShuffled( bool /*shuffled*/ ) {} protected: diff --git a/src/libtomahawk/playlist/TrackModelItem.cpp b/src/libtomahawk/playlist/TrackModelItem.cpp index 3e707d664..badc68131 100644 --- a/src/libtomahawk/playlist/TrackModelItem.cpp +++ b/src/libtomahawk/playlist/TrackModelItem.cpp @@ -23,6 +23,7 @@ #include "Query.h" #include "utils/TomahawkUtils.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/TrackProxyModel.cpp b/src/libtomahawk/playlist/TrackProxyModel.cpp index d28358162..2d1b30ab1 100644 --- a/src/libtomahawk/playlist/TrackProxyModel.cpp +++ b/src/libtomahawk/playlist/TrackProxyModel.cpp @@ -25,6 +25,7 @@ #include "Artist.h" #include "Album.h" #include "Query.h" +#include "Source.h" #include "utils/Logger.h" diff --git a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.cpp index 492adfb1b..d98a52386 100644 --- a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.cpp @@ -24,13 +24,14 @@ #include "Album.h" #include "Query.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; TrackProxyModelPlaylistInterface::TrackProxyModelPlaylistInterface( TrackProxyModel* proxyModel ) : PlaylistInterface() , m_proxyModel( proxyModel ) - , m_repeatMode( PlaylistInterface::NoRepeat ) + , m_repeatMode( PlaylistModes::NoRepeat ) , m_shuffled( false ) { } @@ -134,7 +135,7 @@ TrackProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly ) idx = proxyModel->currentIndex(); // random mode is disabled - if ( m_repeatMode != PlaylistInterface::RepeatOne ) + if ( m_repeatMode != PlaylistModes::RepeatOne ) { // keep progressing through the playlist normally idx = proxyModel->index( idx.row() + itemsAway, 0 ); @@ -142,7 +143,7 @@ TrackProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly ) } } - if ( !idx.isValid() && m_repeatMode == PlaylistInterface::RepeatAll ) + if ( !idx.isValid() && m_repeatMode == PlaylistModes::RepeatAll ) { // repeat all tracks if ( itemsAway > 0 ) diff --git a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.h b/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.h index b899ea983..394a9c443 100644 --- a/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.h +++ b/src/libtomahawk/playlist/TrackProxyModelPlaylistInterface.h @@ -52,16 +52,16 @@ public: virtual QString filter() const; virtual void setFilter( const QString& pattern ); - virtual PlaylistInterface::RepeatMode repeatMode() const { return m_repeatMode; } + virtual PlaylistModes::RepeatMode repeatMode() const { return m_repeatMode; } virtual bool shuffled() const { return m_shuffled; } public slots: - virtual void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); } + virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); } virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); } protected: QWeakPointer< TrackProxyModel > m_proxyModel; - RepeatMode m_repeatMode; + PlaylistModes::RepeatMode m_repeatMode; bool m_shuffled; }; diff --git a/src/libtomahawk/playlist/TreeHeader.cpp b/src/libtomahawk/playlist/TreeHeader.cpp index 105268ade..4aeccd17d 100644 --- a/src/libtomahawk/playlist/TreeHeader.cpp +++ b/src/libtomahawk/playlist/TreeHeader.cpp @@ -20,6 +20,7 @@ #include "playlist/ArtistView.h" #include "utils/Logger.h" +#include "Source.h" TreeHeader::TreeHeader( ArtistView* parent ) diff --git a/src/libtomahawk/playlist/TreeItemDelegate.cpp b/src/libtomahawk/playlist/TreeItemDelegate.cpp index 667de0351..abe65953a 100644 --- a/src/libtomahawk/playlist/TreeItemDelegate.cpp +++ b/src/libtomahawk/playlist/TreeItemDelegate.cpp @@ -34,6 +34,7 @@ #include "TreeModelItem.h" #include "TreeProxyModel.h" +#include "Source.h" #include "ArtistView.h" diff --git a/src/libtomahawk/playlist/TreeModel.h b/src/libtomahawk/playlist/TreeModel.h index 30b0885fa..a1e163ab1 100644 --- a/src/libtomahawk/playlist/TreeModel.h +++ b/src/libtomahawk/playlist/TreeModel.h @@ -128,13 +128,13 @@ public: public slots: virtual void setCurrentItem( const QModelIndex& index ); - virtual void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode /*mode*/ ) {} + virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode /*mode*/ ) {} virtual void setShuffled( bool /*shuffled*/ ) {} void addAlbums( const QModelIndex& parent, const QList& albums ); signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void modeChanged( Tomahawk::ModelMode mode ); diff --git a/src/libtomahawk/playlist/TreeModelItem.cpp b/src/libtomahawk/playlist/TreeModelItem.cpp index 0752719f8..566539f28 100644 --- a/src/libtomahawk/playlist/TreeModelItem.cpp +++ b/src/libtomahawk/playlist/TreeModelItem.cpp @@ -23,6 +23,7 @@ #include "Artist.h" #include "Album.h" #include "Query.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.cpp index c1d7ac574..7770332f2 100644 --- a/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.cpp @@ -33,7 +33,7 @@ using namespace Tomahawk; TreeProxyModelPlaylistInterface::TreeProxyModelPlaylistInterface( TreeProxyModel *proxyModel ) : PlaylistInterface() , m_proxyModel( proxyModel ) - , m_repeatMode( PlaylistInterface::NoRepeat ) + , m_repeatMode( PlaylistModes::NoRepeat ) , m_shuffled( false ) { } @@ -115,11 +115,11 @@ TreeProxyModelPlaylistInterface::siblingItem( int itemsAway, bool readOnly ) } else { - if ( m_repeatMode != PlaylistInterface::RepeatOne ) + if ( m_repeatMode != PlaylistModes::RepeatOne ) idx = proxyModel->index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0, idx.parent() ); } - if ( !idx.isValid() && m_repeatMode == PlaylistInterface::RepeatAll ) + if ( !idx.isValid() && m_repeatMode == PlaylistModes::RepeatAll ) { if ( itemsAway > 0 ) { diff --git a/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.h b/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.h index ae6abf293..2367f5e06 100644 --- a/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.h +++ b/src/libtomahawk/playlist/TreeProxyModelPlaylistInterface.h @@ -57,12 +57,12 @@ public: virtual void sendTrackCount() { emit trackCountChanged( trackCount() ); } - virtual PlaylistInterface::RepeatMode repeatMode() const { return m_repeatMode; } + virtual PlaylistModes::RepeatMode repeatMode() const { return m_repeatMode; } virtual bool shuffled() const { return m_shuffled; } - virtual PlaylistInterface::ViewMode viewMode() const { return PlaylistInterface::Tree; } + virtual PlaylistModes::ViewMode viewMode() const { return PlaylistModes::Tree; } signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void trackCountChanged( unsigned int tracks ); @@ -75,13 +75,13 @@ signals: void nextTrackReady(); public slots: - virtual void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); } + virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); } virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); } private: QWeakPointer< TreeProxyModel > m_proxyModel; - RepeatMode m_repeatMode; + PlaylistModes::RepeatMode m_repeatMode; bool m_shuffled; }; diff --git a/src/libtomahawk/playlist/XspfUpdater.cpp b/src/libtomahawk/playlist/XspfUpdater.cpp index a997648bf..22c43fd4a 100644 --- a/src/libtomahawk/playlist/XspfUpdater.cpp +++ b/src/libtomahawk/playlist/XspfUpdater.cpp @@ -22,6 +22,7 @@ #include "utils/XspfLoader.h" #include "Pipeline.h" #include "utils/TomahawkUtils.h" +#include "Source.h" #include diff --git a/src/libtomahawk/playlist/dynamic/DynamicPlaylistRevision.cpp b/src/libtomahawk/playlist/dynamic/DynamicPlaylistRevision.cpp index 10bbaf4ed..bbc85b57a 100644 --- a/src/libtomahawk/playlist/dynamic/DynamicPlaylistRevision.cpp +++ b/src/libtomahawk/playlist/dynamic/DynamicPlaylistRevision.cpp @@ -19,6 +19,7 @@ #include "DynamicPlaylistRevision.h" #include "dynamic/DynamicControl.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/dynamic/DynamicView.cpp b/src/libtomahawk/playlist/dynamic/DynamicView.cpp index 4b326344d..b4fbc9b6b 100644 --- a/src/libtomahawk/playlist/dynamic/DynamicView.cpp +++ b/src/libtomahawk/playlist/dynamic/DynamicView.cpp @@ -31,6 +31,7 @@ #include "DynamicModel.h" #include "widgets/OverlayWidget.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/dynamic/GeneratorFactory.cpp b/src/libtomahawk/playlist/dynamic/GeneratorFactory.cpp index 8dfb24b0a..c534c6066 100644 --- a/src/libtomahawk/playlist/dynamic/GeneratorFactory.cpp +++ b/src/libtomahawk/playlist/dynamic/GeneratorFactory.cpp @@ -20,6 +20,7 @@ #include "dynamic/GeneratorInterface.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/dynamic/GeneratorInterface.cpp b/src/libtomahawk/playlist/dynamic/GeneratorInterface.cpp index fe4064006..4b6bd1aca 100644 --- a/src/libtomahawk/playlist/dynamic/GeneratorInterface.cpp +++ b/src/libtomahawk/playlist/dynamic/GeneratorInterface.cpp @@ -20,6 +20,7 @@ #include "dynamic/GeneratorInterface.h" #include "utils/Logger.h" +#include "Source.h" Tomahawk::GeneratorInterface::GeneratorInterface( QObject* parent ) diff --git a/src/libtomahawk/playlist/dynamic/database/DatabaseGenerator.cpp b/src/libtomahawk/playlist/dynamic/database/DatabaseGenerator.cpp index 4a84950c4..ee4c8d137 100644 --- a/src/libtomahawk/playlist/dynamic/database/DatabaseGenerator.cpp +++ b/src/libtomahawk/playlist/dynamic/database/DatabaseGenerator.cpp @@ -20,8 +20,9 @@ #include "DatabaseControl.h" #include "utils/Logger.h" -#include -#include +#include "Source.h" +#include "database/DatabaseCommand_GenericSelect.h" +#include "database/Database.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp index ff1c39fa2..f9c983b9e 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp @@ -28,6 +28,7 @@ #include #include "echonest/Playlist.h" +#include "Source.h" #include "dynamic/widgets/DynamicWidget.h" #include "utils/TomahawkUtils.h" diff --git a/src/libtomahawk/playlist/dynamic/widgets/CollapsibleControls.cpp b/src/libtomahawk/playlist/dynamic/widgets/CollapsibleControls.cpp index da26e824f..728638e56 100644 --- a/src/libtomahawk/playlist/dynamic/widgets/CollapsibleControls.cpp +++ b/src/libtomahawk/playlist/dynamic/widgets/CollapsibleControls.cpp @@ -25,6 +25,7 @@ #include "dynamic/DynamicControl.h" #include "utils/TomahawkUtils.h" #include "widgets/ElidedLabel.h" +#include "Source.h" #include #include diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicControlList.cpp b/src/libtomahawk/playlist/dynamic/widgets/DynamicControlList.cpp index 2c10de64f..3f1e8c429 100644 --- a/src/libtomahawk/playlist/dynamic/widgets/DynamicControlList.cpp +++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicControlList.cpp @@ -31,6 +31,7 @@ #include "dynamic/GeneratorInterface.h" #include "utils/TomahawkUtils.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/playlist/topbar/TopBar.cpp b/src/libtomahawk/playlist/topbar/TopBar.cpp index 2c878932d..41adb5e7f 100644 --- a/src/libtomahawk/playlist/topbar/TopBar.cpp +++ b/src/libtomahawk/playlist/topbar/TopBar.cpp @@ -116,8 +116,8 @@ TopBar::TopBar( QWidget* parent ) connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ), SLOT( setFilterVisible( bool ) ) ); - connect( ViewManager::instance(), SIGNAL( modeChanged( Tomahawk::PlaylistInterface::ViewMode ) ), - SLOT( onModeChanged( Tomahawk::PlaylistInterface::ViewMode ) ) ); + connect( ViewManager::instance(), SIGNAL( modeChanged( Tomahawk::PlaylistModes::ViewMode ) ), + SLOT( onModeChanged( Tomahawk::PlaylistModes::ViewMode ) ) ); } @@ -300,20 +300,20 @@ TopBar::setFilter( const QString& filter ) void -TopBar::onModeChanged( Tomahawk::PlaylistInterface::ViewMode mode ) +TopBar::onModeChanged( Tomahawk::PlaylistModes::ViewMode mode ) { qDebug() << Q_FUNC_INFO << mode; switch ( mode ) { - case Tomahawk::PlaylistInterface::Flat: + case Tomahawk::PlaylistModes::Flat: onFlatMode(); break; - case Tomahawk::PlaylistInterface::Tree: + case Tomahawk::PlaylistModes::Tree: onArtistMode(); break; - case Tomahawk::PlaylistInterface::Album: + case Tomahawk::PlaylistModes::Album: onAlbumMode(); break; diff --git a/src/libtomahawk/playlist/topbar/TopBar.h b/src/libtomahawk/playlist/topbar/TopBar.h index 55a1da462..6cb50563b 100644 --- a/src/libtomahawk/playlist/topbar/TopBar.h +++ b/src/libtomahawk/playlist/topbar/TopBar.h @@ -63,7 +63,7 @@ public slots: void setFilter( const QString& filter ); private slots: - void onModeChanged( Tomahawk::PlaylistInterface::ViewMode mode ); + void onModeChanged( Tomahawk::PlaylistModes::ViewMode mode ); void onFlatMode(); void onArtistMode(); void onAlbumMode(); diff --git a/src/libtomahawk/sip/SipPlugin.cpp b/src/libtomahawk/sip/SipPlugin.cpp index 3c205cda5..694bf03e0 100644 --- a/src/libtomahawk/sip/SipPlugin.cpp +++ b/src/libtomahawk/sip/SipPlugin.cpp @@ -22,6 +22,7 @@ #include "sip/SipPlugin.h" #include "utils/Logger.h" +#include "Source.h" SipPlugin::SipPlugin() : QObject() {} diff --git a/src/libtomahawk/utils/PixmapDelegateFader.cpp b/src/libtomahawk/utils/PixmapDelegateFader.cpp index 232e9e886..a4bcedee2 100644 --- a/src/libtomahawk/utils/PixmapDelegateFader.cpp +++ b/src/libtomahawk/utils/PixmapDelegateFader.cpp @@ -2,7 +2,7 @@ * * Copyright 2010-2012, Leo Franchi * Copyright 2012, Jeff Mitchell - * + * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -19,6 +19,7 @@ #include "PixmapDelegateFader.h" #include "TomahawkUtilsGui.h" +#include "Source.h" #include #include @@ -108,7 +109,7 @@ PixmapDelegateFader::init() { m_current = QPixmap( m_size ); m_current.fill( Qt::transparent ); - + if ( m_currentReference.isNull() ) { // No cover loaded yet, use default and don't fade in @@ -175,13 +176,13 @@ PixmapDelegateFader::setPixmap( const QPixmap& pixmap ) return; m_oldImageMd5 = newImageMd5; - + if ( m_connectedToStl ) { m_pixmapQueue.enqueue( pixmap ); return; } - + m_oldReference = m_currentReference; m_currentReference = pixmap; @@ -202,7 +203,7 @@ PixmapDelegateFader::onAnimationStep( int step ) if ( m_fadePct == 100.0 ) QTimer::singleShot( 0, this, SLOT( onAnimationFinished() ) ); - + const qreal opacity = m_fadePct / 100.0; const qreal oldOpacity = ( 100.0 - m_fadePct ) / 100.0; m_current.fill( Qt::transparent ); diff --git a/src/libtomahawk/utils/ShortenedLinkParser.cpp b/src/libtomahawk/utils/ShortenedLinkParser.cpp index 09bf6929e..6452e1b0c 100644 --- a/src/libtomahawk/utils/ShortenedLinkParser.cpp +++ b/src/libtomahawk/utils/ShortenedLinkParser.cpp @@ -26,6 +26,7 @@ #include "jobview/ErrorStatusMessage.h" #include "jobview/JobStatusModel.h" #include "jobview/JobStatusView.h" +#include "Source.h" #include diff --git a/src/libtomahawk/utils/TomahawkCache.cpp b/src/libtomahawk/utils/TomahawkCache.cpp index 08e441ed9..e69baac16 100644 --- a/src/libtomahawk/utils/TomahawkCache.cpp +++ b/src/libtomahawk/utils/TomahawkCache.cpp @@ -19,6 +19,7 @@ #include "TomahawkCache.h" #include "TomahawkSettings.h" +#include "Source.h" #include "utils/Logger.h" #include diff --git a/src/libtomahawk/utils/TomahawkUtils.cpp b/src/libtomahawk/utils/TomahawkUtils.cpp index 3e3d854b4..f70a1c149 100644 --- a/src/libtomahawk/utils/TomahawkUtils.cpp +++ b/src/libtomahawk/utils/TomahawkUtils.cpp @@ -24,6 +24,7 @@ #include "utils/TomahawkUtils.h" #include "utils/Logger.h" +#include "Source.h" #ifdef LIBLASTFM_FOUND #include diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.cpp b/src/libtomahawk/utils/TomahawkUtilsGui.cpp index 7bc83dc8f..8d2017dc2 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.cpp +++ b/src/libtomahawk/utils/TomahawkUtilsGui.cpp @@ -24,6 +24,7 @@ #include "Result.h" #include "Logger.h" #include "TrackModelItem.h" +#include "Source.h" #include #include diff --git a/src/libtomahawk/utils/XspfGenerator.cpp b/src/libtomahawk/utils/XspfGenerator.cpp index ba0fb9cf6..72355f618 100644 --- a/src/libtomahawk/utils/XspfGenerator.cpp +++ b/src/libtomahawk/utils/XspfGenerator.cpp @@ -26,6 +26,7 @@ #include "Playlist.h" #include "Query.h" #include "utils/Logger.h" +#include "Source.h" using namespace Tomahawk; diff --git a/src/libtomahawk/widgets/ChartDataLoader.cpp b/src/libtomahawk/widgets/ChartDataLoader.cpp index 07a69112e..760df389c 100644 --- a/src/libtomahawk/widgets/ChartDataLoader.cpp +++ b/src/libtomahawk/widgets/ChartDataLoader.cpp @@ -17,6 +17,8 @@ */ #include "ChartDataLoader.h" +#include "Source.h" + using namespace Tomahawk; diff --git a/src/libtomahawk/widgets/CheckDirTree.cpp b/src/libtomahawk/widgets/CheckDirTree.cpp index 6bed37868..9c7d878c6 100644 --- a/src/libtomahawk/widgets/CheckDirTree.cpp +++ b/src/libtomahawk/widgets/CheckDirTree.cpp @@ -21,6 +21,7 @@ #include "utils/Logger.h" #include "TomahawkSettings.h" +#include "Source.h" #include #include diff --git a/src/libtomahawk/widgets/QueryLabel.cpp b/src/libtomahawk/widgets/QueryLabel.cpp index 8e0fe9bd4..d81e32843 100644 --- a/src/libtomahawk/widgets/QueryLabel.cpp +++ b/src/libtomahawk/widgets/QueryLabel.cpp @@ -30,6 +30,7 @@ #include "ContextMenu.h" #include "utils/TomahawkUtilsGui.h" #include "utils/Logger.h" +#include "Source.h" #define BOXMARGIN 2 #define DASH " - " diff --git a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp index af5137c97..f1dbf14dc 100644 --- a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp +++ b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2011 Leo Franchi Copyright (C) 2011 Jeff Mitchell - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -25,6 +25,7 @@ #include "SourceList.h" #include "utils/Logger.h" #include "dynamic/DynamicPlaylist.h" +#include "Playlist.h" using namespace Tomahawk; @@ -37,7 +38,7 @@ RecentlyPlayedPlaylistsModel::RecentlyPlayedPlaylistsModel( QObject* parent ) loadFromSettings(); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), this, SLOT( onSourceAdded( Tomahawk::source_ptr ) ), Qt::QueuedConnection ); - connect( TomahawkSettings::instance(), SIGNAL( recentlyPlayedPlaylistAdded( Tomahawk::playlist_ptr ) ), this, SLOT( plAdded( Tomahawk::playlist_ptr ) ) ); + connect( TomahawkSettings::instance(), SIGNAL( recentlyPlayedPlaylistAdded( QString, int ) ), this, SLOT( plAdded( QString, int ) ) ); connect( AudioEngine::instance(),SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ), Qt::QueuedConnection ); emit emptinessChanged( m_recplaylists.isEmpty() ); @@ -217,8 +218,21 @@ RecentlyPlayedPlaylistsModel::rowCount( const QModelIndex& ) const void -RecentlyPlayedPlaylistsModel::plAdded( const playlist_ptr& pl ) +RecentlyPlayedPlaylistsModel::plAdded( const QString& plguid, int sId ) { + source_ptr source = SourceList::instance()->get( sId ); + if ( source.isNull() ) + return; + + playlist_ptr pl = source->collection()->playlist( plguid ); + if ( pl.isNull() ) + pl = source->collection()->autoPlaylist( plguid ); + if ( pl.isNull() ) + pl = source->collection()->station( plguid ); + + if ( pl.isNull() ) + return; + onPlaylistsRemoved( QList< playlist_ptr >() << pl ); beginInsertRows( QModelIndex(), 0, 0 ); @@ -235,7 +249,7 @@ RecentlyPlayedPlaylistsModel::playlistChanged( Tomahawk::playlistinterface_ptr p // ARG if ( pli.isNull() ) return; - + if ( Playlist *pl = dynamic_cast< Playlist* >( pli.data() ) ) { // look for it, qsharedpointer fail playlist_ptr ptr; diff --git a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h index f280afecc..7e14f4cf8 100644 --- a/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h +++ b/src/libtomahawk/widgets/RecentlyPlayedPlaylistsModel.h @@ -1,7 +1,7 @@ /* Copyright (C) 2011 Leo Franchi Copyright (C) 2011 Jeff Mitchell - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -47,14 +47,14 @@ signals: public slots: void sourceOnline(); - + private slots: void playlistChanged( Tomahawk::playlistinterface_ptr ); void onSourceAdded( const Tomahawk::source_ptr& source ); void onPlaylistsRemoved( QList ); void loadFromSettings(); - void plAdded( const Tomahawk::playlist_ptr& ); + void plAdded( const QString& plid, int sid ); void playlistRevisionLoaded(); private: diff --git a/src/libtomahawk/widgets/WhatsHotWidget_p.h b/src/libtomahawk/widgets/WhatsHotWidget_p.h index c72c1fde1..8d830eb31 100644 --- a/src/libtomahawk/widgets/WhatsHotWidget_p.h +++ b/src/libtomahawk/widgets/WhatsHotWidget_p.h @@ -40,10 +40,10 @@ public: : PlaylistInterface() , m_w( w ) { - connect( m_w->ui->tracksViewLeft->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - SLOT( anyRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); - connect( m_w->ui->artistsViewLeft->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - SLOT( anyRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); + connect( m_w->ui->tracksViewLeft->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + SLOT( anyRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); + connect( m_w->ui->artistsViewLeft->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + SLOT( anyRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); connect( m_w->ui->tracksViewLeft->proxyModel()->playlistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ), SLOT( anyShuffleChanged( bool ) ) ); @@ -53,7 +53,7 @@ public: virtual ~ChartsPlaylistInterface() {} // Any one is fine, we keep them all synched - virtual RepeatMode repeatMode() const { return m_w->ui->tracksViewLeft->proxyModel()->playlistInterface()->repeatMode(); } + virtual PlaylistModes::RepeatMode repeatMode() const { return m_w->ui->tracksViewLeft->proxyModel()->playlistInterface()->repeatMode(); } virtual bool shuffled() const { return m_w->ui->tracksViewLeft->proxyModel()->playlistInterface()->shuffled(); } @@ -72,7 +72,7 @@ public: } public slots: - virtual void setRepeatMode( RepeatMode mode ) + virtual void setRepeatMode( PlaylistModes::RepeatMode mode ) { m_w->ui->tracksViewLeft->proxyModel()->playlistInterface()->setRepeatMode( mode ); m_w->ui->artistsViewLeft->proxyModel()->playlistInterface()->setRepeatMode( mode ); @@ -85,7 +85,7 @@ public slots: } signals: - void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ); + void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ); void shuffleModeChanged( bool enabled ); void trackCountChanged( unsigned int tracks ); @@ -93,7 +93,7 @@ signals: void nextTrackReady(); private slots: - void anyRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ) + void anyRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ) { emit repeatModeChanged( mode ); } diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index 496bd5c3d..9ead62220 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -26,6 +26,7 @@ #include "playlist/TreeModel.h" #include "playlist/PlaylistModel.h" #include "playlist/TreeProxyModel.h" +#include "Source.h" #include "database/DatabaseCommand_AllTracks.h" #include "database/DatabaseCommand_AllAlbums.h" diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h index d697b56e0..10f6776b4 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget_p.h @@ -25,6 +25,7 @@ #include "PlaylistInterface.h" #include "TreeProxyModel.h" #include "Result.h" +#include "Typedefs.h" #include @@ -36,12 +37,12 @@ public: : PlaylistInterface() , m_w( w ) { - connect( m_w->ui->albums->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - SLOT( anyRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); - connect( m_w->ui->relatedArtists->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - SLOT( anyRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); - connect( m_w->ui->topHits->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ), - SLOT( anyRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode ) ) ); + connect( m_w->ui->albums->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + SLOT( anyRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); + connect( m_w->ui->relatedArtists->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + SLOT( anyRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); + connect( m_w->ui->topHits->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), + SLOT( anyRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) ); connect( m_w->ui->albums->proxyModel()->playlistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ), SLOT( anyShuffleChanged( bool ) ) ); @@ -54,7 +55,7 @@ public: // Any one is fine, we keep them all synched - virtual RepeatMode repeatMode() const { return m_w->ui->albums->proxyModel()->playlistInterface()->repeatMode(); } + virtual Tomahawk::PlaylistModes::RepeatMode repeatMode() const { return m_w->ui->albums->proxyModel()->playlistInterface()->repeatMode(); } virtual bool shuffled() const { return m_w->ui->albums->proxyModel()->playlistInterface()->shuffled(); } @@ -73,7 +74,7 @@ public: } public slots: - virtual void setRepeatMode( RepeatMode mode ) + virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ) { m_w->ui->albums->proxyModel()->playlistInterface()->setRepeatMode( mode ); m_w->ui->relatedArtists->proxyModel()->playlistInterface()->setRepeatMode( mode ); @@ -91,7 +92,7 @@ signals: void nextTrackReady(); private slots: - void anyRepeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode ) + void anyRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode ) { emit repeatModeChanged( mode ); } diff --git a/src/libtomahawk/widgets/infowidgets/TrackInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/TrackInfoWidget.cpp index f6ffcb122..325fd75a6 100644 --- a/src/libtomahawk/widgets/infowidgets/TrackInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/TrackInfoWidget.cpp @@ -24,6 +24,7 @@ #include "ViewManager.h" #include "SourceList.h" #include "playlist/AlbumModel.h" +#include "audio/AudioEngine.h" #include "utils/TomahawkUtils.h" #include "utils/Logger.h" @@ -62,7 +63,7 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par ui->albumLabel->setFont( f ); ui->byLabel->setFont( f ); ui->fromLabel->setFont( f ); - + f.setPixelSize( 12 ); ui->statsLabel->setFont( f ); @@ -187,12 +188,12 @@ TrackInfoWidget::onStatsLoaded() { stats += "\n" + tr( "You first listened to it on %1." ).arg( QDateTime::fromTime_t( history.first().timestamp ).toString( "dd MMM yyyy" ) ); } - + if ( artistCounter ) stats += "\n" + tr( "You've listened to %1 %n time(s).", "", artistCounter ).arg( m_artist->name() ); else stats += "\n" + tr( "You've never listened to %1 before." ).arg( m_artist->name() ); - + ui->statsLabel->setText( stats ); } diff --git a/src/main.cpp b/src/main.cpp index 2c786bf55..08b1cfc6c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,7 @@ #include "UbuntuUnityHack.h" #include "TomahawkSettings.h" #include "config.h" +#include "utils/Logger.h" #include diff --git a/src/sourcetree/SourceDelegate.cpp b/src/sourcetree/SourceDelegate.cpp index e7ba57897..bd3c4a8eb 100644 --- a/src/sourcetree/SourceDelegate.cpp +++ b/src/sourcetree/SourceDelegate.cpp @@ -218,7 +218,7 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem& if ( !colItem->source()->isLocal() ) { realtimeListeningAlongPixmap = - colItem->source()->playlistInterface()->latchMode() == Tomahawk::PlaylistInterface::RealTime ? + colItem->source()->playlistInterface()->latchMode() == Tomahawk::PlaylistModes::RealTime ? m_realtimeLocked : m_realtimeUnlocked; } } diff --git a/src/sourcetree/SourceTreeView.cpp b/src/sourcetree/SourceTreeView.cpp index 3e43c36b6..dbb0afd8a 100644 --- a/src/sourcetree/SourceTreeView.cpp +++ b/src/sourcetree/SourceTreeView.cpp @@ -173,7 +173,7 @@ SourceTreeView::setupMenus() connect( latchOffAction, SIGNAL( triggered() ), SLOT( latchOff() ) ); m_latchMenu.addSeparator(); QAction *latchRealtimeAction = ActionCollection::instance()->getAction( "realtimeFollowingAlong" ); - latchRealtimeAction->setChecked( source->playlistInterface()->latchMode() == Tomahawk::PlaylistInterface::RealTime ); + latchRealtimeAction->setChecked( source->playlistInterface()->latchMode() == Tomahawk::PlaylistModes::RealTime ); m_latchMenu.addAction( latchRealtimeAction ); connect( latchRealtimeAction, SIGNAL( toggled( bool ) ), SLOT( latchModeToggled( bool ) ) ); } diff --git a/src/sourcetree/SourcesModel.cpp b/src/sourcetree/SourcesModel.cpp index 607955127..e0934a368 100644 --- a/src/sourcetree/SourcesModel.cpp +++ b/src/sourcetree/SourcesModel.cpp @@ -132,7 +132,7 @@ SourcesModel::data( const QModelIndex& index, int role ) const if ( itemFromIndex( index )->type() == Collection ) { SourceItem* cItem = qobject_cast< SourceItem* >( itemFromIndex( index ) ); - return cItem->localLatchMode() == Tomahawk::PlaylistInterface::RealTime; + return cItem->localLatchMode() == Tomahawk::PlaylistModes::RealTime; } return false; } diff --git a/src/sourcetree/items/CategoryItems.cpp b/src/sourcetree/items/CategoryItems.cpp index d01cc763d..9ea1e005b 100644 --- a/src/sourcetree/items/CategoryItems.cpp +++ b/src/sourcetree/items/CategoryItems.cpp @@ -28,6 +28,7 @@ #include "SourceTreeView.h" #include "utils/TomahawkUtils.h" #include "widgets/NewPlaylistWidget.h" +#include "TomahawkWindow.h" #include "widgets/PlaylistTypeSelectorDialog.h" #include #include "utils/Logger.h" diff --git a/src/sourcetree/items/SourceItem.cpp b/src/sourcetree/items/SourceItem.cpp index 1a4caa914..d2b51b0ae 100644 --- a/src/sourcetree/items/SourceItem.cpp +++ b/src/sourcetree/items/SourceItem.cpp @@ -212,13 +212,13 @@ SourceItem::localLatchedOn() const } -Tomahawk::PlaylistInterface::LatchMode +Tomahawk::PlaylistModes::LatchMode SourceItem::localLatchMode() const { if ( !m_source.isNull() && !m_source->isLocal() ) return m_source->playlistInterface()->latchMode(); - return Tomahawk::PlaylistInterface::StayOnSong; + return Tomahawk::PlaylistModes::StayOnSong; } @@ -228,7 +228,7 @@ SourceItem::latchedOff( const source_ptr& from, const source_ptr& to ) if ( from->isLocal() && ( m_source == to || m_source == from ) ) { m_latchedOn = false; - disconnect( m_latchedOnTo->playlistInterface().data(), SIGNAL( latchModeChanged( Tomahawk::PlaylistInterface::LatchMode ) ) ); + disconnect( m_latchedOnTo->playlistInterface().data(), SIGNAL( latchModeChanged( Tomahawk::PlaylistModes::LatchMode ) ) ); m_latchedOnTo.clear(); emit updated(); } @@ -242,14 +242,14 @@ SourceItem::latchedOn( const source_ptr& from, const source_ptr& to ) { m_latchedOn = true; m_latchedOnTo = to; - connect( m_latchedOnTo->playlistInterface().data(), SIGNAL( latchModeChanged( Tomahawk::PlaylistInterface::LatchMode ) ), SLOT( latchModeChanged( Tomahawk::PlaylistInterface::LatchMode ) ) ); + connect( m_latchedOnTo->playlistInterface().data(), SIGNAL( latchModeChanged( Tomahawk::PlaylistModes::LatchMode ) ), SLOT( latchModeChanged( Tomahawk::PlaylistModes::LatchMode ) ) ); emit updated(); } } void -SourceItem::latchModeChanged( Tomahawk::PlaylistInterface::LatchMode mode ) +SourceItem::latchModeChanged( Tomahawk::PlaylistModes::LatchMode mode ) { Q_UNUSED( mode ); emit updated(); @@ -535,7 +535,7 @@ SourceItem::latestAdditionsClicked() RecentlyAddedModel* raModel = new RecentlyAddedModel( m_source, cv ); raModel->setStyle( TrackModel::Large ); raModel->setTitle( tr( "Latest Additions" ) ); - + if ( m_source->isLocal() ) raModel->setDescription( tr( "Latest additions to your collection" ) ); else diff --git a/src/sourcetree/items/SourceItem.h b/src/sourcetree/items/SourceItem.h index 0be1f4e52..7f4a87ed8 100644 --- a/src/sourcetree/items/SourceItem.h +++ b/src/sourcetree/items/SourceItem.h @@ -43,7 +43,7 @@ public: virtual int IDValue() const; virtual bool localLatchedOn() const; - virtual Tomahawk::PlaylistInterface::LatchMode localLatchMode() const; + virtual Tomahawk::PlaylistModes::LatchMode localLatchMode() const; Tomahawk::source_ptr source() const; @@ -65,7 +65,7 @@ private slots: void latchedOn( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& ); void latchedOff( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& ); - void latchModeChanged( Tomahawk::PlaylistInterface::LatchMode mode ); + void latchModeChanged( Tomahawk::PlaylistModes::LatchMode mode ); void requestExpanding(); diff --git a/src/utils/GuiHelpers.cpp b/src/utils/GuiHelpers.cpp index 8f3d3c5ba..6a77d1b6c 100644 --- a/src/utils/GuiHelpers.cpp +++ b/src/utils/GuiHelpers.cpp @@ -23,6 +23,7 @@ #include "accounts/Account.h" #include "accounts/AccountManager.h" #include "DelegateConfigWrapper.h" +#include "TomahawkSettings.h" namespace TomahawkUtils { diff --git a/src/web/Api_v1.cpp b/src/web/Api_v1.cpp index e918ec90f..7008d0e2a 100644 --- a/src/web/Api_v1.cpp +++ b/src/web/Api_v1.cpp @@ -30,6 +30,7 @@ #include "database/DatabaseCommand_ClientAuthValid.h" #include "network/Servent.h" #include "Pipeline.h" +#include "Source.h" using namespace Tomahawk;