void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame) { QString val = par.attribute("value"); if (par.attribute("fixed") == "1") { m_fixedMode = true; buttonPrevious->setHidden(true); buttonNext->setHidden(true); buttonDelete->setHidden(true); buttonAdd->setHidden(true); spinTransp->setMaximum(500); label_pos->setHidden(true); m_helper->setHidden(true); m_timePos.setHidden(true); } if (par.attribute("opacity") == "false") { label_opacity->setHidden(true); spinTransp->setHidden(true); } if (m_geom) m_geom->parse(val.toUtf8().data(), maxFrame - minFrame, m_profile->width(), m_profile->height()); else m_geom = new Mlt::Geometry(val.toUtf8().data(), maxFrame - minFrame, m_profile->width(), m_profile->height()); ////qDebug() << " / / UPDATING TRANSITION VALUE: " << m_geom->serialise(); //read param her and set rect if (!m_fixedMode) { m_helper->setKeyGeometry(m_geom, maxFrame - minFrame - 1); m_helper->update(); /*QDomDocument doc; doc.appendChild(doc.importNode(par, true)); //qDebug() << "IMPORTED TRANS: " << doc.toString();*/ if (m_path == NULL) { m_path = new QGraphicsPathItem(); m_path->setPen(QPen(Qt::red)); m_scene->addItem(m_path); } updateTransitionPath(); } Mlt::GeometryItem item; m_geom->fetch(&item, 0); delete m_paramRect; m_paramRect = new QGraphicsRectItem(QRectF(0, 0, item.w() * m_dar, item.h())); m_paramRect->setPos(item.x() * m_dar, item.y()); m_paramRect->setZValue(0); m_paramRect->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); m_paramRect->setPen(QPen(QBrush(QColor(255, 0, 0, 255)), 1.0)); m_scene->addItem(m_paramRect); slotPositionChanged(0, false); slotUpdateGeometry(); if (!m_fixedMode) { m_timePos.setRange(0, maxFrame - minFrame - 1); connect(&m_timePos, SIGNAL(timeCodeEditingFinished()), this , SLOT(slotPositionChanged())); } connect(spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int))); }
void QIrParabolicEffectManager::unpolish( QIrDockletBundle * bundle ) { QIR_P(QIrParabolicEffectManager); QPropertyAnimation * geomAnim = p->geomAnimations.take(bundle); QPropertyAnimation * offsetAnim = p->offsetAnimations.take(bundle); disconnect(bundle,SIGNAL(geometryChanged()),p->view->dock(),SLOT(slotUpdateGeometry())); disconnect(bundle,SIGNAL(clicked()),this,SLOT(slotHandleDockletClicked())); p->bundleAnimationGroup->removeAnimation(geomAnim); delete geomAnim; delete offsetAnim; if ( p->hover == bundle ) { //p->useAnimation = false; // p->hover = 0; } p->updateMinDockletRects(); }
void QIrParabolicEffectManager::polish( QIrDockletBundle * bundle ) { QIR_P(QIrParabolicEffectManager); if ( !p->geomAnimations.contains(bundle) ) { QPropertyAnimation * animGeom = new QPropertyAnimation(bundle,"geometry"); QPropertyAnimation * animOffset = new QPropertyAnimation(bundle,"dockletOffset",this); animGeom->setDuration(250); animGeom->setEasingCurve(QEasingCurve::OutCubic); p->geomAnimations[bundle] = animGeom; p->bundleAnimationGroup->addAnimation(animGeom); animOffset->setDuration(750); animOffset->setEasingCurve(QEasingCurve::InOutQuad); p->offsetAnimations[bundle] = animOffset; connect(bundle,SIGNAL(geometryChanged()),p->view->dock(),SLOT(slotUpdateGeometry())); connect(bundle,SIGNAL(clicked()),this,SLOT(slotHandleDockletClicked())); } invalidate(); }
void Geometryval::slotPositionChanged(int pos, bool seek) { if (pos == -1) { pos = m_timePos.getValue(); } if (seek && KdenliveSettings::transitionfollowcursor()) emit seekToPos(pos + m_startPoint); m_timePos.setValue(pos); //spinPos->setValue(pos); m_helper->blockSignals(true); m_helper->setValue(pos); m_helper->blockSignals(false); Mlt::GeometryItem item; int error = m_geom->fetch(&item, pos); if (error || item.key() == false) { // no keyframe under cursor, adjust buttons buttonAdd->setEnabled(true); buttonDelete->setEnabled(false); widget->setEnabled(false); spinTransp->setEnabled(false); frameOptions->setEnabled(false); m_reset->setEnabled(false); } else { buttonAdd->setEnabled(false); buttonDelete->setEnabled(true); widget->setEnabled(true); spinTransp->setEnabled(true); frameOptions->setEnabled(true); m_reset->setEnabled(true); } m_paramRect->setPos(item.x() * m_dar, item.y()); m_paramRect->setRect(0, 0, item.w() * m_dar, item.h()); spinTransp->setValue(item.mix()); m_paramRect->setBrush(QColor(255, 0, 0, item.mix())); slotUpdateGeometry(); }
Geometryval::Geometryval(const Mlt::Profile *profile, const Timecode &t, const QPoint &frame_size, int startPoint, QWidget* parent) : QWidget(parent), m_profile(profile), m_paramRect(NULL), m_geom(NULL), m_path(NULL), m_fixedMode(false), m_frameSize(frame_size), m_startPoint(startPoint), m_timePos(t) { setupUi(this); toolbarlayout->addWidget(&m_timePos); toolbarlayout->insertStretch(-1); QVBoxLayout* vbox = new QVBoxLayout(widget); m_sceneview = new QGraphicsView(this); m_sceneview->setBackgroundBrush(QBrush(Qt::black)); vbox->addWidget(m_sceneview); vbox->setContentsMargins(0, 0, 0, 0); QVBoxLayout* vbox2 = new QVBoxLayout(keyframeWidget); m_helper = new KeyframeHelper(this); vbox2->addWidget(m_helper); vbox2->setContentsMargins(0, 0, 0, 0); connect(m_helper, SIGNAL(positionChanged(int)), this, SLOT(slotPositionChanged(int))); connect(m_helper, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int))); connect(m_helper, SIGNAL(addKeyframe(int)), this, SLOT(slotAddFrame(int))); connect(m_helper, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteFrame(int))); m_scene = new GraphicsSceneRectMove(this); m_scene->setTool(TITLE_SELECT); m_sceneview->setScene(m_scene); m_dar = (m_profile->height() * m_profile->dar()) / (double) m_profile->width(); m_realWidth = (int)(profile->height() * profile->dar() + 0.5); QGraphicsRectItem *frameBorder = new QGraphicsRectItem(QRectF(0, 0, m_realWidth, profile->height())); frameBorder->setZValue(-1100); frameBorder->setBrush(QColor(255, 255, 0, 30)); frameBorder->setPen(QPen(QBrush(QColor(255, 255, 255, 255)), 1.0, Qt::DashLine)); m_scene->addItem(frameBorder); buttonNext->setIcon(QIcon::fromTheme("media-skip-forward")); buttonNext->setToolTip(i18n("Go to next keyframe")); buttonPrevious->setIcon(QIcon::fromTheme("media-skip-backward")); buttonPrevious->setToolTip(i18n("Go to previous keyframe")); buttonAdd->setIcon(QIcon::fromTheme("document-new")); buttonAdd->setToolTip(i18n("Add keyframe")); buttonDelete->setIcon(QIcon::fromTheme("edit-delete")); buttonDelete->setToolTip(i18n("Delete keyframe")); m_configMenu = new QMenu(i18n("Misc..."), this); buttonMenu->setMenu(m_configMenu); buttonMenu->setPopupMode(QToolButton::MenuButtonPopup); m_editOptions = m_configMenu->addAction(QIcon::fromTheme("system-run"), i18n("Show/Hide options")); m_editOptions->setCheckable(true); buttonMenu->setDefaultAction(m_editOptions); connect(m_editOptions, SIGNAL(triggered()), this, SLOT(slotSwitchOptions())); slotSwitchOptions(); m_reset = m_configMenu->addAction(QIcon::fromTheme("view-refresh"), i18n("Reset"), this, SLOT(slotResetPosition())); m_syncAction = m_configMenu->addAction(i18n("Sync timeline cursor"), this, SLOT(slotSyncCursor())); m_syncAction->setCheckable(true); m_syncAction->setChecked(KdenliveSettings::transitionfollowcursor()); //scene->setSceneRect(0, 0, profile->width * 2, profile->height * 2); //view->fitInView(m_frameBorder, Qt::KeepAspectRatio); const double sc = 100.0 / profile->height() * 0.8; QRectF srect = m_sceneview->sceneRect(); m_sceneview->setSceneRect(srect.x(), -srect.height() / 3 + 10, srect.width(), srect.height() + srect.height() / 3 * 2 - 10); m_scene->setZoom(sc); m_sceneview->centerOn(frameBorder); m_sceneview->setMouseTracking(true); connect(buttonNext , SIGNAL(clicked()) , this , SLOT(slotNextFrame())); connect(buttonPrevious , SIGNAL(clicked()) , this , SLOT(slotPreviousFrame())); connect(buttonDelete , SIGNAL(clicked()) , this , SLOT(slotDeleteFrame())); connect(buttonAdd , SIGNAL(clicked()) , this , SLOT(slotAddFrame())); connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateTransitionProperties())); buttonhcenter->setIcon(QIcon::fromTheme("kdenlive-align-hor")); buttonhcenter->setToolTip(i18n("Align item horizontally")); buttonvcenter->setIcon(QIcon::fromTheme("kdenlive-align-vert")); buttonvcenter->setToolTip(i18n("Align item vertically")); buttontop->setIcon(QIcon::fromTheme("kdenlive-align-top")); buttontop->setToolTip(i18n("Align item to top")); buttonbottom->setIcon(QIcon::fromTheme("kdenlive-align-bottom")); buttonbottom->setToolTip(i18n("Align item to bottom")); buttonright->setIcon(QIcon::fromTheme("kdenlive-align-right")); buttonright->setToolTip(i18n("Align item to right")); buttonleft->setIcon(QIcon::fromTheme("kdenlive-align-left")); buttonleft->setToolTip(i18n("Align item to left")); connect(buttonhcenter, SIGNAL(clicked()), this, SLOT(slotAlignHCenter())); connect(buttonvcenter, SIGNAL(clicked()), this, SLOT(slotAlignVCenter())); connect(buttontop, SIGNAL(clicked()), this, SLOT(slotAlignTop())); connect(buttonbottom, SIGNAL(clicked()), this, SLOT(slotAlignBottom())); connect(buttonright, SIGNAL(clicked()), this, SLOT(slotAlignRight())); connect(buttonleft, SIGNAL(clicked()), this, SLOT(slotAlignLeft())); connect(spinX, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryX(int))); connect(spinY, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryY(int))); connect(spinWidth, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryWidth(int))); connect(spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryHeight(int))); connect(spinResize, SIGNAL(editingFinished()), this, SLOT(slotResizeCustom())); connect(buttonResize, SIGNAL(clicked()), this, SLOT(slotResizeOriginal())); connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateGeometry())); }
GeometryWidget::GeometryWidget(Monitor* monitor, const Timecode &timecode, int clipPos, bool showRotation, QWidget* parent): QWidget(parent), m_monitor(monitor), m_timePos(new TimecodeDisplay(timecode)), m_clipPos(clipPos), m_inPoint(0), m_outPoint(1), m_previous(NULL), m_geometry(NULL), m_fixedGeom(false) { m_ui.setupUi(this); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); connect(m_monitor, SIGNAL(effectChanged(QRect)), this, SLOT(slotUpdateGeometry(QRect))); /*MonitorEditWidget *edit = monitor->getEffectEdit(); edit->removeCustomControls(); edit->addCustomButton(KoIconUtils::themedIcon("draw-path"), i18n("Show path"), this, SLOT(slotShowPath(bool)), true, KdenliveSettings::onmonitoreffects_geometryshowpath()); edit->addCustomButton(KoIconUtils::themedIcon("transform-crop"), i18n("Show previous keyframe"), this, SLOT(slotShowPreviousKeyFrame(bool)), true, KdenliveSettings::onmonitoreffects_geometryshowprevious()); m_scene = edit->getScene(); m_scene->cleanup();*/ /* Setup of timeline and keyframe controls */ ((QGridLayout *)(m_ui.widgetTimeWrapper->layout()))->addWidget(m_timePos, 1, 5); QVBoxLayout *layout = new QVBoxLayout(m_ui.frameTimeline); 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(KoIconUtils::themedIcon(QStringLiteral("media-skip-backward"))); m_ui.buttonPrevious->setToolTip(i18n("Go to previous keyframe")); m_ui.buttonPrevious->setIconSize(iconSize); m_ui.buttonNext->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-forward"))); m_ui.buttonNext->setToolTip(i18n("Go to next keyframe")); m_ui.buttonNext->setIconSize(iconSize); m_ui.buttonAddDelete->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add"))); m_ui.buttonAddDelete->setToolTip(i18n("Add keyframe")); m_ui.buttonAddDelete->setIconSize(iconSize); connect(m_timeline, SIGNAL(requestSeek(int)), this, SLOT(slotRequestSeek(int))); connect(m_timeline, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int))); connect(m_timeline, SIGNAL(addKeyframe(int)), this, SLOT(slotAddKeyframe(int))); connect(m_timeline, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteKeyframe(int))); connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotPositionChanged())); connect(m_ui.buttonPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousKeyframe())); connect(m_ui.buttonNext, SIGNAL(clicked()), this, SLOT(slotNextKeyframe())); connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe())); m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinX, 0, 0); m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinY, 0, 1); m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, 1, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinWidth, 0, 2); m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, 1, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinHeight, 0, 3); m_ui.horizontalLayout->setColumnStretch(4, 10); QMenu *menu = new QMenu(this); QAction *adjustSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-best")), i18n("Adjust to original size"), this); connect(adjustSize, SIGNAL(triggered()), this, SLOT(slotAdjustToFrameSize())); QAction *fitToWidth = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-width")), i18n("Fit to width"), this); connect(fitToWidth, SIGNAL(triggered()), this, SLOT(slotFitToWidth())); QAction *fitToHeight = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-height")), i18n("Fit to height"), this); connect(fitToHeight, SIGNAL(triggered()), this, SLOT(slotFitToHeight())); QAction *importKeyframes = new QAction(i18n("Import keyframes from clip"), this); connect(importKeyframes, SIGNAL(triggered()), this, SIGNAL(importClipKeyframes())); menu->addAction(importKeyframes); QAction *resetKeyframes = new QAction(i18n("Reset all keyframes"), this); connect(resetKeyframes, SIGNAL(triggered()), this, SLOT(slotResetKeyframes())); menu->addAction(resetKeyframes); QAction *resetNextKeyframes = new QAction(i18n("Reset keyframes after cursor"), this); connect(resetNextKeyframes, SIGNAL(triggered()), this, SLOT(slotResetNextKeyframes())); menu->addAction(resetNextKeyframes); QAction *resetPreviousKeyframes = new QAction(i18n("Reset keyframes before cursor"), this); connect(resetPreviousKeyframes, SIGNAL(triggered()), this, SLOT(slotResetPreviousKeyframes())); menu->addAction(resetPreviousKeyframes); menu->addSeparator(); QAction *syncTimeline = new QAction(KoIconUtils::themedIcon(QStringLiteral("edit-link")), i18n("Synchronize with timeline cursor"), this); syncTimeline->setCheckable(true); syncTimeline->setChecked(KdenliveSettings::transitionfollowcursor()); connect(syncTimeline, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool))); menu->addAction(syncTimeline); QAction *alignleft = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-left")), i18n("Align left"), this); connect(alignleft, SIGNAL(triggered()), this, SLOT(slotMoveLeft())); QAction *alignhcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-hor")), i18n("Center horizontally"), this); connect(alignhcenter, SIGNAL(triggered()), this, SLOT(slotCenterH())); QAction *alignright = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-right")), i18n("Align right"), this); connect(alignright, SIGNAL(triggered()), this, SLOT(slotMoveRight())); QAction *aligntop = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-top")), i18n("Align top"), this); connect(aligntop, SIGNAL(triggered()), this, SLOT(slotMoveTop())); QAction *alignvcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-vert")), i18n("Center vertically"), this); connect(alignvcenter, SIGNAL(triggered()), this, SLOT(slotCenterV())); QAction *alignbottom = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-bottom")), i18n("Align bottom"), this); connect(alignbottom, SIGNAL(triggered()), this, SLOT(slotMoveBottom())); m_ui.buttonOptions->setMenu(menu); m_ui.buttonOptions->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure"))); m_ui.buttonOptions->setToolTip(i18n("Options")); m_ui.buttonOptions->setIconSize(iconSize); QHBoxLayout *alignLayout = new QHBoxLayout; alignLayout->setSpacing(0); QToolButton *alignButton = new QToolButton; alignButton->setDefaultAction(alignleft); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignhcenter); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignright); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(aligntop); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignvcenter); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignbottom); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(adjustSize); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(fitToWidth); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(fitToHeight); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignLayout->addStretch(10); m_ui.horizontalLayout->addLayout(alignLayout, 1, 0, 1, 4); //m_ui.horizontalLayout->addStretch(10); m_spinSize = new DragValue(i18n("Size"), 100, 2, 1, 99000, -1, i18n("%"), false, this); m_ui.horizontalLayout2->addWidget(m_spinSize); m_opacity = new DragValue(i18n("Opacity"), 100, 0, 0, 100, -1, i18n("%"), true, this); m_ui.horizontalLayout2->addWidget(m_opacity); if (showRotation) { m_rotateX = new DragValue(i18n("Rotate X"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateX->setObjectName(QStringLiteral("rotate_x")); m_ui.horizontalLayout3->addWidget(m_rotateX); m_rotateY = new DragValue(i18n("Rotate Y"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateY->setObjectName(QStringLiteral("rotate_y")); m_ui.horizontalLayout3->addWidget(m_rotateY); m_rotateZ = new DragValue(i18n("Rotate Z"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateZ->setObjectName(QStringLiteral("rotate_z")); m_ui.horizontalLayout3->addWidget(m_rotateZ); connect(m_rotateX, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); connect(m_rotateY, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); connect(m_rotateZ, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); } /* Setup of geometry controls */ connect(m_spinX, SIGNAL(valueChanged(double)), this, SLOT(slotSetX(double))); connect(m_spinY, SIGNAL(valueChanged(double)), this, SLOT(slotSetY(double))); connect(m_spinWidth, SIGNAL(valueChanged(double)), this, SLOT(slotSetWidth(double))); connect(m_spinHeight, SIGNAL(valueChanged(double)), this, SLOT(slotSetHeight(double))); connect(m_spinSize, SIGNAL(valueChanged(double)), this, SLOT(slotResize(double))); connect(m_opacity, SIGNAL(valueChanged(double)), this, SLOT(slotSetOpacity(double))); /*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()));*/ /* Setup of configuration controls */ connect(m_monitor, SIGNAL(addKeyframe()), this, SLOT(slotAddKeyframe())); connect(m_monitor, SIGNAL(seekToKeyframe(int)), this, SLOT(slotSeekToKeyframe(int))); connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties())); }