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
256
Issues
256
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
47989cc1
Commit
47989cc1
authored
May 09, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow inserting several tracks in one step.
Related to
#382
parent
835ffc33
Pipeline
#19881
passed with stage
in 9 minutes and 13 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
48 deletions
+81
-48
src/timeline2/view/dialogs/trackdialog.cpp
src/timeline2/view/dialogs/trackdialog.cpp
+10
-0
src/timeline2/view/dialogs/trackdialog.h
src/timeline2/view/dialogs/trackdialog.h
+3
-0
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+23
-17
src/ui/addtrack_ui.ui
src/ui/addtrack_ui.ui
+45
-31
No files found.
src/timeline2/view/dialogs/trackdialog.cpp
View file @
47989cc1
...
...
@@ -39,7 +39,12 @@ TrackDialog::TrackDialog(const std::shared_ptr<TimelineItemModel> &model, int tr
buildCombo
();
connect
(
audio_track
,
&
QRadioButton
::
toggled
,
this
,
&
TrackDialog
::
buildCombo
);
connect
(
arec_track
,
&
QRadioButton
::
toggled
,
this
,
&
TrackDialog
::
buildCombo
);
connect
(
tracks_count
,
QOverload
<
int
>::
of
(
&
QSpinBox
::
valueChanged
),
[
this
]
(
int
count
)
{
tracks_count
->
setSuffix
(
count
>
1
?
i18n
(
" tracks"
)
:
i18n
(
" track"
));
track_name
->
setEnabled
(
count
==
1
);
});
if
(
deleteMode
)
{
tracks_count
->
setVisible
(
false
);
track_name
->
setVisible
(
false
);
video_track
->
setVisible
(
false
);
audio_track
->
setVisible
(
false
);
...
...
@@ -115,3 +120,8 @@ const QString TrackDialog::trackName() const
{
return
track_name
->
text
();
}
int
TrackDialog
::
tracksCount
()
const
{
return
tracks_count
->
value
();
}
src/timeline2/view/dialogs/trackdialog.h
View file @
47989cc1
...
...
@@ -48,6 +48,9 @@ public:
/** @brief: returns the newly created track name
*/
const
QString
trackName
()
const
;
/** @brief: returns the number of tracks to be inserted
*/
int
tracksCount
()
const
;
private:
int
m_trackIndex
;
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
47989cc1
...
...
@@ -585,32 +585,38 @@ void TimelineController::addTrack(int tid)
}
QPointer
<
TrackDialog
>
d
=
new
TrackDialog
(
m_model
,
tid
,
qApp
->
activeWindow
());
if
(
d
->
exec
()
==
QDialog
::
Accepted
)
{
int
newTid
;
bool
audioRecTrack
=
d
->
addRecTrack
();
bool
addAVTrack
=
d
->
addAVTrack
();
int
tracksCount
=
d
->
tracksCount
();
Fun
undo
=
[]()
{
return
true
;
};
Fun
redo
=
[]()
{
return
true
;
};
bool
result
=
m_model
->
requestTrackInsertion
(
d
->
selectedTrackPosition
(),
newTid
,
d
->
trackName
(),
d
->
addAudioTrack
(),
undo
,
redo
);
if
(
result
)
{
m_model
->
setTrackProperty
(
newTid
,
"kdenlive:timeline_active"
,
QStringLiteral
(
"1"
));
if
(
addAVTrack
)
{
int
newTid2
;
int
mirrorPos
=
0
;
int
mirrorId
=
m_model
->
getMirrorAudioTrackId
(
newTid
);
if
(
mirrorId
>
-
1
)
{
mirrorPos
=
m_model
->
getTrackMltIndex
(
mirrorId
);
bool
result
=
true
;
for
(
int
ix
=
0
;
ix
<
tracksCount
;
++
ix
)
{
int
newTid
;
result
=
m_model
->
requestTrackInsertion
(
d
->
selectedTrackPosition
(),
newTid
,
d
->
trackName
(),
d
->
addAudioTrack
(),
undo
,
redo
);
if
(
result
)
{
m_model
->
setTrackProperty
(
newTid
,
"kdenlive:timeline_active"
,
QStringLiteral
(
"1"
));
if
(
addAVTrack
)
{
int
newTid2
;
int
mirrorPos
=
0
;
int
mirrorId
=
m_model
->
getMirrorAudioTrackId
(
newTid
);
if
(
mirrorId
>
-
1
)
{
mirrorPos
=
m_model
->
getTrackMltIndex
(
mirrorId
);
}
result
=
m_model
->
requestTrackInsertion
(
mirrorPos
,
newTid2
,
d
->
trackName
(),
true
,
undo
,
redo
);
if
(
result
)
{
m_model
->
setTrackProperty
(
newTid2
,
"kdenlive:timeline_active"
,
QStringLiteral
(
"1"
));
}
}
result
=
m_model
->
requestTrackInsertion
(
mirrorPos
,
newTid2
,
d
->
trackName
(),
true
,
undo
,
redo
);
if
(
result
)
{
m_model
->
setTrackProperty
(
newTid2
,
"kdenlive:timeline_active"
,
QStringLiteral
(
"1"
));
if
(
audioRecTrack
)
{
m_model
->
setTrackProperty
(
newTid
,
"kdenlive:audio_rec"
,
QStringLiteral
(
"1"
));
}
}
if
(
audioRecTrack
)
{
m_model
->
setTrackProperty
(
newTid
,
"kdenlive:audio_rec"
,
QStringLiteral
(
"1"
));
}
else
{
break
;
}
}
if
(
result
)
{
pCore
->
pushUndo
(
undo
,
redo
,
addAVTrack
?
i18n
(
"Insert Tracks"
)
:
i18n
(
"Insert Track"
));
pCore
->
pushUndo
(
undo
,
redo
,
addAVTrack
||
tracksCount
>
1
?
i18n
(
"Insert Tracks"
)
:
i18n
(
"Insert Track"
));
}
else
{
pCore
->
displayMessage
(
i18n
(
"Could not insert track"
),
InformationMessage
,
500
);
undo
();
...
...
src/ui/addtrack_ui.ui
View file @
47989cc1
...
...
@@ -6,39 +6,29 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
496
</width>
<height>
1
68
</height>
<width>
611
</width>
<height>
1
94
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Insert track
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"KComboBox"
name=
"before_select"
>
<item
row=
"2"
column=
"0"
colspan=
"4"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<property
name=
"text"
>
<string>
Above
</string>
</property>
<widget
class=
"QLabel"
name=
"name_label"
>
<property
name=
"text"
>
<string>
Track name
</string>
</property>
</widget>
</item>
<item>
<property
name=
"text"
>
<string>
Under
</string>
</property>
<widget
class=
"QLineEdit"
name=
"track_name"
/>
</item>
</
widge
t>
</
layou
t>
</item>
<item
row=
"0"
column=
"
2
"
>
<item
row=
"0"
column=
"
3
"
>
<widget
class=
"KComboBox"
name=
"comboTracks"
/>
</item>
<item
row=
"1"
column=
"0"
colspan=
"
3
"
>
<item
row=
"1"
column=
"0"
colspan=
"
4
"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QRadioButton"
name=
"video_track"
>
...
...
@@ -86,17 +76,14 @@
</item>
</layout>
</item>
<item
row=
"
2
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"
name_
label"
>
<item
row=
"
0
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Track name
</string>
<string>
Insert
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
colspan=
"2"
>
<widget
class=
"QLineEdit"
name=
"track_name"
/>
</item>
<item
row=
"3"
column=
"1"
>
<item
row=
"3"
column=
"2"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -109,7 +96,20 @@
</property>
</spacer>
</item>
<item
row=
"3"
column=
"2"
>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QSpinBox"
name=
"tracks_count"
>
<property
name=
"suffix"
>
<string>
track
</string>
</property>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
<property
name=
"value"
>
<number>
1
</number>
</property>
</widget>
</item>
<item
row=
"3"
column=
"3"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -119,6 +119,20 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"KComboBox"
name=
"before_select"
>
<item>
<property
name=
"text"
>
<string>
Above
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Under
</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<customwidgets>
...
...
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