Commit 433490ba authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

fix insertion in playlist of list of elements not being tracks

parent ce3df0bb
......@@ -84,8 +84,38 @@ void GridViewProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMod
allData.reserve(rowCount());
for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) {
auto currentIndex = index(rowIndex, 0);
allData.push_back(ElisaUtils::EntryData{data(currentIndex, DataTypes::FullDataRole).value<DataTypes::TrackDataType>(),
data(currentIndex, Qt::DisplayRole).toString(), {}});
switch (mDataType)
{
case ElisaUtils::Radio:
case ElisaUtils::Track:
allData.push_back(ElisaUtils::EntryData{data(currentIndex, DataTypes::FullDataRole).value<DataTypes::TrackDataType>(),
data(currentIndex, Qt::DisplayRole).toString(), {}});
break;
case ElisaUtils::Album:
allData.push_back(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, data(currentIndex, DataTypes::DatabaseIdRole).toULongLong()},
{DataTypes::ImageUrlRole, data(currentIndex, DataTypes::ImageUrlRole).toUrl()},
{DataTypes::AlbumArtistRole, data(currentIndex, DataTypes::ArtistRole).toString()},
{DataTypes::AlbumRole, data(currentIndex, DataTypes::AlbumRole).toString()}},
data(currentIndex, Qt::DisplayRole).toString(), {}});
break;
case ElisaUtils::Artist:
allData.push_back(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, data(currentIndex, DataTypes::DatabaseIdRole).toULongLong()},
{DataTypes::ImageUrlRole, data(currentIndex, DataTypes::ImageUrlRole).toUrl()},
{DataTypes::AlbumArtistRole, data(currentIndex, DataTypes::ArtistRole).toString()},
{DataTypes::AlbumRole, {}}},
data(currentIndex, Qt::DisplayRole).toString(), {}});
break;
case ElisaUtils::Genre:
case ElisaUtils::Lyricist:
case ElisaUtils::Composer:
case ElisaUtils::FileName:
allData.push_back(ElisaUtils::EntryData{{{DataTypes::DatabaseIdRole, data(currentIndex, DataTypes::DatabaseIdRole).toULongLong()}},
data(currentIndex, Qt::DisplayRole).toString(), {}});
break;
case ElisaUtils::Unknown:
break;
}
}
Q_EMIT entriesToEnqueue(allData, mDataType, enqueueMode, triggerPlay);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment