#include <KLocalizedString>
#include <KGlobalSettings>
-DragValue::DragValue(const QString &label, int defaultValue, int id, const QString suffix, QWidget* parent) :
+DragValue::DragValue(const QString &label, int defaultValue, int id, const QString suffix, bool showSlider, QWidget* parent) :
QWidget(parent),
m_maximum(100),
m_minimum(0),
m_default(defaultValue),
m_id(id)
{
- setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ if (showSlider) setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ else setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
setFocusPolicy(Qt::StrongFocus);
setContextMenuPolicy(Qt::CustomContextMenu);
QHBoxLayout *l = new QHBoxLayout;
l->setSpacing(0);
l->setContentsMargins(0, 0, 0, 0);
- m_label = new CustomLabel(label, this);
+ m_label = new CustomLabel(label, showSlider, this);
m_label->setCursor(Qt::PointingHandCursor);
m_label->setRange(m_minimum, m_maximum);
l->addWidget(m_label);
m_edit = new KIntSpinBox(this);
+ m_edit->setObjectName("dragBox");
if (!suffix.isEmpty()) m_edit->setSuffix(suffix);
m_edit->setButtonSymbols(QAbstractSpinBox::NoButtons);
m_edit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- m_edit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
+ m_edit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
m_edit->setRange(m_minimum, m_maximum);
l->addWidget(m_edit);
connect(m_edit, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int)));
connect(m_label, SIGNAL(valueChanged(int,bool)), this, SLOT(setValue(int,bool)));
+ connect(m_label, SIGNAL(resetValue()), this, SLOT(slotReset()));
setLayout(l);
m_label->setMaximumHeight(m_edit->sizeHint().height());
connect(m_label, SIGNAL(setInTimeline()), this, SLOT(slotSetInTimeline()));
m_menu->addAction(timeline);
}
-
- m_label->setRange(m_minimum, m_maximum);
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotShowContextMenu(const QPoint&)));
connect(m_scale, SIGNAL(triggered(int)), this, SLOT(slotSetScaleMode(int)));
m_edit->update();
}
-CustomLabel::CustomLabel(const QString &label, QWidget* parent) :
+CustomLabel::CustomLabel(const QString &label, bool showSlider, QWidget* parent) :
QProgressBar(parent),
m_dragMode(false),
- m_step(1)
-
+ m_step(1),
+ m_showSlider(showSlider)
{
+ setFont(KGlobalSettings::toolBarFont());
setFormat(" " + label);
setFocusPolicy(Qt::ClickFocus);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
- setRange(0, 100);
+ if (!showSlider) {
+ QSize sh;
+ const QFontMetrics &fm = fontMetrics();
+ sh.setWidth(fm.width(" " + label + " "));
+ setMaximumWidth(sh.width());
+ setObjectName("dragOnly");
+ }
setValue(0);
- setFont(KGlobalSettings::toolBarFont());
}
void CustomLabel::mousePressEvent(QMouseEvent* e)
m_dragStartPosition = m_dragLastPosition = e->pos();
e->accept();
}
+ else if (e->button() == Qt::MiddleButton) {
+ emit resetValue();
+ m_dragStartPosition = QPoint(-1, -1);
+ }
else QWidget::mousePressEvent(e);
}
void CustomLabel::mouseMoveEvent(QMouseEvent* e)
{
- if ((e->pos() - m_dragStartPosition).manhattanLength() >= QApplication::startDragDistance()) {
- m_dragMode = true;
- if (KdenliveSettings::dragvalue_mode() > 0) {
- int diff = e->x() - m_dragLastPosition.x();
-
- if (e->modifiers() == Qt::ControlModifier)
- diff *= 2;
- else if (e->modifiers() == Qt::ShiftModifier)
- diff /= 2;
- if (KdenliveSettings::dragvalue_mode() == 2)
- diff = (diff > 0 ? 1 : -1) * pow(diff, 2);
-
- int nv = value() + diff / m_step;
- if (nv != value()) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
+ if (m_dragStartPosition != QPoint(-1, -1)) {
+ if (!m_dragMode && (e->pos() - m_dragStartPosition).manhattanLength() >= QApplication::startDragDistance()) {
+ m_dragMode = true;
+ m_dragLastPosition = e->pos();
+ e->accept();
+ return;
}
- else {
- int nv = minimum() + ((double) maximum() - minimum()) / width() * e->pos().x();
- if (nv != value()) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
+ if (m_dragMode) {
+ if (KdenliveSettings::dragvalue_mode() > 0 || !m_showSlider) {
+ int diff = e->x() - m_dragLastPosition.x();
+
+ if (e->modifiers() == Qt::ControlModifier)
+ diff *= 2;
+ else if (e->modifiers() == Qt::ShiftModifier)
+ diff /= 2;
+ if (KdenliveSettings::dragvalue_mode() == 2)
+ diff = (diff > 0 ? 1 : -1) * pow(diff, 2);
+
+ int nv = value() + diff / m_step;
+ if (nv != value()) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
+ }
+ else {
+ int nv = minimum() + ((double) maximum() - minimum()) / width() * e->pos().x();
+ if (nv != value()) setNewValue(nv, KdenliveSettings::dragvalue_directupdate());
+ }
+ m_dragLastPosition = e->pos();
+ e->accept();
}
- m_dragLastPosition = e->pos();
- e->accept();
}
else QWidget::mouseMoveEvent(e);
}
void CustomLabel::mouseReleaseEvent(QMouseEvent* e)
{
+ if (e->button() == Qt::MiddleButton) {
+ e->accept();
+ return;
+ }
if (e->modifiers() == Qt::ControlModifier) {
emit setInTimeline();
e->accept();
m_dragLastPosition = m_dragStartPosition;
e->accept();
}
- else {
+ else if (m_showSlider) {
setNewValue((int) (minimum() + ((double)maximum() - minimum()) / width() * e->pos().x()), true);
m_dragLastPosition = m_dragStartPosition;
e->accept();
{
Q_OBJECT
public:
- CustomLabel(const QString &label, QWidget *parent = 0);
+ CustomLabel(const QString &label, bool showSlider = true, QWidget *parent = 0);
protected:
//virtual void mouseDoubleClickEvent(QMouseEvent * event);
QPoint m_dragLastPosition;
bool m_dragMode;
double m_step;
+ bool m_showSlider;
//QStyleOptionProgressBarV2 m_progressOptions;
void slotValueInc(int factor = 1);
void slotValueDec(int factor = 1);
signals:
void valueChanged(int, bool);
void setInTimeline();
+ void resetValue();
};
/**
Q_OBJECT
public:
- DragValue(const QString &label, int defaultValue, int id, const QString suffix, QWidget* parent = 0);
+ DragValue(const QString &label, int defaultValue, int id, const QString suffix, bool showSlider = true, QWidget* parent = 0);
virtual ~DragValue();
/** @brief Returns the precision = number of decimals */
int spinSize();
/** @brief Sets the minimum size for QSpinBox, used to set all spinboxes to the same width. */
void setSpinSize(int width);
-
+
public slots:
/** @brief Sets the value (forced to be in the valid range) and emits valueChanged. */
void setValue(int value, bool final = true);
QColor light_bg = scheme.shade(KColorScheme::LightShade);
QColor mid_bg = scheme.shade(KColorScheme::DarkShade);
- QString stylesheet(QString("QProgressBar:horizontal {border: 1px solid %5;border-radius:0px;border-top-left-radius: 4px;border-bottom-left-radius: 4px;border-right: 0px;background:%4;padding: 0px;text-align:left center} QProgressBar:horizontal:hover {border: 1px solid %3;border-right: 0px;} QProgressBar::chunk:horizontal {background: %5;} QProgressBar::chunk:horizontal:hover {background: %3;} QProgressBar:horizontal[inTimeline=\"true\"] { border: 1px solid %2;border-right: 0px;background: %4;padding: 0px;text-align:left center } QProgressBar::chunk:horizontal[inTimeline=\"true\"] {background: %2;} QSpinBox {border: 1px solid %1;border-top-right-radius: 4px;border-bottom-right-radius: 4px;padding-right:0px;} QSpinBox::down-button {width:0px;padding:0px;} QSpinBox::up-button {width:0px;padding:0px;} QSpinBox[inTimeline=\"true\"]{ border: 1px solid %2;} QSpinBox:hover {border: 1px solid %3;} ").arg(dark_bg.name()).arg(selected_bg.name()).arg(hover_bg.name()).arg(light_bg.name()).arg(mid_bg.name()));
+ QString stylesheet(QString("QProgressBar:horizontal {border: 1px solid %5;border-radius:0px;border-top-left-radius: 4px;border-bottom-left-radius: 4px;border-right: 0px;background:%4;padding: 0px;text-align:left center} QProgressBar:horizontal#dragOnly {background: %5} QProgressBar:horizontal:hover#dragOnly {background: %3} QProgressBar:horizontal:hover {border: 1px solid %3;border-right: 0px;} QProgressBar::chunk:horizontal {background: %5;} QProgressBar::chunk:horizontal:hover {background: %3;} QProgressBar:horizontal[inTimeline=\"true\"] { border: 1px solid %2;border-right: 0px;background: %4;padding: 0px;text-align:left center } QProgressBar::chunk:horizontal[inTimeline=\"true\"] {background: %2;} QSpinBox#dragBox {border: 1px solid %1;border-top-right-radius: 4px;border-bottom-right-radius: 4px;padding-right:0px;} QSpinBox::down-button#dragBox {width:0px;padding:0px;} QSpinBox::up-button#dragBox {width:0px;padding:0px;} QSpinBox[inTimeline=\"true\"]#dragBox { border: 1px solid %2;} QSpinBox:hover#dragBox {border: 1px solid %3;} ").arg(dark_bg.name()).arg(selected_bg.name()).arg(hover_bg.name()).arg(light_bg.name()).arg(mid_bg.name()));
setStyleSheet(stylesheet);
setWidget(m_baseWidget);
QString type = pa.attributes().namedItem("type").nodeValue();
QString paramName = i18n(na.toElement().text().toUtf8().data());
- if (type == "geometry" && !KdenliveSettings::on_monitor_effects()) {
- Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
- geom->setFrameSize(m_frameSize);
- break;
+ if (type == "geometry") {
+ if (!KdenliveSettings::on_monitor_effects()) {
+ Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
+ geom->setFrameSize(m_frameSize);
+ break;
+ }
+ else {
+ GeometryWidget *geom = ((GeometryWidget*)m_valueItems[paramName+"geometry"]);
+ geom->setFrameSize(m_frameSize);
+ break;
+ }
}
}
}
} else if (type == "geometry") {
if (KdenliveSettings::on_monitor_effects()) {
GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
+ geometry->setFrameSize(m_frameSize);
geometry->slotShowScene(!disable);
// connect this before setupParam to make sure the monitor scene shows up at startup
connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
m_sceneview->setScene(m_scene);
m_dar = (m_profile.height * m_profile.display_aspect_num / (double) m_profile.display_aspect_den) / (double) m_profile.width;
- m_realWidth = (int)(profile.height * profile.display_aspect_num / (double) profile.display_aspect_den);
+ m_realWidth = (int)(profile.height * profile.display_aspect_num / (double) profile.display_aspect_den + 0.5);
QGraphicsRectItem *frameBorder = new QGraphicsRectItem(QRectF(0, 0, m_realWidth, profile.height));
frameBorder->setZValue(-1100);
frameBorder->setBrush(QColor(255, 255, 0, 30));
#include "monitoreditwidget.h"
#include "onmonitoritems/onmonitorrectitem.h"
#include "kdenlivesettings.h"
+#include "dragvalue.h"
#include <QtCore>
#include <QGraphicsView>
#include <QVBoxLayout>
#include <QGridLayout>
+#include <QMenu>
m_showScene(true)
{
m_ui.setupUi(this);
-
MonitorEditWidget *edit = monitor->getEffectEdit();
edit->showVisibilityButton(true);
m_scene = edit->getScene();
connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe()));
connect(m_ui.buttonSync, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool)));
-
+ m_spinX = new DragValue(i18n("X"), 0, -1, QString(), false, this);
+ m_spinX->setRange(-10000, 10000);
+ m_ui.horizontalLayout->addWidget(m_spinX);
+
+ m_spinY = new DragValue(i18n("Y"), 0, -1, QString(), false, this);
+ m_spinY->setRange(-10000, 10000);
+ m_ui.horizontalLayout->addWidget(m_spinY);
+
+ m_spinWidth = new DragValue(i18n("W"), m_monitor->render->frameRenderWidth(), -1, QString(), false, this);
+ m_spinWidth->setRange(1, 10000);
+ m_ui.horizontalLayout->addWidget(m_spinWidth);
+
+ m_spinHeight = new DragValue(i18n("H"), m_monitor->render->renderHeight(), -1, QString(), false, this);
+ m_spinHeight->setRange(1, 10000);
+ m_ui.horizontalLayout->addWidget(m_spinHeight);
+ m_ui.horizontalLayout->addStretch(10);
+
+ m_spinSize = new DragValue(i18n("Size"), 100, -1, i18n("%"), false, this);
+ m_spinSize->setRange(1, 10000);
+ m_ui.horizontalLayout2->addWidget(m_spinSize);
+
+ m_opacity = new DragValue(i18n("Opacity"), 100, -1, i18n("%"), true, this);
+ m_ui.horizontalLayout2->addWidget(m_opacity);
+
/*
Setup of geometry controls
*/
- m_ui.buttonMoveLeft->setIcon(KIcon("kdenlive-align-left"));
- m_ui.buttonMoveLeft->setToolTip(i18n("Move to left"));
- m_ui.buttonCenterH->setIcon(KIcon("kdenlive-align-hor"));
- m_ui.buttonCenterH->setToolTip(i18n("Center horizontally"));
- m_ui.buttonMoveRight->setIcon(KIcon("kdenlive-align-right"));
- m_ui.buttonMoveRight->setToolTip(i18n("Move to right"));
- m_ui.buttonMoveTop->setIcon(KIcon("kdenlive-align-top"));
- m_ui.buttonMoveTop->setToolTip(i18n("Move to top"));
- m_ui.buttonCenterV->setIcon(KIcon("kdenlive-align-vert"));
- m_ui.buttonCenterV->setToolTip(i18n("Center vertically"));
- m_ui.buttonMoveBottom->setIcon(KIcon("kdenlive-align-bottom"));
- m_ui.buttonMoveBottom->setToolTip(i18n("Move to bottom"));
-
- connect(m_ui.spinX, SIGNAL(valueChanged(int)), this, SLOT(slotSetX(int)));
- connect(m_ui.spinY, SIGNAL(valueChanged(int)), this, SLOT(slotSetY(int)));
- connect(m_ui.spinWidth, SIGNAL(valueChanged(int)), this, SLOT(slotSetWidth(int)));
- connect(m_ui.spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotSetHeight(int)));
-
- connect(m_ui.spinSize, SIGNAL(valueChanged(int)), this, SLOT(slotResize(int)));
-
- connect(m_ui.spinOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotSetOpacity(int)));
- connect(m_ui.sliderOpacity, SIGNAL(valueChanged(int)), m_ui.spinOpacity, SLOT(setValue(int)));
-
- connect(m_ui.buttonMoveLeft, SIGNAL(clicked()), this, SLOT(slotMoveLeft()));
+ connect(m_spinX, SIGNAL(valueChanged(int)), this, SLOT(slotSetX(int)));
+ connect(m_spinY, SIGNAL(valueChanged(int)), this, SLOT(slotSetY(int)));
+ connect(m_spinWidth, SIGNAL(valueChanged(int)), this, SLOT(slotSetWidth(int)));
+ connect(m_spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotSetHeight(int)));
+
+ connect(m_spinSize, SIGNAL(valueChanged(int)), this, SLOT(slotResize(int)));
+
+ connect(m_opacity, SIGNAL(valueChanged(int)), this, SLOT(slotSetOpacity(int)));
+
+ QMenu *menu = new QMenu(this);
+ QAction *adjustSize = new QAction(i18n("Adjust to original size"), this);
+ connect(adjustSize, SIGNAL(triggered()), this, SLOT(slotAdjustToFrameSize()));
+ menu->addAction(adjustSize);
+ QAction *fitToWidth = new QAction(i18n("Fit to width"), this);
+ connect(fitToWidth, SIGNAL(triggered()), this, SLOT(slotFitToWidth()));
+ menu->addAction(fitToWidth);
+ QAction *fitToHeight = new QAction(i18n("Fit to height"), this);
+ connect(fitToHeight, SIGNAL(triggered()), this, SLOT(slotFitToHeight()));
+ menu->addAction(fitToHeight);
+ menu->addSeparator();
+
+ QAction *alignleft = new QAction(KIcon("kdenlive-align-left"), i18n("Align left"), this);
+ connect(alignleft, SIGNAL(triggered()), this, SLOT(slotMoveLeft()));
+ menu->addAction(alignleft);
+ QAction *alignhcenter = new QAction(KIcon("kdenlive-align-hor"), i18n("Center horizontally"), this);
+ connect(alignhcenter, SIGNAL(triggered()), this, SLOT(slotCenterH()));
+ menu->addAction(alignhcenter);
+ QAction *alignright = new QAction(KIcon("kdenlive-align-right"), i18n("Align right"), this);
+ connect(alignright, SIGNAL(triggered()), this, SLOT(slotMoveRight()));
+ menu->addAction(alignright);
+ QAction *aligntop = new QAction(KIcon("kdenlive-align-top"), i18n("Align top"), this);
+ connect(aligntop, SIGNAL(triggered()), this, SLOT(slotMoveTop()));
+ menu->addAction(aligntop);
+ QAction *alignvcenter = new QAction(KIcon("kdenlive-align-vert"), i18n("Center vertically"), this);
+ connect(alignvcenter, SIGNAL(triggered()), this, SLOT(slotCenterV()));
+ menu->addAction(alignvcenter);
+ QAction *alignbottom = new QAction(KIcon("kdenlive-align-bottom"), i18n("Align bottom"), this);
+ connect(alignbottom, SIGNAL(triggered()), this, SLOT(slotMoveBottom()));
+ menu->addAction(alignbottom);
+ m_ui.buttonOptions->setMenu(menu);
+
+ /*connect(m_ui.buttonMoveLeft, SIGNAL(clicked()), this, SLOT(slotMoveLeft()));
connect(m_ui.buttonCenterH, SIGNAL(clicked()), this, SLOT(slotCenterH()));
connect(m_ui.buttonMoveRight, SIGNAL(clicked()), this, SLOT(slotMoveRight()));
connect(m_ui.buttonMoveTop, SIGNAL(clicked()), this, SLOT(slotMoveTop()));
connect(m_ui.buttonCenterV, SIGNAL(clicked()), this, SLOT(slotCenterV()));
- connect(m_ui.buttonMoveBottom, SIGNAL(clicked()), this, SLOT(slotMoveBottom()));
+ connect(m_ui.buttonMoveBottom, SIGNAL(clicked()), this, SLOT(slotMoveBottom()));*/
/*
m_scene->setEnabled(true);
delete m_timePos;
delete m_timeline;
+ delete m_spinX;
+ delete m_spinY;
+ delete m_spinWidth;
+ delete m_spinHeight;
+ delete m_opacity;
m_scene->removeItem(m_rect);
delete m_geometry;
if (m_monitor) {
}
// no opacity
- if (elem.attribute("opacity") == "false")
- m_ui.widgetOpacity->setHidden(true);
+ if (elem.attribute("opacity") == "false") {
+ m_opacity->setHidden(true);
+ m_ui.horizontalLayout2->addStretch(2);
+ }
Mlt::GeometryItem item;
m_rect->setPos(item.x(), item.y());
m_rect->setRect(0, 0, item.w(), item.h());
- m_ui.spinOpacity->blockSignals(true);
- m_ui.sliderOpacity->blockSignals(true);
- m_ui.spinOpacity->setValue(item.mix());
- m_ui.sliderOpacity->setValue(item.mix());
- m_ui.spinOpacity->blockSignals(false);
- m_ui.sliderOpacity->blockSignals(false);
+ m_opacity->blockSignals(true);
+ m_opacity->setValue(item.mix());
+ m_opacity->blockSignals(false);
slotUpdateProperties();
item.y(rectpos.y());
item.w(r.width());
item.h(r.height());
- item.mix(m_ui.spinOpacity->value());
+ //item.mix(m_ui.spinOpacity->value());
m_geometry->insert(item);
m_timeline->update();
else
size = (int)((rectSize.height() * 100.0 / m_monitor->render->renderHeight()) + 0.5);
- m_ui.spinX->blockSignals(true);
- m_ui.spinY->blockSignals(true);
- m_ui.spinWidth->blockSignals(true);
- m_ui.spinHeight->blockSignals(true);
- m_ui.spinSize->blockSignals(true);
-
- m_ui.spinX->setValue(rectPos.x());
- m_ui.spinY->setValue(rectPos.y());
- m_ui.spinWidth->setValue(rectSize.width());
- m_ui.spinHeight->setValue(rectSize.height());
- m_ui.spinSize->setValue(size);
-
- m_ui.spinX->blockSignals(false);
- m_ui.spinY->blockSignals(false);
- m_ui.spinWidth->blockSignals(false);
- m_ui.spinHeight->blockSignals(false);
- m_ui.spinSize->blockSignals(false);
+ m_spinX->blockSignals(true);
+ m_spinY->blockSignals(true);
+ m_spinWidth->blockSignals(true);
+ m_spinHeight->blockSignals(true);
+ m_spinSize->blockSignals(true);
+
+ m_spinX->setValue(rectPos.x());
+ m_spinY->setValue(rectPos.y());
+ m_spinWidth->setValue(rectSize.width());
+ m_spinHeight->setValue(rectSize.height());
+ m_spinSize->setValue(size);
+
+ m_spinX->blockSignals(false);
+ m_spinY->blockSignals(false);
+ m_spinWidth->blockSignals(false);
+ m_spinHeight->blockSignals(false);
+ m_spinSize->blockSignals(false);
}
void GeometryWidget::slotSetX(int value)
{
- m_rect->setPos(value, m_ui.spinY->value());
+ m_rect->setPos(value, m_spinY->value());
slotUpdateGeometry();
}
void GeometryWidget::slotSetY(int value)
{
- m_rect->setPos(m_ui.spinX->value(), value);
+ m_rect->setPos(m_spinX->value(), value);
slotUpdateGeometry();
}
void GeometryWidget::slotSetWidth(int value)
{
- m_rect->setRect(0, 0, value, m_ui.spinHeight->value());
+ m_rect->setRect(0, 0, value, m_spinHeight->value());
slotUpdateGeometry();
}
void GeometryWidget::slotSetHeight(int value)
{
- m_rect->setRect(0, 0, m_ui.spinWidth->value(), value);
+ m_rect->setRect(0, 0, m_spinWidth->value(), value);
slotUpdateGeometry();
}
void GeometryWidget::slotSetOpacity(int value)
{
- m_ui.sliderOpacity->blockSignals(true);
- m_ui.sliderOpacity->setValue(value);
- m_ui.sliderOpacity->blockSignals(false);
-
int pos = m_timePos->getValue();
Mlt::GeometryItem item;
if (m_geometry->fetch(&item, pos) || item.key() == false)
return;
item.mix(value);
m_geometry->insert(item);
-
emit parameterChanged();
}
slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
}
+void GeometryWidget::setFrameSize(QPoint size)
+{
+ m_frameSize = size;
+}
+
+void GeometryWidget::slotAdjustToFrameSize()
+{
+ if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+ m_spinWidth->setValue(m_frameSize.x());
+ m_spinHeight->setValue(m_frameSize.y());
+}
+
+void GeometryWidget::slotFitToWidth()
+{
+ if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+ double factor = 100.0 * m_monitor->render->frameRenderWidth() / m_frameSize.x() + 0.5;
+ m_spinSize->setValue(factor);
+}
+
+void GeometryWidget::slotFitToHeight()
+{
+ if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+ double factor = 100.0 * m_monitor->render->renderHeight() / m_frameSize.y() + 0.5;
+ m_spinSize->setValue(factor);
+}
+
#include "geometrywidget.moc"
class KeyframeHelper;
class TimecodeDisplay;
class OnMonitorRectItem;
-
+class DragValue;
class GeometryWidget : public QWidget
{
QString getValue() const;
/** @brief Updates the timecode display according to settings (frame number or hh:mm:ss:ff) */
void updateTimecodeFormat();
+ /** @brief Sets the size of the original clip. */
+ void setFrameSize(QPoint size);
public slots:
/** @brief Sets up the rect and the geometry object.
/** Stores the different settings in the MLT geometry format. */
Mlt::Geometry *m_geometry;
bool m_showScene;
+ DragValue *m_spinX;
+ DragValue *m_spinY;
+ DragValue *m_spinWidth;
+ DragValue *m_spinHeight;
+ DragValue *m_spinSize;
+ DragValue *m_opacity;
+ QPoint m_frameSize;
private slots:
/** @brief Updates controls according to position.
/** @brief Enables/Disables syncing with the timeline according to @param sync. */
void slotSetSynchronize(bool sync);
+ void slotAdjustToFrameSize();
+ void slotFitToWidth();
+ void slotFitToHeight();
signals:
void parameterChanged();
<rect>
<x>0</x>
<y>0</y>
- <width>364</width>
- <height>187</height>
+ <width>129</width>
+ <height>78</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="1">
- <widget class="QWidget" name="widgetGeometry" native="true">
- <layout class="QGridLayout" name="gridLayout_3">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>X</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="spinX">
- <property name="minimum">
- <number>-10000</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QWidget" name="widget" native="true">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Resize:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="spinSize">
- <property name="suffix">
- <string>%</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="2" rowspan="5">
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="4" rowspan="5">
- <widget class="QWidget" name="widgetOpacity" native="true">
- <layout class="QGridLayout" name="gridLayout_5">
- <property name="margin">
- <number>0</number>
- </property>
- <item row="0" column="1">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Opacity</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="spinOpacity">
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="0" column="0" rowspan="3">
- <widget class="Line" name="line_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QWidget" name="widget_2" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QSlider" name="sliderOpacity">
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="spinY">
- <property name="minimum">
- <number>-10000</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Y</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Width</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="spinWidth">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Height</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="spinHeight">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- </widget>
- </item>
- <item row="1" column="3" rowspan="3">
- <widget class="QFrame" name="frame">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <property name="margin">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QToolButton" name="buttonMoveLeft">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QToolButton" name="buttonMoveRight">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QToolButton" name="buttonCenterH">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QToolButton" name="buttonMoveTop">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QToolButton" name="buttonCenterV">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QToolButton" name="buttonMoveBottom">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="0" colspan="4">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <property name="horizontalSpacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
<widget class="QWidget" name="widgetTimeWrapper" native="true">
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
</layout>
</widget>
</item>
- <item row="2" column="0" colspan="4">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <item row="1" column="0">
+ <widget class="QFrame" name="widgetGeometry">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
</property>
- </spacer>
- </item>
- <item row="1" column="2">
- <widget class="QWidget" name="widgetConfigButton" native="true">
- <layout class="QGridLayout" name="gridLayout_6">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="spacing">
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
<number>0</number>
</property>
- <item row="0" column="1">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="2">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
+ <item row="0" column="0" colspan="5">
+ <layout class="QHBoxLayout" name="horizontalLayout"/>
+ </item>
+ <item row="1" column="0" colspan="5">
+ <layout class="QHBoxLayout" name="horizontalLayout2">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="buttonOptions">
+ <property name="text">
+ <string>Options</string>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
</item>
- <item row="1" column="0">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
<tabstops>
- <tabstop>spinX</tabstop>
- <tabstop>spinY</tabstop>
- <tabstop>spinWidth</tabstop>
- <tabstop>spinHeight</tabstop>
- <tabstop>spinSize</tabstop>
- <tabstop>buttonMoveLeft</tabstop>
- <tabstop>buttonCenterH</tabstop>
- <tabstop>buttonMoveRight</tabstop>
- <tabstop>buttonMoveTop</tabstop>
- <tabstop>buttonCenterV</tabstop>
- <tabstop>buttonMoveBottom</tabstop>
- <tabstop>spinOpacity</tabstop>
- <tabstop>sliderOpacity</tabstop>
<tabstop>buttonPrevious</tabstop>
<tabstop>buttonAddDelete</tabstop>
<tabstop>buttonNext</tabstop>