1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-02 04:10:20 +02: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" ); m_scrubFriendlyName = qApp->arguments().contains( "--demo" );
if ( id == 0 ) if ( id == 0 )
{
m_isLocal = true; m_isLocal = true;
m_online = true;
}
m_currentTrackTimer.setSingleShot( true ); m_currentTrackTimer.setSingleShot( true );
connect( &m_currentTrackTimer, SIGNAL( timeout() ), this, SLOT( trackTimerFired() ) ); connect( &m_currentTrackTimer, SIGNAL( timeout() ), this, SLOT( trackTimerFired() ) );
@@ -524,3 +521,26 @@ Source::updateIndexWhenSynced()
{ {
m_updateIndexWhenSynced = true; 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(); virtual ~Source();
bool isLocal() const { return m_isLocal; } 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 userName() const { return m_username; }
QString friendlyName() const; QString friendlyName() const;
@@ -83,7 +83,7 @@ public:
unsigned int trackCount() const; unsigned int trackCount() const;
Tomahawk::query_ptr currentTrack() const { return m_currentTrack; } Tomahawk::query_ptr currentTrack() const { return m_currentTrack; }
QString textStatus() const { return m_textStatus; } QString textStatus() const;
DBSyncConnection::State state() const { return m_state; } DBSyncConnection::State state() const { return m_state; }
Tomahawk::playlistinterface_ptr playlistInterface(); Tomahawk::playlistinterface_ptr playlistInterface();