Commit 0b973ddb authored by Sashmita Raghav's avatar Sashmita Raghav
Browse files

Add function to enable subtitle clips' movement in subtitle track

parent 24a7169a
...@@ -3661,13 +3661,28 @@ void TimelineController::editSubtitle(int startFrame, QString text, int endFrame ...@@ -3661,13 +3661,28 @@ void TimelineController::editSubtitle(int startFrame, QString text, int endFrame
GenTime startPos(startFrame, pCore->getCurrentFps()); GenTime startPos(startFrame, pCore->getCurrentFps());
GenTime endPos(endFrame, pCore->getCurrentFps()); GenTime endPos(endFrame, pCore->getCurrentFps());
subtitleModel->editSubtitle(startPos, text, endPos); subtitleModel->editSubtitle(startPos, text, endPos);
return;
} }
void TimelineController::moveSubtitle(int oldStartFrame, int newStartFrame) 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(); auto subtitleModel = pCore->projectManager()->current()->getSubtitleModel();
GenTime oldStartPos(oldStartFrame, pCore->getCurrentFps()); GenTime oldStartPos(oldStartFrame, pCore->getCurrentFps());
GenTime newStartPos(newStartFrame, pCore->getCurrentFps()); GenTime newStartPos(newStartFrame, pCore->getCurrentFps());
subtitleModel->moveSubtitle(oldStartPos, newStartPos); 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
} }
...@@ -555,8 +555,10 @@ public: ...@@ -555,8 +555,10 @@ public:
QPoint selectionInOut() const; QPoint selectionInOut() const;
/** @brief Edit the subtitle text and/or end timings */ /** @brief Edit the subtitle text and/or end timings */
Q_INVOKABLE void editSubtitle(int startFrame, QString text, int endFrame); 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); 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: public slots:
void resetView(); 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