cliptranscode.cpp
keyframeedit.cpp
positionedit.cpp
+ trackdialog.cpp
)
add_definitions( ${KDE4_DEFINITIONS} )
m_keyframeFactor(1),
m_fps(fps)
{
- setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
setTrack(info.track);
m_startPos = info.startPos;
m_cropDuration = info.endPos - info.startPos;
return m_maxDuration;
}
-QPainterPath AbstractClipItem::upperRectPart(QRectF br)
-{
- QPainterPath roundRectPathUpper;
- double roundingY = 20;
- double roundingX = 20;
- double offset = 1;
-
- while (roundingX > br.width() / 2) {
- roundingX = roundingX / 2;
- roundingY = roundingY / 2;
- }
- int br_endx = (int)(br.x() + br .width() - offset);
- int br_startx = (int)(br.x() + offset);
- int br_starty = (int)(br.y());
- int br_halfy = (int)(br.y() + br.height() / 2 - offset);
-
- roundRectPathUpper.moveTo(br_endx , br_halfy);
- roundRectPathUpper.arcTo(br_endx - roundingX , br_starty , roundingX, roundingY, 0.0, 90.0);
- roundRectPathUpper.lineTo(br_startx + roundingX , br_starty);
- roundRectPathUpper.arcTo(br_startx , br_starty , roundingX, roundingY, 90.0, 90.0);
- roundRectPathUpper.lineTo(br_startx , br_halfy);
-
- return roundRectPathUpper;
-}
-
-QPainterPath AbstractClipItem::lowerRectPart(QRectF br)
-{
- QPainterPath roundRectPathLower;
- double roundingY = 20;
- double roundingX = 20;
- double offset = 1;
-
- int br_endx = (int)(br.x() + br .width() - offset);
- int br_startx = (int)(br.x() + offset);
- int br_halfy = (int)(br.y() + br.height() / 2 - offset);
- int br_endy = (int)(br.y() + br.height() - 1);
-
- while (roundingX > br.width() / 2) {
- roundingX = roundingX / 2;
- roundingY = roundingY / 2;
- }
- roundRectPathLower.moveTo(br_startx, br_halfy);
- roundRectPathLower.arcTo(br_startx , br_endy - roundingY , roundingX, roundingY, 180.0, 90.0);
- roundRectPathLower.lineTo(br_endx - roundingX , br_endy);
- roundRectPathLower.arcTo(br_endx - roundingX , br_endy - roundingY, roundingX, roundingY, 270.0, 90.0);
- roundRectPathLower.lineTo(br_endx , br_halfy);
- return roundRectPathLower;
-}
-
void AbstractClipItem::drawKeyFrames(QPainter *painter, QRectF /*exposedRect*/)
{
if (m_keyframes.count() < 2) return;
QLineF l2 = painter->matrix().map(l);
painter->setPen(QColor(168, 168, 168, 180));
painter->drawLine(l2);
- l2.translate(0, 1);
painter->setPen(QColor(108, 108, 108, 180));
- painter->drawLine(l2);
+ painter->drawLine(l2.translated(0, 1));
painter->setPen(QColor(Qt::white));
}
l2 = painter->matrix().map(l);
painter->drawLine(l2);
if (active) {
- painter->fillRect(l2.x1() - 3, l2.y1() - 3, 6, 6, QBrush(color));
+ painter->fillRect(l2.x1() - 3, l2.y1() - 3, 6, 6, color);
}
x1 = x2;
y1 = y2;
}
- if (active) painter->fillRect(l2.x2() - 3, l2.y2() - 3, 6, 6, QBrush(color));
+ if (active) painter->fillRect(l2.x2() - 3, l2.y2() - 3, 6, 6, color);
}
int AbstractClipItem::mouseOverKeyFrames(QPointF pos)
setSelected(false);
setFlag(QGraphicsItem::ItemIsMovable, false);
setFlag(QGraphicsItem::ItemIsSelectable, false);
- } else setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ } else setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
}
bool AbstractClipItem::isItemLocked() const
double m_keyframeFactor;
double m_keyframeDefault;
double m_fps;
- QPainterPath upperRectPart(QRectF);
- QPainterPath lowerRectPart(QRectF);
//QRect visibleRect();
void drawKeyFrames(QPainter *painter, QRectF exposedRect);
int mouseOverKeyFrames(QPointF pos);
QGraphicsItemGroup()
{
setZValue(1);
- setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
setAcceptDrops(true);
}
void AbstractGroupItem::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *)
{
const double scale = option->matrix.m11();
- p->fillRect(option->exposedRect, QColor(100, 100, 200, 100));
+ QColor bgcolor(100, 100, 200, 100);
+ p->fillRect(option->exposedRect, bgcolor);
p->setClipping(false);
QPen pen = p->pen();
pen.setColor(QColor(200, 90, 90));
pen.setStyle(Qt::DashLine);
- pen.setWidthF(1.0);
- pen.setCosmetic(true);
+ pen.setWidthF(0.0);
+ //pen.setCosmetic(true);
p->setPen(pen);
p->drawRect(boundingRect().adjusted(0, 0, - 1 / scale, 0));
}
{
if (!m_remove) setText(i18n("Add timeline clip"));
else setText(i18n("Delete timeline clip"));
+ if (parent) {
+ // command has a parent, so there are several operations ongoing, do not refresh monitor
+ m_refresh = false;
+ } else m_refresh = true;
}
// virtual
void AddTimelineClipCommand::undo()
{
- if (!m_remove) m_view->deleteClip(m_clipInfo);
- else m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects);
+ if (!m_remove) m_view->deleteClip(m_clipInfo, m_refresh);
+ else m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects, m_refresh);
}
// virtual
void AddTimelineClipCommand::redo()
{
if (m_doIt) {
- if (!m_remove) m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects);
- else m_view->deleteClip(m_clipInfo);
+ if (!m_remove) m_view->addClip(m_xml, m_clipId, m_clipInfo, m_effects, m_refresh);
+ else m_view->deleteClip(m_clipInfo, m_refresh);
}
m_doIt = true;
}
QDomElement m_xml;
bool m_doIt;
bool m_remove;
+ bool m_refresh;
};
#endif
{
if (m_remove) setText(i18n("Delete transition from clip"));
else setText(i18n("Add transition to clip"));
+ if (parent) {
+ // command has a parent, so there are several operations ongoing, do not refresh monitor
+ m_refresh = false;
+ } else m_refresh = true;
}
// virtual
void AddTransitionCommand::undo()
{
- if (m_remove) m_view->addTransition(m_info, m_track, m_params);
- else m_view->deleteTransition(m_info, m_track, m_params);
+ if (m_remove) m_view->addTransition(m_info, m_track, m_params, m_refresh);
+ else m_view->deleteTransition(m_info, m_track, m_params, m_refresh);
}
// virtual
void AddTransitionCommand::redo()
{
if (m_doIt) {
- if (m_remove) m_view->deleteTransition(m_info, m_track, m_params);
- else m_view->addTransition(m_info, m_track, m_params);
+ if (m_remove) m_view->deleteTransition(m_info, m_track, m_params, m_refresh);
+ else m_view->addTransition(m_info, m_track, m_params, m_refresh);
}
m_doIt = true;
}
int m_track;
bool m_doIt;
bool m_remove;
+ bool m_refresh;
};
#endif
m_clipName = name;
}
-const QString &ClipItem::clipProducer() const
+const QString ClipItem::clipProducer() const
{
return m_producer;
}
if (parentItem()) paintColor = QColor(255, 248, 149);
else paintColor = brush().color();
if (isSelected() || (parentItem() && parentItem()->isSelected())) paintColor = paintColor.darker();
- QRectF br = rect();
- QRectF exposed = option->exposedRect;
- QRectF mapped = painter->matrix().mapRect(br);
+ const QRectF br = rect();
+ const QRectF exposed = option->exposedRect;
+ const QRectF mapped = painter->matrix().mapRect(br);
const double itemWidth = br.width();
const double itemHeight = br.height();
// Draw effects names
if (!m_effectNames.isEmpty() && itemWidth * scale > 40) {
- QRectF txtBounding = painter->boundingRect(mapped, Qt::AlignLeft | Qt::AlignTop, m_effectNames);
- txtBounding.setRight(txtBounding.right() + 15);
+ QRectF txtBounding = painter->boundingRect(mapped, Qt::AlignLeft | Qt::AlignTop, m_effectNames).adjusted(0, 0, 15, 0);
painter->setPen(Qt::white);
QBrush markerBrush(Qt::SolidPattern);
if (m_timeLine && m_timeLine->state() == QTimeLine::Running) {
} else if (m_audioOnly) {
painter->drawPixmap(txtBounding.topLeft() - QPointF(17, -1), m_audioPix);
}
- txtBounding.translate(QPointF(1, 1));
painter->setPen(QColor(255, 255, 255, 255));
painter->drawText(txtBounding, Qt::AlignCenter, m_clipName);
// draw clip border
// expand clip rect to allow correct painting of clip border
QPen pen1(frameColor);
- pen1.setWidthF(1.0);
- pen1.setCosmetic(true);
+ //pen1.setCosmetic(true);
painter->setPen(pen1);
/*exposed.setRight(exposed.right() + xoffset + 0.5);
void resizeStart(int posx, double speed = 1.0);
void resizeEnd(int posx, double speed = 1.0, bool updateKeyFrames = true);
OPERATIONTYPE operationMode(QPointF pos);
- const QString &clipProducer() const;
+ const QString clipProducer() const;
int clipType() const;
DocClipBase *baseClip() const;
QString clipName() const;
}
}
-void ClipManager::resetProducersList(QList <Mlt::Producer *> prods)
+void ClipManager::resetProducersList(const QList <Mlt::Producer *> prods)
{
for (int i = 0; i < m_clipList.count(); i++) {
if (m_clipList.at(i)->numReferences() > 0) {
- m_clipList.at(i)->deleteProducers();
+ m_clipList.at(i)->clearProducers();
}
}
QString id;
for (int i = 0; i < prods.count(); i++) {
id = prods.at(i)->get("id");
+ kDebug() << "// // // REPLACE CLIP: " << id;
if (id.contains('_')) id = id.section('_', 0, 0);
DocClipBase *clip = getClipById(id);
if (clip) {
clip->setProducer(prods.at(i));
- kDebug() << "// // // REPLACE CLIP: " << id;
}
}
emit checkAllClips();
void askForAudioThumb(const QString &id);
QString projectFolder() const;
void clearUnusedProducers();
- void resetProducersList(QList <Mlt::Producer *> prods);
+ void resetProducersList(const QList <Mlt::Producer *> prods);
void addFolder(const QString&, const QString&);
void deleteFolder(const QString&);
void clear();
} 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);
+ else if (qAbs(pos - m_zoneStart * m_factor) < 4) {
+ setCursor(KCursor("left_side", Qt::SizeHorCursor));
+ setToolTip(i18n("Zone start: %1", m_timecode.getTimecodeFromFrames(m_zoneStart)));
+ } else if (qAbs(pos - m_zoneEnd * m_factor) < 4) {
+ setCursor(KCursor("right_side", Qt::SizeHorCursor));
+ setToolTip(i18n("Zone end: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd)));
+ } else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2) * m_factor) < 4) {
+ setCursor(Qt::SizeHorCursor);
+ setToolTip(i18n("Zone duration: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd - m_zoneStart)));
+ } else {
+ setCursor(Qt::ArrowCursor);
+ setToolTip(QString());
+ }
}
}
}
if (zoneEnd > 0) {
+ QColor center(Qt::white);
+ center.setAlpha(150);
QRect rec(zoneStart - off + (zoneEnd - zoneStart) / 2 - 4, 9, 8, 9);
- p.fillRect(rec, QColor(255, 255, 255, 150));
+ p.fillRect(rec, center);
p.drawRect(rec);
QPolygon pa(4);
m_document(doc),
m_scale(1.0, 1.0)
{
- m_transitionPixmap = QPixmap(KStandardDirs::locate("appdata", "transition.png"));
}
CustomTrackScene::~CustomTrackScene()
void setScale(double scale, double vscale);
QPointF scale() const;
int tracksCount() const;
- QPixmap m_transitionPixmap;
MltVideoProfile profile() const;
private:
#include "groupclipscommand.h"
#include "splitaudiocommand.h"
#include "changecliptypecommand.h"
+#include "trackdialog.h"
#include <KDebug>
#include <KLocale>
verticalScrollBar()->setMaximum(maxWidth);
m_cursorLine = projectscene->addLine(0, 0, 0, maxWidth);
m_cursorLine->setZValue(1000);
- QPen pen1;
+ /*QPen pen1;
pen1.setWidthF(1.0);
pen1.setCosmetic(true);
- m_cursorLine->setPen(pen1);
+ m_cursorLine->setPen(pen1);*/
KIcon razorIcon("edit-cut");
m_razorCursor = QCursor(razorIcon.pixmap(22, 22));
}
ct++;
}
- if (!found) m_dragItem = NULL;
+ if (!found) {
+ if (m_dragItem) emit clipItemSelected(NULL);
+ m_dragItem = NULL;
+ }
if (m_dragItem && m_dragItem->type() == TRANSITIONWIDGET) {
// update transition menu action
setCursor(Qt::ArrowCursor);
m_scene->clearSelection();
//event->accept();
- emit clipItemSelected(NULL);
updateClipTypeActions(NULL);
if (m_tool == SPACERTOOL) {
QList<QGraphicsItem *> selection;
for (int i = 0; i < children.count(); i++) {
if (children.at(i)->type() == AVWIDGET || children.at(i)->type() == TRANSITIONWIDGET) {
if (!static_cast <AbstractClipItem *>(children.at(i))->isItemLocked()) {
- children.at(i)->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ children.at(i)->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
children.at(i)->setSelected(selectItems);
}
} else if (children.at(i)->type() == GROUPWIDGET) {
- children.at(i)->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ children.at(i)->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
children.at(i)->setSelected(selectItems);
}
}
setDocumentModified();
}
-void CustomTrackView::addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params)
+void CustomTrackView::addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh)
{
Transition *tr = new Transition(transitionInfo, endTrack, m_document->fps(), params, true);
//kDebug() << "---- ADDING transition " << params.attribute("value");
- if (m_document->renderer()->mltAddTransition(tr->transitionTag(), endTrack, m_document->tracksCount() - transitionInfo.track, transitionInfo.startPos, transitionInfo.endPos, tr->toXML())) {
+ if (m_document->renderer()->mltAddTransition(tr->transitionTag(), endTrack, m_document->tracksCount() - transitionInfo.track, transitionInfo.startPos, transitionInfo.endPos, tr->toXML(), refresh)) {
scene()->addItem(tr);
setDocumentModified();
} else {
}
}
-void CustomTrackView::deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement /*params*/)
+void CustomTrackView::deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement /*params*/, bool refresh)
{
Transition *item = getTransitionItemAt(transitionInfo.startPos, transitionInfo.track);
if (!item) {
emit displayMessage(i18n("Select clip to delete"), ErrorMessage);
return;
}
- m_document->renderer()->mltDeleteTransition(item->transitionTag(), endTrack, m_document->tracksCount() - transitionInfo.track, transitionInfo.startPos, transitionInfo.endPos, item->toXML());
+ m_document->renderer()->mltDeleteTransition(item->transitionTag(), endTrack, m_document->tracksCount() - transitionInfo.track, transitionInfo.startPos, transitionInfo.endPos, item->toXML(), refresh);
if (m_dragItem == item) m_dragItem = NULL;
delete item;
emit transitionItemSelected(NULL);
}
m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
setSceneRect(0, 0, sceneRect().width(), maxHeight);
- QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
- viewport()->update();
+ //viewport()->update();
+ emit trackHeightChanged();
+ //QTimer::singleShot(500, this, SIGNAL(trackHeightChanged()));
//setFixedHeight(50 * m_tracksCount);
}
}
m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
setSceneRect(0, 0, sceneRect().width(), maxHeight);
- QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
- viewport()->update();
+ //viewport()->update();
+ emit trackHeightChanged();
+ //QTimer::singleShot(500, this, SIGNAL(trackHeightChanged()));
}
void CustomTrackView::changeTrack(int ix, TrackInfo type)
m_operationMode = NONE;
}
-void CustomTrackView::deleteClip(ItemInfo info)
+void CustomTrackView::deleteClip(ItemInfo info, bool refresh)
{
ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()), info.track);
delete tr;
}
}*/
- scene()->removeItem(item);
m_waitingThumbs.removeAll(item);
if (m_dragItem == item) m_dragItem = NULL;
+ scene()->removeItem(item);
delete item;
item = NULL;
setDocumentModified();
- m_document->renderer()->doRefresh();
+ if (refresh) m_document->renderer()->doRefresh();
}
void CustomTrackView::deleteSelectedClips()
m_document->clipManager()->removeGroup(grp);
scene()->destroyItemGroup(grp);
}
- clip->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ clip->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
}
for (int i = 0; i < transitionInfos.count(); i++) {
Transition *tr = getTransitionItemAt(transitionInfos.at(i).startPos, transitionInfos.at(i).track);
m_document->clipManager()->removeGroup(grp);
scene()->destroyItemGroup(grp);
}
- tr->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ tr->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
}
setDocumentModified();
return;
setDocumentModified();
}
-void CustomTrackView::addClip(QDomElement xml, const QString &clipId, ItemInfo info, EffectsList effects)
+void CustomTrackView::addClip(QDomElement xml, const QString &clipId, ItemInfo info, EffectsList effects, bool refresh)
{
DocClipBase *baseclip = m_document->clipManager()->getClipById(clipId);
if (baseclip == NULL) {
m_document->renderer()->mltAddEffect(info.track, info.startPos, item->getEffectArgs(item->effectAt(i)), false);
}
setDocumentModified();
- m_document->renderer()->doRefresh();
+ if (refresh) m_document->renderer()->doRefresh();
m_waitingThumbs.append(item);
m_thumbsTimer.start();
}
void CustomTrackView::drawBackground(QPainter * painter, const QRectF &rect)
{
- QRectF r = rect;
- r.setWidth(r.width() + 1);
+ QRectF r = rect.adjusted(0, 0, 1, 0);
painter->setClipRect(r);
painter->drawLine(r.left(), 0, r.right(), 0);
uint max = m_document->tracksCount();
QColor audioColor = palette().alternateBase().color();
QColor base = scheme.background(KColorScheme::NormalBackground).color();
for (uint i = 0; i < max; i++) {
- if (m_document->trackInfoAt(max - i - 1).isLocked == true) painter->fillRect(r.left(), m_tracksHeight * i + 1, r.right() - r.left() + 1, m_tracksHeight - 1, QBrush(lockedColor));
- else if (m_document->trackInfoAt(max - i - 1).type == AUDIOTRACK) painter->fillRect(r.left(), m_tracksHeight * i + 1, r.right() - r.left() + 1, m_tracksHeight - 1, QBrush(audioColor));
+ if (m_document->trackInfoAt(max - i - 1).isLocked == true) painter->fillRect(r.left(), m_tracksHeight * i + 1, r.right() - r.left() + 1, m_tracksHeight - 1, lockedColor);
+ else if (m_document->trackInfoAt(max - i - 1).type == AUDIOTRACK) painter->fillRect(r.left(), m_tracksHeight * i + 1, r.right() - r.left() + 1, m_tracksHeight - 1, audioColor);
painter->drawLine(r.left(), m_tracksHeight *(i + 1), r.right(), m_tracksHeight *(i + 1));
}
int lowerLimit = m_tracksHeight * m_document->tracksCount() + 1;
if (height() > lowerLimit)
- painter->fillRect(QRectF(r.left(), lowerLimit, r.width(), height() - lowerLimit), QBrush(base));
+ painter->fillRect(QRectF(r.left(), lowerLimit, r.width(), height() - lowerLimit), base);
}
bool CustomTrackView::findString(const QString &text)
void CustomTrackView::slotInsertTrack(int ix)
{
- kDebug() << "// INSERTING TRK: " << ix;
- QDialog d(parentWidget());
- Ui::AddTrack_UI view;
- view.setupUi(&d);
- view.track_nb->setMaximum(m_document->tracksCount() - 1);
- view.track_nb->setValue(ix);
- d.setWindowTitle(i18n("Insert Track"));
+ TrackDialog d(m_document, parentWidget());
+ d.view.label->setText(i18n("Insert track"));
+ d.view.track_nb->setMaximum(m_document->tracksCount() - 1);
+ d.view.track_nb->setValue(ix);
+ d.setWindowTitle(i18n("Insert New Track"));
+ d.slotUpdateName(ix);
if (d.exec() == QDialog::Accepted) {
- ix = view.track_nb->value();
- if (view.before_select->currentIndex() == 1) {
+ ix = d.view.track_nb->value();
+ if (d.view.before_select->currentIndex() == 1) {
ix++;
}
TrackInfo info;
- if (view.video_track->isChecked()) {
+ if (d.view.video_track->isChecked()) {
info.type = VIDEOTRACK;
info.isMute = false;
info.isBlind = false;
void CustomTrackView::slotDeleteTrack(int ix)
{
- bool ok;
- ix = QInputDialog::getInteger(this, i18n("Remove Track"), i18n("Track"), ix, 0, m_document->tracksCount() - 1, 1, &ok);
- if (ok) {
+ TrackDialog d(m_document, parentWidget());
+ d.view.label->setText(i18n("Delete track"));
+ d.view.before_select->setHidden(true);
+ d.view.track_nb->setMaximum(m_document->tracksCount() - 1);
+ d.view.track_nb->setValue(ix);
+ d.slotUpdateName(ix);
+ d.setWindowTitle(i18n("Delete Track"));
+ d.view.video_track->setHidden(true);
+ d.view.audio_track->setHidden(true);
+ if (d.exec() == QDialog::Accepted) {
+ ix = d.view.track_nb->value();
TrackInfo info = m_document->trackInfoAt(m_document->tracksCount() - ix - 1);
deleteTimelineTrack(ix, info);
setDocumentModified();
void CustomTrackView::slotChangeTrack(int ix)
{
- QDialog d(parentWidget());
- Ui::AddTrack_UI view;
- view.setupUi(&d);
- view.label->setText(i18n("Change track"));
- view.before_select->setHidden(true);
- view.track_nb->setMaximum(m_document->tracksCount() - 1);
- view.track_nb->setValue(ix);
+ TrackDialog d(m_document, parentWidget());
+ d.view.label->setText(i18n("Change track"));
+ d.view.before_select->setHidden(true);
+ d.view.track_nb->setMaximum(m_document->tracksCount() - 1);
+ d.view.track_nb->setValue(ix);
+ d.slotUpdateName(ix);
d.setWindowTitle(i18n("Change Track Type"));
if (m_document->trackInfoAt(m_document->tracksCount() - ix - 1).type == VIDEOTRACK)
- view.video_track->setChecked(true);
+ d.view.video_track->setChecked(true);
else
- view.audio_track->setChecked(true);
+ d.view.audio_track->setChecked(true);
if (d.exec() == QDialog::Accepted) {
TrackInfo info;
info.isLocked = false;
info.isMute = false;
- ix = view.track_nb->value();
+ ix = d.view.track_nb->value();
- if (view.video_track->isChecked()) {
+ if (d.view.video_track->isChecked()) {
info.type = VIDEOTRACK;
info.isBlind = false;
} else {
}
}
- selection = m_scene->items();
new AddTrackCommand(this, ix, trackinfo, false, deleteTrack);
m_commandStack->push(deleteTrack);
}
break;
}
}
- clip->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ clip->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
m_document->clipManager()->removeGroup(grp);
scene()->destroyItemGroup(grp);
}
/** move transition, startPos = (old start, old end), endPos = (new start, new end) */
void moveTransition(const ItemInfo start, const ItemInfo end);
void resizeClip(const ItemInfo start, const ItemInfo end);
- void addClip(QDomElement xml, const QString &clipId, ItemInfo info, EffectsList list = EffectsList());
- void deleteClip(ItemInfo info);
+ void addClip(QDomElement xml, const QString &clipId, ItemInfo info, EffectsList list = EffectsList(), bool refresh = true);
+ void deleteClip(ItemInfo info, bool refresh = true);
void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position);
void slotDeleteAllClipMarkers(const QString &id);
void addMarker(const QString &id, const GenTime &pos, const QString comment);
void deleteEffect(int track, GenTime pos, QDomElement effect);
void updateEffect(int track, GenTime pos, QDomElement effect, int ix, bool triggeredByUser = true);
void moveEffect(int track, GenTime pos, int oldPos, int newPos);
- void addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params);
- void deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement params);
+ void addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
+ void deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
void updateTransition(int track, GenTime pos, QDomElement oldTransition, QDomElement transition, bool updateTransitionWidget);
void moveTransition(GenTime oldpos, GenTime newpos);
void activateMonitor();
return QString();
}
+void DocClipBase::clearProducers()
+{
+ m_baseTrackProducers.clear();
+}
+
void DocClipBase::deleteProducers()
{
+ kDebug() << "// CLIP KILL PRODS ct: " << m_baseTrackProducers.count();
+ if (m_thumbProd) m_thumbProd->clearProducer();
+ /*kDebug()<<"// CLIP KILL PRODS ct: "<<m_baseTrackProducers.count();
+ int max = m_baseTrackProducers.count();
+ for (int i = 0; i < max; i++) {
+ kDebug()<<"// CLIP KILL PROD "<<i;
+ Mlt::Producer *p = m_baseTrackProducers.takeAt(i);
+ if (p != NULL) {
+ delete p;
+ p = NULL;
+ }
+ m_baseTrackProducers.insert(i, NULL);
+ }*/
+
+ delete m_videoOnlyProducer;
+ m_videoOnlyProducer = NULL;
+
qDeleteAll(m_baseTrackProducers);
m_baseTrackProducers.clear();
- if (m_thumbProd) m_thumbProd->clearProducer();
qDeleteAll(m_audioTrackProducers);
m_audioTrackProducers.clear();
- delete m_videoOnlyProducer;
- m_videoOnlyProducer = NULL;
}
void DocClipBase::setProducer(Mlt::Producer *producer, bool reset)
if (producer == NULL) return;
if (reset) {
// Clear all previous producers
+ kDebug() << "/+++++++++++++++ DELETE ALL PRODS " << producer->get("id");
deleteProducers();
}
QString id = producer->get("id");
+ kDebug() << "// set prod: " << id;
if (id.contains('_')) {
// this is a subtrack producer, insert it at correct place
id = id.section('_', 1);
}
if (m_audioTrackProducers.at(pos) == NULL) m_audioTrackProducers[pos] = producer;
return;
- }
- if (id.endsWith("video")) {
+ } else if (id.endsWith("video")) {
m_videoOnlyProducer = producer;
return;
}
void refreshThumbUrl();
const char *producerProperty(const char *name) const;
void setProducerProperty(const char *name, const char *data);
+ void clearProducers();
void deleteProducers();
/** Set default play zone for clip monitor */
} else if (m_tool == TITLE_TEXT) {
m_selectedItem = addText(QString());
emit newText((QGraphicsTextItem *) m_selectedItem);
- m_selectedItem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ m_selectedItem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
((QGraphicsTextItem *)m_selectedItem)->setTextInteractionFlags(Qt::TextEditorInteraction);
m_selectedItem->setPos(e->scenePos());
QGraphicsScene::mousePressEvent(e);
// create new rect item
m_selectedItem = addRect(0, 0, e->scenePos().x() - m_sceneClickPoint.x(), e->scenePos().y() - m_sceneClickPoint.y());
emit newRect((QGraphicsRectItem *) m_selectedItem);
- m_selectedItem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemClipsToShape);
+ m_selectedItem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
m_selectedItem->setPos(m_sceneClickPoint);
m_resizeMode = BottomRight;
QGraphicsScene::mouseMoveEvent(e);
#include "guide.h"
#include "customtrackview.h"
-#include "customtrackscene.h"
#include "kdenlivesettings.h"
#include <KDebug>
#include <QPen>
#include <QBrush>
+#include <QStyleOptionGraphicsItem>
Guide::Guide(CustomTrackView *view, GenTime pos, QString label, double fps, double height) :
QGraphicsLineItem(),
m_position(pos),
m_label(label),
m_fps(fps),
- m_view(view)
+ m_view(view),
+ m_pen(QPen())
{
- setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemClipsToShape);
+ setFlags(QGraphicsItem::ItemIsMovable);
setToolTip(label);
setLine(0, 0, 0, height);
setPos(m_position.frames(m_fps), 0);
- setPen(QPen(QBrush(QColor(0, 0, 200, 180)), 2));
+ m_pen.setWidthF(0);
+ m_pen.setColor(QColor(0, 0, 200, 180));
+ //m_pen.setCosmetic(true);
+ setPen(m_pen);
setZValue(999);
setAcceptsHoverEvents(true);
const QFontMetrics metric = m_view->fontMetrics();
//virtual
void Guide::hoverEnterEvent(QGraphicsSceneHoverEvent *)
{
- setPen(QPen(QBrush(QColor(200, 0, 0, 180)), 2));
+ m_pen.setColor(QColor(200, 0, 0, 180));
+ setPen(m_pen);
}
//virtual
void Guide::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
{
- setPen(QPen(QBrush(QColor(0, 0, 200, 180)), 2));
+ m_pen.setColor(QColor(0, 0, 200, 180));
+ setPen(m_pen);
}
//virtual
// virtual
QRectF Guide::boundingRect() const
{
+ double scale = m_view->matrix().m11();
+ double width = m_pen.widthF() / scale * 2;
+ QRectF rect(line().x1() - width / 2 , line().y1(), width, line().y2() - line().y1());
if (KdenliveSettings::showmarkers()) {
- QRectF rect = QGraphicsLineItem::boundingRect();
- rect.setLeft(line().x1());
- rect.setWidth(m_width / static_cast <CustomTrackScene*>(scene())->scale().x());
- return rect;
- } else return QGraphicsLineItem::boundingRect();
+ rect.setWidth(width + m_width / scale);
+ }
+ return rect;
}
// virtual
QPainterPath Guide::shape() const
{
QPainterPath path;
- path.addRect(line().x1() - pen().widthF() / 2, line().y1(), pen().widthF(), line().y2() - line().y1());
+ if (!scene()) return path;
+ double scale = m_view->matrix().m11();
+ double width = m_pen.widthF() / scale * 2;
+ path.addRect(line().x1() - width / 2 , line().y1(), width, line().y2() - line().y1());
if (KdenliveSettings::showmarkers()) {
const QFontMetrics metric = m_view->fontMetrics();
- int height = metric.height();
- path.addRoundedRect(line().x1(), line().y1() + 10, m_width / static_cast <CustomTrackScene*>(scene())->scale().x(), height, 3, 3);
+ QRectF txtBounding(line().x1() + 1 / scale, line().y1() + 10, m_width / scale, metric.height() / m_view->matrix().m22());
+ path.addRect(txtBounding);
}
return path;
}
// virtual
-void Guide::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*w*/)
+void Guide::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget */*w*/)
{
- painter->setMatrixEnabled(false);
- QLineF guideline = painter->matrix().map(line());
- painter->setPen(pen());
- painter->drawLine(guideline);
- //painter->fillRect(painter->matrix().mapRect(boundingRect()), QColor(200, 100, 100, 100));
- //QGraphicsLineItem::paint(painter, option, w);
+ QGraphicsLineItem::paint(painter, option);
if (KdenliveSettings::showmarkers()) {
- QPointF p1 = guideline.p1() + QPointF(1, 0);
- QRectF txtBounding = painter->boundingRect(p1.x(), p1.y() + 10, m_width, 50, Qt::AlignLeft | Qt::AlignTop, ' ' + m_label + ' ');
+ painter->setMatrixEnabled(false);
+ QPointF p1 = painter->matrix().map(line()).p1() + QPointF(1, 0);
+ const QFontMetrics metric = m_view->fontMetrics();
+ QRectF txtBounding = painter->boundingRect(p1.x(), p1.y() + 10, m_width, metric.height(), Qt::AlignLeft | Qt::AlignTop, ' ' + m_label + ' ');
QPainterPath path;
path.addRoundedRect(txtBounding, 3, 3);
- painter->fillPath(path, QBrush(pen().color()));
+ painter->fillPath(path, QBrush(m_pen.color()));
painter->setPen(Qt::white);
painter->drawText(txtBounding, Qt::AlignCenter, m_label);
+ painter->setMatrixEnabled(true);
}
}
#define GUIDE_H
#include <QGraphicsLineItem>
+#include <QPen>
#include "gentime.h"
#include "definitions.h"
double m_fps;
CustomTrackView *m_view;
int m_width;
+ QPen m_pen;
};
#endif
#include <QWidget>
#include <QPainter>
#include <QAction>
+#include <QTimer>
HeaderTrack::HeaderTrack(int index, TrackInfo info, int height, QWidget *parent) :
QWidget(parent),
}
void HeaderTrack::slotDeleteTrack()
+{
+ QTimer::singleShot(500, this, SLOT(deleteTrack()));
+}
+
+void HeaderTrack::deleteTrack()
{
emit deleteTrack(m_index);
}
public:
HeaderTrack(int index, TrackInfo info, int height, QWidget *parent = 0);
- ~HeaderTrack();
+ virtual ~HeaderTrack();
void setLock(bool lock);
void adjustSize(int height);
void switchAudio();
void switchVideo();
void slotDeleteTrack();
+ void deleteTrack();
void slotAddTrack();
void slotChangeTrack();
void slotRenameTrack();
{
m_clipManager->updatePreviewSettings();
m_render->updatePreviewSettings();
+ QList <Mlt::Producer *> prods = m_render->producersList();
m_clipManager->resetProducersList(m_render->producersList());
-
+ qDeleteAll(prods);
+ prods.clear();
}
Render *KdenliveDoc::renderer()
return m_render;
}
-void KdenliveDoc::updateClip(const QString &id)
+void KdenliveDoc::updateClip(const QString id)
{
emit updateClipDisplay(id);
}
void deleteClip(const QString &clipId);
int getFramePos(QString duration);
DocClipBase *getBaseClip(const QString &clipId);
- void updateClip(const QString &id);
+ void updateClip(const QString id);
void deleteProjectClip(QList <QString> ids);
/** Inform application of the audio thumbnails generation progress */
void setThumbsProgress(const QString &message, int progress);
allExtensions.append(' ');
}
}
- QString dialogFilter = allExtensions + ' ' + QLatin1Char('|') + i18n("All Supported Files");
- dialogFilter.append("\n*" + QLatin1Char('|') + i18n("All Files"));
+ const QString dialogFilter = allExtensions.simplified() + ' ' + QLatin1Char('|') + i18n("All Supported Files") + "\n* " + QLatin1Char('|') + i18n("All Files");
list = KFileDialog::getOpenUrls(KUrl("kfiledialog:///clipfolder"), dialogFilter, this);
} else {
{
//delete m_osdTimer;
if (m_mltProducer) {
- Mlt::Service service(m_mltProducer->get_service());
+ Mlt::Service service(m_mltProducer->parent().get_service());
+ mlt_service_lock(service.get_service());
+
if (service.type() == tractor_type) {
Mlt::Tractor tractor(service);
- int trackNb = tractor.count();
+ Mlt::Field *field = tractor.field();
+ mlt_service nextservice = mlt_service_get_producer(service.get_service());
+ mlt_properties properties = MLT_SERVICE_PROPERTIES(nextservice);
+ QString mlt_type = mlt_properties_get(properties, "mlt_type");
+ QString resource = mlt_properties_get(properties, "mlt_service");
+ // Delete all transitions
+ while (mlt_type == "transition") {
+ mlt_field_disconnect_service(field->get_field(), nextservice);
+ nextservice = mlt_service_producer(nextservice);
+ if (nextservice == NULL) break;
+ properties = MLT_SERVICE_PROPERTIES(nextservice);
+ mlt_type = mlt_properties_get(properties, "mlt_type");
+ resource = mlt_properties_get(properties, "mlt_service");
+ }
+ int trackNb = tractor.count();
while (trackNb > 0) {
Mlt::Producer trackProducer(tractor.track(trackNb - 1));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
- trackPlaylist.clear();
+ if (trackPlaylist.type() == playlist_type) trackPlaylist.clear();
trackNb--;
}
}
+ mlt_service_unlock(service.get_service());
}
kDebug() << "// // // CLOSE RENDERER " << m_name;
delete m_blackClip;
m_blackClip = NULL;
- if (m_mltProfile) delete m_mltProfile;
+ //TODO: uncomment following line when everything is clean
+ //if (m_mltProfile) delete m_mltProfile;
m_mltProfile = new Mlt::Profile(tmp);
delete[] tmp;
if (m_winid == -1) return -1;
m_isBlocked = true;
int error;
- qDeleteAll(m_slowmotionProducers.values());
- m_slowmotionProducers.clear();
//kWarning() << "////// RENDER, SET SCENE LIST: " << playlist;
if (!m_mltConsumer->is_stopped()) {
m_mltConsumer->stop();
- //m_mltConsumer->set("refresh", 0);
}
+ m_mltConsumer->set("refresh", 0);
if (m_mltProducer) {
m_mltProducer->set_speed(0);
//if (KdenliveSettings::osdtimecode() && m_osdInfo) m_mltProducer->detach(*m_osdInfo);
- Mlt::Service service(m_mltProducer->get_service());
+ Mlt::Service service(m_mltProducer->parent().get_service());
+ mlt_service_lock(service.get_service());
+
if (service.type() == tractor_type) {
Mlt::Tractor tractor(service);
+ Mlt::Field *field = tractor.field();
+ mlt_service nextservice = mlt_service_get_producer(service.get_service());
+ mlt_properties properties = MLT_SERVICE_PROPERTIES(nextservice);
+ QString mlt_type = mlt_properties_get(properties, "mlt_type");
+ QString resource = mlt_properties_get(properties, "mlt_service");
+ // Delete all transitions
+ while (mlt_type == "transition") {
+ mlt_field_disconnect_service(field->get_field(), nextservice);
+ nextservice = mlt_service_producer(nextservice);
+ if (nextservice == NULL) break;
+ properties = MLT_SERVICE_PROPERTIES(nextservice);
+ mlt_type = mlt_properties_get(properties, "mlt_type");
+ resource = mlt_properties_get(properties, "mlt_service");
+ }
+
int trackNb = tractor.count();
while (trackNb > 0) {
Mlt::Producer trackProducer(tractor.track(trackNb - 1));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
- trackPlaylist.clear();
+ if (trackPlaylist.type() == playlist_type) trackPlaylist.clear();
trackNb--;
}
}
+ mlt_service_unlock(service.get_service());
+
+ qDeleteAll(m_slowmotionProducers.values());
+ m_slowmotionProducers.clear();
delete m_mltProducer;
m_mltProducer = NULL;
//kDebug()<<"//// Deleting at: "<< (int) position.frames(m_fps) <<" --------------------------------------";
m_isBlocked = true;
Mlt::Producer *clip = trackPlaylist.replace_with_blank(clipIndex);
- delete clip;
+ if (clip) delete clip;
trackPlaylist.consolidate_blanks(0);
/*if (QString(clip.parent().get("transparency")).toInt() == 1)
mltDeleteTransparency((int) position.frames(m_fps), track, QString(clip.parent().get("id")).toInt());*/
fileConsumer.start();
}
-QList <Mlt::Producer *> Render::producersList()
+const QList <Mlt::Producer *> Render::producersList()
{
QList <Mlt::Producer *> prods;
if (m_mltProducer == NULL) return prods;
//kDebug() << "/////////// RESULT SCENE: \n" << doc.toString();
setSceneList(doc.toString(), m_framePosition);
- if (m_mltProducer != NULL) {
- Mlt::Producer parentProd(m_mltProducer->parent());
- if (parentProd.get_producer() != NULL) {
- Mlt::Service service(parentProd.get_service());
- if (service.type() == tractor_type) {
- Mlt::Tractor tractor(service);
- mltCheckLength(&tractor);
+ /* if (m_mltProducer != NULL) {
+ Mlt::Producer parentProd(m_mltProducer->parent());
+ if (parentProd.get_producer() != NULL) {
+ Mlt::Service service(parentProd.get_service());
+ if (service.type() == tractor_type) {
+ Mlt::Tractor tractor(service);
+ mltCheckLength(&tractor);
+ }
}
- }
- }
+ }*/
}
in the ClipManager list and speed is the current speed */
int mltChangeClipSpeed(ItemInfo info, double speed, double oldspeed, int strobe, Mlt::Producer *prod);
- QList <Mlt::Producer *> producersList();
+ const QList <Mlt::Producer *> producersList();
void updatePreviewSettings();
void setDropFrames(bool show);
}
}
-QString Timecode::getTimecodeFromFrames(int frames) const
+const QString Timecode::getTimecodeFromFrames(int frames) const
{
return getTimecodeHH_MM_SS_FF(frames);
}
}
-QString Timecode::getTimecodeHH_MM_SS_FF(const GenTime & time) const
+const QString Timecode::getTimecodeHH_MM_SS_FF(const GenTime & time) const
{
if (m_dropFrame)
return getTimecodeDropFrame(time);
return getTimecodeHH_MM_SS_FF((int) time.frames(m_realFps));
}
-QString Timecode::getTimecodeHH_MM_SS_FF(int frames) const
+const QString Timecode::getTimecodeHH_MM_SS_FF(int frames) const
{
if (m_dropFrame) {
return getTimecodeDropFrame(frames);
int getFrameCount(const QString duration) const;
static QString getEasyTimecode(const GenTime & time, const double &fps);
static QString getStringTimecode(int frames, const double &fps);
- QString getTimecodeFromFrames(int frames) const;
+ const QString getTimecodeFromFrames(int frames) const;
int fps() const;
private:
int m_displayedFramesPerSecond;
double m_realFps;
- QString getTimecodeHH_MM_SS_FF(const GenTime & time) const;
- QString getTimecodeHH_MM_SS_FF(int frames) const;
+ const QString getTimecodeHH_MM_SS_FF(const GenTime & time) const;
+ const QString getTimecodeHH_MM_SS_FF(int frames) const;
QString getTimecodeHH_MM_SS_HH(const GenTime & time) const;
QString getTimecodeFrames(const GenTime & time) const;
QPixmap bg(m_frameWidth / 2, m_frameHeight / 2);
QPixmap pattern(20, 20);
pattern.fill();
+ QColor bgcolor(210, 210, 210);
QPainter p;
p.begin(&pattern);
- p.fillRect(QRect(0, 0, 10, 10), QColor(210, 210, 210));
- p.fillRect(QRect(10, 10, 20, 20), QColor(210, 210, 210));
+ p.fillRect(QRect(0, 0, 10, 10), bgcolor);
+ p.fillRect(QRect(10, 10, 20, 20), bgcolor);
p.end();
QBrush br(pattern);
--- /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 *
+ ***************************************************************************/
+
+
+#include "trackdialog.h"
+#include "kdenlivedoc.h"
+#include "kdenlivesettings.h"
+
+#include <KDebug>
+
+
+TrackDialog::TrackDialog(KdenliveDoc *doc, QWidget * parent) :
+ QDialog(parent),
+ m_doc(doc)
+{
+ //setFont(KGlobalSettings::toolBarFont());
+ view.setupUi(this);
+ connect(view.track_nb, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateName(int)));
+}
+
+TrackDialog::~TrackDialog()
+{
+}
+
+void TrackDialog::slotUpdateName(int ix)
+{
+ ix = m_doc->tracksCount() - ix;
+ view.track_name->setText(m_doc->trackInfoAt(ix - 1).trackName);
+}
+
+
+#include "trackdialog.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 TRACKDIALOG_H
+#define TRACKDIALOG_H
+
+
+#include "ui_addtrack_ui.h"
+
+class KdenliveDoc;
+
+class TrackDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ TrackDialog(KdenliveDoc *doc, QWidget * parent = 0);
+ ~TrackDialog();
+ Ui::AddTrack_UI view;
+
+public slots:
+
+ void slotUpdateName(int);
+
+private:
+ KdenliveDoc *m_doc;
+};
+
+
+#endif
+
m_view.ruler_frame->setLayout(layout);
layout->addWidget(m_ruler);
-
QHBoxLayout *sizeLayout = new QHBoxLayout;
sizeLayout->setContentsMargins(0, 0, 0, 0);
sizeLayout->setSpacing(0);
QString style1 = "QToolButton {border-style: none;margin: 0px 3px;padding: 0px;} QToolButton:pressed:hover { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;} QToolButton:hover { background-color: rgba(255, 255, 255, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}";
+
QToolButton *butSmall = new QToolButton(this);
butSmall->setIcon(KIcon("kdenlive-zoom-small"));
butSmall->setToolTip(i18n("Smaller tracks"));
sizeLayout->addWidget(butLarge);
m_view.size_frame->setStyleSheet(style1);
-
QHBoxLayout *tracksLayout = new QHBoxLayout;
tracksLayout->setContentsMargins(0, 0, 0, 0);
tracksLayout->setSpacing(0);
m_headersLayout->setContentsMargins(0, m_trackview->frameWidth(), 0, 0);
m_headersLayout->setSpacing(0);
m_view.headers_container->setLayout(m_headersLayout);
-
connect(m_view.headers_area->verticalScrollBar(), SIGNAL(valueChanged(int)), m_trackview->verticalScrollBar(), SLOT(setValue(int)));
tracksLayout->addWidget(m_trackview);
-
connect(m_trackview->verticalScrollBar(), SIGNAL(valueChanged(int)), m_view.headers_area->verticalScrollBar(), SLOT(setValue(int)));
connect(m_trackview, SIGNAL(trackHeightChanged()), this, SLOT(slotRebuildTrackHeaders()));
void TrackView::slotRebuildTrackHeaders()
{
- QList <TrackInfo> list = m_doc->tracksList();
+ kDebug() << "--------- - - - -REBUILD TLK HEAD";
+ const QList <TrackInfo> list = m_doc->tracksList();
QLayoutItem *child;
+ m_view.headers_container->hide();
while ((child = m_headersLayout->takeAt(0)) != 0) {
if (child->widget()) delete child->widget();
delete child;
}
int max = list.count();
int height = KdenliveSettings::trackheight() * m_scene->scale().y();
+
for (int i = 0; i < max; i++) {
HeaderTrack *header = new HeaderTrack(i, list.at(max - i - 1), height, this);
connect(header, SIGNAL(switchTrackVideo(int)), m_trackview, SLOT(slotSwitchTrackVideo(int)));
connect(header, SIGNAL(renameTrack(int)), this, SLOT(slotRenameTrack(int)));
m_headersLayout->addWidget(header);
}
+ m_view.headers_container->show();
}
info.trackName = newName;
m_doc->setTrackType(tracknumber - 1, info);
QTimer::singleShot(300, this, SLOT(slotRebuildTrackHeaders()));
+ m_doc->setModified(true);
}
}
return false; //m_parameters.attribute("reverse").toInt();
}
-QPixmap Transition::transitionPixmap() const
-{
- KIcon icon;
- QString tag = transitionTag();
- if (tag == "luma") {
- if (invertedTransition()) icon = KIcon("kdenlive_trans_up");
- else icon = KIcon("kdenlive_trans_down");
- } else if (tag == "composite") {
- icon = KIcon("kdenlive_trans_wiper");
- } else if (tag == "lumafile") {
- icon = KIcon("kdenlive_trans_luma");
- } else icon = KIcon("kdenlive_trans_pip");
- return icon.pixmap(QSize(15, 15));
-}
-
-
void Transition::setTransitionDirection(bool /*inv*/)
{
//m_parameters.setAttribute("reverse", inv);
const double scale = option->matrix.m11();
QRectF exposed = option->exposedRect;
painter->setClipRect(exposed);
- QRectF br = rect();
- QRectF mapped = painter->matrix().mapRect(br);
+ const QRectF br = rect();
+ const QRectF mapped = painter->matrix().mapRect(br);
painter->fillRect(exposed, brush());
QPointF p1(br.x(), br.y() + br.height() / 2 - 7);
painter->setMatrixEnabled(false);
//painter->drawPixmap(painter->matrix().map(p1) + QPointF(5, 0), transitionPixmap());
- QString text = transitionName();
- if (m_forceTransitionTrack) text.append("|>");
- QRectF txtBounding = painter->boundingRect(mapped, Qt::AlignHCenter | Qt::AlignVCenter, ' ' + text + ' ');
- painter->fillRect(txtBounding, QBrush(QColor(50, 50, 0, 150)));
- txtBounding.translate(QPointF(1, 1));
- painter->setPen(QColor(255, 255, 255, 255));
+ const QString text = m_name + (m_forceTransitionTrack ? "|>" : QString());
+ const QRectF txtBounding = painter->boundingRect(mapped, Qt::AlignHCenter | Qt::AlignVCenter, ' ' + text + ' ');
+
+ QColor frameColor(Qt::black);
+ if (isSelected() || (parentItem() && parentItem()->isSelected())) {
+ frameColor = QColor(Qt::red);
+ }
+ frameColor.setAlpha(150);
+ painter->fillRect(txtBounding, frameColor);
+
+ painter->setPen(Qt::white);
painter->drawText(txtBounding, Qt::AlignCenter, text);
/* painter->setPen(QColor(0, 0, 0, 180));
//pen.setWidth(1);
}
- pen.setWidthF(1.0);
- pen.setCosmetic(true);
+ //pen.setCosmetic(true);
painter->setPen(pen);
painter->setClipping(false);
painter->drawRect(br.adjusted(0, 0, -1 / scale, 0));
m_parameters.setAttribute("clipb_starttime", m_secondClip->startPos().frames(m_referenceClip->fps()));
m_parameters.setAttribute("clipb_track", transitionEndTrack());
}
- return m_parameters;
+ return m_parameters.cloneNode().toElement();
}
bool Transition::hasGeometry()
void setTransitionParameters(const QDomElement params);
void setTransitionDirection(bool inv);
void setTransitionTrack(int track);
- QPixmap transitionPixmap() const;
//Transition *reparent(ClipItem * clip);
bool isValid() const;
/** Transition should be linked to another track */
painter->setPen(option.palette.color(QPalette::HighlightedText));
QColor backgroundColor = option.palette.color(QPalette::Highlight);
painter->setBrush(QBrush(backgroundColor));
- painter->fillRect(r1, QBrush(backgroundColor));
+ painter->fillRect(r1, backgroundColor);
}
QFont font = painter->font();
font.setBold(true);