summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-12-07 09:40:00 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-12-07 09:40:30 (GMT)
commitd39d1860ee3cde75c0b60ef22c45bb3acc94a4a2 (patch)
treefd62d1f4c5c529ddca9ae4fed20d5fe15e5253c3
parentf8696c813c9952274c0f5c416688abab5c4a1193 (diff)
Add option in monitor options menu to display zoom toolbar
BUG: 371871
-rw-r--r--data/kdenliveclipmonitor.qml3
-rw-r--r--data/kdenlivemonitor.qml2
-rw-r--r--data/kdenlivemonitorcornerscene.qml23
-rw-r--r--data/kdenlivemonitoreffectscene.qml6
-rw-r--r--data/kdenlivemonitorrotoscene.qml21
-rw-r--r--src/monitor/monitor.cpp30
-rw-r--r--src/monitor/monitor.h3
7 files changed, 77 insertions, 11 deletions
diff --git a/data/kdenliveclipmonitor.qml b/data/kdenliveclipmonitor.qml
index 3aa3b94..4ef9b1b 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 = !root.showToolbar
+ toolBarChanged(root.showToolbar)
}
}
SceneToolBar {
diff --git a/data/kdenlivemonitor.qml b/data/kdenlivemonitor.qml
index f7c15df..53d6609 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 = !root.showToolbar
+ toolBarChanged(root.showToolbar)
}
}
SceneToolBar {
diff --git a/data/kdenlivemonitorcornerscene.qml b/data/kdenlivemonitorcornerscene.qml
index 9a05939..98a4d7c 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 = 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);
@@ -153,6 +159,13 @@ Item {
root.addKeyframe()
}
+ onClicked: {
+ if (mouse.button & Qt.MidButton) {
+ root.showToolbar = !root.showToolbar
+ toolBarChanged(root.showToolbar)
+ }
+ }
+
onPositionChanged: {
if (root.iskeyframe == false) return;
if (pressed && root.requestedKeyFrame >= 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/kdenlivemonitoreffectscene.qml
index bf6ae81..fe6f727 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 = !root.showToolbar
+ toolBarChanged(root.showToolbar)
} else {
if (root.requestedKeyFrame >= 0 && !isMoving) {
root.seekToKeyframe();
diff --git a/data/kdenlivemonitorrotoscene.qml b/data/kdenlivemonitorrotoscene.qml
index ff9648d..372d66f 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 for 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 = 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);
@@ -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 = !root.showToolbar
+ toolBarChanged(root.showToolbar)
+ }
if (!root.isDefined) {
if (mouse.button == 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 3e25684..5e69676 100644
--- a/src/monitor/monitor.cpp
+++ b/src/monitor/monitor.cpp
@@ -308,14 +308,15 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
connect(m_ruler, SIGNAL(zoneChanged(QPoint)), this, SLOT(setClipZone(QPoint)));
}
+ m_sceneVisibilityAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("transform-crop")), i18n("Show/Hide edit mode"), this);
+ m_sceneVisibilityAction->setCheckable(true);
+ m_sceneVisibilityAction->setChecked(KdenliveSettings::showOnMonitorScene());
+ connect(m_sceneVisibilityAction, SIGNAL(triggered(bool)), this, SLOT(slotEnableEffectScene(bool)));
+ m_toolbar->addAction(m_sceneVisibilityAction);
- if (id == Kdenlive::ProjectMonitor) {
- m_sceneVisibilityAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("transform-crop")), i18n("Show/Hide edit mode"), this);
- m_sceneVisibilityAction->setCheckable(true);
- m_sceneVisibilityAction->setChecked(KdenliveSettings::showOnMonitorScene());
- connect(m_sceneVisibilityAction, SIGNAL(triggered(bool)), this, SLOT(slotEnableEffectScene(bool)));
- m_toolbar->addAction(m_sceneVisibilityAction);
- }
+ m_zoomVisibilityAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-in")), i18n("Zoom"), this);
+ m_zoomVisibilityAction->setCheckable(true);
+ connect(m_zoomVisibilityAction, SIGNAL(triggered(bool)), this, SLOT(slotEnableSceneZoom(bool)));
m_toolbar->addSeparator();
m_timePos = 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 = new QWidget(this);
@@ -497,6 +498,7 @@ void Monitor::setupMenu(QMenu *goMenu, QMenu *overlayMenu, 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 TimeCodeDisplay) 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 == Kdenlive::DvdMonitor || type == m_qmlManager->sceneType()) {
return;
}
- if (m_sceneVisibilityAction && !m_sceneVisibilityAction->isChecked()) {
+ bool sceneWithEdit = type == MonitorSceneGeometry || type == MonitorSceneCorners || type == MonitorSceneRoto;
+ if (m_sceneVisibilityAction && !m_sceneVisibilityAction->isChecked() && sceneWithEdit) {
// User doesn't want effect scenes
- if (type == MonitorSceneGeometry || type == MonitorSceneCorners || type == MonitorSceneRoto)
- type = MonitorSceneDefault;
+ type = MonitorSceneDefault;
}
m_qmlManager->setScene(m_id, type, m_glMonitor->profileSize(), (double) render->renderWidth() / render->frameRenderWidth(), m_glMonitor->displayRect(), m_glMonitor->zoom());
QQuickItem *root = 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(addKeyframe()), Qt::UniqueConnection);
QObject::connect(root, SIGNAL(seekToKeyframe()), this, SLOT(slotSeekToKeyFrame()), Qt::UniqueConnection);
+ QObject::connect(root, SIGNAL(toolBarChanged(bool)), m_zoomVisibilityAction, SLOT(setChecked(bool)), Qt::UniqueConnection);
break;
case MonitorSceneRipple:
QObject::connect(root, SIGNAL(doAcceptRipple(bool)), this, SIGNAL(acceptRipple(bool)), Qt::UniqueConnection);
diff --git a/src/monitor/monitor.h b/src/monitor/monitor.h
index 3067bae..79d9c48 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 &);