Small Qml fixes, load guides model in project monitor

parent 19e7158d
......@@ -1634,7 +1634,6 @@ void GLWidget::refreshSceneLayout()
void GLWidget::switchPlay(bool play, double speed)
{
// QMutexLocker locker(&m_mutex);
qDebug()<<"* * * *SWITCH PLAY: "<<play<<" = "<<speed;
m_proxy->setSeekPosition(SEEK_INACTIVE);
if ((m_producer == nullptr) || (m_consumer == nullptr)) {
return;
......@@ -1734,10 +1733,12 @@ int GLWidget::getCurrentPos() const
return m_proxy->seekPosition() == SEEK_INACTIVE ? m_consumer->position() : m_proxy->seekPosition();
}
void GLWidget::setRulerInfo(int duration, int in, int out, std::shared_ptr<MarkerListModel> model)
void GLWidget::setRulerInfo(int duration, std::shared_ptr<MarkerListModel> model)
{
rootObject()->setProperty("duration", duration);
rootContext()->setContextProperty("markersModel", model.get());
if (model != nullptr) {
rootContext()->setContextProperty("markersModel", model.get());
}
}
bool GLWidget::setProducer(Mlt::Producer *producer, int position, bool isActive)
......
......@@ -107,7 +107,7 @@ public:
int getCurrentPos() const;
/** @brief Requests a monitor refresh */
void requestRefresh();
void setRulerInfo(int duration, int in, int out, std::shared_ptr<MarkerListModel> model);
void setRulerInfo(int duration, std::shared_ptr<MarkerListModel> model = nullptr);
MonitorProxy *getControllerProxy();
bool playZone(bool loop = false);
bool loopClip();
......
......@@ -1201,13 +1201,13 @@ void Monitor::seekCursor(int pos)
}*/
}
void Monitor::adjustRulerSize(int length, int offset)
void Monitor::adjustRulerSize(int length, std::shared_ptr<MarkerListModel> markerModel)
{
if (m_controller != nullptr) {
QPoint zone = m_controller->zone();
m_glMonitor->setRulerInfo(length, zone.x(), zone.y(), nullptr);
m_glMonitor->setRulerInfo(length);
} else {
m_glMonitor->setRulerInfo(length, 0, 100, nullptr);
m_glMonitor->setRulerInfo(length, markerModel);
}
if (length > 0) {
m_length = length;
......@@ -1344,7 +1344,7 @@ void Monitor::slotOpenClip(ProjectClip *controller, int in, int out)
// we are in record mode, don't display clip
return;
}
m_glMonitor->setRulerInfo(m_controller->frameDuration(), in, out, controller->getMarkerModel());
m_glMonitor->setRulerInfo(m_controller->frameDuration(), controller->getMarkerModel());
updateMarkers();
// Loading new clip / zone, stop if playing
if (m_playAction->isActive()) {
......@@ -1881,8 +1881,6 @@ void Monitor::loadQmlScene(MonitorSceneType type)
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);
switch (type) {
case MonitorSceneSplit:
......
......@@ -26,6 +26,7 @@
#include "gentime.h"
#include "renderer.h"
#include "scopes/sharedframe.h"
#include "bin/model/markerlistmodel.hpp"
#include "timecodedisplay.h"
#include <QDomElement>
......@@ -307,7 +308,7 @@ public slots:
void slotLoadClipZone(int start, int end);
void slotSeekToNextSnap();
void slotSeekToPreviousSnap();
void adjustRulerSize(int length, int offset = 0);
void adjustRulerSize(int length, std::shared_ptr<MarkerListModel> markerModel = nullptr);
void setTimePos(const QString &pos);
QPoint getZoneInfo() const;
/** @brief Display the on monitor effect scene (to adjust geometry over monitor). */
......
......@@ -27,7 +27,7 @@ Item {
property bool showSafezone
property bool showAudiothumb
property bool showToolbar: false
property int displayFontSize
property real baseUnit: fontMetrics.font.pointSize
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
......@@ -35,6 +35,12 @@ Item {
property double frameSize: 10
property double timeScale: 1
property int rulerHeight: 20
FontMetrics {
id: fontMetrics
font.family: "Arial"
}
onZoomChanged: {
sceneToolBar.setZoom(root.zoom)
}
......@@ -132,7 +138,7 @@ Item {
style: Text.Outline;
styleColor: "black"
text: root.timecode
font.pixelSize: root.displayFontSize
font.pixelSize: root.baseUnit
visible: root.showTimecode
anchors {
right: root.right
......@@ -148,7 +154,7 @@ Item {
styleColor: "black"
text: root.fps + "fps"
visible: root.showFps
font.pixelSize: root.displayFontSize
font.pixelSize: root.baseUnit
anchors {
right: timecode.visible ? timecode.left : root.right
bottom: root.bottom
......@@ -179,7 +185,7 @@ Item {
width: marker.width
}
}
font.pixelSize: root.displayFontSize
font.pixelSize: root.baseUnit
}
MonitorRuler {
id: clipMonitorRuler
......
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick 2.4
Item {
id: root
......@@ -24,7 +24,7 @@ Item {
property bool showSafezone
property bool showAudiothumb
property bool showToolbar: false
property int displayFontSize
property real baseUnit: fontMetrics.font.pointSize
property int duration: 300
property bool mouseOverRuler: false
property int mouseRulerPos: 0
......@@ -32,6 +32,13 @@ Item {
property double frameSize: 10
property double timeScale: 1
property int rulerHeight: 20
FontMetrics {
id: fontMetrics
font.family: "Arial"
}
onZoomChanged: {
sceneToolBar.setZoom(root.zoom)
}
......@@ -97,7 +104,7 @@ Item {
styleColor: "black"
text: root.timecode
visible: root.showTimecode
font.pixelSize: root.displayFontSize
font.pixelSize: root.baseUnit
anchors {
right: root.right
bottom: root.bottom
......@@ -113,7 +120,7 @@ Item {
styleColor: "black"
text: root.fps + "fps"
visible: root.showFps
font.pixelSize: root.displayFontSize
font.pixelSize: root.baseUnit
anchors {
right: timecode.visible ? timecode.left : root.right
bottom: root.bottom
......@@ -145,7 +152,7 @@ Item {
width: marker.width
}
}
font.pixelSize: root.displayFontSize
font.pixelSize: root.baseUnit
}
MonitorRuler {
id: clipMonitorRuler
......
......@@ -597,7 +597,7 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
m_trackView->setDuration(m_trackView->duration());*/
pCore->window()->slotGotProgressInfo(QString(), 100);
pCore->monitorManager()->projectMonitor()->adjustRulerSize(m_mainTimelineModel->duration() - 1);
pCore->monitorManager()->projectMonitor()->adjustRulerSize(m_mainTimelineModel->duration() - 1, m_project->getGuideModel());
if (openBackup) {
slotOpenBackup(url);
}
......@@ -608,7 +608,7 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
void ProjectManager::adjustProjectDuration()
{
pCore->monitorManager()->projectMonitor()->adjustRulerSize(m_mainTimelineModel->duration() - 1);
pCore->monitorManager()->projectMonitor()->adjustRulerSize(m_mainTimelineModel->duration() - 1, m_project->getGuideModel());
}
void ProjectManager::slotRevert()
......
......@@ -391,7 +391,6 @@ Rectangle {
timeline.seekPosition = timeline.position - 10
else
timeline.seekPosition = timeline.position + 10
timeline.position = timeline.seekPosition1
}
}
......
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