Git commit d39d1860ee3cde75c0b60ef22c45bb3acc94a4a2 by Jean-Baptiste Mardel= le. Committed on 07/12/2016 at 09:40. Pushed by mardelle into branch 'Applications/16.12'. Add option in monitor options menu to display zoom toolbar BUG: 371871 M +3 -0 data/kdenliveclipmonitor.qml M +2 -0 data/kdenlivemonitor.qml M +23 -0 data/kdenlivemonitorcornerscene.qml M +6 -0 data/kdenlivemonitoreffectscene.qml M +21 -0 data/kdenlivemonitorrotoscene.qml M +19 -11 src/monitor/monitor.cpp M +3 -0 src/monitor/monitor.h https://commits.kde.org/kdenlive/d39d1860ee3cde75c0b60ef22c45bb3acc94a4a2 diff --git a/data/kdenliveclipmonitor.qml b/data/kdenliveclipmonitor.qml index 3aa3b9494..4ef9b1bf3 100644 --- a/data/kdenliveclipmonitor.qml +++ b/data/kdenliveclipmonitor.qml @@ -28,11 +28,14 @@ Item { sceneToolBar.setZoom(root.zoom) } signal editCurrentMarker() + signal toolBarChanged(bool doAccept) + MouseArea { anchors.fill: parent acceptedButtons: Qt.MidButton onClicked: { root.showToolbar =3D !root.showToolbar + toolBarChanged(root.showToolbar) } } SceneToolBar { diff --git a/data/kdenlivemonitor.qml b/data/kdenlivemonitor.qml index f7c15df65..53d660990 100644 --- a/data/kdenlivemonitor.qml +++ b/data/kdenlivemonitor.qml @@ -27,12 +27,14 @@ Item { sceneToolBar.setZoom(root.zoom) } signal editCurrentMarker() + signal toolBarChanged(bool doAccept) = MouseArea { anchors.fill: parent acceptedButtons: Qt.MidButton onClicked: { root.showToolbar =3D !root.showToolbar + toolBarChanged(root.showToolbar) } } SceneToolBar { diff --git a/data/kdenlivemonitorcornerscene.qml b/data/kdenlivemonitorcorn= erscene.qml index 9a0593918..98a4d7c67 100644 --- a/data/kdenlivemonitorcornerscene.qml +++ b/data/kdenlivemonitorcornerscene.qml @@ -11,6 +11,7 @@ Item { property rect framesize property point profile property point center + property double zoom property double scalex property double scaley property double stretch : 1 @@ -25,10 +26,15 @@ 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 =3D root.sourcedar < root.profile.x * root.stretc= h / root.profile.y ? (root.profile.x * root.stretch - root.profile.y * root= .sourcedar) / (2 * root.profile.x * root.stretch) :(root.profile.y - root.p= rofile.x * root.stretch / root.sourcedar) / (2 * root.profile.y); @@ -153,6 +159,13 @@ Item { root.addKeyframe() } = + onClicked: { + if (mouse.button & Qt.MidButton) { + root.showToolbar =3D !root.showToolbar + toolBarChanged(root.showToolbar) + } + } + onPositionChanged: { if (root.iskeyframe =3D=3D false) return; if (pressed && root.requestedKeyFrame >=3D 0) { @@ -184,4 +197,14 @@ Item { } } } + EffectToolBar { + id: effectToolBar + anchors { + left: parent.left + top: parent.top + topMargin: 10 + leftMargin: 10 + } + visible: root.showToolbar + } } diff --git a/data/kdenlivemonitoreffectscene.qml b/data/kdenlivemonitoreffe= ctscene.qml index bf6ae81b2..fe6f7274e 100644 --- a/data/kdenlivemonitoreffectscene.qml +++ b/data/kdenlivemonitoreffectscene.qml @@ -11,6 +11,7 @@ Item { property rect framesize property point profile property point center + property double zoom property double scalex property double scaley property double offsetx : 0 @@ -29,6 +30,10 @@ Item { signal centersChanged() signal addKeyframe() signal seekToKeyframe() + signal toolBarChanged(bool doAccept) + onZoomChanged: { + effectToolBar.setZoom(root.zoom) + } = Text { id: fontReference @@ -181,6 +186,7 @@ Item { onClicked: { if (mouse.button & Qt.MidButton) { root.showToolbar =3D !root.showToolbar + toolBarChanged(root.showToolbar) } else { if (root.requestedKeyFrame >=3D 0 && !isMoving) { root.seekToKeyframe(); diff --git a/data/kdenlivemonitorrotoscene.qml b/data/kdenlivemonitorrotosc= ene.qml index ff9648d56..372d66fd1 100644 --- a/data/kdenlivemonitorrotoscene.qml +++ b/data/kdenlivemonitorrotoscene.qml @@ -12,6 +12,7 @@ Item { property point profile profile: Qt.point(1920, 1080) property point center: Qt.point(960, 540) + property double zoom property double scalex : 1 property double scaley : 1 property double stretch : 1 @@ -31,10 +32,15 @@ Item { property var centerPoints : [] // The control points for the bezier curve points (2 controls points f= or each coordinate) property var centerPointsTypes : [] + property bool showToolbar: false onCenterPointsTypesChanged: checkDefined() signal effectPolygonChanged() signal addKeyframe() signal seekToKeyframe() + signal toolBarChanged(bool doAccept) + onZoomChanged: { + effectToolBar.setZoom(root.zoom) + } = function refreshdar() { canvas.darOffset =3D root.sourcedar < root.profile.x * root.stretc= h / root.profile.y ? (root.profile.x * root.stretch - root.profile.y * root= .sourcedar) / (2 * root.profile.x * root.stretch) :(root.profile.y - root.p= rofile.x * root.stretch / root.sourcedar) / (2 * root.profile.y); @@ -164,6 +170,7 @@ Item { color: "transparent" border.color: "#ffffff00" } + MouseArea { id: global objectName: "global" @@ -175,6 +182,10 @@ Item { cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor = onClicked: { + if (mouse.button & Qt.MidButton) { + root.showToolbar =3D !root.showToolbar + toolBarChanged(root.showToolbar) + } if (!root.isDefined) { if (mouse.button =3D=3D Qt.RightButton) { // close shape, define control points @@ -270,4 +281,14 @@ Item { } } } + EffectToolBar { + id: effectToolBar + anchors { + left: parent.left + top: parent.top + topMargin: 10 + leftMargin: 10 + } + visible: root.showToolbar + } } diff --git a/src/monitor/monitor.cpp b/src/monitor/monitor.cpp index 3e256849f..5e696762a 100644 --- a/src/monitor/monitor.cpp +++ b/src/monitor/monitor.cpp @@ -308,14 +308,15 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManag= er *manager, QWidget *paren connect(m_ruler, SIGNAL(zoneChanged(QPoint)), this, SLOT(setClipZo= ne(QPoint))); } = + m_sceneVisibilityAction =3D new QAction(KoIconUtils::themedIcon(QStrin= gLiteral("transform-crop")), i18n("Show/Hide edit mode"), this); + m_sceneVisibilityAction->setCheckable(true); + m_sceneVisibilityAction->setChecked(KdenliveSettings::showOnMonitorSce= ne()); + connect(m_sceneVisibilityAction, SIGNAL(triggered(bool)), this, SLOT(s= lotEnableEffectScene(bool))); + m_toolbar->addAction(m_sceneVisibilityAction); = - if (id =3D=3D Kdenlive::ProjectMonitor) { - m_sceneVisibilityAction =3D new QAction(KoIconUtils::themedIcon(QS= tringLiteral("transform-crop")), i18n("Show/Hide edit mode"), this); - m_sceneVisibilityAction->setCheckable(true); - m_sceneVisibilityAction->setChecked(KdenliveSettings::showOnMonito= rScene()); - connect(m_sceneVisibilityAction, SIGNAL(triggered(bool)), this, SL= OT(slotEnableEffectScene(bool))); - m_toolbar->addAction(m_sceneVisibilityAction); - } + m_zoomVisibilityAction =3D new QAction(KoIconUtils::themedIcon(QString= Literal("zoom-in")), i18n("Zoom"), this); + m_zoomVisibilityAction->setCheckable(true); + connect(m_zoomVisibilityAction, SIGNAL(triggered(bool)), this, SLOT(sl= otEnableSceneZoom(bool))); = m_toolbar->addSeparator(); m_timePos =3D new TimecodeDisplay(m_monitorManager->timecode(), this); @@ -325,7 +326,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager= *manager, QWidget *paren configButton->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive= -menu"))); configButton->setToolTip(i18n("Options")); configButton->setMenu(m_configMenu); - configButton->setPopupMode(QToolButton::QToolButton::InstantPopup); + configButton->setPopupMode(QToolButton::InstantPopup); m_toolbar->addWidget(configButton); if (m_recManager) m_toolbar->addAction(m_recManager->switchAction()); /*QWidget *spacer =3D new QWidget(this); @@ -497,6 +498,7 @@ void Monitor::setupMenu(QMenu *goMenu, QMenu *overlayMe= nu, QAction *playZone, QA switchAudioMonitor->setCheckable(true); switchAudioMonitor->setChecked(KdenliveSettings::monitoraudio() & m_id= ); m_configMenu->addAction(overlayAudio); + m_configMenu->addAction(m_zoomVisibilityAction); // For some reason, the frame in QAbstracSpinBox (base class of TimeCo= deDisplay) needs to be displayed once, then hidden // or it will never appear (supposed to appear on hover). m_timePos->setFrame(false); @@ -1513,6 +1515,10 @@ void Monitor::slotSetSelectedClip(Transition* item) } } = +void Monitor::slotEnableSceneZoom(bool enable) +{ + m_qmlManager->setProperty(QStringLiteral("showToolbar"), enable); +} = void Monitor::slotEnableEffectScene(bool enable) { @@ -1834,13 +1840,14 @@ void Monitor::loadQmlScene(MonitorSceneType type) if (m_id =3D=3D Kdenlive::DvdMonitor || type =3D=3D m_qmlManager->scen= eType()) { return; } - if (m_sceneVisibilityAction && !m_sceneVisibilityAction->isChecked()) { + bool sceneWithEdit =3D type =3D=3D MonitorSceneGeometry || type =3D=3D= MonitorSceneCorners || type =3D=3D MonitorSceneRoto; + if (m_sceneVisibilityAction && !m_sceneVisibilityAction->isChecked() &= & sceneWithEdit) { // User doesn't want effect scenes - if (type =3D=3D MonitorSceneGeometry || type =3D=3D MonitorSceneCo= rners || type =3D=3D MonitorSceneRoto) - type =3D MonitorSceneDefault; + type =3D MonitorSceneDefault; } m_qmlManager->setScene(m_id, type, m_glMonitor->profileSize(), (double= ) render->renderWidth() / render->frameRenderWidth(), m_glMonitor->displayR= ect(), m_glMonitor->zoom()); QQuickItem *root =3D m_glMonitor->rootObject(); + root->setProperty("showToolbar", m_zoomVisibilityAction->isChecked()); QFontInfo info(font()); root->setProperty("displayFontSize", info.pixelSize() * 1.4); connectQmlToolbar(root); @@ -1853,6 +1860,7 @@ void Monitor::loadQmlScene(MonitorSceneType type) case MonitorSceneRoto: QObject::connect(root, SIGNAL(addKeyframe()), this, SIGNAL(addKe= yframe()), Qt::UniqueConnection); QObject::connect(root, SIGNAL(seekToKeyframe()), this, SLOT(slot= SeekToKeyFrame()), Qt::UniqueConnection); + QObject::connect(root, SIGNAL(toolBarChanged(bool)), m_zoomVisib= ilityAction, SLOT(setChecked(bool)), Qt::UniqueConnection); break; case MonitorSceneRipple: QObject::connect(root, SIGNAL(doAcceptRipple(bool)), this, SIGNA= L(acceptRipple(bool)), Qt::UniqueConnection); diff --git a/src/monitor/monitor.h b/src/monitor/monitor.h index 3067bae15..79d9c480a 100644 --- a/src/monitor/monitor.h +++ b/src/monitor/monitor.h @@ -205,6 +205,7 @@ private: /** Has to be available so we can enable and disable it. */ QAction *m_loopClipAction; QAction *m_sceneVisibilityAction; + QAction *m_zoomVisibilityAction; QAction *m_multitrackView; QMenu *m_contextMenu; QMenu *m_configMenu; @@ -272,6 +273,8 @@ private slots: void gpuError(); void setOffsetX(int x); void setOffsetY(int y); + /** @brief Show/hide monitor zoom */ + void slotEnableSceneZoom(bool enable); = public slots: void slotOpenDvdFile(const QString &);