Commit 3e7d908b authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '2004'

parents d0c15fe6 c3fa2d7e
Pipeline #17589 passed with stage
in 14 minutes and 1 second
......@@ -430,6 +430,25 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return QVariant();
}
void TimelineItemModel::setTrackName(int trackId, const QString &text)
{
QWriteLocker locker(&m_lock);
const QString &currentName = getTrackProperty(trackId, QStringLiteral("kdenlive:track_name")).toString();
if (text == currentName) {
return;
}
Fun undo_lambda = [this, trackId, currentName]() {
setTrackProperty(trackId, QStringLiteral("kdenlive:track_name"), currentName);
return true;
};
Fun redo_lambda = [this, trackId, text]() {
setTrackProperty(trackId, QStringLiteral("kdenlive:track_name"), text);
return true;
};
redo_lambda();
PUSH_UNDO(undo_lambda, redo_lambda, i18n("Edit item"));
}
void TimelineItemModel::setTrackProperty(int trackId, const QString &name, const QString &value)
{
std::shared_ptr<TrackModel> track = getTrackById(trackId);
......@@ -438,6 +457,9 @@ void TimelineItemModel::setTrackProperty(int trackId, const QString &name, const
bool updateMultiTrack = false;
if (name == QLatin1String("kdenlive:track_name")) {
roles.push_back(NameRole);
if (!track->isAudioTrack()) {
updateMultiTrack = true;
}
} else if (name == QLatin1String("kdenlive:locked_track")) {
roles.push_back(IsLockedRole);
} else if (name == QLatin1String("hide")) {
......
......@@ -83,6 +83,11 @@ public:
/* @brief Enabled/disabled a track's effect stack */
Q_INVOKABLE void setTrackStackEnabled(int tid, bool enable);
Q_INVOKABLE QVariant getTrackProperty(int tid, const QString &name) const;
/* @brief Sets a track name
@param trackId is of the track to alter
@param text is the new track name.
*/
Q_INVOKABLE void setTrackName(int trackId, const QString &text);
/** @brief returns the lower video track index in timeline.
**/
int getFirstVideoTrackIndex() const;
......
......@@ -472,7 +472,7 @@ Rectangle {
}
}*/
onEditingFinished: {
controller.setTrackProperty(trackId, "kdenlive:track_name", text)
controller.setTrackName(trackId, text)
visible = 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