Commit 9e0eb15e authored by Sashmita Raghav's avatar Sashmita Raghav
Browse files

Enable visibility of subtitle track according to state of subtitle toolbar button

parent 3be563bf
......@@ -4128,6 +4128,7 @@ void MainWindow::slotEditSubtitle()
std::shared_ptr<SubtitleModel> m_subtitleModel;
m_subtitleModel.reset(new SubtitleModel(getMainTimeline()->controller()->tractor(),this));
pCore->currentDoc()->initializeSubtitles(m_subtitleModel);
getMainTimeline()->connectSubtitleModel();
}
void MainWindow::slotAddSubtitle()
......
......@@ -306,6 +306,7 @@ Rectangle {
property double dar: 16/9
property bool paletteUnchanged: true
property int maxLabelWidth: 20 * root.baseUnit * Math.sqrt(root.timeScale)
property bool showSubtitles: false
onSeekingFinishedChanged : {
playhead.opacity = seekingFinished ? 1 : 0.5
......@@ -1072,7 +1073,7 @@ Rectangle {
Item {
id: subtitleTrack
width: tracksContainerArea.width
height: 50
height: showSubtitles? 50 : 0
Repeater { id: subtitlesRepeater; model: subtitleDelegateModel }
}
Item {
......@@ -1554,7 +1555,7 @@ Rectangle {
parent.textEditBegin = false
}
anchors.fill: parent
visible: text != "" && timeScale >= 6
visible: timeScale >= 6
enabled: parent.textEditBegin
text: model.subtitle
height: subtitleBase.height
......
......@@ -478,3 +478,19 @@ bool TimelineWidget::eventFilter(QObject *object, QEvent *event)
return QQuickWidget::eventFilter(object, event);
}
void TimelineWidget::connectSubtitleModel()
{
qDebug()<<"root context get sub model new function";
if (pCore->projectManager()->current()->getSubtitleModel().get() == nullptr) {
//qDebug()<<"null ptr here at root context";
return;
}
else
{
showSubtitles = !showSubtitles;
//qDebug()<<"null ptr NOT here at root context";
rootObject()->setProperty("showSubtitles",showSubtitles);
rootContext()->setContextProperty("subtitleModel", pCore->projectManager()->current()->getSubtitleModel().get());
}
}
\ No newline at end of file
......@@ -56,6 +56,8 @@ public:
/** @brief Initiate timeline clip context menu */
void setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *timelineRulerMenu, QMenu *guideMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu);
bool loading;
void connectSubtitleModel();
bool showSubtitles=false;
protected:
void mousePressEvent(QMouseEvent *event) override;
......
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