Fix insert sometimes not working and add status bar label to indicate timeline mode

Related to #673
parent c4d18763
Pipeline #20531 passed with stage
in 9 minutes and 20 seconds
......@@ -1219,14 +1219,20 @@ void MainWindow::setupActions()
toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
if (KdenliveSettings::gpu_accel()) {
/*QString styleBorderless = QStringLiteral("QToolButton { border-width: 0px;margin: 1px 3px 0px;padding: 0px;}");*/
QLabel *warnLabel = new QLabel(i18n("Experimental GPU processing enabled - not for production"), this);
warnLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
// m_trimLabel->setAutoFillBackground(true);
warnLabel->setAlignment(Qt::AlignHCenter);
warnLabel->setStyleSheet(QStringLiteral("QLabel { background-color :red; color:black;padding-left:2px;padding-right:2px}"));
toolbar->addWidget(warnLabel);
}
m_trimLabel = new QLabel(QString(), this);
m_trimLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_trimLabel->setAlignment(Qt::AlignHCenter);
//m_trimLabel->setStyleSheet(QStringLiteral("QLabel { background-color :red; }"));
toolbar->addWidget(m_trimLabel);
toolbar->addAction(m_buttonAutomaticTransition);
toolbar->addAction(m_buttonVideoThumbs);
toolbar->addAction(m_buttonAudioThumbs);
......@@ -2974,8 +2980,15 @@ void MainWindow::slotChangeEdit(QAction *action)
TimelineMode::EditMode mode = TimelineMode::NormalEdit;
if (action == m_overwriteEditTool) {
mode = TimelineMode::OverwriteEdit;
m_trimLabel->setText(i18n("Overwrite"));
m_trimLabel->setStyleSheet(QStringLiteral("QLabel { padding-left: 2; padding-right: 2; background-color :darkGreen; }"));
} else if (action == m_insertEditTool) {
mode = TimelineMode::InsertEdit;
m_trimLabel->setText(i18n("Insert"));
m_trimLabel->setStyleSheet(QStringLiteral("QLabel { padding-left: 2; padding-right: 2; background-color :red; }"));
} else {
m_trimLabel->setText(QString());
m_trimLabel->setStyleSheet(QString());
}
getMainTimeline()->controller()->getModel()->setEditMode(mode);
}
......
......@@ -2938,10 +2938,13 @@ bool TimelineController::endFakeMove(int clipId, int position, bool updateView,
}
int startClipId = m_model->getClipByPosition(trackId, position);
if (startClipId > -1) {
// There is a clip, cut
res = res && TimelineFunctions::requestClipCut(m_model, startClipId, position, undo, redo);
// There is a clip at insert pos
if (m_model->getClipPosition(startClipId) != position) {
// If position is in the middle of the clip, cut it
res = res && TimelineFunctions::requestClipCut(m_model, startClipId, position, undo, redo);
}
}
res = res && TimelineFunctions::requestInsertSpace(m_model, QPoint(position, position + duration), undo, redo, {currentTrack});
res = res && TimelineFunctions::requestInsertSpace(m_model, QPoint(position, position + duration), undo, redo, {trackId});
}
res = res && m_model->getTrackById(trackId)->requestClipInsertion(clipId, position, updateView, invalidateTimeline, undo, redo);
if (res) {
......
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