- const QRectF txtBounding2 = painter->boundingRect(mapped, Qt::AlignHCenter | Qt::AlignVCenter, ' ' + m_clipName + ' ');
- //painter->fillRect(txtBounding2, frameColor);
- painter->setBrush(frameColor);
- painter->setPen(Qt::NoPen);
- painter->drawRoundedRect(txtBounding2, 3, 3);
- painter->setBrush(QBrush(Qt::NoBrush));
-
- //painter->setPen(QColor(0, 0, 0, 180));
- //painter->drawText(txtBounding, Qt::AlignCenter, m_clipName);
- if (m_videoOnly) {
- painter->drawPixmap(txtBounding2.topLeft() - QPointF(17, -1), m_videoPix);
- } else if (m_audioOnly) {
- painter->drawPixmap(txtBounding2.topLeft() - QPointF(17, -1), m_audioPix);
- }
- painter->setPen(Qt::white);
- painter->drawText(txtBounding2, Qt::AlignCenter, m_clipName);
-
-
- // draw markers
- if (isEnabled() && m_clip) {
- QList < CommentedTime > markers = m_clip->commentedSnapMarkers();
- QList < CommentedTime >::Iterator it = markers.begin();
- GenTime pos;
- double framepos;
- QBrush markerBrush(QColor(120, 120, 0, 140));
- QPen pen = painter->pen();
- pen.setColor(QColor(255, 255, 255, 200));
- pen.setStyle(Qt::DotLine);
-
- for (; it != markers.end(); ++it) {
- pos = GenTime((int)((*it).time().frames(m_fps) / qAbs(m_speed) + 0.5), m_fps) - cropStart();
- if (pos > GenTime()) {
- if (pos > cropDuration()) break;
- QLineF l(rect().x() + pos.frames(m_fps), rect().y(), rect().x() + pos.frames(m_fps), rect().bottom());
- QLineF l2 = painter->matrix().map(l);
- painter->setPen(pen);
- painter->drawLine(l2);
- if (KdenliveSettings::showmarkers()) {
- framepos = rect().x() + pos.frames(m_fps);
- const QRectF r1(framepos + 0.04, 10, rect().width() - framepos - 2, rect().height() - 10);
- const QRectF r2 = painter->matrix().mapRect(r1);
- const QRectF txtBounding3 = painter->boundingRect(r2, Qt::AlignLeft | Qt::AlignTop, ' ' + (*it).comment() + ' ');
- painter->setBrush(markerBrush);
- painter->setPen(Qt::NoPen);
- painter->drawRoundedRect(txtBounding3, 3, 3);
- painter->setBrush(QBrush(Qt::NoBrush));
- painter->setPen(Qt::white);
- painter->drawText(txtBounding3, Qt::AlignCenter, (*it).comment());
+ // only paint details if clip is big enough
+ if (mapped.width() > 20) {
+
+ // Draw effects names
+ 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);
+ 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->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->fillRect(txtBounding2.adjusted(-3, 0, 0, 0), textBgColor);
+ painter->setBrush(QBrush(Qt::NoBrush));
+ painter->setPen(textColor);
+ if (m_videoOnly) {
+ painter->drawPixmap(txtBounding2.topLeft() - QPointF(17, -1), m_videoPix);
+ } else if (m_audioOnly) {
+ painter->drawPixmap(txtBounding2.topLeft() - QPointF(17, -1), m_audioPix);
+ }
+ painter->drawText(txtBounding2, Qt::AlignLeft, m_clipName);
+
+
+ // draw markers
+ if (isEnabled() && m_clip) {
+ QList < CommentedTime > markers = m_clip->commentedSnapMarkers();
+ QList < CommentedTime >::Iterator it = markers.begin();
+ GenTime pos;
+ double framepos;
+ QBrush markerBrush(QColor(120, 120, 0, 140));
+ QPen pen = painter->pen();
+
+ for (; it != markers.end(); ++it) {
+ pos = GenTime((int)((*it).time().frames(m_fps) / qAbs(m_speed) + 0.5), m_fps) - cropStart();
+ if (pos > GenTime()) {
+ 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);
+ painter->setPen(pen);
+ painter->drawLine(l2);
+ if (KdenliveSettings::showmarkers()) {
+ framepos = rect().x() + pos.frames(m_fps);
+ const QRectF r1(framepos + 0.04, rect().height()/3, rect().width() - framepos - 2, rect().height() / 2);
+ 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);
+ painter->setPen(pen);
+ painter->drawRect(txtBounding3);
+ painter->setBrush(Qt::NoBrush);
+ painter->setPen(Qt::white);
+ painter->drawText(txtBounding3, Qt::AlignCenter, (*it).comment());
+ }
+ //painter->fillRect(QRect(br.x() + framepos, br.y(), 10, br.height()), QBrush(QColor(0, 0, 0, 150)));