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
ed9c7a4d
Commit
ed9c7a4d
authored
Nov 03, 2020
by
Sashmita Raghav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable deletion of subtitle clips from timeline by right clicking on them
parent
36a2cd5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
10 deletions
+27
-10
src/bin/model/subtitlemodel.cpp
src/bin/model/subtitlemodel.cpp
+4
-4
src/timeline2/view/qml/timeline.qml
src/timeline2/view/qml/timeline.qml
+12
-6
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+8
-0
src/timeline2/view/timelinecontroller.h
src/timeline2/view/timelinecontroller.h
+3
-0
No files found.
src/bin/model/subtitlemodel.cpp
View file @
ed9c7a4d
...
...
@@ -48,7 +48,7 @@ std::shared_ptr<SubtitleModel> SubtitleModel::getModel()
void
SubtitleModel
::
parseSubtitle
()
{
qDebug
()
<<
"Parsing started"
;
QString
filePath
=
"path_to_subtitle_file.srt"
;
QString
filePath
;
//
"path_to_subtitle_file.srt";
m_subFilePath
=
filePath
;
QString
start
,
end
,
comment
;
QString
timeLine
;
...
...
@@ -394,7 +394,7 @@ void SubtitleModel::moveSubtitle(GenTime oldPos, GenTime newPos)
QString
SubtitleModel
::
toJson
()
{
qDebug
()
<<
"to JSON"
;
//
qDebug()<< "to JSON";
QJsonArray
list
;
for
(
const
auto
&
subtitle
:
m_subtitleList
)
{
QJsonObject
currentSubtitle
;
...
...
@@ -411,12 +411,12 @@ QString SubtitleModel::toJson()
void
SubtitleModel
::
jsontoSubtitle
(
const
QString
&
data
)
{
QString
outFile
=
"path_to_temp_Subtitle.
ass"
;
QString
outFile
=
"path_to_temp_Subtitle.
srt"
;
// use srt format as default unless file is imported (m_subFilePath)
if
(
!
outFile
.
contains
(
".ass"
))
qDebug
()
<<
"srt file import"
;
// if imported file isn't .ass, it is .srt format
QFile
outF
(
outFile
);
qDebug
()
<<
"Import from JSON"
;
//
qDebug()<< "Import from JSON";
QWriteLocker
locker
(
&
m_lock
);
auto
json
=
QJsonDocument
::
fromJson
(
data
.
toUtf8
());
if
(
!
json
.
isArray
())
{
...
...
src/timeline2/view/qml/timeline.qml
View file @
ed9c7a4d
...
...
@@ -1505,17 +1505,23 @@ Rectangle {
property
double
delta
:
-
1
property
double
originalDuration
:
-
1
property
double
oldDelta
:
0
acceptedButtons
:
Qt
.
LeftButton
acceptedButtons
:
Qt
.
LeftButton
|
Qt
.
RightButton
cursorShape
:
(
pressed
?
Qt
.
ClosedHandCursor
:
Qt
.
PointingHandCursor
);
drag.target
:
subtitleBase
drag.axis
:
Drag
.
XAxis
onPressed
:
{
console
.
log
(
'
IT IS PRESSED
'
)
root
.
autoScrolling
=
false
oldStartX
=
mouseX
oldStartFrame
=
subtitleBase
.
x
originalDuration
=
subtitleBase
.
width
/
timeScale
console
.
log
(
"
originalDuration
"
,
originalDuration
)
if
(
mouse
.
button
==
Qt
.
RightButton
)
{
console
.
log
(
'
RIGHT BUTTON CLICKED
'
)
timeline
.
deleteSubtitle
(
subtitleBase
.
x
/
timeline
.
scaleFactor
)
}
else
{
root
.
autoScrolling
=
false
oldStartX
=
mouseX
oldStartFrame
=
subtitleBase
.
x
originalDuration
=
subtitleBase
.
width
/
timeScale
console
.
log
(
"
originalDuration
"
,
originalDuration
)
}
}
onPositionChanged
:
{
if
(
pressed
)
{
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
ed9c7a4d
...
...
@@ -3709,3 +3709,11 @@ void TimelineController::addSubtitle()
QString
text
=
"Add Text"
;
subtitleModel
->
addSubtitle
(
start
,
end
,
text
);
}
void
TimelineController
::
deleteSubtitle
(
int
frame
)
{
auto
subtitleModel
=
pCore
->
projectManager
()
->
current
()
->
getSubtitleModel
();
GenTime
start
(
frame
,
pCore
->
getCurrentFps
());
subtitleModel
->
removeSubtitle
(
start
);
return
;
}
\ No newline at end of file
src/timeline2/view/timelinecontroller.h
View file @
ed9c7a4d
...
...
@@ -562,7 +562,10 @@ 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
=
""
);
/** @brief Add subtitle clip at cursor's position in timeline */
Q_INVOKABLE
void
addSubtitle
();
/** @brief Delete subtitle clip with frame as start position*/
Q_INVOKABLE
void
deleteSubtitle
(
int
frame
);
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