Commit d765c0b9 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix bug in subtitle deletion undo

Fixes #1035
parent 49db3a2f
...@@ -357,10 +357,10 @@ bool SubtitleModel::addSubtitle(int id, GenTime start, GenTime end, const QStrin ...@@ -357,10 +357,10 @@ bool SubtitleModel::addSubtitle(int id, GenTime start, GenTime end, const QStrin
qDebug()<<"already present in model"<<"string :"<<m_subtitleList[start].first<<" start time "<<start.frames(pCore->getCurrentFps())<<"end time : "<< m_subtitleList[start].second.frames(pCore->getCurrentFps()); qDebug()<<"already present in model"<<"string :"<<m_subtitleList[start].first<<" start time "<<start.frames(pCore->getCurrentFps())<<"end time : "<< m_subtitleList[start].second.frames(pCore->getCurrentFps());
return false; return false;
} }
int row = m_timeline->m_allSubtitles.size(); m_timeline->registerSubtitle(id, start, temporary);
int row = m_timeline->getSubtitleIndex(id);
beginInsertRows(QModelIndex(), row, row); beginInsertRows(QModelIndex(), row, row);
m_subtitleList[start] = {str, end}; m_subtitleList[start] = {str, end};
m_timeline->registerSubtitle(id, start, temporary);
endInsertRows(); endInsertRows();
addSnapPoint(start); addSnapPoint(start);
addSnapPoint(end); addSnapPoint(end);
...@@ -1003,7 +1003,7 @@ void SubtitleModel::jsontoSubtitle(const QString &data) ...@@ -1003,7 +1003,7 @@ void SubtitleModel::jsontoSubtitle(const QString &data)
minutes %= 60; minutes %= 60;
int milli_2 = millisec / 10; int milli_2 = millisec / 10;
QString startTimeString = QString("%1:%2:%3.%4") QString startTimeString = QString("%1:%2:%3.%4")
.arg(hours, 1, 10, QChar('0')) .arg(hours, 2, 10, QChar('0'))
.arg(minutes, 2, 10, QChar('0')) .arg(minutes, 2, 10, QChar('0'))
.arg(seconds, 2, 10, QChar('0')) .arg(seconds, 2, 10, QChar('0'))
.arg(milli_2,2,10,QChar('0')); .arg(milli_2,2,10,QChar('0'));
...@@ -1024,7 +1024,7 @@ void SubtitleModel::jsontoSubtitle(const QString &data) ...@@ -1024,7 +1024,7 @@ void SubtitleModel::jsontoSubtitle(const QString &data)
milli_2 = millisec / 10; // to limit ms to 2 digits (for .ass) milli_2 = millisec / 10; // to limit ms to 2 digits (for .ass)
QString endTimeString = QString("%1:%2:%3.%4") QString endTimeString = QString("%1:%2:%3.%4")
.arg(hours, 1, 10, QChar('0')) .arg(hours, 2, 10, QChar('0'))
.arg(minutes, 2, 10, QChar('0')) .arg(minutes, 2, 10, QChar('0'))
.arg(seconds, 2, 10, QChar('0')) .arg(seconds, 2, 10, QChar('0'))
.arg(milli_2,2,10,QChar('0')); .arg(milli_2,2,10,QChar('0'));
......
...@@ -1816,7 +1816,7 @@ bool TimelineModel::requestItemDeletion(int itemId, bool logUndo) ...@@ -1816,7 +1816,7 @@ bool TimelineModel::requestItemDeletion(int itemId, bool logUndo)
actionLabel = i18n("Delete Clip"); actionLabel = i18n("Delete Clip");
} else if (isComposition(itemId)) { } else if (isComposition(itemId)) {
actionLabel = i18n("Delete Composition"); actionLabel = i18n("Delete Composition");
} else if (isComposition(itemId)) { } else if (isSubTitle(itemId)) {
actionLabel = i18n("Delete Subtitle"); actionLabel = i18n("Delete Subtitle");
} }
} }
......
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