Commit 6c1ac094 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix several small issues / crash in new guides widget

parent 66216267
Pipeline #260656 passed with stage
in 10 minutes and 46 seconds
......@@ -530,12 +530,12 @@ void AssetPanel::updateAssetPosition(int itemId)
if (m_effectStackWidget->isVisible()) {
ObjectId id = {ObjectType::TimelineClip, itemId};
if (m_effectStackWidget->stackOwner() == id) {
emit pCore->getMonitor(Kdenlive::ProjectMonitor)->seekPosition(pCore->getTimelinePosition());
emit pCore->getMonitor(Kdenlive::ProjectMonitor)->seekPosition(pCore->getMonitorPosition());
}
} else if (m_transitionWidget->isVisible()) {
ObjectId id = {ObjectType::TimelineComposition, itemId};
if (m_transitionWidget->stackOwner() == id) {
emit pCore->getMonitor(Kdenlive::ProjectMonitor)->seekPosition(pCore->getTimelinePosition());
emit pCore->getMonitor(Kdenlive::ProjectMonitor)->seekPosition(pCore->getMonitorPosition());
}
}
}
......@@ -465,7 +465,7 @@ void KeyframeWidget::slotRefresh()
m_keyframeview->setDuration(duration);
m_time->setRange(0, duration - 1);
if (m_model->monitorId == Kdenlive::ProjectMonitor) {
monitorSeek(pCore->getTimelinePosition());
monitorSeek(pCore->getMonitorPosition());
} else {
int pos = m_time->getValue();
bool isInRange = pos >= in && pos < out;
......
......@@ -987,10 +987,15 @@ Mlt::Profile *Core::thumbProfile()
return m_thumbProfile.get();
}
int Core::getTimelinePosition() const
int Core::getMonitorPosition(Kdenlive::MonitorId id) const
{
if (m_guiConstructed) {
return m_monitorManager->projectMonitor()->position();
switch (id) {
case Kdenlive::ClipMonitor:
return m_monitorManager->clipMonitor()->position();
default:
return m_monitorManager->projectMonitor()->position();
}
}
return 0;
}
......
......@@ -217,8 +217,8 @@ public:
int projectDuration() const;
/** @brief Returns true if current project has some rendered timeline preview */
bool hasTimelinePreview() const;
/** @brief Returns current timeline cursor position */
int getTimelinePosition() const;
/** @brief Returns monitor position */
int getMonitorPosition(Kdenlive::MonitorId id = Kdenlive::ProjectMonitor) const;
/** @brief Handles audio and video capture **/
void startMediaCapture(int tid, bool, bool);
void stopMediaCapture(int tid, bool, bool);
......
......@@ -346,7 +346,7 @@ void SubtitleEdit::goToPrevious()
id = m_model->getPreviousSub(m_activeSub);
} else {
// Start from timeline cursor position
int cursorPos = pCore->getTimelinePosition();
int cursorPos = pCore->getMonitorPosition();
std::unordered_set<int> sids = m_model->getItemsInRange(cursorPos, cursorPos);
if (sids.empty()) {
sids = m_model->getItemsInRange(0, cursorPos);
......@@ -378,7 +378,7 @@ void SubtitleEdit::goToNext()
id = m_model->getNextSub(m_activeSub);
} else {
// Start from timeline cursor position
int cursorPos = pCore->getTimelinePosition();
int cursorPos = pCore->getMonitorPosition();
std::unordered_set<int> sids = m_model->getItemsInRange(cursorPos, cursorPos);
if (sids.empty()) {
sids = m_model->getItemsInRange(cursorPos, -1);
......
......@@ -147,7 +147,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
if (m_model->getOwnerId().first == ObjectType::BinClip) {
m_outPos->setValue(pCore->getMonitor(Kdenlive::ClipMonitor)->position());
} else {
m_inPos->setValue(pCore->getTimelinePosition());
m_inPos->setValue(pCore->getMonitorPosition());
}
updateEffectZone();
});
......@@ -155,7 +155,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
if (m_model->getOwnerId().first == ObjectType::BinClip) {
m_outPos->setValue(pCore->getMonitor(Kdenlive::ClipMonitor)->position());
} else {
m_outPos->setValue(pCore->getTimelinePosition());
m_outPos->setValue(pCore->getMonitorPosition());
}
updateEffectZone();
});
......@@ -931,7 +931,7 @@ void CollapsibleEffectView::switchInOut(bool checked)
if (!checked) {
inOut = {0, 0};
} else {
int in = pCore->getTimelinePosition();
int in = pCore->getMonitorPosition();
inOut = {in, in + pCore->getDurationFromString(KdenliveSettings::transition_duration())};
}
break;
......
......@@ -132,10 +132,11 @@ GuideCategories::GuideCategories(KdenliveDoc *doc, QWidget *parent)
if (!editItem()) {
delete item;
}
guide_delete->setEnabled(guides_list->count() > 1);
});
connect(guide_delete, &QPushButton::clicked, this, [=]() {
auto *item = guides_list->currentItem();
if (!item) {
if (!item || guides_list->count() == 1) {
return;
}
int count = item->data(Qt::UserRole + 2).toInt();
......@@ -146,6 +147,7 @@ GuideCategories::GuideCategories(KdenliveDoc *doc, QWidget *parent)
}
}
delete item;
guide_delete->setEnabled(guides_list->count() > 1);
});
}
......
......@@ -188,7 +188,7 @@ void GuidesList::editGuide(const QModelIndex &ix)
int frame = m_proxy->data(ix, MarkerListModel::FrameRole).toInt();
GenTime pos(frame, pCore->getCurrentFps());
if (auto markerModel = m_model.lock()) {
markerModel->editMarkerGui(pos, qApp->activeWindow(), false);
markerModel->editMarkerGui(pos, qApp->activeWindow(), false, m_clip.get());
}
}
......@@ -211,18 +211,18 @@ void GuidesList::removeGuide()
void GuidesList::addGuide()
{
int frame = pCore->getTimelinePosition();
int frame = pCore->getMonitorPosition(m_markerMode ? Kdenlive::ClipMonitor : Kdenlive::ProjectMonitor);
if (frame >= 0) {
GenTime pos(frame, pCore->getCurrentFps());
if (auto markerModel = m_model.lock()) {
markerModel->addMultipleMarkersGui(pos, this, true);
markerModel->addMultipleMarkersGui(pos, this, true, m_clip.get());
}
}
}
void GuidesList::selectionChanged(const QItemSelection &selected, const QItemSelection &)
{
if (selected.isEmpty()) {
if (selected.indexes().isEmpty()) {
return;
}
const QModelIndex ix = selected.indexes().first();
......@@ -230,13 +230,18 @@ void GuidesList::selectionChanged(const QItemSelection &selected, const QItemSel
return;
}
int pos = m_proxy->data(ix, MarkerListModel::FrameRole).toInt();
pCore->seekMonitor(Kdenlive::ProjectMonitor, pos);
pCore->seekMonitor(m_markerMode ? Kdenlive::ClipMonitor : Kdenlive::ProjectMonitor, pos);
}
GuidesList::~GuidesList() = default;
void GuidesList::setClipMarkerModel(std::shared_ptr<ProjectClip> clip)
{
m_markerMode = true;
if (clip == m_clip) {
return;
}
m_clip = clip;
if (clip == nullptr) {
m_sortModel = nullptr;
m_proxy->setSourceModel(m_sortModel);
......@@ -246,7 +251,6 @@ void GuidesList::setClipMarkerModel(std::shared_ptr<ProjectClip> clip)
return;
}
setEnabled(true);
m_markerMode = true;
guideslist_label->setText(i18n("Markers for %1", clip->clipName()));
m_sortModel = clip->getFilteredMarkerModel().get();
m_model = clip->getMarkerModel();
......@@ -262,6 +266,8 @@ void GuidesList::setClipMarkerModel(std::shared_ptr<ProjectClip> clip)
void GuidesList::setModel(std::weak_ptr<MarkerListModel> model, std::shared_ptr<MarkerSortModel> viewModel)
{
m_clip = nullptr;
m_markerMode = false;
if (viewModel.get() == m_sortModel) {
// already displayed
return;
......@@ -307,6 +313,7 @@ void GuidesList::rebuildCategories()
}
QMapIterator<int, Core::MarkerCategory> i(pCore->markerTypes);
bool defaultCategoryFound = false;
while (i.hasNext()) {
i.next();
pixmap.fill(i.value().color);
......@@ -319,10 +326,19 @@ void GuidesList::rebuildCategories()
markerDefaultMenu->addAction(ac);
if (i.key() == KdenliveSettings::default_marker_type()) {
default_category->setIcon(colorIcon);
defaultCategoryFound = true;
}
catGroup->addButton(cb);
m_categoriesLayout.addWidget(cb);
}
if (!defaultCategoryFound) {
// Default marker category not found. set it to first one
QAction *ac = markerDefaultMenu->actions().first();
if (ac) {
default_category->setIcon(ac->icon());
KdenliveSettings::setDefault_marker_type(ac->data().toInt());
}
}
connect(catGroup, &QButtonGroup::buttonToggled, this, &GuidesList::updateFilter);
}
......@@ -352,7 +368,6 @@ void GuidesList::updateFilter(QAbstractButton *, bool)
}
pCore->currentDoc()->setGuidesFilter(filters);
emit pCore->refreshActiveGuides();
qDebug() << "::: GOT FILTERS: " << filters;
}
void GuidesList::filterView(const QString &text)
......
......@@ -50,6 +50,7 @@ private:
std::weak_ptr<MarkerListModel> m_model;
QIdentityProxyModel *m_proxy{nullptr};
MarkerSortModel *m_sortModel{nullptr};
std::shared_ptr<ProjectClip> m_clip;
QVBoxLayout m_categoriesLayout;
QButtonGroup *catGroup{nullptr};
QActionGroup *m_filterGroup;
......
......@@ -939,7 +939,7 @@ bool TimelineModel::mixClip(int idToMove, const QString &mixId, int delta)
}
if (previousClip > -1 && nextClip > -1) {
// We have a clip before and a clip after, check timeline cursor position to decide where to mix
int cursor = pCore->getTimelinePosition();
int cursor = pCore->getMonitorPosition();
if (cursor < mixPosition + clipDuration / 2) {
nextClip = -1;
} else {
......@@ -3041,7 +3041,7 @@ int TimelineModel::requestItemResizeInfo(int itemId, int in, int out, int size,
}
int proposed_size = size;
if (!skipSnaps) {
int timelinePos = pCore->getTimelinePosition();
int timelinePos = pCore->getMonitorPosition();
m_snaps->addPoint(timelinePos);
proposed_size = m_snaps->proposeSize(in, out, getBoundaries(itemId), size, right, snapDistance);
m_snaps->removePoint(timelinePos);
......@@ -3116,7 +3116,7 @@ int TimelineModel::requestItemSpeedChange(int itemId, int size, bool right, int
size = out - getTrackById_const(trackId)->getBlankStart(in - 1);
}
}
int timelinePos = pCore->getTimelinePosition();
int timelinePos = pCore->getMonitorPosition();
m_snaps->addPoint(timelinePos);
int proposed_size = m_snaps->proposeSize(in, out, getBoundaries(itemId), size, right, snapDistance);
m_snaps->removePoint(timelinePos);
......@@ -4674,7 +4674,7 @@ void TimelineModel::setUndoStack(std::weak_ptr<DocUndoStack> undo_stack)
int TimelineModel::suggestSnapPoint(int pos, int snapDistance)
{
int cursorPosition = pCore->getTimelinePosition();
int cursorPosition = pCore->getMonitorPosition();
m_snaps->addPoint(cursorPosition);
int snapped = m_snaps->getClosestPoint(pos);
m_snaps->removePoint(cursorPosition);
......
......@@ -319,20 +319,20 @@ bool TimelineController::selectCurrentItem(ObjectType type, bool select, bool ad
{
int currentClip = -1;
if (type == ObjectType::TimelineClip) {
currentClip = m_model->isSubtitleTrack(m_activeTrack) ? m_model->getSubtitleByPosition(pCore->getTimelinePosition())
: m_model->getClipByPosition(m_activeTrack, pCore->getTimelinePosition());
currentClip = m_model->isSubtitleTrack(m_activeTrack) ? m_model->getSubtitleByPosition(pCore->getMonitorPosition())
: m_model->getClipByPosition(m_activeTrack, pCore->getMonitorPosition());
} else if (type == ObjectType::TimelineComposition) {
currentClip = m_model->getCompositionByPosition(m_activeTrack, pCore->getTimelinePosition());
currentClip = m_model->getCompositionByPosition(m_activeTrack, pCore->getMonitorPosition());
} else if (type == ObjectType::TimelineMix) {
if (m_activeTrack >= 0) {
currentClip = m_model->getClipByPosition(m_activeTrack, pCore->getTimelinePosition());
currentClip = m_model->getClipByPosition(m_activeTrack, pCore->getMonitorPosition());
}
if (currentClip > -1) {
if (m_model->hasClipEndMix(currentClip)) {
int mixPartner = m_model->getTrackById_const(m_activeTrack)->getSecondMixPartner(currentClip);
int clipEnd = m_model->getClipPosition(currentClip) + m_model->getClipPlaytime(currentClip);
int mixStart = clipEnd - m_model->getMixDuration(mixPartner);
if (mixStart < pCore->getTimelinePosition() && pCore->getTimelinePosition() < clipEnd) {
if (mixStart < pCore->getMonitorPosition() && pCore->getMonitorPosition() < clipEnd) {
if (select) {
m_model->requestMixSelection(mixPartner);
return true;
......@@ -342,7 +342,7 @@ bool TimelineController::selectCurrentItem(ObjectType type, bool select, bool ad
}
}
}
int delta = pCore->getTimelinePosition() - m_model->getClipPosition(currentClip);
int delta = pCore->getMonitorPosition() - m_model->getClipPosition(currentClip);
if (m_model->getMixDuration(currentClip) >= delta) {
if (select) {
m_model->requestMixSelection(currentClip);
......@@ -437,7 +437,7 @@ int TimelineController::insertClip(int tid, int position, const QString &data_st
tid = m_activeTrack;
}
if (position == -1) {
position = pCore->getTimelinePosition();
position = pCore->getMonitorPosition();
}
if (!m_model->requestClipInsertion(data_str, tid, position, id, logUndo, refreshView, useTargets)) {
id = -1;
......@@ -452,7 +452,7 @@ QList<int> TimelineController::insertClips(int tid, int position, const QStringL
tid = m_activeTrack;
}
if (position == -1) {
position = pCore->getTimelinePosition();
position = pCore->getMonitorPosition();
}
TimelineFunctions::requestMultipleClipsInsertion(m_model, binIds, tid, position, clipIds, logUndo, refreshView);
// we don't need to check the return value of the above function, in case of failure it will return an empty list of ids.
......@@ -648,7 +648,7 @@ int TimelineController::getMainSelectedItem(bool restrictToCurrentPos, bool allo
}
}
if (m_model->isClip(itemId)) {
int position = pCore->getTimelinePosition();
int position = pCore->getMonitorPosition();
int start = m_model->getClipPosition(itemId);
int end = start + m_model->getClipPlaytime(itemId);
if (position >= start && position <= end) {
......@@ -852,15 +852,15 @@ void TimelineController::gotoNextSnap()
m_activeSnaps.push_back(m_zone.y() - 1);
}
std::vector<int> canceled = pCore->currentDoc()->getFilteredGuideModel()->getIgnoredSnapPoints();
int nextSnap = m_model->getNextSnapPos(pCore->getTimelinePosition(), m_activeSnaps, canceled);
if (nextSnap > pCore->getTimelinePosition()) {
int nextSnap = m_model->getNextSnapPos(pCore->getMonitorPosition(), m_activeSnaps, canceled);
if (nextSnap > pCore->getMonitorPosition()) {
setPosition(nextSnap);
}
}
void TimelineController::gotoPreviousSnap()
{
if (pCore->getTimelinePosition() > 0) {
if (pCore->getMonitorPosition() > 0) {
if (m_activeSnaps.empty() || pCore->undoIndex() != m_snapStackIndex) {
m_snapStackIndex = pCore->undoIndex();
m_activeSnaps.clear();
......@@ -869,14 +869,14 @@ void TimelineController::gotoPreviousSnap()
m_activeSnaps.push_back(m_zone.y() - 1);
}
std::vector<int> canceled = pCore->currentDoc()->getFilteredGuideModel()->getIgnoredSnapPoints();
setPosition(m_model->getPreviousSnapPos(pCore->getTimelinePosition(), m_activeSnaps, canceled));
setPosition(m_model->getPreviousSnapPos(pCore->getMonitorPosition(), m_activeSnaps, canceled));
}
}
void TimelineController::gotoNextGuide()
{
QList<CommentedTime> guides = pCore->currentDoc()->getGuideModel()->getAllMarkers();
int pos = pCore->getTimelinePosition();
int pos = pCore->getMonitorPosition();
double fps = pCore->getCurrentFps();
for (auto &guide : guides) {
if (guide.time().frames(fps) > pos) {
......@@ -889,9 +889,9 @@ void TimelineController::gotoNextGuide()
void TimelineController::gotoPreviousGuide()
{
if (pCore->getTimelinePosition() > 0) {
if (pCore->getMonitorPosition() > 0) {
QList<CommentedTime> guides = pCore->currentDoc()->getGuideModel()->getAllMarkers();
int pos = pCore->getTimelinePosition();
int pos = pCore->getMonitorPosition();
double fps = pCore->getCurrentFps();
int lastGuidePos = 0;
for (auto &guide : guides) {
......@@ -969,7 +969,7 @@ void TimelineController::setInPoint(bool ripple)
m_model->requestItemResize(id, size, false, true, 0, false);
}
};
int cursorPos = pCore->getTimelinePosition();
int cursorPos = pCore->getMonitorPosition();
const auto selection = m_model->getCurrentSelection();
bool selectionFound = false;
if (!selection.empty()) {
......@@ -1048,7 +1048,7 @@ void TimelineController::setOutPoint(bool ripple)
m_model->requestItemResize(id, size, true, true, 0, false);
}
};
int cursorPos = pCore->getTimelinePosition();
int cursorPos = pCore->getMonitorPosition();
const auto selection = m_model->getCurrentSelection();
bool selectionFound = false;
if (!selection.empty()) {
......@@ -1126,7 +1126,7 @@ void TimelineController::editMarker(int cid, int position)
double speed = m_model->getClipSpeed(cid);
if (position == -1) {
// Calculate marker position relative to timeline cursor
position = pCore->getTimelinePosition() - m_model->getClipPosition(cid) + m_model->getClipIn(cid);
position = pCore->getMonitorPosition() - m_model->getClipPosition(cid) + m_model->getClipIn(cid);
position = int(position * speed);
}
if (position < (m_model->getClipIn(cid) * speed) || position > (m_model->getClipIn(cid) * speed + m_model->getClipPlaytime(cid))) {
......@@ -1155,7 +1155,7 @@ void TimelineController::addMarker(int cid, int position)
double speed = m_model->getClipSpeed(cid);
if (position == -1) {
// Calculate marker position relative to timeline cursor
position = pCore->getTimelinePosition() - m_model->getClipPosition(cid) + m_model->getClipIn(cid);
position = pCore->getMonitorPosition() - m_model->getClipPosition(cid) + m_model->getClipIn(cid);
position = int(position * speed);
}
if (position < (m_model->getClipIn(cid) * speed) || position > (m_model->getClipIn(cid) * speed + m_model->getClipPlaytime(cid))) {
......@@ -1195,7 +1195,7 @@ void TimelineController::addQuickMarker(int cid, int position)
double speed = m_model->getClipSpeed(cid);
if (position == -1) {
// Calculate marker position relative to timeline cursor
position = pCore->getTimelinePosition() - m_model->getClipPosition(cid);
position = pCore->getMonitorPosition() - m_model->getClipPosition(cid);
position = int(position * speed);
}
if (position < (m_model->getClipIn(cid) * speed) || position > ((m_model->getClipIn(cid) + m_model->getClipPlaytime(cid) * speed))) {
......@@ -1221,7 +1221,7 @@ void TimelineController::deleteMarker(int cid, int position)
double speed = m_model->getClipSpeed(cid);
if (position == -1) {
// Calculate marker position relative to timeline cursor
position = pCore->getTimelinePosition() - m_model->getClipPosition(cid) + m_model->getClipIn(cid);
position = pCore->getMonitorPosition() - m_model->getClipPosition(cid) + m_model->getClipIn(cid);
position = int(position * speed);
}
if (position < (m_model->getClipIn(cid) * speed) || position > (m_model->getClipIn(cid) * speed + m_model->getClipPlaytime(cid))) {
......@@ -1250,7 +1250,7 @@ void TimelineController::deleteAllMarkers(int cid)
void TimelineController::editGuide(int frame)
{
if (frame == -1) {
frame = pCore->getTimelinePosition();
frame = pCore->getMonitorPosition();
}
auto guideModel = pCore->currentDoc()->getGuideModel();
GenTime pos(frame, pCore->getCurrentFps());
......@@ -1309,7 +1309,7 @@ void TimelineController::switchGuide(int frame, bool deleteOnly, bool showGui)
{
bool markerFound = false;
if (frame == -1) {
frame = pCore->getTimelinePosition();
frame = pCore->getMonitorPosition();
}
CommentedTime marker = pCore->currentDoc()->getGuideModel()->getMarker(frame, &markerFound);
if (!markerFound) {
......@@ -1357,7 +1357,7 @@ void TimelineController::addAsset(const QVariantMap &data)
// Move timeline cursor inside clip if it is not
int in = m_model->getClipPosition(cid);
int out = in + m_model->getClipPlaytime(cid);
int position = pCore->getTimelinePosition();
int position = pCore->getMonitorPosition();
if (position < in || position > out) {
emit seeked(in);
}
......@@ -1667,7 +1667,7 @@ void TimelineController::selectItems(const QVariantList &tracks, int startFrame,
void TimelineController::requestClipCut(int clipId, int position)
{
if (position == -1) {
position = pCore->getTimelinePosition();
position = pCore->getMonitorPosition();
}
TimelineFunctions::requestClipCut(m_model, clipId, position);
}
......@@ -1675,7 +1675,7 @@ void TimelineController::requestClipCut(int clipId, int position)
void TimelineController::cutClipUnderCursor(int position, int track)
{
if (position == -1) {
position = pCore->getTimelinePosition();
position = pCore->getMonitorPosition();
}
QMutexLocker lk(&m_metaMutex);
bool foundClip = false;
......@@ -1724,7 +1724,7 @@ void TimelineController::cutSubtitle(int id, int cursorPos)
return requestClipCut(id, -1);
}
// Cut subtitle at edit position
int timelinePos = pCore->getTimelinePosition();
int timelinePos = pCore->getMonitorPosition();
GenTime position(timelinePos, pCore->getCurrentFps());
GenTime start = m_model->m_allSubtitles.at(id);
auto subtitleModel = pCore->getSubtitleModel();
......@@ -1757,7 +1757,7 @@ void TimelineController::cutSubtitle(int id, int cursorPos)
void TimelineController::cutAllClipsUnderCursor(int position)
{
if (position == -1) {
position = pCore->getTimelinePosition();
position = pCore->getMonitorPosition();
}
QMutexLocker lk(&m_metaMutex);
TimelineFunctions::requestClipCutAll(m_model, position);
......@@ -1814,7 +1814,7 @@ void TimelineController::seekCurrentClip(bool seekToEnd)
if (!selection.empty()) {
cid = *selection.begin();
} else {
int cursorPos = pCore->getTimelinePosition();
int cursorPos = pCore->getMonitorPosition();
cid = m_model->getClipByPosition(m_activeTrack, cursorPos);
if (cid < 0) {
/* If the cursor is at the clip end it is one frame after the clip,
......@@ -1864,7 +1864,7 @@ int TimelineController::getMouseTrack()
bool TimelineController::positionIsInItem(int id)
{
int in = m_model->getItemPosition(id);
int position = pCore->getTimelinePosition();
int position = pCore->getMonitorPosition();
if (in > position) {
return false;
}
......@@ -1904,7 +1904,7 @@ void TimelineController::addEffectToCurrentClip(const QStringList &effectData)
QList<int> activeClips;
for (int track = m_model->getTracksCount() - 1; track >= 0; track--) {
int trackIx = m_model->getTrackIndexFromPosition(track);
int cid = m_model->getClipByPosition(trackIx, pCore->getTimelinePosition());
int cid = m_model->getClipByPosition(trackIx, pCore->getMonitorPosition());
if (cid > -1) {
activeClips << cid;
}
......@@ -2587,7 +2587,7 @@ QMap<QString, QString> TimelineController::documentProperties()
props.insert(QStringLiteral("audioTarget"), QString::number(audioTarget));
props.insert(QStringLiteral("videoTarget"), QString::number(videoTarget));
props.insert(QStringLiteral("activeTrack"), QString::number(activeTrack));
props.insert(QStringLiteral("position"), QString::number(pCore->getTimelinePosition()));
props.insert(QStringLiteral("position"), QString::number(pCore->getMonitorPosition()));
QVariant returnedValue;
QMetaObject::invokeMethod(m_root, "getScrollPos", Q_RETURN_ARG(QVariant, returnedValue));
int scrollPos = returnedValue.toInt();
......@@ -2607,7 +2607,7 @@ int TimelineController::getMenuOrTimelinePos() const
{
int frame = m_root->property("clickFrame").toInt();
if (frame == -1) {
frame = pCore->getTimelinePosition();
frame = pCore->getMonitorPosition();
}
return frame;
}
......@@ -2837,8 +2837,8 @@ void TimelineController::extractZone(QPoint zone, bool liftOnly)
}
if (m_zone.isNull()) {
// Use current timeline position and clip zone length
zone.setY(pCore->getTimelinePosition() + zone.y() - zone.x());
zone.setX(pCore->getTimelinePosition());
zone.setY(pCore->getMonitorPosition() + zone.y() - zone.x());
zone.setX(pCore->getMonitorPosition());
}
TimelineFunctions::extractZone(m_model, tracks, m_zone == QPoint() ? zone : m_zone, liftOnly);
if (!liftOnly && !m_zone.isNull()) {
......@@ -3004,7 +3004,7 @@ bool TimelineController::insertClipZone(const QString &binId, int tid, int posit
bool res = TimelineFunctions::insertZone(m_model, target_tracks, binId, position, zone, overwrite, false, undo, redo);
if (res) {
int newPos = position + (zone.y() - zone.x());
int currentPos = pCore->getTimelinePosition();
int currentPos = pCore->getMonitorPosition();
Fun redoPos = [this, newPos]() {
Kdenlive::MonitorId activeMonitor = pCore->monitorManager()->activeMonitor()->id();
pCore->monitorManager()->activateMonitor(Kdenlive::ProjectMonitor);
......@@ -3057,7 +3057,7 @@ int TimelineController::insertZone(const QString &binId, QPoint zone, bool overw
sourceZone = QPoint(zone.x(), zone.x() + m_zone.y() - m_zone.x());
} else {
// Use current timeline pos and clip zone for in/out
insertPoint = pCore->getTimelinePosition();
insertPoint = pCore->getMonitorPosition();
sourceZone = zone;
}
QList<int> target_tracks;
......@@ -3076,7 +3076,7 @@ int TimelineController::insertZone(const QString &binId, QPoint zone, bool overw
bool res = TimelineFunctions::insertZone(m_model, target_tracks, binId, insertPoint, sourceZone, overwrite, true, undo, redo);
if (res) {
int newPos = insertPoint + (sourceZone.y() - sourceZone.x());
int currentPos = pCore->getTimelinePosition();
int currentPos = pCore->getMonitorPosition();
Fun redoPos = [this, newPos]() {
setPosition(newPos);
pCore->getMonitor(Kdenlive::ProjectMonitor)->refreshMonitorIfActive();
......@@ -3169,7 +3169,7 @@ void TimelineController::addEffectToClip(const QString &assetId, int clipId)
// Move timeline cursor inside clip if it is not
int in = m_model->getClipPosition(clipId);
int out = in + m_model->getClipPlaytime(clipId);
int position = pCore->getTimelinePosition();
int position = pCore->getMonitorPosition();
if (position < in || position > out) {
emit seeked(in);
}
......@@ -4544,7 +4544,7 @@ void TimelineController::switchRecording(int trackId, bool record)
pCore->displayMessage(i18n("Impossible to capture on a locked track"), ErrorMessage, 500);
return;
}
m_recordStart.first = pCore->getTimelinePosition();
m_recordStart.first = pCore->getMonitorPosition();
m_recordTrack = trackId;
int maximumSpace = m_model->getTrackById_const(trackId)->getBlankEnd(m_recordStart.first);
if (maximumSpace == INT_MAX) {
......@@ -4680,7 +4680,7 @@ bool TimelineController::refreshIfVisible(int cid)
++it;
continue;
}
int child = m_model->getClipByPosition(target_track, pCore->getTimelinePosition());