]> git.sesse.net Git - kdenlive/commitdiff
* show image thumbnail in marker creation dialog
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 23 Jun 2008 19:10:14 +0000 (19:10 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 23 Jun 2008 19:10:14 +0000 (19:10 +0000)
* better keyframes handling
* small bugfixes

svn path=/branches/KDE4/; revision=2263

src/abstractclipitem.cpp
src/abstractclipitem.h
src/clipitem.cpp
src/customtrackview.cpp
src/kthumb.cpp
src/mainwindow.cpp
src/markerdialog.cpp
src/markerdialog.h
src/renderer.cpp
src/statusbarmessagelabel.cpp
src/trackview.cpp

index 31be18b6a40805a4adaa68d0b09722fe57fc7b27..160021fc8731712ae16b50784b729d6ebb4e0a42 100644 (file)
@@ -211,41 +211,56 @@ QPainterPath AbstractClipItem::lowerRectPart(QRectF br) {
 }
 
 void AbstractClipItem::drawKeyFrames(QPainter *painter, QRectF exposedRect) {
+    if (m_keyframes.count() < 2) return;
     QRectF br = rect();
     double maxw = br.width() / m_cropDuration.frames(m_fps);
-    double maxh = br.height() / 100.0;
-    if (m_keyframes.count() > 1) {
-        QMap<int, double>::const_iterator i = m_keyframes.constBegin();
-        double x1;
-        double y1;
-        double x2;
-        double y2;
-        QColor color(Qt::blue);
-        x1 = br.x() + maxw * (i.key() - m_cropStart.frames(m_fps));
-        y1 = br.bottom() - i.value() * maxh;
-        while (i != m_keyframes.constEnd()) {
-            if (i.key() == m_selectedKeyframe) color = QColor(Qt::red);
-            else color = QColor(Qt::blue);
-            ++i;
-            if (i == m_keyframes.constEnd()) break;
-            x2 = br.x() + maxw * (i.key() - m_cropStart.frames(m_fps));
-            y2 = br.bottom() - i.value() * maxh;
-            QLineF l(x1, y1, x2, y2);
-            painter->drawLine(l);
-            if (isSelected()) {
-                painter->fillRect(x1 - 3, y1 - 3, 6, 6, QBrush(color));
-            }
-            x1 = x2;
-            y1 = y2;
+    double maxh = br.height() / 100.0 * m_keyframeFactor;
+    double x1;
+    double y1;
+    double x2;
+    double y2;
+
+    // draw line showing default value
+    if (isSelected()) {
+        x1 = br.x();
+        x1 = br.right();
+        y1 = br.bottom() - m_keyframeDefault * maxh;
+        QLineF l(x1, y1, x2, y1);
+        painter->setPen(QColor(168, 168, 168, 180));
+        painter->drawLine(l);
+        l.translate(0, 1);
+        painter->setPen(QColor(108, 108, 108, 180));
+        painter->drawLine(l);
+        painter->setPen(QColor(Qt::white));
+    }
+
+    // draw keyframes
+    QMap<int, double>::const_iterator i = m_keyframes.constBegin();
+    QColor color(Qt::blue);
+    x1 = br.x() + maxw * (i.key() - m_cropStart.frames(m_fps));
+    y1 = br.bottom() - i.value() * maxh;
+    while (i != m_keyframes.constEnd()) {
+        if (i.key() == m_selectedKeyframe) color = QColor(Qt::red);
+        else color = QColor(Qt::blue);
+        ++i;
+        if (i == m_keyframes.constEnd()) break;
+        x2 = br.x() + maxw * (i.key() - m_cropStart.frames(m_fps));
+        y2 = br.bottom() - i.value() * maxh;
+        QLineF l(x1, y1, x2, y2);
+        painter->drawLine(l);
+        if (isSelected()) {
+            painter->fillRect(x1 - 3, y1 - 3, 6, 6, QBrush(color));
         }
-        if (isSelected()) painter->fillRect(x1 - 3, y1 - 3, 6, 6, QBrush(color));
+        x1 = x2;
+        y1 = y2;
     }
+    if (isSelected()) painter->fillRect(x1 - 3, y1 - 3, 6, 6, QBrush(color));
 }
 
 int AbstractClipItem::mouseOverKeyFrames(QPointF pos) {
     QRectF br = rect();
     double maxw = br.width() / m_cropDuration.frames(m_fps);
-    double maxh = br.height() / 100.0;
+    double maxh = br.height() / 100.0 * m_keyframeFactor;
     if (m_keyframes.count() > 1) {
         QMap<int, double>::const_iterator i = m_keyframes.constBegin();
         double x1;
@@ -254,7 +269,7 @@ int AbstractClipItem::mouseOverKeyFrames(QPointF pos) {
             x1 = br.x() + maxw * (i.key() - m_cropStart.frames(m_fps));
             y1 = br.bottom() - i.value() * maxh;
             if (qAbs(pos.x() - x1) < 6 && qAbs(pos.y() - y1) < 6) {
-                setToolTip("[" + QString::number(i.key()) + "x" + QString::number(i.value()) + "]");
+                setToolTip("[" + QString::number(i.key()) + " frames, " + QString::number(i.value(), 'f', 1) + "%]");
                 return i.key();
             } else if (x1 > pos.x()) break;
             ++i;
@@ -268,7 +283,7 @@ void AbstractClipItem::updateSelectedKeyFrame() {
     if (m_editedKeyframe == -1) return;
     QRectF br = rect();
     double maxw = br.width() / m_cropDuration.frames(m_fps);
-    double maxh = br.height() / 100.0;
+    double maxh = br.height() / 100.0 * m_keyframeFactor;
     update(br.x() + maxw * (m_selectedKeyframe - m_cropStart.frames(m_fps)) - 3, br.bottom() - m_keyframes[m_selectedKeyframe] * maxh - 3, 12, 12);
     m_selectedKeyframe = m_editedKeyframe;
     update(br.x() + maxw * (m_selectedKeyframe - m_cropStart.frames(m_fps)) - 3, br.bottom() - m_keyframes[m_selectedKeyframe] * maxh - 3, 12, 12);
@@ -277,8 +292,8 @@ void AbstractClipItem::updateSelectedKeyFrame() {
 void AbstractClipItem::updateKeyFramePos(const GenTime pos, const int value) {
     if (!m_keyframes.contains(m_selectedKeyframe)) return;
     QRectF br = rect();
-    double maxh = br.height() / 100.0;
-    double newval = (br.bottom() - value) / maxh;
+    double maxh = 100.0 / br.height();
+    double newval = (br.bottom() - value) * maxh;
     int newpos = (int) pos.frames(m_fps);
     int start = m_cropStart.frames(m_fps);
     int end = (m_cropStart + m_cropDuration).frames(m_fps);
@@ -300,7 +315,7 @@ void AbstractClipItem::updateKeyFramePos(const GenTime pos, const int value) {
     }
     newval = qMax(newval, 0.0);
     newval = qMin(newval, 100.0);
-
+    newval = newval / m_keyframeFactor;
     if (m_selectedKeyframe != newpos) m_keyframes.remove(m_selectedKeyframe);
     m_keyframes[newpos] = newval;
     m_selectedKeyframe = newpos;
@@ -309,8 +324,8 @@ void AbstractClipItem::updateKeyFramePos(const GenTime pos, const int value) {
 
 void AbstractClipItem::addKeyFrame(const GenTime pos, const int value) {
     QRectF br = rect();
-    double maxh = br.height() / 100.0;
-    double newval = (br.bottom() - value) / maxh;
+    double maxh = 100.0 / br.height() / m_keyframeFactor;
+    double newval = (br.bottom() - value) * maxh;
     int newpos = (int) pos.frames(m_fps) ;
     m_keyframes[newpos] = newval;
     m_selectedKeyframe = newpos;
index 6c35b726dc0318284983e08e0af6e45c5f6259ee..fdb948b169eb9c9de7119c70c30d9ce5daa577b6 100644 (file)
@@ -57,6 +57,8 @@ protected:
     GenTime m_startPos;
     GenTime m_maxDuration;
     QMap <int, double> m_keyframes;
+    double m_keyframeFactor;
+    double m_keyframeDefault;
     double m_fps;
     QPainterPath upperRectPart(QRectF);
     QPainterPath lowerRectPart(QRectF);
index fd9caa6bf4a18658f3f90a274f4fa6325919e114..16a173e6c0aa4257a97eb97601a595f5d81e146e 100644 (file)
@@ -51,10 +51,7 @@ ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, GenTime cropStart, double s
     m_maxDuration = clip->maxDuration();
     setAcceptDrops(true);
     audioThumbReady = clip->audioThumbCreated();
-    /*m_keyframes[0] = 50;
-    m_keyframes[30] = 20;
-    m_keyframes[70] = 90;
-    m_keyframes[100] = 10;*/
+
     /*
       m_cropStart = xml.attribute("in", 0).toInt();
       m_maxDuration = xml.attribute("duration", 0).toInt();
@@ -114,15 +111,10 @@ void ClipItem::initEffect(QDomElement effect) {
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
         if (!e.isNull() && e.attribute("type") == "keyframe") {
-            double max = e.attribute("max").toDouble();
-            double min = e.attribute("min").toDouble();
-            double def = e.attribute("default").toDouble();
-            double factor = e.attribute("factor", "1").toDouble();
-
+            QString def = e.attribute("default");
             // Effect has a keyframe type parameter, we need to set the values
             if (e.attribute("keyframes").isEmpty()) {
-                // no keyframes defined, set up 2 keyframes (start and end) with default value.
-                e.setAttribute("keyframes", QString::number(m_cropStart.frames(m_fps)) + ":" + QString::number(100 * def / (max - min)) + ";" + QString::number((m_cropStart + m_cropDuration).frames(m_fps)) + ":" + QString::number(100 * def / (max - min)));
+                e.setAttribute("keyframes", QString::number(m_cropStart.frames(m_fps)) + ":" + def + ";" + QString::number((m_cropStart + m_cropDuration).frames(m_fps)) + ":" + def);
                 //kDebug() << "///// EFFECT KEYFRAMES INITED: " << e.attribute("keyframes");
                 break;
             }
@@ -132,7 +124,7 @@ void ClipItem::initEffect(QDomElement effect) {
 
 
 void ClipItem::setSelectedEffect(int ix) {
-    //if (ix == m_selectedEffect) return;
+
     m_selectedEffect = ix;
     QDomElement effect = effectAt(m_selectedEffect);
     QDomNodeList params = effect.elementsByTagName("parameter");
@@ -142,23 +134,14 @@ void ClipItem::setSelectedEffect(int ix) {
             m_keyframes.clear();
             double max = e.attribute("max").toDouble();
             double min = e.attribute("min").toDouble();
-            double def = e.attribute("default").toDouble();
-            double factor = e.attribute("factor", "1").toDouble();
-
-            // Effect has a keyframe type parameter, we need to set the values
-            /*if (e.attribute("keyframes").isEmpty()) {
-                // no keyframes defined, set up 2 keyframes (start and end) with default value.
-                m_keyframes[m_cropStart.frames(m_fps)] = 100 * def / (max - min);
-                m_keyframes[(m_cropStart + m_cropDuration).frames(m_fps)] = 100 * def / (max - min);
-            e.setAttribute("keyframes", QString::number(m_cropStart.frames(m_fps)) + ":" + QString::number(100 * def / (max - min)) + ";" + QString::number((m_cropStart + m_cropDuration).frames(m_fps)) + ":" + QString::number(100 * def / (max - min)));
-            } else {*/
+            m_keyframeFactor = 100.0 / (max - min);
+            m_keyframeDefault = e.attribute("default").toDouble();
             // parse keyframes
             QStringList keyframes = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
             foreach(QString str, keyframes) {
                 int pos = str.section(":", 0, 0).toInt();
                 double val = str.section(":", 1, 1).toDouble();
                 m_keyframes[pos] = val;
-                //}
             }
             update();
             return;
@@ -171,18 +154,14 @@ void ClipItem::setSelectedEffect(int ix) {
 }
 
 void ClipItem::updateKeyframeEffect() {
+    // regenerate xml parameter from the clip keyframes
     QDomElement effect = effectAt(m_selectedEffect);
     QDomNodeList params = effect.elementsByTagName("parameter");
 
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
         if (!e.isNull() && e.attribute("type") == "keyframe") {
-            int max = e.attribute("max").toInt();
-            int min = e.attribute("min").toInt();
-            int def = e.attribute("default").toInt();
-            double factor = e.attribute("factor", "1").toDouble();
             QString keyframes;
-
             if (m_keyframes.count() > 1) {
                 QMap<int, double>::const_iterator i = m_keyframes.constBegin();
                 double x1;
@@ -193,7 +172,7 @@ void ClipItem::updateKeyframeEffect() {
                 }
             }
             // Effect has a keyframe type parameter, we need to set the values
-            kDebug() << ":::::::::::::::   SETTING EFFECT KEYFRAMES: " << keyframes;
+            //kDebug() << ":::::::::::::::   SETTING EFFECT KEYFRAMES: " << keyframes;
             e.setAttribute("keyframes", keyframes);
             break;
         }
index 805be75ce43c406179782b696b107862d1f11abf..b056260a561a020885647fc8d64e3ea2b62f5ee9 100644 (file)
@@ -537,11 +537,17 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
 
 void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event) {
     if (m_dragItem && m_dragItem->hasKeyFrames()) {
-        GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x() / m_scale), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
-        m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
-        ClipItem * item = (ClipItem *) m_dragItem;
-        item->updateKeyframeEffect();
-        updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
+        if (m_moveOpMode == KEYFRAME) {
+            // user double clicked on a keyframe, open edit dialog
+
+        } else  {
+            // add keyframe
+            GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x() / m_scale), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
+            m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
+            ClipItem * item = (ClipItem *) m_dragItem;
+            item->updateKeyframeEffect();
+            updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
+        }
     }
 }
 
index 50eb0abefc02f15b7b76dab2576a294301e11b0b..82a8f08a2a96ee4cebe6ab6598b1c0fd9a487842 100644 (file)
@@ -221,9 +221,8 @@ QPixmap KThumb::getImage(QDomElement xml, int frame, int width, int height) {
 
 //static
 QPixmap KThumb::getFrame(Mlt::Producer producer, int framepos, int width, int height) {
-    if (framepos > 0)
-        producer.seek(framepos);
 
+    producer.seek(framepos);
     Mlt::Frame *frame = producer.get_frame();
     mlt_image_format format = mlt_image_yuv422;
     int frame_width = 0;
@@ -244,7 +243,6 @@ QPixmap KThumb::getFrame(Mlt::Producer producer, int framepos, int width, int he
 
     mlt_pool_release(new_image);
     delete frame;
-
     return pix;
 }
 /*
index c3399368a5f60902724c135ab75df781cfe6c3c2..fd47bc2763f571854db495e651643e30df111047 100644 (file)
@@ -415,14 +415,14 @@ void MainWindow::setupActions() {
 
     toolbar->addWidget(m_zoomSlider);
 
-    m_buttonVideoThumbs = toolbar->addAction(KIcon("video-mpeg"), i18n("Show videoo thumbnails"));
+    m_buttonVideoThumbs = toolbar->addAction(KIcon("video-mpeg"), i18n("Show video thumbnails"));
     m_buttonVideoThumbs->setCheckable(true);
-    m_buttonVideoThumbs->setChecked(KdenliveSettings::audiothumbnails());
+    m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
     connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
 
     m_buttonAudioThumbs = toolbar->addAction(KIcon("audio-mpeg"), i18n("Show audio thumbnails"));
     m_buttonAudioThumbs->setCheckable(true);
-    m_buttonAudioThumbs->setChecked(KdenliveSettings::videothumbnails());
+    m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
     connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
 
     m_buttonShowMarkers = toolbar->addAction(KIcon("audio-mpeg"), i18n("Show markers comments"));
@@ -432,8 +432,7 @@ void MainWindow::setupActions() {
     layout->addWidget(toolbar);
 
     m_messageLabel = new StatusBarMessageLabel(this);
-    m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-    m_messageLabel->setMinimumTextHeight(contentHeight);
+    m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
 
     statusBar()->addWidget(m_messageLabel, 10);
     statusBar()->addWidget(statusProgressBar, 0);
index 91b0b37f253fed5f22243e8df91bf6d5cf2f08d7..8b7516b7fddb5a45df8a15f3681d11ea221055d7 100644 (file)
 #include <KDebug>
 
 #include "markerdialog.h"
+#include "kthumb.h"
+#include "kdenlivesettings.h"
 
 MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, QWidget * parent): QDialog(parent), m_tc(tc), m_clip(clip), m_marker(t) {
     setFont(KGlobalSettings::toolBarFont());
     m_fps = m_tc.fps();
     m_view.setupUi(this);
-    m_view.marker_position->setText(tc.getTimecode(t.time(), tc.fps()));
+
+    m_previewTimer = new QTimer(this);
+    m_previewTimer->setInterval(500);
+    connect(m_previewTimer, SIGNAL(timeout()), this, SLOT(slotUpdateThumb()));
+
+    m_profile = new Mlt::Profile((char*) KdenliveSettings::current_profile().data());
+    m_dar = m_profile->dar();
+    QDomDocument doc;
+    QDomElement westley = doc.createElement("westley");
+    QDomElement play = doc.createElement("playlist");
+    doc.appendChild(westley);
+    westley.appendChild(play);
+    play.appendChild(doc.importNode(clip->toXML(), true));
+    //char *tmp = doc.toString().toUtf8().data();
+    m_producer = new Mlt::Producer(*m_profile, "westley-xml", doc.toString().toUtf8().data());
+    //delete[] tmp;
+
+    m_view.marker_position->setText(tc.getTimecode(t.time(), m_fps));
     m_view.marker_comment->setText(t.comment());
     connect(m_view.position_up, SIGNAL(clicked()), this, SLOT(slotTimeUp()));
     connect(m_view.position_down, SIGNAL(clicked()), this, SLOT(slotTimeDown()));
+
     m_view.marker_comment->selectAll();
     m_view.marker_comment->setFocus();
+    QPixmap p;
+    QString colour = clip->getProperty("colour");
+    switch (m_clip->clipType()) {
+    case VIDEO:
+    case AV:
+    case SLIDESHOW:
+    case PLAYLIST:
+        connect(this, SIGNAL(updateThumb()), m_previewTimer, SLOT(start()));
+    case IMAGE:
+    case TEXT:
+        p = KThumb::getFrame(*m_producer, t.time().frames(m_fps), (int)(100 * m_dar), 100);
+        break;
+    case COLOR:
+        colour = colour.replace(0, 2, "#");
+        p = QPixmap(m_view.clip_thumb->width(), m_view.clip_thumb->height());
+        p.fill(QColor(colour.left(7)));
+        break;
+    default:
+        p = QPixmap(m_view.clip_thumb->width(), m_view.clip_thumb->height());
+        p.fill(Qt::black);
+    }
+    if (!p.isNull()) {
+        m_view.clip_thumb->setFixedWidth(p.width());
+        m_view.clip_thumb->setFixedHeight(p.height());
+        m_view.clip_thumb->setPixmap(p);
+    }
+    connect(m_view.marker_position, SIGNAL(textChanged(const QString &)), this, SIGNAL(updateThumb()));
     adjustSize();
 }
 
+MarkerDialog::~MarkerDialog() {
+    delete m_previewTimer;
+    if (m_producer) delete m_producer;
+    if (m_profile) delete m_profile;
+}
+
+void MarkerDialog::slotUpdateThumb() {
+    m_previewTimer->stop();
+    int pos = m_tc.getFrameCount(m_view.marker_position->text(), m_fps);
+    kDebug() << "// getting thumb for: " << pos;
+    QPixmap p = KThumb::getFrame(*m_producer, pos, (int)(100 * m_dar), 100);
+    if (!p.isNull()) m_view.clip_thumb->setPixmap(p);
+    else kDebug() << "!!!!!!!!!!!  ERROR CREATING THUMB";
+}
 
 void MarkerDialog::slotTimeUp() {
     int duration = m_tc.getFrameCount(m_view.marker_position->text(), m_fps);
index 10c81fa4e2c3350ca61822484d23a8a3126d4c3c..05225ccd1a4ab35fe7bb60ed27cd6117ff87b09e 100644 (file)
 #include "timecode.h"
 #include "ui_markerdialog_ui.h"
 
+namespace Mlt {
+class Producer;
+class Profile;
+};
+
 class MarkerDialog : public QDialog {
     Q_OBJECT
 
 public:
     MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, QWidget * parent = 0);
+    ~MarkerDialog();
     CommentedTime newMarker();
+
 private slots:
     void slotTimeUp();
     void slotTimeDown();
+    void slotUpdateThumb();
 
 private:
+    Mlt::Producer *m_producer;
+    Mlt::Profile *m_profile;
     Ui::MarkerDialog_UI m_view;
     DocClipBase *m_clip;
     CommentedTime m_marker;
     Timecode m_tc;
     double m_fps;
+    double m_dar;
+    QTimer *m_previewTimer;
+
+signals:
+    void updateThumb();
 };
 
 
index ea55281673234ec16aa2db193d5c4c52909f37db..2fd774b6a1cb4480509f5662051e8ec69c7fa936 100644 (file)
@@ -143,7 +143,9 @@ int Render::resetProfile(QString profile) {
     if (m_mltProfile) delete m_mltProfile;
     m_mltProfile = NULL;
 
-    m_mltProfile = new Mlt::Profile((char*) profile.toUtf8().data());
+    char *tmp = decodedString(profile);
+    m_mltProfile = new Mlt::Profile(tmp);
+    delete[] tmp;
     m_mltConsumer = new Mlt::Consumer(*m_mltProfile , "sdl_preview"); //consumer;
     m_mltConsumer->set("resize", 1);
     m_mltConsumer->set("window_id", m_winid);
@@ -154,7 +156,9 @@ int Render::resetProfile(QString profile) {
     m_mltConsumer->set("audio_buffer", 1024);
     m_mltConsumer->set("frequency", 48000);
 
-    Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile , "westley-xml", (char *) scene.toUtf8().data());
+    tmp = decodedString(scene);
+    Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile , "westley-xml", tmp);
+    delete[] tmp;
     m_mltProducer = producer;
     m_mltConsumer->connect(*m_mltProducer);
     m_mltProducer->set_speed(0.0);
@@ -1183,8 +1187,8 @@ void Render::mltAddEffect(int track, GenTime position, QMap <QString, QString> a
             filter->set("in", x1);
             filter->set("out", x2);
             //kDebug() << "// ADDING KEYFRAME vals: " << min<<" / "<<max<<", "<<y1<<", factor: "<<factor;
-            filter->set(starttag, QString::number((min + y1 * (max - min) / 100.0) / factor).toUtf8().data());
-            filter->set(endtag, QString::number((min + y2 * (max - min) / 100.0) / factor).toUtf8().data());
+            filter->set(starttag, QString::number((min + y1) / factor).toUtf8().data());
+            filter->set(endtag, QString::number((min + y2) / factor).toUtf8().data());
             clipService.attach(*filter);
             offset = 1;
         }
@@ -1536,7 +1540,7 @@ void Render::mltMoveTransition(QString type, int startTrack, int newTrack, int n
 }
 
 void Render::mltUpdateTransition(QString oldTag, QString tag, int a_track, int b_track, GenTime in, GenTime out, QDomElement xml) {
-    //kDebug() << "update transition"  << tag;
+    // kDebug() << "update transition"  << tag << " at pos " << in.frames(25);
     if (oldTag == tag) mltUpdateTransitionParams(tag, a_track, b_track, in, out, xml);
     else {
         mltDeleteTransition(oldTag, a_track, b_track, in, out, xml, false);
@@ -1621,6 +1625,7 @@ void Render::mltDeleteTransition(QString tag, int a_track, int b_track, GenTime
         kDebug() << "// FOUND EXISTING TRANS, IN: " << currentIn << ", OUT: " << currentOut << ", TRACK: " << currentTrack;
 
         if (resource == tag && b_track == currentTrack && currentIn <= old_pos && currentOut >= old_pos) {
+            //kDebug() << " / / / / /DELETE TRANS DOOOMNE";
             mlt_field_disconnect_service(field->get_field(), nextservice);
             break;
         }
index 2e1c591c47a0b961f4d8cb93f3c55652f6a9b2de..e7e87b48868e090d8e40ed245c2e8ae2378b1194 100644 (file)
@@ -114,7 +114,7 @@ void StatusBarMessageLabel::setMessage(const QString& text,
     }
 
     m_pixmap = (iconName == 0) ? QPixmap() : SmallIcon(iconName);
-    QTimer::singleShot(GeometryTimeout, this, SLOT(assureVisibleText()));
+    //QTimer::singleShot(GeometryTimeout, this, SLOT(assureVisibleText()));
     show(); //update();
 }
 
@@ -122,9 +122,9 @@ void StatusBarMessageLabel::setMinimumTextHeight(int min) {
     if (min != m_minTextHeight) {
         m_minTextHeight = min;
         setMinimumHeight(min);
-        if (m_closeButton->height() > min) {
+        /*if (m_closeButton->height() > min) {
             m_closeButton->setFixedHeight(min);
-        }
+        }*/
     }
 }
 
@@ -149,23 +149,23 @@ void StatusBarMessageLabel::paintEvent(QPaintEvent* /* event */) {
     }
     painter.setBrush(backgroundColor);
     painter.setPen(Qt::NoPen);
-    painter.drawRect(QRect(0, 0, width(), height()));
+    painter.drawRect(0, 0, width(), height());
 
     // draw pixmap
     int x = BorderGap;
-    int y = (m_minTextHeight - m_pixmap.height()) / 2;
+    int y = (height() - m_pixmap.height()) / 2;
 
     if (!m_pixmap.isNull()) {
         painter.drawPixmap(x, y, m_pixmap);
-        x += m_pixmap.width() + BorderGap;
+        x += m_pixmap.width() + BorderGap * 2;
     }
 
     // draw text
     painter.setPen(palette().windowText().color());
     int flags = Qt::AlignVCenter;
-    if (height() > m_minTextHeight) {
+    /*if (height() > m_minTextHeight) {
         flags = flags | Qt::TextWordWrap;
-    }
+    }*/
     painter.drawText(QRect(x, 0, availableTextWidth(), height()), flags, m_text);
     painter.end();
 }
@@ -173,14 +173,14 @@ void StatusBarMessageLabel::paintEvent(QPaintEvent* /* event */) {
 void StatusBarMessageLabel::resizeEvent(QResizeEvent* event) {
     QWidget::resizeEvent(event);
     //updateCloseButtonPosition();
-    QTimer::singleShot(GeometryTimeout, this, SLOT(assureVisibleText()));
+    //QTimer::singleShot(GeometryTimeout, this, SLOT(assureVisibleText()));
 }
 
 void StatusBarMessageLabel::timerDone() {
     switch (m_state) {
     case Illuminate: {
         // increase the illumination
-        const int illumination_max = 224;
+        const int illumination_max = 128;
         if (m_illumination < illumination_max) {
             m_illumination += 32;
             if (m_illumination > illumination_max) {
index 2d217bdab9e3084ec405e7dd5621f608a6875fce..7abd8d5da22ffcc1abff1eb3082845b7fc5a4234 100644 (file)
@@ -381,8 +381,6 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) {
                         if (MainWindow::videoEffects.hasKeyFrames(clipeffect)) {
                             kDebug() << " * * * * * * * * * * ** CLIP EFF WITH KFR FND  * * * * * * * * * * *";
                             // effect is key-framable, read all effects to retrieve keyframes
-                            double min;
-                            double max;
                             double factor;
                             QString starttag;
                             QString endtag;
@@ -392,8 +390,6 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) {
                                 if (e.attribute("type") == "keyframe") {
                                     starttag = e.attribute("starttag", "start");
                                     endtag = e.attribute("endtag", "end");
-                                    min = e.attribute("min").toDouble();
-                                    max = e.attribute("max").toDouble();
                                     factor = e.attribute("factor", "1").toDouble();
                                     break;
                                 }
@@ -407,9 +403,9 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) {
                                 // parse effect parameters
                                 QDomElement effectparam = n3.toElement();
                                 if (effectparam.attribute("name") == starttag)
-                                    startvalue = effectparam.text().toDouble() * factor / (max - min) * 100;
+                                    startvalue = effectparam.text().toDouble() * factor;
                                 if (effectparam.attribute("name") == endtag)
-                                    endvalue = effectparam.text().toDouble() * factor / (max - min) * 100;
+                                    endvalue = effectparam.text().toDouble() * factor;
                             }
                             // add first keyframe
                             keyframes.append(QString::number(in + effectin) + ":" + QString::number(startvalue) + ";" + QString::number(in + effectout) + ":" + QString::number(endvalue) + ";");
@@ -430,7 +426,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) {
                                         continueParsing = false;
                                         break;
                                     } else if (subeffectparam.attribute("name") == endtag) {
-                                        endvalue = subeffectparam.text().toDouble() * factor / (max - min) * 100;
+                                        endvalue = subeffectparam.text().toDouble() * factor;
                                         break;
                                     }
                                 }