Revert "Revert "Merge branch '1904'""

This reverts commit 2518ec46.
parent 2518ec46
......@@ -452,6 +452,8 @@ void TimelineItemModel::setTrackProperty(int trackId, const QString &name, const
roles.push_back(TrackActiveRole);
} else if (name == QLatin1String("kdenlive:thumbs_format")) {
roles.push_back(ThumbsFormatRole);
} else if (name == QLatin1String("kdenlive:collapsed")) {
roles.push_back(HeightRole);
} else if (name == QLatin1String("kdenlive:audio_rec")) {
roles.push_back(AudioRecordRole);
}
......
......@@ -33,7 +33,6 @@ Column{
property int trackInternalId : -42
property int trackThumbsFormat
property int itemType: 0
height: parent.height
/*function redrawWaveforms() {
for (var i = 0; i < repeater.count; i++)
......
......@@ -45,10 +45,6 @@ Rectangle {
border.color: root.frameColor
signal clicked()
onCollapsedChanged: {
resizer.y = trackHeadRoot.height - resizer.height
}
function pulseLockButton() {
flashLock.restart();
}
......@@ -463,11 +459,14 @@ Rectangle {
}
onReleased: {
root.stopScrolling = false
parent.opacity = 0
parent.y = trackHeadRoot.height - parent.height
//resizer.y = spacer.y + spacer.height
if (!trimInMouseArea.containsMouse) {
parent.opacity = 0
}
if (mouse.modifiers & Qt.ShiftModifier) {
timeline.adjustAllTrackHeight(trackHeadRoot.trackId, trackHeadRoot.myTrackHeight)
}
}
onEntered: parent.opacity = 0.5
onEntered: parent.opacity = 0.3
onExited: parent.opacity = 0
onPositionChanged: {
if (mouse.buttons === Qt.LeftButton) {
......
......@@ -646,16 +646,13 @@ Rectangle {
effectNames: model.effectNames
isStackEnabled: model.isStackEnabled
width: headerWidth
height: model.trackHeight
current: item === timeline.activeTrack
trackId: item
height: model.trackHeight
onIsLockedChanged: tracksRepeater.itemAt(index).isLocked = isLocked
collapsed: height <= collapsedHeight
onMyTrackHeightChanged: {
trackBaseRepeater.itemAt(index).height = myTrackHeight
tracksRepeater.itemAt(index).height = myTrackHeight
height = myTrackHeight
collapsed = height <= collapsedHeight
collapsed = myTrackHeight <= collapsedHeight
if (!collapsed) {
controller.setTrackProperty(trackId, "kdenlive:trackheight", myTrackHeight)
controller.setTrackProperty(trackId, "kdenlive:collapsed", "0")
......@@ -1281,7 +1278,6 @@ Rectangle {
delegate: Track {
trackModel: multitrack
rootIndex: trackDelegateModel.modelIndex(index)
height: trackHeight
timeScale: timeline.scaleFactor
width: tracksContainerArea.width
isAudio: audio
......
......@@ -676,6 +676,23 @@ void TimelineController::showTrackAsset(int trackId)
emit showItemEffectStack(getTrackNameFromIndex(trackId), m_model->getTrackEffectStackModel(trackId), pCore->getCurrentFrameSize(), false);
}
void TimelineController::adjustAllTrackHeight(int trackId, int height)
{
bool isAudio = m_model->getTrackById_const(trackId)->isAudioTrack();
auto it = m_model->m_allTracks.cbegin();
while (it != m_model->m_allTracks.cend()) {
int target_track = (*it)->getId();
if (target_track != trackId && m_model->getTrackById_const(target_track)->isAudioTrack() == isAudio) {
m_model->getTrackById(target_track)->setProperty(QStringLiteral("kdenlive:trackheight"), QString::number(height));
}
++it;
}
int tracksCount = m_model->getTracksCount();
QModelIndex modelStart = m_model->makeTrackIndexFromID(m_model->getTrackIndexFromPosition(0));
QModelIndex modelEnd = m_model->makeTrackIndexFromID(m_model->getTrackIndexFromPosition(tracksCount - 1));
m_model->dataChanged(modelStart, modelEnd, {TimelineModel::HeightRole});
}
void TimelineController::setPosition(int position)
{
setSeekPosition(position);
......
......@@ -246,6 +246,9 @@ public:
*/
Q_INVOKABLE void showAsset(int id);
Q_INVOKABLE void showTrackAsset(int trackId);
/* @brief Adjust height of all simlar (audio or video) tracks
*/
Q_INVOKABLE void adjustAllTrackHeight(int trackId, int height);
Q_INVOKABLE bool exists(int itemId);
......
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