Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
259
Issues
259
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
24801001
Commit
24801001
authored
Nov 03, 2020
by
Sashmita Raghav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timeline ruler menu item to create subtitle clip
parent
46a5c8af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
0 deletions
+21
-0
src/mainwindow.cpp
src/mainwindow.cpp
+7
-0
src/mainwindow.h
src/mainwindow.h
+1
-0
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+12
-0
src/timeline2/view/timelinecontroller.h
src/timeline2/view/timelinecontroller.h
+1
-0
No files found.
src/mainwindow.cpp
View file @
24801001
...
...
@@ -581,6 +581,7 @@ void MainWindow::init()
timelineRulerMenu
->
addAction
(
actionCollection
()
->
action
(
QStringLiteral
(
"edit_guide"
)));
timelineRulerMenu
->
addMenu
(
guideMenu
);
timelineRulerMenu
->
addAction
(
actionCollection
()
->
action
(
QStringLiteral
(
"add_project_note"
)));
timelineRulerMenu
->
addAction
(
actionCollection
()
->
action
(
QStringLiteral
(
"add_subtitle"
)));
// Timeline headers menu
QMenu
*
timelineHeadersMenu
=
new
QMenu
(
this
);
...
...
@@ -1682,6 +1683,7 @@ void MainWindow::setupActions()
addAction
(
QStringLiteral
(
"edit_guide"
),
i18n
(
"Edit Guide"
),
this
,
SLOT
(
slotEditGuide
()),
QIcon
::
fromTheme
(
QStringLiteral
(
"document-properties"
)));
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
);
m_saveAction
=
KStandardAction
::
save
(
pCore
->
projectManager
(),
SLOT
(
saveFile
()),
actionCollection
());
m_saveAction
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-save"
)));
...
...
@@ -4139,6 +4141,11 @@ void MainWindow::slotEditSubtitle()
pCore
->
currentDoc
()
->
initializeSubtitles
(
m_subtitleModel
);
}
void
MainWindow
::
slotAddSubtitle
()
{
getCurrentTimeline
()
->
controller
()
->
addSubtitle
();
}
#ifdef DEBUG_MAINW
#undef DEBUG_MAINW
#endif
src/mainwindow.h
View file @
24801001
...
...
@@ -500,6 +500,7 @@ private slots:
/** @brief Select target for current track */
void
slotActivateTarget
();
void
slotEditSubtitle
();
void
slotAddSubtitle
();
signals:
Q_SCRIPTABLE
void
abortRenderJob
(
const
QString
&
url
);
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
24801001
...
...
@@ -3697,3 +3697,15 @@ void TimelineController::shiftSubtitle(int oldStartFrame, int newStartFrame, int
subtitleModel
->
removeSubtitle
(
oldStartPos
);
//first delete subtitle at old start position
subtitleModel
->
addSubtitle
(
newStartPos
,
endPos
,
text
);
//next, add a new subtitle at new start position
}
void
TimelineController
::
addSubtitle
()
{
int
startframe
=
pCore
->
getTimelinePosition
();
int
endframe
=
startframe
+
50
;
//create basic subtitle clip of default width
GenTime
start
(
startframe
,
pCore
->
getCurrentFps
());
GenTime
end
(
endframe
,
pCore
->
getCurrentFps
());
auto
subtitleModel
=
pCore
->
projectManager
()
->
current
()
->
getSubtitleModel
();
QString
text
=
"Add Text"
;
subtitleModel
->
addSubtitle
(
start
,
end
,
text
);
}
src/timeline2/view/timelinecontroller.h
View file @
24801001
...
...
@@ -562,6 +562,7 @@ public:
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
=
""
);
Q_INVOKABLE
void
addSubtitle
();
public
slots
:
void
resetView
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment