Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/geometrywidget.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 38 | { | |||
---|---|---|---|---|---|
45 | m_defaultSize = pCore->getCurrentFrameSize(); | 45 | m_defaultSize = pCore->getCurrentFrameSize(); | ||
46 | m_sourceSize = frameSize.isValid() ? frameSize : m_defaultSize; | 46 | m_sourceSize = frameSize.isValid() ? frameSize : m_defaultSize; | ||
47 | /*QString paramName = i18n(paramTag.toUtf8().data()); | 47 | /*QString paramName = i18n(paramTag.toUtf8().data()); | ||
48 | QString comment = m_model->data(ix, AssetParameterModel::CommentRole).toString(); | 48 | QString comment = m_model->data(ix, AssetParameterModel::CommentRole).toString(); | ||
49 | if (!comment.isEmpty()) { | 49 | if (!comment.isEmpty()) { | ||
50 | comment = i18n(comment.toUtf8().data()); | 50 | comment = i18n(comment.toUtf8().data()); | ||
51 | }*/ | 51 | }*/ | ||
52 | 52 | | |||
53 | | ||||
54 | m_rotationWidget = DoubleWidget *doubleparam; | ||||
55 | | ||||
53 | auto *horLayout = new QHBoxLayout; | 56 | auto *horLayout = new QHBoxLayout; | ||
54 | horLayout->setSpacing(2); | 57 | horLayout->setSpacing(2); | ||
55 | m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this); | 58 | m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this); | ||
56 | connect(m_spinX, &DragValue::valueChanged, this, &GeometryWidget::slotAdjustRectKeyframeValue); | 59 | connect(m_spinX, &DragValue::valueChanged, this, &GeometryWidget::slotAdjustRectKeyframeValue); | ||
57 | horLayout->addWidget(m_spinX); | 60 | horLayout->addWidget(m_spinX); | ||
58 | 61 | | |||
59 | m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this); | 62 | m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this); | ||
60 | connect(m_spinY, &DragValue::valueChanged, this, &GeometryWidget::slotAdjustRectKeyframeValue); | 63 | connect(m_spinY, &DragValue::valueChanged, this, &GeometryWidget::slotAdjustRectKeyframeValue); | ||
▲ Show 20 Lines • Show All 351 Lines • ▼ Show 20 Line(s) | |||||
412 | void GeometryWidget::connectMonitor(bool activate) | 415 | void GeometryWidget::connectMonitor(bool activate) | ||
413 | { | 416 | { | ||
414 | if (m_active == activate) { | 417 | if (m_active == activate) { | ||
415 | return; | 418 | return; | ||
416 | } | 419 | } | ||
417 | m_active = activate; | 420 | m_active = activate; | ||
418 | if (activate) { | 421 | if (activate) { | ||
419 | m_monitor->slotShowEffectScene(MonitorSceneGeometry); | 422 | m_monitor->slotShowEffectScene(MonitorSceneGeometry); | ||
423 | m_monitor->setEffectSceneProperty(QStringLiteral("showRotation"), true); | ||||
424 | m_monitor->setEffectSceneProperty(QStringLiteral("showOpacity"), true); | ||||
420 | connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect, Qt::UniqueConnection); | 425 | connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect, Qt::UniqueConnection); | ||
426 | connect(m_monitor, &Monitor::opacityChanged, this, &AnimationWidget::slotUpdateOpacity, Qt::UniqueConnection); | ||||
427 | connect(m_monitor, &Monitor::angleChanged, this, &AnimationWidget::slotUpdateRotation, Qt::UniqueConnection); | ||||
421 | QRect rect(m_spinX->value(), m_spinY->value(), m_spinWidth->value(), m_spinHeight->value()); | 428 | QRect rect(m_spinX->value(), m_spinY->value(), m_spinWidth->value(), m_spinHeight->value()); | ||
422 | m_monitor->setUpEffectGeometry(rect); | 429 | m_monitor->setUpEffectGeometry(rect); | ||
423 | /*double ratio = (double)m_spinWidth->value() / m_spinHeight->value(); | 430 | /*double ratio = (double)m_spinWidth->value() / m_spinHeight->value(); | ||
424 | if (m_sourceSize.width() != m_defaultSize.width() || m_sourceSize.height() != m_defaultSize.height()) { | 431 | if (m_sourceSize.width() != m_defaultSize.width() || m_sourceSize.height() != m_defaultSize.height()) { | ||
425 | // Source frame size different than project frame size, enable original size option accordingly | 432 | // Source frame size different than project frame size, enable original size option accordingly | ||
426 | bool isOriginalSize = | 433 | bool isOriginalSize = | ||
427 | qAbs((double)m_sourceSize.width() / m_sourceSize.height() - ratio) < qAbs((double)m_defaultSize.width() / m_defaultSize.height() - ratio); | 434 | qAbs((double)m_sourceSize.width() / m_sourceSize.height() - ratio) < qAbs((double)m_defaultSize.width() / m_defaultSize.height() - ratio); | ||
428 | if (isOriginalSize) { | 435 | if (isOriginalSize) { | ||
429 | m_originalSize->blockSignals(true); | 436 | m_originalSize->blockSignals(true); | ||
430 | m_originalSize->setChecked(true); | 437 | m_originalSize->setChecked(true); | ||
431 | m_originalSize->blockSignals(false); | 438 | m_originalSize->blockSignals(false); | ||
432 | } | 439 | } | ||
433 | }*/ | 440 | }*/ | ||
434 | } else { | 441 | } else { | ||
435 | m_monitor->slotShowEffectScene(MonitorSceneDefault); | 442 | m_monitor->slotShowEffectScene(MonitorSceneDefault); | ||
436 | disconnect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect); | 443 | disconnect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect); | ||
444 | disconnect(m_monitor, &Monitor::opacityChanged, this, &AnimationWidget::slotUpdateOpacity, Qt::UniqueConnection); | ||||
445 | disconnect(m_monitor, &Monitor::angleChanged, this, &AnimationWidget::slotUpdateRotation, Qt::UniqueConnection); | ||||
437 | } | 446 | } | ||
438 | } | 447 | } | ||
439 | 448 | | |||
440 | void GeometryWidget::slotSetRange(QPair <int, int> range) | 449 | void GeometryWidget::slotSetRange(QPair <int, int> range) | ||
441 | { | 450 | { | ||
442 | m_min = range.first; | 451 | m_min = range.first; | ||
443 | m_max = range.second; | 452 | m_max = range.second; | ||
444 | } | 453 | } | ||
454 | | ||||
455 | void AnimationWidget::slotUpdateOpacity(qreal value) | ||||
456 | { | ||||
457 | m_opacity->setValue(value); | ||||
458 | } | ||||
459 | | ||||
460 | void AnimationWidget::slotUpdateRotation(qreal value) | ||||
461 | { | ||||
462 | m_rotationWidget->setValue(value); | ||||
463 | } |