]> git.sesse.net Git - kdenlive/commitdiff
Monitorscene control widget:
authorTill Theato <root@ttill.de>
Fri, 22 Oct 2010 21:31:18 +0000 (21:31 +0000)
committerTill Theato <root@ttill.de>
Fri, 22 Oct 2010 21:31:18 +0000 (21:31 +0000)
 - Allow adding custom widgets
Corners widget:
 - Make the lines connecting the corners on the monitor optional (disabled by default). They make it harder to think of the effect working in 3D space, which can be very helpful.

svn path=/trunk/kdenlive/; revision=5031

src/cornerswidget.cpp
src/cornerswidget.h
src/kdenlivesettings.kcfg
src/monitorscene.h
src/monitorscenecontrolwidget.cpp
src/monitorscenecontrolwidget.h
src/onmonitoritems/onmonitorcornersitem.cpp

index 44b876a814de5ca037fd03e3603d294ae55f57a2..14c43353ef2b1d2c837763d4fc4901d21324c273 100644 (file)
@@ -23,6 +23,7 @@
 #include "monitorscenecontrolwidget.h"
 #include "onmonitoritems/onmonitorcornersitem.h"
 #include "renderer.h"
+#include "kdenlivesettings.h"
 
 #include <QGraphicsView>
 #include <QHBoxLayout>
@@ -54,6 +55,14 @@ CornersWidget::CornersWidget(Monitor* monitor, int clipPos, bool isEffect, int f
     layout2->setContentsMargins(0, 0, 0, 0);
     layout2->addWidget(m_config->getShowHideButton());
 
+    QToolButton *buttonShowLines = new QToolButton(m_config);
+    // TODO: Better Icon
+    buttonShowLines->setIcon(KIcon("insert-horizontal-rule"));
+    buttonShowLines->setToolTip(i18n("Show/Hide the lines connecting the corners"));
+    buttonShowLines->setCheckable(true);
+    connect(buttonShowLines, SIGNAL(toggled(bool)), this, SLOT(slotShowLines(bool)));
+    m_config->addWidget(buttonShowLines, 0, 2);
+
     int width = m_monitor->render->frameRenderWidth();
     int height = m_monitor->render->renderHeight();
 
@@ -203,6 +212,12 @@ void CornersWidget::slotShowScene(bool show)
         slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
 }
 
+void CornersWidget::slotShowLines(bool show)
+{
+    KdenliveSettings::setOnmonitoreffects_cornersshowlines(show);
+    m_item->update();
+}
+
 void CornersWidget::slotResetCorner1()
 {
     blockSignals(true);
index 6185ed7e865010976badba634174b42d8adc76de..de322943bb7de585e18a27c2833c096daed11921 100644 (file)
@@ -86,6 +86,9 @@ private slots:
      * @param changed (default = true) Whether to emit parameterChanged */
     void slotUpdateProperties(bool changed = true);
 
+    /** @brief Shows/Hides the lines connecting the corners in the on-monitor item according to @param show. */
+    void slotShowLines(bool show = true);
+
     /*
      * These functions reset the positions of the corners.
      * The default values in the effect XML file are not considered, but
index 4dee03783ed368464f27cea505d0bf5b971b04e6..f7ac5bc126b8ac76f13dd943a8290bb16e7f63ce 100644 (file)
     <entry name="blitzeffect" type="Int">
       <label>Effect applied to stopmotion frame overlay.</label>
       <default>0</default>
-    </entry> 
+    </entry>
+
+    <entry name="onmonitoreffects_cornersshowlines" type="Bool">
+      <label>Connect the corners in the widget for the c0rners effect with lines.</label>
+      <default>false</default>
+    </entry>
+
   </group>
 
 </kcfg>
index cf04b624d5510437ef6652be251e5532112762f7..f96e3f387ed9fc104459be09309e9b8574f1d926 100644 (file)
@@ -52,6 +52,7 @@ protected:
     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
     /** @brief Adds a keyframe if scene is disabled. */
     virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+    /** @brief Reimplemented to allow zooming using ctrl + mouse wheel. */
     virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
 
 public slots:
index 0ba4d5afb2eec9114ad39650fea7c162472db4f3..06c4e4d3a183add2a131c241be5278162922fab4 100644 (file)
@@ -21,6 +21,8 @@
 #include "monitorscene.h"
 #include "kdenlivesettings.h"
 
+#include <QGridLayout>
+
 
 MonitorSceneControlWidget::MonitorSceneControlWidget(MonitorScene* scene, QWidget* parent) :
         QWidget(parent),
@@ -74,6 +76,11 @@ QToolButton *MonitorSceneControlWidget::getShowHideButton()
     return m_buttonConfig;
 }
 
+void MonitorSceneControlWidget::addWidget(QWidget* widget, int row, int column)
+{
+    ((QGridLayout*)m_ui.groupBox->layout())->addWidget(widget, row, column);
+}
+
 void MonitorSceneControlWidget::slotSetDirectUpdate(bool directUpdate)
 {
     KdenliveSettings::setMonitorscene_directupdate(directUpdate);
index b35cc9dd7423b732589848ca5efbda2ef1da6f45..53ee209676b17c55bec78485ddf045eef3b21db0 100644 (file)
@@ -40,6 +40,9 @@ public:
     /** @brief Returns a button for showing and hiding the monitor scene controls (this widget). */
     QToolButton *getShowHideButton();
 
+    /** @brief Adds a custom widget to the controls. */
+    void addWidget(QWidget *widget, int row, int column);
+
 private slots:
     /** @brief Sets the KdenliveSetting directupdate with true = update parameters (rerender frame) during mouse move (before mouse button is released) */
     void slotSetDirectUpdate(bool directUpdate);
index b650abd3056328e028abee84a3c354f8c67b7700..7c0ee55274cd17a2dd435e037d020cc1afeb8f4d 100644 (file)
@@ -120,7 +120,8 @@ void OnMonitorCornersItem::slotMouseMoved(QGraphicsSceneMouseEvent* event)
 
 void OnMonitorCornersItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
-    QGraphicsPolygonItem::paint(painter, option, widget);
+    if (KdenliveSettings::onmonitoreffects_cornersshowlines())
+        QGraphicsPolygonItem::paint(painter, option, widget);
 
     painter->setRenderHint(QPainter::Antialiasing);
     painter->setBrush(QBrush(Qt::yellow));