[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdenlive/Applications/16.12] /: Add option in monitor options menu to display zoom toolbar
From: Jean-Baptiste Mardelle <jb () kdenlive ! org>
Date: 2016-12-07 9:40:36
Message-ID: E1cEYiK-0003aa-Vg () code ! kde ! org
[Download RAW message or body]
Git commit d39d1860ee3cde75c0b60ef22c45bb3acc94a4a2 by Jean-Baptiste Mardelle.
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 = !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 = !root.showToolbar
+ toolBarChanged(root.showToolbar)
}
}
SceneToolBar {
diff --git a/data/kdenlivemonitorcornerscene.qml \
b/data/kdenlivemonitorcornerscene.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 = 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 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 = !root.showToolbar
+ toolBarChanged(root.showToolbar)
} else {
if (root.requestedKeyFrame >= 0 && !isMoving) {
root.seekToKeyframe();
diff --git a/data/kdenlivemonitorrotoscene.qml b/data/kdenlivemonitorrotoscene.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 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 3e256849f..5e696762a 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 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 &);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic