Commit 17a9ef37 authored by Sashmita Raghav's avatar Sashmita Raghav

Add function to enable subtitle clips' movement in subtitle track

parent 27b5e631
......@@ -3672,13 +3672,28 @@ void TimelineController::editSubtitle(int startFrame, QString text, int endFrame
GenTime startPos(startFrame, pCore->getCurrentFps());
GenTime endPos(endFrame, pCore->getCurrentFps());
subtitleModel->editSubtitle(startPos, text, endPos);
return;
}
void TimelineController::moveSubtitle(int oldStartFrame, int newStartFrame)
{
qDebug()<<"Moving existing subtitle in controller from"<<oldStartFrame<<" to "<<newStartFrame;
qDebug()<<"Moving existing subtitle start position in controller from"<<oldStartFrame<<" to "<<newStartFrame;
auto subtitleModel = pCore->projectManager()->current()->getSubtitleModel();
GenTime oldStartPos(oldStartFrame, pCore->getCurrentFps());
GenTime newStartPos(newStartFrame, pCore->getCurrentFps());
subtitleModel->moveSubtitle(oldStartPos, newStartPos);
return;
}
void TimelineController::shiftSubtitle(int oldStartFrame, int newStartFrame, int endFrame, QString text)
{
qDebug()<<"Shifting existing subtitle in controller from"<<oldStartFrame<<" to "<<newStartFrame;
auto subtitleModel = pCore->projectManager()->current()->getSubtitleModel();
GenTime oldStartPos(oldStartFrame, pCore->getCurrentFps());
GenTime newStartPos(newStartFrame, pCore->getCurrentFps());
GenTime endPos(endFrame, pCore->getCurrentFps());
subtitleModel->removeSubtitle(oldStartPos); //first delete subtitle at old start position
subtitleModel->addSubtitle(newStartPos,endPos,text); //next, add a new subtitle at new start position
}
......@@ -558,8 +558,10 @@ public:
QPoint selectionInOut() const;
/** @brief Edit the subtitle text and/or end timings */
Q_INVOKABLE void editSubtitle(int startFrame, QString text, int endFrame);
/** @brief Move position of subtitle */
/** @brief Move position of subtitle start timing */
Q_INVOKABLE void moveSubtitle(int oldStartFrame, int newStartFrame);
/** @brief Shift subtitle clips without changing the clip duration */
Q_INVOKABLE void shiftSubtitle(int oldStartFrame, int newStartFrame, int endFrame=0, QString text="");
public slots:
void resetView();
......
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