Commit 4d940f4e authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

allow to modify metadata from entries in playlist

parent 898bb5ab
......@@ -80,6 +80,7 @@ QHash<int, QByteArray> MediaPlayList::roleNames() const
roles[static_cast<int>(ColumnsRoles::AlbumIdRole)] = "albumId";
roles[static_cast<int>(ColumnsRoles::AlbumSectionRole)] = "albumSection";
roles[static_cast<int>(ColumnsRoles::ElementTypeRole)] = "entryType";
roles[static_cast<int>(ColumnsRoles::MetadataModifiableRole)] = "metadataModifiableRole";
return roles;
}
......@@ -130,6 +131,27 @@ QVariant MediaPlayList::data(const QModelIndex &index, int role) const
}
break;
}
case ColumnsRoles::MetadataModifiableRole:
switch (d->mData[index.row()].mEntryType)
{
case ElisaUtils::Album:
case ElisaUtils::Artist:
case ElisaUtils::Composer:
case ElisaUtils::Genre:
case ElisaUtils::Unknown:
case ElisaUtils::Lyricist:
case ElisaUtils::Container:
result = false;
break;
case ElisaUtils::Radio:
result = true;
break;
case ElisaUtils::FileName:
case ElisaUtils::Track:
result = d->mTrackData[index.row()].resourceURI().isLocalFile();
break;
}
break;
default:
const auto &trackData = d->mTrackData[index.row()];
auto roleEnum = static_cast<TrackDataType::key_type>(role);
......
......@@ -78,6 +78,7 @@ public:
CountRole,
IsPlayingRole,
AlbumSectionRole,
MetadataModifiableRole,
};
Q_ENUM(ColumnsRoles)
......
......@@ -44,7 +44,7 @@ ScrollView {
/* currently disabled animations due to display corruption
because of https://bugreports.qt.io/browse/QTBUG-49868
causing https://bugs.kde.org/show_bug.cgi?id=406524
and https://bugs.kde.org/show_bug.cgi?id=398093
and https://bugs.kde.org/show_bug.cgi?id=398093
add: Transition {
NumberAnimation {
property: "opacity";
......@@ -118,11 +118,12 @@ ScrollView {
isSingleDiscAlbum: model.isSingleDiscAlbum !== undefined ? model.isSingleDiscAlbum : true
isValid: model.isValid
isPlaying: model.isPlaying
metadataModifiableRole: model.metadataModifiableRole
onStartPlayback: scrollView.startPlayback()
onPausePlayback: scrollView.pausePlayback()
onRemoveFromPlaylist: scrollView.playListModel.removeRow(trackIndex)
onSwitchToTrack: scrollView.playListModel.switchTo(trackIndex)
onStartPlayback: playListView.startPlayback()
onPausePlayback: playListView.pausePlayback()
onRemoveFromPlaylist: playListView.playListModel.removeRow(trackIndex)
onSwitchToTrack: playListView.playListModel.switchTo(trackIndex)
onActiveFocusChanged: {
if (activeFocus && playListView.currentIndex !== index) {
......
......@@ -35,6 +35,7 @@ FocusScope {
property int discNumber
property int rating
property bool hasValidDiscNumber: true
property bool metadataModifiableRole: false
property bool simpleMode: false
signal startPlayback()
......@@ -63,7 +64,7 @@ FocusScope {
modelType: entryType
showTrackFileName: entryType !== ElisaUtils.Radio
showDeleteButton: entryType === ElisaUtils.Radio
editableMetadata: entryType === ElisaUtils.Radio
editableMetadata: playListEntry.metadataModifiableRole
onRejected: metadataLoader.active = false
}
......
......@@ -112,6 +112,7 @@ ScrollView {
isSingleDiscAlbum: model.isSingleDiscAlbum !== undefined ? model.isSingleDiscAlbum : true
isValid: model.isValid
isPlaying: model.isPlaying
metadataModifiableRole: model.metadataModifiableRole
}
}
}
......
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