Commit 1ad28e8d authored by Sashmita Raghav's avatar Sashmita Raghav
Browse files

Add function to remove a subtitle from model

parent 1b68eb91
......@@ -321,3 +321,17 @@ void SubtitleModel::editSubtitle(GenTime startPos, QString newSubtitleText, GenT
emit model->dataChanged(model->index(row), model->index(row), QVector<int>() << SubtitleRole);
return;
}
void SubtitleModel::removeSubtitle(GenTime pos)
{
qDebug()<<"Deleting subtitle in model";
auto model = getModel();
if(model->m_subtitleList.count(pos) <= 0){
qDebug()<<"No Subtitle at pos in model";
return;
}
int row = static_cast<int>(std::distance(model->m_subtitleList.begin(), model->m_subtitleList.find(pos)));
model->beginRemoveRows(QModelIndex(), row, row);
model->m_subtitleList.erase(pos);
model->endRemoveRows();
}
......@@ -59,6 +59,9 @@ public:
*/
void editSubtitle(GenTime startPos, QString newSubtitleText, GenTime endPos);
/** @brief Remove subtitle at start position (pos) */
void removeSubtitle(GenTime pos);
public slots:
/** @brief Function that parses through a subtitle file */
void parseSubtitle();
......
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