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

remove enqueue methods from MediaPlayListProxyModel not called from HMI

parent a6983a65
This diff is collapsed.
......@@ -406,7 +406,9 @@ void MediaPlayList::enqueueMultipleEntries(const DataTypes::EntryDataList &entri
beginInsertRows(QModelIndex(), d->mData.size(), d->mData.size() + entriesData.size() - 1);
for (const auto &entryData : entriesData) {
if (!std::get<0>(entryData).databaseId() && std::get<2>(entryData).isValid()) {
d->mData.push_back(MediaPlayListEntry{std::get<2>(entryData)});
auto newEntry = MediaPlayListEntry{std::get<2>(entryData)};
newEntry.mEntryType = ElisaUtils::FileName;
d->mData.push_back(std::move(newEntry));
d->mTrackData.push_back({});
} else {
d->mData.push_back(MediaPlayListEntry{std::get<0>(entryData).databaseId(), std::get<1>(entryData), std::get<0>(entryData).elementType()});
......
......@@ -470,46 +470,20 @@ int MediaPlayListProxyModel::currentTrackRow() const
return d->mCurrentTrack.row();
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry)
{
enqueue(newEntry, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries)
{
enqueue(newEntries, ElisaUtils::PlayListEnqueueMode::AppendPlayList, ElisaUtils::PlayListEnqueueTriggerPlay::DoNotTriggerPlay);
}
void MediaPlayListProxyModel::enqueue(qulonglong newEntryDatabaseId,
const QString &newEntryTitle,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(DataTypes::EntryData{{{DataTypes::DatabaseIdRole, newEntryDatabaseId}}, newEntryTitle, {}}, enqueueMode, triggerPlay);
enqueue({{{{DataTypes::ElementTypeRole, ElisaUtils::Track}, {DataTypes::DatabaseIdRole, newEntryDatabaseId}}, newEntryTitle, {}}},
enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const QUrl &entryUrl,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(DataTypes::EntryData{{}, {}, entryUrl}, enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryData &newEntry,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
d->mTriggerPlay = triggerPlay;
if (enqueueMode == ElisaUtils::ReplacePlayList) {
if (rowCount() == 0) {
Q_EMIT hideUndoNotification();
} else {
clearPlayList();
}
}
d->mPlayListModel->enqueueOneEntry(newEntry);
enqueue({{{{DataTypes::ElementTypeRole, ElisaUtils::Track}}, {}, entryUrl}}, enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const DataTypes::EntryDataList &newEntries,
......@@ -732,15 +706,18 @@ void MediaPlayListProxyModel::loadPlayList(const QUrl &fileName)
void MediaPlayListProxyModel::loadPlayListLoaded()
{
clearPlayList();
auto newTracks = DataTypes::EntryDataList{};
for (int i = 0; i < d->mLoadPlaylist.mediaCount(); ++i) {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
enqueue(DataTypes::EntryData{{{DataTypes::ElementTypeRole, ElisaUtils::Track}}, {}, d->mLoadPlaylist.media(i).canonicalUrl()});
newTracks.push_back({{{{DataTypes::ElementTypeRole, ElisaUtils::FileName}}}, {}, d->mLoadPlaylist.media(i).canonicalUrl()});
#else
qDebug() << "MediaPlayListProxyModel::loadPlayListLoaded()" << d->mLoadPlaylist.media(i).request().url();
enqueue(DataTypes::EntryData{{{DataTypes::ElementTypeRole, ElisaUtils::Track}}, {}, d->mLoadPlaylist.media(i).request().url()});
newTracks.push_back({{{{DataTypes::ElementTypeRole, ElisaUtils::FileName}}}, {}, d->mLoadPlaylist.media(i).request().url()});
#endif
}
enqueue(newTracks, ElisaUtils::ReplacePlayList, ElisaUtils::DoNotTriggerPlay);
Q_EMIT persistentStateChanged();
d->mLoadPlaylist.clear();
......
......@@ -114,19 +114,11 @@ public:
public Q_SLOTS:
void enqueue(const DataTypes::EntryData &newEntry);
void enqueue(const DataTypes::EntryDataList &newEntries);
void enqueue(qulonglong newEntryDatabaseId, const QString &newEntryTitle,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(const QUrl &entryUrl,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(const DataTypes::EntryData &newEntry,
void enqueue(qulonglong newEntryDatabaseId, const QString &newEntryTitle,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay 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