1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

Extra check for starred container

This commit is contained in:
Hugo Lindström
2012-12-22 17:19:47 +01:00
parent db0743b783
commit 11eea91354
2 changed files with 7 additions and 4 deletions

View File

@@ -838,7 +838,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
const bool isOwner = plMap.value( "owner" ).toBool(); const bool isOwner = plMap.value( "owner" ).toBool();
const bool sync = plMap.value( "sync" ).toBool(); const bool sync = plMap.value( "sync" ).toBool();
const bool subscribed = plMap.value( "subscribed" ).toBool(); const bool subscribed = plMap.value( "subscribed" ).toBool();
const bool starContainer = plMap.value( "starContainer" ).toBool(); const bool starContainer = ( plMap.value( "starContainer" ).toBool() || name == "Starred Tracks");
if ( name.isNull() || plid.isNull() || revid.isNull() ) if ( name.isNull() || plid.isNull() || revid.isNull() )
{ {
@@ -1175,7 +1175,7 @@ SpotifyAccount::saveConfig()
m_configWidget.data()->saveSettings(); m_configWidget.data()->saveSettings();
foreach ( SpotifyPlaylistInfo* pl, m_allSpotifyPlaylists.values() ) foreach ( SpotifyPlaylistInfo* pl, m_allSpotifyPlaylists.values() )
{ {
// qDebug() << "Checking changed state:" << pl->changed << pl->name << pl->sync; // qDebug() << "Checking changed state:" << pl->changed << "name:" << pl->name << "sync" << pl->sync << "starred:" << pl->starContainer;
if ( pl->changed ) if ( pl->changed )
{ {
pl->changed = false; pl->changed = false;

View File

@@ -101,12 +101,14 @@ SpotifyAccountConfig::saveSettings()
const bool toSync = ( item->checkState() == Qt::Checked ); const bool toSync = ( item->checkState() == Qt::Checked );
if ( pl->sync != toSync ) if ( pl->sync != toSync )
{ {
qDebug() << Q_FUNC_INFO << "Setting sync";
pl->changed = true; pl->changed = true;
pl->sync = toSync; pl->sync = toSync;
} }
if ( ( pl->starContainer && loveSync() ) && ( pl->loveSync != loveSync() ) ) if ( ( pl->starContainer && loveSync() ) && ( pl->loveSync != loveSync() ) )
{ {
qDebug() << Q_FUNC_INFO << "Setting lovesync";
pl->loveSync = loveSync(); pl->loveSync = loveSync();
pl->changed = true; pl->changed = true;
} }
@@ -161,10 +163,11 @@ SpotifyAccountConfig::setPlaylists( const QList<SpotifyPlaylistInfo *>& playlist
foreach ( SpotifyPlaylistInfo* pl, myList ) foreach ( SpotifyPlaylistInfo* pl, myList )
{ {
bool starContainer = ( pl->starContainer || pl->name == "Starred Tracks" );
QListWidgetItem* item = new QListWidgetItem( pl->name, m_ui->playlistList ); QListWidgetItem* item = new QListWidgetItem( pl->name, m_ui->playlistList );
item->setData( Qt::UserRole, QVariant::fromValue< SpotifyPlaylistInfo* >( pl ) ); item->setData( Qt::UserRole, QVariant::fromValue< SpotifyPlaylistInfo* >( pl ) );
item->setData( Qt::UserRole+2, pl->starContainer ); item->setData( Qt::UserRole+2, starContainer );
if( loveSync() && pl->starContainer ) if( loveSync() && starContainer )
item->setHidden(true); item->setHidden(true);
item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled ); item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled );
item->setCheckState( pl->sync ? Qt::Checked : Qt::Unchecked ); item->setCheckState( pl->sync ? Qt::Checked : Qt::Unchecked );