Commit 8688a638 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

fix enqueing from the delegates

parent e9a6c06d
......@@ -470,13 +470,10 @@ int MediaPlayListProxyModel::currentTrackRow() const
return d->mCurrentTrack.row();
}
void MediaPlayListProxyModel::enqueue(qulonglong newEntryDatabaseId,
const QString &newEntryTitle,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
void MediaPlayListProxyModel::enqueue(const DataTypes::MusicDataType &newEntry, const QString &newEntryTitle,
ElisaUtils::PlayListEnqueueMode enqueueMode, ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue({{{{DataTypes::ElementTypeRole, ElisaUtils::Track}, {DataTypes::DatabaseIdRole, newEntryDatabaseId}}, newEntryTitle, {}}},
enqueueMode, triggerPlay);
enqueue({{newEntry, newEntryTitle, {}}}, enqueueMode, triggerPlay);
}
void MediaPlayListProxyModel::enqueue(const QUrl &entryUrl,
......
......@@ -118,7 +118,8 @@ public Q_SLOTS:
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(qulonglong newEntryDatabaseId, const QString &newEntryTitle,
void enqueue(const DataTypes::MusicDataType &newEntry,
const QString &newEntryTitle,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
......
......@@ -56,11 +56,11 @@ FocusScope {
contentModel: proxyModel
onEnqueue: elisa.mediaPlayListProxyModel.enqueue(databaseId, name, modelType,
onEnqueue: elisa.mediaPlayListProxyModel.enqueue(fullData, name,
ElisaUtils.AppendPlayList,
ElisaUtils.DoNotTriggerPlay)
onReplaceAndPlay: elisa.mediaPlayListProxyModel.enqueue(databaseId, name, modelType,
onReplaceAndPlay: elisa.mediaPlayListProxyModel.enqueue(fullData, name,
ElisaUtils.ReplacePlayList,
ElisaUtils.TriggerPlay)
......
......@@ -98,10 +98,12 @@ FocusScope {
isAlternateColor: (index % 2) === 1
detailedView: false
onEnqueue: elisa.mediaPlayListProxyModel.enqueue(url, ElisaUtils.AppendPlayList,
onEnqueue: elisa.mediaPlayListProxyModel.enqueue(model.fullData, model.display,
ElisaUtils.AppendPlayList,
ElisaUtils.DoNotTriggerPlay)
onReplaceAndPlay: elisa.mediaPlayListProxyModel.enqueue(url, ElisaUtils.ReplacePlayList,
onReplaceAndPlay: elisa.mediaPlayListProxyModel.enqueue(model.fullData, model.display,
ElisaUtils.ReplacePlayList,
ElisaUtils.TriggerPlay)
......@@ -144,10 +146,12 @@ FocusScope {
isSelected: listView.currentIndex === index
isAlternateColor: (index % 2) === 1
onEnqueue: elisa.mediaPlayListProxyModel.enqueue(url, ElisaUtils.AppendPlayList,
onEnqueue: elisa.mediaPlayListProxyModel.enqueue(model.fullData, model.display,
ElisaUtils.AppendPlayList,
ElisaUtils.DoNotTriggerPlay)
onReplaceAndPlay: elisa.mediaPlayListProxyModel.enqueue(url, ElisaUtils.ReplacePlayList,
onReplaceAndPlay: elisa.mediaPlayListProxyModel.enqueue(model.fullData, model.display,
ElisaUtils.ReplacePlayList,
ElisaUtils.TriggerPlay)
onClicked: {
......
......@@ -29,8 +29,8 @@ FocusScope {
property bool showPlayButton: true
property bool showEnqueueButton: true
signal enqueue(var databaseId, var name, var url)
signal replaceAndPlay(var databaseId, var name, var url)
signal enqueue()
signal replaceAndPlay()
signal open()
signal selected()
......@@ -174,9 +174,9 @@ FocusScope {
Accessible.description: ToolTip.text
Accessible.onPressAction: onClicked
onClicked: replaceAndPlay(databaseId, mainText, fileUrl)
Keys.onReturnPressed: replaceAndPlay(databaseId, mainText, fileUrl)
Keys.onEnterPressed: replaceAndPlay(databaseId, mainText, fileUrl)
onClicked: replaceAndPlay()
Keys.onReturnPressed: replaceAndPlay()
Keys.onEnterPressed: replaceAndPlay()
visible: showPlayButton
......@@ -199,9 +199,9 @@ FocusScope {
Accessible.description: ToolTip.text
Accessible.onPressAction: onClicked
onClicked: enqueue(databaseId, mainText, fileUrl)
Keys.onReturnPressed: enqueue(databaseId, mainText, fileUrl)
Keys.onEnterPressed: enqueue(databaseId, mainText, fileUrl)
onClicked: enqueue()
Keys.onReturnPressed: enqueue()
Keys.onEnterPressed: enqueue()
visible: showEnqueueButton
......
......@@ -27,9 +27,9 @@ FocusScope {
property var stackView
property url defaultIcon
signal enqueue(int databaseId, string name)
signal replaceAndPlay(int databaseId, string name)
signal open(string innerMainTitle, string innerSecondaryTitle, url innerImage, int databaseId, var dataType)
signal enqueue(var fullData, string name)
signal replaceAndPlay(var fullData, string name)
signal open(string innerMainTitle, string innerSecondaryTitle, url innerImage, int databaseId, var dataType, var showDiscHeader)
signal goBack()
ColumnLayout {
......@@ -134,8 +134,8 @@ FocusScope {
delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText
entryType: model.dataType
onEnqueue: gridView.enqueue(databaseId, name)
onReplaceAndPlay: gridView.replaceAndPlay(databaseId, name)
onEnqueue: gridView.enqueue(model.fullData, model.display)
onReplaceAndPlay: gridView.replaceAndPlay(model.fullData, model.display)
onOpen: gridView.open(model.display, model.secondaryText,
(model && model.imageUrl && model.imageUrl.toString() !== "" ? model.imageUrl : defaultIcon),
model.databaseId, model.dataType)
......
......@@ -33,16 +33,16 @@ FocusScope {
property bool detailedView: true
signal clicked()
signal enqueue(var url, var entryType, var name)
signal replaceAndPlay(var url, var entryType, var name)
signal enqueue()
signal replaceAndPlay()
signal callOpenMetaDataView(var url, var entryType)
Accessible.role: Accessible.ListItem
Accessible.name: title
Accessible.description: title
Keys.onReturnPressed: enqueue(trackUrl, dataType, title)
Keys.onEnterPressed: enqueue(trackUrl, dataType, title)
Keys.onReturnPressed: enqueue()
Keys.onEnterPressed: enqueue()
property int singleLineHeight: 3 * Kirigami.Units.smallSpacing + Kirigami.Units.gridUnit
height: singleLineHeight + (detailedView ? Kirigami.Units.gridUnit : 0)
......@@ -69,7 +69,7 @@ FocusScope {
mediaTrack.clicked()
}
onDoubleClicked: enqueue(trackUrl, dataType, title)
onDoubleClicked: enqueue()
RowLayout {
anchors.fill: parent
......@@ -261,7 +261,7 @@ FocusScope {
text: i18nc("Enqueue current track", "Enqueue")
icon.name: "list-add"
onClicked: enqueue(trackUrl, dataType, title)
onClicked: enqueue()
}
FlatButtonWithToolTip {
......@@ -272,7 +272,7 @@ FocusScope {
text: i18nc("Clear play list and enqueue current track", "Play Now and Replace Play List")
icon.name: "media-playback-start"
onClicked: replaceAndPlay(trackUrl, dataType, title)
onClicked: replaceAndPlay()
}
}
}
......
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