diff --git a/src/assets/view/widgets/animationwidget.cpp b/src/assets/view/widgets/animationwidget.cpp --- a/src/assets/view/widgets/animationwidget.cpp +++ b/src/assets/view/widgets/animationwidget.cpp @@ -859,7 +859,6 @@ connect(m_spinOpacity, &DragValue::valueChanged, this, &AnimationWidget::slotAdjustRectKeyframeValue); horLayout2->addWidget(m_spinOpacity); } - // Build buttons m_originalSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-original")), i18n("Adjust to original size"), this); connect(m_originalSize, &QAction::triggered, this, &AnimationWidget::slotAdjustToSource); @@ -1692,3 +1691,4 @@ m_ruler->setRange(0, m_outPoint - m_inPoint); m_timePos->setRange(0, m_outPoint - m_inPoint - 1); } + diff --git a/src/monitor/monitor.h b/src/monitor/monitor.h --- a/src/monitor/monitor.h +++ b/src/monitor/monitor.h @@ -345,6 +345,8 @@ void extractZone(const QString &id); void effectChanged(const QRect &); void effectPointsChanged(const QVariantList &); + void opacityChanged(qreal); + void angleChanged(); void addKeyframe(); void deleteKeyframe(); void seekToNextKeyframe(); diff --git a/src/monitor/monitor.cpp b/src/monitor/monitor.cpp --- a/src/monitor/monitor.cpp +++ b/src/monitor/monitor.cpp @@ -172,6 +172,8 @@ m_qmlManager = new QmlManager(m_glMonitor); connect(m_qmlManager, &QmlManager::effectChanged, this, &Monitor::effectChanged); connect(m_qmlManager, &QmlManager::effectPointsChanged, this, &Monitor::effectPointsChanged); + connect(m_qmlManager, &QmlManager::opacityChanged, this, &Monitor::opacityChanged); + connect(m_qmlManager, &QmlManager::angleChanged, this, &Monitor::angleChanged); auto *monitorEventEater = new QuickMonitorEventEater(this); m_glWidget->installEventFilter(monitorEventEater); diff --git a/src/monitor/qmlmanager.h b/src/monitor/qmlmanager.h --- a/src/monitor/qmlmanager.h +++ b/src/monitor/qmlmanager.h @@ -56,10 +56,14 @@ void effectRectChanged(); void effectPolygonChanged(); void effectRotoChanged(); + void effectOpacityChanged(); + void effectRotationChanged(); signals: void effectChanged(const QRect &); void effectPointsChanged(const QVariantList &); + void opacityChanged(const qreal &); + void angleChanged(); }; #endif diff --git a/src/monitor/qmlmanager.cpp b/src/monitor/qmlmanager.cpp --- a/src/monitor/qmlmanager.cpp +++ b/src/monitor/qmlmanager.cpp @@ -66,6 +66,8 @@ root = m_view->rootObject(); QObject::connect(root, SIGNAL(effectChanged()), this, SLOT(effectRectChanged()), Qt::UniqueConnection); QObject::connect(root, SIGNAL(centersChanged()), this, SLOT(effectPolygonChanged()), Qt::UniqueConnection); + QObject::connect(root, SIGNAL(opacityChanged(qreal)), this, SIGNAL(opacityChanged(qreal)), Qt::UniqueConnection); + QObject::connect(root, SIGNAL(angleChanged()), this, SIGNAL(angleChanged()), Qt::UniqueConnection); root->setProperty("profile", QPoint(profile.width(), profile.height())); root->setProperty("framesize", QRect(0, 0, profile.width(), profile.height())); root->setProperty("scalex", (double)displayRect.width() / profile.width() * zoom); @@ -151,3 +153,20 @@ } emit effectPointsChanged(mix); } + +void QmlManager::effectOpacityChanged() +{ + if (!m_view->rootObject()) { + return; + } + const qreal opacityValue = m_view->rootObject()->property("opacity").toReal(); + emit opacityChanged(opacityValue); +} + +void QmlManager::effectRotationChanged() +{ + if (!m_view->rootObject()) { + return; + } + emit angleChanged(); +} diff --git a/src/monitor/view/OpacitySlider.qml b/src/monitor/view/OpacitySlider.qml new file mode 100644 --- /dev/null +++ b/src/monitor/view/OpacitySlider.qml @@ -0,0 +1,22 @@ +import QtQuick.Controls 1.3 +import QtQuick.Controls.Styles 1.3 +import QtQuick 2.0 + +Item { + id: opacity + objectName: "opacity" + + Row { + Slider { + id: opacitySlider + objectName: "opacitySlider" + orientation: Qt.Horizontal + maximumValue: 1.0 + stepSize: 0.01 + value: 0.5 + onValueChanged: { + opacitySlider.opacityChanged(value); + } + } + } +} diff --git a/src/monitor/view/RotationSlider.qml b/src/monitor/view/RotationSlider.qml new file mode 100644 --- /dev/null +++ b/src/monitor/view/RotationSlider.qml @@ -0,0 +1,22 @@ +import QtQuick.Controls 1.3 +import QtQuick.Controls.Styles 1.3 +import QtQuick 2.0 + +Item { + id: rotation + objectName: "rotation" + + Row { + Slider { + id: rotationSlider + objectName: "rotationSlider" + orientation: Qt.Horizontal + maximumValue: 359 + stepSize: 1 + value: 0 + onValueChanged: { + rotationSlider.angleChanged(); + } + } + } +} diff --git a/src/monitor/view/kdenlivemonitoreffectscene.qml b/src/monitor/view/kdenlivemonitoreffectscene.qml --- a/src/monitor/view/kdenlivemonitoreffectscene.qml +++ b/src/monitor/view/kdenlivemonitoreffectscene.qml @@ -28,11 +28,15 @@ property var centerPointsTypes: [] onCenterPointsChanged: canvas.requestPaint() property bool showToolbar: false + property bool showOpacity: false + property bool showRotation: false signal effectChanged() signal centersChanged() signal addKeyframe() signal seekToKeyframe() signal toolBarChanged(bool doAccept) + signal opacityChanged(real value) + signal angleChanged() onZoomChanged: { effectToolBar.setZoom(root.zoom) } @@ -510,4 +514,25 @@ color: framerect.hoverColor } } + + OpacitySlider { + id: opacityslider + anchors { + left: parent.left + top: parent.top + topMargin: 20 + leftMargin: 10 + } + } + + RotationSlider { + id: rotationslider + anchors { + left: parent.left + top: parent.top + topMargin: 30 + leftMargin: 10 + } + } + } diff --git a/src/uiresources.qrc b/src/uiresources.qrc --- a/src/uiresources.qrc +++ b/src/uiresources.qrc @@ -13,6 +13,8 @@ monitor/view/SceneToolBar.qml monitor/view/EffectToolBar.qml monitor/view/MonitorRuler.qml + monitor/view/OpacitySlider.qml + monitor/view/RotationSlider.qml timeline2/view/qml/timeline.qml timeline2/view/qml/TrackHead.qml timeline2/view/qml/Track.qml diff --git a/src/widgets/geometrywidget.h b/src/widgets/geometrywidget.h --- a/src/widgets/geometrywidget.h +++ b/src/widgets/geometrywidget.h @@ -30,6 +30,7 @@ class KSelectAction; class DragValue; class Monitor; +class DoubleWidget; /** * @brief A widget for modifying numbers by dragging, using the mouse wheel or entering them with the keyboard. @@ -63,6 +64,7 @@ DragValue *m_spinHeight; DragValue *m_spinSize; DragValue *m_opacity; + DoubleWidget *m_rotationWidget; QSize m_defaultSize; QSize m_sourceSize; QAction *m_originalSize; @@ -73,6 +75,8 @@ public slots: void slotUpdateGeometryRect(const QRect r); void slotSetRange(QPair); + void slotUpdateOpacity(qreal); + void slotUpdateRotation(qreal); private slots: void slotAdjustRectKeyframeValue(); @@ -100,6 +104,8 @@ signals: void valueChanged(const QString val); + void opacityChanged(qreal opacity); + void angleChanged(); }; #endif diff --git a/src/widgets/geometrywidget.cpp b/src/widgets/geometrywidget.cpp --- a/src/widgets/geometrywidget.cpp +++ b/src/widgets/geometrywidget.cpp @@ -35,6 +35,7 @@ , m_max(range.second) , m_active(false) , m_monitor(monitor) + , m_rotationWidget(nullptr) { Q_UNUSED(useRatioLock) @@ -49,7 +50,7 @@ if (!comment.isEmpty()) { comment = i18n(comment.toUtf8().data()); }*/ - + auto *horLayout = new QHBoxLayout; horLayout->setSpacing(2); m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this); @@ -403,6 +404,17 @@ m_monitor->setUpEffectGeometry(r); } +void GeometryWidget::slotUpdateOpacity(qreal value) +{ + m_opacity->setValue(value); +} + +void GeometryWidget::slotUpdateRotation(qreal value) +{ + if(m_rotationWidget) { + m_rotationWidget->setValue(value); + } +} const QString GeometryWidget::getValue() const { @@ -417,7 +429,11 @@ m_active = activate; if (activate) { m_monitor->slotShowEffectScene(MonitorSceneGeometry); + m_monitor->setEffectSceneProperty(QStringLiteral("showRotation"), true); + m_monitor->setEffectSceneProperty(QStringLiteral("showOpacity"), true); connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect, Qt::UniqueConnection); + connect(m_monitor, SIGNAL(opacityChanged()), this, SLOT(slotUpdateOpacity()), Qt::UniqueConnection); + connect(m_monitor, SIGNAL(angleChanged()), this, SLOT(slotUpdateRotation()), Qt::UniqueConnection); QRect rect(m_spinX->value(), m_spinY->value(), m_spinWidth->value(), m_spinHeight->value()); m_monitor->setUpEffectGeometry(rect); /*double ratio = (double)m_spinWidth->value() / m_spinHeight->value(); @@ -434,6 +450,8 @@ } else { m_monitor->slotShowEffectScene(MonitorSceneDefault); disconnect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect); + disconnect(m_monitor, SIGNAL(opacityChanged()), this, SLOT(slotUpdateOpacity())); + disconnect(m_monitor, SIGNAL(angleChanged()), this, SLOT(slotUpdateRotation())); } }