wizard.cpp
customtrackscene.cpp
abstractgroupitem.cpp
+ keyframehelper.cpp
)
kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
#include <QPushButton>
#include <QCheckBox>
#include <QScrollArea>
+
#include "ui_constval_ui.h"
#include "ui_listval_ui.h"
#include "ui_boolval_ui.h"
#include "ui_colorval_ui.h"
#include "ui_wipeval_ui.h"
#include "complexparameter.h"
+
#include "geometryval.h"
QMap<QString, QImage> EffectStackEdit::iconCache;
iconCache.clear();
}
+void EffectStackEdit::updateProjectFormat(MltVideoProfile profile) {
+ m_profile = profile;
+}
+
void EffectStackEdit::transferParamDesc(const QDomElement& d, int , int) {
kDebug() << "in";
params = d;
- QDomNodeList namenode = params.elementsByTagName("parameter");
clearAllItems();
+ if (params.isNull()) return;
+
+ QDomDocument doc;
+ doc.appendChild(doc.importNode(params, true));
+ kDebug() << "IMPORTED TRANS: " << doc.toString();
+ QDomNodeList namenode = params.elementsByTagName("parameter");
+ QDomElement e = params.toElement();
+ const int minFrame = e.attribute("start").toInt();
+ const int maxFrame = e.attribute("end").toInt();
+
for (int i = 0;i < namenode.count() ;i++) {
kDebug() << "in form";
valueItems[paramName+"complex"] = pl;
items.append(pl);
} else if (type == "geometry") {
- Geometryval *geo = new Geometryval;
+ Geometryval *geo = new Geometryval(m_profile);
connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
- geo->setupParam(d, pa.attribute("name"), 0, 100);
+ geo->setupParam(pa, minFrame, maxFrame);
vbox->addWidget(geo);
valueItems[paramName+"geometry"] = geo;
items.append(geo);
#include <QList>
#include <QMap>
+#include "definitions.h"
+
enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 };
struct wipeInfo {
public:
EffectStackEdit(QFrame* frame, QWidget *parent);
~EffectStackEdit();
+ void updateProjectFormat(MltVideoProfile profile);
static QMap<QString, QImage> iconCache;
private:
void createSliderItem(const QString& name, int val , int min, int max);
wipeInfo getWipeInfo(QString value);
QString getWipeString(wipeInfo info);
+ MltVideoProfile m_profile;
public slots:
void transferParamDesc(const QDomElement&, int , int);
***************************************************************************/
-#include "geometryval.h"
+
#include <QGraphicsView>
#include <QVBoxLayout>
#include <QGraphicsScene>
#include <QMouseEvent>
#include <KDebug>
-Geometryval::Geometryval(QWidget* parent): QWidget(parent) {
+#include "geometryval.h"
+
+Geometryval::Geometryval(const MltVideoProfile profile, QWidget* parent): QWidget(parent), m_profile(profile) {
ui.setupUi(this);
- QVBoxLayout* vbox = new QVBoxLayout(this);
- ui.widget->setLayout(vbox);
+ QVBoxLayout* vbox = new QVBoxLayout(ui.widget);
QGraphicsView *view = new QGraphicsView(this);
- view->setBackgroundBrush(QBrush(QColor(0, 0, 0)));
+ view->setBackgroundBrush(QBrush(Qt::black));
vbox->addWidget(view);
+ vbox->setContentsMargins(0, 0, 0, 0);
- ui.frame->setTickPosition(QSlider::TicksBelow);
+ QVBoxLayout* vbox2 = new QVBoxLayout(ui.keyframeWidget);
+ m_helper = new KeyframeHelper(this);
+ vbox2->addWidget(m_helper);
+ vbox2->setContentsMargins(0, 0, 0, 0);
scene = new GraphicsSceneRectMove(this);
scene->setTool(TITLE_SELECT);
view->setScene(scene);
- double aspect = 4.0 / 3.0; //change to project val
- QGraphicsRectItem *m_frameBorder = new QGraphicsRectItem(QRectF(0, 0, 100.0*aspect, 100));
+ double aspect = (double) profile.sample_aspect_num / profile.sample_aspect_den * profile.width / profile.height;
+ QGraphicsRectItem *m_frameBorder = new QGraphicsRectItem(QRectF(0, 0, profile.width, profile.height));
m_frameBorder->setZValue(-1100);
- //m_frameBorder->setBrush(QColor(255, 255, 0, 255));
+ m_frameBorder->setBrush(QColor(255, 255, 0, 30));
m_frameBorder->setPen(QPen(QBrush(QColor(255, 255, 255, 255)), 1.0, Qt::DashLine));
scene->addItem(m_frameBorder);
- paramRect = new QGraphicsRectItem(QRectF(20.0*aspect, 20, 80*aspect, 80));
-
- paramRect->setZValue(0);
- //m_frameBorder1->setBrush(QColor(255, 0, 0, 0));
- paramRect->setPen(QPen(QBrush(QColor(255, 0, 0, 255)), 1.0));
+ //scene->setSceneRect(-100.0*aspect, -100, 300.0*aspect, 300);
+ //view->fitInView(m_frameBorder, Qt::KeepAspectRatio);
+ const double sc = 100.0 / profile.height;
+ view->scale(sc, sc);
+ view->centerOn(m_frameBorder);
+ connect(scene , SIGNAL(itemMoved()) , this , SLOT(moveEvent()));
+ connect(ui.buttonNext , SIGNAL(clicked()) , this , SLOT(slotNextFrame()));
+ connect(ui.buttonPrevious , SIGNAL(clicked()) , this , SLOT(slotPreviousFrame()));
+}
- scene->addItem(paramRect);
+void Geometryval::slotNextFrame() {
+ Mlt::GeometryItem item;
+ m_geom->next_key(&item, ui.keyframeSlider->value() + 1);
+ int pos = item.frame();
+ ui.keyframeSlider->setValue(pos);
+}
- scene->setSceneRect(-100.0*aspect, -100, 300.0*aspect, 300);
- connect(scene , SIGNAL(itemMoved()) , this , SLOT(moveEvent()));
+void Geometryval::slotPreviousFrame() {
+ Mlt::GeometryItem item;
+ m_geom->prev_key(&item, ui.keyframeSlider->value() - 1);
+ int pos = item.frame();
+ ui.keyframeSlider->setValue(pos);
}
void Geometryval::moveEvent() {
return param;
}
-void Geometryval::setupParam(const QDomElement& par, const QString& paramName, int minFrame, int maxFrame) {
+void Geometryval::setupParam(const QDomElement& par, int minFrame, int maxFrame) {
param = par;
+ QString val = par.attribute("value");
+ char *tmp = (char *) qstrdup(val.toUtf8().data());
+ m_geom = new Mlt::Geometry(tmp, val.count(';') + 1, m_profile.width, m_profile.height);
+ delete[] tmp;
//read param her and set rect
- ui.frame->setRange(minFrame, maxFrame);
+ ui.keyframeSlider->setRange(0, maxFrame - minFrame);
+ m_helper->setKeyGeometry(m_geom, maxFrame - minFrame);
+ QDomDocument doc;
+ doc.appendChild(doc.importNode(par, true));
+ kDebug() << "IMPORTED TRANS: " << doc.toString();
+
+ Mlt::GeometryItem item;
+ m_geom->fetch(&item, 0);
+ paramRect = new QGraphicsRectItem(QRectF(0, 0, item.w(), item.h()));
+ paramRect->setPos(item.x(), item.y());
+ paramRect->setZValue(0);
+
+ paramRect->setBrush(QColor(255, 0, 0, 40));
+ paramRect->setPen(QPen(QBrush(QColor(255, 0, 0, 255)), 1.0));
+ scene->addItem(paramRect);
}
#define GEOMETRYVAL_H
-#include "ui_geometryval_ui.h"
#include <QWidget>
#include <QDomElement>
+#include <mlt++/Mlt.h>
+
+#include "ui_geometryval_ui.h"
+#include "definitions.h"
+#include "keyframehelper.h"
+
//class QGraphicsScene;
class GraphicsSceneRectMove;
class QGraphicsRectItem;
class Geometryval : public QWidget {
Q_OBJECT
public:
- Geometryval(QWidget* parent = 0);
+ Geometryval(const MltVideoProfile profile, QWidget* parent = 0);
QDomElement getParamDesc();
private:
Ui::Geometryval ui;
+ MltVideoProfile m_profile;
//QGraphicsScene* scene;
GraphicsSceneRectMove *scene;
QDomElement param;
QGraphicsRectItem *paramRect;
+ Mlt::Geometry *m_geom;
+ KeyframeHelper *m_helper;
+
public slots:
- void setupParam(const QDomElement&, const QString& paramName, int, int);
+ void setupParam(const QDomElement&, int, int);
void moveEvent();
+
+private slots:
+ void slotNextFrame();
+ void slotPreviousFrame();
+
signals:
void parameterChanged();
};
//thumbnailer.prepareThumbnailsCall(imagelist);
} else if (name == "composite") {
- paramList.append(quickParameterFill(ret, "Geometry", "geometry", "geometry", "0;0;100;100;100", "-500;-500;-500;-500;0", "500;500;500;500;100"));
+ paramList.append(quickParameterFill(ret, "Geometry", "geometry", "geometry", "20%,0%:50%x100%;30=50%,0%:50%x50%", "-500;-500;-500;-500;0", "500;500;500;500;100"));
tname.appendChild(ret.createTextNode("Composite"));
QDomDocument ret1;
return m_profile.path;
}
+MltVideoProfile KdenliveDoc::mltProfile() const {
+ return m_profile;
+}
+
void KdenliveDoc::setProfilePath(QString path) {
if (path.isEmpty()) path = KdenliveSettings::default_profile();
if (path.isEmpty()) path = "dv_pal";
/** Inform application of the audio thumbnails generation progress */
void setThumbsProgress(const QString &message, int progress);
QString profilePath() const;
+ MltVideoProfile mltProfile() const;
QString description() const;
/** Returns the document format: PAL or NTSC */
QString getDocumentStandard();
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include <QMouseEvent>
+#include <QStylePainter>
+
+#include <KDebug>
+#include <KIcon>
+#include <KCursor>
+#include <KGlobalSettings>
+
+#include "keyframehelper.h"
+
+#include "definitions.h"
+
+
+KeyframeHelper::KeyframeHelper(QWidget *parent)
+ : QWidget(parent), m_geom(NULL) {
+ setFont(KGlobalSettings::toolBarFont());
+
+}
+
+// virtual
+void KeyframeHelper::mousePressEvent(QMouseEvent * event) {
+ /* if (event->button() == Qt::RightButton) {
+ m_contextMenu->exec(event->globalPos());
+ return;
+ }
+ m_view->activateMonitor();
+ int pos = (int)((event->x() + offset()));
+ m_moveCursor = RULER_CURSOR;
+ if (event->y() > 10) {
+ if (qAbs(pos - m_zoneStart * m_factor) < 4) m_moveCursor = RULER_START;
+ else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2) * m_factor) < 4) m_moveCursor = RULER_MIDDLE;
+ else if (qAbs(pos - m_zoneEnd * m_factor) < 4) m_moveCursor = RULER_END;
+ }
+ if (m_moveCursor == RULER_CURSOR)
+ m_view->setCursorPos((int) pos / m_factor);
+ */
+}
+
+// virtual
+void KeyframeHelper::mouseMoveEvent(QMouseEvent * event) {
+ /* if (event->buttons() == Qt::LeftButton) {
+ int pos = (int)((event->x() + offset()) / m_factor);
+ if (pos < 0) pos = 0;
+ if (m_moveCursor == RULER_CURSOR) {
+ m_view->setCursorPos(pos);
+ return;
+ } else if (m_moveCursor == RULER_START) m_zoneStart = pos;
+ else if (m_moveCursor == RULER_END) m_zoneEnd = pos;
+ else if (m_moveCursor == RULER_MIDDLE) {
+ int move = pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2);
+ m_zoneStart += move;
+ m_zoneEnd += move;
+ }
+ m_view->setDocumentModified();
+ update();
+ } else {
+ int pos = (int)((event->x() + offset()));
+ if (event->y() <= 10) setCursor(Qt::ArrowCursor);
+ else if (qAbs(pos - m_zoneStart * m_factor) < 4) setCursor(KCursor("left_side", Qt::SizeHorCursor));
+ else if (qAbs(pos - m_zoneEnd * m_factor) < 4) setCursor(KCursor("right_side", Qt::SizeHorCursor));
+ else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2) * m_factor) < 4) setCursor(Qt::SizeHorCursor);
+ else setCursor(Qt::ArrowCursor);
+ }
+ */
+}
+
+
+// virtual
+void KeyframeHelper::wheelEvent(QWheelEvent * e) {
+ /* int delta = 1;
+ if (e->modifiers() == Qt::ControlModifier) delta = m_timecode.fps();
+ if (e->delta() < 0) delta = 0 - delta;
+ m_view->moveCursorPos(delta);
+ */
+}
+
+// virtual
+void KeyframeHelper::paintEvent(QPaintEvent *e) {
+ QStylePainter p(this);
+ p.setClipRect(e->rect());
+
+ if (m_geom != NULL) {
+ int pos = 0;
+ Mlt::GeometryItem item;
+ for (int i = 0; i < m_geom->length(); i++) {
+ m_geom->next_key(&item, pos);
+ pos = item.frame();
+ kDebug() << "++ PAINTING POS: " << pos;
+ int scaledPos = pos * width() / m_length;
+ p.fillRect(QRect(scaledPos - 1, 0, 2, 15), QBrush(QColor(255, 20, 20)));
+ pos++;
+ }
+ }
+}
+
+void KeyframeHelper::setKeyGeometry(Mlt::Geometry *geom, const int length) {
+ m_geom = geom;
+ m_length = length;
+ kDebug() << "KEYFRAMES: " << m_geom->length() << ", TRANS SOZE: " << m_length;
+ update();
+}
+
+#include "keyframehelper.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef KEYFRAMEHELPER_H
+#define KEYFRAMEHELPER_H
+
+#include <QWidget>
+
+#include <mlt++/Mlt.h>
+
+#include "timecode.h"
+
+class KeyframeHelper : public QWidget {
+ Q_OBJECT
+
+public:
+ KeyframeHelper(QWidget *parent = 0);
+
+protected:
+ virtual void paintEvent(QPaintEvent * /*e*/);
+ virtual void wheelEvent(QWheelEvent * e);
+ virtual void mousePressEvent(QMouseEvent * event);
+ virtual void mouseMoveEvent(QMouseEvent * event);
+
+private:
+ Mlt::Geometry *m_geom;
+ int m_length;
+
+public slots:
+ void setKeyGeometry(Mlt::Geometry *geom, const int length);
+};
+
+#endif
KdenliveSettings::setProject_fps(doc->fps());
m_monitorManager->resetProfiles(doc->timecode());
m_projectList->setDocument(doc);
+ transitionConfig->updateProjectFormat(doc->mltProfile());
connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
ui.splitter->setStretchFactor(1, 10);
}
+void TransitionSettings::updateProjectFormat(MltVideoProfile profile) {
+ effectEdit->updateProjectFormat(profile);
+}
+
void TransitionSettings::slotTransitionChanged(bool reinit) {
QDomElement e = m_usedTransition->toXML().cloneNode().toElement();
m_usedTransition->toXML().save(str, 2);*/
//kDebug() << test;
//oldparam must be also first given to Transition and then return the toXML()
- emit transitionUpdated(m_usedTransition, oldparam);
+ if (oldparam != param) emit transitionUpdated(m_usedTransition, oldparam);
}
void TransitionSettings::raiseWindow(QWidget* dock) {
***************************************************************************/
#ifndef TRANSITIONSETTINGS_H
#define TRANSITIONSETTINGS_H
-#include "ui_transitionsettings_ui.h"
+
#include <QDomElement>
+#include "ui_transitionsettings_ui.h"
+#include "definitions.h"
+
class Transition;
class EffectsList;
class EffectStackEdit;
public:
TransitionSettings(QWidget* parent = 0);
void raiseWindow(QWidget*);
+ void updateProjectFormat(MltVideoProfile profile);
+
private:
Ui::TransitionSettings_UI ui;
EffectStackEdit *effectEdit;
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>300</height>
+ <width>273</width>
+ <height>256</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Geometry</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
+ <item row="0" column="0" colspan="7" >
<widget class="QWidget" native="1" name="widget" >
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
</property>
</widget>
</item>
+ <item row="1" column="0" colspan="7" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QFrame" name="keyframeWidget" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Plain</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="keyframeSlider" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item row="2" column="0" >
- <widget class="QSlider" name="frame" >
+ <widget class="KArrowButton" name="buttonPrevious" >
+ <property name="arrowType" stdset="0" >
+ <number>3</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="KArrowButton" name="buttonNext" >
+ <property name="arrowType" stdset="0" >
+ <number>4</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QToolButton" name="buttonAdd" >
+ <property name="text" >
+ <string>A</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QToolButton" name="buttonDelete" >
+ <property name="text" >
+ <string>D</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4" >
+ <spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- </widget>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>17</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
</item>
- <item row="3" column="0" >
- <widget class="QCheckBox" name="isKeyFrame" >
+ <item row="2" column="5" >
+ <widget class="QLabel" name="label_2" >
<property name="text" >
- <string>Keyframe</string>
+ <string>Transparency</string>
</property>
</widget>
</item>
+ <item row="2" column="6" >
+ <widget class="QSpinBox" name="spinBox" />
+ </item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>KArrowButton</class>
+ <extends>QPushButton</extends>
+ <header>karrowbutton.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>