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

* Manage source's off-/online state for the local source, too.

This commit is contained in:
Christian Muehlhaeuser 2012-06-07 09:35:35 +02:00
parent 1b743b0e9d
commit 0d85d15002
2 changed files with 25 additions and 5 deletions

View File

@ -59,10 +59,7 @@ Source::Source( int id, const QString& username )
m_scrubFriendlyName = qApp->arguments().contains( "--demo" );
if ( id == 0 )
{
m_isLocal = true;
m_online = true;
}
m_currentTrackTimer.setSingleShot( true );
connect( &m_currentTrackTimer, SIGNAL( timeout() ), this, SLOT( trackTimerFired() ) );
@ -524,3 +521,26 @@ Source::updateIndexWhenSynced()
{
m_updateIndexWhenSynced = true;
}
QString
Source::textStatus() const
{
if ( !m_textStatus.isEmpty() )
return m_textStatus;
if ( !currentTrack().isNull() )
{
return currentTrack()->artist() + " - " + currentTrack()->track();
}
// do not use isOnline() here - it will always return true for the local source
if ( m_online )
{
return tr( "Online" );
}
else
{
return tr( "Offline" );
}
}

View File

@ -58,7 +58,7 @@ public:
virtual ~Source();
bool isLocal() const { return m_isLocal; }
bool isOnline() const { return m_online; }
bool isOnline() const { return m_online || m_isLocal; }
QString userName() const { return m_username; }
QString friendlyName() const;
@ -83,7 +83,7 @@ public:
unsigned int trackCount() const;
Tomahawk::query_ptr currentTrack() const { return m_currentTrack; }
QString textStatus() const { return m_textStatus; }
QString textStatus() const;
DBSyncConnection::State state() const { return m_state; }
Tomahawk::playlistinterface_ptr playlistInterface();