Commit a6983a65 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

clean enqueue methods from MediaPlayList and MediaPlayListProxyModel

remove most of the ElisaUtils::PlayListEntryType parameters to allow
enqueue of miced entities

clean up also in MediaPlayListProxyModel

fix enqueue from grid views header bar
parent 533acb77
......@@ -80,7 +80,7 @@ private Q_SLOTS:
QCOMPARE(argumentsChangedSpy.count(), 0);
QCOMPARE(enqueueSpy.count(), 1);
QCOMPARE(enqueueSpy.at(0).count(), 4);
QCOMPARE(enqueueSpy.at(0).count(), 3);
QCOMPARE(std::get<2>(enqueueSpy.at(0).at(0).value<DataTypes::EntryDataList>().at(0)), QUrl::fromLocalFile(myTestFile.canonicalFilePath()));
}
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -52,6 +52,8 @@ private Q_SLOTS:
qRegisterMetaType<DataTypes::ArtistDataType>("ArtistDataType");
qRegisterMetaType<DataTypes::GenreDataType>("GenreDataType");
qRegisterMetaType<ElisaUtils::PlayListEntryType>("PlayListEntryType");
qRegisterMetaType<TracksListener::TrackDataType>("TracksListener::TrackDataType");
qRegisterMetaType<TracksListener::ListTrackDataType>("TracksListener::ListTrackDataType");
}
void testTrackRemoval()
......@@ -85,7 +87,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{}, QStringLiteral("artist1"), {}}, ElisaUtils::Artist);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{{DataTypes::ElementTypeRole, ElisaUtils::Artist}}, QStringLiteral("artist1"), {}});
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -212,7 +214,8 @@ private Q_SLOTS:
QCOMPARE(trackId != 0, true);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, trackId}}, {}, {}}, ElisaUtils::Track);
myPlayList.enqueueOneEntry(DataTypes::EntryData{{{DataTypes::ElementTypeRole, ElisaUtils::Track},
{DataTypes::DatabaseIdRole, trackId}}, {}, {}});
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -274,9 +277,9 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueueOneEntry({{{DataTypes::DatabaseIdRole, myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1)}},
QStringLiteral("track1"), {}},
ElisaUtils::Track);
myPlayList.enqueueOneEntry({{{DataTypes::ElementTypeRole, ElisaUtils::Track},
{DataTypes::DatabaseIdRole, myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1)}},
QStringLiteral("track1"), {}});
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -407,9 +410,9 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueueOneEntry({{{DataTypes::DatabaseIdRole, myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1)}},
QStringLiteral("track1"), {}},
ElisaUtils::Track);
myPlayList.enqueueOneEntry({{{DataTypes::ElementTypeRole, ElisaUtils::Track},
{DataTypes::DatabaseIdRole, myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1)}},
QStringLiteral("track1"), {}});
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......
......@@ -6993,7 +6993,7 @@ DataTypes::TrackDataType DatabaseInterface::buildTrackDataFromDatabaseRecord(con
}
result[DataTypes::TrackDataType::key_type::PlayCounter] = trackRecord.value(28);
result[DataTypes::TrackDataType::key_type::PlayFrequency] = trackRecord.value(29);
result[DataTypes::TrackDataType::key_type::ElementTypeRole] = ElisaUtils::Track;
result[DataTypes::TrackDataType::key_type::ElementTypeRole] = QVariant::fromValue(ElisaUtils::Track);
return result;
}
......
......@@ -374,6 +374,7 @@ public:
};
Q_DECLARE_METATYPE(DataTypes::MusicDataType)
Q_DECLARE_METATYPE(DataTypes::TrackDataType)
Q_DECLARE_METATYPE(DataTypes::AlbumDataType)
Q_DECLARE_METATYPE(DataTypes::ArtistDataType)
......
......@@ -189,7 +189,7 @@ void ElisaApplication::setArguments(const DataTypes::EntryDataList &newArguments
Q_EMIT argumentsChanged();
if (!d->mArguments.isEmpty()) {
Q_EMIT enqueue(d->mArguments, ElisaUtils::FileName,
Q_EMIT enqueue(d->mArguments,
ElisaUtils::PlayListEnqueueMode::AppendPlayList,
ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
}
......@@ -217,7 +217,6 @@ void ElisaApplication::activateRequested(const QStringList &arguments, const QSt
}
Q_EMIT enqueue(checkFileListAndMakeAbsolute(realArguments, workingDirectory),
ElisaUtils::FileName,
ElisaUtils::PlayListEnqueueMode::AppendPlayList,
ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
}
......@@ -363,7 +362,6 @@ void ElisaApplication::initializeModels()
QObject::connect(this, &ElisaApplication::enqueue,
d->mMediaPlayListProxyModel.get(), static_cast<void (MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&,
ElisaUtils::PlayListEntryType,
ElisaUtils::PlayListEnqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
}
......@@ -440,7 +438,7 @@ void ElisaApplication::initializePlayer()
QObject::connect(d->mMediaPlayListProxyModel.get(), &MediaPlayListProxyModel::currentTrackDataChanged, d->mManageHeaderBar.get(), &ManageHeaderBar::updateCurrentTrackData);
if (!d->mArguments.isEmpty()) {
Q_EMIT enqueue(d->mArguments, ElisaUtils::FileName,
Q_EMIT enqueue(d->mArguments,
ElisaUtils::PlayListEnqueueMode::AppendPlayList,
ElisaUtils::PlayListEnqueueTriggerPlay::TriggerPlay);
}
......
......@@ -132,7 +132,6 @@ Q_SIGNALS:
void manageHeaderBarChanged();
void enqueue(const DataTypes::EntryDataList &newEntries,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
......
......@@ -102,7 +102,7 @@ QVariant MediaPlayList::data(const QModelIndex &index, int role) const
result = d->mData[index.row()].mIsPlaying;
break;
case ColumnsRoles::ElementTypeRole:
result = d->mData[index.row()].mEntryType;
result = QVariant::fromValue(d->mData[index.row()].mEntryType);
break;
case ColumnsRoles::StringDurationRole:
{
......@@ -335,78 +335,73 @@ void MediaPlayList::enqueueRestoredEntries(const QVariantList &newEntries)
endInsertRows();
}
void MediaPlayList::enqueueFilesList(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType)
void MediaPlayList::enqueueFilesList(const DataTypes::EntryDataList &newEntries)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueFilesList";
beginInsertRows(QModelIndex(), d->mData.size(), d->mData.size() + newEntries.size() - 1);
for (const auto &oneTrackUrl : newEntries) {
switch (databaseIdType)
{
case ElisaUtils::Radio:
case ElisaUtils::Track:
case ElisaUtils::FileName:
{
const auto &trackUrl = std::get<2>(oneTrackUrl);
auto newEntry = MediaPlayListEntry(trackUrl);
newEntry.mEntryType = databaseIdType;
d->mData.push_back(newEntry);
if (trackUrl.isValid()) {
if (trackUrl.isLocalFile()) {
d->mTrackData.push_back({{DataTypes::ColumnsRoles::ResourceRole, trackUrl}});
auto entryString = trackUrl.toLocalFile();
QFileInfo newTrackFile(entryString);
if (newTrackFile.exists()) {
d->mData.last().mIsValid = true;
}
} else {
d->mTrackData.push_back({{DataTypes::ColumnsRoles::ResourceRole, trackUrl},
{DataTypes::ColumnsRoles::TitleRole, trackUrl.fileName()}});
const auto &trackUrl = std::get<2>(oneTrackUrl);
auto newEntry = MediaPlayListEntry(trackUrl);
newEntry.mEntryType = ElisaUtils::FileName;
d->mData.push_back(newEntry);
if (trackUrl.isValid()) {
if (trackUrl.isLocalFile()) {
d->mTrackData.push_back({{DataTypes::ColumnsRoles::ResourceRole, trackUrl}});
auto entryString = trackUrl.toLocalFile();
QFileInfo newTrackFile(entryString);
if (newTrackFile.exists()) {
d->mData.last().mIsValid = true;
}
Q_EMIT newUrlInList(trackUrl, newEntry.mEntryType);
} else {
d->mTrackData.push_back({});
d->mTrackData.push_back({{DataTypes::ColumnsRoles::ResourceRole, trackUrl},
{DataTypes::ColumnsRoles::TitleRole, trackUrl.fileName()}});
d->mData.last().mIsValid = true;
}
break;
}
case ElisaUtils::Album:
case ElisaUtils::Artist:
case ElisaUtils::Genre:
case ElisaUtils::Lyricist:
case ElisaUtils::Composer:
case ElisaUtils::Unknown:
break;
Q_EMIT newUrlInList(trackUrl, newEntry.mEntryType);
} else {
d->mTrackData.push_back({});
}
}
endInsertRows();
}
void MediaPlayList::enqueueOneEntry(const DataTypes::EntryData &entryData, ElisaUtils::PlayListEntryType type)
void MediaPlayList::enqueueOneEntry(const DataTypes::EntryData &entryData)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueOneEntry" << std::get<0>(entryData) << std::get<1>(entryData) << type;
if (!std::get<0>(entryData).isEmpty() || !std::get<1>(entryData).isEmpty()) {
if (!std::get<0>(entryData).isEmpty() || !std::get<1>(entryData).isEmpty() || !std::get<2>(entryData).isEmpty()) {
beginInsertRows(QModelIndex(), d->mData.size(), d->mData.size());
d->mData.push_back(MediaPlayListEntry{std::get<0>(entryData).databaseId(), std::get<1>(entryData), type});
const auto &data = std::get<0>(entryData);
switch (data.elementType())
{
case ElisaUtils::Track:
case ElisaUtils::Radio:
d->mTrackData.push_back(static_cast<const DataTypes::TrackDataType&>(data));
break;
default:
if (!std::get<0>(entryData).databaseId() && std::get<2>(entryData).isValid()) {
auto newEntry = MediaPlayListEntry{std::get<2>(entryData)};
newEntry.mEntryType = ElisaUtils::FileName;
d->mData.push_back(std::move(newEntry));
d->mTrackData.push_back({});
} else {
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueOneEntry" << std::get<0>(entryData) << std::get<1>(entryData) << std::get<0>(entryData).elementType();
d->mData.push_back(MediaPlayListEntry{std::get<0>(entryData).databaseId(), std::get<1>(entryData), std::get<0>(entryData).elementType()});
const auto &data = std::get<0>(entryData);
switch (data.elementType())
{
case ElisaUtils::Track:
case ElisaUtils::Radio:
d->mTrackData.push_back(static_cast<const DataTypes::TrackDataType&>(data));
break;
default:
d->mTrackData.push_back({});
}
}
if (std::get<2>(entryData).isValid()) {
Q_EMIT newUrlInList(std::get<2>(entryData), std::get<0>(entryData).elementType());
} else {
Q_EMIT newEntryInList(std::get<0>(entryData).databaseId(), std::get<1>(entryData), std::get<0>(entryData).elementType());
}
Q_EMIT newEntryInList(std::get<0>(entryData).databaseId(), std::get<1>(entryData), type);
endInsertRows();
}
}
void MediaPlayList::enqueueMultipleEntries(const DataTypes::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type)
void MediaPlayList::enqueueMultipleEntries(const DataTypes::EntryDataList &entriesData)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueMultipleEntries" << entriesData.size() << type;
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueMultipleEntries" << entriesData.size();
beginInsertRows(QModelIndex(), d->mData.size(), d->mData.size() + entriesData.size() - 1);
for (const auto &entryData : entriesData) {
......@@ -414,7 +409,7 @@ void MediaPlayList::enqueueMultipleEntries(const DataTypes::EntryDataList &entri
d->mData.push_back(MediaPlayListEntry{std::get<2>(entryData)});
d->mTrackData.push_back({});
} else {
d->mData.push_back(MediaPlayListEntry{std::get<0>(entryData).databaseId(), std::get<1>(entryData), type});
d->mData.push_back(MediaPlayListEntry{std::get<0>(entryData).databaseId(), std::get<1>(entryData), std::get<0>(entryData).elementType()});
const auto &data = std::get<0>(entryData);
switch (data.elementType())
{
......@@ -427,9 +422,9 @@ void MediaPlayList::enqueueMultipleEntries(const DataTypes::EntryDataList &entri
}
}
if (std::get<2>(entryData).isValid()) {
Q_EMIT newUrlInList(std::get<2>(entryData), type);
Q_EMIT newUrlInList(std::get<2>(entryData), std::get<0>(entryData).elementType());
} else {
Q_EMIT newEntryInList(std::get<0>(entryData).databaseId(), std::get<1>(entryData), type);
Q_EMIT newEntryInList(std::get<0>(entryData).databaseId(), std::get<1>(entryData), std::get<0>(entryData).elementType());
}
}
endInsertRows();
......
......@@ -137,11 +137,11 @@ public Q_SLOTS:
void trackInError(const QUrl &sourceInError, QMediaPlayer::Error playerError);
void enqueueFilesList(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType);
void enqueueFilesList(const DataTypes::EntryDataList &newEntries);
void enqueueOneEntry(const DataTypes::EntryData &entryData, ElisaUtils::PlayListEntryType type);
void enqueueOneEntry(const DataTypes::EntryData &entryData);
void enqueueMultipleEntries(const DataTypes::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type);
void enqueueMultipleEntries(const DataTypes::EntryDataList &entriesData);
private:
......
......@@ -470,34 +470,32 @@ int MediaPlayListProxyModel::currentTrackRow() const
return d->mCurrentTrack.row();
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType)
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry)
{
enqueue(newEntry, databaseIdType, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
enqueue(newEntry, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType)
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries)
{
enqueue(newEntries, databaseIdType, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
enqueue(newEntries, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
}
void MediaPlayListProxyModel::enqueue(qulonglong newEntryDatabaseId,
const QString &newEntryTitle,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, newEntryDatabaseId}}, newEntryTitle, {}}, databaseIdType, enqueueMode, triggerPlay);
enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, newEntryDatabaseId}}, newEntryTitle, {}}, enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const QUrl &entryUrl, ElisaUtils::PlayListEntryType databaseIdType,
void MediaPlayListProxyModel::enqueue(const QUrl &entryUrl,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(DataTypes::EntryData{{}, {}, entryUrl}, databaseIdType, enqueueMode, triggerPlay);
enqueue(DataTypes::EntryData{{}, {}, entryUrl}, enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
......@@ -511,33 +509,10 @@ void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry,
}
}
switch (databaseIdType)
{
case ElisaUtils::Album:
case ElisaUtils::Artist:
case ElisaUtils::Genre:
d->mPlayListModel->enqueueOneEntry(newEntry, databaseIdType);
break;
case ElisaUtils::Track:
case ElisaUtils::Radio:
if (std::get<2>(newEntry).isValid()) {
d->mPlayListModel->enqueueFilesList({newEntry}, databaseIdType);
} else {
d->mPlayListModel->enqueueOneEntry(newEntry, databaseIdType);
}
break;
case ElisaUtils::FileName:
d->mPlayListModel->enqueueFilesList({newEntry}, databaseIdType);
break;
case ElisaUtils::Lyricist:
case ElisaUtils::Composer:
case ElisaUtils::Unknown:
break;
}
d->mPlayListModel->enqueueOneEntry(newEntry);
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
......@@ -555,25 +530,7 @@ void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries
}
}
switch (databaseIdType)
{
case ElisaUtils::Track:
case ElisaUtils::Radio:
d->mPlayListModel->enqueueMultipleEntries(newEntries, databaseIdType);
break;
case ElisaUtils::FileName:
d->mPlayListModel->enqueueFilesList(newEntries, databaseIdType);
break;
case ElisaUtils::Album:
case ElisaUtils::Artist:
case ElisaUtils::Genre:
d->mPlayListModel->enqueueMultipleEntries(newEntries, databaseIdType);
break;
case ElisaUtils::Lyricist:
case ElisaUtils::Composer:
case ElisaUtils::Unknown:
break;
}
d->mPlayListModel->enqueueMultipleEntries(newEntries);
}
void MediaPlayListProxyModel::trackInError(const QUrl &sourceInError, QMediaPlayer::Error playerError)
......@@ -777,9 +734,10 @@ void MediaPlayListProxyModel::loadPlayListLoaded()
clearPlayList();
for (int i = 0; i < d->mLoadPlaylist.mediaCount(); ++i) {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
enqueue(DataTypes::EntryData{{}, {}, d->mLoadPlaylist.media(i).canonicalUrl()}, ElisaUtils::FileName);
enqueue(DataTypes::EntryData{{{DataTypes::ElementTypeRole, ElisaUtils::Track}}, {}, d->mLoadPlaylist.media(i).canonicalUrl()});
#else
enqueue(DataTypes::EntryData{{}, {}, d->mLoadPlaylist.media(i).request().url()}, ElisaUtils::FileName);
qDebug() << "MediaPlayListProxyModel::loadPlayListLoaded()" << d->mLoadPlaylist.media(i).request().url();
enqueue(DataTypes::EntryData{{{DataTypes::ElementTypeRole, ElisaUtils::Track}}, {}, d->mLoadPlaylist.media(i).request().url()});
#endif
}
......@@ -867,7 +825,7 @@ void MediaPlayListProxyModel::enqueueDirectory(const QUrl &fileName, ElisaUtils:
enqueueDirectory(fileUrl, databaseIdType, ElisaUtils::AppendPlayList, triggerPlay, depth-1);
}
}
if (newFiles.size() != 0) enqueue(newFiles, databaseIdType, ElisaUtils::AppendPlayList, triggerPlay);
if (newFiles.size() != 0) enqueue(newFiles, ElisaUtils::AppendPlayList, triggerPlay);
}
#include "moc_mediaplaylistproxymodel.cpp"
......@@ -114,27 +114,23 @@ public:
public Q_SLOTS:
void enqueue(const DataTypes::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType);
void enqueue(const DataTypes::EntryData &newEntry);
void enqueue(const DataTypes::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType);
void enqueue(const DataTypes::EntryDataList &newEntries);
void enqueue(qulonglong newEntryDatabaseId, const QString &newEntryTitle,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(const QUrl &entryUrl,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(const DataTypes::EntryData &newEntry,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(const DataTypes::EntryDataList &newEntries,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
......
......@@ -97,7 +97,7 @@ void AbstractMediaProxyModel::disconnectPlayList()
{
if (mPlayList) {
disconnect(this, &AbstractMediaProxyModel::entriesToEnqueue,
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEntryType, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
}
}
......@@ -105,7 +105,7 @@ void AbstractMediaProxyModel::connectPlayList()
{
if (mPlayList) {
connect(this, &AbstractMediaProxyModel::entriesToEnqueue,
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEntryType, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
}
}
......
......@@ -76,7 +76,6 @@ Q_SIGNALS:
void playListChanged();
void entriesToEnqueue(const DataTypes::EntryDataList &newEntries,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
......
......@@ -56,7 +56,7 @@ void AllTracksProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMo
data(currentIndex, DataTypes::ColumnsRoles::TitleRole).toString(),
data(currentIndex, DataTypes::ColumnsRoles::ResourceRole).toUrl()});
}
Q_EMIT entriesToEnqueue(allTracks, ElisaUtils::Track, enqueueMode, triggerPlay);
Q_EMIT entriesToEnqueue(allTracks, enqueueMode, triggerPlay);
});
}
......
......@@ -240,19 +240,19 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
switch (d->mModelType)
{
case ElisaUtils::Track:
result = QVariant::fromValue(d->mAllTrackData[index.row()]);
result = QVariant::fromValue(static_cast<DataTypes::MusicDataType>(d->mAllTrackData[index.row()]));
break;
case ElisaUtils::Radio:
result = QVariant::fromValue(d->mAllRadiosData[index.row()]);
result = QVariant::fromValue(static_cast<DataTypes::MusicDataType>(d->mAllRadiosData[index.row()]));
break;
case ElisaUtils::Album:
result = QVariant::fromValue(d->mAllAlbumData[index.row()]);
result = QVariant::fromValue(static_cast<DataTypes::MusicDataType>(d->mAllAlbumData[index.row()]));
break;
case ElisaUtils::Artist:
result = QVariant::fromValue(d->mAllArtistData[index.row()]);
result = QVariant::fromValue(static_cast<DataTypes::MusicDataType>(d->mAllArtistData[index.row()]));
break;
case ElisaUtils::Genre:
result = QVariant::fromValue(d->mAllGenreData[index.row()]);
result = QVariant::fromValue(static_cast<DataTypes::MusicDataType>(d->mAllGenreData[index.row()]));
break;
case ElisaUtils::Lyricist:
case ElisaUtils::Composer:
......
......@@ -88,7 +88,6 @@ void FileBrowserProxyModel::enqueueToPlayList()
}
}
Q_EMIT filesToEnqueue(allTrackUrls,
ElisaUtils::FileName,
ElisaUtils::AppendPlayList,
ElisaUtils::DoNotTriggerPlay);
});
......@@ -106,7 +105,6 @@ void FileBrowserProxyModel::replaceAndPlayOfPlayList()
}
}
Q_EMIT filesToEnqueue(allTrackUrls,
ElisaUtils::FileName,
ElisaUtils::ReplacePlayList,
ElisaUtils::TriggerPlay);
});
......@@ -133,7 +131,7 @@ void FileBrowserProxyModel::disconnectPlayList()
{
if (mPlayList) {
disconnect(this, &FileBrowserProxyModel::filesToEnqueue,
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEntryType, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
}
}
......@@ -141,7 +139,7 @@ void FileBrowserProxyModel::connectPlayList()
{
if (mPlayList) {
connect(this, &FileBrowserProxyModel::filesToEnqueue,
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEntryType, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
mPlayList, static_cast<void(MediaPlayListProxyModel::*)(const DataTypes::EntryDataList&, ElisaUtils::PlayListEnqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay)>(&MediaPlayListProxyModel::enqueue));
}
}
......
......@@ -83,7 +83,6 @@ public Q_SLOTS:
Q_SIGNALS:
void filesToEnqueue(const DataTypes::EntryDataList &newFiles,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
......
......@@ -64,7 +64,7 @@ bool GridViewProxyModel::filterAcceptsRow(int source_row, const QModelIndex &sou
}
void GridViewProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
QtConcurrent::run(&mThreadPool, [=] () {
QReadLocker locker(&mDataLock);
......@@ -73,39 +73,10 @@ void GridViewProxyModel::genericEnqueueToPlayList(ElisaUtils::PlayListEnqueueMod
for (int rowIndex = 0, maxRowCount = rowCount(); rowIndex < maxRowCount; ++rowIndex) {
auto currentIndex = index(rowIndex, 0);
switch (mDataType)
{
case ElisaUtils::Radio:
case ElisaUtils::Track:
allData.push_back(DataTypes::EntryData{data(currentIndex, DataTypes::FullDataRole).value<DataTypes::TrackDataType>(),
data(currentIndex, Qt::DisplayRole).toString(), {}});
break;