Commit 738c36aa authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

fix initialisation of ContextView at start of Elisa

ensure the metadata model with be correctly initialised at application
start before playing any music or switching to some other views or
tracks
parent 87bed79e
......@@ -305,7 +305,7 @@ void ManageHeaderBar::notifyTrackTypeProperty()
{
auto newTrackTypeValue = mCurrentTrack.data(mTrackTypeIdRole).value<ElisaUtils::PlayListEntryType>();
if (mOldTrackType != newTrackTypeValue) {
Q_EMIT trackTypeRoleChanged();
Q_EMIT trackTypeChanged();
mOldTrackType = newTrackTypeValue;
}
......
......@@ -648,6 +648,7 @@ void MediaPlayListProxyModel::clearPlayList()
d->mPersistentSettingsForUndo = persistentState();
d->mCurrentPlayListPosition = -1;
d->mCurrentTrack = QPersistentModelIndex{};
notifyCurrentTrackChanged();
d->mPlayListModel->clearPlayList();
Q_EMIT clearPlayListPlayer();
Q_EMIT displayUndoNotification();
......
......@@ -423,10 +423,12 @@ void TrackMetadataModel::lyricsValueIsReady()
void TrackMetadataModel::initializeByIdAndUrl(ElisaUtils::PlayListEntryType type, qulonglong databaseId, const QUrl &url)
{
beginResetModel();
mFullData.clear();
mTrackData.clear();
mCoverImage.clear();
mFileUrl.clear();
endResetModel();
Q_EMIT lyricsChanged();
......
......@@ -334,19 +334,29 @@ FocusScope {
}
onDatabaseIdChanged: {
metaDataModel.initializeByIdAndUrl(trackType, databaseId, fileUrl)
if (ElisaApplication.musicManager && trackType !== undefined && databaseId !== 0) {
metaDataModel.initializeByIdAndUrl(trackType, databaseId, fileUrl)
}
}
onTrackTypeChanged: {
if (ElisaApplication.musicManager && trackType !== undefined && databaseId !== 0) {
metaDataModel.initializeByIdAndUrl(trackType, databaseId, fileUrl)
}
}
Connections {
target: ElisaApplication
function onMusicManagerChanged() {
metaDataModel.initializeByIdAndUrl(trackType, databaseId, fileUrl)
if (ElisaApplication.musicManager && trackType !== undefined && databaseId !== 0) {
metaDataModel.initializeByIdAndUrl(trackType, databaseId, fileUrl)
}
}
}
Component.onCompleted: {
if (ElisaApplication.musicManager) {
if (ElisaApplication.musicManager && trackType !== undefined && databaseId !== 0) {
metaDataModel.initializeByIdAndUrl(trackType, databaseId, fileUrl)
}
}
......
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