Commit 2c02637c authored by Sashmita Raghav's avatar Sashmita Raghav

Add menu for subtitle clips

parent fc7b261c
Pipeline #40576 passed with stage
in 9 minutes and 49 seconds
......@@ -586,6 +586,10 @@ void MainWindow::init()
timelineRulerMenu->addAction(actionCollection()->action(QStringLiteral("add_project_note")));
timelineRulerMenu->addAction(actionCollection()->action(QStringLiteral("add_subtitle")));
//Timeline subtitle menu
QMenu *timelineSubtitleMenu = new QMenu(this);
timelineSubtitleMenu->addAction(actionCollection()->action(QStringLiteral("delete_subtitle_clip")));
// Timeline headers menu
QMenu *timelineHeadersMenu = new QMenu(this);
timelineHeadersMenu->addAction(actionCollection()->action(QStringLiteral("insert_track")));
......@@ -767,7 +771,7 @@ void MainWindow::init()
#ifdef USE_JOGSHUTTLE
new JogManager(this);
#endif
getMainTimeline()->setTimelineMenu(timelineClipMenu, compositionMenu, timelineMenu, guideMenu, timelineRulerMenu, actionCollection()->action(QStringLiteral("edit_guide")), timelineHeadersMenu, thumbsMenu);
getMainTimeline()->setTimelineMenu(timelineClipMenu, compositionMenu, timelineMenu, guideMenu, timelineRulerMenu, actionCollection()->action(QStringLiteral("edit_guide")), timelineHeadersMenu, thumbsMenu , timelineSubtitleMenu);
scmanager->slotCheckActiveScopes();
// m_messageLabel->setMessage(QStringLiteral("This is a beta version. Always backup your data"), MltError);
}
......@@ -1701,6 +1705,7 @@ void MainWindow::setupActions()
addAction(QStringLiteral("delete_all_guides"), i18n("Delete All Guides"), this, SLOT(slotDeleteAllGuides()),
QIcon::fromTheme(QStringLiteral("edit-delete")));
addAction(QStringLiteral("add_subtitle"), i18n("Add Subtitle"), this, SLOT(slotAddSubtitle()), QIcon::fromTheme(QStringLiteral("list-add")), Qt::SHIFT +Qt::Key_S);
addAction(QStringLiteral("delete_subtitle_clip"), i18n("Delete Subtitle"), this, SLOT(slotDeleteItem()), QIcon::fromTheme(QStringLiteral("edit-delete")));
m_saveAction = KStandardAction::save(pCore->projectManager(), SLOT(saveFile()), actionCollection());
m_saveAction->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
......
......@@ -509,6 +509,7 @@ private slots:
/** @brief Select target for current track */
void slotActivateTarget();
void slotEditSubtitle();
/** @brief Add subtitle clip to timeline */
void slotAddSubtitle();
signals:
......
......@@ -44,18 +44,12 @@ Item {
drag.minimumX: 0
onPressed: {
console.log('IT IS PRESSED')
if (mouse.button == Qt.RightButton) {
console.log('RIGHT BUTTON CLICKED')
timeline.deleteSubtitle(subtitleBase.x / timeline.scaleFactor, subtitleBase.x / timeline.scaleFactor + duration, subtitleEdit.text)
}
else {
root.autoScrolling = false
oldStartX = mouseX
oldStartFrame = subtitleBase.x
originalDuration = subtitleBase.width/timeScale
console.log("originalDuration",originalDuration)
controller.requestSubtitleSelection(model.startframe);
}
root.autoScrolling = false
oldStartX = mouseX
oldStartFrame = subtitleBase.x
originalDuration = subtitleBase.width/timeScale
console.log("originalDuration",originalDuration)
controller.requestSubtitleSelection(model.startframe);
}
onReleased: {
console.log('IT IS RELEASED')
......@@ -68,6 +62,12 @@ Item {
}
console.log("originalDuration after shifting",originalDuration)
}
onClicked: {
if (mouse.button == Qt.RightButton) {
//console.log('RIGHT BUTTON CLICKED')
root.showSubtitleClipMenu()
}
}
onDoubleClicked: {
parent.textEditBegin = true
}
......
......@@ -24,6 +24,7 @@ Rectangle {
signal zoomIn(bool onMouse)
signal zoomOut(bool onMouse)
signal processingDrag(bool dragging)
signal showSubtitleClipMenu()
FontMetrics {
id: fontMetrics
......
......@@ -115,7 +115,7 @@ const QMap<QString, QString> TimelineWidget::sortedItems(const QStringList &item
return sortedItems;
}
void TimelineWidget::setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *guideMenu, QMenu *timelineRulerMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu)
void TimelineWidget::setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *guideMenu, QMenu *timelineRulerMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu, QMenu *subtitleClipMenu)
{
m_timelineClipMenu = clipMenu;
m_timelineCompositionMenu = compositionMenu;
......@@ -125,6 +125,7 @@ void TimelineWidget::setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QM
m_headerMenu = headerMenu;
m_thumbsMenu = thumbsMenu;
m_headerMenu->addMenu(m_thumbsMenu);
m_timelineSubtitleClipMenu = subtitleClipMenu;
m_editGuideAcion = editGuideAction;
updateEffectFavorites();
updateTransitionFavorites();
......@@ -146,6 +147,7 @@ void TimelineWidget::setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QM
connect(m_timelineCompositionMenu, &QMenu::aboutToHide, this, &TimelineWidget::slotUngrabHack, Qt::DirectConnection);
connect(m_timelineRulerMenu, &QMenu::aboutToHide, this, &TimelineWidget::slotUngrabHack, Qt::DirectConnection);
connect(m_timelineMenu, &QMenu::aboutToHide, this, &TimelineWidget::slotUngrabHack, Qt::DirectConnection);
connect(m_timelineSubtitleClipMenu, &QMenu::aboutToHide, this, &TimelineWidget::slotUngrabHack, Qt::DirectConnection);
m_timelineClipMenu->addMenu(m_favEffects);
m_timelineClipMenu->addMenu(m_favCompositions);
......@@ -189,6 +191,7 @@ void TimelineWidget::setModel(const std::shared_ptr<TimelineItemModel> &model, M
connect(rootObject(), SIGNAL(showRulerMenu()), this, SLOT(showRulerMenu()));
connect(rootObject(), SIGNAL(showHeaderMenu()), this, SLOT(showHeaderMenu()));
connect(rootObject(), SIGNAL(showTargetMenu(int)), this, SLOT(showTargetMenu(int)));
connect(rootObject(), SIGNAL(showSubtitleClipMenu()), this, SLOT(showSubtitleClipMenu()));
m_proxy->setRoot(rootObject());
setVisible(true);
loading = false;
......@@ -351,6 +354,11 @@ void TimelineWidget::showTimelineMenu()
m_timelineMenu->popup(m_clickPos);
}
void TimelineWidget::showSubtitleClipMenu()
{
m_timelineSubtitleClipMenu->popup(m_clickPos);
}
void TimelineWidget::slotChangeZoom(int value, bool zoomOnMouse)
{
double pixelScale = QFontMetrics(font()).maxWidth() * 2;
......
......@@ -54,7 +54,7 @@ public:
/* @brief Give keyboard focus to timeline qml */
void focusTimeline();
/** @brief Initiate timeline clip context menu */
void setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *timelineRulerMenu, QMenu *guideMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu);
void setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *timelineRulerMenu, QMenu *guideMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu, QMenu *subtitleClipMenu);
bool loading;
void connectSubtitleModel();
bool showSubtitles=false;
......@@ -84,6 +84,7 @@ private slots:
void showTimelineMenu();
void showRulerMenu();
void showHeaderMenu();
void showSubtitleClipMenu();
private:
TimelineController *m_proxy;
......@@ -99,6 +100,7 @@ private:
QMenu *m_favEffects;
QMenu *m_favCompositions;
QAction *m_editGuideAcion;
QMenu *m_timelineSubtitleClipMenu;
static const int comboScale[];
std::unique_ptr<QSortFilterProxyModel> m_sortModel;
/* @brief Keep last scale before fit to restore it on second click */
......
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