Commit d39d1860 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Add option in monitor options menu to display zoom toolbar

BUG: 371871
parent f8696c81
......@@ -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 {
......
......@@ -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 {
......
......@@ -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
}
}
......@@ -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();
......
......@@ -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
}
}
......@@ -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);
......
......@@ -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 &);
......
Supports Markdown
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