Fix loading of track state (mute, hidden, locked)

parent 0de81d99
......@@ -67,7 +67,12 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
case tractor_type: {
// that is a double track
int tid;
ok = timeline->requestTrackInsertion(-1, tid, QString(), false, undo, redo, false);
bool audioTrack = track->get_int("kdenlive:audio_track") == 1;
ok = timeline->requestTrackInsertion(-1, tid, QString(), audioTrack, undo, redo, false);
int lockState = track->get_int("kdenlive:locked_track");
if (lockState > 0) {
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:locked_track"), QString::number(lockState));
}
Mlt::Tractor local_tractor(*track);
ok = ok && constructTrackFromMelt(timeline, tid, local_tractor, binIdCorresp, undo, redo);
break;
......@@ -78,8 +83,16 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
int tid;
Mlt::Playlist local_playlist(*track);
const QString trackName = local_playlist.get("kdenlive:track_name");
int audioTrack = local_playlist.get_int("kdenlive:audio_track");
ok = timeline->requestTrackInsertion(-1, tid, trackName, audioTrack == 1, undo, redo, false);
bool audioTrack = local_playlist.get_int("kdenlive:audio_track") == 1;
ok = timeline->requestTrackInsertion(-1, tid, trackName, audioTrack, undo, redo, false);
int muteState = track->get_int("hide");
if (muteState > 0 && (!audioTrack || (audioTrack && muteState != 1))) {
timeline->setTrackProperty(tid, QStringLiteral("hide"), QString::number(muteState));
}
int lockState = local_playlist.get_int("kdenlive:locked_track");
if (lockState > 0) {
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:locked_track"), QString::number(lockState));
}
ok = ok && constructTrackFromMelt(timeline, tid, local_playlist, binIdCorresp, undo, redo);
break;
}
......@@ -147,10 +160,15 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline,
if (!trackName.isEmpty()) {
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:track_name"), trackName.toUtf8().constData());
}
if (track.get_int("kdenlive:audio_track") == 1) {
bool audioTrack = track.get_int("kdenlive:audio_track") == 1;
if (audioTrack) {
// This is an audio track
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:audio_track"), QStringLiteral("1"));
}
int muteState = playlist.get_int("hide");
if (muteState > 0 && (!audioTrack || (audioTrack && muteState != 1))) {
timeline->setTrackProperty(tid, QStringLiteral("hide"), QString::number(muteState));
}
}
}
return true;
......
......@@ -591,9 +591,10 @@ void TrackModel::setProperty(const QString &name, const QString &value)
{
QWriteLocker locker(&m_lock);
m_track->set(name.toUtf8().constData(), value.toUtf8().constData());
if (name == QLatin1String("kdenlive:audio_track") && value.toInt() == 1) {
// Hide property mus be defined at playlist level or it won't be saved
if (name == QLatin1String("kdenlive:audio_track") || name == QLatin1String("hide")) {
for (int i = 0; i < 2; i++) {
m_playlists[i].set("hide", 1);
m_playlists[i].set(name.toUtf8().constData(), value.toInt());
}
}
}
......
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