Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

small cleanup in monitor ruler, fix monitor image offset

parent a8d94198
......@@ -245,9 +245,9 @@ void GLWidget::initializeGL()
void GLWidget::resizeGL(int width, int height)
{
int x, y, w, h;
height -= m_proxy->rulerHeight();
double this_aspect = (double)width / height;
double video_aspect = m_monitorProfile->dar();
height -= rulerHeight();
// Special case optimisation to negate odd effect of sample aspect ratio
// not corresponding exactly with image resolution.
......@@ -420,7 +420,7 @@ void GLWidget::paintGL()
f->glDisable(GL_BLEND);
f->glDisable(GL_DEPTH_TEST);
f->glDepthMask(GL_FALSE);
f->glViewport(0, rulerHeight()/2, width, height);
f->glViewport(0, 0, width, height);
check_error(f);
QColor color(KdenliveSettings::window_background());
f->glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF());
......@@ -486,10 +486,10 @@ void GLWidget::paintGL()
QVector<QVector2D> vertices;
width = m_rect.width() * devicePixelRatio();
height = m_rect.height() * devicePixelRatio();
vertices << QVector2D(float(-width) / 2.0f, float(-height) / 2.0f);
vertices << QVector2D(float(-width) / 2.0f, float(height) / 2.0f);
vertices << QVector2D(float(width) / 2.0f, float(-height) / 2.0f);
vertices << QVector2D(float(width) / 2.0f, float(height) / 2.0f);
vertices << QVector2D(float(-width) / 2.0f, float(-height) / 2.0f + m_proxy->rulerHeight());
vertices << QVector2D(float(-width) / 2.0f, float(height) / 2.0f + m_proxy->rulerHeight());
vertices << QVector2D(float(width) / 2.0f, float(-height) / 2.0f + m_proxy->rulerHeight());
vertices << QVector2D(float(width) / 2.0f, float(height) / 2.0f + m_proxy->rulerHeight());
m_shader->enableAttributeArray(m_vertexLocation);
check_error(f);
m_shader->setAttributeArray(m_vertexLocation, vertices.constData());
......@@ -1785,11 +1785,6 @@ void GLWidget::setRulerInfo(int duration, std::shared_ptr<MarkerListModel> model
}
}
int GLWidget::rulerHeight() const
{
return rootObject()->property("rulerHeight").toInt();
}
void GLWidget::startConsumer()
{
if (m_consumer == nullptr) {
......
......@@ -26,6 +26,9 @@
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <QQuickView>
#include <QApplication>
#include <QFont>
#include <QFontMetrics>
#include <QRect>
#include <QSemaphore>
#include <QThread>
......@@ -295,6 +298,7 @@ class MonitorProxy : public QObject
Q_PROPERTY(int seekPosition READ seekPosition WRITE setSeekPosition NOTIFY seekPositionChanged)
Q_PROPERTY(int zoneIn READ zoneIn WRITE setZoneIn NOTIFY zoneChanged)
Q_PROPERTY(int zoneOut READ zoneOut WRITE setZoneOut NOTIFY zoneChanged)
Q_PROPERTY(int rulerHeight READ rulerHeight NOTIFY rulerHeightChanged)
Q_PROPERTY(QString markerComment READ markerComment NOTIFY markerCommentChanged)
public:
MonitorProxy(GLWidget *parent)
......@@ -304,10 +308,12 @@ public:
, m_seekPosition(-1)
, m_zoneIn(0)
, m_zoneOut(-1)
, m_rulerHeight(QFontMetrics(QApplication::font()).lineSpacing() * 0.7)
{
}
int seekPosition() const { return m_seekPosition; }
int position() const { return m_position; }
int rulerHeight() const { return m_rulerHeight; }
QString markerComment() const { return m_markerComment; }
Q_INVOKABLE void requestSeekPosition(int pos)
{
......@@ -371,6 +377,7 @@ signals:
void seekRequestChanged();
void zoneChanged();
void markerCommentChanged();
void rulerHeightChanged();
private:
GLWidget *q;
......@@ -378,6 +385,7 @@ private:
int m_seekPosition;
int m_zoneIn;
int m_zoneOut;
int m_rulerHeight;
QString m_markerComment;
};
......
......@@ -550,13 +550,13 @@ void Monitor::slotForceSize(QAction *a)
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_videoWidget->setMinimumSize(profileWidth, profileHeight);
m_videoWidget->setMaximumSize(profileWidth, profileHeight);
setMinimumSize(QSize(profileWidth, profileHeight + m_toolbar->height() + m_glMonitor->rulerHeight()));
setMinimumSize(QSize(profileWidth, profileHeight + m_toolbar->height() + m_glMonitor->getControllerProxy()->rulerHeight()));
break;
default:
// Free resize
m_videoWidget->setMinimumSize(profileWidth, profileHeight);
m_videoWidget->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
setMinimumSize(QSize(profileWidth, profileHeight + m_toolbar->height() + m_glMonitor->rulerHeight()));
setMinimumSize(QSize(profileWidth, profileHeight + m_toolbar->height() + m_glMonitor->getControllerProxy()->rulerHeight()));
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
break;
}
......
......@@ -8,7 +8,6 @@ import QtQuick 2.4
Rectangle {
id: ruler
color: activePalette.window
opacity: 0.8
// frame ticks
Repeater {
......
......@@ -33,7 +33,6 @@ Item {
property int mouseRulerPos: 0
property double frameSize: 10
property double timeScale: 1
property int rulerHeight: 20
FontMetrics {
id: fontMetrics
......@@ -61,7 +60,7 @@ Item {
Item {
id: monitorOverlay
height: root.height - root.rulerHeight
height: root.height - controller.rulerHeight
width: root.width
SceneToolBar {
id: sceneToolBar
......@@ -209,6 +208,6 @@ Item {
right: root.right
bottom: root.bottom
}
height: root.rulerHeight
height: controller.rulerHeight
}
}
......@@ -33,7 +33,6 @@ Item {
property int mouseRulerPos: 0
property double frameSize: 10
property double timeScale: 1
property int rulerHeight: 20
FontMetrics {
id: fontMetrics
......@@ -61,7 +60,7 @@ Item {
Item {
id: monitorOverlay
height: root.height - root.rulerHeight
height: root.height - controller.rulerHeight
width: root.width
SceneToolBar {
id: sceneToolBar
......@@ -177,6 +176,6 @@ Item {
right: root.right
bottom: root.bottom
}
height: root.rulerHeight
height: controller.rulerHeight
}
}
......@@ -19,7 +19,6 @@ Item {
property double offsetx : 0
property double offsety : 0
property double lockratio : -1
property int rulerHeight: 20
property double timeScale: 1
property double frameSize: 10
property int duration: 300
......@@ -536,6 +535,6 @@ Item {
right: root.right
bottom: root.bottom
}
height: root.rulerHeight
height: controller.rulerHeight
}
}
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