From 45adaf0e93ffa28bfeb3425a099ca95e70fd0d79 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Tue, 28 May 2013 20:13:08 +0200 Subject: [PATCH] Fix indent. Const'ref. Optimization. Clean up code --- src/abstractmonitor.h | 12 +- src/clipitem.cpp | 445 +++++++++++++++++---------------- src/clipitem.h | 4 +- src/clipproperties.h | 2 +- src/headertrack.h | 12 +- src/initeffects.cpp | 2 +- src/initeffects.h | 2 +- src/kdenlivesettingsdialog.cpp | 27 +- src/keyframehelper.h | 14 +- src/kthumb.cpp | 2 +- src/kthumb.h | 6 +- src/mainwindow.cpp | 358 +++++++++++++------------- src/mainwindow.h | 8 +- src/managecapturesdialog.cpp | 4 +- src/mltdevicecapture.h | 2 +- src/monitor.cpp | 18 +- src/monitor.h | 24 +- src/monitormanager.cpp | 2 +- src/monitormanager.h | 2 +- src/parameterplotter.cpp | 4 +- src/projectlist.cpp | 71 +++--- src/projectlist.h | 4 +- src/recmonitor.cpp | 2 +- src/renderer.cpp | 6 +- src/renderer.h | 20 +- src/renderwidget.cpp | 4 +- src/renderwidget.h | 6 +- src/smallruler.h | 6 +- src/timecodedisplay.cpp | 2 +- src/timecodedisplay.h | 2 +- src/titlewidget.cpp | 5 +- src/titlewidget.h | 6 +- src/trackview.h | 2 +- src/transitionsettings.cpp | 2 +- src/transitionsettings.h | 2 +- src/utils/abstractservice.cpp | 2 +- src/utils/abstractservice.h | 2 +- src/utils/archiveorg.cpp | 2 +- src/utils/archiveorg.h | 12 +- src/utils/freesound.cpp | 5 +- src/utils/freesound.h | 12 +- src/utils/openclipart.cpp | 5 +- src/utils/openclipart.h | 8 +- src/v4l/v4lcapture.cpp | 27 +- 44 files changed, 586 insertions(+), 579 deletions(-) diff --git a/src/abstractmonitor.h b/src/abstractmonitor.h index db7ab3a5..537f5d74 100644 --- a/src/abstractmonitor.h +++ b/src/abstractmonitor.h @@ -41,7 +41,13 @@ Q_OBJECT public: * @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() {} @@ -62,10 +68,10 @@ private: 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,int,int,int); + void audioSamplesSignal(const QVector&,int,int,int); }; diff --git a/src/clipitem.cpp b/src/clipitem.cpp index b2af83a8..59d54d90 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -43,24 +43,24 @@ 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); @@ -162,7 +162,7 @@ void ClipItem::setEffectList(const EffectsList &effectList) 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"); @@ -261,23 +261,23 @@ void ClipItem::initEffect(QDomElement effect, int diff, int offset) } 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") { @@ -314,7 +314,7 @@ void ClipItem::initEffect(QDomElement effect, int diff, int offset) 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; } @@ -324,7 +324,7 @@ void ClipItem::initEffect(QDomElement effect, int diff, int offset) } 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; } @@ -357,10 +357,10 @@ bool ClipItem::checkKeyFrames(int width, int height, int previousDuration, int c 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; @@ -515,9 +515,9 @@ void ClipItem::resizeGeometries(const int index, int width, int height, int prev 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)); + } } } @@ -796,15 +796,15 @@ void ClipItem::paint(QPainter *painter, 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; @@ -823,28 +823,28 @@ void ClipItem::paint(QPainter *painter, 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); @@ -875,8 +875,8 @@ void ClipItem::paint(QPainter *painter, 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()) { @@ -920,14 +920,14 @@ void ClipItem::paint(QPainter *painter, 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()); + } } } @@ -943,27 +943,27 @@ void ClipItem::paint(QPainter *painter, 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) { @@ -978,7 +978,7 @@ void ClipItem::paint(QPainter *painter, 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) { @@ -987,8 +987,8 @@ void ClipItem::paint(QPainter *painter, 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()) { @@ -997,7 +997,7 @@ void ClipItem::paint(QPainter *painter, 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); @@ -1078,32 +1078,32 @@ OPERATIONTYPE ClipItem::operationMode(const QPointF &pos) 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 (parentItem()); - QList list = dragGroup->childItems(); - for (int i = 0; i < list.count(); ++i) { - if (list.at(i)->type() == AVWIDGET) { - ClipItem *c = static_cast (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 (parentItem()); + QList list = dragGroup->childItems(); + for (int i = 0; i < list.count(); ++i) { + if (list.at(i)->type() == AVWIDGET) { + ClipItem *c = static_cast (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 (parentItem()); - QList list = dragGroup->childItems(); - for (int i = 0; i < list.count(); ++i) { - if (list.at(i)->type() == AVWIDGET) { - ClipItem *c = static_cast (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 (parentItem()); + QList list = dragGroup->childItems(); + for (int i = 0; i < list.count(); ++i) { + if (list.at(i)->type() == AVWIDGET) { + ClipItem *c = static_cast (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; @@ -1163,12 +1163,12 @@ void ClipItem::slotPrepareAudioThumb(double pixelForOneFrame, int startpixel, in { // 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; @@ -1186,30 +1186,30 @@ void ClipItem::slotPrepareAudioThumb(double pixelForOneFrame, int startpixel, in 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; @@ -1219,40 +1219,40 @@ void ClipItem::slotPrepareAudioThumb(double pixelForOneFrame, int startpixel, in const QMap 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))); @@ -1387,9 +1387,9 @@ QVariant ClipItem::itemChange(GraphicsItemChange change, const QVariant &value) { if (change == QGraphicsItem::ItemSelectedChange) { if (value.toBool()) - setZValue(10); + setZValue(10); else - setZValue(2); + setZValue(2); } if (change == ItemPositionChange && scene()) { // calculate new position. @@ -1399,16 +1399,16 @@ QVariant ClipItem::itemChange(GraphicsItemChange change, const QVariant &value) 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(); @@ -1467,9 +1467,9 @@ QVariant ClipItem::itemChange(GraphicsItemChange change, const QVariant &value) return newPos; } if (change == ItemParentChange) { - QGraphicsItem* parent = value.value(); - if (parent) m_paintColor = m_baseColor.lighter(135); - else m_paintColor = m_baseColor; + QGraphicsItem* parent = value.value(); + if (parent) m_paintColor = m_baseColor.lighter(135); + else m_paintColor = m_baseColor; } return QGraphicsItem::itemChange(change, value); } @@ -1564,7 +1564,7 @@ EffectsParameterList ClipItem::addEffect(QDomElement effect, bool /*animate*/) 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()) { @@ -1578,13 +1578,13 @@ EffectsParameterList ClipItem::addEffect(QDomElement effect, bool /*animate*/) 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; @@ -1603,38 +1603,38 @@ EffectsParameterList ClipItem::addEffect(QDomElement effect, bool /*animate*/) // 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(); }*/ @@ -1709,7 +1709,7 @@ EffectsParameterList ClipItem::addEffect(QDomElement effect, bool /*animate*/) return parameters; } -void ClipItem::deleteEffect(QString index) +void ClipItem::deleteEffect(const QString &index) { bool needRepaint = false; int ix = index.toInt(); @@ -1717,11 +1717,11 @@ void ClipItem::deleteEffect(QString index) 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; @@ -1734,8 +1734,9 @@ void ClipItem::deleteEffect(QString index) 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); @@ -1792,11 +1793,11 @@ int ClipItem::nextFreeEffectGroupIndex() const 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; } @@ -1805,28 +1806,28 @@ int ClipItem::nextFreeEffectGroupIndex() const 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; @@ -1837,7 +1838,7 @@ void ClipItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) { if (isItemLocked()) event->setAccepted(false); else if (event->mimeData()->hasFormat("kdenlive/effectslist")) { - event->acceptProposedAction(); + event->acceptProposedAction(); } else event->setAccepted(false); } @@ -1873,9 +1874,9 @@ void ClipItem::setAudioOnly(bool force) 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(); } @@ -1993,7 +1994,7 @@ Mlt::Producer *ClipItem::getProducer(int track, bool trackSpecific) return m_clip->getProducer(trackSpecific ? track : -1); } -QMap ClipItem::adjustEffectsToDuration(int width, int height, ItemInfo oldInfo) +QMap ClipItem::adjustEffectsToDuration(int width, int height, const ItemInfo &oldInfo) { QMap effects; for (int i = 0; i < m_effectList.count(); ++i) { @@ -2020,7 +2021,7 @@ QMap ClipItem::adjustEffectsToDuration(int width, int height, } if (effects.contains(i)) { setFadeIn(out - in); - } + } } else { if (out != clipEnd) { effects[i] = effect.cloneNode().toElement(); @@ -2046,9 +2047,9 @@ QMap ClipItem::adjustEffectsToDuration(int width, int height, 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++) { @@ -2088,12 +2089,12 @@ bool ClipItem::updateNormalKeyframes(QDomElement parameter, ItemInfo oldInfo) const QStringList data = parameter.attribute("keyframes").split(';', QString::SkipEmptyParts); QMap 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)); } @@ -2138,7 +2139,7 @@ bool ClipItem::updateNormalKeyframes(QDomElement parameter, ItemInfo oldInfo) relPos = (out - lastPos) / (qreal)(i.key() - lastPos + 1); keyframes[out] = lastValue + (i.value() - lastValue) * relPos; } - } + } lastPos = i.key(); lastValue = i.value(); if (endFound) diff --git a/src/clipitem.h b/src/clipitem.h index c5158fd3..ac9f1df9 100644 --- a/src/clipitem.h +++ b/src/clipitem.h @@ -78,7 +78,7 @@ public: 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(); @@ -180,7 +180,7 @@ public: bool updateNormalKeyframes(QDomElement parameter, ItemInfo oldInfo); /** @brief Adjusts effects after a clip duration change. */ - QMap adjustEffectsToDuration(int width, int height, ItemInfo oldInfo); + QMap adjustEffectsToDuration(int width, int height, const ItemInfo &oldInfo); /** Returns the necessary (audio, video, general) producer. * @param track Track of the requested producer diff --git a/src/clipproperties.h b/src/clipproperties.h index 0753b49d..e3a93702 100644 --- a/src/clipproperties.h +++ b/src/clipproperties.h @@ -102,7 +102,7 @@ private: void loadVideoProperties(const QMap &props); signals: - void addMarkers(const QString &, QList ); + void addMarkers(const QString &, const QList &); void deleteProxy(const QString&); void applyNewClipProperties(const QString&, const QMap &, const QMap &, bool, bool); void saveMarkers(const QString &id); diff --git a/src/headertrack.h b/src/headertrack.h index c2ca783c..6d208982 100644 --- a/src/headertrack.h +++ b/src/headertrack.h @@ -41,10 +41,10 @@ public: 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; @@ -63,10 +63,10 @@ signals: 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); }; diff --git a/src/initeffects.cpp b/src/initeffects.cpp index 7a7b1609..c706f6a6 100644 --- a/src/initeffects.cpp +++ b/src/initeffects.cpp @@ -116,7 +116,7 @@ void initEffects::refreshLumas() } // static -QDomDocument initEffects::getUsedCustomEffects(QMap effectids) +QDomDocument initEffects::getUsedCustomEffects(const QMap & effectids) { QMapIterator i(effectids); int ix; diff --git a/src/initeffects.h b/src/initeffects.h index 780a8056..2b2a6c28 100644 --- a/src/initeffects.h +++ b/src/initeffects.h @@ -57,7 +57,7 @@ public: 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 effectids); + static QDomDocument getUsedCustomEffects(const QMap &effectids); /** @brief Fills the transitions list. * @param repository MLT repository diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 50e3dea6..f8eb77f2 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -487,14 +487,11 @@ void KdenliveSettingsDialog::slotEditVideoApplication() { KService::Ptr service; QPointer 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; } @@ -502,14 +499,11 @@ void KdenliveSettingsDialog::slotEditAudioApplication() { KService::Ptr service; QPointer 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; } @@ -517,13 +511,10 @@ void KdenliveSettingsDialog::slotEditImageApplication() { KService::Ptr service; QPointer 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; } diff --git a/src/keyframehelper.h b/src/keyframehelper.h index 6d1f9a38..701609bf 100644 --- a/src/keyframehelper.h +++ b/src/keyframehelper.h @@ -36,13 +36,13 @@ public: 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; diff --git a/src/kthumb.cpp b/src/kthumb.cpp index 686b7a1a..3d660b55 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -93,7 +93,7 @@ void KThumb::updateThumbUrl(const QString &hash) 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"; diff --git a/src/kthumb.h b/src/kthumb.h index 961b6972..cecf58a5 100644 --- a/src/kthumb.h +++ b/src/kthumb.h @@ -71,7 +71,7 @@ public: 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: @@ -109,8 +109,8 @@ private: 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(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c4c1515a..40288fc2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -157,10 +157,10 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & 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) @@ -176,9 +176,9 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & 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(); } @@ -406,7 +406,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & 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)); @@ -436,7 +436,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & 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(); @@ -535,7 +535,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & 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); @@ -601,25 +601,25 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & QList docks = findChildren(); 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"); @@ -840,7 +840,7 @@ void MainWindow::generateClip() ClipGenerator *iGenerator = qobject_cast(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 () << clipUrl); } @@ -908,7 +908,7 @@ void MainWindow::slotFullScreen() 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()) { @@ -979,23 +979,23 @@ void MainWindow::slotAdjustProjectMonitor() 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() @@ -2036,7 +2036,7 @@ bool MainWindow::closeCurrentDocument(bool saveChanges) 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 { @@ -2136,22 +2136,21 @@ void MainWindow::openFile(const KUrl &url) kDebug()<<"Opening archive, processing"; QPointer 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; } @@ -2539,18 +2538,18 @@ void MainWindow::slotUpdateMousePosition(int pos) 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()); } } @@ -2614,7 +2613,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha 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,bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*,int,QList,bool))); disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*,int,QList,int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*,int,QList,int))); disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*))); @@ -2622,13 +2621,13 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha 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)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(QString,QList))); + disconnect(m_projectList, SIGNAL(addMarkers(QString,QList)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(QString,QList))); m_effectStack->clear(); } //m_activeDocument->setRenderer(NULL); @@ -2936,11 +2935,11 @@ void MainWindow::slotAddClipMarker() QString id = clip->getId(); CommentedTime marker(pos, i18n("Marker"), KdenliveSettings::default_marker_type()); QPointer 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 () << 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; } @@ -3024,11 +3023,11 @@ void MainWindow::slotEditClipMarker() } QPointer 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 () <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); @@ -3052,7 +3051,7 @@ void MainWindow::slotAddMarkerGuideQuickly() 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 () <projectView()->slotAddGuide(false); @@ -3243,11 +3242,11 @@ void MainWindow::slotAddVideoEffect(QAction *result) 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); } @@ -3387,15 +3386,18 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip) 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); @@ -3412,20 +3414,20 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip) QList list = findChildren(); 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)), m_activeDocument->clipManager(), SLOT(slotRequestThumbs(QString,QList))); - m_activeDocument->clipManager()->slotRequestThumbs(QString('?' + clip->getId()), QList() << clip->getClipThumbFrame()); + // request clip thumbnails + connect(m_activeDocument->clipManager(), SIGNAL(gotClipPropertyThumbnail(QString,QImage)), dia, SLOT(slotGotThumbnail(QString,QImage))); + connect(dia, SIGNAL(requestThumb(QString,QList)), m_activeDocument->clipManager(), SLOT(slotRequestThumbs(QString,QList))); + m_activeDocument->clipManager()->slotRequestThumbs(QString('?' + clip->getId()), QList() << clip->getClipThumbFrame()); } connect(dia, SIGNAL(addMarkers(QString,QList)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(QString,QList))); @@ -3455,10 +3457,10 @@ void MainWindow::slotApplyNewClipProperties(const QString id, QMap cliplist, QMap commonproperties) +void MainWindow::slotShowClipProperties(const QList &cliplist, const QMap &commonproperties) { QPointer 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")); @@ -3490,9 +3492,9 @@ void MainWindow::customEvent(QEvent* e) 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); @@ -3705,9 +3707,9 @@ void MainWindow::slotClipInTimeline(const QString &clipId) 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(); @@ -3796,7 +3798,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) } -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"); @@ -4011,52 +4013,52 @@ void MainWindow::slotMaximizeCurrent(bool) void MainWindow::loadClipActions() { - QMenu* actionMenu= static_cast(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(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())); + } + } } @@ -4151,11 +4153,11 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS 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 getUrl = new KUrlRequesterDialog(path, i18n("Create Render Script"), this); - getUrl->fileDialog()->setMode(KFile::File); - getUrl->fileDialog()->setOperationMode(KFileDialog::Saving); + QPointer 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; @@ -4377,7 +4379,7 @@ void MainWindow::slotChangePalette(QAction *action, const QString &themename) // 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); @@ -4490,7 +4492,7 @@ void MainWindow::slotInsertZoneToTimeline() } -void MainWindow::slotDeleteProjectClips(QStringList ids, QMap folderids) +void MainWindow::slotDeleteProjectClips(const QStringList &ids, const QMap &folderids) { if (m_activeDocument && m_activeTimeline) { if (!ids.isEmpty()) { @@ -4565,10 +4567,10 @@ void MainWindow::slotOpenStopmotion() 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(m_scopesList.at(i)->widget())->autoRefreshEnabled())) request = true;*/ - //connect(m_stopmotion, SIGNAL(gotFrame(QImage)), static_cast(m_gfxScopesList.at(i)->widget()), SLOT(slotRenderZoneUpdated(QImage))); - //static_cast(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(m_scopesList.at(i)->widget())->autoRefreshEnabled())) request = true;*/ + //connect(m_stopmotion, SIGNAL(gotFrame(QImage)), static_cast(m_gfxScopesList.at(i)->widget()), SLOT(slotRenderZoneUpdated(QImage))); + //static_cast(m_scopesList.at(i)->widget())->slotMonitorCapture(); //} } m_stopmotion->show(); @@ -4672,28 +4674,28 @@ void MainWindow::slotChangePalette() 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 } } @@ -4707,18 +4709,18 @@ void MainWindow::slotSetDeinterlacer(int ix) { 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); @@ -4728,17 +4730,17 @@ void MainWindow::slotSetInterpolation(int ix) { 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); diff --git a/src/mainwindow.h b/src/mainwindow.h index 6b0f711a..185f5478 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -364,7 +364,7 @@ private slots: 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(); @@ -428,7 +428,7 @@ private slots: void slotAddProjectClip(KUrl url, stringMap data = stringMap()); void slotAddProjectClipList(KUrl::List urls); void slotShowClipProperties(DocClipBase *clip); - void slotShowClipProperties(QList cliplist, QMap commonproperties); + void slotShowClipProperties(const QList &cliplist, const QMap &commonproperties); void slotTimelineClipSelected(ClipItem* item, bool raise = true); void slotTrackSelected(int index, TrackInfo info, bool raise = true); void slotActivateTransitionView(Transition *); @@ -461,7 +461,7 @@ private slots: 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(); @@ -527,7 +527,7 @@ private slots: /** @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 folderids); + void slotDeleteProjectClips(const QStringList &ids, const QMap &folderids); void slotShowTitleBars(bool show); void slotSwitchTitles(); /** @brief Update the capture folder if user asked a change. */ diff --git a/src/managecapturesdialog.cpp b/src/managecapturesdialog.cpp index 5467460c..d5d8dfeb 100644 --- a/src/managecapturesdialog.cpp +++ b/src/managecapturesdialog.cpp @@ -65,7 +65,9 @@ ManageCapturesDialog::ManageCapturesDialog(const KUrl::List &files, QWidget * pa adjustSize(); } -ManageCapturesDialog::~ManageCapturesDialog() {} +ManageCapturesDialog::~ManageCapturesDialog() +{ +} void ManageCapturesDialog::slotCheckItemIcon() { diff --git a/src/mltdevicecapture.h b/src/mltdevicecapture.h index 032de2ce..535728e2 100644 --- a/src/mltdevicecapture.h +++ b/src/mltdevicecapture.h @@ -39,7 +39,7 @@ class Frame; class Event; class Producer; class Profile; -}; +} class MltDeviceCapture: public AbstractRender { diff --git a/src/monitor.cpp b/src/monitor.cpp index 68f7b249..f9fac8d2 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -228,7 +228,7 @@ QWidget *Monitor::container() } #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); @@ -610,13 +610,13 @@ void Monitor::slotExtractCurrentFrame() 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) @@ -958,7 +958,7 @@ void Monitor::resetProfile(const QString &profile) 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); @@ -970,7 +970,7 @@ const QString Monitor::sceneList() return render->sceneList(); } -void Monitor::setClipZone(QPoint pos) +void Monitor::setClipZone(const QPoint &pos) { if (m_currentClip == NULL) return; m_currentClip->setZone(pos); diff --git a/src/monitor.h b/src/monitor.h index 5dc6f2a4..c041bccb 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -101,18 +101,18 @@ public: 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); @@ -148,7 +148,7 @@ private: #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); @@ -167,7 +167,7 @@ private slots: 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); @@ -194,7 +194,7 @@ public slots: 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(); @@ -223,13 +223,13 @@ signals: 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 diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index 9cba158e..35ad43d8 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -205,7 +205,7 @@ void MonitorManager::slotEnd() else if (m_activeMonitor == m_projectMonitor) m_projectMonitor->slotEnd(); } -void MonitorManager::resetProfiles(Timecode tc) +void MonitorManager::resetProfiles(const Timecode &tc) { m_timecode = tc; slotResetProfiles(); diff --git a/src/monitormanager.h b/src/monitormanager.h index 70eb597f..b9f7de2c 100644 --- a/src/monitormanager.h +++ b/src/monitormanager.h @@ -37,7 +37,7 @@ public: 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. diff --git a/src/parameterplotter.cpp b/src/parameterplotter.cpp index f298bd79..c7ebc8c0 100644 --- a/src/parameterplotter.cpp +++ b/src/parameterplotter.cpp @@ -150,9 +150,9 @@ void ParameterPlotter::createParametersNew() 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 points = plotobjs[i]->points(); + QList points = plotobjs.at(i)->points(); foreach(const KPlotPoint *o, points) { txtstr << (int)o->y() ; break;//first no keyframes diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 0c395164..4979901e 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1707,7 +1707,7 @@ QString ProjectList::getExtensions() 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: "< list; @@ -1715,7 +1715,7 @@ void ProjectList::slotAddClip(const QString url, const QString &groupName, const slotAddClip(list, groupName, groupId); } -void ProjectList::slotAddClip(const QList givenList, const QString &groupName, const QString &groupId) +void ProjectList::slotAddClip(const QList &givenList, const QString &groupName, const QString &groupId) { if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK"; @@ -1735,45 +1735,46 @@ void ProjectList::slotAddClip(const QList givenList, const QString &group l->addWidget(c); l->addStretch(5); f->setLayout(l); + QPointer 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 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 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; } } } diff --git a/src/projectlist.h b/src/projectlist.h index 3470239d..fa5175c4 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -313,8 +313,8 @@ public slots: /** @brief Prepares removing the selected items. */ void slotRemoveClip(); - void slotAddClip(const QString url, const QString &groupName, const QString &groupId); - void slotAddClip(const QList givenList = QList (), const QString &groupName = QString(), const QString &groupId = QString()); + void slotAddClip(const QString &url, const QString &groupName, const QString &groupId); + void slotAddClip(const QList &givenList = QList (), const QString &groupName = QString(), const QString &groupId = QString()); /** @brief Adds, edits or deletes a folder item. * diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index 8aaa60e2..e104426e 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -970,7 +970,7 @@ void RecMonitor::manageCapturedFiles() kDebug() << "Found : " << capturedFiles.count() << " new capture files"; kDebug() << capturedFiles; - if (capturedFiles.count() > 0) { + if (!capturedFiles.isEmpty()) { QPointer d = new ManageCapturesDialog(capturedFiles, this); if (d->exec() == QDialog::Accepted) { emit addProjectClipList(d->importFiles()); diff --git a/src/renderer.cpp b/src/renderer.cpp index be5edc3d..301e2c34 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -1475,7 +1475,7 @@ void Render::saveZone(KUrl url, QString desc, QPoint zone) } -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()); @@ -1856,7 +1856,7 @@ void Render::exportFileToFirewire(QString /*srcFileName*/, int /*port*/, GenTime 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.")); @@ -2109,7 +2109,7 @@ int Render::mltInsertClip(ItemInfo info, QDomElement element, Mlt::Producer *pro } -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) { diff --git a/src/renderer.h b/src/renderer.h index e44e59a3..1f0edec1 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -65,7 +65,7 @@ class Filter; class Profile; class Service; class Event; -}; +} struct requestClipInfo { QDomElement xml; @@ -73,10 +73,10 @@ struct requestClipInfo { 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 @@ -94,7 +94,7 @@ private: class Render: public AbstractRender { -Q_OBJECT public: + Q_OBJECT public: enum FailStates { OK = 0, APP_NOEXIST @@ -159,7 +159,7 @@ Q_OBJECT public: 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; @@ -181,7 +181,7 @@ Q_OBJECT public: 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 @@ -215,7 +215,7 @@ Q_OBJECT public: 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 trackClipStartList, QMap trackTransitionStartList, int track, const GenTime &duration, const GenTime &timeOffset); int mltGetSpaceLength(const GenTime &pos, int track, bool fromBlankStart); @@ -239,7 +239,7 @@ Q_OBJECT public: 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 diff --git a/src/renderwidget.cpp b/src/renderwidget.cpp index 16228dba..a71ec3bf 100644 --- a/src/renderwidget.cpp +++ b/src/renderwidget.cpp @@ -516,7 +516,7 @@ void RenderWidget::slotSaveProfile() } -void RenderWidget::saveProfile(QDomElement newprofile) +void RenderWidget::saveProfile(const QDomElement &newprofile) { QString exportFile = KStandardDirs::locateLocal("appdata", "export/customprofiles.xml"); QDomDocument doc; @@ -860,7 +860,7 @@ void RenderWidget::slotPrepareExport(bool scriptExport) } -void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio) +void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap &metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio) { QListWidgetItem *item = m_view.size_list->currentItem(); if (!item) return; diff --git a/src/renderwidget.h b/src/renderwidget.h index 6e74ffa7..2c0c9cee 100644 --- a/src/renderwidget.h +++ b/src/renderwidget.h @@ -142,7 +142,7 @@ protected: virtual void keyPressEvent(QKeyEvent *e); public slots: - void slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio); + void slotExport(bool scriptExport, int zoneIn, int zoneOut, const QMap &metadata, const QString &playlistPath, const QString &scriptPath, bool exportAudio); private slots: void slotUpdateButtons(const KUrl &url); @@ -202,7 +202,7 @@ private: /** @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 m_renderItems; QList m_renderCategory; void errorMessage(const QString &message); @@ -212,7 +212,7 @@ signals: 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 renderProps); + void selectedRenderProfile(const QMap &renderProps); void prepareRenderingData(bool scriptExport, bool zoneOnly, const QString &chapterFile); void shutdown(); }; diff --git a/src/smallruler.h b/src/smallruler.h index 89bb0546..44451607 100644 --- a/src/smallruler.h +++ b/src/smallruler.h @@ -33,9 +33,6 @@ class SmallRuler : public QWidget 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(); @@ -49,6 +46,9 @@ protected: 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; diff --git a/src/timecodedisplay.cpp b/src/timecodedisplay.cpp index aa93a4a2..a98659ed 100644 --- a/src/timecodedisplay.cpp +++ b/src/timecodedisplay.cpp @@ -96,7 +96,7 @@ void TimecodeDisplay::slotUpdateTimeCodeFormat() setTimeCodeFormat(KdenliveSettings::frametimecode()); } -void TimecodeDisplay::updateTimeCode(Timecode t) +void TimecodeDisplay::updateTimeCode(const Timecode &t) { m_timecode = t; setTimeCodeFormat(KdenliveSettings::frametimecode()); diff --git a/src/timecodedisplay.h b/src/timecodedisplay.h index 467882e4..285bde74 100644 --- a/src/timecodedisplay.h +++ b/src/timecodedisplay.h @@ -72,7 +72,7 @@ public: /** @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); diff --git a/src/titlewidget.cpp b/src/titlewidget.cpp index 64272842..a92d6bac 100644 --- a/src/titlewidget.cpp +++ b/src/titlewidget.cpp @@ -1881,8 +1881,9 @@ void TitleWidget::saveTitle(KUrl url) 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()) { diff --git a/src/titlewidget.h b/src/titlewidget.h index 4c44b631..4c6a351e 100644 --- a/src/titlewidget.h +++ b/src/titlewidget.h @@ -104,9 +104,9 @@ public: 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: diff --git a/src/trackview.h b/src/trackview.h index 67477671..755b8e11 100644 --- a/src/trackview.h +++ b/src/trackview.h @@ -80,7 +80,7 @@ public: void updatePalette(); protected: - virtual void keyPressEvent(QKeyEvent * event); + void keyPressEvent(QKeyEvent * event); public slots: void slotDeleteClip(const QString &clipId); diff --git a/src/transitionsettings.cpp b/src/transitionsettings.cpp index 715ad244..6afc76ec 100644 --- a/src/transitionsettings.cpp +++ b/src/transitionsettings.cpp @@ -211,7 +211,7 @@ void TransitionSettings::slotTransitionItemSelected(Transition* t, int nextTrack } } -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); diff --git a/src/transitionsettings.h b/src/transitionsettings.h index ed59d25d..e1cc0c52 100644 --- a/src/transitionsettings.h +++ b/src/transitionsettings.h @@ -50,7 +50,7 @@ private: 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). */ diff --git a/src/utils/abstractservice.cpp b/src/utils/abstractservice.cpp index 6ccffff2..05917a56 100644 --- a/src/utils/abstractservice.cpp +++ b/src/utils/abstractservice.cpp @@ -38,7 +38,7 @@ AbstractService::~AbstractService() { } -void AbstractService::slotStartSearch(const QString , int ) +void AbstractService::slotStartSearch(const QString & , int ) { } diff --git a/src/utils/abstractservice.h b/src/utils/abstractservice.h index 2e52d634..1ed591e3 100644 --- a/src/utils/abstractservice.h +++ b/src/utils/abstractservice.h @@ -74,7 +74,7 @@ public: 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); diff --git a/src/utils/archiveorg.cpp b/src/utils/archiveorg.cpp index 60117898..e6b9296c 100644 --- a/src/utils/archiveorg.cpp +++ b/src/utils/archiveorg.cpp @@ -52,7 +52,7 @@ ArchiveOrg::~ArchiveOrg() 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="; diff --git a/src/utils/archiveorg.h b/src/utils/archiveorg.h index b0a5a0ec..3ef1446f 100644 --- a/src/utils/archiveorg.h +++ b/src/utils/archiveorg.h @@ -36,15 +36,15 @@ class ArchiveOrg : public AbstractService 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); diff --git a/src/utils/freesound.cpp b/src/utils/freesound.cpp index 650f208f..bd739317 100644 --- a/src/utils/freesound.cpp +++ b/src/utils/freesound.cpp @@ -50,12 +50,13 @@ FreeSound::~FreeSound() 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 ); diff --git a/src/utils/freesound.h b/src/utils/freesound.h index 03906093..db15d345 100644 --- a/src/utils/freesound.h +++ b/src/utils/freesound.h @@ -36,15 +36,15 @@ class FreeSound : public AbstractService 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); diff --git a/src/utils/openclipart.cpp b/src/utils/openclipart.cpp index 94a54a2e..2130cba3 100644 --- a/src/utils/openclipart.cpp +++ b/src/utils/openclipart.cpp @@ -39,12 +39,13 @@ OpenClipArt::~OpenClipArt() { } -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*)) ); diff --git a/src/utils/openclipart.h b/src/utils/openclipart.h index 1ba638c6..bc61a215 100644 --- a/src/utils/openclipart.h +++ b/src/utils/openclipart.h @@ -36,13 +36,13 @@ class OpenClipArt : public AbstractService 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: diff --git a/src/v4l/v4lcapture.cpp b/src/v4l/v4lcapture.cpp index bee35725..cf0e247c 100644 --- a/src/v4l/v4lcapture.cpp +++ b/src/v4l/v4lcapture.cpp @@ -59,11 +59,11 @@ QStringList V4lCaptureHandler::getDeviceName(const QString &input) 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; @@ -71,7 +71,7 @@ QStringList V4lCaptureHandler::getDeviceName(const QString &input) } if (captureEnabled) { - struct v4l2_format format; + struct v4l2_format format; memset(&format,0,sizeof(format)); format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -85,20 +85,20 @@ QStringList V4lCaptureHandler::getDeviceName(const QString &input) 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; @@ -106,14 +106,14 @@ QStringList V4lCaptureHandler::getDeviceName(const QString &input) 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++; @@ -125,7 +125,8 @@ QStringList V4lCaptureHandler::getDeviceName(const QString &input) 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; -- 2.39.5