Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

New timeline display option, you can now choose between A2,A1,V1,V2 and A1,V1,A2,V2

parent 023fd40d
......@@ -254,9 +254,9 @@
<default>0</default>
</entry>
<entry name="clipcornertype" type="Int">
<label>Timeline clip corners.</label>
<default>1</default>
<entry name="audiotracksbelow" type="Bool">
<label>Display audio tracks grouped below video tracks.</label>
<default>false</default>
</entry>
<entry name="raisepropsclips" type="Bool">
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="153" translationDomain="kdenlive">
<kpartgui name="kdenlive" version="155" translationDomain="kdenlive">
<MenuBar>
<Menu name="file" >
<Action name="dvd_wizard" />
......@@ -64,18 +64,17 @@
<Menu name="clip" ><text>Clip</text>
<Menu name="marker_menu" ><text>Markers</text>
<Action name="add_clip_marker" />
<Action name="add_marker_guide_quickly" />
<Action name="edit_clip_marker" />
<Action name="delete_clip_marker" />
<Action name="delete_all_clip_markers" />
</Menu>
<Action name="add_clip_marker" />
<Action name="add_marker_guide_quickly" />
<Action name="edit_clip_marker" />
<Action name="delete_clip_marker" />
<Action name="delete_all_clip_markers" />
</Menu>
<Action name="auto_transition" />
<Action name="split_audio" />
<Separator />
<Action name="clip_audio_and_video" />
<Action name="clip_video_only" />
<Action name="clip_audio_only" />
<Action name="clip_video_only" />
<Action name="clip_audio_only" />
</Menu>
<Menu name="timeline" ><text>Timeline</text>
......@@ -230,7 +229,7 @@
</MenuBar>
<ToolBar name="timelineToolBar" fullWidth="true" newline="true" noMerge="1" position="bottom">
<text>Timeline Toolbar</text>
<Action name="timeline_compositing" />
<Action name="timeline_settings" />
<Action name="timeline_mode" />
<Separator />
<Action name="use_timeline_zone_in_edit" />
......
......@@ -1018,6 +1018,31 @@ void MainWindow::setupActions()
connect(m_compositeAction, static_cast<void (KSelectAction::*)(QAction *)>(&KSelectAction::triggered), this, &MainWindow::slotUpdateCompositing);
addAction(QStringLiteral("timeline_compositing"), m_compositeAction);
QAction *splitView = new QAction(KoIconUtils::themedIcon(QStringLiteral("view-split-top-bottom")), i18n("Split Audio Tracks"), this);
addAction(QStringLiteral("timeline_view_split"), splitView);
splitView->setData(QVariant::fromValue(1));
splitView->setCheckable(true);
splitView->setChecked(KdenliveSettings::audiotracksbelow());
QAction *mixedView = new QAction(KoIconUtils::themedIcon(QStringLiteral("document-new")), i18n("Mixed Audio tracks"), this);
addAction(QStringLiteral("timeline_mixed_view"), mixedView);
mixedView->setData(QVariant::fromValue(0));
mixedView->setCheckable(true);
mixedView->setChecked(!KdenliveSettings::audiotracksbelow());
QActionGroup *clipTypeGroup = new QActionGroup(this);
clipTypeGroup->addAction(mixedView);
clipTypeGroup->addAction(splitView);
connect(clipTypeGroup, &QActionGroup::triggered, this, &MainWindow::slotUpdateTimelineView);
auto tlsettings = new QMenu(this);
tlsettings->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
tlsettings->addAction(m_compositeAction);
tlsettings->addAction(mixedView);
tlsettings->addAction(splitView);
addAction(QStringLiteral("timeline_settings"), tlsettings->menuAction());
m_timeFormatButton = new KSelectAction(QStringLiteral("00:00:00:00 / 00:00:00:00"), this);
m_timeFormatButton->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
m_timeFormatButton->addAction(i18n("hh:mm:ss:ff"));
......@@ -3080,6 +3105,13 @@ void MainWindow::slotUpdateClipType(QAction *action)
*/
}
void MainWindow::slotUpdateTimelineView(QAction *action)
{
int viewMode = action->data().toInt();
KdenliveSettings::setAudiotracksbelow(viewMode == 1);
getMainTimeline()->controller()->getModel()->_resetView();
}
void MainWindow::slotDvdWizard(const QString &url)
{
// We must stop the monitors since we create a new on in the dvd wizard
......
......@@ -393,6 +393,7 @@ private slots:
void slotSetAudioAlignReference();
void slotAlignAudio();
void slotUpdateClipType(QAction *action);
void slotUpdateTimelineView(QAction *action);
void slotShowTimeline(bool show);
void slotTranscode(const QStringList &urls = QStringList());
void slotTranscodeClip();
......
......@@ -217,7 +217,7 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
}
if (role == SortRole) {
if (isTrack(id)) {
return getTrackMltIndex(id);
return getTrackSortValue(id, KdenliveSettings::audiotracksbelow());
}
return id;
}
......
......@@ -262,6 +262,41 @@ int TimelineModel::getTrackMltIndex(int trackId) const
return getTrackPosition(trackId) + 1;
}
int TimelineModel::getTrackSortValue(int trackId, bool separated) const
{
if (separated) {
return getTrackPosition(trackId) + 1;
}
auto it = m_allTracks.end();
int aCount = 0;
int vCount = 0;
bool isAudio = false;
int trackPos = 0;
while (it != m_allTracks.begin()) {
--it;
bool audioTrack = (*it)->isAudioTrack();
if (audioTrack) {
aCount++;
} else {
vCount++;
}
if (trackId == (*it)->getId()) {
isAudio = audioTrack;
trackPos = audioTrack ? aCount : vCount;
}
}
int trackDiff = aCount - vCount;
if (trackDiff > 0) {
// more audio tracks
if (!isAudio) {
trackPos -= trackDiff;
} else if (trackPos > vCount) {
return -trackPos;
}
}
return isAudio ? ((aCount * trackPos) - 1) : (vCount + 1 - trackPos) * 2;
}
QList<int> TimelineModel::getLowerTracksId(int trackId, TrackType type) const
{
READ_LOCK();
......
......@@ -276,6 +276,11 @@ public:
/* @brief Returns the track's index in terms of mlt's internal representation
*/
int getTrackMltIndex(int trackId) const;
/* @brief Returns a sort position for tracks.
* @param separated: if true, the tracks will be sorted like: V2,V1,A1,A2
* Otherwise, the tracks will be sorted like V2,A2,V1,A1
*/
int getTrackSortValue(int trackId, bool separated) const;
/* @brief Returns the ids of the tracks below the given track in the order of the tracks
Returns an empty list if no track available
......
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