Commit 7b11f0a4 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

fix edition of radio metadata

parent f0779fb6
......@@ -138,54 +138,70 @@ QVariant EditableTrackMetadataModel::data(const QModelIndex &index, int role) co
}
break;
case RemovableFieldRole:
switch (currentKey)
switch (allTrackData().elementType())
{
case DataTypes::TitleRole:
case DataTypes::BitRateRole:
case DataTypes::ChannelsRole:
case DataTypes::ArtistRole:
case DataTypes::AlbumRole:
case DataTypes::AlbumArtistRole:
case DataTypes::TrackNumberRole:
case DataTypes::DiscNumberRole:
case DataTypes::RatingRole:
case DataTypes::GenreRole:
case DataTypes::LyricistRole:
case DataTypes::ComposerRole:
case DataTypes::CommentRole:
case DataTypes::YearRole:
case DataTypes::LyricsRole:
case DataTypes::SampleRateRole:
result = true;
case ElisaUtils::Track:
switch (currentKey)
{
case DataTypes::TitleRole:
case DataTypes::BitRateRole:
case DataTypes::ChannelsRole:
case DataTypes::ArtistRole:
case DataTypes::AlbumRole:
case DataTypes::AlbumArtistRole:
case DataTypes::TrackNumberRole:
case DataTypes::DiscNumberRole:
case DataTypes::RatingRole:
case DataTypes::GenreRole:
case DataTypes::LyricistRole:
case DataTypes::ComposerRole:
case DataTypes::CommentRole:
case DataTypes::YearRole:
case DataTypes::LyricsRole:
case DataTypes::SampleRateRole:
result = true;
break;
case DataTypes::LastPlayDate:
case DataTypes::PlayCounter:
case DataTypes::ImageUrlRole:
case DataTypes::DurationRole:
case DataTypes::SecondaryTextRole:
case DataTypes::ShadowForImageRole:
case DataTypes::ChildModelRole:
case DataTypes::StringDurationRole:
case DataTypes::IsValidAlbumArtistRole:
case DataTypes::AllArtistsRole:
case DataTypes::HighestTrackRating:
case DataTypes::IdRole:
case DataTypes::ParentIdRole:
case DataTypes::DatabaseIdRole:
case DataTypes::IsSingleDiscAlbumRole:
case DataTypes::ContainerDataRole:
case DataTypes::IsPartialDataRole:
case DataTypes::AlbumIdRole:
case DataTypes::HasEmbeddedCover:
case DataTypes::FileModificationTime:
case DataTypes::FirstPlayDate:
case DataTypes::PlayFrequency:
case DataTypes::ElementTypeRole:
case DataTypes::FullDataRole:
case DataTypes::IsDirectoryRole:
case DataTypes::IsPlayListRole:
case DataTypes::FilePathRole:
case DataTypes::ResourceRole:
result = false;
break;
}
break;
case DataTypes::LastPlayDate:
case DataTypes::PlayCounter:
case DataTypes::ImageUrlRole:
case DataTypes::DurationRole:
case DataTypes::SecondaryTextRole:
case DataTypes::ShadowForImageRole:
case DataTypes::ChildModelRole:
case DataTypes::StringDurationRole:
case DataTypes::IsValidAlbumArtistRole:
case DataTypes::AllArtistsRole:
case DataTypes::HighestTrackRating:
case DataTypes::IdRole:
case DataTypes::ParentIdRole:
case DataTypes::DatabaseIdRole:
case DataTypes::IsSingleDiscAlbumRole:
case DataTypes::ContainerDataRole:
case DataTypes::IsPartialDataRole:
case DataTypes::AlbumIdRole:
case DataTypes::HasEmbeddedCover:
case DataTypes::FileModificationTime:
case DataTypes::FirstPlayDate:
case DataTypes::PlayFrequency:
case DataTypes::ElementTypeRole:
case DataTypes::FullDataRole:
case DataTypes::IsDirectoryRole:
case DataTypes::IsPlayListRole:
case DataTypes::FilePathRole:
case DataTypes::ResourceRole:
case ElisaUtils::Radio:
case ElisaUtils::Album:
case ElisaUtils::Artist:
case ElisaUtils::Composer:
case ElisaUtils::Container:
case ElisaUtils::FileName:
case ElisaUtils::Genre:
case ElisaUtils::Lyricist:
case ElisaUtils::Unknown:
result = false;
break;
}
......
......@@ -43,6 +43,7 @@ FocusScope {
"showTrackFileName": entryType !== ElisaUtils.Radio,
"showDeleteButton": entryType === ElisaUtils.Radio,
"editableMetadata": true,
"canAddMoreMetadata": entryType !== ElisaUtils.Radio,
});
metadataLoader.active = true
}
......@@ -56,6 +57,7 @@ FocusScope {
"showTrackFileName": false,
"showDeleteButton": true,
"editableMetadata": true,
"canAddMoreMetadata": false,
});
metadataLoader.active = true
}
......
......@@ -47,6 +47,7 @@ FocusScope {
showTrackFileName: true
showDeleteButton: false
editableMetadata: false
canAddMoreMetadata: false
onRejected: metadataLoader.active = false;
}
......
......@@ -22,6 +22,7 @@ Window {
property bool editableMetadata
property bool isModifying: false
property bool isCreation: false
property bool canAddMoreMetadata: false
property alias showImage: metadataImage.visible
property alias showTrackFileName: fileNameRow.visible
property bool showDeleteButton: false
......@@ -140,7 +141,7 @@ Window {
spacing: 0
visible: (dialogStates.state === 'readWrite' || dialogStates.state === 'readWriteAndDirty' ||
dialogStates.state === 'create' || dialogStates.state === 'createAndDirty') && !realModel.isReadOnly
dialogStates.state === 'create' || dialogStates.state === 'createAndDirty') && !realModel.isReadOnly && canAddMoreMetadata
Item {
Layout.fillWidth: true
......
......@@ -65,6 +65,7 @@ FocusScope {
showTrackFileName: entryType !== ElisaUtils.Radio
showDeleteButton: entryType === ElisaUtils.Radio
editableMetadata: playListEntry.metadataModifiableRole
canAddMoreMetadata: entryType !== ElisaUtils.Radio
onRejected: metadataLoader.active = false
}
......
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