setBrush(QColor(colour.left(7)));
} else if (m_clipType == IMAGE || m_clipType == TEXT) {
setBrush(QColor(141, 166, 215));
- m_startPix = KThumb::getImage(KUrl(clip->getProperty("resource")), (int)(KdenliveSettings::trackheight() * KdenliveSettings::project_display_ratio()), KdenliveSettings::trackheight());
+ //m_startPix = KThumb::getImage(KUrl(clip->getProperty("resource")), (int)(KdenliveSettings::trackheight() * KdenliveSettings::project_display_ratio()), KdenliveSettings::trackheight());
} else if (m_clipType == AUDIO) {
setBrush(QColor(141, 215, 166));
connect(clip, SIGNAL(gotAudioData()), this, SLOT(slotGotAudioData()));
ClipItem *ClipItem::clone(ItemInfo info) const
{
ClipItem *duplicate = new ClipItem(m_clip, info, m_fps, m_speed);
- if (info.cropStart == m_cropStart) duplicate->slotSetStartThumb(m_startPix);
- if (info.cropStart + (info.endPos - info.startPos) == m_cropStart + m_cropDuration) duplicate->slotSetEndThumb(m_endPix);
- kDebug() << "// CLoning clip: " << (info.cropStart + (info.endPos - info.startPos)).frames(m_fps) << ", CURRENT end: " << (cropStart() + duration()).frames(m_fps);
+ if (m_clipType == IMAGE || m_clipType == TEXT) duplicate->slotSetStartThumb(m_startPix);
+ else {
+ if (info.cropStart == m_cropStart) duplicate->slotSetStartThumb(m_startPix);
+ if (info.cropStart + (info.endPos - info.startPos) == m_cropStart + m_cropDuration) duplicate->slotSetEndThumb(m_endPix);
+ }
+ //kDebug() << "// CLoning clip: " << (info.cropStart + (info.endPos - info.startPos)).frames(m_fps) << ", CURRENT end: " << (cropStart() + duration()).frames(m_fps);
duplicate->setEffectList(m_effectList.clone());
duplicate->setVideoOnly(m_videoOnly);
duplicate->setAudioOnly(m_audioOnly);
return effectAt(m_selectedEffect);
}
-void ClipItem::resetThumbs()
+void ClipItem::resetThumbs(bool clearExistingThumbs)
{
- m_startPix = QPixmap();
- m_endPix = QPixmap();
+ if (clearExistingThumbs) {
+ m_startPix = QPixmap();
+ m_endPix = QPixmap();
+ m_audioThumbCachePic.clear();
+ }
slotFetchThumbs();
- m_audioThumbCachePic.clear();
}
QString colour = m_clip->getProperty("colour");
colour = colour.replace(0, 2, "#");
setBrush(QColor(colour.left(7)));
- } else resetThumbs();
+ } else resetThumbs(checkDuration);
}
void ClipItem::slotFetchThumbs()
{
+ if (m_clipType == IMAGE || m_clipType == TEXT) {
+ if (m_startPix.isNull()) {
+ m_startPix = KThumb::getImage(KUrl(m_clip->getProperty("resource")), (int)(KdenliveSettings::trackheight() * KdenliveSettings::project_display_ratio()), KdenliveSettings::trackheight());
+ update();
+ }
+ return;
+ }
+
if (m_endPix.isNull() && m_startPix.isNull()) {
m_startThumbRequested = true;
m_endThumbRequested = true;
QRectF mappedRect;
if (m_clipType == AV && !isAudioOnly()) {
QRectF re = br;
- re.setTop(re.y() + re.height() / 2);
mappedRect = painter->matrix().mapRect(re);
- //painter->fillRect(mappedRect, QBrush(QColor(200, 200, 200, 140)));
+ mappedRect.setTop(mappedRect.bottom() - re.height() / 2);
} else mappedRect = mapped;
int channels = baseClip()->getProperty("channels").toInt();
if (m_timeLine && m_timeLine->state() == QTimeLine::Running) {
qreal value = m_timeLine->currentValue();
txtBounding.setWidth(txtBounding.width() * value);
- markerBrush.setColor(QColor(50 + 200 * (1.0 - value), 50, 50, 100 + 50 * value));
+ markerBrush.setColor(QColor(50 + 200 *(1.0 - value), 50, 50, 100 + 50 * value));
} else markerBrush.setColor(QColor(50, 50, 50, 150));
painter->setBrush(markerBrush);
painter->setPen(Qt::NoPen);
}*/
// draw effect or transition keyframes
- if (itemWidth > 20) drawKeyFrames(painter, exposed);
+ if (mapped.width() > 20) drawKeyFrames(painter, exposed);
painter->setMatrixEnabled(true);
//kDebug() << "// PREP AUDIO THMB FRMO : scale:" << pixelForOneFrame<< ", from: " << startpixel << ", to: " << endpixel;
//if ( (!audioThumbWasDrawn || framePixelWidth!=pixelForOneFrame ) && !baseClip()->audioFrameChache.isEmpty()){
- for (int startCache = startpixel - startpixel % 100;startCache < endpixel;startCache += 100) {
+ for (int startCache = startpixel - startpixel % 100; startCache < endpixel; startCache += 100) {
//kDebug() << "creating " << startCache;
//if (framePixelWidth!=pixelForOneFrame ||
if (m_framePixelWidth == pixelForOneFrame && m_audioThumbCachePic.contains(startCache))
int channelHeight = m_audioThumbCachePic[startCache].height() / channels;
- for (int i = 0;i < channels;i++) {
+ for (int i = 0; i < channels; i++) {
positiveChannelPaths[i].moveTo(0, channelHeight*i + channelHeight / 2);
negativeChannelPaths[i].moveTo(0, channelHeight*i + channelHeight / 2);
}
- for (int samples = 0;samples <= 100;samples++) {
+ for (int samples = 0; samples <= 100; samples++) {
double frame = (double)(samples + startCache - 0) / pixelForOneFrame;
int sample = (int)((frame - (int)(frame)) * 20); // AUDIO_FRAME_SIZE
if (frame < 0 || sample < 0 || sample > 19)
continue;
QMap<int, QByteArray> frame_channel_data = baseClip()->m_audioFrameCache[(int)frame];
- for (int channel = 0;channel < channels && frame_channel_data[channel].size() > 0;channel++) {
+ for (int channel = 0; channel < channels && frame_channel_data[channel].size() > 0; channel++) {
int y = channelHeight * channel + channelHeight / 2;
int delta = (int)(frame_channel_data[channel][sample] - 127 / 2) * channelHeight / 64;
negativeChannelPaths[channel].lineTo(samples, 0.1 + y - delta);
}
}
- for (int channel = 0;channel < channels ;channel++)
+ for (int channel = 0; channel < channels ; channel++)
if (fullAreaDraw && samples == 100) {
positiveChannelPaths[channel].lineTo(samples, channelHeight*channel + channelHeight / 2);
negativeChannelPaths[channel].lineTo(samples, channelHeight*channel + channelHeight / 2);
pixpainter.setPen(QPen(QColor(0, 0, 0)));
pixpainter.setBrush(QBrush(QColor(60, 60, 60)));
- for (int i = 0;i < channels;i++) {
+ for (int i = 0; i < channels; i++) {
if (fullAreaDraw) {
//pixpainter.fillPath(positiveChannelPaths[i].united(negativeChannelPaths[i]),QBrush(Qt::SolidPattern));//or singleif looks better
pixpainter.drawPath(positiveChannelPaths[i].united(negativeChannelPaths[i]));//or singleif looks better
QTextStream txtNeu(&neu);
if (values.size() > 0)
txtNeu << (int)values[0].toDouble();
- for (int i = 0;i < separators.size() && i + 1 < values.size();i++) {
+ for (int i = 0; i < separators.size() && i + 1 < values.size(); i++) {
txtNeu << separators[i];
txtNeu << (int)(values[i+1].toDouble());
}