From: Jean-Baptiste M. <nu...@kd...> - 2017-05-21 17:08:10
|
Git commit 60e2af13103169519a1b57ba495dc583920773ed by Jean-Baptiste Mardelle. Committed on 21/05/2017 at 17:07. Pushed by mardelle into branch 'refactoring_timeline'. Fix recognition of audio tracks, port track count method M +1 -1 src/mainwindow.cpp M +1 -0 src/monitor/view/MonitorRuler.qml M +4 -0 src/timeline2/model/builders/meltBuilder.cpp M +16 -0 src/timeline2/view/qml/Timeline.js M +4 -0 src/timeline2/view/qml/timeline.qml M +11 -0 src/timeline2/view/timelinecontroller.cpp M +3 -0 src/timeline2/view/timelinecontroller.h M +5 -0 src/timeline2/view/timelinewidget.cpp M +1 -0 src/timeline2/view/timelinewidget.h https://commits.kde.org/kdenlive/60e2af13103169519a1b57ba495dc583920773ed diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 76491e0e0..2a871406c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1696,7 +1696,7 @@ void MainWindow::slotRefreshProfiles() void MainWindow::slotEditProjectSettings() { KdenliveDoc *project = pCore->projectManager()->current(); - QPoint p = pCore->projectManager()->currentTimeline()->getTracksCount(); + QPoint p = m_timelineTabs->getCurrentTimeline()->getTracksCount(); ProjectSettings *w = new ProjectSettings(project, project->metadata(), pCore->projectManager()->currentTimeline()->projectView()->extractTransitionsLumas(), p.x(), p.y(), project->projectTempFolder(), true, !project->isModified(), this); diff --git a/src/monitor/view/MonitorRuler.qml b/src/monitor/view/MonitorRuler.qml index aa5da1527..e33566b76 100644 --- a/src/monitor/view/MonitorRuler.qml +++ b/src/monitor/view/MonitorRuler.qml @@ -8,6 +8,7 @@ import QtQuick 2.4 Rectangle { id: ruler color: activePalette.window + opacity: 0.8 // frame ticks Repeater { diff --git a/src/timeline2/model/builders/meltBuilder.cpp b/src/timeline2/model/builders/meltBuilder.cpp index 062f3f0b3..f9a793e11 100644 --- a/src/timeline2/model/builders/meltBuilder.cpp +++ b/src/timeline2/model/builders/meltBuilder.cpp @@ -140,6 +140,10 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline, if (!trackName.isEmpty()) { timeline->setTrackProperty(tid, QStringLiteral("kdenlive:track_name"), trackName.toUtf8().constData()); } + if (track.get_int("kdenlive:audio_track") == 1) { + // This is an audio track + timeline->setTrackProperty(tid, QStringLiteral("kdenlive:audio_track"), QStringLiteral("1")); + } } } return true; diff --git a/src/timeline2/view/qml/Timeline.js b/src/timeline2/view/qml/Timeline.js index 011b30c54..d925a10d4 100644 --- a/src/timeline2/view/qml/Timeline.js +++ b/src/timeline2/view/qml/Timeline.js @@ -59,6 +59,22 @@ function getTrackYFromId(id) { return result } +function getTracksList() { + var result = new Array(2); + var aTracks = 0 + var vTracks = 0 + for (var i = 0; i < trackHeaderRepeater.count; i++) { + if (trackHeaderRepeater.itemAt(i).isAudio) { + aTracks ++; + } else { + vTracks ++; + } + } + result[0] = aTracks; + result[1] = vTracks; + return result +} + function acceptDrop(xml) { var position = Math.round((dropTarget.x + scrollView.flickableItem.contentX - headerWidth) / timeline.scaleFactor) timeline.insertClip(currentTrack, position, xml) diff --git a/src/timeline2/view/qml/timeline.qml b/src/timeline2/view/qml/timeline.qml index 207acfb7b..1277c986e 100644 --- a/src/timeline2/view/qml/timeline.qml +++ b/src/timeline2/view/qml/timeline.qml @@ -58,6 +58,10 @@ Rectangle { return Logic.getTrackYFromId(a_track) } + function getTracksCount() { + return Logic.getTracksList() + } + function getTrackColor(audio, header) { var col = activePalette.alternateBase if (audio) { diff --git a/src/timeline2/view/timelinecontroller.cpp b/src/timeline2/view/timelinecontroller.cpp index c4a20e59f..db9a782f7 100644 --- a/src/timeline2/view/timelinecontroller.cpp +++ b/src/timeline2/view/timelinecontroller.cpp @@ -482,3 +482,14 @@ void TimelineController::seekCurrentClip(bool seekToEnd) } } +QPoint TimelineController::getTracksCount() const +{ + int audioTracks = 0; + int videoTracks = 0; + QVariant returnedValue; + QMetaObject::invokeMethod(m_root, "getTracksCount", + Q_RETURN_ARG(QVariant, returnedValue)); + QVariantList tracks = returnedValue.toList(); + QPoint p(tracks.at(0).toInt(), tracks.at(1).toInt()); + return p; +} diff --git a/src/timeline2/view/timelinecontroller.h b/src/timeline2/view/timelinecontroller.h index 96353a9e2..6309dd932 100644 --- a/src/timeline2/view/timelinecontroller.h +++ b/src/timeline2/view/timelinecontroller.h @@ -194,6 +194,9 @@ public: /* @brief Seeks to selected clip start / end */ void seekCurrentClip(bool seekToEnd = false); + /* @brief Returns the number of tracks (audioTrakcs, videoTracks) + */ + QPoint getTracksCount() const; public slots: void selectMultitrack(); diff --git a/src/timeline2/view/timelinewidget.cpp b/src/timeline2/view/timelinewidget.cpp index fd8f8eb8f..2a81a838d 100644 --- a/src/timeline2/view/timelinewidget.cpp +++ b/src/timeline2/view/timelinewidget.cpp @@ -139,3 +139,8 @@ void TimelineWidget::setTool(ProjectTool tool) { rootObject()->setProperty("activeTool", (int) tool); } + +QPoint TimelineWidget::getTracksCount() const +{ + return m_proxy->getTracksCount(); +} diff --git a/src/timeline2/view/timelinewidget.h b/src/timeline2/view/timelinewidget.h index af3a23dc6..0847ec06e 100644 --- a/src/timeline2/view/timelinewidget.h +++ b/src/timeline2/view/timelinewidget.h @@ -48,6 +48,7 @@ public: Mlt::Tractor *tractor(); TimelineController *controller(); void setTool(ProjectTool tool); + QPoint getTracksCount() const; protected: void mousePressEvent(QMouseEvent *event) override; |