]> git.sesse.net Git - kdenlive/commitdiff
adapt to latest MLT changes
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 9 Feb 2008 19:13:03 +0000 (19:13 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 9 Feb 2008 19:13:03 +0000 (19:13 +0000)
svn path=/branches/KDE4/; revision=1826

18 files changed:
src/clipitem.cpp
src/clipitem.h
src/customtrackview.cpp
src/kdenlivedoc.cpp
src/kdenlivesettings.kcfg
src/kthumb.cpp
src/kthumb.h
src/mainwindow.cpp
src/monitor.cpp
src/monitor.h
src/monitormanager.cpp
src/projectlist.cpp
src/projectlist.h
src/renderer.cpp
src/renderer.h
src/smallruler.cpp
src/trackview.cpp
src/widgets/monitor_ui.ui

index 8db033fbc029043702f291e8bc425db9d8f79055..01334ae0f6abc20063e6d5e8826cd5d749ab3497 100644 (file)
@@ -56,8 +56,8 @@ ClipItem::ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect
 
   setBrush(QColor(100, 100, 150));
   if (m_clipType == VIDEO || m_clipType == AV) {
-    m_thumbProd = new KThumb(KUrl(xml.attribute("resource")));
-    connect(this, SIGNAL(getThumb(int, int, int, int)), m_thumbProd, SLOT(extractImage(int, int, int, int)));
+    m_thumbProd = new KThumb(KUrl(xml.attribute("resource")), KdenliveSettings::track_height() * KdenliveSettings::project_display_ratio(), KdenliveSettings::track_height());
+    connect(this, SIGNAL(getThumb(int, int)), m_thumbProd, SLOT(extractImage(int, int)));
     connect(m_thumbProd, SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
     QTimer::singleShot(300, this, SLOT(slotFetchThumbs()));
 
@@ -77,7 +77,6 @@ ClipItem::ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect
   else if (m_clipType == IMAGE) {
     m_startPix = KThumb::getImage(KUrl(xml.attribute("resource")), 50 * KdenliveSettings::project_display_ratio(), 50);
   }
-  //m_startPix.load("/home/one/Desktop/thumb.jpg");
 }
 
 ClipItem::~ClipItem()
@@ -89,17 +88,17 @@ ClipItem::~ClipItem()
 
 void ClipItem::slotFetchThumbs()
 {
-  emit getThumb(m_cropStart, m_cropStart + m_cropDuration, 50 * KdenliveSettings::project_display_ratio(), 50);
+  emit getThumb(m_cropStart, m_cropStart + m_cropDuration);
 }
 
 void ClipItem::slotGetStartThumb()
 {
-  emit getThumb(m_cropStart, -1, 50 * KdenliveSettings::project_display_ratio(), 50);
+  emit getThumb(m_cropStart, -1);
 }
 
 void ClipItem::slotGetEndThumb()
 {
-  emit getThumb(-1, m_cropStart + m_cropDuration, 50 * KdenliveSettings::project_display_ratio(), 50);
+  emit getThumb(-1, m_cropStart + m_cropDuration);
 }
 
 void ClipItem::slotThumbReady(int frame, QPixmap pix)
index 098ad574383642cb44639851d88043be5ab9dfd8..42c5163cf52efdb40c8a42217baab3b8d9b4fc54 100644 (file)
@@ -26,6 +26,7 @@
 #include <QGraphicsSceneMouseEvent>
 
 #include "definitions.h"
+#include "gentime.h"
 #include "kthumb.h"
 
 
@@ -93,7 +94,7 @@ class ClipItem : public QObject, public QGraphicsRectItem
     void slotGetEndThumb();
 
   signals:
-    void getThumb(int, int, int, int);
+    void getThumb(int, int);
 
 };
 
index 88c8cc86d319e3ff724a3b66fcfd7cae9864a46c..8a0a07aa79a5ededd61910d1a240a4496b8180de 100644 (file)
@@ -261,6 +261,7 @@ void CustomTrackView::mouseMoveEvent ( QMouseEvent * event )
 // virtual 
 void CustomTrackView::mousePressEvent ( QMouseEvent * event )
 {
+  kDebug()<<"-- TIMELINE MSE PRESSED";
   int pos = event->x();
   if (event->modifiers() == Qt::ControlModifier) 
     setDragMode(QGraphicsView::ScrollHandDrag);
index 4af830ffe66c4db520057a3997dd97555ff94443..a0f61f1efdba5e6baa950e7a295a3a196979fb70 100644 (file)
@@ -63,18 +63,12 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, double fps, int width, int height, QWi
 
     /*QDomElement westley = m_document.createElement("westley");
     m_document.appendChild(westley);*/
-    QDomElement prod = m_document.createElement("producer");
-    prod.setAttribute("resource", "colour");
-    prod.setAttribute("colour", "red");
-    prod.setAttribute("id", "black");
-    prod.setAttribute("in", "0");
-    prod.setAttribute("out", "0");
+
 
     QDomElement tractor = m_document.createElement("tractor");
     QDomElement multitrack = m_document.createElement("multitrack");
 
     QDomElement playlist1 = m_document.createElement("playlist");
-    playlist1.appendChild(prod);
     playlist1.setAttribute("id", "playlist1");
     multitrack.appendChild(playlist1);
     QDomElement playlist2 = m_document.createElement("playlist");
index f7875f8adcd48cf534ee604b47f07b60ab28f49f..03c188f7edae3efc7f62e3564381a43f9aba2fa7 100644 (file)
       <label>Current project display ratio.</label>
       <default>1.7777778</default>
     </entry>
+    <entry name="track_height" type="Int">
+      <label>Timeline track size.</label>
+      <default>50</default>
+    </entry>
+    <entry name="default_profile" type="String">
+      <label>Default project format.</label>
+      <default>hdv_1080_50i</default>
+    </entry>
+    <entry name="current_profile" type="String">
+      <label>active project format.</label>
+      <default>hdv_1080_50i</default>
+    </entry>
   </group>
 </kcfg>
\ No newline at end of file
index 571049510c1fcf0cb91eedacd43892f91ec9bbb5..3e474a0c6b5cbbb82a1aeab9744903f02f0b4044 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "renderer.h"
 #include "kthumb.h"
+#include "kdenlivesettings.h"
 
 /*
     void MyThread::init(KUrl url, QString target, double frame, double frameLength, int frequency, int channels, int arrayWidth)
 #define _G(y,u,v) (0x2568*(y) - 0x0c92*(v) - 0x1a1e*(u)) /0x2000
 #define _B(y,u,v) (0x2568*(y) + 0x40cf*(v))                                          /0x2000
 */
-KThumb::KThumb(KUrl url, QObject * parent, const char *name):QObject(parent), m_url(url)
+KThumb::KThumb(KUrl url, int width, int height, QObject * parent, const char *name):QObject(parent), m_url(url), m_width(width), m_height(height)
 {
+  kDebug()<<"+++++++++++  CREATING THMB PROD FOR: "<<url;
+  m_profile = Mlt::Profile((char*) KdenliveSettings::current_profile().data());
 }
 
 KThumb::~KThumb()
@@ -146,8 +149,10 @@ QPixmap KThumb::getImage(KUrl url, int width, int height)
 {
     if (url.isEmpty()) return QPixmap();
     QPixmap pix(width, height);
+  kDebug()<<"+++++++++++  GET THMB IMG FOR: "<<url;
     char *tmp = Render::decodedString(url.path());
-    Mlt::Producer m_producer(tmp);
+    Mlt::Profile prof((char*) KdenliveSettings::current_profile().data());
+    Mlt::Producer m_producer(prof, tmp);
     delete tmp;
 
     if (m_producer.is_blank()) {
@@ -156,7 +161,7 @@ QPixmap KThumb::getImage(KUrl url, int width, int height)
     }
     Mlt::Frame * m_frame;
     mlt_image_format format = mlt_image_rgb24a;
-    Mlt::Filter m_convert("avcolour_space");
+    Mlt::Filter m_convert(prof, "avcolour_space");
     m_convert.set("forced", mlt_image_rgb24a);
     m_producer.attach(m_convert);
     //m_producer.seek(frame);
@@ -173,12 +178,12 @@ QPixmap KThumb::getImage(KUrl url, int width, int height)
     return pix;
 }
 
-void KThumb::extractImage(int frame, int frame2, int width, int height)
+void KThumb::extractImage(int frame, int frame2)
 {
     if (m_url.isEmpty()) return;
-    QPixmap pix(width, height);
+    QPixmap pix(m_width, m_height);
     char *tmp = Render::decodedString(m_url.path());
-    Mlt::Producer m_producer(tmp);
+    Mlt::Producer m_producer(m_profile, tmp);
     delete tmp;
 
     if (m_producer.is_blank()) {
@@ -188,15 +193,15 @@ void KThumb::extractImage(int frame, int frame2, int width, int height)
     }
     Mlt::Frame * m_frame;
     mlt_image_format format = mlt_image_rgb24a;
-    Mlt::Filter m_convert("avcolour_space");
+    Mlt::Filter m_convert(m_profile, "avcolour_space");
     m_convert.set("forced", mlt_image_rgb24a);
     m_producer.attach(m_convert);
     if (frame != -1) {
       m_producer.seek(frame);
       m_frame = m_producer.get_frame();
       if (m_frame && m_frame->is_valid()) {
-       uint8_t *thumb = m_frame->get_image(format, width, height);
-       QImage image(thumb, width, height, QImage::Format_ARGB32);
+       uint8_t *thumb = m_frame->get_image(format, m_width, m_height);
+       QImage image(thumb, m_width, m_height, QImage::Format_ARGB32);
        if (!image.isNull()) {
          pix = pix.fromImage(image);
        }
@@ -209,8 +214,8 @@ void KThumb::extractImage(int frame, int frame2, int width, int height)
     m_producer.seek(frame2);
     m_frame = m_producer.get_frame();
     if (m_frame && m_frame->is_valid()) {
-      uint8_t *thumb = m_frame->get_image(format, width, height);
-      QImage image(thumb, width, height, QImage::Format_ARGB32);
+      uint8_t *thumb = m_frame->get_image(format, m_width, m_height);
+      QImage image(thumb, m_width, m_height, QImage::Format_ARGB32);
       if (!image.isNull()) {
        pix = pix.fromImage(image);
       }
index 27cfd6a98c3d484515dd3b4ed60cabcaea08918c..2f2162fc5df454abbe13515030c2fa16af3e73c4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <kurl.h>
 
+#include <mlt++/Mlt.h>
 
 /**KRender encapsulates the client side of the interface to a renderer.
 From Kdenlive's point of view, you treat the KRender object as the
@@ -40,6 +41,7 @@ namespace Mlt {
     class Consumer;
     class Producer;
     class Frame;
+    class Profile;
 };
 
 
@@ -67,11 +69,11 @@ class KThumb:public QObject {
   Q_OBJECT public:
 
 
-     KThumb(KUrl url, QObject * parent = 0, const char *name = 0);
+     KThumb(KUrl url, int width, int height, QObject * parent = 0, const char *name = 0);
     ~KThumb();
 
 public slots:
-       void extractImage( int frame, int frame2, int width, int height);
+       void extractImage( int frame, int frame2);
        static QPixmap getImage(KUrl url, int width, int height);
 /*     void getImage(KUrl url, int frame, int width, int height);
        void getThumbs(KUrl url, int startframe, int endframe, int width, int height);
@@ -83,6 +85,9 @@ private:
 //     MyThread thumbProducer;
        KUrl m_url;
        QString m_thumbFile;
+       int m_width;
+       int m_height;
+       Mlt::Profile m_profile;
 
 signals:
        void thumbReady(int frame, QPixmap pm);
index e9b4509699c49a3bdd2de1218240a0c90abdbdf1..0a42b1ed6cd1ef5a7778a43934eedc0b3f1d8be3 100644 (file)
@@ -59,6 +59,7 @@ MainWindow::MainWindow(QWidget *parent)
   m_timelineArea->setTabReorderingEnabled(true);
   connect(m_timelineArea, SIGNAL(currentChanged (int)), this, SLOT(activateDocument()));
 
+  Mlt::Factory::init(NULL);
   m_monitorManager = new MonitorManager();
 
   projectListDock = new QDockWidget(i18n("Project Tree"), this);
@@ -85,14 +86,14 @@ MainWindow::MainWindow(QWidget *parent)
   transitionConfigDock->setWidget(transitionConfig);
   addDockWidget(Qt::TopDockWidgetArea, transitionConfigDock);
 
-  Mlt::Factory::init(NULL);
 
   clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
   clipMonitorDock->setObjectName("clip_monitor");
   m_clipMonitor = new Monitor("clip", m_monitorManager, this);
   clipMonitorDock->setWidget(m_clipMonitor);
   addDockWidget(Qt::TopDockWidgetArea, clipMonitorDock);
-  
+  //m_clipMonitor->stop();
+
   projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
   projectMonitorDock->setObjectName("project_monitor");
   m_projectMonitor = new Monitor("project", m_monitorManager, this);
index 111156fcab04b756532480c34d8f8d1709a038d1..29e04eb77f00af1f9ead24492b1f4acbda53539c 100644 (file)
@@ -28,7 +28,7 @@
 #include "monitor.h"
 
 Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
-    : QWidget(parent), render(NULL), m_monitorManager(manager), m_name(name)
+    : QWidget(parent), render(NULL), m_monitorManager(manager), m_name(name), m_isActive(false)
 {
   ui.setupUi(this);
   m_scale = 1;
@@ -50,6 +50,18 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
   connect(ui.button_fwd, SIGNAL(clicked()), this, SLOT(slotForward()));
   connect(ui.button_fwd1, SIGNAL(clicked()), this, SLOT(slotForwardOneFrame()));
   connect(ui.button_play, SIGNAL(clicked()), this, SLOT(slotPlay()));
+  //if ( render ) return;
+  render = new Render(m_name, (int) ui.video_frame->winId(), -1, this);
+  connect(render, SIGNAL(playListDuration(int)), this, SLOT(adjustRulerSize(int)));
+  connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
+  connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
+  //render->createVideoXWindow(ui.video_frame->winId(), -1);
+  int width = m_ruler->width();
+  m_ruler->setLength(width);
+  m_ruler->setMaximum(width);
+  m_length = 0;
+
+  kDebug()<<"/////// BUILDING MONITOR, ID: "<<ui.video_frame->winId();
 }
 
 // virtual
@@ -67,6 +79,7 @@ void Monitor::wheelEvent ( QWheelEvent * event )
 
 void Monitor::slotSeek(int pos)
 {
+  if (!m_isActive) m_monitorManager->activateMonitor(m_name);
   if ( render == NULL ) return;
   int realPos = ((double) pos) / m_scale;
   render->seekToFrame(realPos);
@@ -76,6 +89,7 @@ void Monitor::slotSeek(int pos)
 
 void Monitor::slotRewind()
 {
+  if (!m_isActive) m_monitorManager->activateMonitor(m_name);
   double speed = render->playSpeed();
   if ( speed >= 0 ) render->play(-2);
   else render->play(speed * 2);
@@ -85,6 +99,7 @@ void Monitor::slotRewind()
 
 void Monitor::slotForward()
 {
+  if (!m_isActive) m_monitorManager->activateMonitor(m_name);
   double speed = render->playSpeed();
   if ( speed <= 1 ) render->play(2);
   else render->play(speed * 2);
@@ -94,6 +109,7 @@ void Monitor::slotForward()
 
 void Monitor::slotRewindOneFrame()
 {
+  if (!m_isActive) m_monitorManager->activateMonitor(m_name);
   render->play(0);
   if (m_position < 1) return;
   m_position--;
@@ -103,6 +119,7 @@ void Monitor::slotRewindOneFrame()
 
 void Monitor::slotForwardOneFrame()
 {
+  if (!m_isActive) m_monitorManager->activateMonitor(m_name);
   render->play(0);
   if (m_position >= m_length) return;
   m_position++;
@@ -112,6 +129,7 @@ void Monitor::slotForwardOneFrame()
 
 void Monitor::seekCursor(int pos)
 {
+  if (!m_isActive) m_monitorManager->activateMonitor(m_name);
   int rulerPos = (int) (pos * m_scale);
   m_position = pos;
   ui.monitor_time->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
@@ -129,16 +147,8 @@ void Monitor::rendererStopped(int pos)
 
 void Monitor::initMonitor()
 {
-  if ( render ) return;
-  render = new Render(m_name, this);
-  render->createVideoXWindow(ui.video_frame->winId(), -1);
-  connect(render, SIGNAL(playListDuration(int)), this, SLOT(adjustRulerSize(int)));
-  connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
-  connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
-  int width = m_ruler->width();
-  m_ruler->setLength(width);
-  m_ruler->setMaximum(width);
-  m_length = 0;
+  kDebug()<<"/////// INITING MONITOR, ID: "<<ui.video_frame->winId();
+
 }
 
 // virtual
@@ -163,11 +173,13 @@ void Monitor::adjustRulerSize(int length)
 
 void Monitor::stop()
 {
+  m_isActive = false;
   if (render) render->stop();
 }
 
 void Monitor::start()
 {
+  m_isActive = true;
   if (render) render->start();
 }
 
@@ -186,7 +198,7 @@ void Monitor::slotOpen()
 void Monitor::slotPlay()
 {
   if ( render == NULL ) return;
-  m_monitorManager->activateMonitor(m_name);
+  if (!m_isActive) m_monitorManager->activateMonitor(m_name);
   render->switchPlay();
   ui.button_play->setChecked(true);
   ui.button_play->setIcon(m_pauseIcon);
@@ -195,7 +207,7 @@ void Monitor::slotPlay()
 void Monitor::slotSetXml(const QDomElement &e)
 {
     if ( render == NULL ) return;
-    m_monitorManager->activateMonitor(m_name);
+    if (!m_isActive) m_monitorManager->activateMonitor(m_name);
     QDomDocument doc;
     QDomElement westley = doc.createElement("westley");
     doc.appendChild(westley);
@@ -210,7 +222,7 @@ void Monitor::slotSetXml(const QDomElement &e)
 void Monitor::slotOpenFile(const QString &file)
 {
     if ( render == NULL ) return;
-    m_monitorManager->activateMonitor(m_name);
+    if (!m_isActive) m_monitorManager->activateMonitor(m_name);
     QDomDocument doc;
     QDomElement westley = doc.createElement("westley");
     doc.appendChild(westley);
index 4259677305d95a7332db2bb6dc072245fb23f787..904b79b166c28aff7224ce2630e04d5d9ca7022e 100644 (file)
@@ -52,6 +52,7 @@ class Monitor : public QWidget
     SmallRuler *m_ruler;
     KIcon m_playIcon;
     KIcon m_pauseIcon;
+    bool m_isActive;
 
   private slots:
     void slotPlay();
index 1660fadcffbcf027983deff263be1583aa686495..5c676a66176584ea984b8537ad658aab79529a47 100644 (file)
@@ -22,6 +22,7 @@
 #include <QTimer>
 
 #include "monitormanager.h"
+#include <mlt++/Mlt.h>
 
 MonitorManager::MonitorManager(QWidget *parent)
     : QObject(parent)
@@ -44,7 +45,7 @@ void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor)
 {
   m_clipMonitor = clipMonitor;
   m_projectMonitor = projectMonitor;
-  //QTimer::singleShot(750, this, SLOT(initClipMonitor()));
+  //QTimer::singleShot(1750, this, SLOT(initClipMonitor()));
   initClipMonitor();
   //initProjectMonitor();
 }
@@ -52,14 +53,15 @@ void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor)
 void MonitorManager::initClipMonitor()
 {
   m_clipMonitor->initMonitor();
-  initProjectMonitor();
+  emit connectMonitors();
+  //initProjectMonitor();
   //QTimer::singleShot(1500, this, SLOT(initProjectMonitor()));
 }
 
 void MonitorManager::initProjectMonitor()
 {
-  m_clipMonitor->stop();
-  // m_projectMonitor->initMonitor();
+  //m_clipMonitor->stop();
+  m_projectMonitor->initMonitor();
   // activateMonitor("project");
   emit connectMonitors();
 }
index d7464702df91695b97c12485e0f9bff53d8e6c92..7fe59f7cb1c716124fc093bed50229f200ef31bb 100644 (file)
 #include <KLocale>
 #include <KFileDialog>
 #include <KInputDialog>
-#include <nepomuk/resourcemanager.h>
 #include <kio/netaccess.h>
 #include <KMessageBox>
 
+#include <nepomuk/global.h>
+#include <nepomuk/resource.h>
+#include <nepomuk/tag.h>
+
 #include "projectlist.h"
 #include "projectitem.h"
 #include "kdenlivesettings.h"
 
 #include <QtGui>
 
-  const int NameRole = Qt::UserRole;
-  const int DurationRole = NameRole + 1;
-  const int FullPathRole = NameRole + 2;
-  const int ClipTypeRole = NameRole + 3;
-
-class ItemDelegate: public QItemDelegate
-{
-  public:
-    ItemDelegate(QObject* parent = 0): QItemDelegate(parent)
-    {
-    }
-
-void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
-{
-  if (index.column() == 1)
-  {
-    const bool hover = option.state & (QStyle::State_Selected|QStyle::State_MouseOver|QStyle::State_HasFocus);
-    QRect r1 = option.rect;
-    painter->save();
-    if (hover) {
-        painter->setPen(option.palette.color(QPalette::HighlightedText));
-        QColor backgroundColor = option.palette.color(QPalette::Highlight);
-        painter->setBrush(QBrush(backgroundColor));
-       painter->fillRect(r1, QBrush(backgroundColor));
-    }
-    QFont font = painter->font();
-    font.setPointSize(font.pointSize() - 1 );
-    font.setBold(true);
-    painter->setFont(font);
-    int mid = (int) ((r1.height() / 2 ));
-    r1.setBottom(r1.y() + mid);
-    QRect r2 = option.rect;
-    r2.setTop(r2.y() + mid);
-    painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
-    //painter->setPen(Qt::green);
-    font.setBold(false);
-    painter->setFont(font);
-    painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , index.data(DurationRole).toString());
-    painter->restore();
-  }
-  else
-  {
-    QItemDelegate::paint(painter, option, index);
-  }
-}
-};
-
-
 ProjectList::ProjectList(QWidget *parent)
     : QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(NULL)
 {
@@ -153,11 +108,10 @@ ProjectList::ProjectList(QWidget *parent)
   connect(listView, SIGNAL(addClip ()), this, SLOT(slotAddClip()));
   connect(listView, SIGNAL(addClip (QUrl, const QString &)), this, SLOT(slotAddClip(QUrl, const QString &)));
 
-
-  listView->setItemDelegate(new ItemDelegate(listView));
+  m_listViewDelegate = new ItemDelegate(listView);
+  listView->setItemDelegate(m_listViewDelegate);
   listView->setIconSize(QSize(60, 40));
   listView->setSortingEnabled (true);
-
 }
 
 ProjectList::~ProjectList()
@@ -192,6 +146,17 @@ void ProjectList::slotContextMenu( const QPoint &pos, QTreeWidgetItem *item )
 {
   bool enable = false;
   if (item) {
+    QFrame *w = new QFrame;
+    w->setFrameShape(QFrame::StyledPanel);
+    w->setLineWidth(2);
+    w->setAutoFillBackground(true);
+    QHBoxLayout *layout = new QHBoxLayout;
+    layout->addWidget( new QLabel(i18n("Color:")));
+    layout->addWidget( new KColorButton());
+    layout->addWidget( new QLabel(i18n("Duration:")));
+    layout->addWidget( new KRestrictedLine());
+    w->setLayout( layout );
+    m_listViewDelegate->extendItem(w, listView->currentIndex());
     enable = true;
   }
   m_editAction->setEnabled(enable);
@@ -254,9 +219,10 @@ void ProjectList::addClip(const QStringList &name, const QDomElement &elem, cons
   else item = new ProjectItem(listView, name, elem, clipId);
   if (!url.isEmpty()) {
     item->setData(1, FullPathRole, url.path());
-/*    Nepomuk::File f( url.path() );
-    QString annotation = f.getAnnotation();
-    if (!annotation.isEmpty()) item->setText(2, annotation);*/
+    // if file has Nepomuk comment, use it
+    Nepomuk::Resource f( url.path() );
+    QString annotation = f.description();
+    if (!annotation.isEmpty()) item->setText(2, annotation);
     QString resource = url.path();
     if (resource.endsWith("westley") || resource.endsWith("kdenlive")) {
        QString tmpfile;
index 66ce9c6c8ee73d47ade2788482226eaa9d099cc7..86939085a6c9a6f5d3ddaa90e926d897d3cd7ccb 100644 (file)
 #include <QDomNodeList>
 #include <QToolBar>
 #include <QTreeWidget>
+#include <QPainter>
 
 #include <KUndoStack>
 #include <KTreeWidgetSearchLine>
+#include <KExtendableItemDelegate>
 
 #include "definitions.h"
 #include "kdenlivedoc.h"
 
 class ProjectItem;
 
+  const int NameRole = Qt::UserRole;
+  const int DurationRole = NameRole + 1;
+  const int FullPathRole = NameRole + 2;
+  const int ClipTypeRole = NameRole + 3;
+
+class ItemDelegate: public KExtendableItemDelegate
+{
+  public:
+    ItemDelegate(QAbstractItemView* parent = 0): KExtendableItemDelegate(parent)
+    {
+    }
+/*
+void expand()
+{
+  QWidget *w = new QWidget;
+  QVBoxLayout *layout = new QVBoxLayout;
+  layout->addWidget( new KColorButton(w)); 
+  w->setLayout( layout );
+  extendItem(w, 
+}
+*/
+
+void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
+{
+  if (index.column() == 1)
+  {
+    const bool hover = option.state & (QStyle::State_Selected|QStyle::State_MouseOver|QStyle::State_HasFocus);
+    QRect r1 = option.rect;
+    painter->save();
+    if (hover) {
+        painter->setPen(option.palette.color(QPalette::HighlightedText));
+        QColor backgroundColor = option.palette.color(QPalette::Highlight);
+        painter->setBrush(QBrush(backgroundColor));
+       painter->fillRect(r1, QBrush(backgroundColor));
+    }
+    QFont font = painter->font();
+    font.setPointSize(font.pointSize() - 1 );
+    font.setBold(true);
+    painter->setFont(font);
+    int mid = (int) ((r1.height() / 2 ));
+    r1.setBottom(r1.y() + mid);
+    QRect r2 = option.rect;
+    r2.setTop(r2.y() + mid);
+    painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
+    //painter->setPen(Qt::green);
+    font.setBold(false);
+    painter->setFont(font);
+    painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , index.data(DurationRole).toString());
+    painter->restore();
+  }
+  else
+  {
+    KExtendableItemDelegate::paint(painter, option, index);
+  }
+}
+};
+
 class ProjectList : public QWidget
 {
   Q_OBJECT
@@ -71,6 +130,7 @@ class ProjectList : public QWidget
     ProjectItem *getItemById(int id);
     QAction *m_editAction;
     QAction *m_deleteAction;
+    ItemDelegate *m_listViewDelegate;
 
   private slots:
     void slotAddClip(QUrl givenUrl = QUrl(), const QString &group = QString::null);
index 2fb82122f09051bf98c7d22727c013152385370e..618c65ad5902fd900490c2598b07ad51858409c1 100644 (file)
@@ -37,14 +37,23 @@ extern "C" {
 #include <KMessageBox>
 #include <KLocale>
 
-
-#include <mlt++/Mlt.h>
-
-
 #include "renderer.h"
 
-Render::Render(const QString & rendererName, QWidget *parent):QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_sceneList(QDomDocument()), m_winid(-1), m_framePosition(0), m_generateScenelist(false), isBlocked(true)
+static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr)
 {
+    // detect if the producer has finished playing. Is there a better way to do it ?
+    //if (self->isBlocked) return;
+    if (mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame_ptr ), "_speed" ) == 0.0) {
+        self->emitConsumerStopped();
+    }
+    else {
+       self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
+    }
+}
+
+Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent):QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_sceneList(QDomDocument()), m_winid(-1), m_framePosition(0), m_generateScenelist(false), isBlocked(true)
+{
+    m_mltProfile = new Mlt::Profile("pal_dv");
     refreshTimer = new QTimer( this );
     connect( refreshTimer, SIGNAL(timeout()), this, SLOT( refresh()) );
 
@@ -57,6 +66,24 @@ Render::Render(const QString & rendererName, QWidget *parent):QObject(parent), m
     connect( osdTimer, SIGNAL(timeout()), this, SLOT(slotOsdTimeout()) );
 
     m_osdProfile =   KStandardDirs::locate("data", "kdenlive/profiles/metadata.properties");
+    //if (rendererName == "clip")
+    {
+    //Mlt::Consumer *consumer = new Mlt::Consumer( profile , "sdl_preview");
+    m_mltConsumer = new Mlt::Consumer( *m_mltProfile , "sdl_preview");//consumer;
+    m_mltConsumer->set("resize", 1);
+    m_mltConsumer->set("window_id", winid);
+    m_mltConsumer->set("terminate_on_pause", 1);
+    m_externalwinid = extid;
+    m_winid = winid;
+    m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
+    Mlt::Producer *producer = new Mlt::Producer( *m_mltProfile , "westley-xml", "<westley><playlist><producer mlt_service=\"colour\" colour=\"blue\" /></playlist></westley>");
+    m_mltProducer = producer;
+    m_mltConsumer->connect(*m_mltProducer);
+    m_mltProducer->set_speed(0.0);
+    //m_mltConsumer->start();
+    //refresh();
+    //initSceneList();
+    }
     /*m_osdInfo = new Mlt::Filter("data_show");
     char *tmp = decodedString(m_osdProfile);
     m_osdInfo->set("resource", tmp);
@@ -90,17 +117,7 @@ void Render::closeMlt()
 
  
 
-static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr)
-{
-    // detect if the producer has finished playing. Is there a better way to do it ?
-    //if (self->isBlocked) return;
-    if (mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame_ptr ), "_speed" ) == 0.0) {
-        self->emitConsumerStopped();
-    }
-    else {
-       self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
-    }
-}
+
 
 /** Wraps the VEML command of the same name; requests that the renderer
 should create a video window. If show is true, then the window should be
@@ -109,25 +126,36 @@ replyCreateVideoXWindow() once the renderer has replied. */
 
 void Render::createVideoXWindow(WId winid, WId externalMonitor)
 {
+  return;
     if (m_mltConsumer) {
        delete m_mltConsumer;
     }
 
-    m_mltConsumer = new Mlt::Consumer("sdl_preview");
+    kDebug()<<"///////// INIT MONITOR WID";
+    //Mlt::Profile profile("dv_pal");//hdv_1080_50i");
+    //m_profile = profile;
+    //Mlt::Producer *producer = new Mlt::Producer( profile, "/home/one/Video002.mp4" );
+    Mlt::Consumer *consumer = new Mlt::Consumer( *m_mltProfile , "sdl_preview");
+    //m_mltProducer = producer;
+    m_mltConsumer = consumer;
+    //consumer->set( "rescale", "none" );
+    m_mltConsumer->set("resize", 1);
+    m_mltConsumer->set("window_id", (int) winid);
+    m_mltConsumer->set("terminate_on_pause", 1);
+    m_externalwinid = (int) externalMonitor;
+    m_winid = (int) winid;
+    m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
+    //m_mltProducer->set_speed(0.0);
+    //m_mltConsumer->connect( *m_mltProducer );
+    //m_mltConsumer->start( );
+/*
+    m_mltConsumer = new Mlt::Consumer(m_profile, "sdl_preview");
     if (!m_mltConsumer || !m_mltConsumer->is_valid()) {
        KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install.\n Exiting now..."));
        kError()<<"Sorry, cannot create MLT consumer, check your MLT install you miss SDL libraries support in MLT";
        exit(1);
     }
 
-    //only as is saw, if we want to lock something with the sdl lock
-    /*if (!KdenliveSettings::videoprofile().isEmpty()) 
-       m_mltConsumer->set("profile", KdenliveSettings::videoprofile().ascii());*/
-
-    m_mltConsumer->set("profile", "hdv_1080_50i"); //KdenliveSettings::videoprofile().ascii());
-    /*m_mltConsumer->set("app_locked", 1);
-    m_mltConsumer->set("app_lock", (void *) &my_lock, 0);
-    m_mltConsumer->set("app_unlock", (void *) &my_unlock, 0);*/
     m_externalwinid = (int) externalMonitor;
     m_winid = (int) winid;
     
@@ -135,17 +163,18 @@ void Render::createVideoXWindow(WId winid, WId externalMonitor)
     m_mltConsumer->set("resize", 1);
     
     m_mltConsumer->set("terminate_on_pause", 1);
-    /*QString aDevice = KdenliveSettings::audiodevice();
-    if (!KdenliveSettings::videodriver().isEmpty()) m_mltConsumer->set("video_driver", KdenliveSettings::videodriver().ascii());
-    if (!KdenliveSettings::audiodriver().isEmpty()) m_mltConsumer->set("audio_driver", KdenliveSettings::audiodriver().ascii());
-    m_mltConsumer->set("audio_device", aDevice.section(";", 1).ascii());*/
     m_mltConsumer->set("progressive", 1);
     m_mltConsumer->set("audio_buffer", 1024);
     m_mltConsumer->set("frequency", 48000);
 
     m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
-    //m_mltConsumer->start();
-    initSceneList();
+*/
+    /*QString aDevice = KdenliveSettings::audiodevice();
+    if (!KdenliveSettings::videodriver().isEmpty()) m_mltConsumer->set("video_driver", KdenliveSettings::videodriver().ascii());
+    if (!KdenliveSettings::audiodriver().isEmpty()) m_mltConsumer->set("audio_driver", KdenliveSettings::audiodriver().ascii());
+    m_mltConsumer->set("audio_device", aDevice.section(";", 1).ascii());*/
+
+   initSceneList();
 
     //QTimer::singleShot(500, this, SLOT(initSceneList()));
     //initSceneList();
@@ -159,14 +188,12 @@ int Render::resetRendererProfile(char * profile)
     if (!m_mltConsumer) return 0;
     if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
     m_mltConsumer->set("refresh", 0);
-    m_mltConsumer->set("profile", profile);
+    //m_mltConsumer->set("profile", profile);
     kDebug()<<" + + RESET CONSUMER WITH PROFILE: "<<profile;
-    m_fps = 25;
-    m_mltConsumer->set("fps", m_fps);
     mlt_properties properties = MLT_CONSUMER_PROPERTIES( m_mltConsumer->get_consumer() );
-    int result = mlt_consumer_profile( properties, profile );
+//    apply_profile_properties( m_profile, m_mltConsumer->get_consumer(), properties );
     refresh();
-    return result;
+    return 1;
 }
 
 void Render::restartConsumer()
@@ -188,7 +215,7 @@ char *Render::decodedString(QString str)
     char *t = new char[fn.length() + 1];
     strcpy(t, (const char *)fn);*/
 
-  return qstrdup( str.toLatin1().data() );
+  return qstrdup( str.toUtf8().data() ); //toLatin1
 }
 
 //static
@@ -220,7 +247,7 @@ QPixmap Render::extractFrame(int frame_position, int width, int height)
        return pix;
     }
     Mlt::Producer *mlt_producer = m_mltProducer->cut(frame_position, frame_position + 1);
-    Mlt::Filter m_convert("avcolour_space");
+    Mlt::Filter m_convert(*m_mltProfile, "avcolour_space");
     m_convert.set("forced", mlt_image_rgb24a);
     mlt_producer->attach(m_convert);
     Mlt::Frame *frame = mlt_producer->get_frame();
@@ -259,18 +286,19 @@ QPixmap Render::getImageThumbnail(KUrl url, int width, int height)
 }
 
 //static
-QPixmap Render::getVideoThumbnail(QString file, int frame_position, int width, int height)
+QPixmap Render::getVideoThumbnail(char *profile, QString file, int frame_position, int width, int height)
 {
     QPixmap pix(width, height);
     char *tmp = decodedString(file);
-    Mlt::Producer m_producer(tmp);
+    Mlt::Profile *prof = new Mlt::Profile(profile);
+    Mlt::Producer m_producer(*prof, tmp);
     delete[] tmp;
     if (m_producer.is_blank()) {
        pix.fill(Qt::black);
        return pix;
     }
 
-    Mlt::Filter m_convert("avcolour_space");
+    Mlt::Filter m_convert(*prof, "avcolour_space");
     m_convert.set("forced", mlt_image_rgb24a);
     m_producer.attach(m_convert);
     m_producer.seek(frame_position);
@@ -279,6 +307,7 @@ QPixmap Render::getVideoThumbnail(QString file, int frame_position, int width, i
        pix = frameThumbnail(frame, width, height, true);
        delete frame;
     }
+    if (prof) delete prof;
     return pix;
 }
 
@@ -370,7 +399,7 @@ int Render::getLength()
 bool Render::isValid(KUrl url)
 {
     char *tmp = decodedString(url.path());
-    Mlt::Producer producer(tmp);
+    Mlt::Producer producer(*m_mltProfile, tmp);
     delete[] tmp;
     if (producer.is_blank())
        return false;
@@ -389,7 +418,7 @@ void Render::getFileProperties(const QDomElement &xml, int clipId)
        kDebug()<<"////////////\n"<<doc.toString()<<"////////////////\n";
        char *tmp = decodedString(doc.toString());
 
-       Mlt::Producer producer("westley-xml", tmp);
+       Mlt::Producer producer(*m_mltProfile, "westley-xml", tmp);
        delete[] tmp;
 
        if (producer.is_blank()) {
@@ -405,11 +434,10 @@ void Render::getFileProperties(const QDomElement &xml, int clipId)
        KUrl url = xml.attribute("resource", QString::null);
        filePropertyMap["filename"] = url.path();
        filePropertyMap["duration"] = QString::number(producer.get_playtime());
-
-        Mlt::Filter m_convert("avcolour_space");
+       kDebug()<<"///////  PRODUCER: "<<url.path()<<" IS: "<<producer.get_playtime();
+        Mlt::Filter m_convert(*m_mltProfile, "avcolour_space");
         m_convert.set("forced", mlt_image_rgb24a);
         producer.attach(m_convert);
-       producer.set("profile", "hdv_1080_50i");
        Mlt::Frame * frame = producer.get_frame();
 
        if (frame->is_valid()) {
@@ -531,19 +559,13 @@ void Render::setSceneList(QDomDocument list, int position)
 
     kWarning()<<"//////  RENDER, SET SCENE LIST";
 
-    Mlt::Playlist track;
-    char *tmp = decodedString(list.toString());
-   
-    Mlt::Producer clip("westley-xml", tmp);
-    delete[] tmp;
 
+/*
     if (!clip.is_valid()) {
        kWarning()<<" ++++ WARNING, UNABLE TO CREATE MLT PRODUCER";
        m_generateScenelist = false;
        return;
-    }
-
-    track.append(clip);
+    }*/
 
     if (m_mltConsumer) {
        m_mltConsumer->set("refresh", 0);
@@ -563,8 +585,12 @@ void Render::setSceneList(QDomDocument list, int position)
        emit stopped();
     }
 
-    m_mltProducer = new Mlt::Producer(clip); //track.current();
-    m_mltProducer->optimise();
+    char *tmp = decodedString(list.toString());
+    //Mlt::Producer clip(profile, "westley-xml", tmp);
+
+    m_mltProducer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp);
+    delete[] tmp;
+    //m_mltProducer->optimise();
     if (position != 0) m_mltProducer->seek(position);
 
     /*if (KdenliveSettings::osdtimecode()) {
@@ -594,8 +620,9 @@ void Render::setSceneList(QDomDocument list, int position)
         if (!m_mltConsumer) {
            restartConsumer();
         }
-       emit playListDuration( (int) m_mltProducer->get_playtime());
-       m_connectTimer->start( 500 );
+       emit playListDuration(m_mltProducer->get_playtime());
+       //m_connectTimer->start( 500 );
+       connectPlaylist();
        m_generateScenelist = false;
   
 }
@@ -606,17 +633,20 @@ const double Render::fps() const
 }
 
 void Render::connectPlaylist() {
-        kDebug()<<"**************  CONNECTING PLAYLIST";
+
         m_connectTimer->stop();
+       m_mltConsumer->connect(*m_mltProducer);
+       m_mltProducer->set_speed(0.0);
+       m_mltConsumer->start();
+       //refresh();
+/*
        if (m_mltConsumer->start() == -1) {
                KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
                m_mltConsumer = NULL;
        }
        else {
-           m_mltConsumer->connect(*m_mltProducer);
-           m_mltProducer->set_speed(0.0);
            refresh();
-       }
+       }*/
 }
 
 void Render::refreshDisplay() {
@@ -669,18 +699,22 @@ void Render::slotOsdTimeout()
 
 void Render::start()
 {
+    kDebug()<<"-----  STARTING MONITOR: "<<m_name;
     if (!m_mltConsumer || m_winid == -1) {
+    kDebug()<<"-----  BROKEN MONITOR: "<<m_name<<", RESTART";
        restartConsumer();
        return;
     }
 
     if (m_mltConsumer->is_stopped()) {
+    kDebug()<<"-----  MONITOR: "<<m_name<<" WAS STOPPED";
        if (m_mltConsumer->start() == -1) {
            KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
            m_mltConsumer = NULL;
            return;
        }
        else {
+         kDebug()<<"-----  MONITOR: "<<m_name<<" REFRESH";
                refresh();
        }
     }
@@ -705,10 +739,10 @@ void Render::clear()
 
 void Render::stop()
 {
-    kDebug()<<"/////////////   RENDER STOP-------";
     if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
+       kDebug()<<"/////////////   RENDER STOPPED: "<<m_name;
        m_mltConsumer->set("refresh", 0);
-       // m_mltConsumer->stop();
+       m_mltConsumer->stop();
     }
     kDebug()<<"/////////////   RENDER STOP2-------";
     isBlocked = true;
@@ -899,8 +933,7 @@ void Render::exportCurrentFrame(KUrl url, bool notify) {
     int width = 1940; //KdenliveSettings::displaywidth();
 
     QPixmap pix(width, height);
-
-    Mlt::Filter m_convert("avcolour_space");
+    Mlt::Filter m_convert(*m_mltProfile, "avcolour_space");
     m_convert.set("forced", mlt_image_rgb24a);
     m_mltProducer->attach(m_convert);
     Mlt::Frame * frame = m_mltProducer->get_frame();
@@ -983,7 +1016,7 @@ void Render::mltInsertClip(int track, GenTime position, QString resource)
     Mlt::Producer trackProducer(tractor.track(track));
     Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
     char *tmp = decodedString(resource);
-    Mlt::Producer clip("westley-xml", tmp);
+    Mlt::Producer clip(*m_mltProfile, "westley-xml", tmp);
     //clip.set_in_and_out(in.frames(m_fps), out.frames(m_fps));
     delete[] tmp;
 
@@ -1076,7 +1109,6 @@ void Render::mltRemoveEffect(int track, GenTime position, QString id, QString ta
 void Render::mltAddEffect(int track, GenTime position, QString id, QString tag, QMap <QString, QString> args)
 {
     Mlt::Service service(m_mltProducer->parent().get_service());
-
     Mlt::Tractor tractor(service);
     Mlt::Producer trackProducer(tractor.track(track));
     Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
@@ -1093,7 +1125,7 @@ void Render::mltAddEffect(int track, GenTime position, QString id, QString tag,
     kDebug()<<" / / INSERTING EFFECT: "<<id;
     if (tag.startsWith("ladspa")) tag = "ladspa";
     char *filterId = decodedString(tag);
-    Mlt::Filter *filter = new Mlt::Filter(filterId);
+    Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, filterId);
     filter->set("kdenlive_id", filterId);
 
     QMap<QString, QString>::Iterator it;
@@ -1108,7 +1140,7 @@ void Render::mltAddEffect(int track, GenTime position, QString id, QString tag,
            if (currentKeyFrameNumber != keyFrameNumber) {
                // attach filter to the clip
                clipService.attach(*filter);
-               filter = new Mlt::Filter(filterId);
+               filter = new Mlt::Filter(*m_mltProfile, filterId);
                filter->set("kdenlive_id", filterId);
                keyFrameNumber = currentKeyFrameNumber;
            }
@@ -1363,9 +1395,8 @@ void Render::mltAddTransition(QString tag, int a_track, int b_track, GenTime in,
 
     Mlt::Tractor tractor(service);
     Mlt::Field *field = tractor.field();
-
     char *transId = decodedString(tag);
-    Mlt::Transition *transition = new Mlt::Transition(transId);
+    Mlt::Transition *transition = new Mlt::Transition(*m_mltProfile, transId);
     transition->set_in_and_out((int) in.frames(m_fps), (int) out.frames(m_fps));
     QMap<QString, QString>::Iterator it;
     QString key;
@@ -1392,7 +1423,7 @@ void Render::mltAddTransition(QString tag, int a_track, int b_track, GenTime in,
 void Render::mltSavePlaylist()
 {
     kWarning()<<"// UPDATING PLAYLIST TO DISK++++++++++++++++";
-    Mlt::Consumer *fileConsumer = new Mlt::Consumer("westley");
+    Mlt::Consumer *fileConsumer = new Mlt::Consumer(*m_mltProfile, "westley");
     fileConsumer->set("resource", "/home/one/playlist.xml");
 
     Mlt::Service service(m_mltProducer->get_service());
index 7f3c6b64f49c35919a4634c683761e28d5d990db..a5d3c4892600fcc84742f3b1f5fdfb71ea50a0f7 100644 (file)
@@ -31,6 +31,8 @@
 #include "effectdesc.h"
 #include "effectparamdescfactory.h"*/
 
+#include <mlt++/Mlt.h>
+
 /**Render encapsulates the client side of the interface to a renderer.
 From Kdenlive's point of view, you treat the Render object as the
 renderer, and simply use it as if it was local. Calls are asyncrhonous -
@@ -50,7 +52,7 @@ namespace Mlt {
     class Frame;
     class Producer;
     class Filter;
-
+    class Profile;
     class Multitrack;
 };
 
@@ -63,7 +65,7 @@ class Render:public QObject {
        APP_NOEXIST
     };
 
-     Render(const QString & rendererName, QWidget *parent = 0);
+     Render(const QString & rendererName, int winid, int extid, QWidget *parent = 0);
     ~Render();
 
        /** Wraps the VEML command of the same name; requests that the renderer
@@ -75,7 +77,7 @@ class Render:public QObject {
     void seek(GenTime time);
     void seekToFrame(int pos);
     
-    static QPixmap getVideoThumbnail(QString file, int frame, int width, int height);
+    static QPixmap getVideoThumbnail(char *profile, QString file, int frame, int width, int height);
     QPixmap getImageThumbnail(KUrl url, int width, int height);
 
        /** Return thumbnail for color clip */
@@ -175,6 +177,7 @@ class Render:public QObject {
      Mlt::Producer * m_mltProducer;
      Mlt::Producer *m_mltTextProducer;
      Mlt::Filter *m_osdInfo;
+     Mlt::Profile *m_mltProfile;
      double m_framePosition;
      double m_fps;
      uint m_monitorId;
index b1353db6bc33b9a3abde5778f24a17d0df1ad84c..b9e420225a4c07adc661284d9ef3405b8eb0ab42 100644 (file)
 
 #include <KDebug>
 
-#define LITTLE_MARK_X2 15
-#define LITTLE_MARK_X1 13
-#define MIDDLE_MARK_X1 9
-#define MIDDLE_MARK_X2 15
+#define LITTLE_MARK_X2 8
+#define LITTLE_MARK_X1 5
+#define MIDDLE_MARK_X1 3
+#define MIDDLE_MARK_X2 8
 
 #define LABEL_SIZE 8
 
@@ -88,13 +88,14 @@ void SmallRuler::slotNewValue ( int _value )
 }
 
 // virtual
-void SmallRuler::paintEvent(QPaintEvent * /*e*/)
+void SmallRuler::paintEvent(QPaintEvent *e)
  {
    //  debug ("KRuler::drawContents, %s",(horizontal==dir)?"horizontal":"vertical");
  
    QStylePainter p(this);
-
+   p.fillRect(e->rect(), QBrush(QColor(Qt::white)));
  
+  
    int value  = this->value(),
      minval = minimum(),
      maxval;
@@ -144,8 +145,8 @@ void SmallRuler::paintEvent(QPaintEvent * /*e*/)
  
    // draw pointer
    if (showPointer()) {
-     QPolygon pa(4);
-       pa.setPoints(3, value-6, 9, value+6, 9, value/*+0*/, 16);
+     QPolygon pa(3);
+       pa.setPoints(3, value-6, 0, value+6, 0, value/*+0*/, 8);
      p.setBrush( QBrush(Qt::yellow) );
      p.drawPolygon( pa );
    }
index a6104ddbe709246e3799ea6cadc2ec7409818eb7..cf09b464528e7b7284d911918c381c455426bcd9 100644 (file)
@@ -40,8 +40,8 @@ TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
   view->setupUi(this);
   m_ruler = new CustomRuler(doc->timecode());
   QVBoxLayout *layout = new QVBoxLayout;
-  layout->addWidget(m_ruler);
   view->ruler_frame->setLayout(layout);
+  layout->addWidget(m_ruler);
 
   m_scene = new QGraphicsScene();
   m_trackview = new CustomTrackView(m_doc->commandStack(), m_scene, this);
@@ -59,10 +59,10 @@ TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
   tracksLayout->addWidget(m_trackview);
 
   parseDocument(doc->toXml());
-
+/*
   TrackPanelClipMoveFunction *m_moveFunction = new TrackPanelClipMoveFunction(this);
   registerFunction("move", m_moveFunction);
-  setEditMode("move");
+  setEditMode("move");*/
 
   connect(view->horizontalSlider, SIGNAL(valueChanged ( int )), this, SLOT(slotChangeZoom( int )));
   connect(m_ruler, SIGNAL(cursorMoved ( int )), m_trackview, SLOT(setCursorPos( int )));
@@ -166,11 +166,11 @@ int TrackView::slotAddAudioTrack(int ix, QDomElement xml)
 {
   kDebug()<<"*************  ADD AUDIO TRACK "<<ix;
   m_trackview->addTrack();
-  DocumentTrack *track = new DocumentAudioTrack(xml, this, m_trackview);
+  //DocumentTrack *track = new DocumentAudioTrack(xml, this, m_trackview);
   HeaderTrack *header = new HeaderTrack();
   //m_tracksAreaLayout->addWidget(track); //, ix, Qt::AlignTop);
   m_headersLayout->addWidget(header); //, ix, Qt::AlignTop);
-  documentTracks.insert(ix, track);
+  //documentTracks.insert(ix, track);
   return 0;
   //track->show();
 }
@@ -178,7 +178,7 @@ int TrackView::slotAddAudioTrack(int ix, QDomElement xml)
 int TrackView::slotAddVideoTrack(int ix, QDomElement xml)
 {
   m_trackview->addTrack();
-  DocumentTrack *track = new DocumentVideoTrack(xml, this, m_trackview);
+  //DocumentTrack *track = new DocumentVideoTrack(xml, this, m_trackview);
   HeaderTrack *header = new HeaderTrack();
   int trackTop = 50 * ix;
   int trackBottom = trackTop + 50;
@@ -194,7 +194,7 @@ int TrackView::slotAddVideoTrack(int ix, QDomElement xml)
     int in = elem.attribute("in", 0).toInt();
     int out = elem.attribute("out", 0).toInt() - in;
     //kDebug()<<"++++++++++++++\n\n / / /ADDING CLIP: "<<clip.cropTime<<", out: "<<clip.duration<<", Producer: "<<clip.producer<<"\n\n++++++++++++++++++++";
-    ClipItem *item = new ClipItem(elem, ix, in, QRectF(position * m_scale, trackTop + 1, out * m_scale, 49), out);
+    ClipItem *item = new ClipItem(elem, ix, position, QRectF(position * m_scale, trackTop + 1, out * m_scale, 49), out);
     m_scene->addItem(item);
     position += out;
 
@@ -205,7 +205,7 @@ int TrackView::slotAddVideoTrack(int ix, QDomElement xml)
 
   //m_tracksAreaLayout->addWidget(track); //, ix, Qt::AlignTop);
   m_headersLayout->addWidget(header); //, ix, Qt::AlignTop);
-  documentTracks.insert(ix, track);
+  //documentTracks.insert(ix, track);
   kDebug()<<"*************  ADD VIDEO TRACK "<<ix<<", DURATION: "<<position;
   return position;
   //track->show();
index 46c605f649bd106102cd68963575cf06d069cd13..dcfa70b907996e510e1dd570fe4edf727c12d357 100644 (file)
@@ -5,24 +5,36 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>320</width>
-    <height>238</height>
+    <width>339</width>
+    <height>216</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Form</string>
   </property>
   <layout class="QGridLayout" >
+   <property name="leftMargin" >
+    <number>0</number>
+   </property>
+   <property name="topMargin" >
+    <number>0</number>
+   </property>
+   <property name="rightMargin" >
+    <number>0</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>0</number>
+   </property>
+   <property name="horizontalSpacing" >
+    <number>0</number>
+   </property>
    <property name="verticalSpacing" >
     <number>0</number>
    </property>
    <item row="0" column="0" colspan="2" >
     <widget class="QFrame" name="video_frame" >
-     <property name="frameShape" >
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow" >
-      <enum>QFrame::Raised</enum>
+     <property name="lineWidth" >
+      <number>0</number>
      </property>
     </widget>
    </item>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
-     <property name="frameShape" >
-      <enum>QFrame::StyledPanel</enum>
+     <property name="minimumSize" >
+      <size>
+       <width>16</width>
+       <height>15</height>
+      </size>
+     </property>
+     <property name="maximumSize" >
+      <size>
+       <width>16777215</width>
+       <height>15</height>
+      </size>
      </property>
-     <property name="frameShadow" >
-      <enum>QFrame::Raised</enum>
+     <property name="lineWidth" >
+      <number>0</number>
      </property>
     </widget>
    </item>