mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
TWK-721: Don't flicker from officialtracks to supercollection tracks.
If the second infosystem albumtracks request comes back empty but the first one came back with tracks, this is not a failure and so keep the official tracks
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -622,7 +623,7 @@ TreeModel::addAlbums( const artist_ptr& artist, const QModelIndex& parent, bool
|
|||||||
requestData.caller = m_infoId;
|
requestData.caller = m_infoId;
|
||||||
requestData.customData["row"] = parent.row();
|
requestData.customData["row"] = parent.row();
|
||||||
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
|
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
|
||||||
requestData.customData["refetch"] = QVariant( autoRefetch );
|
requestData.customData["refetch"] = autoRefetch;
|
||||||
requestData.type = Tomahawk::InfoSystem::InfoArtistReleases;
|
requestData.type = Tomahawk::InfoSystem::InfoArtistReleases;
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||||
}
|
}
|
||||||
@@ -660,8 +661,8 @@ TreeModel::addTracks( const album_ptr& album, const QModelIndex& parent, bool au
|
|||||||
m_receivedInfoData.removeAll( artistInfo );
|
m_receivedInfoData.removeAll( artistInfo );
|
||||||
Tomahawk::InfoSystem::InfoRequestData requestData;
|
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||||
requestData.caller = m_infoId;
|
requestData.caller = m_infoId;
|
||||||
requestData.customData["rows"] = QVariant( rows );
|
requestData.customData["rows"] = rows;
|
||||||
requestData.customData["refetch"] = QVariant( autoRefetch );
|
requestData.customData["refetch"] = autoRefetch;
|
||||||
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
|
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
|
||||||
requestData.type = Tomahawk::InfoSystem::InfoAlbumSongs;
|
requestData.type = Tomahawk::InfoSystem::InfoAlbumSongs;
|
||||||
requestData.timeoutMillis = 0;
|
requestData.timeoutMillis = 0;
|
||||||
@@ -796,7 +797,7 @@ TreeModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const QModel
|
|||||||
albumitem = new TreeModelItem( album, parentItem );
|
albumitem = new TreeModelItem( album, parentItem );
|
||||||
albumitem->index = createIndex( parentItem->children.count() - 1, 0, albumitem );
|
albumitem->index = createIndex( parentItem->children.count() - 1, 0, albumitem );
|
||||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
|
|
||||||
getCover( albumitem->index );
|
getCover( albumitem->index );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,7 +887,7 @@ TreeModel::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QV
|
|||||||
|
|
||||||
QModelIndex idx = index( requestData.customData[ "row" ].toInt(), 0, QModelIndex() );
|
QModelIndex idx = index( requestData.customData[ "row" ].toInt(), 0, QModelIndex() );
|
||||||
|
|
||||||
if ( requestData.customData[ "refetch" ].toInt() > 0 && !al.count() )
|
if ( requestData.customData[ "refetch" ].toBool() && !al.count() )
|
||||||
{
|
{
|
||||||
setMode( DatabaseMode );
|
setMode( DatabaseMode );
|
||||||
|
|
||||||
@@ -940,7 +941,13 @@ TreeModel::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QV
|
|||||||
}
|
}
|
||||||
else if ( m_receivedInfoData.count() == 2 /* FIXME */ )
|
else if ( m_receivedInfoData.count() == 2 /* FIXME */ )
|
||||||
{
|
{
|
||||||
if ( requestData.customData[ "refetch" ].toInt() > 0 )
|
// If the second load got no data, but the first load did, don't do anything
|
||||||
|
QList< QVariant > rows = requestData.customData[ "rows" ].toList();
|
||||||
|
QModelIndex idx = index( rows.first().toUInt(), 0, index( rows.at( 1 ).toUInt(), 0, QModelIndex() ) );
|
||||||
|
if ( rowCount( idx ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( requestData.customData[ "refetch" ].toBool() )
|
||||||
{
|
{
|
||||||
setMode( DatabaseMode );
|
setMode( DatabaseMode );
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -231,7 +232,7 @@ AlbumInfoWidget::loadAlbums( bool autoRefetch )
|
|||||||
artistInfo["artist"] = m_album->artist()->name();
|
artistInfo["artist"] = m_album->artist()->name();
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoRequestData requestData;
|
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||||
requestData.customData["refetch"] = QVariant( autoRefetch );
|
requestData.customData["refetch"] = autoRefetch;
|
||||||
requestData.caller = m_infoId;
|
requestData.caller = m_infoId;
|
||||||
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
|
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
|
||||||
requestData.type = Tomahawk::InfoSystem::InfoArtistReleases;
|
requestData.type = Tomahawk::InfoSystem::InfoArtistReleases;
|
||||||
@@ -308,7 +309,7 @@ AlbumInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDa
|
|||||||
tDebug() << "Adding" << al.count() << "albums";
|
tDebug() << "Adding" << al.count() << "albums";
|
||||||
gotAlbums( al );
|
gotAlbums( al );
|
||||||
}
|
}
|
||||||
else if ( requestData.customData[ "refetch" ].toInt() > 0 )
|
else if ( requestData.customData[ "refetch" ].toBool() )
|
||||||
{
|
{
|
||||||
tDebug() << "Auto refetching";
|
tDebug() << "Auto refetching";
|
||||||
m_buttonAlbums->setChecked( false );
|
m_buttonAlbums->setChecked( false );
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
Reference in New Issue
Block a user