Commit 46a5c8af authored by Sashmita Raghav's avatar Sashmita Raghav
Browse files

Add button in timeline toolbar to enable subtitle editing

parent 1a743001
......@@ -411,7 +411,7 @@ QString SubtitleModel::toJson()
void SubtitleModel::jsontoSubtitle(const QString &data)
{
QString filePath= "path_to_subtitle_file.srt";
QString outFile = "path_to_subtitle_file.ass";
if (!outFile.contains(".ass"))
return; // this function currrently writes in ass file format only
QFile outF(outFile);
......
......@@ -280,6 +280,8 @@
<Separator />
<Action name="timeline_preview_button" />
<Action name="audiomixer_button" />
<Separator />
<Action name="subtitle_tool" />
</ToolBar>
<ToolBar name="extraToolBar" >
<text>Extra Toolbar</text>
......
......@@ -21,6 +21,7 @@
#include "assets/assetpanel.hpp"
#include "bin/clipcreator.hpp"
#include "bin/generators/generators.h"
#include "bin/model/subtitlemodel.hpp"
#include "bin/projectclip.h"
#include "bin/projectfolder.h"
#include "bin/projectitemmodel.h"
......@@ -1106,6 +1107,12 @@ void MainWindow::setupActions()
m_timeFormatButton->setToolButtonPopupMode(QToolButton::InstantPopup);
addAction(QStringLiteral("timeline_timecode"), m_timeFormatButton);
m_buttonSubtitleEditTool = new QAction(QIcon::fromTheme(QStringLiteral("input-keyboard")), i18n("Edit Subtitle tool"), this);
m_buttonSubtitleEditTool->setCheckable(true);
m_buttonSubtitleEditTool->setChecked(false);
addAction(QStringLiteral("subtitle_tool"), m_buttonSubtitleEditTool);
connect(m_buttonSubtitleEditTool, &QAction::triggered, this, &MainWindow::slotEditSubtitle);
// create tools buttons
m_buttonSelectTool = new QAction(QIcon::fromTheme(QStringLiteral("cursor-arrow")), i18n("Selection tool"), this);
// toolbar->addAction(m_buttonSelectTool);
......@@ -4125,6 +4132,13 @@ void MainWindow::slotActivateTarget()
}
}
void MainWindow::slotEditSubtitle()
{
std::shared_ptr<SubtitleModel> m_subtitleModel;
m_subtitleModel.reset(new SubtitleModel(getMainTimeline()->controller()->tractor(),this));
pCore->currentDoc()->initializeSubtitles(m_subtitleModel);
}
#ifdef DEBUG_MAINW
#undef DEBUG_MAINW
#endif
......@@ -228,6 +228,7 @@ private:
QAction *m_playZone;
QAction *m_loopClip;
QAction *m_proxyClip;
QAction *m_buttonSubtitleEditTool;
QString m_theme;
KIconLoader *m_iconLoader;
KToolBar *m_timelineToolBar;
......@@ -498,6 +499,7 @@ private slots:
void slotActivateVideoTrackSequence();
/** @brief Select target for current track */
void slotActivateTarget();
void slotEditSubtitle();
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
......
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