]> git.sesse.net Git - kdenlive/blobdiff - src/cornerswidget.cpp
Cleanup effect stack (part 2) - show monitor scene when required
[kdenlive] / src / cornerswidget.cpp
index 46f2a1336131621ccf160432f3a63f8f5b2c79f1..6454a7c0d80b18dfbcb708d81c53857f17a3fa4c 100644 (file)
@@ -45,35 +45,24 @@ CornersWidget::CornersWidget(Monitor *monitor, QDomElement e, int minFrame, int
     MonitorEditWidget *edit = monitor->getEffectEdit();
     edit->showVisibilityButton(true);
     m_scene = edit->getScene();
+    m_scene->cleanup();
 
-    m_item = new OnMonitorCornersItem(m_scene);
+    m_item = new OnMonitorCornersItem();
     m_scene->addItem(m_item);
 
     // TODO: Better Icons
-    QToolButton *buttonShowControls = new QToolButton();
-    buttonShowControls->setIcon(KIcon("transform-move"));
-    buttonShowControls->setToolTip(i18n("Show additional controls"));
-    buttonShowControls->setCheckable(true);
-    buttonShowControls->setAutoRaise(true);
-    buttonShowControls->setChecked(KdenliveSettings::onmonitoreffects_cornersshowcontrols());
-    connect(buttonShowControls, SIGNAL(toggled(bool)), this, SLOT(slotShowControls(bool)));
-    edit->addCustomControl(buttonShowControls);
-
-    QToolButton *buttonShowLines = new QToolButton();
-    buttonShowLines->setIcon(KIcon("insert-horizontal-rule"));
-    buttonShowLines->setToolTip(i18n("Show/Hide the lines connecting the corners"));
-    buttonShowLines->setCheckable(true);
-    buttonShowControls->setAutoRaise(true);
-    buttonShowLines->setChecked(KdenliveSettings::onmonitoreffects_cornersshowlines());
-    connect(buttonShowLines, SIGNAL(toggled(bool)), this, SLOT(slotShowLines(bool)));
-    edit->addCustomControl(buttonShowLines);
+    edit->removeCustomControls();
+    edit->addCustomButton(KIcon("transform-move"), i18n("Show additional controls"), this, SLOT(slotShowControls(bool)),
+                          true, KdenliveSettings::onmonitoreffects_cornersshowcontrols());
+    edit->addCustomButton(KIcon("insert-horizontal-rule"), i18n("Show/Hide the lines connecting the corners"), this, SLOT(slotShowLines(bool)),
+                          true, KdenliveSettings::onmonitoreffects_cornersshowlines());
 
     connect(edit, SIGNAL(showEdit(bool)), this, SLOT(slotShowScene(bool)));
-    connect(m_monitor, SIGNAL(renderPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
-    connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateProperties()));
+    connect(m_item, SIGNAL(changed()), this, SLOT(slotUpdateProperties()));
     connect(m_scene, SIGNAL(addKeyframe()), this, SLOT(slotInsertKeyframe()));
 
     connect(keyframe_list, SIGNAL(cellChanged(int, int)), this, SLOT(slotUpdateItem()));
+    m_scene->centerView();
 }
 
 CornersWidget::~CornersWidget()
@@ -84,7 +73,6 @@ CornersWidget::~CornersWidget()
         MonitorEditWidget *edit = m_monitor->getEffectEdit();
         edit->showVisibilityButton(false);
         edit->removeCustomControls();
-        m_monitor->slotEffectScene(false);
     }
 }
 
@@ -188,7 +176,7 @@ void CornersWidget::slotShowScene(bool show)
 {
     m_showScene = show;
     if (!m_showScene)
-        m_monitor->slotEffectScene(false);
+        m_monitor->slotShowEffectScene(false);
     else
         slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
 }
@@ -209,8 +197,8 @@ void CornersWidget::slotSyncPosition(int relTimelinePos)
 {
     if (keyframe_list->rowCount()) {
         relTimelinePos = qBound(0, relTimelinePos, m_max);
-        if (relTimelinePos != m_pos) {
-            m_pos = relTimelinePos;
+        if (relTimelinePos != m_pos - m_min) {
+            m_pos = relTimelinePos + m_min;
             slotUpdateItem();
         }
     }