1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Warning and memleak fixes

This commit is contained in:
Leo Franchi 2012-05-19 09:40:02 -04:00
parent 77a901a71f
commit 4b28c15850
157 changed files with 557 additions and 427 deletions

View File

@ -30,6 +30,7 @@
#include "utils/Logger.h"
#include "utils/AnimatedSpinner.h"
#include "utils/Closure.h"
#include "Source.h"
#define CHILD_ACCOUNT_HEIGHT 24

View File

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

View File

@ -20,6 +20,7 @@
#include "accounts/Account.h"
#include "AccountFactoryWrapper.h"
#include "utils/TomahawkUtils.h"
#include "Source.h"
#include <QApplication>
#include <QPainter>

View File

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

View File

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

View File

@ -29,7 +29,6 @@
#define TOMAHAWK_APPLICATION QApplication
#include <QApplication>
#include "TomahawkWindow.h"
#endif

View File

@ -18,6 +18,7 @@
#include "LoadXSPFDialog.h"
#include "TomahawkSettings.h"
#include "Source.h"
#include "ui_LoadXSPFDialog.h"
#include <QFileDialog>

View File

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

View File

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

View File

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

View File

@ -47,6 +47,7 @@ class Servent;
class SipHandler;
class TomahawkSettings;
class XMPPBot;
class AudioControls;
namespace Tomahawk
{

View File

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

View File

@ -318,8 +318,8 @@ void
TomahawkWindow::setupSignals()
{
// <From PlaylistManager>
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 ) ) );

View File

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

View File

@ -30,6 +30,8 @@
#include "utils/TomahawkUtils.h"
#include "utils/Logger.h"
#include "accounts/lastfm/LastFmAccount.h"
#include "Source.h"
#include "TomahawkSettings.h"
#include <lastfm/ws.h>
#include <lastfm/XmlQuery>
@ -128,7 +130,7 @@ LastFmInfoPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
case InfoChartCapabilities:
fetchChartCapabilities( requestData );
break;
case InfoTrackSimilars:
fetchSimilarTracks( requestData );
break;

View File

@ -24,6 +24,7 @@
#include "TomahawkSettings.h"
#include "utils/TomahawkUtils.h"
#include "database/Database.h"
#include "Source.h"
#include "TomahawkOAuthTwitter.h"
#include <QTweetLib/qtweetaccountverifycredentials.h>

View File

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

View File

@ -37,6 +37,7 @@
#include <TomahawkSettings.h>
#include <database/Database.h>
#include <network/Servent.h>
#include "Source.h"
#include "utils/Logger.h"
#include "accounts/twitter/TomahawkOAuthTwitter.h"

View File

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

View File

@ -48,6 +48,7 @@
#include <utils/TomahawkUtils.h>
#include <utils/Logger.h>
#include <accounts/AccountManager.h>
#include <TomahawkSettings.h>
#ifndef ENABLE_HEADLESS
#include <QtGui/QInputDialog>

View File

@ -26,6 +26,7 @@
#include "TomahawkSettings.h"
#include "utils/Logger.h"
#include "ZeroconfAccount.h"
#include "Source.h"
using namespace Tomahawk;
using namespace Accounts;

View File

@ -20,6 +20,7 @@
#include "sip/SipPlugin.h"
#include "Zeroconf.h"
#include "Source.h"
#include <QtCore/QtPlugin>

View File

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

View File

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

View File

@ -14,6 +14,7 @@
#include "utils/TomahawkUtils.h"
#include "utils/Logger.h"
#include "utils/TomahawkCache.h"
#include "Source.h"
#include <qjson/parser.h>
#include <qjson/serializer.h>

View File

@ -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 <qjson/parser.h>

View File

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

View File

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

View File

@ -26,6 +26,9 @@
#include <QTimer>
#include <QMutex>
#include <QVariant>
#include <QQueue>
#include <QStringList>
#include <QUuid>
#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.

View File

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

View File

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

View File

@ -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<Tomahawk::query_ptr> filterTracks( const QList<Tomahawk::query_ptr>& queries );
QList< Tomahawk::query_ptr > m_queries;
result_ptr m_currentItem;
unsigned int m_currentTrack;
bool m_infoSystemLoaded;
bool m_databaseLoaded;

View File

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

View File

@ -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<Tomahawk::album_ptr> albums( ModelMode mode = Mixed, const Tomahawk::collection_ptr& collection = Tomahawk::collection_ptr() ) const;
QList<Tomahawk::artist_ptr> similarArtists() const;
@ -103,7 +102,7 @@ private:
QList<Tomahawk::album_ptr> m_databaseAlbums;
QList<Tomahawk::album_ptr> m_officialAlbums;
QList<Tomahawk::artist_ptr> 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;
};

View File

@ -24,6 +24,7 @@
#include "Query.h"
#include "database/Database.h"
#include "database/DatabaseCommand_AllTracks.h"
#include "Source.h"
#include "utils/Logger.h"

View File

@ -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*/ ) {}

View File

@ -21,6 +21,7 @@
#include "utils/TomahawkUtils.h"
#include "TomahawkSettingsGui.h"
#include "Pipeline.h"
#include "Source.h"
#include <attica/downloaditem.h>

View File

@ -27,6 +27,7 @@
#include "Artist.h"
#include "Album.h"
#include "utils/Logger.h"
#include "audio/AudioEngine.h"
using namespace Tomahawk;

View File

@ -19,6 +19,7 @@
#include "ExternalResolver.h"
#include "utils/Logger.h"
#include "Source.h"
Tomahawk::ExternalResolver::ErrorState
Tomahawk::ExternalResolver::error() const

View File

@ -28,6 +28,8 @@
#include <QUiLoader>
#include "utils/Logger.h"
#include "Source.h"
Tomahawk::ExternalResolverGui::ExternalResolverGui(const QString& filePath)
: Tomahawk::ExternalResolver(filePath)
{

View File

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

View File

@ -25,6 +25,7 @@
#include "ExternalResolver.h"
#include "resolvers/ScriptResolver.h"
#include "resolvers/QtScriptResolver.h"
#include "Source.h"
#include "utils/Logger.h"

View File

@ -25,10 +25,9 @@ using namespace Tomahawk;
PlaylistInterface::PlaylistInterface ()
: QObject()
, m_latchMode( StayOnSong )
, m_latchMode( PlaylistModes::StayOnSong )
{
m_id = uuid();
qRegisterMetaType<Tomahawk::PlaylistInterface::RepeatMode>( "Tomahawk::PlaylistInterface::RepeatMode" );
}
PlaylistInterface::~PlaylistInterface()

View File

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

View File

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

View File

@ -17,3 +17,5 @@
*/
#include "Resolver.h"
#include "Source.h"

View File

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

View File

@ -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<Tomahawk::query_ptr> 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 );

View File

@ -22,6 +22,7 @@
#include <QDir>
#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<Tomahawk::playlist_ptr>
TomahawkSettings::recentlyPlayedPlaylists() const
{
QStringList playlist_guids = value( "playlists/recentlyPlayed" ).toStringList();
QList<playlist_ptr> 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 );
}

View File

@ -1,7 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011 Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012 Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
* 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 <QSettings>
#include <QtNetwork/QNetworkProxy>
#include "DllMacro.h"
#include <QStringList>
#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<Tomahawk::playlist_ptr> 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();

View File

@ -77,6 +77,128 @@ namespace Tomahawk
class ExternalResolver;
typedef boost::function<Tomahawk::ExternalResolver*(QString)> 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;

View File

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

View File

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

View File

@ -19,6 +19,7 @@
#include "ViewPage.h"
#include "utils/Logger.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -19,6 +19,8 @@
#include "Account.h"
#include "TomahawkSettings.h"
namespace Tomahawk
{

View File

@ -26,12 +26,12 @@
#include <QtGui/QIcon>
#include <QtCore/QString>
#include <QtCore/QUuid>
#include <QMutex>
#include "Typedefs.h"
#include "DllMacro.h"
#include "TomahawkSettings.h"
#include "libtomahawk/infosystem/InfoSystem.h"
// #include "libtomahawk/infosystem/InfoSystem.h"
class SipPlugin;

View File

@ -20,6 +20,7 @@
#include "AccountManager.h"
#include "config.h"
#include "SourceList.h"
#include "TomahawkSettings.h"
#include "ResolverAccount.h"
#include <QtCore/QLibrary>

View File

@ -23,6 +23,7 @@
#include "AccountManager.h"
#include "AtticaManager.h"
#include "ResolverAccount.h"
#include "TomahawkSettings.h"
#ifndef ENABLE_HEADLESS
#include <QMessageBox>

View File

@ -24,6 +24,7 @@
#include "Account.h"
#include <QAbstractListModel>
#include <QSet>
namespace Tomahawk {

View File

@ -21,6 +21,9 @@
#include "ExternalResolver.h"
#include "ExternalResolverGui.h"
#include "AccountManager.h"
#include "TomahawkSettings.h"
#include "Source.h"
#include <Pipeline.h>
#include <QFile>
#include <QFileInfo>

View File

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

View File

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

View File

@ -31,6 +31,7 @@
#include "playlist/ArtistView.h"
#include "playlist/TreeModel.h"
#include "Source.h"
#include "utils/StyleHelper.h"
#include "utils/TomahawkUtilsGui.h"

View File

@ -23,6 +23,7 @@
#include "playlist/ArtistView.h"
#include "playlist/TreeModel.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -22,6 +22,7 @@
#include "playlist/PlaylistModel.h"
#include "playlist/PlaylistView.h"
#include "playlist/TrackHeader.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -17,6 +17,7 @@
*/
#include "WebContext.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -17,6 +17,7 @@
*/
#include "WikipediaContext.h"
#include "Source.h"
using namespace Tomahawk;

View File

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

View File

@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
*
* 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,

View File

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

View File

@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
*
* 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 )

View File

@ -23,6 +23,7 @@
#include "DatabaseImpl.h"
#include "utils/Logger.h"
#include "Source.h"
void

View File

@ -23,6 +23,7 @@
#include "DatabaseImpl.h"
#include "utils/Logger.h"
#include "Source.h"
void

View File

@ -24,6 +24,7 @@
#include "Source.h"
#include "dynamic/DynamicPlaylist.h"
#include "utils/Logger.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -28,6 +28,7 @@
#include "dynamic/GeneratorFactory.h"
#include "qjson/parser.h"
#include "utils/Logger.h"
#include "Source.h"
using namespace Tomahawk;

View File

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

View File

@ -24,6 +24,7 @@
#include "Query.h"
#include "qjson/parser.h"
#include "utils/Logger.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -21,6 +21,7 @@
#include "utils/Logger.h"
#include "Playlist.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -19,6 +19,7 @@
#include "DatabaseCommand_SetTrackAttributes.h"
#include "TomahawkSqlQuery.h"
#include "DatabaseImpl.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -21,6 +21,7 @@
#include "DatabaseImpl.h"
#include "TomahawkSqlQuery.h"
#include "utils/Logger.h"
#include "Source.h"
DatabaseCommand_SourceOffline::DatabaseCommand_SourceOffline( int id )

View File

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

View File

@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2012 Leo Franchi <lfranchi@kde.org>
*
* 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 <QSqlRecord>

View File

@ -22,6 +22,7 @@
#include "network/Servent.h"
#include "database/Database.h"
#include "database/DatabaseCommand_Resolve.h"
#include "Source.h"
#include "utils/Logger.h"

View File

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

View File

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

View File

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

View File

@ -19,9 +19,6 @@
#include <QtDebug>
#include <QDir>
#include <QSettings>
#include <QCryptographicHash>
#ifndef ENABLE_HEADLESS
#include <QDesktopServices>
@ -30,7 +27,11 @@
#include "InfoSystemCache.h"
#include "TomahawkSettings.h"
#include "utils/Logger.h"
#include "Source.h"
#include <QDir>
#include <QSettings>
#include <QCryptographicHash>
namespace Tomahawk
{

View File

@ -18,6 +18,17 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#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 <QCoreApplication>
#include <QNetworkConfiguration>
#include <QNetworkProxy>
@ -25,14 +36,6 @@
#include <QLibrary>
#include <QPluginLoader>
#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 )

View File

@ -21,6 +21,7 @@
#include "JobStatusModel.h"
#include "utils/TomahawkUtils.h"
#include "utils/Logger.h"
#include <QPixmap>
#include <QPainter>
@ -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 );

View File

@ -27,6 +27,7 @@
#include "TransferStatusItem.h"
#include "LatchedStatusItem.h"
#include "utils/Logger.h"
#include "Source.h"
#include <QHeaderView>
#include <QVBoxLayout>

View File

@ -25,6 +25,7 @@
#include "TomahawkApp.h"
#include "JobStatusModel.h"
#include "JobStatusView.h"
#include "Source.h"
PipelineStatusItem::PipelineStatusItem()

View File

@ -19,11 +19,12 @@
#include "Connection.h"
#include <QtCore/QTime>
#include <QtCore/QThread>
#include "network/Servent.h"
#include "utils/Logger.h"
#include "Source.h"
#include <QtCore/QTime>
#include <QtCore/QThread>
#define PROTOVER "4" // must match remote peer, or we can't talk.

View File

@ -19,14 +19,15 @@
#include "PortFwdThread.h"
#include "HeadlessCheck.h"
#include "portfwd/portfwd.h"
#include "utils/Logger.h"
#include "Source.h"
#include <QNetworkInterface>
#include <QStringList>
#include <QTime>
#include <QTimer>
#include "portfwd/portfwd.h"
#include "utils/Logger.h"
PortFwdThread::PortFwdThread( unsigned int port )

View File

@ -20,6 +20,7 @@
#include "utils/TomahawkUtils.h"
#include "utils/Logger.h"
#include "Source.h"
using namespace Tomahawk;

View File

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

View File

@ -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<Tomahawk::album_ptr>& albums );
@ -97,7 +97,7 @@ public slots:
void addQueries( const QList<Tomahawk::query_ptr>& queries );
signals:
void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode );
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );
void shuffleModeChanged( bool enabled );
void itemCountChanged( unsigned int items );

View File

@ -25,6 +25,7 @@
#include "Artist.h"
#include "AlbumItem.h"
#include "Query.h"
#include "Source.h"
#include "utils/Logger.h"

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More