{
m_ui.setupUi(this);
m_scene = monitor->getEffectScene();
- connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateGeometry()));
- connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateProperties()));
- connect(m_monitor->render, SIGNAL(rendererPosition(int)), this, SLOT(slotCheckPosition(int)));
+ m_ui.buttonMoveLeft->setIcon(KIcon("kdenlive-align-left"));
+ m_ui.buttonMoveLeft->setToolTip(i18n("Move to left"));
+ m_ui.buttonCenterH->setIcon(KIcon("kdenlive-align-hor"));
+ m_ui.buttonCenterH->setToolTip(i18n("Center horizontally"));
+ m_ui.buttonMoveRight->setIcon(KIcon("kdenlive-align-right"));
+ m_ui.buttonMoveRight->setToolTip(i18n("Move to right"));
+ m_ui.buttonMoveTop->setIcon(KIcon("kdenlive-align-top"));
+ m_ui.buttonMoveTop->setToolTip(i18n("Move to top"));
+ m_ui.buttonCenterV->setIcon(KIcon("kdenlive-align-vert"));
+ m_ui.buttonCenterV->setToolTip(i18n("Center vertically"));
+ m_ui.buttonMoveBottom->setIcon(KIcon("kdenlive-align-bottom"));
+ m_ui.buttonMoveBottom->setToolTip(i18n("Move to bottom"));
+
+
+ connect(m_ui.spinX, SIGNAL(valueChanged(int)), this, SLOT(slotSetX(int)));
+ connect(m_ui.spinY, SIGNAL(valueChanged(int)), this, SLOT(slotSetY(int)));
+ connect(m_ui.spinWidth, SIGNAL(valueChanged(int)), this, SLOT(slotSetWidth(int)));
+ connect(m_ui.spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotSetHeight(int)));
+
+ connect(m_ui.spinSize, SIGNAL(valueChanged(int)), this, SLOT(slotResize(int)));
+
+ connect(m_ui.buttonMoveLeft, SIGNAL(clicked()), this, SLOT(slotMoveLeft()));
+ connect(m_ui.buttonCenterH, SIGNAL(clicked()), this, SLOT(slotCenterH()));
+ connect(m_ui.buttonMoveRight, SIGNAL(clicked()), this, SLOT(slotMoveRight()));
+ connect(m_ui.buttonMoveTop, SIGNAL(clicked()), this, SLOT(slotMoveTop()));
+ connect(m_ui.buttonCenterV, SIGNAL(clicked()), this, SLOT(slotCenterV()));
+ connect(m_ui.buttonMoveBottom, SIGNAL(clicked()), this, SLOT(slotMoveBottom()));
- connect(m_ui.spinX, SIGNAL(valueChanged(int)), this, SLOT(slotSetX(int)));
- connect(m_ui.spinY, SIGNAL(valueChanged(int)), this, SLOT(slotSetY(int)));
- connect(m_ui.spinWidth, SIGNAL(valueChanged(int)), this, SLOT(slotSetWidth(int)));
- connect(m_ui.spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotSetHeight(int)));
+ connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateGeometry()));
+ connect(m_monitor->render, SIGNAL(rendererPosition(int)), this, SLOT(slotCheckPosition(int)));
+ connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties()));
}
GeometryWidget::~GeometryWidget()
if (renderPos >= m_clipPos && renderPos <= m_clipPos + m_outPoint - m_inPoint) {
if (!m_scene->views().at(0)->isVisible())
m_monitor->slotEffectScene(true);
- } else
+ } else {
m_monitor->slotEffectScene(false);
+ }
}
void GeometryWidget::slotUpdateGeometry()
{
QRectF rectSize = m_rect->rect().normalized();
QPointF rectPos = m_rect->pos();
+ int size;
+ if (rectSize.width() / m_monitor->render->dar() < rectSize.height())
+ size = (int)(rectSize.width() * 100 / m_monitor->render->renderWidth());
+ else
+ size = (int)(rectSize.height() * 100 / m_monitor->render->renderHeight());
m_ui.spinX->blockSignals(true);
m_ui.spinY->blockSignals(true);
m_ui.spinWidth->blockSignals(true);
m_ui.spinHeight->blockSignals(true);
+ m_ui.spinSize->blockSignals(true);
m_ui.spinX->setValue(rectPos.x());
m_ui.spinY->setValue(rectPos.y());
m_ui.spinWidth->setValue(rectSize.width());
m_ui.spinHeight->setValue(rectSize.height());
+ m_ui.spinSize->setValue(size);
m_ui.spinX->blockSignals(false);
m_ui.spinY->blockSignals(false);
m_ui.spinWidth->blockSignals(false);
m_ui.spinHeight->blockSignals(false);
+ m_ui.spinSize->blockSignals(false);
}
+
void GeometryWidget::slotSetX(int value)
{
m_rect->setPos(value, m_ui.spinY->value());
slotUpdateGeometry();
}
+
+void GeometryWidget::slotResize(int value)
+{
+ m_rect->setRect(0, 0, m_monitor->render->renderWidth() * value / 100, m_monitor->render->renderHeight() * value / 100);
+ slotUpdateGeometry();
+}
+
+
+void GeometryWidget::slotMoveLeft()
+{
+ m_rect->setPos(0, m_rect->pos().y());
+ slotUpdateGeometry();
+}
+
+void GeometryWidget::slotCenterH()
+{
+ m_rect->setPos((m_monitor->render->renderWidth() - m_rect->rect().width()) / 2, m_rect->pos().y());
+ slotUpdateGeometry();
+}
+
+void GeometryWidget::slotMoveRight()
+{
+ m_rect->setPos(m_monitor->render->renderWidth() - m_rect->rect().width(), m_rect->pos().y());
+ slotUpdateGeometry();
+}
+
+void GeometryWidget::slotMoveTop()
+{
+ m_rect->setPos(m_rect->pos().x(), 0);
+ slotUpdateGeometry();
+}
+
+void GeometryWidget::slotCenterV()
+{
+ m_rect->setPos(m_rect->pos().x(), (m_monitor->render->renderHeight() - m_rect->rect().height()) / 2);
+ slotUpdateGeometry();
+}
+
+void GeometryWidget::slotMoveBottom()
+{
+ m_rect->setPos(m_rect->pos().x(), m_monitor->render->renderHeight() - m_rect->rect().height());
+ slotUpdateGeometry();
+}
+
#include "geometrywidget.moc"
{
Q_OBJECT
public:
- GeometryWidget(Monitor *monitor, int clipPos = 0, QWidget* parent = 0);
+ /** @brief Sets up the UI and connects it.
+ * @param monitor Project monitor
+ * @param clipPos Position of the clip in timeline
+ * @param parent (optional) Parent widget */
+ GeometryWidget(Monitor *monitor, int clipPos, QWidget* parent = 0);
virtual ~GeometryWidget();
+ /** @brief Gets the geometry as a serialized string. */
QString getValue() const;
public slots:
+ /** @brief Sets up the rect and the geometry object.
+ * @param elem DomElement representing this effect parameter
+ * @param minframe In point of the clip
+ * @param maxframe Out point of the clip */
void setupParam(const QDomElement elem, int minframe, int maxframe);
private:
Ui::GeometryWidget_UI m_ui;
Monitor *m_monitor;
+ /** Position of the clip in timeline. */
int m_clipPos;
+ /** In point of the clip (crop from start). */
int m_inPoint;
+ /** Out point of the clip (crop from end). */
int m_outPoint;
MonitorScene *m_scene;
QGraphicsRectItem *m_rect;
Mlt::Geometry *m_geometry;
private slots:
+ /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible.
+ * @param renderPos Postion of the Monitor / Timeline cursor */
void slotCheckPosition(int renderPos);
+ /** @brief Updates the Mlt::Geometry object. */
void slotUpdateGeometry();
+ /** @brief Updates the spinBoxes according to the rect. */
void slotUpdateProperties();
+
+ /** @brief Sets the rect's x position to @param value. */
void slotSetX(int value);
+ /** @brief Sets the rect's y position to @param value. */
void slotSetY(int value);
+ /** @brief Sets the rect's width to @param value. */
void slotSetWidth(int value);
+ /** @brief Sets the rect's height to @param value. */
void slotSetHeight(int value);
+ /** @brief Resizes the rect by @param value (in perecent) compared to the frame size. */
+ void slotResize(int value);
+
+ /** @brief Moves the rect to the left frame border (x position = 0). */
+ void slotMoveLeft();
+ /** @brief Centers the rect horizontally. */
+ void slotCenterH();
+ /** @brief Moves the rect to the right frame border (x position = frame width - rect width). */
+ void slotMoveRight();
+ /** @brief Moves the rect to the top frame border (y position = 0). */
+ void slotMoveTop();
+ /** @brief Centers the rect vertically. */
+ void slotCenterV();
+ /** @brief Moves the rect to the bottom frame border (y position = frame height - rect height). */
+ void slotMoveBottom();
+
signals:
void parameterChanged();
};
<rect>
<x>0</x>
<y>0</y>
- <width>256</width>
- <height>120</height>
+ <width>274</width>
+ <height>133</height>
</rect>
</property>
<property name="windowTitle">
</property>
</widget>
</item>
+ <item row="1" column="4" rowspan="3">
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QToolButton" name="buttonMoveLeft">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QToolButton" name="buttonMoveRight">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QToolButton" name="buttonCenterH">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QToolButton" name="buttonMoveTop">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QToolButton" name="buttonCenterV">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QToolButton" name="buttonMoveBottom">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Resize:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinSize">
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>500</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="5" rowspan="4">
+ <spacer name="horizontalSpacer">
+ <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="3" rowspan="4">
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" rowspan="4">
+ <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>
</layout>
</widget>
<resources/>