]> git.sesse.net Git - kdenlive/blobdiff - src/geometrywidget.cpp
Merge branch 'master' into audioAlign
[kdenlive] / src / geometrywidget.cpp
index 04fe9085b601d6721bd9ae348a47bb1c13aebfde..1aac90f45ed9a1edec569bb6e869c3be87c48273 100644 (file)
@@ -70,17 +70,24 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     m_timeline = new KeyframeHelper(m_ui.frameTimeline);
     layout->addWidget(m_timeline);
     layout->setContentsMargins(0, 0, 0, 0);
+    
+    int size = style()->pixelMetric(QStyle::PM_SmallIconSize);
+    QSize iconSize(size, size);
 
     m_ui.buttonPrevious->setIcon(KIcon("media-skip-backward"));
     m_ui.buttonPrevious->setToolTip(i18n("Go to previous keyframe"));
+    m_ui.buttonPrevious->setIconSize(iconSize);
     m_ui.buttonNext->setIcon(KIcon("media-skip-forward"));
     m_ui.buttonNext->setToolTip(i18n("Go to next keyframe"));
+    m_ui.buttonNext->setIconSize(iconSize);
     m_ui.buttonAddDelete->setIcon(KIcon("document-new"));
     m_ui.buttonAddDelete->setToolTip(i18n("Add keyframe"));
+    m_ui.buttonAddDelete->setIconSize(iconSize);
 
     m_ui.buttonSync->setIcon(KIcon("insert-link"));
     m_ui.buttonSync->setToolTip(i18n("Synchronize with timeline cursor"));
     m_ui.buttonSync->setChecked(KdenliveSettings::transitionfollowcursor());
+    m_ui.buttonSync->setIconSize(iconSize);
 
     connect(m_timeline, SIGNAL(positionChanged(int)), this, SLOT(slotPositionChanged(int)));
     connect(m_timeline, SIGNAL(keyframeMoved(int)),   this, SLOT(slotKeyframeMoved(int)));
@@ -271,12 +278,13 @@ QString GeometryWidget::getExtraValue(const QString &name) const
 {
     int ix = m_extraGeometryNames.indexOf(name);
     QString val = m_extraGeometries.at(ix)->serialise();
-    if (!val.contains("=")) val = val.section(',', 0, 0);
+    if (!val.contains("=")) val = val.section('/', 0, 0);
     else {
-        QStringList list = val.split(';');
+        QStringList list = val.split(';', QString::SkipEmptyParts);
         val.clear();
+        val.append(list.takeFirst().section('/', 0, 0));
         foreach (const QString value, list) {
-            val.append(value.section(',', 0, 0) + ';');
+            val.append(';' + value.section('/', 0, 0));
         }
     }
     return val;
@@ -286,6 +294,7 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
 {
     m_inPoint = minframe;
     m_outPoint = maxframe;
+    m_scene->cleanup();
 
     if (m_geometry)
         m_geometry->parse(elem.attribute("value").toUtf8().data(), maxframe - minframe, m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
@@ -317,7 +326,7 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
     m_rect->setZValue(0);
     m_scene->addItem(m_rect);
     connect(m_rect, SIGNAL(changed()), this, SLOT(slotUpdateGeometry()));
-
+    m_scene->centerView();
     slotPositionChanged(0, false);
     slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
 }
@@ -565,7 +574,6 @@ void GeometryWidget::slotUpdateGeometry()
             geom->insert(item2);
         }
     }
-    
     emit parameterChanged();
 }
 
@@ -711,7 +719,9 @@ void GeometryWidget::setFrameSize(QPoint size)
 
 void GeometryWidget::slotAdjustToFrameSize()
 {
-    if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+    if (m_frameSize == QPoint() || m_frameSize.x() == 0 || m_frameSize.y() == 0) {
+        m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+    }
     m_spinWidth->blockSignals(true);
     m_spinHeight->blockSignals(true);
     m_spinWidth->setValue((int) (m_frameSize.x() / m_monitor->render->sar() + 0.5));
@@ -723,7 +733,9 @@ void GeometryWidget::slotAdjustToFrameSize()
 
 void GeometryWidget::slotFitToWidth()
 {
-    if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+    if (m_frameSize == QPoint() || m_frameSize.x() == 0 || m_frameSize.y() == 0) {
+        m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+    }
     double factor = (double) m_monitor->render->frameRenderWidth() / m_frameSize.x() * m_monitor->render->sar();
     m_spinWidth->blockSignals(true);
     m_spinHeight->blockSignals(true);
@@ -736,7 +748,9 @@ void GeometryWidget::slotFitToWidth()
 
 void GeometryWidget::slotFitToHeight()
 {
-    if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+    if (m_frameSize == QPoint() || m_frameSize.x() == 0 || m_frameSize.y() == 0) {
+        m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight());
+    }
     double factor = (double) m_monitor->render->renderHeight() / m_frameSize.y();
     m_spinWidth->blockSignals(true);
     m_spinHeight->blockSignals(true);