Commit 9d3a7c6e authored by Julius Künzel's avatar Julius Künzel
Browse files

Disable "Change Speed" and "Time Remap" actions if the other one is

active

BUG: 443613
FIXED-IN: 21.12.2
parent ade1c515
......@@ -1653,11 +1653,13 @@ void MainWindow::setupActions()
act = addAction(QStringLiteral("edit_item_speed"), i18n("Change Speed"), this, SLOT(slotEditItemSpeed()),
QIcon::fromTheme(QStringLiteral("speedometer")), QKeySequence(), clipActionCategory);
// "Q" as data means this action should only be available if the item is not endless and has no time remap
act->setData('Q');
act->setEnabled(false);
act = addAction(QStringLiteral("edit_item_remap"), i18n("Time Remap"), this, SLOT(slotRemapItemTime()),
QIcon::fromTheme(QStringLiteral("speedometer")), QKeySequence(), clipActionCategory);
// "C" as data means this action should only be available for clips - not for compositions
// "R" as data means this action should only be available if the item is not endless and has no speed effect
act->setData('R');
act->setCheckable(true);
act->setEnabled(false);
......
......@@ -2622,6 +2622,7 @@ void TimelineController::remapItemTime(int clipId)
// Add remap effect
emit pCore->remapClip(clipId);
}
updateClipActions();
}
void TimelineController::changeItemSpeed(int clipId, double speed)
......@@ -2664,7 +2665,10 @@ void TimelineController::changeItemSpeed(int clipId, double speed)
pitchCompensate = d->getPitchCompensate();
qDebug() << "requesting speed " << speed;
}
m_model->requestClipTimeWarp(clipId, speed, pitchCompensate, true);
bool res = m_model->requestClipTimeWarp(clipId, speed, pitchCompensate, true);
if (res) {
updateClipActions();
}
}
void TimelineController::switchCompositing(int mode)
......@@ -3782,11 +3786,16 @@ void TimelineController::updateClipActions()
// Position actions should stay enabled in clip monitor
enableAction = true;
} else if (actionData == QLatin1Char('R')) {
// Time remap action
enableAction = clip != nullptr && type != ClipType::Color && type != ClipType::Image;
// Time remap action
enableAction = clip != nullptr && type != ClipType::Color && type != ClipType::Image
&& qFuzzyCompare(1., m_model->m_allClips[item]->getSpeed());
if (enableAction) {
act->setChecked(clip->isChain());
}
} else if (actionData == QLatin1Char('Q')) {
// Speed change action
enableAction = clip != nullptr && type != ClipType::Color && type != ClipType::Image
&& !clip->isChain();
}
act->setEnabled(enableAction);
}
......
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