Start reconnecting effect scene toolbar

parent 55450159
......@@ -1645,11 +1645,15 @@ void AnimationWidget::monitorSeek(int pos)
if (m_spinX) {
// Update monitor scene for geometry params
if (pos > m_inPoint && pos < m_outPoint) {
connectMonitor(true);
m_monitor->slotShowEffectScene(MonitorSceneGeometry);
if (!m_active) {
connectMonitor(true);
m_monitor->slotShowEffectScene(MonitorSceneGeometry);
}
} else {
connectMonitor(false);
m_monitor->slotShowEffectScene(MonitorSceneDefault);
if (m_active) {
connectMonitor(false);
m_monitor->slotShowEffectScene(MonitorSceneDefault);
}
}
}
}
......
......@@ -248,10 +248,14 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
if (vals.count() >= 4) {
rect = QRect(vals.at(0).toInt(), vals.at(1).toInt(), vals.at(2).toInt(), vals.at(3).toInt());
}
GeometryWidget *geomWidget = new GeometryWidget(pCore->getMonitor(m_model->monitorId), range, rect, frameSize, false,
Monitor *monitor = pCore->getMonitor(m_model->monitorId);
GeometryWidget *geomWidget = new GeometryWidget(monitor, range, rect, frameSize, false,
m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), this);
connect(geomWidget, &GeometryWidget::valueChanged,
[this, index](const QString v) { m_keyframes->updateKeyframe(GenTime(getPosition(), pCore->getCurrentFps()), QVariant(v), index); });
connect(monitor, &Monitor::seekToNextKeyframe, m_keyframeview, &KeyframeView::slotGoToNext, Qt::UniqueConnection);
connect(monitor, &Monitor::seekToPreviousKeyframe, m_keyframeview, &KeyframeView::slotGoToPrev, Qt::UniqueConnection);
connect(monitor, &Monitor::addRemoveKeyframe, m_keyframeview, &KeyframeView::slotAddRemove, Qt::UniqueConnection);
paramWidget = geomWidget;
} else {
QLocale locale;
......
......@@ -159,6 +159,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
connect(m_glMonitor, &GLWidget::passKeyEvent, this, &Monitor::doKeyPressEvent);
connect(m_glMonitor, &GLWidget::panView, this, &Monitor::panView);
connect(m_glMonitor, &GLWidget::seekPosition, this, &Monitor::slotSeekPosition, Qt::DirectConnection);
connect(m_glMonitor, &GLWidget::activateMonitor, this, &AbstractMonitor::slotActivateMonitor, Qt::DirectConnection);
m_videoWidget = QWidget::createWindowContainer(qobject_cast<QWindow *>(m_glMonitor));
m_videoWidget->setAcceptDrops(true);
......@@ -301,6 +302,10 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::zoneChanged, this, &Monitor::updateClipZone);
}
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::triggerAction, pCore.get(), &Core::triggerAction);
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::seekNextKeyframe, this, &Monitor::seekToNextKeyframe);
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::seekPreviousKeyframe, this, &Monitor::seekToPreviousKeyframe);
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::addRemoveKeyframe, this, &Monitor::addRemoveKeyframe);
connect(m_glMonitor->getControllerProxy(), &MonitorProxy::addRemoveKeyframe, this, &Monitor::slotSeekToKeyFrame);
m_sceneVisibilityAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("transform-crop")), i18n("Show/Hide edit mode"), this);
m_sceneVisibilityAction->setCheckable(true);
......@@ -1868,7 +1873,6 @@ void Monitor::loadQmlScene(MonitorSceneType type)
double ratio = (double)m_glMonitor->profileSize().width() / (int)(m_glMonitor->profileSize().height() * m_glMonitor->profile()->dar() + 0.5);
m_qmlManager->setScene(m_id, type, m_glMonitor->profileSize(), ratio, m_glMonitor->displayRect(), m_glMonitor->zoom(), m_timePos->maximum());
QQuickItem *root = m_glMonitor->rootObject();
connectQmlToolbar(root);
switch (type) {
case MonitorSceneSplit:
QObject::connect(root, SIGNAL(qmlMoveSplit()), this, SLOT(slotAdjustEffectCompare()), Qt::UniqueConnection);
......@@ -1876,8 +1880,6 @@ void Monitor::loadQmlScene(MonitorSceneType type)
case MonitorSceneGeometry:
case MonitorSceneCorners:
case MonitorSceneRoto:
QObject::connect(root, SIGNAL(addKeyframe()), this, SIGNAL(addKeyframe()), Qt::UniqueConnection);
QObject::connect(root, SIGNAL(seekToKeyframe()), this, SLOT(slotSeekToKeyFrame()), Qt::UniqueConnection);
break;
case MonitorSceneRipple:
QObject::connect(root, SIGNAL(doAcceptRipple(bool)), this, SIGNAL(acceptRipple(bool)), Qt::UniqueConnection);
......@@ -1898,28 +1900,6 @@ void Monitor::loadQmlScene(MonitorSceneType type)
m_qmlManager->setProperty(QStringLiteral("fps"), QString::number(m_monitorManager->timecode().fps(), 'g', 2));
}
void Monitor::connectQmlToolbar(QQuickItem *root)
{
// TODO: get rid of this horrible hack and use triggerAction in qml
// Effect monitor toolbar
QObject *button = root->findChild<QObject *>(QStringLiteral("nextKeyframe"));
if (button) {
QObject::connect(button, SIGNAL(clicked()), this, SIGNAL(seekToNextKeyframe()), Qt::UniqueConnection);
}
button = root->findChild<QObject *>(QStringLiteral("prevKeyframe"));
if (button) {
QObject::connect(button, SIGNAL(clicked()), this, SIGNAL(seekToPreviousKeyframe()), Qt::UniqueConnection);
}
button = root->findChild<QObject *>(QStringLiteral("addKeyframe"));
if (button) {
QObject::connect(button, SIGNAL(clicked()), this, SIGNAL(addKeyframe()), Qt::UniqueConnection);
}
button = root->findChild<QObject *>(QStringLiteral("removeKeyframe"));
if (button) {
QObject::connect(button, SIGNAL(clicked()), this, SIGNAL(deleteKeyframe()), Qt::UniqueConnection);
}
}
void Monitor::setQmlProperty(const QString &name, const QVariant &value)
{
m_qmlManager->setProperty(name, value);
......
......@@ -233,8 +233,6 @@ private:
void adjustScrollBars(float horizontal, float vertical);
void loadQmlScene(MonitorSceneType type);
void updateQmlDisplay(int currentOverlay);
/** @brief Connect qml on monitor toolbar buttons */
void connectQmlToolbar(QQuickItem *root);
/** @brief Check and display dropped frames */
void checkDrops(int dropped);
/** @brief Create temporary Mlt::Tractor holding a clip and it's effectless clone */
......@@ -347,8 +345,7 @@ signals:
void extractZone(const QString &id);
void effectChanged(const QRect &);
void effectPointsChanged(const QVariantList &);
void addKeyframe();
void deleteKeyframe();
void addRemoveKeyframe();
void seekToNextKeyframe();
void seekToPreviousKeyframe();
void seekToKeyframe(int);
......
......@@ -79,9 +79,13 @@ signals:
void rulerHeightChanged();
void addSnap(int);
void removeSnap(int);
Q_INVOKABLE void triggerAction(const QString &name);
void triggerAction(const QString &name);
void overlayTypeChanged();
void timecodeChanged();
void seekNextKeyframe();
void seekPreviousKeyframe();
void addRemoveKeyframe();
void seekToKeyframe();
private:
GLWidget *q;
......
......@@ -2,69 +2,53 @@ import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
import QtQuick 2.0
Rectangle {
id: effecttoolbar
objectName: "effecttoolbar"
width: fullscreenButton.width
height: fullscreenButton.height * 5 + zoomSlider.height + 2
height: childrenRect.height
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
color: Qt.rgba(myPalette.window.r, myPalette.window.g, myPalette.window.b, 0.7)
radius: 4
border.color : Qt.rgba(0, 0, 0, 0.3)
border.width: 1
function setZoom(zoom) {
if (zoom >= 1) {
zoomSlider.value = zoom + 2
} else if (zoom == 0.5) {
zoomSlider.value = 2
} else if (zoom == 0.25) {
zoomSlider.value = 1
} else if (zoom == 0.125) {
zoomSlider.value = 0
}
}
Column {
ToolButton {
id: fullscreenButton
objectName: "fullScreen"
iconName: "view-fullscreen"
tooltip: "Switch Full Screen"
onClicked: controller.triggerAction('monitor_fullscreen')
}
ToolButton {
objectName: "nextKeyframe"
iconName: "go-next"
tooltip: "Go to Next Keyframe"
onClicked: controller.seekNextKeyframe()
}
ToolButton {
objectName: "prevKeyframe"
iconName: "go-previous"
tooltip: "Go to Previous Keyframe"
onClicked: controller.seekPreviousKeyframe()
}
ToolButton {
objectName: "addKeyframe"
iconName: "list-add"
tooltip: "Add Keyframe"
tooltip: "Add/Remove Keyframe"
onClicked: controller.addRemoveKeyframe()
}
ToolButton {
objectName: "removeKeyframe"
iconName: "list-remove"
tooltip: "Remove Keyframe"
iconName: "zoom-in"
tooltip: "Zoom in"
onClicked: controller.triggerAction('monitor_zoomin')
}
Slider {
id: zoomSlider
signal zoomChanged(real value)
anchors.horizontalCenter:parent.horizontalCenter
objectName: "zoomSlider"
orientation: Qt.Vertical
height: fullscreenButton.height * 3
maximumValue: 5.0
stepSize: 1.0
value: 3.0
onValueChanged: {
zoomSlider.zoomChanged(value);
}
ToolButton {
iconName: "zoom-out"
tooltip: "Zoom out"
onClicked: controller.triggerAction('monitor_zoomout')
}
}
}
......@@ -11,7 +11,6 @@ Item {
property rect framesize
property point profile
property point center
property double zoom
property double scalex
property double scaley
property double stretch : 1
......@@ -26,15 +25,9 @@ Item {
property bool iskeyframe
property int requestedKeyFrame
property var centerPoints: []
property bool showToolbar: false
onCenterPointsChanged: canvas.requestPaint()
signal effectPolygonChanged()
signal addKeyframe()
signal seekToKeyframe()
signal toolBarChanged(bool doAccept)
onZoomChanged: {
effectToolBar.setZoom(root.zoom)
}
function refreshdar() {
canvas.darOffset = root.sourcedar < root.profile.x * root.stretch / root.profile.y ? (root.profile.x * root.stretch - root.profile.y * root.sourcedar) / (2 * root.profile.x * root.stretch) :(root.profile.y - root.profile.x * root.stretch / root.sourcedar) / (2 * root.profile.y);
......@@ -193,11 +186,20 @@ Item {
EffectToolBar {
id: effectToolBar
anchors {
left: parent.left
right: parent.right
top: parent.top
topMargin: 10
leftMargin: 10
topMargin: 4
rightMargin: 4
}
visible: global.mouseX >= x - 10
}
MonitorRuler {
id: clipMonitorRuler
anchors {
left: root.left
right: root.right
bottom: root.bottom
}
visible: root.showToolbar
height: controller.rulerHeight
}
}
......@@ -13,7 +13,6 @@ Item {
property rect adjustedFrame
property point profile
property point center
property double zoom
property double scalex
property double scaley
property double offsetx : 0
......@@ -33,15 +32,10 @@ Item {
property var centerPoints: []
property var centerPointsTypes: []
onCenterPointsChanged: canvas.requestPaint()
property bool showToolbar: false
signal effectChanged()
signal centersChanged()
signal addKeyframe()
signal seekToKeyframe()
signal toolBarChanged(bool doAccept)
onZoomChanged: {
effectToolBar.setZoom(root.zoom)
}
onDurationChanged: {
timeScale = width / duration
if (duration < 200) {
......@@ -210,7 +204,7 @@ Item {
onPressed: {
if (mouse.button & Qt.LeftButton) {
if (root.requestedKeyFrame >= 0 && !isMoving) {
root.seekToKeyframe();
controller.seekToKeyframe();
}
}
isMoving = false
......@@ -224,16 +218,7 @@ Item {
isMoving = false;
}
}
EffectToolBar {
id: effectToolBar
anchors {
left: parent.left
top: parent.top
topMargin: 10
leftMargin: 10
}
visible: root.showToolbar
}
Rectangle {
id: framerect
property color hoverColor: "#ffffff"
......@@ -528,6 +513,16 @@ Item {
color: framerect.hoverColor
}
}
EffectToolBar {
id: effectToolBar
anchors {
right: parent.right
top: parent.top
topMargin: 4
rightMargin: 4
}
visible: global.mouseX >= x - 10
}
MonitorRuler {
id: clipMonitorRuler
anchors {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment