Exemplo n.º 1
0
void KeyframeEdit::slotKeyframeMode()
{
    widgetTable->setHidden(false);
    buttonKeyframes->setHidden(true);
    if (keyframe_list->rowCount() == 1) {
        slotAddKeyframe();
    }
}
Exemplo n.º 2
0
KeyframeEdit::KeyframeEdit(const QDomElement &e, int minFrame, int maxFrame, const Timecode &tc, int activeKeyframe, QWidget* parent) :
    QWidget(parent),
    m_min(minFrame),
    m_max(maxFrame),
    m_timecode(tc),
    m_keyframesTag(false)
{
    setupUi(this);
    if (m_max == -1) {
        // special case: keyframe for tracks, do not allow keyframes
        widgetTable->setHidden(true);
    }
    setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
    keyframe_list->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
    buttonSeek->setChecked(KdenliveSettings::keyframeseek());
    connect(buttonSeek, SIGNAL(toggled(bool)), this, SLOT(slotSetSeeking(bool)));

    buttonKeyframes->setIcon(KoIconUtils::themedIcon(QStringLiteral("chronometer")));
    button_add->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add")));
    button_add->setToolTip(i18n("Add keyframe"));
    button_delete->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-remove")));
    button_delete->setToolTip(i18n("Delete keyframe"));
    buttonResetKeyframe->setIcon(KoIconUtils::themedIcon(QStringLiteral("edit-undo")));
    buttonSeek->setIcon(KoIconUtils::themedIcon(QStringLiteral("edit-link")));
    connect(keyframe_list, &QTableWidget::cellActivated, this, &KeyframeEdit::rowClicked);
    connect(keyframe_list, SIGNAL(cellChanged(int,int)), this, SLOT(slotGenerateParams(int,int)));

    m_position = new PositionEdit(i18n("Position"), 0, 0, 1, tc, widgetTable);
    ((QGridLayout*)widgetTable->layout())->addWidget(m_position, 3, 0, 1, -1);

    m_slidersLayout = new QGridLayout(param_sliders);
    //m_slidersLayout->setSpacing(0);
    
    m_slidersLayout->setContentsMargins(0, 0, 0, 0);
    m_slidersLayout->setVerticalSpacing(2);
    keyframe_list->setSelectionBehavior(QAbstractItemView::SelectRows);
    keyframe_list->setSelectionMode(QAbstractItemView::SingleSelection);
    addParameter(e, activeKeyframe);
    keyframe_list->resizeRowsToContents();

    //keyframe_list->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
    connect(button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteKeyframe()));
    connect(button_add, SIGNAL(clicked()), this, SLOT(slotAddKeyframe()));
    connect(buttonKeyframes, SIGNAL(clicked()), this, SLOT(slotKeyframeMode()));
    connect(buttonResetKeyframe, SIGNAL(clicked()), this, SLOT(slotResetKeyframe()));
    connect(m_position, SIGNAL(parameterChanged(int)), this, SLOT(slotAdjustKeyframePos(int)));

    //connect(keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem*,int)));

    if (!keyframe_list->currentItem()) {
        keyframe_list->setCurrentCell(0, 0);
        keyframe_list->selectRow(0);
    }
    // ensure the keyframe list shows at least 3 lines
    keyframe_list->setMinimumHeight(QFontInfo(keyframe_list->font()).pixelSize() * 9);

    // Do not show keyframe table if only one keyframe exists at the beginning
    if (keyframe_list->rowCount() < 2 && getPos(0) == m_min && m_max != -1)
        widgetTable->setHidden(true);
    else
        buttonKeyframes->setHidden(true);
}
cKeyframeAnimation::cKeyframeAnimation(cInterface *_interface, cKeyframes *_frames, cImage *_image,
		QWidget *_imageWidget, cParameterContainer *_params, cFractalContainer *_fractal,
		QObject *parent) :
		QObject(parent), mainInterface(_interface), keyframes(_frames)
{
	image = _image;
	imageWidget = _imageWidget;
	params = _params;
	fractalParams = _fractal;

	if (mainInterface->mainWindow)
	{
		ui = mainInterface->mainWindow->ui;
		QApplication::connect(ui->pushButton_add_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotAddKeyframe()));
		QApplication::connect(ui->pushButton_insert_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotInsertKeyframe()));
		QApplication::connect(ui->pushButton_delete_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotDeleteKeyframe()));
		QApplication::connect(ui->pushButton_modify_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotModifyKeyframe()));
		QApplication::connect(ui->pushButton_render_keyframe_animation,
													SIGNAL(clicked()),
													this,
													SLOT(slotRenderKeyframes()));
		QApplication::connect(ui->pushButton_delete_all_keyframe_images,
													SIGNAL(clicked()),
													this,
													SLOT(slotDeleteAllImages()));
		QApplication::connect(ui->pushButton_show_keyframe_animation,
													SIGNAL(clicked()),
													this,
													SLOT(slotShowAnimation()));
		QApplication::connect(ui->pushButton_refresh_keyframe_table,
													SIGNAL(clicked()),
													this,
													SLOT(slotRefreshTable()));
		QApplication::connect(ui->pushButton_keyframe_to_flight_export,
													SIGNAL(clicked()),
													this,
													SLOT(slotExportKeyframesToFlight()));
		QApplication::connect(ui->pushButton_check_for_collisions,
													SIGNAL(clicked()),
													this,
													SLOT(slotValidate()));
		QApplication::connect(ui->pushButton_set_constant_target_distance,
													SIGNAL(clicked()),
													this,
													SLOT(slotSetConstantTargetDistance()));

		QApplication::connect(ui->button_selectAnimKeyframeImageDir,
													SIGNAL(clicked()),
													this,
													SLOT(slotSelectKeyframeAnimImageDir()));
		QApplication::connect(ui->tableWidget_keyframe_animation,
													SIGNAL(cellChanged(int, int)),
													this,
													SLOT(slotTableCellChanged(int, int)));

		QApplication::connect(ui->spinboxInt_keyframe_first_to_render,
													SIGNAL(valueChanged(int)),
													this,
													SLOT(slotMovedSliderFirstFrame(int)));
		QApplication::connect(ui->spinboxInt_keyframe_last_to_render,
													SIGNAL(valueChanged(int)),
													this,
													SLOT(slotMovedSliderLastFrame(int)));
		QApplication::connect(ui->spinboxInt_frames_per_keyframe,
													SIGNAL(valueChanged(int)),
													this,
													SLOT(UpdateLimitsForFrameRange()));

		QApplication::connect(ui->tableWidget_keyframe_animation,
													SIGNAL(cellDoubleClicked(int, int)),
													this,
													SLOT(slotCellDoubleClicked(int, int)));

		QApplication::connect(this,
													SIGNAL(QuestionMessage(const QString, const QString, QMessageBox::StandardButtons, QMessageBox::StandardButton*)),
													mainInterface->mainWindow,
													SLOT(slotQuestionMessage(const QString, const QString, QMessageBox::StandardButtons, QMessageBox::StandardButton*)));

		table = ui->tableWidget_keyframe_animation;

		//add default parameters for animation
		if (keyframes->GetListOfUsedParameters().size() == 0)
		{
			keyframes->AddAnimatedParameter("camera", params->GetAsOneParameter("camera"));
			keyframes->AddAnimatedParameter("target", params->GetAsOneParameter("target"));
			keyframes->AddAnimatedParameter("camera_top", params->GetAsOneParameter("camera_top"));
			if (mainInterface->mainWindow) PrepareTable();
		}
	}
Exemplo n.º 4
0
GeometryWidget::GeometryWidget(EffectMetaInfo *info, int clipPos, bool showRotation, bool useOffset, QWidget* parent):
    QWidget(parent),
    m_monitor(info->monitor),
    m_timePos(new TimecodeDisplay(info->monitor->timecode())),
    m_clipPos(clipPos),
    m_inPoint(0),
    m_outPoint(1),
    m_previous(NULL),
    m_geometry(NULL),
    m_frameSize(info->frameSize),
    m_fixedGeom(false),
    m_singleKeyframe(false),
    m_useOffset(useOffset)
{
    m_ui.setupUi(this);
    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
    connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect);
    connect(m_monitor, &Monitor::effectPointsChanged, this, &GeometryWidget::slotUpdateCenters, Qt::UniqueConnection);
    /*
        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 *originalSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-original")), i18n("Adjust to original size"), this);
    connect(originalSize, SIGNAL(triggered()), this, SLOT(slotAdjustToSource()));
    QAction *adjustSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-best")), i18n("Adjust and center in frame"), 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(originalSize);
    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()));
}
Exemplo n.º 5
0
void KeyframeEdit::slotKeyframeMode()
{
    widgetTable->setHidden(false);
    buttonKeyframes->setHidden(true);
    slotAddKeyframe();
}