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

Ensure subtitle track is displayed when dropping a subtitle file in timeline.

Related to #1026
parent d343386a
......@@ -4350,10 +4350,7 @@ void MainWindow::slotEditSubtitle(QMap<QString, QString> subProperties)
void MainWindow::slotAddSubtitle(const QString &text)
{
if (pCore->getSubtitleModel() == nullptr || !KdenliveSettings::showSubtitles()) {
m_buttonSubtitleEditTool->setChecked(true);
slotEditSubtitle();
}
showSubtitleTrack();
getCurrentTimeline()->controller()->addSubtitle(-1, text);
}
......@@ -4367,12 +4364,17 @@ void MainWindow::slotLockSubtitle()
getCurrentTimeline()->controller()->switchSubtitleLock();
}
void MainWindow::slotImportSubtitle()
void MainWindow::showSubtitleTrack()
{
if (pCore->getSubtitleModel() == nullptr || !KdenliveSettings::showSubtitles()) {
slotEditSubtitle();
m_buttonSubtitleEditTool->setChecked(true);
slotEditSubtitle();
}
}
void MainWindow::slotImportSubtitle()
{
showSubtitleTrack();
getCurrentTimeline()->controller()->importSubtitle();
}
......
......@@ -316,6 +316,8 @@ public slots:
void slotTranscode(const QStringList &urls = QStringList());
/** @brief Add subtitle clip to timeline */
void slotAddSubtitle(const QString &text = QString());
/** @brief Ensure subtitle track is displayed */
void showSubtitleTrack();
private slots:
/** @brief Shows the shortcut dialog. */
......
......@@ -3811,6 +3811,7 @@ void TimelineController::urlDropped(QStringList droppedFile, int frame, int tid)
qDebug()<<"=== GOT DROPPED FILED: "<<droppedFile<<"\n======";
if (droppedFile.first().endsWith(QLatin1String(".ass")) || droppedFile.first().endsWith(QLatin1String(".srt"))) {
// Subtitle dropped, import
pCore->window()->showSubtitleTrack();
importSubtitle(droppedFile.first());
} else {
finishRecording(QUrl(droppedFile.first()).toLocalFile());
......
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