synchronize with timeline, show monitor scene, update geometry while rect on scene changes (before mouse release)
svn path=/trunk/kdenlive/; revision=4711
m_outPoint(1),
m_isEffect(isEffect),
m_rect(NULL),
- m_geometry(NULL)
+ m_geometry(NULL),
+ m_showScene(true)
{
m_ui.setupUi(this);
+ m_scene = monitor->getEffectScene();
/*
connect(m_ui.buttonMoveBottom, SIGNAL(clicked()), this, SLOT(slotMoveBottom()));
- m_scene = monitor->getEffectScene();
+ /*
+ Setup of configuration controls
+ */
+
+ m_ui.buttonConfig->setIcon(KIcon("system-run"));
+ m_ui.buttonConfig->setToolTip(i18n("Show/Hide settings"));
+ m_ui.buttonConfig->setCheckable(true);
+ m_ui.groupSettings->setHidden(true);
+ m_ui.checkSync->setChecked(KdenliveSettings::transitionfollowcursor());
+ m_ui.checkDirectUpdate->setChecked(m_scene->getDirectUpdate());
+
+ connect(m_ui.buttonConfig, SIGNAL(toggled(bool)), m_ui.groupSettings, SLOT(setVisible(bool)));
+
+ connect(m_ui.checkSync, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool)));
+ connect(m_ui.checkShowScene, SIGNAL(toggled(bool)), this, SLOT(slotShowScene(bool)));
+ connect(m_ui.checkDirectUpdate, SIGNAL(toggled(bool)), m_scene, SLOT(slotSetDirectUpdate(bool)));
+
+
connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateGeometry()));
connect(m_monitor, SIGNAL(renderPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties()));
void GeometryWidget::slotCheckMonitorPosition(int renderPos)
{
- /*
- We do only get the position in timeline if this geometry belongs to a transition,
- therefore we need to ways here.
- */
- if (m_isEffect) {
- emit checkMonitorPosition(renderPos);
- } else {
- if (renderPos >= m_clipPos && renderPos <= m_clipPos + m_outPoint - m_inPoint) {
- if (!m_scene->views().at(0)->isVisible())
- m_monitor->slotEffectScene(true);
+ if (m_showScene) {
+ /*
+ We do only get the position in timeline if this geometry belongs to a transition,
+ therefore we need to ways here.
+ */
+ if (m_isEffect) {
+ emit checkMonitorPosition(renderPos);
} else {
- m_monitor->slotEffectScene(false);
+ if (renderPos >= m_clipPos && renderPos <= m_clipPos + m_outPoint - m_inPoint) {
+ if (!m_scene->views().at(0)->isVisible())
+ m_monitor->slotEffectScene(true);
+ } else {
+ m_monitor->slotEffectScene(false);
+ }
}
}
}
slotUpdateGeometry();
}
+
+void GeometryWidget::slotSetSynchronize(bool sync)
+{
+ KdenliveSettings::setTransitionfollowcursor(sync);
+}
+
+void GeometryWidget::slotShowScene(bool show)
+{
+ m_showScene = show;
+ if (!m_showScene)
+ m_monitor->slotEffectScene(false);
+ else
+ slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
+}
+
#include "geometrywidget.moc"
KeyframeHelper *m_timeline;
/** Stores the different settings in the MLT geometry format. */
Mlt::Geometry *m_geometry;
+ bool m_showScene;
private slots:
/** @brief Updates controls according to position.
/** @brief Moves the rect to the bottom frame border (y position = frame height - rect height). */
void slotMoveBottom();
+ /** @brief Enables/Disables syncing with the timeline according to @param sync. */
+ void slotSetSynchronize(bool sync);
+ /** @brief Switches from normal monitor to monitor scene according to @param show. */
+ void slotShowScene(bool show = true);
+
signals:
void parameterChanged();
void checkMonitorPosition(int);
m_resizeMode(NoResize),
m_clickPoint(0, 0),
m_backgroundImage(QImage()),
- m_enabled(true)
+ m_enabled(true),
+ m_modified(false),
+ m_directUpdate(false)
{
setBackgroundBrush(QBrush(QColor(KdenliveSettings::window_background().name())));
}
}
+void MonitorScene::slotSetDirectUpdate(bool directUpdate)
+{
+ m_directUpdate = directUpdate;
+}
+
+bool MonitorScene::getDirectUpdate()
+{
+ return m_directUpdate;
+}
+
void MonitorScene::slotSetBackgroundImage(QImage image)
{
m_backgroundImage = image;
if (mousePos.x() < pos.x() + rect.height() && mousePos.y() < pos.y() + rect.height()) {
item->setRect(rect.adjusted(0, 0, -mousePosInRect.x(), -mousePosInRect.y()));
item->setPos(mousePos);
+ m_modified = true;
}
break;
case Top:
rect.setBottom(rect.height() - mousePosInRect.y());
item->setRect(rect);
item->setPos(QPointF(pos.x(), mousePos.y()));
+ m_modified = true;
}
break;
case TopRight:
rect.setBottomRight(QPointF(mousePosInRect.x(), rect.bottom() - mousePosInRect.y()));
item->setRect(rect);
item->setPos(QPointF(pos.x(), mousePos.y()));
+ m_modified = true;
}
break;
case Left:
rect.setRight(rect.width() - mousePosInRect.x());
item->setRect(rect);
item->setPos(QPointF(mousePos.x(), pos.y()));
+ m_modified = true;
}
break;
case Right:
if (mousePos.x() > pos.x()) {
rect.setRight(mousePosInRect.x());
item->setRect(rect);
+ m_modified = true;
}
break;
case BottomLeft:
rect.setBottomRight(QPointF(rect.width() - mousePosInRect.x(), mousePosInRect.y()));
item->setRect(rect);
item->setPos(QPointF(mousePos.x(), pos.y()));
+ m_modified = true;
}
break;
case Bottom:
if (mousePos.y() > pos.y()) {
rect.setBottom(mousePosInRect.y());
item->setRect(rect);
+ m_modified = true;
}
break;
case BottomRight:
if (mousePos.x() > pos.x() && mousePos.y() > pos.y()) {
rect.setBottomRight(mousePosInRect);
item->setRect(rect);
+ m_modified = true;
}
break;
default:
QPointF diff = mousePos - m_clickPoint;
m_clickPoint = mousePos;
item->moveBy(diff.x(), diff.y());
+ m_modified = true;
break;
}
}
}
}
- if (!itemFound && m_view != NULL)
+ if (!itemFound && m_view)
m_view->setCursor(Qt::ArrowCursor);
QGraphicsScene::mouseMoveEvent(event);
}
+ if (m_modified && m_directUpdate) {
+ emit actionFinished();
+ m_modified = false;
+ }
}
void MonitorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
return;
QGraphicsScene::mouseReleaseEvent(event);
- emit actionFinished();
+ if (m_modified) {
+ m_modified = false;
+ emit actionFinished();
+ }
}
#include "monitorscene.moc"
MonitorScene(Render *renderer, QObject* parent = 0);
void setUp();
void setEnabled(bool enabled = true);
+ bool getDirectUpdate();
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
public slots:
void slotUpdateBackground(bool fit = false);
+ void slotSetDirectUpdate(bool directUpdate);
private slots:
void slotSetBackgroundImage(QImage image);
QPointF m_clickPoint;
QImage m_backgroundImage;
bool m_enabled;
+ bool m_modified;
+ bool m_directUpdate;
signals:
void actionFinished();
<rect>
<x>0</x>
<y>0</y>
- <width>373</width>
- <height>191</height>
+ <width>381</width>
+ <height>304</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="1" column="1">
+ <item row="1" column="2">
<widget class="QWidget" name="widgetGeometry" native="true">
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
</layout>
</widget>
</item>
- <item row="1" column="0">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="2">
+ <item row="1" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
- <item row="0" column="0" colspan="3">
+ <item row="0" column="0" colspan="4">
<widget class="QWidget" name="widgetTimeWrapper" native="true">
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<property name="text">
<string>...</string>
</property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="1" column="2">
<property name="text">
<string>...</string>
</property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="1" column="1">
<property name="text">
<string>...</string>
</property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="1" column="3">
</layout>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QWidget" name="widget_3" native="true">
+ <layout class="QGridLayout" name="gridLayout_6">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="1" column="1">
+ <widget class="QToolButton" name="buttonConfig">
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" rowspan="2">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QGroupBox" name="groupSettings">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>Settings</string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>4</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>4</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="checkSync">
+ <property name="text">
+ <string>Synchronize with timeline cursor</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkShowScene">
+ <property name="text">
+ <string>Show on-monitor scene</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkDirectUpdate">
+ <property name="text">
+ <string>Update while monitor scene changes</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="4">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
<resources/>