* @param name A unique identifier for this renderer
* @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering
* @param profile The MLT profile used for the renderer (default one will be used if empty). */
- explicit AbstractRender(Kdenlive::MONITORID name, QWidget *parent = 0):QObject(parent), sendFrameForAnalysis(false), analyseAudio(false), m_name(name) {}
+ explicit AbstractRender(Kdenlive::MONITORID name, QWidget *parent = 0)
+ : QObject(parent),
+ sendFrameForAnalysis(false),
+ analyseAudio(false),
+ m_name(name)
+ {
+ }
/** @brief Destroy the MLT Renderer. */
virtual ~AbstractRender() {}
signals:
/** @brief The renderer refreshed the current frame. */
- void frameUpdated(QImage);
+ void frameUpdated(const QImage &);
/** @brief This signal contains the audio of the current frame. */
- void audioSamplesSignal(QVector<int16_t>,int,int,int);
+ void audioSamplesSignal(const QVector<int16_t>&,int,int,int);
};
static int FRAME_SIZE;
ClipItem::ClipItem(DocClipBase *clip, const ItemInfo& info, double fps, double speed, int strobe, int frame_width, bool generateThumbs) :
- AbstractClipItem(info, QRectF(), fps),
- m_clip(clip),
- m_startFade(0),
- m_endFade(0),
- m_audioOnly(false),
- m_videoOnly(false),
- m_startPix(QPixmap()),
- m_endPix(QPixmap()),
- m_hasThumbs(false),
- m_selectedEffect(-1),
- m_timeLine(0),
- m_startThumbRequested(false),
- m_endThumbRequested(false),
- //m_hover(false),
- m_speed(speed),
- m_strobe(strobe),
- m_framePixelWidth(0),
- m_limitedKeyFrames(false)
+ AbstractClipItem(info, QRectF(), fps),
+ m_clip(clip),
+ m_startFade(0),
+ m_endFade(0),
+ m_audioOnly(false),
+ m_videoOnly(false),
+ m_startPix(QPixmap()),
+ m_endPix(QPixmap()),
+ m_hasThumbs(false),
+ m_selectedEffect(-1),
+ m_timeLine(0),
+ m_startThumbRequested(false),
+ m_endThumbRequested(false),
+ //m_hover(false),
+ m_speed(speed),
+ m_strobe(strobe),
+ m_framePixelWidth(0),
+ m_limitedKeyFrames(false)
{
setZValue(2);
m_effectList = EffectsList(true);
m_effectNames = m_effectList.effectNames().join(" / ");
if (!m_effectList.isEmpty()) {
for (int i = 0; i < m_effectList.count(); ++i) {
- QDomElement effect = m_effectList.at(i);
+ QDomElement effect = m_effectList.at(i);
QString effectId = effect.attribute("id");
// check if it is a fade effect
QDomNodeList params = effect.elementsByTagName("parameter");
}
if (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") {
- if (e.attribute("keyframes").isEmpty()) {
- // Effect has a keyframe type parameter, we need to set the values
- e.setAttribute("keyframes", QString::number((int) cropStart().frames(m_fps)) + ':' + e.attribute("default"));
- }
- else if (offset != 0) {
- // adjust keyframes to this clip
- QString adjusted = adjustKeyframes(e.attribute("keyframes"), offset - cropStart().frames(m_fps));
- e.setAttribute("keyframes", adjusted);
- }
+ if (e.attribute("keyframes").isEmpty()) {
+ // Effect has a keyframe type parameter, we need to set the values
+ e.setAttribute("keyframes", QString::number((int) cropStart().frames(m_fps)) + ':' + e.attribute("default"));
+ }
+ else if (offset != 0) {
+ // adjust keyframes to this clip
+ QString adjusted = adjustKeyframes(e.attribute("keyframes"), offset - cropStart().frames(m_fps));
+ e.setAttribute("keyframes", adjusted);
+ }
}
if (e.attribute("type") == "geometry" && !e.hasAttribute("fixed")) {
// Effects with a geometry parameter need to sync in / out with parent clip
- effect.setAttribute("in", QString::number((int) cropStart().frames(m_fps)));
- effect.setAttribute("out", QString::number((int) (cropStart() + cropDuration()).frames(m_fps) - 1));
- effect.setAttribute("_sync_in_out", "1");
- }
+ effect.setAttribute("in", QString::number((int) cropStart().frames(m_fps)));
+ effect.setAttribute("out", QString::number((int) (cropStart() + cropDuration()).frames(m_fps) - 1));
+ effect.setAttribute("_sync_in_out", "1");
+ }
}
if (effect.attribute("tag") == "volume" || effect.attribute("tag") == "brightness") {
if (effect.attribute("id") == "fadeout" || effect.attribute("id") == "fade_to_black") {
if (effect.attribute("id") == "fadein") {
if (m_effectList.hasEffect(QString(), "fade_from_black") == -1) {
int effectDuration = EffectsList::parameter(effect, "out").toInt();
- if (offset != 0) effectDuration -= offset;
+ if (offset != 0) effectDuration -= offset;
if (effectDuration > cropDuration().frames(m_fps)) {
effectDuration = cropDuration().frames(m_fps) / 2;
}
} else if (effect.attribute("id") == "fade_from_black") {
if (m_effectList.hasEffect(QString(), "fadein") == -1) {
int effectDuration = EffectsList::parameter(effect, "out").toInt();
- if (offset != 0) effectDuration -= offset;
+ if (offset != 0) effectDuration -= offset;
if (effectDuration > cropDuration().frames(m_fps)) {
effectDuration = cropDuration().frames(m_fps) / 2;
}
QLocale locale;
// go through all effects this clip has
for (int ix = 0; ix < m_effectList.count(); ++ix) {
- // Check geometry params
- resizeGeometries(ix, width, height, previousDuration, cutPos == -1 ? 0 : cutPos, cropDuration().frames(m_fps) - 1);
+ // Check geometry params
+ resizeGeometries(ix, width, height, previousDuration, cutPos == -1 ? 0 : cutPos, cropDuration().frames(m_fps) - 1);
- // Check keyframe params
+ // Check keyframe params
QStringList keyframeParams = keyframes(ix);
QStringList newKeyFrameParams;
bool effModified = false;
QDomElement e = params.item(i).toElement();
if (!e.isNull() && e.attribute("type") == "geometry") {
geom = e.attribute("value");
- Mlt::Geometry geometry(geom.toUtf8().data(), previousDuration, width, height);
- e.setAttribute("value", geometry.serialise(start, start + duration));
- }
+ Mlt::Geometry geometry(geom.toUtf8().data(), previousDuration, width, height);
+ e.setAttribute("value", geometry.serialise(start, start + duration));
+ }
}
}
QColor textBgColor;
QPen framePen;
if (isSelected() || (parentItem() && parentItem()->isSelected())) {
- textColor = palette.highlightedText().color();
- textBgColor = palette.highlight().color();
+ textColor = palette.highlightedText().color();
+ textBgColor = palette.highlight().color();
framePen.setColor(textBgColor);
- paintColor.setRed(qMin(paintColor.red() * 2, 255));
+ paintColor.setRed(qMin(paintColor.red() * 2, 255));
}
else {
- textColor = palette.text().color();
- textBgColor = palette.window().color();
- textBgColor.setAlpha(200);
+ textColor = palette.text().color();
+ textBgColor = palette.window().color();
+ textBgColor.setAlpha(200);
framePen.setColor(m_paintColor.darker());
}
const QRectF exposed = option->exposedRect;
painter->setPen(m_paintColor.darker());
// draw thumbnails
if (KdenliveSettings::videothumbnails() && !isAudioOnly()) {
- QRectF thumbRect;
+ QRectF thumbRect;
if ((m_clipType == IMAGE || m_clipType == TEXT) && !m_startPix.isNull()) {
- if (thumbRect.isNull()) thumbRect = QRectF(0, 0, mapped.height() / m_startPix.height() * m_startPix.width(), mapped.height());
- thumbRect.moveTopRight(mapped.topRight());
- painter->drawPixmap(thumbRect, m_startPix, m_startPix.rect());
- //const QPointF top = mapped.topRight() - QPointF(m_startPix.width() - 1, 0);
+ if (thumbRect.isNull()) thumbRect = QRectF(0, 0, mapped.height() / m_startPix.height() * m_startPix.width(), mapped.height());
+ thumbRect.moveTopRight(mapped.topRight());
+ painter->drawPixmap(thumbRect, m_startPix, m_startPix.rect());
+ //const QPointF top = mapped.topRight() - QPointF(m_startPix.width() - 1, 0);
//painter->drawPixmap(top, m_startPix);
//QLineF l2(top.x(), mapped.top(), top.x(), mapped.bottom());
//painter->drawLine(l2);
} else if (!m_endPix.isNull()) {
- if (thumbRect.isNull()) thumbRect = QRectF(0, 0, mapped.height() / m_endPix.height() * m_endPix.width(), mapped.height());
- thumbRect.moveTopRight(mapped.topRight());
- painter->drawPixmap(thumbRect, m_endPix, m_endPix.rect());
- //const QPointF top = mapped.topRight() - QPointF(m_endPix.width() - 1, 0);
+ if (thumbRect.isNull()) thumbRect = QRectF(0, 0, mapped.height() / m_endPix.height() * m_endPix.width(), mapped.height());
+ thumbRect.moveTopRight(mapped.topRight());
+ painter->drawPixmap(thumbRect, m_endPix, m_endPix.rect());
+ //const QPointF top = mapped.topRight() - QPointF(m_endPix.width() - 1, 0);
//painter->drawPixmap(top, m_endPix);
//QLineF l2(top.x(), mapped.top(), top.x(), mapped.bottom());
//painter->drawLine(l2);
}
if (!m_startPix.isNull()) {
- if (thumbRect.isNull()) thumbRect = QRectF(0, 0, mapped.height() / m_startPix.height() * m_startPix.width(), mapped.height());
- thumbRect.moveTopLeft(mapped.topLeft());
- painter->drawPixmap(thumbRect, m_startPix, m_startPix.rect());
+ if (thumbRect.isNull()) thumbRect = QRectF(0, 0, mapped.height() / m_startPix.height() * m_startPix.width(), mapped.height());
+ thumbRect.moveTopLeft(mapped.topLeft());
+ painter->drawPixmap(thumbRect, m_startPix, m_startPix.rect());
//painter->drawPixmap(mapped.topLeft(), m_startPix);
//QLineF l2(mapped.left() + m_startPix.width(), mapped.top(), mapped.left() + m_startPix.width(), mapped.bottom());
//painter->drawLine(l2);
QPointF xpos = startPos + QPointF(FRAME_SIZE *(i - startOffset), 0);
if (img.isNull()) missing << i;
else {
- painter->drawImage(xpos, img);
- }
+ painter->drawImage(xpos, img);
+ }
painter->drawLine(xpos, xpos + QPointF(0, mapped.height()));
}
if (!missing.isEmpty()) {
if (channels >= 1) {
emit prepareAudioThumb(scale, mappedStartPixel, mappedEndPixel, channels, (int) (mappedRect.height() + 0.5));
}
- QRectF pixmapRect(0, mappedRect.y(), 100, mappedRect.height());
+ QRectF pixmapRect(0, mappedRect.y(), 100, mappedRect.height());
for (int startCache = mappedStartPixel - (mappedStartPixel) % 100; startCache < mappedEndPixel; startCache += 100) {
if (!m_audioThumbCachePic.value(startCache).isNull()) {
//painter->drawPixmap(clipStart + startCache - cropLeft, mappedRect.y(), m_audioThumbCachePic.value(startCache));
- QPixmap pix(m_audioThumbCachePic.value(startCache));
- pixmapRect.moveLeft(clipStart + startCache - cropLeft);
- painter->drawPixmap(pixmapRect, pix, pix.rect());
- }
+ QPixmap pix(m_audioThumbCachePic.value(startCache));
+ pixmapRect.moveLeft(clipStart + startCache - cropLeft);
+ painter->drawPixmap(pixmapRect, pix, pix.rect());
+ }
}
}
if (!m_effectNames.isEmpty() && mapped.width() > 40) {
QRectF txtBounding = painter->boundingRect(mapped, Qt::AlignLeft | Qt::AlignTop, m_effectNames);
QColor bColor = palette.window().color();
- QColor tColor = palette.text().color();
- tColor.setAlpha(220);
+ QColor tColor = palette.text().color();
+ tColor.setAlpha(220);
if (m_timeLine && m_timeLine->state() == QTimeLine::Running) {
qreal value = m_timeLine->currentValue();
txtBounding.setWidth(txtBounding.width() * value);
bColor.setAlpha(100 + 50 * value);
};
- painter->setBrush(bColor);
- painter->setPen(Qt::NoPen);
- painter->drawRoundedRect(txtBounding.adjusted(-1, -2, 4, -1), 3, 3);
+ painter->setBrush(bColor);
+ painter->setPen(Qt::NoPen);
+ painter->drawRoundedRect(txtBounding.adjusted(-1, -2, 4, -1), 3, 3);
painter->setPen(tColor);
painter->drawText(txtBounding.adjusted(2, 0, 1, -1), Qt::AlignCenter, m_effectNames);
}
// Draw clip name
const QRectF txtBounding2 = painter->boundingRect(mapped, Qt::AlignRight | Qt::AlignTop, m_clipName + ' ').adjusted(0, -1, 0, -1);
- painter->setPen(Qt::NoPen);
+ painter->setPen(Qt::NoPen);
painter->fillRect(txtBounding2.adjusted(-3, 0, 0, 0), textBgColor);
painter->setBrush(QBrush(Qt::NoBrush));
- painter->setPen(textColor);
+ painter->setPen(textColor);
if (m_videoOnly) {
painter->drawPixmap(txtBounding2.topLeft() - QPointF(17, -1), m_videoPix);
} else if (m_audioOnly) {
QList < CommentedTime >::Iterator it = markers.begin();
GenTime pos;
double framepos;
- QBrush markerBrush(QColor(120, 120, 0, 140));
+ QBrush markerBrush(QColor(120, 120, 0, 140));
QPen pen = painter->pen();
for (; it != markers.end(); ++it) {
if (pos > cropDuration()) break;
QLineF l(rect().x() + pos.frames(m_fps), rect().y(), rect().x() + pos.frames(m_fps), rect().bottom());
QLineF l2 = transformation.map(l);
- pen.setColor(CommentedTime::markerColor((*it).markerType()));
- pen.setStyle(Qt::DotLine);
+ pen.setColor(CommentedTime::markerColor((*it).markerType()));
+ pen.setStyle(Qt::DotLine);
painter->setPen(pen);
painter->drawLine(l2);
if (KdenliveSettings::showmarkers()) {
const QRectF r2 = transformation.mapRect(r1);
const QRectF txtBounding3 = painter->boundingRect(r2, Qt::AlignLeft | Qt::AlignTop, ' ' + (*it).comment() + ' ');
painter->setBrush(markerBrush);
- pen.setStyle(Qt::SolidLine);
+ pen.setStyle(Qt::SolidLine);
painter->setPen(pen);
painter->drawRect(txtBounding3);
painter->setBrush(Qt::NoBrush);
if (qAbs((int)(pos.x() - (rect.x() + m_startFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) {
return FADEIN;
} else if ((pos.x() <= rect.x() + rect.width() / 2) && pos.x() - rect.x() < maximumOffset && (rect.bottom() - pos.y() > addtransitionOffset)) {
- // If we are in a group, allow resize only if all clips start at same position
- if (parentItem()) {
- QGraphicsItemGroup *dragGroup = static_cast <QGraphicsItemGroup *>(parentItem());
- QList<QGraphicsItem *> list = dragGroup->childItems();
- for (int i = 0; i < list.count(); ++i) {
- if (list.at(i)->type() == AVWIDGET) {
- ClipItem *c = static_cast <ClipItem*>(list.at(i));
- if (c->startPos() != startPos()) return MOVE;
- }
- }
- }
+ // If we are in a group, allow resize only if all clips start at same position
+ if (parentItem()) {
+ QGraphicsItemGroup *dragGroup = static_cast <QGraphicsItemGroup *>(parentItem());
+ QList<QGraphicsItem *> list = dragGroup->childItems();
+ for (int i = 0; i < list.count(); ++i) {
+ if (list.at(i)->type() == AVWIDGET) {
+ ClipItem *c = static_cast <ClipItem*>(list.at(i));
+ if (c->startPos() != startPos()) return MOVE;
+ }
+ }
+ }
return RESIZESTART;
} else if (qAbs((int)(pos.x() - (rect.x() + rect.width() - m_endFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) {
return FADEOUT;
} else if ((pos.x() >= rect.x() + rect.width() / 2) && (rect.right() - pos.x() < maximumOffset) && (rect.bottom() - pos.y() > addtransitionOffset)) {
- // If we are in a group, allow resize only if all clips end at same position
- if (parentItem()) {
- QGraphicsItemGroup *dragGroup = static_cast <QGraphicsItemGroup *>(parentItem());
- QList<QGraphicsItem *> list = dragGroup->childItems();
- for (int i = 0; i < list.count(); ++i) {
- if (list.at(i)->type() == AVWIDGET) {
- ClipItem *c = static_cast <ClipItem*>(list.at(i));
- if (c->endPos() != endPos()) return MOVE;
- }
- }
- }
+ // If we are in a group, allow resize only if all clips end at same position
+ if (parentItem()) {
+ QGraphicsItemGroup *dragGroup = static_cast <QGraphicsItemGroup *>(parentItem());
+ QList<QGraphicsItem *> list = dragGroup->childItems();
+ for (int i = 0; i < list.count(); ++i) {
+ if (list.at(i)->type() == AVWIDGET) {
+ ClipItem *c = static_cast <ClipItem*>(list.at(i));
+ if (c->endPos() != endPos()) return MOVE;
+ }
+ }
+ }
return RESIZEEND;
} else if ((pos.x() - rect.x() < 16 / scale) && (rect.bottom() - pos.y() <= addtransitionOffset)) {
return TRANSITIONSTART;
{
// Bail out, if caller provided invalid data
if (channels <= 0) {
- kWarning() << "Unable to draw image with " << channels << "number of channels";
+ kWarning() << "Unable to draw image with " << channels << "number of channels";
return;
}
int factor = 64;
if (KdenliveSettings::normaliseaudiothumbs()) {
- factor = m_clip->getProperty("audio_max").toInt();
+ factor = m_clip->getProperty("audio_max").toInt();
}
//kDebug() << "// PREP AUDIO THMB FRMO : scale:" << pixelForOneFrame<< ", from: " << startpixel << ", to: " << endpixel;
if (m_framePixelWidth == pixelForOneFrame && m_audioThumbCachePic.contains(startCache))
continue;
if (m_audioThumbCachePic.value(startCache).isNull() || m_framePixelWidth != pixelForOneFrame) {
- QPixmap pix(100, pixelHeight);
- pix.fill(QColor(180, 180, 180, 150));
- m_audioThumbCachePic[startCache] = pix;
+ QPixmap pix(100, pixelHeight);
+ pix.fill(QColor(180, 180, 180, 150));
+ m_audioThumbCachePic[startCache] = pix;
}
positiveChannelPaths.clear();
negativeChannelPaths.clear();
QPainter pixpainter(&m_audioThumbCachePic[startCache]);
- for (int i = 0; i < channels; ++i) {
- if (simplifiedAudio) {
- positiveChannelPaths[i].moveTo(-1, channelHeight);
- }
- else if (fullAreaDraw) {
- positiveChannelPaths[i].moveTo(-1, channelHeight*i + channelHeight / 2);
- negativeChannelPaths[i].moveTo(-1, channelHeight*i + channelHeight / 2);
- }
- else {
- positiveChannelPaths[i].moveTo(-1, channelHeight*i + channelHeight / 2);
- audiopen.setColor(QColor(60, 60, 60, 50));
- pixpainter.setPen(audiopen);
- pixpainter.drawLine(0, channelHeight*i + channelHeight / 2, 100, channelHeight*i + channelHeight / 2);
- }
- }
+ for (int i = 0; i < channels; ++i) {
+ if (simplifiedAudio) {
+ positiveChannelPaths[i].moveTo(-1, channelHeight);
+ }
+ else if (fullAreaDraw) {
+ positiveChannelPaths[i].moveTo(-1, channelHeight*i + channelHeight / 2);
+ negativeChannelPaths[i].moveTo(-1, channelHeight*i + channelHeight / 2);
+ }
+ else {
+ positiveChannelPaths[i].moveTo(-1, channelHeight*i + channelHeight / 2);
+ audiopen.setColor(QColor(60, 60, 60, 50));
+ pixpainter.setPen(audiopen);
+ pixpainter.drawLine(0, channelHeight*i + channelHeight / 2, 100, channelHeight*i + channelHeight / 2);
+ }
+ }
for (int samples = 0; samples <= 100; samples++) {
double frame = (double)(samples + startCache - 0) / pixelForOneFrame;
const QMap<int, QByteArray> frame_channel_data = baseClip()->audioFrameCache.value((int)frame);
for (int channel = 0; channel < channels && !frame_channel_data.value(channel).isEmpty(); channel++) {
- int y = channelHeight * channel + channelHeight / 2;
- if (simplifiedAudio) {
- double delta = qAbs((frame_channel_data.value(channel).at(sample) - 63.5) * channelHeight / factor);
- positiveChannelPaths[channel].lineTo(samples, channelHeight - delta);
- } else if (fullAreaDraw) {
- double delta = qAbs((frame_channel_data.value(channel).at(sample) - 63.5) * channelHeight / (2 * factor));
+ int y = channelHeight * channel + channelHeight / 2;
+ if (simplifiedAudio) {
+ double delta = qAbs((frame_channel_data.value(channel).at(sample) - 63.5) * channelHeight / factor);
+ positiveChannelPaths[channel].lineTo(samples, channelHeight - delta);
+ } else if (fullAreaDraw) {
+ double delta = qAbs((frame_channel_data.value(channel).at(sample) - 63.5) * channelHeight / (2 * factor));
positiveChannelPaths[channel].lineTo(samples, y + delta);
negativeChannelPaths[channel].lineTo(samples, y - delta);
} else {
- double delta = (frame_channel_data.value(channel).at(sample) - 63.5) * channelHeight / (2 * factor);
- positiveChannelPaths[channel].lineTo(samples, y + delta);
+ double delta = (frame_channel_data.value(channel).at(sample) - 63.5) * channelHeight / (2 * factor);
+ positiveChannelPaths[channel].lineTo(samples, y + delta);
}
}
}
for (int channel = 0; channel < channels; channel++) {
- if (simplifiedAudio) {
- positiveChannelPaths[channel].lineTo(101, channelHeight);
- } else if (fullAreaDraw) {
- int y = channelHeight * channel + channelHeight / 2;
- positiveChannelPaths[channel].lineTo(101, y);
- negativeChannelPaths[channel].lineTo(101, y);
- }
- }
+ if (simplifiedAudio) {
+ positiveChannelPaths[channel].lineTo(101, channelHeight);
+ } else if (fullAreaDraw) {
+ int y = channelHeight * channel + channelHeight / 2;
+ positiveChannelPaths[channel].lineTo(101, y);
+ negativeChannelPaths[channel].lineTo(101, y);
+ }
+ }
if (fullAreaDraw || simplifiedAudio) {
- audiopen.setColor(QColor(80, 80, 80, 200));
- pixpainter.setPen(audiopen);
- pixpainter.setBrush(QBrush(QColor(120, 120, 120, 200)));
- }
- else {
- audiopen.setColor(QColor(60, 60, 60, 100));
- pixpainter.setPen(audiopen);
- pixpainter.setBrush(Qt::NoBrush);
- }
- pixpainter.setRenderHint(QPainter::Antialiasing, false);
+ audiopen.setColor(QColor(80, 80, 80, 200));
+ pixpainter.setPen(audiopen);
+ pixpainter.setBrush(QBrush(QColor(120, 120, 120, 200)));
+ }
+ else {
+ audiopen.setColor(QColor(60, 60, 60, 100));
+ pixpainter.setPen(audiopen);
+ pixpainter.setBrush(Qt::NoBrush);
+ }
+ pixpainter.setRenderHint(QPainter::Antialiasing, false);
for (int i = 0; i < channels; ++i) {
if (fullAreaDraw) {
pixpainter.drawPath(positiveChannelPaths[i].united(negativeChannelPaths.value(i)));
{
if (change == QGraphicsItem::ItemSelectedChange) {
if (value.toBool())
- setZValue(10);
+ setZValue(10);
else
- setZValue(2);
+ setZValue(2);
}
if (change == ItemPositionChange && scene()) {
// calculate new position.
int xpos = projectScene()->getSnapPointForPos((int) newPos.x(), KdenliveSettings::snaptopoints());
xpos = qMax(xpos, 0);
newPos.setX(xpos);
- // Warning: newPos gives a position relative to the click event, so hack to get absolute pos
- int yOffset = property("y_absolute").toInt() + newPos.y();
+ // Warning: newPos gives a position relative to the click event, so hack to get absolute pos
+ int yOffset = property("y_absolute").toInt() + newPos.y();
int newTrack = yOffset / KdenliveSettings::trackheight();
newTrack = qMin(newTrack, projectScene()->tracksCount() - 1);
newTrack = qMax(newTrack, 0);
- QStringList lockedTracks = property("locked_tracks").toStringList();
- if (lockedTracks.contains(QString::number(newTrack))) {
- // Trying to move to a locked track
- return pos();
- }
+ QStringList lockedTracks = property("locked_tracks").toStringList();
+ if (lockedTracks.contains(QString::number(newTrack))) {
+ // Trying to move to a locked track
+ return pos();
+ }
newPos.setY((int)(newTrack * KdenliveSettings::trackheight() + 1));
// Only one clip is moving
QRectF sceneShape = rect();
return newPos;
}
if (change == ItemParentChange) {
- QGraphicsItem* parent = value.value<QGraphicsItem*>();
- if (parent) m_paintColor = m_baseColor.lighter(135);
- else m_paintColor = m_baseColor;
+ QGraphicsItem* parent = value.value<QGraphicsItem*>();
+ if (parent) m_paintColor = m_baseColor.lighter(135);
+ else m_paintColor = m_baseColor;
}
return QGraphicsItem::itemChange(change, value);
}
int ix;
QDomElement insertedEffect;
if (!effect.hasAttribute("kdenlive_ix")) {
- // effect dropped from effect list
+ // effect dropped from effect list
ix = effectsCounter();
} else ix = effect.attribute("kdenlive_ix").toInt();
if (!m_effectList.isEmpty() && ix <= m_effectList.count()) {
int effectOut;
if (effect.attribute("tag") == "affine") {
- // special case: the affine effect needs in / out points
- effectIn = effect.attribute("in").toInt();
- effectOut = effect.attribute("out").toInt();
+ // special case: the affine effect needs in / out points
+ effectIn = effect.attribute("in").toInt();
+ effectOut = effect.attribute("out").toInt();
}
else {
- effectIn = EffectsList::parameter(effect, "in").toInt();
- effectOut = EffectsList::parameter(effect, "out").toInt();
+ effectIn = EffectsList::parameter(effect, "in").toInt();
+ effectOut = EffectsList::parameter(effect, "out").toInt();
}
EffectsParameterList parameters;
// check if it is a fade effect
if (effectId == "fadein") {
- needRepaint = true;
+ needRepaint = true;
if (m_effectList.hasEffect(QString(), "fade_from_black") == -1) {
- fade = effectOut - effectIn;
+ fade = effectOut - effectIn;
}/* else {
- QDomElement fadein = m_effectList.getEffectByTag(QString(), "fade_from_black");
+ QDomElement fadein = m_effectList.getEffectByTag(QString(), "fade_from_black");
if (fadein.attribute("name") == "out") fade += fadein.attribute("value").toInt();
else if (fadein.attribute("name") == "in") fade -= fadein.attribute("value").toInt();
}*/
} else if (effectId == "fade_from_black") {
- needRepaint = true;
+ needRepaint = true;
if (m_effectList.hasEffect(QString(), "fadein") == -1) {
- fade = effectOut - effectIn;
+ fade = effectOut - effectIn;
}/* else {
- QDomElement fadein = m_effectList.getEffectByTag(QString(), "fadein");
+ QDomElement fadein = m_effectList.getEffectByTag(QString(), "fadein");
if (fadein.attribute("name") == "out") fade += fadein.attribute("value").toInt();
else if (fadein.attribute("name") == "in") fade -= fadein.attribute("value").toInt();
}*/
- } else if (effectId == "fadeout") {
- needRepaint = true;
+ } else if (effectId == "fadeout") {
+ needRepaint = true;
if (m_effectList.hasEffect(QString(), "fade_to_black") == -1) {
- fade = effectIn - effectOut;
+ fade = effectIn - effectOut;
} /*else {
- QDomElement fadeout = m_effectList.getEffectByTag(QString(), "fade_to_black");
+ QDomElement fadeout = m_effectList.getEffectByTag(QString(), "fade_to_black");
if (fadeout.attribute("name") == "out") fade -= fadeout.attribute("value").toInt();
else if (fadeout.attribute("name") == "in") fade += fadeout.attribute("value").toInt();
}*/
} else if (effectId == "fade_to_black") {
- needRepaint = true;
+ needRepaint = true;
if (m_effectList.hasEffect(QString(), "fadeout") == -1) {
- fade = effectIn - effectOut;
+ fade = effectIn - effectOut;
}/* else {
- QDomElement fadeout = m_effectList.getEffectByTag(QString(), "fadeout");
+ QDomElement fadeout = m_effectList.getEffectByTag(QString(), "fadeout");
if (fadeout.attribute("name") == "out") fade -= fadeout.attribute("value").toInt();
else if (fadeout.attribute("name") == "in") fade += fadeout.attribute("value").toInt();
}*/
return parameters;
}
-void ClipItem::deleteEffect(QString index)
+void ClipItem::deleteEffect(const QString &index)
{
bool needRepaint = false;
int ix = index.toInt();
QDomElement effect = m_effectList.itemFromIndex(ix);
QString effectId = effect.attribute("id");
if ((effectId == "fadein" && hasEffect(QString(), "fade_from_black") == -1) ||
- (effectId == "fade_from_black" && hasEffect(QString(), "fadein") == -1)) {
+ (effectId == "fade_from_black" && hasEffect(QString(), "fadein") == -1)) {
m_startFade = 0;
needRepaint = true;
} else if ((effectId == "fadeout" && hasEffect(QString(), "fade_to_black") == -1) ||
- (effectId == "fade_to_black" && hasEffect(QString(), "fadeout") == -1)) {
+ (effectId == "fade_to_black" && hasEffect(QString(), "fadeout") == -1)) {
m_endFade = 0;
needRepaint = true;
} else if (EffectsList::hasKeyFrames(effect)) needRepaint = true;
setSelectedEffect(m_effectList.count());
} else setSelectedEffect(ix);
}
- if (needRepaint) update(boundingRect());
- else {
+ if (needRepaint) {
+ update(boundingRect());
+ } else {
QRectF r = boundingRect();
r.setHeight(20);
update(r);
int freeGroupIndex = 0;
for (int i = 0; i < m_effectList.count(); ++i) {
QDomElement effect = m_effectList.at(i);
- EffectInfo effectInfo;
- effectInfo.fromString(effect.attribute("kdenlive_info"));
- if (effectInfo.groupIndex >= freeGroupIndex) {
- freeGroupIndex = effectInfo.groupIndex + 1;
- }
+ EffectInfo effectInfo;
+ effectInfo.fromString(effect.attribute("kdenlive_info"));
+ if (effectInfo.groupIndex >= freeGroupIndex) {
+ freeGroupIndex = effectInfo.groupIndex + 1;
+ }
}
return freeGroupIndex;
}
void ClipItem::dropEvent(QGraphicsSceneDragDropEvent * event)
{
if (event->proposedAction() == Qt::CopyAction && scene() && !scene()->views().isEmpty()) {
- const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
- event->acceptProposedAction();
- QDomDocument doc;
- doc.setContent(effects, true);
- QDomElement e = doc.documentElement();
- if (e.tagName() == "effectgroup") {
- // dropped an effect group
- QDomNodeList effectlist = e.elementsByTagName("effect");
- int freeGroupIndex = nextFreeEffectGroupIndex();
- EffectInfo effectInfo;
- for (int i = 0; i < effectlist.count(); ++i) {
- QDomElement effect = effectlist.at(i).toElement();
- effectInfo.fromString(effect.attribute("kdenlive_info"));
- effectInfo.groupIndex = freeGroupIndex;
- effect.setAttribute("kdenlive_info", effectInfo.toString());
- effect.removeAttribute("kdenlive_ix");
- }
- } else {
- // single effect dropped
- e.removeAttribute("kdenlive_ix");
- }
- CustomTrackView *view = (CustomTrackView *) scene()->views()[0];
+ const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
+ event->acceptProposedAction();
+ QDomDocument doc;
+ doc.setContent(effects, true);
+ QDomElement e = doc.documentElement();
+ if (e.tagName() == "effectgroup") {
+ // dropped an effect group
+ QDomNodeList effectlist = e.elementsByTagName("effect");
+ int freeGroupIndex = nextFreeEffectGroupIndex();
+ EffectInfo effectInfo;
+ for (int i = 0; i < effectlist.count(); ++i) {
+ QDomElement effect = effectlist.at(i).toElement();
+ effectInfo.fromString(effect.attribute("kdenlive_info"));
+ effectInfo.groupIndex = freeGroupIndex;
+ effect.setAttribute("kdenlive_info", effectInfo.toString());
+ effect.removeAttribute("kdenlive_ix");
+ }
+ } else {
+ // single effect dropped
+ e.removeAttribute("kdenlive_ix");
+ }
+ CustomTrackView *view = (CustomTrackView *) scene()->views().first();
if (view) view->slotDropEffect(this, e, m_info.startPos, track());
}
else return;
{
if (isItemLocked()) event->setAccepted(false);
else if (event->mimeData()->hasFormat("kdenlive/effectslist")) {
- event->acceptProposedAction();
+ event->acceptProposedAction();
} else event->setAccepted(false);
}
else m_baseColor = QColor(141, 166, 215);
}
if (parentItem())
- m_paintColor = m_baseColor.lighter(135);
+ m_paintColor = m_baseColor.lighter(135);
else
- m_paintColor = m_baseColor;
+ m_paintColor = m_baseColor;
m_audioThumbCachePic.clear();
}
return m_clip->getProducer(trackSpecific ? track : -1);
}
-QMap<int, QDomElement> ClipItem::adjustEffectsToDuration(int width, int height, ItemInfo oldInfo)
+QMap<int, QDomElement> ClipItem::adjustEffectsToDuration(int width, int height, const ItemInfo &oldInfo)
{
QMap<int, QDomElement> effects;
for (int i = 0; i < m_effectList.count(); ++i) {
}
if (effects.contains(i)) {
setFadeIn(out - in);
- }
+ }
} else {
if (out != clipEnd) {
effects[i] = effect.cloneNode().toElement();
EffectsList::setParameter(effect, "frame", QString::number(frame - diff));
continue;
} else if (effect.attribute("id") == "pan_zoom") {
- effect.setAttribute("in", cropStart().frames(m_fps));
- effect.setAttribute("out", (cropStart() + cropDuration()).frames(m_fps) - 1);
- }
+ effect.setAttribute("in", cropStart().frames(m_fps));
+ effect.setAttribute("out", (cropStart() + cropDuration()).frames(m_fps) - 1);
+ }
QDomNodeList params = effect.elementsByTagName("parameter");
for (int j = 0; j < params.count(); j++) {
const QStringList data = parameter.attribute("keyframes").split(';', QString::SkipEmptyParts);
QMap <int, double> keyframes;
foreach (QString keyframe, data) {
- int keyframepos = keyframe.section(':', 0, 0).toInt();
- // if keyframe was at clip start, update it
- if (keyframepos == oldin) {
- keyframepos = in;
- keyFrameUpdated = true;
- }
+ int keyframepos = keyframe.section(':', 0, 0).toInt();
+ // if keyframe was at clip start, update it
+ if (keyframepos == oldin) {
+ keyframepos = in;
+ keyFrameUpdated = true;
+ }
keyframes[keyframepos] = locale.toDouble(keyframe.section(':', 1, 1));
}
relPos = (out - lastPos) / (qreal)(i.key() - lastPos + 1);
keyframes[out] = lastValue + (i.value() - lastValue) * relPos;
}
- }
+ }
lastPos = i.key();
lastValue = i.value();
if (endFound)
EffectsParameterList addEffect(QDomElement effect, bool animate = true);
/** @brief Deletes the effect with id @param index. */
- void deleteEffect(QString index);
+ void deleteEffect(const QString &index);
/** @brief Gets the number of effects in this clip. */
int effectsCount();
bool updateNormalKeyframes(QDomElement parameter, ItemInfo oldInfo);
/** @brief Adjusts effects after a clip duration change. */
- QMap<int, QDomElement> adjustEffectsToDuration(int width, int height, ItemInfo oldInfo);
+ QMap<int, QDomElement> adjustEffectsToDuration(int width, int height, const ItemInfo &oldInfo);
/** Returns the necessary (audio, video, general) producer.
* @param track Track of the requested producer
void loadVideoProperties(const QMap<QString, QString> &props);
signals:
- void addMarkers(const QString &, QList <CommentedTime>);
+ void addMarkers(const QString &, const QList <CommentedTime>&);
void deleteProxy(const QString&);
void applyNewClipProperties(const QString&, const QMap <QString, QString> &, const QMap <QString, QString> &, bool, bool);
void saveMarkers(const QString &id);
void updateEffectLabel(const QStringList &effects);
protected:
- virtual void mousePressEvent(QMouseEvent * event);
- virtual void mouseDoubleClickEvent(QMouseEvent * event);
- virtual void dropEvent(QDropEvent * event);
- virtual void dragEnterEvent(QDragEnterEvent *event);
+ void mousePressEvent(QMouseEvent * event);
+ void mouseDoubleClickEvent(QMouseEvent * event);
+ void dropEvent(QDropEvent * event);
+ void dragEnterEvent(QDragEnterEvent *event);
private:
int m_index;
void switchTrackAudio(int);
void switchTrackVideo(int);
void switchTrackLock(int);
- void renameTrack(int, QString);
+ void renameTrack(int, const QString&);
void selectTrack(int);
void configTrack(int);
- void addTrackEffect(const QDomElement, int);
+ void addTrackEffect(const QDomElement &, int);
void showTrackEffects(int);
};
}
// static
-QDomDocument initEffects::getUsedCustomEffects(QMap <QString, QString> effectids)
+QDomDocument initEffects::getUsedCustomEffects(const QMap <QString, QString>& effectids)
{
QMapIterator<QString, QString> i(effectids);
int ix;
static void parseEffectFiles(const QString &locale = QString());
static void refreshLumas();
static QDomDocument createDescriptionFromMlt(Mlt::Repository* repository, const QString& type, const QString& name);
- static QDomDocument getUsedCustomEffects(QMap <QString, QString> effectids);
+ static QDomDocument getUsedCustomEffects(const QMap<QString, QString> &effectids);
/** @brief Fills the transitions list.
* @param repository MLT repository
{
KService::Ptr service;
QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), this);
- if (dlg->exec() != QDialog::Accepted)
- {
- delete dlg;
- return;
+ if (dlg->exec() == QDialog::Accepted) {
+ service = dlg->service();
+ m_configEnv.kcfg_defaultplayerapp->setText(service->exec());
}
- service = dlg->service();
- m_configEnv.kcfg_defaultplayerapp->setText(service->exec());
delete dlg;
}
{
KService::Ptr service;
QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this);
- if (dlg->exec() != QDialog::Accepted)
- {
- delete dlg;
- return;
+ if (dlg->exec() == QDialog::Accepted) {
+ service = dlg->service();
+ m_configEnv.kcfg_defaultaudioapp->setText(service->exec());
}
- service = dlg->service();
- m_configEnv.kcfg_defaultaudioapp->setText(service->exec());
delete dlg;
}
{
KService::Ptr service;
QPointer<KOpenWithDialog> dlg = new KOpenWithDialog(KUrl::List(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this);
- if (dlg->exec() != QDialog::Accepted)
- {
- delete dlg;
- return;
+ if (dlg->exec() == QDialog::Accepted) {
+ service = dlg->service();
+ m_configEnv.kcfg_defaultimageapp->setText(service->exec());
}
- service = dlg->service();
- m_configEnv.kcfg_defaultimageapp->setText(service->exec());
delete dlg;
}
int frameLength;
protected:
- virtual void paintEvent(QPaintEvent * /*e*/);
- virtual void wheelEvent(QWheelEvent * e);
- virtual void mousePressEvent(QMouseEvent * event);
- virtual void mouseMoveEvent(QMouseEvent * event);
- virtual void mouseReleaseEvent(QMouseEvent * event);
- virtual void mouseDoubleClickEvent(QMouseEvent * event);
- virtual void leaveEvent( QEvent * event );
+ void paintEvent(QPaintEvent * /*e*/);
+ void wheelEvent(QWheelEvent * e);
+ void mousePressEvent(QMouseEvent * event);
+ void mouseMoveEvent(QMouseEvent * event);
+ void mouseReleaseEvent(QMouseEvent * event);
+ void mouseDoubleClickEvent(QMouseEvent * event);
+ void leaveEvent( QEvent * event );
private:
Mlt::Geometry *m_geom;
m_thumbFile = m_clipManager->projectFolder() + "/thumbs/" + hash + ".thumb";
}
-void KThumb::updateClipUrl(KUrl url, const QString &hash)
+void KThumb::updateClipUrl(const KUrl &url, const QString &hash)
{
m_url = url;
m_thumbFile = m_clipManager->projectFolder() + "/thumbs/" + hash + ".thumb";
void getGenericThumb(int frame, int height, int type);
public slots:
- void updateClipUrl(KUrl url, const QString &hash);
+ void updateClipUrl(const KUrl &url, const QString &hash);
void slotCreateAudioThumbs();
public:
QImage getProducerFrame(int framepos, int frameWidth, int displayWidth, int height);
signals:
- void thumbReady(int, QImage);
- void mainThumbReady(const QString &, QPixmap);
+ void thumbReady(int, const QImage&);
+ void mainThumbReady(const QString &, const QPixmap&);
void audioThumbReady(const audioByteArray&);
/** @brief We have finished caching all requested thumbs. */
void thumbsCached();
m_projectMonitor(NULL),
m_recMonitor(NULL),
m_renderWidget(NULL),
-#ifdef USE_JOGSHUTTLE
+ #ifdef USE_JOGSHUTTLE
m_jogProcess(NULL),
m_jogShuttle(NULL),
-#endif
+ #endif
m_findActivated(false),
m_stopmotion(NULL),
m_mainClip(NULL)
if (separator != systemLocale.decimalPoint()) {
kDebug()<<"------\n!!! system locale is not similar to Qt's locale... be prepared for bugs!!!\n------";
// HACK: There is a locale conflict, so set locale to C
- // Make sure to override exported values or it won't work
- setenv("LANG", "C", 1);
- setlocale(LC_NUMERIC, "C");
+ // Make sure to override exported values or it won't work
+ setenv("LANG", "C", 1);
+ setlocale(LC_NUMERIC, "C");
systemLocale = QLocale::c();
}
for (int i = 1; i < 5; ++i) {
KAction *load = new KAction(KIcon(), i18n("Layout %1", i), this);
load->setData('_' + QString::number(i));
- layoutActions->addAction("load_layout" + QString::number(i), load);
+ layoutActions->addAction("load_layout" + QString::number(i), load);
m_loadLayout->addAction(load);
KAction *save = new KAction(KIcon(), i18n("Save As Layout %1", i), this);
save->setData('_' + QString::number(i));
m_effectList->reloadEffectList(m_effectsMenu, m_effectActions);
m_effectsActionCollection->readSettings();
- // Populate View menu with show / hide actions for dock widgets
+ // Populate View menu with show / hide actions for dock widgets
KActionCategory *guiActions = new KActionCategory(i18n("Interface"), actionCollection());
setupGUI();
connect(m, SIGNAL(triggered(QAction*)), this, SLOT(slotAddVideoEffect(QAction*)));
connect(m_effectsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotAddVideoEffect(QAction*)));
- connect(m_transitionsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotAddTransition(QAction*)));
+ connect(m_transitionsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotAddTransition(QAction*)));
m_timelineContextMenu = new QMenu(this);
m_timelineContextClipMenu = new QMenu(this);
QList <QDockWidget *> docks = findChildren<QDockWidget *>();
for (int i = 0; i < docks.count(); ++i) {
QDockWidget* dock = docks.at(i);
- QAction * a = dock->toggleViewAction();
- if (!a) continue;
- KAction* dockInformations = new KAction(this);
- dockInformations->setText(a->text());
- dockInformations->setCheckable(true);
- dockInformations->setChecked(!dock->isHidden());
- // HACK: since QActions cannot be used in KActionCategory to allow shortcut, we create a duplicate KAction of the dock QAction and link them
- connect(a,SIGNAL(toggled(bool)), dockInformations, SLOT(setChecked(bool)));
- connect(dockInformations,SIGNAL(triggered(bool)), a, SLOT(trigger()));
- pair.first = dockInformations->text();
- pair.second = dockInformations;
- viewActions.append(pair);
+ QAction * a = dock->toggleViewAction();
+ if (!a) continue;
+ KAction* dockInformations = new KAction(this);
+ dockInformations->setText(a->text());
+ dockInformations->setCheckable(true);
+ dockInformations->setChecked(!dock->isHidden());
+ // HACK: since QActions cannot be used in KActionCategory to allow shortcut, we create a duplicate KAction of the dock QAction and link them
+ connect(a,SIGNAL(toggled(bool)), dockInformations, SLOT(setChecked(bool)));
+ connect(dockInformations,SIGNAL(triggered(bool)), a, SLOT(trigger()));
+ pair.first = dockInformations->text();
+ pair.second = dockInformations;
+ viewActions.append(pair);
}
// Sort dock view action by name
qSort(viewActions.begin(), viewActions.end(), sortByNames);
// Populate view menu
for (int i = 0; i < viewActions.count(); ++i)
- viewMenu->addAction(guiActions->addAction(viewActions.at(i).first, viewActions.at(i).second));
+ viewMenu->addAction(guiActions->addAction(viewActions.at(i).first, viewActions.at(i).second));
// Populate encoding profiles
KConfig conf("encodingprofiles.rc", KConfig::CascadeConfig, "appdata");
ClipGenerator *iGenerator = qobject_cast<ClipGenerator *>(action->parent());
KUrl clipUrl = iGenerator->generatedClip(KdenliveSettings::rendererpath(), action->data().toString(), m_activeDocument->projectFolder(),
- QStringList(), QStringList(), m_activeDocument->fps(), m_activeDocument->width(), m_activeDocument->height());
+ QStringList(), QStringList(), m_activeDocument->fps(), m_activeDocument->width(), m_activeDocument->height());
if (!clipUrl.isEmpty()) {
m_projectList->slotAddClip(QList <QUrl> () << clipUrl);
}
KToggleFullScreenAction::setFullScreen(this, actionCollection()->action("fullscreen")->isChecked());
}
-void MainWindow::slotAddEffect(const QDomElement effect)
+void MainWindow::slotAddEffect(const QDomElement &effect)
{
if (!m_activeDocument) return;
if (effect.isNull()) {
class NameGrabbingKActionCollection {
public:
- NameGrabbingKActionCollection(KActionCollection* collection, QStringList& action_names)
- : m_collection(collection), m_action_names(action_names) {
- m_action_names.clear();
- }
- KAction* addAction(const QString& action_name) {
- m_action_names << action_name;
- return m_collection->addAction(action_name);
- }
- void addAction(const QString& action_name, QAction* action) {
- m_action_names << action_name;
- m_collection->addAction(action_name, action);
- }
- operator KActionCollection*() { return m_collection; }
- const QStringList& actionNames() const { return m_action_names; }
+ NameGrabbingKActionCollection(KActionCollection* collection, QStringList& action_names)
+ : m_collection(collection), m_action_names(action_names) {
+ m_action_names.clear();
+ }
+ KAction* addAction(const QString& action_name) {
+ m_action_names << action_name;
+ return m_collection->addAction(action_name);
+ }
+ void addAction(const QString& action_name, QAction* action) {
+ m_action_names << action_name;
+ m_collection->addAction(action_name, action);
+ }
+ operator KActionCollection*() { return m_collection; }
+ const QStringList& actionNames() const { return m_action_names; }
private:
- KActionCollection* m_collection;
- QStringList& m_action_names;
+ KActionCollection* m_collection;
+ QStringList& m_action_names;
};
void MainWindow::setupActions()
if (docToClose == m_activeDocument) {
delete m_activeDocument;
m_activeDocument = NULL;
- m_monitorManager->setDocument(m_activeDocument);
+ m_monitorManager->setDocument(m_activeDocument);
m_effectStack->clear();
m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
} else {
kDebug()<<"Opening archive, processing";
QPointer<ArchiveWidget> ar = new ArchiveWidget(url);
if (ar->exec() == QDialog::Accepted) {
- openFile(KUrl(ar->extractedProjectFile()));
- }
- else if (!m_startUrl.isEmpty()) {
- // we tried to open an invalid file from command line, init new project
- newFile(false);
- }
+ openFile(KUrl(ar->extractedProjectFile()));
+ } else if (!m_startUrl.isEmpty()) {
+ // we tried to open an invalid file from command line, init new project
+ newFile(false);
+ }
delete ar;
return;
}
if (!url.fileName().endsWith(".kdenlive")) {
// This is not a Kdenlive project file, abort loading
KMessageBox::sorry(this, i18n("File %1 is not a Kdenlive project file", url.path()));
- if (!m_startUrl.isEmpty()) {
- // we tried to open an invalid file from command line, init new project
- newFile(false);
- }
+ if (!m_startUrl.isEmpty()) {
+ // we tried to open an invalid file from command line, init new project
+ newFile(false);
+ }
return;
}
if (m_activeDocument)
switch (m_timeFormatButton->currentItem()) {
case 0:
- m_timeFormatButton->setText(m_activeDocument->timecode().getTimecodeFromFrames(pos) + " / " + m_activeDocument->timecode().getTimecodeFromFrames(m_activeTimeline->duration()));
+ m_timeFormatButton->setText(m_activeDocument->timecode().getTimecodeFromFrames(pos) + " / " + m_activeDocument->timecode().getTimecodeFromFrames(m_activeTimeline->duration()));
break;
default:
- m_timeFormatButton->setText(QString::number(pos) + " / " + QString::number(m_activeTimeline->duration()));
+ m_timeFormatButton->setText(QString::number(pos) + " / " + QString::number(m_activeTimeline->duration()));
}
}
void MainWindow::slotUpdateProjectDuration(int pos)
{
if (m_activeDocument) {
- m_activeTimeline->setDuration(pos);
- slotUpdateMousePosition(m_activeTimeline->projectView()->getMousePos());
+ m_activeTimeline->setDuration(pos);
+ slotUpdateMousePosition(m_activeTimeline->projectView()->getMousePos());
}
}
disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
disconnect(m_effectStack, SIGNAL(updateEffect(ClipItem*,int,QDomElement,QDomElement,int,bool)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*,int,QDomElement,QDomElement,int,bool)));
disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*,int,QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*,int,QDomElement)));
- disconnect(m_effectStack, SIGNAL(addEffect(ClipItem*,QDomElement)), trackView->projectView(), SLOT(slotAddEffect(ClipItem*,QDomElement)));
+ disconnect(m_effectStack, SIGNAL(addEffect(ClipItem*,QDomElement)), trackView->projectView(), SLOT(slotAddEffect(ClipItem*,QDomElement)));
disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*,int,QList<int>,bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*,int,QList<int>,bool)));
disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*,int,QList<int>,int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*,int,QList<int>,int)));
disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
disconnect(m_effectStack, SIGNAL(displayMessage(QString,int)), this, SLOT(slotGotProgressInfo(QString,int)));
disconnect(m_transitionConfig, SIGNAL(transitionUpdated(Transition*,QDomElement)), m_activeTimeline->projectView() , SLOT(slotTransitionUpdated(Transition*,QDomElement)));
disconnect(m_transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
- disconnect(m_transitionConfig, SIGNAL(importClipKeyframes(GRAPHICSRECTITEM)), m_activeTimeline->projectView() , SLOT(slotImportClipKeyframes(GRAPHICSRECTITEM)));
+ disconnect(m_transitionConfig, SIGNAL(importClipKeyframes(GRAPHICSRECTITEM)), m_activeTimeline->projectView() , SLOT(slotImportClipKeyframes(GRAPHICSRECTITEM)));
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(slotActivateMonitor()));
disconnect(m_activeTimeline, SIGNAL(zoneMoved(int,int)), this, SLOT(slotZoneMoved(int,int)));
disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
disconnect(m_projectList, SIGNAL(refreshClip(QString)), m_activeTimeline->projectView(), SLOT(slotRefreshThumbs(QString)));
- disconnect(m_projectList, SIGNAL(addMarkers(QString,QList<CommentedTime>)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(QString,QList<CommentedTime>)));
+ disconnect(m_projectList, SIGNAL(addMarkers(QString,QList<CommentedTime>)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(QString,QList<CommentedTime>)));
m_effectStack->clear();
}
//m_activeDocument->setRenderer(NULL);
QString id = clip->getId();
CommentedTime marker(pos, i18n("Marker"), KdenliveSettings::default_marker_type());
QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
- m_activeDocument->timecode(), i18n("Add Marker"), this);
+ m_activeDocument->timecode(), i18n("Add Marker"), this);
if (d->exec() == QDialog::Accepted) {
m_activeTimeline->projectView()->slotAddClipMarker(id, QList <CommentedTime>() << d->newMarker());
- QString hash = clip->getClipHash();
- if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
+ QString hash = clip->getClipHash();
+ if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
}
delete d;
}
}
QPointer<MarkerDialog> d = new MarkerDialog(clip, oldMarker,
- m_activeDocument->timecode(), i18n("Edit Marker"), this);
+ m_activeDocument->timecode(), i18n("Edit Marker"), this);
if (d->exec() == QDialog::Accepted) {
m_activeTimeline->projectView()->slotAddClipMarker(id, QList <CommentedTime>() <<d->newMarker());
- QString hash = clip->getClipHash();
- if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
+ QString hash = clip->getClipHash();
+ if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
if (d->newMarker().time() != pos) {
// remove old marker
oldMarker.setMarkerType(-1);
return;
}
//TODO: allow user to set default marker category
- CommentedTime marker(pos, m_activeDocument->timecode().getDisplayTimecode(pos, false), KdenliveSettings::default_marker_type());
+ CommentedTime marker(pos, m_activeDocument->timecode().getDisplayTimecode(pos, false), KdenliveSettings::default_marker_type());
m_activeTimeline->projectView()->slotAddClipMarker(clip->getId(), QList <CommentedTime>() <<marker);
} else {
m_activeTimeline->projectView()->slotAddGuide(false);
if (info.isEmpty() || info.size() < 3) return;
QDomElement effect ;
if (info.last() == QString::number((int) EFFECT_VIDEO))
- effect = videoEffects.getEffectByTag(info.at(0), info.at(1));
+ effect = videoEffects.getEffectByTag(info.at(0), info.at(1));
else if (info.last() == QString::number((int) EFFECT_AUDIO))
- effect = audioEffects.getEffectByTag(info.at(0), info.at(1));
+ effect = audioEffects.getEffectByTag(info.at(0), info.at(1));
else
- effect = customEffects.getEffectByTag(info.at(0), info.at(1));
+ effect = customEffects.getEffectByTag(info.at(0), info.at(1));
if (!effect.isNull()) slotAddEffect(effect);
else m_messageLabel->setMessage(i18n("Cannot find effect %1 / %2", info.at(0), info.at(1)), ErrorMessage);
}
newprops.insert("out", QString::number(dia_ui->duration() - 1));
int currentLength = QString(clip->producerProperty("length")).toInt();
if (currentLength <= dia_ui->duration())
- newprops.insert("length", QString::number(dia_ui->duration()));
- else newprops.insert("length", clip->producerProperty("length"));
+ newprops.insert("length", QString::number(dia_ui->duration()));
+ else
+ newprops.insert("length", clip->producerProperty("length"));
}
if (!path.isEmpty()) {
// we are editing an external file, asked if we want to detach from that file or save the result to that title file.
if (KMessageBox::questionYesNo(this, i18n("You are editing an external title clip (%1). Do you want to save your changes to the title file or save the changes for this project only?", path), i18n("Save Title"), KGuiItem(i18n("Save to title file")), KGuiItem(i18n("Save in project only"))) == KMessageBox::Yes) {
// save to external file
dia_ui->saveTitle(path);
- } else newprops.insert("resource", QString());
+ } else {
+ newprops.insert("resource", QString());
+ }
}
EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->currentProperties(newprops), newprops, true);
m_activeDocument->commandStack()->push(command);
QList <ClipProperties *> list = findChildren<ClipProperties *>();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i)->clipId() == clip->getId()) {
- // We have one dialog, show it
- list.at(i)->raise();
- return;
- }
+ // We have one dialog, show it
+ list.at(i)->raise();
+ return;
+ }
}
// any type of clip but a title
ClipProperties *dia = new ClipProperties(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
if (clip->clipType() == AV || clip->clipType() == VIDEO || clip->clipType() == PLAYLIST || clip->clipType() == SLIDESHOW) {
- // request clip thumbnails
- connect(m_activeDocument->clipManager(), SIGNAL(gotClipPropertyThumbnail(QString,QImage)), dia, SLOT(slotGotThumbnail(QString,QImage)));
- connect(dia, SIGNAL(requestThumb(QString,QList<int>)), m_activeDocument->clipManager(), SLOT(slotRequestThumbs(QString,QList<int>)));
- m_activeDocument->clipManager()->slotRequestThumbs(QString('?' + clip->getId()), QList<int>() << clip->getClipThumbFrame());
+ // request clip thumbnails
+ connect(m_activeDocument->clipManager(), SIGNAL(gotClipPropertyThumbnail(QString,QImage)), dia, SLOT(slotGotThumbnail(QString,QImage)));
+ connect(dia, SIGNAL(requestThumb(QString,QList<int>)), m_activeDocument->clipManager(), SLOT(slotRequestThumbs(QString,QList<int>)));
+ m_activeDocument->clipManager()->slotRequestThumbs(QString('?' + clip->getId()), QList<int>() << clip->getClipThumbFrame());
}
connect(dia, SIGNAL(addMarkers(QString,QList<CommentedTime>)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(QString,QList<CommentedTime>)));
}
-void MainWindow::slotShowClipProperties(QList <DocClipBase *> cliplist, QMap<QString, QString> commonproperties)
+void MainWindow::slotShowClipProperties(const QList <DocClipBase *> &cliplist, const QMap<QString, QString> &commonproperties)
{
QPointer<ClipProperties> dia = new ClipProperties(cliplist,
- m_activeDocument->timecode(), commonproperties, this);
+ m_activeDocument->timecode(), commonproperties, this);
if (dia->exec() == QDialog::Accepted) {
QUndoCommand *command = new QUndoCommand();
command->setText(i18n("Edit clips"));
void MainWindow::slotTimelineClipSelected(ClipItem* item, bool raise)
{
if (item != m_mainClip) {
- if (m_mainClip) m_mainClip->setMainSelectedClip(false);
- if (item) item->setMainSelectedClip(true);
- m_mainClip = item;
+ if (m_mainClip) m_mainClip->setMainSelectedClip(false);
+ if (item) item->setMainSelectedClip(true);
+ m_mainClip = item;
}
m_effectStack->slotClipItemSelected(item);
m_projectMonitor->slotSetSelectedClip(item);
void MainWindow::slotClipInProjectTree()
{
if (m_activeTimeline) {
- QStringList clipIds;
- if (m_mainClip) clipIds << m_mainClip->clipProducer();
- else clipIds = m_activeTimeline->projectView()->selectedClips();
+ QStringList clipIds;
+ if (m_mainClip) clipIds << m_mainClip->clipProducer();
+ else clipIds = m_activeTimeline->projectView()->selectedClips();
if (clipIds.isEmpty())
return;
m_projectListDock->raise();
}
-void MainWindow::slotSaveZone(Render *render, QPoint zone, DocClipBase *baseClip, KUrl path)
+void MainWindow::slotSaveZone(Render *render, const QPoint &zone, DocClipBase *baseClip, KUrl path)
{
KDialog *dialog = new KDialog(this);
dialog->setCaption("Save clip zone");
void MainWindow::loadClipActions()
{
- QMenu* actionMenu= static_cast<QMenu*>(factory()->container("clip_actions", this));
- if (actionMenu){
- actionMenu->clear();
- Mlt::Profile profile;
- Mlt::Filter *filter = Mlt::Factory::filter(profile,(char*)"videostab");
- if (filter) {
- if (!filter->is_valid()) {
- delete filter;
- }
- else {
- delete filter;
- QAction *action=actionMenu->addAction(i18n("Stabilize (vstab)"));
- action->setData("videostab");
- connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
- }
- }
- filter = Mlt::Factory::filter(profile,(char*)"videostab2");
- if (filter) {
- if (!filter->is_valid()) {
- delete filter;
- }
- else {
- delete filter;
- QAction *action=actionMenu->addAction(i18n("Stabilize (transcode)"));
- action->setData("videostab2");
- connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
- }
- }
- filter = Mlt::Factory::filter(profile,(char*)"motion_est");
- if (filter) {
- if (!filter->is_valid()) {
- delete filter;
- }
- else {
- delete filter;
- QAction *action=actionMenu->addAction(i18n("Automatic scene split"));
- action->setData("motion_est");
- connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
- }
- }
- if (KdenliveSettings::producerslist().contains("framebuffer")) {
- QAction *action=actionMenu->addAction(i18n("Reverse clip"));
- action->setData("framebuffer");
- connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
- }
- }
+ QMenu* actionMenu= static_cast<QMenu*>(factory()->container("clip_actions", this));
+ if (actionMenu){
+ actionMenu->clear();
+ Mlt::Profile profile;
+ Mlt::Filter *filter = Mlt::Factory::filter(profile,(char*)"videostab");
+ if (filter) {
+ if (!filter->is_valid()) {
+ delete filter;
+ }
+ else {
+ delete filter;
+ QAction *action=actionMenu->addAction(i18n("Stabilize (vstab)"));
+ action->setData("videostab");
+ connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
+ }
+ }
+ filter = Mlt::Factory::filter(profile,(char*)"videostab2");
+ if (filter) {
+ if (!filter->is_valid()) {
+ delete filter;
+ }
+ else {
+ delete filter;
+ QAction *action=actionMenu->addAction(i18n("Stabilize (transcode)"));
+ action->setData("videostab2");
+ connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
+ }
+ }
+ filter = Mlt::Factory::filter(profile,(char*)"motion_est");
+ if (filter) {
+ if (!filter->is_valid()) {
+ delete filter;
+ }
+ else {
+ delete filter;
+ QAction *action=actionMenu->addAction(i18n("Automatic scene split"));
+ action->setData("motion_est");
+ connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
+ }
+ }
+ if (KdenliveSettings::producerslist().contains("framebuffer")) {
+ QAction *action=actionMenu->addAction(i18n("Reverse clip"));
+ action->setData("framebuffer");
+ connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
+ }
+ }
}
QString scriptPath;
QString playlistPath;
if (scriptExport) {
- QString scriptsFolder = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "scripts/";
+ //QString scriptsFolder = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "scripts/";
QString path = m_renderWidget->getFreeScriptName(m_activeDocument->url());
- QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(path, i18n("Create Render Script"), this);
- getUrl->fileDialog()->setMode(KFile::File);
- getUrl->fileDialog()->setOperationMode(KFileDialog::Saving);
+ QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(path, i18n("Create Render Script"), this);
+ getUrl->fileDialog()->setMode(KFile::File);
+ getUrl->fileDialog()->setOperationMode(KFileDialog::Saving);
if (getUrl->exec() == QDialog::Rejected) {
delete getUrl;
return;
// Since there was a bug in createApplicationPalette in KDE < 4.6.3 we need
// to do the palette loading stuff ourselves. (https://bugs.kde.org/show_bug.cgi?id=263497)
QPalette::ColorGroup states[3] = { QPalette::Active, QPalette::Inactive,
- QPalette::Disabled };
+ QPalette::Disabled };
// TT thinks tooltips shouldn't use active, so we use our active colors for all states
KColorScheme schemeTooltip(QPalette::Active, KColorScheme::Tooltip, config);
}
-void MainWindow::slotDeleteProjectClips(QStringList ids, QMap<QString, QString> folderids)
+void MainWindow::slotDeleteProjectClips(const QStringList &ids, const QMap<QString, QString> &folderids)
{
if (m_activeDocument && m_activeTimeline) {
if (!ids.isEmpty()) {
m_stopmotion = new StopmotionWidget(m_monitorManager, m_activeDocument->projectFolder(), m_stopmotion_actions->actions(), this);
connect(m_stopmotion, SIGNAL(addOrUpdateSequence(QString)), m_projectList, SLOT(slotAddOrUpdateSequence(QString)));
//for (int i = 0; i < m_gfxScopesList.count(); ++i) {
- // Check if we need the renderer to send a new frame for update
- /*if (!m_scopesList.at(i)->widget()->visibleRegion().isEmpty() && !(static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->autoRefreshEnabled())) request = true;*/
- //connect(m_stopmotion, SIGNAL(gotFrame(QImage)), static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget()), SLOT(slotRenderZoneUpdated(QImage)));
- //static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->slotMonitorCapture();
+ // Check if we need the renderer to send a new frame for update
+ /*if (!m_scopesList.at(i)->widget()->visibleRegion().isEmpty() && !(static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->autoRefreshEnabled())) request = true;*/
+ //connect(m_stopmotion, SIGNAL(gotFrame(QImage)), static_cast<AbstractGfxScopeWidget *>(m_gfxScopesList.at(i)->widget()), SLOT(slotRenderZoneUpdated(QImage)));
+ //static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->slotMonitorCapture();
//}
}
m_stopmotion->show();
void MainWindow::slotSaveTimelineClip()
{
if (m_activeTimeline && m_projectMonitor->render) {
- ClipItem *clip = m_activeTimeline->projectView()->getActiveClipUnderCursor(true);
- if (!clip) {
- m_messageLabel->setMessage(i18n("Select a clip to save"), InformationMessage);
- return;
- }
- KUrl url = KFileDialog::getSaveUrl(m_activeDocument->projectFolder(), "video/mlt-playlist");
- if (!url.isEmpty()) m_projectMonitor->render->saveClip(m_activeDocument->tracksCount() - clip->track(), clip->startPos(), url);
+ ClipItem *clip = m_activeTimeline->projectView()->getActiveClipUnderCursor(true);
+ if (!clip) {
+ m_messageLabel->setMessage(i18n("Select a clip to save"), InformationMessage);
+ return;
+ }
+ KUrl url = KFileDialog::getSaveUrl(m_activeDocument->projectFolder(), "video/mlt-playlist");
+ if (!url.isEmpty()) m_projectMonitor->render->saveClip(m_activeDocument->tracksCount() - clip->track(), clip->startPos(), url);
}
}
void MainWindow::slotProcessImportKeyframes(GRAPHICSRECTITEM type, const QString& data, int maximum)
{
if (type == AVWIDGET) {
- // This data should be sent to the effect stack
- m_effectStack->setKeyframes(data, maximum);
+ // This data should be sent to the effect stack
+ m_effectStack->setKeyframes(data, maximum);
}
else if (type == TRANSITIONWIDGET) {
- // This data should be sent to the transition stack
- m_transitionConfig->setKeyframes(data, maximum);
+ // This data should be sent to the transition stack
+ m_transitionConfig->setKeyframes(data, maximum);
}
else {
- // Error
+ // Error
}
}
{
QString value;
switch (ix) {
-
- case 1:
- value = "linearblend";
- break;
- case 2:
- value = "yadif-nospatial";
- break;
- case 3:
- value = "yadif";
- break;
- default:
- value = "onefield";
+
+ case 1:
+ value = "linearblend";
+ break;
+ case 2:
+ value = "yadif-nospatial";
+ break;
+ case 3:
+ value = "yadif";
+ break;
+ default:
+ value = "onefield";
}
KdenliveSettings::setMltdeinterlacer(value);
m_monitorManager->setConsumerProperty("deinterlace_method", value);
{
QString value;
switch (ix) {
- case 1:
- value = "bilinear";
- break;
- case 2:
- value = "bicubic";
- break;
- case 3:
- value = "hyper";
- break;
- default:
- value = "nearest";
+ case 1:
+ value = "bilinear";
+ break;
+ case 2:
+ value = "bicubic";
+ break;
+ case 3:
+ value = "hyper";
+ break;
+ default:
+ value = "nearest";
}
KdenliveSettings::setMltinterpolation(value);
m_monitorManager->setConsumerProperty("rescale", value);
void slotUpdateClip(const QString &id);
void slotUpdateMousePosition(int pos);
void slotUpdateProjectDuration(int pos);
- void slotAddEffect(const QDomElement effect);
+ void slotAddEffect(const QDomElement &effect);
void slotEditProfiles();
void slotDetectAudioDriver();
void slotEditProjectSettings();
void slotAddProjectClip(KUrl url, stringMap data = stringMap());
void slotAddProjectClipList(KUrl::List urls);
void slotShowClipProperties(DocClipBase *clip);
- void slotShowClipProperties(QList <DocClipBase *>cliplist, QMap<QString, QString> commonproperties);
+ void slotShowClipProperties(const QList<DocClipBase *> &cliplist, const QMap<QString, QString> &commonproperties);
void slotTimelineClipSelected(ClipItem* item, bool raise = true);
void slotTrackSelected(int index, TrackInfo info, bool raise = true);
void slotActivateTransitionView(Transition *);
void slotAdjustClipMonitor();
void slotAdjustProjectMonitor();
- void slotSaveZone(Render *render, QPoint zone, DocClipBase *baseClip = NULL, KUrl path = KUrl());
+ void slotSaveZone(Render *render, const QPoint &zone, DocClipBase *baseClip = NULL, KUrl path = KUrl());
void slotSetInPoint();
void slotSetOutPoint();
/** @brief Deletes items from timeline and document.
* @param ids The ids of the clips to delete.
* @param folderids The names and ids of the folders to delete. */
- void slotDeleteProjectClips(QStringList ids, QMap<QString, QString> folderids);
+ void slotDeleteProjectClips(const QStringList &ids, const QMap<QString, QString> &folderids);
void slotShowTitleBars(bool show);
void slotSwitchTitles();
/** @brief Update the capture folder if user asked a change. */
adjustSize();
}
-ManageCapturesDialog::~ManageCapturesDialog() {}
+ManageCapturesDialog::~ManageCapturesDialog()
+{
+}
void ManageCapturesDialog::slotCheckItemIcon()
{
class Event;
class Producer;
class Profile;
-};
+}
class MltDeviceCapture: public AbstractRender
{
}
#ifdef USE_OPENGL
-bool Monitor::createOpenGlWidget(QWidget *parent, const QString profile)
+bool Monitor::createOpenGlWidget(QWidget *parent, const QString &profile)
{
render = new Render(id(), 0, profile, this);
m_glWidget = new VideoGLWidget(parent);
fs->setMode(KFile::File);
fs->setConfirmOverwrite(true);
fs->setKeepLocation(true);
- fs->exec();
- QString path;
- if (fs) path = fs->selectedFile();
- delete fs;
- if (!path.isEmpty()) {
- frame.save(path);
+ if (fs->exec()) {
+ QString path = fs->selectedFile();
+ if (!path.isEmpty()) {
+ frame.save(path);
+ }
}
+ delete fs;
}
void Monitor::setTimePos(const QString &pos)
m_effectWidget->resetProfile(render);
}
-void Monitor::saveSceneList(QString path, QDomElement info)
+void Monitor::saveSceneList(const QString &path, const QDomElement &info)
{
if (render == NULL) return;
render->saveSceneList(path, info);
return render->sceneList();
}
-void Monitor::setClipZone(QPoint pos)
+void Monitor::setClipZone(const QPoint &pos)
{
if (m_currentClip == NULL) return;
m_currentClip->setZone(pos);
QString getMarkerThumb(GenTime pos);
protected:
- virtual void mousePressEvent(QMouseEvent * event);
- virtual void mouseReleaseEvent(QMouseEvent * event);
- virtual void mouseDoubleClickEvent(QMouseEvent * event);
- virtual void resizeEvent(QResizeEvent *event);
+ void mousePressEvent(QMouseEvent * event);
+ void mouseReleaseEvent(QMouseEvent * event);
+ void mouseDoubleClickEvent(QMouseEvent * event);
+ void resizeEvent(QResizeEvent *event);
/** @brief Move to another position on mouse wheel event.
*
* Moves towards the end of the clip/timeline on mouse wheel down/back, the
* opposite on mouse wheel up/forward.
* Ctrl + wheel moves by a second, without Ctrl it moves by a single frame. */
- virtual void wheelEvent(QWheelEvent * event);
- virtual void mouseMoveEvent(QMouseEvent *event);
+ void wheelEvent(QWheelEvent * event);
+ void mouseMoveEvent(QMouseEvent *event);
virtual QStringList mimeTypes() const;
/*virtual void dragMoveEvent(QDragMoveEvent * event);
#ifdef USE_OPENGL
VideoGLWidget *m_glWidget;
- bool createOpenGlWidget(QWidget *parent, const QString profile);
+ bool createOpenGlWidget(QWidget *parent, const QString &profile);
#endif
GenTime getSnapForPos(bool previous);
void slotSetSizeOneToTwo();
void slotSaveZone();
void slotSeek();
- void setClipZone(QPoint pos);
+ void setClipZone(const QPoint &pos);
void slotSwitchMonitorInfo(bool show);
void slotSwitchDropFrames(bool show);
void slotGoToMarker(QAction *action);
void slotRewind(double speed = 0);
void slotRewindOneFrame(int diff = 1);
void slotForwardOneFrame(int diff = 1);
- void saveSceneList(QString path, QDomElement info = QDomElement());
+ void saveSceneList(const QString &path, const QDomElement &info = QDomElement());
void slotStart();
void slotEnd();
void slotSetZoneStart();
void durationChanged(int);
void refreshClipThumbnail(const QString &, bool);
void adjustMonitorSize();
- void zoneUpdated(QPoint);
- void saveZone(Render *, QPoint, DocClipBase *);
+ void zoneUpdated(const QPoint&);
+ void saveZone(Render *, const QPoint&, DocClipBase *);
/** @brief Editing transitions / effects over the monitor requires the renderer to send frames as QImage.
* This causes a major slowdown, so we only enable it if required */
void requestFrameForAnalysis(bool);
/** @brief Request a zone extraction (ffmpeg transcoding). */
- void extractZone(const QString &id, QPoint zone);
+ void extractZone(const QString &id, const QPoint &zone);
};
#endif
else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotEnd();
}
-void MonitorManager::resetProfiles(Timecode tc)
+void MonitorManager::resetProfiles(const Timecode &tc)
{
m_timecode = tc;
slotResetProfiles();
void appendMonitor(AbstractMonitor *monitor);
void removeMonitor(AbstractMonitor *monitor);
Timecode timecode() const;
- void resetProfiles(Timecode tc);
+ void resetProfiles(const Timecode &tc);
void stopActiveMonitor();
AbstractRender *activeRenderer();
/** Searches for a monitor with the given name.
QString paramlist;
QTextStream txtstr(¶mlist);
QDomNode pa = namenode.item(0);
- if (namenode.count() > 0) {
+ if (!namenode.isEmpty()) {
for (int i = 0; i < plotobjs.count(); ++i) {
- QList<KPlotPoint*> points = plotobjs[i]->points();
+ QList<KPlotPoint*> points = plotobjs.at(i)->points();
foreach(const KPlotPoint *o, points) {
txtstr << (int)o->y() ;
break;//first no keyframes
return allExtensions.simplified();
}
-void ProjectList::slotAddClip(const QString url, const QString &groupName, const QString &groupId)
+void ProjectList::slotAddClip(const QString &url, const QString &groupName, const QString &groupId)
{
kDebug()<<"// Adding clip: "<<url;
QList <QUrl> list;
slotAddClip(list, groupName, groupId);
}
-void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &groupName, const QString &groupId)
+void ProjectList::slotAddClip(const QList <QUrl> &givenList, const QString &groupName, const QString &groupId)
{
if (!m_commandStack)
kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
l->addWidget(c);
l->addStretch(5);
f->setLayout(l);
+
QPointer<KFileDialog> d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, kapp->activeWindow(), f);
d->setOperationMode(KFileDialog::Opening);
d->setMode(KFile::Files);
if (d->exec() == QDialog::Accepted) {
KdenliveSettings::setAutoimagetransparency(c->isChecked());
- }
- list = d->selectedUrls();
- if (b->isChecked() && list.count() == 1) {
- // Check for image sequence
- KUrl url = list.at(0);
- QString fileName = url.fileName().section('.', 0, -2);
- if (fileName.at(fileName.size() - 1).isDigit()) {
- KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
- if (item.mimetype().startsWith("image")) {
- // import as sequence if we found more than one image in the sequence
- QStringList list;
- QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &list);
- int count = list.count();
- if (count > 1) {
- delete d;
- QStringList groupInfo = getGroup();
-
- // get image sequence base name
- while (fileName.at(fileName.size() - 1).isDigit()) {
- fileName.chop(1);
+ list = d->selectedUrls();
+ if (b->isChecked() && list.count() == 1) {
+ // Check for image sequence
+ KUrl url = list.at(0);
+ QString fileName = url.fileName().section('.', 0, -2);
+ if (fileName.at(fileName.size() - 1).isDigit()) {
+ KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
+ if (item.mimetype().startsWith("image")) {
+ // import as sequence if we found more than one image in the sequence
+ QStringList list;
+ QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &list);
+ int count = list.count();
+ if (count > 1) {
+ delete d;
+ QStringList groupInfo = getGroup();
+
+ // get image sequence base name
+ while (fileName.at(fileName.size() - 1).isDigit()) {
+ fileName.chop(1);
+ }
+ QMap <QString, QString> properties;
+ properties.insert("name", fileName);
+ properties.insert("resource", pattern);
+ properties.insert("in", "0");
+ QString duration = m_timecode.reformatSeparators(KdenliveSettings::sequence_duration());
+ properties.insert("out", QString::number(m_doc->getFramePos(duration) * count));
+ properties.insert("ttl", QString::number(m_doc->getFramePos(duration)));
+ properties.insert("loop", QString::number(false));
+ properties.insert("crop", QString::number(false));
+ properties.insert("fade", QString::number(false));
+ properties.insert("luma_duration", QString::number(m_doc->getFramePos(m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))))));
+ m_doc->slotCreateSlideshowClipFile(properties, groupInfo.at(0), groupInfo.at(1));
+ return;
}
- QMap <QString, QString> properties;
- properties.insert("name", fileName);
- properties.insert("resource", pattern);
- properties.insert("in", "0");
- QString duration = m_timecode.reformatSeparators(KdenliveSettings::sequence_duration());
- properties.insert("out", QString::number(m_doc->getFramePos(duration) * count));
- properties.insert("ttl", QString::number(m_doc->getFramePos(duration)));
- properties.insert("loop", QString::number(false));
- properties.insert("crop", QString::number(false));
- properties.insert("fade", QString::number(false));
- properties.insert("luma_duration", QString::number(m_doc->getFramePos(m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))))));
- m_doc->slotCreateSlideshowClipFile(properties, groupInfo.at(0), groupInfo.at(1));
- return;
}
}
}
/** @brief Prepares removing the selected items. */
void slotRemoveClip();
- void slotAddClip(const QString url, const QString &groupName, const QString &groupId);
- void slotAddClip(const QList <QUrl> givenList = QList <QUrl> (), const QString &groupName = QString(), const QString &groupId = QString());
+ void slotAddClip(const QString &url, const QString &groupName, const QString &groupId);
+ void slotAddClip(const QList <QUrl> &givenList = QList <QUrl> (), const QString &groupName = QString(), const QString &groupId = QString());
/** @brief Adds, edits or deletes a folder item.
*
kDebug() << "Found : " << capturedFiles.count() << " new capture files";
kDebug() << capturedFiles;
- if (capturedFiles.count() > 0) {
+ if (!capturedFiles.isEmpty()) {
QPointer<ManageCapturesDialog> d = new ManageCapturesDialog(capturedFiles, this);
if (d->exec() == QDialog::Accepted) {
emit addProjectClipList(d->importFiles());
}
-bool Render::saveClip(int track, GenTime position, KUrl url, QString desc)
+bool Render::saveClip(int track, const GenTime &position, const KUrl &url, const QString &desc)
{
// find clip
Mlt::Service service(m_mltProducer->parent().get_service());
KMessageBox::sorry(0, i18n("Firewire is not enabled on your system.\n Please install Libiec61883 and recompile Kdenlive"));
}
-void Render::exportCurrentFrame(KUrl url, bool /*notify*/)
+void Render::exportCurrentFrame(const KUrl &url, bool /*notify*/)
{
if (!m_mltProducer) {
KMessageBox::sorry(qApp->activeWindow(), i18n("There is no clip, cannot extract frame."));
}
-bool Render::mltCutClip(int track, GenTime position)
+bool Render::mltCutClip(int track, const GenTime &position)
{
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) {
class Profile;
class Service;
class Event;
-};
+}
struct requestClipInfo {
QDomElement xml;
int imageHeight;
bool replaceProducer;
-bool operator==(const requestClipInfo &a)
-{
- return clipId == a.clipId;
-}
+ bool operator==(const requestClipInfo &a)
+ {
+ return clipId == a.clipId;
+ }
};
class MltErrorEvent : public QEvent
class Render: public AbstractRender
{
-Q_OBJECT public:
+ Q_OBJECT public:
enum FailStates { OK = 0,
APP_NOEXIST
void saveZone(KUrl url, QString desc, QPoint zone);
/** @brief Save a clip in timeline to an xml playlist. */
- bool saveClip(int track, GenTime position, KUrl url, QString desc = QString());
+ bool saveClip(int track, const GenTime &position, const KUrl &url, const QString &desc = QString());
/** @brief Return true if we are currently playing */
bool isPlaying() const;
double consumerRatio() const;
/** @brief Saves current producer frame as an image. */
- void exportCurrentFrame(KUrl url, bool notify);
+ void exportCurrentFrame(const KUrl &url, bool notify);
/** @brief Change the Mlt PROFILE
* @param profileName The MLT profile name
Mlt::Producer *checkSlowMotionProducer(Mlt::Producer *prod, QDomElement element);
int mltInsertClip(ItemInfo info, QDomElement element, Mlt::Producer *prod, bool overwrite = false, bool push = false);
bool mltUpdateClip(Mlt::Tractor *tractor, ItemInfo info, QDomElement element, Mlt::Producer *prod);
- bool mltCutClip(int track, GenTime position);
+ bool mltCutClip(int track, const GenTime &position);
void mltInsertSpace(QMap <int, int> trackClipStartList, QMap <int, int> trackTransitionStartList, int track, const GenTime &duration, const GenTime &timeOffset);
int mltGetSpaceLength(const GenTime &pos, int track, bool fromBlankStart);
bool mltAddEffect(Mlt::Service service, EffectsParameterList params, int duration, bool doRefresh);
bool mltAddTrackEffect(int track, EffectsParameterList params);
- /** @brief Enable / disable clip effects.
+ /** @brief Enable / disable clip effects.
* @param track The track where the clip is
* @param position The start position of the clip
* @param effectIndexes The list of effect indexes to enable / disable
}
-void RenderWidget::saveProfile(QDomElement newprofile)
+void RenderWidget::saveProfile(const QDomElement &newprofile)
{
QString exportFile = KStandardDirs::locateLocal("appdata", "export/customprofiles.xml");
QDomDocument doc;
}
-void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap <QString, QString> metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio)
+void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap<QString, QString> &metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio)
{
QListWidgetItem *item = m_view.size_list->currentItem();
if (!item) return;
virtual void keyPressEvent(QKeyEvent *e);
public slots:
- void slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap <QString, QString> metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio);
+ void slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap <QString, QString> &metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio);
private slots:
void slotUpdateButtons(const KUrl &url);
/** @brief Check if a job needs to be started. */
void checkRenderStatus();
void startRendering(RenderJobItem *item);
- void saveProfile(QDomElement newprofile);
+ void saveProfile(const QDomElement &newprofile);
QList <QListWidgetItem *> m_renderItems;
QList <QListWidgetItem *> m_renderCategory;
void errorMessage(const QString &message);
void openDvdWizard(const QString &url);
/** Send the infos about rendering that will be saved in the document:
(profile destination, profile name and url of rendered file */
- void selectedRenderProfile(QMap <QString, QString> renderProps);
+ void selectedRenderProfile(const QMap <QString, QString> &renderProps);
void prepareRenderingData(bool scriptExport, bool zoneOnly, const QString &chapterFile);
void shutdown();
};
public:
explicit SmallRuler(Monitor *manager, Render *render, QWidget *parent = 0);
- virtual void mousePressEvent(QMouseEvent * event);
- virtual void mouseMoveEvent(QMouseEvent * event);
- virtual void mouseReleaseEvent(QMouseEvent * event);
void adjustScale(int maximum);
void setZone(int start, int end);
void setZoneStart();
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *);
void leaveEvent(QEvent * event);
+ void mousePressEvent(QMouseEvent * event);
+ void mouseMoveEvent(QMouseEvent * event);
+ void mouseReleaseEvent(QMouseEvent * event);
private:
int m_cursorPosition;
setTimeCodeFormat(KdenliveSettings::frametimecode());
}
-void TimecodeDisplay::updateTimeCode(Timecode t)
+void TimecodeDisplay::updateTimeCode(const Timecode &t)
{
m_timecode = t;
setTimeCodeFormat(KdenliveSettings::frametimecode());
/** @brief Sets timecode for current project.
* @param t the new timecode */
- void updateTimeCode(Timecode t);
+ void updateTimeCode(const Timecode &t);
virtual void stepBy(int steps);
fs->setMode(KFile::File);
fs->setConfirmOverwrite(true);
fs->setKeepLocation(true);
- fs->exec();
- if (fs) url = fs->selectedUrl();
+ if (fs->exec()) {
+ url = fs->selectedUrl();
+ }
delete fs;
}
if (!url.isEmpty()) {
static void refreshTitleTemplates();
protected:
- virtual void resizeEvent(QResizeEvent * event);
- virtual void keyPressEvent(QKeyEvent *e);
- virtual QSize sizeHint() const;
+ void resizeEvent(QResizeEvent * event);
+ void keyPressEvent(QKeyEvent *e);
+ QSize sizeHint() const;
private:
void updatePalette();
protected:
- virtual void keyPressEvent(QKeyEvent * event);
+ void keyPressEvent(QKeyEvent * event);
public slots:
void slotDeleteClip(const QString &clipId);
}
}
-void TransitionSettings::slotUpdateEffectParams(const QDomElement oldparam, const QDomElement param)
+void TransitionSettings::slotUpdateEffectParams(const QDomElement &oldparam, const QDomElement ¶m)
{
if (m_usedTransition) {
m_usedTransition->setTransitionParameters(param);
public slots:
void slotTransitionItemSelected(Transition* t, int nextTrack, const QPoint &p, bool update);
void slotTransitionChanged(bool reinit = true, bool updateCurrent = false);
- void slotUpdateEffectParams(const QDomElement, const QDomElement);
+ void slotUpdateEffectParams(const QDomElement &, const QDomElement&);
private slots:
/** @brief Sets the new B track for the transition (automatic or forced). */
{
}
-void AbstractService::slotStartSearch(const QString , int )
+void AbstractService::slotStartSearch(const QString & , int )
{
}
SERVICETYPE serviceType;
public slots:
- virtual void slotStartSearch(const QString searchText, int page = 0);
+ virtual void slotStartSearch(const QString &searchText, int page = 0);
virtual OnlineItemInfo displayItemDetails(QListWidgetItem *item);
virtual bool startItemPreview(QListWidgetItem *item);
virtual void stopItemPreview(QListWidgetItem *item);
delete m_previewProcess;
}
-void ArchiveOrg::slotStartSearch(const QString searchText, int page)
+void ArchiveOrg::slotStartSearch(const QString &searchText, int page)
{
m_listWidget->clear();
QString uri = "http://www.archive.org/advancedsearch.php?q=";
public:
explicit ArchiveOrg(QListWidget *listWidget, QObject * parent = 0);
virtual ~ArchiveOrg();
- virtual QString getExtension(QListWidgetItem *item);
- virtual QString getDefaultDownloadName(QListWidgetItem *item);
+ QString getExtension(QListWidgetItem *item);
+ QString getDefaultDownloadName(QListWidgetItem *item);
public slots:
- virtual void slotStartSearch(const QString searchText, int page = 0);
- virtual OnlineItemInfo displayItemDetails(QListWidgetItem *item);
- virtual bool startItemPreview(QListWidgetItem *item);
- virtual void stopItemPreview(QListWidgetItem *item);
+ void slotStartSearch(const QString &searchText, int page = 0);
+ OnlineItemInfo displayItemDetails(QListWidgetItem *item);
+ bool startItemPreview(QListWidgetItem *item);
+ void stopItemPreview(QListWidgetItem *item);
private slots:
void slotShowResults(KJob* job);
delete m_previewProcess;
}
-void FreeSound::slotStartSearch(const QString searchText, int page)
+void FreeSound::slotStartSearch(const QString &searchText, int page)
{
m_listWidget->clear();
QString uri = "http://www.freesound.org/api/sounds/search/?q=";
uri.append(searchText);
- if (page > 1) uri.append("&p=" + QString::number(page));
+ if (page > 1)
+ uri.append("&p=" + QString::number(page));
uri.append("&api_key=a1772c8236e945a4bee30a64058dabf8");
KJob* resolveJob = KIO::storedGet( KUrl(uri), KIO::NoReload, KIO::HideProgressInfo );
public:
explicit FreeSound(QListWidget *listWidget, QObject * parent = 0);
~FreeSound();
- virtual QString getExtension(QListWidgetItem *item);
- virtual QString getDefaultDownloadName(QListWidgetItem *item);
+ QString getExtension(QListWidgetItem *item);
+ QString getDefaultDownloadName(QListWidgetItem *item);
public slots:
- virtual void slotStartSearch(const QString searchText, int page = 0);
- virtual OnlineItemInfo displayItemDetails(QListWidgetItem *item);
- virtual bool startItemPreview(QListWidgetItem *item);
- virtual void stopItemPreview(QListWidgetItem *item);
+ void slotStartSearch(const QString& searchText, int page = 0);
+ OnlineItemInfo displayItemDetails(QListWidgetItem *item);
+ bool startItemPreview(QListWidgetItem *item);
+ void stopItemPreview(QListWidgetItem *item);
private slots:
void slotShowResults(KJob* job);
{
}
-void OpenClipArt::slotStartSearch(const QString searchText, int page)
+void OpenClipArt::slotStartSearch(const QString &searchText, int page)
{
m_listWidget->clear();
QString uri = "http://openclipart.org/api/search/?query=";
uri.append(searchText);
- if (page > 1) uri.append("&page=" + QString::number(page));
+ if (page > 1)
+ uri.append("&page=" + QString::number(page));
KJob* resolveJob = KIO::storedGet( KUrl(uri), KIO::NoReload, KIO::HideProgressInfo );
connect( resolveJob, SIGNAL(result(KJob*)), this, SLOT(slotShowResults(KJob*)) );
public:
explicit OpenClipArt(QListWidget *listWidget, QObject * parent = 0);
~OpenClipArt();
- virtual QString getExtension(QListWidgetItem *item);
- virtual QString getDefaultDownloadName(QListWidgetItem *item);
+ QString getExtension(QListWidgetItem *item);
+ QString getDefaultDownloadName(QListWidgetItem *item);
public slots:
- virtual void slotStartSearch(const QString searchText, int page = 0);
- virtual OnlineItemInfo displayItemDetails(QListWidgetItem *item);
+ void slotStartSearch(const QString &searchText, int page = 0);
+ OnlineItemInfo displayItemDetails(QListWidgetItem *item);
private slots:
char *devName = NULL;
int captureEnabled = 1;
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0) {
- fprintf(stderr, "Cannot get capabilities.");
- //return NULL;
+ fprintf(stderr, "Cannot get capabilities.");
+ //return NULL;
}
else {
- devName = strdup((char*) cap.card);
+ devName = strdup((char*) cap.card);
if(!cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) {
// Device cannot capture
captureEnabled = 0;
}
if (captureEnabled) {
- struct v4l2_format format;
+ struct v4l2_format format;
memset(&format,0,sizeof(format));
format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
struct v4l2_frmivalenum rates;
memset(&rates,0,sizeof(rates));
- char value[200];
+ char value[200];
while (ioctl(fd, VIDIOC_ENUM_FMT, &fmt) != -1)
{
- if (pixelformatdescription.length() > 2000) break;
+ if (pixelformatdescription.length() > 2000) break;
if (snprintf( value, sizeof(value), ">%c%c%c%c", fmt.pixelformat >> 0, fmt.pixelformat >> 8, fmt.pixelformat >> 16, fmt.pixelformat >> 24 ) > 0)
- pixelformatdescription.append(value);
+ pixelformatdescription.append(value);
fprintf(stderr, "detected format: %s: %c%c%c%c\n", fmt.description, fmt.pixelformat >> 0, fmt.pixelformat >> 8, fmt.pixelformat >> 16, fmt.pixelformat >> 24);
sizes.pixel_format = fmt.pixelformat;
sizes.index = 0;
// Query supported frame size
while (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &sizes) != -1) {
- struct v4l2_frmsize_discrete image_size = sizes.discrete;
+ struct v4l2_frmsize_discrete image_size = sizes.discrete;
// Query supported frame rates
rates.index = 0;
rates.pixel_format = fmt.pixelformat;
rates.height = image_size.height;
if (pixelformatdescription.length() > 2000) break;
if (snprintf( value, sizeof(value), ":%dx%d=", image_size.width, image_size.height ) > 0)
- pixelformatdescription.append(value);
+ pixelformatdescription.append(value);
fprintf(stderr, "Size: %dx%d: ", image_size.width, image_size.height);
while (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &rates) != -1) {
- if (pixelformatdescription.length() > 2000) break;
+ if (pixelformatdescription.length() > 2000) break;
if (snprintf( value, sizeof(value), "%d/%d,", rates.discrete.denominator, rates.discrete.numerator ) > 0)
- pixelformatdescription.append(value);
+ pixelformatdescription.append(value);
fprintf(stderr, "%d/%d, ", rates.discrete.numerator, rates.discrete.denominator);
- rates.index ++;
+ rates.index ++;
}
fprintf(stderr, "\n");
sizes.index++;
free(src);
QStringList result;
- if (devName == NULL) return result;
+ if (devName == NULL)
+ return result;
QString deviceName(devName);
result << (deviceName.isEmpty() ? input : deviceName) << pixelformatdescription;
return result;