Ensure we cannot delete first keyframe of an effect.

Fixes #109
parent 9583e835
Pipeline #1768 failed with stage
in 8 minutes
...@@ -51,6 +51,7 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode ...@@ -51,6 +51,7 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
: AbstractParamWidget(std::move(model), index, parent) : AbstractParamWidget(std::move(model), index, parent)
, m_monitorHelper(nullptr) , m_monitorHelper(nullptr)
, m_neededScene(MonitorSceneType::MonitorSceneDefault) , m_neededScene(MonitorSceneType::MonitorSceneDefault)
, m_active(false)
{ {
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
...@@ -192,7 +193,7 @@ void KeyframeWidget::monitorSeek(int pos) ...@@ -192,7 +193,7 @@ void KeyframeWidget::monitorSeek(int pos)
int in = pCore->getItemPosition(m_model->getOwnerId()); int in = pCore->getItemPosition(m_model->getOwnerId());
int out = in + pCore->getItemDuration(m_model->getOwnerId()); int out = in + pCore->getItemDuration(m_model->getOwnerId());
bool isInRange = pos >= in && pos < out; bool isInRange = pos >= in && pos < out;
m_buttonAddDelete->setEnabled(isInRange); m_buttonAddDelete->setEnabled(isInRange && pos > in);
connectMonitor(isInRange); connectMonitor(isInRange);
int framePos = qBound(in, pos, out) - in; int framePos = qBound(in, pos, out) - in;
if (isInRange && framePos != m_time->getValue()) { if (isInRange && framePos != m_time->getValue()) {
...@@ -410,6 +411,10 @@ void KeyframeWidget::slotInitMonitor(bool active) ...@@ -410,6 +411,10 @@ void KeyframeWidget::slotInitMonitor(bool active)
void KeyframeWidget::connectMonitor(bool active) void KeyframeWidget::connectMonitor(bool active)
{ {
if (active == m_active) {
return;
}
m_active = active;
if (m_monitorHelper) { if (m_monitorHelper) {
if (m_monitorHelper->connectMonitor(active)) { if (m_monitorHelper->connectMonitor(active)) {
slotRefreshParams(); slotRefreshParams();
......
...@@ -94,6 +94,7 @@ private: ...@@ -94,6 +94,7 @@ private:
KSelectAction *m_selectType; KSelectAction *m_selectType;
TimecodeDisplay *m_time; TimecodeDisplay *m_time;
MonitorSceneType m_neededScene; MonitorSceneType m_neededScene;
bool m_active;
void connectMonitor(bool active); void connectMonitor(bool active);
std::unordered_map<QPersistentModelIndex, QWidget *> m_parameters; std::unordered_map<QPersistentModelIndex, QWidget *> m_parameters;
......
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