mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-02-24 20:03:07 +01:00
Report social action changes and refresh loved playlists
This commit is contained in:
parent
b9733249ee
commit
23ea7537e6
@ -36,6 +36,8 @@ DatabaseCommand_SocialAction::postCommitHook()
|
||||
{
|
||||
Servent::instance()->triggerDBSync();
|
||||
}
|
||||
|
||||
source()->reportSocialAttributesChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "database/databasecommand_genericselect.h"
|
||||
#include "database/database.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include <sourcelist.h>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -37,6 +38,16 @@ CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, c
|
||||
|
||||
setPlaylistModel( m_model );
|
||||
generateTracks();
|
||||
|
||||
if ( m_type == SourceLovedTracks )
|
||||
connect( m_source.data(), SIGNAL( socialAttributesChanged() ), this, SLOT( reload() ) );
|
||||
else if ( m_type == AllLovedTracks )
|
||||
{
|
||||
foreach ( const source_ptr& s, SourceList::instance()->sources( true ) )
|
||||
connect( s.data(), SIGNAL( socialAttributesChanged() ), this, SLOT( reload() ) );
|
||||
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), this, SLOT( sourceAdded( Tomahawk::source_ptr ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,3 +116,17 @@ CustomPlaylistView::pixmap() const
|
||||
{
|
||||
return QPixmap( RESPATH "images/loved_playlist.png" );
|
||||
}
|
||||
|
||||
void
|
||||
CustomPlaylistView::reload()
|
||||
{
|
||||
m_model->clear();
|
||||
generateTracks();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CustomPlaylistView::sourceAdded( const source_ptr& s)
|
||||
{
|
||||
connect( s.data(), SIGNAL( socialAttributesChanged() ), this, SLOT( reload() ) );
|
||||
}
|
||||
|
@ -51,6 +51,9 @@ public:
|
||||
private slots:
|
||||
void tracksGenerated( QList<Tomahawk::query_ptr> tracks );
|
||||
|
||||
void reload();
|
||||
void sourceAdded( const Tomahawk::source_ptr& );
|
||||
|
||||
private:
|
||||
void generateTracks();
|
||||
|
||||
|
@ -312,3 +312,10 @@ Source::trackTimerFired()
|
||||
|
||||
emit stateChanged();
|
||||
}
|
||||
|
||||
void
|
||||
Source::reportSocialAttributesChanged()
|
||||
{
|
||||
emit socialAttributesChanged();
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
class DatabaseCommand_LogPlayback;
|
||||
class ControlConnection;
|
||||
class DatabaseCommand_SocialAction;
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
@ -41,6 +42,7 @@ Q_OBJECT
|
||||
|
||||
friend class ::DatabaseCommand_LogPlayback;
|
||||
friend class ::DBSyncConnection;
|
||||
friend class ::DatabaseCommand_SocialAction;
|
||||
|
||||
public:
|
||||
explicit Source( int id, const QString& username = QString() );
|
||||
@ -95,6 +97,8 @@ signals:
|
||||
|
||||
void stateChanged();
|
||||
|
||||
void socialAttributesChanged();
|
||||
|
||||
public slots:
|
||||
void setStats( const QVariantMap& m );
|
||||
|
||||
@ -110,6 +114,8 @@ private slots:
|
||||
void trackTimerFired();
|
||||
|
||||
private:
|
||||
void reportSocialAttributesChanged();
|
||||
|
||||
bool m_isLocal;
|
||||
bool m_online;
|
||||
QString m_username, m_friendlyname;
|
||||
|
Loading…
x
Reference in New Issue
Block a user