FIx various problems/crashes with split effect button

parent 06eabb67
......@@ -116,8 +116,10 @@ void AssetPanel::showTransition(int tid, std::shared_ptr<AssetParameterModel> tr
void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<EffectStackModel> effectsModel, QSize frameSize, bool showKeyframes)
{
m_splitButton->setChecked(false);
if (effectsModel == nullptr) {
// Item is not ready
m_splitButton->setVisible(false);
clear();
return;
}
......@@ -155,6 +157,15 @@ void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<Effect
}
m_assetTitle->setText(title);
m_splitButton->setVisible(showSplit);
if (showSplit) {
m_splitButton->setEnabled(effectsModel->rowCount() > 0);
QObject::connect(effectsModel.get(), &EffectStackModel::dataChanged, [&](){
if (m_effectStackWidget->isEmpty()) {
m_splitButton->setChecked(false);
}
m_splitButton->setEnabled(!m_effectStackWidget->isEmpty());
});
}
m_timelineButton->setVisible(enableKeyframes);
m_timelineButton->setChecked(showKeyframes);
// Disable built stack until properly implemented
......
......@@ -336,6 +336,11 @@ void EffectStackView::addEffect(const QString &effectId)
}
}
bool EffectStackView::isEmpty() const
{
return m_model == nullptr ? true : m_model->rowCount() == 0;
}
/*
void EffectStackView::switchBuiltStack(bool show)
{
......
......@@ -64,6 +64,9 @@ public:
/** @brief Add an effect to the current stack
*/
void addEffect(const QString &effectId);
/** @brief Returns true if effectstack is empty
*/
bool isEmpty() const;
protected:
void dragEnterEvent(QDragEnterEvent *event) override;
......
......@@ -1860,6 +1860,7 @@ void Monitor::buildSplitEffect(Mlt::Producer *original)
delete original;
m_splitProducer = new Mlt::Producer(trac.get_producer());
m_glMonitor->setProducer(m_splitProducer, isActive(), position());
m_glMonitor->setRulerInfo(m_controller->frameDuration(), m_controller->getMarkerModel());
loadQmlScene(MonitorSceneSplit);
}
......
import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
import QtQuick 2.4
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Item {
id: root
......@@ -15,6 +15,7 @@ Item {
property int mouseRulerPos: 0
property int splitterPos
property point center
property real baseUnit: fontMetrics.font.pixelSize * 0.8
// percentage holds splitter pos relative to the scene percentage
property double percentage
// realpercent holds splitter pos relative to the frame width percentage
......@@ -22,10 +23,22 @@ Item {
signal qmlMoveSplit()
FontMetrics {
id: fontMetrics
font.family: "Arial"
}
percentage: 0.5
realpercent: 0.5
splitterPos: this.width / 2
onDurationChanged: {
clipMonitorRuler.updateRuler()
}
onWidthChanged: {
clipMonitorRuler.updateRuler()
}
MouseArea {
width: root.width; height: root.height
anchors.centerIn: parent
......
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