]> git.sesse.net Git - mlt/commitdiff
Merge branch 'jbm-kdenlivetitle' into kdenlivetitle
authorMarco Gittler <g.marco@freenet.de>
Fri, 24 Jul 2009 09:39:03 +0000 (11:39 +0200)
committerMarco Gittler <g.marco@freenet.de>
Fri, 24 Jul 2009 09:39:03 +0000 (11:39 +0200)
Conflicts:
src/modules/qimage/factory.c
src/modules/qimage/kdenlivetitle_wrapper.cpp
src/modules/qimage/kdenlivetitle_wrapper.h
src/modules/qimage/producer_kdenlivetitle.c

1  2 
src/modules/qimage/kdenlivetitle_wrapper.cpp
src/modules/qimage/kdenlivetitle_wrapper.h
src/modules/qimage/producer_kdenlivetitle.c

index 3c9f5a808b2b21124e569a63f0fdbf1acb04115c,0e7d4f41a338a87e223fad7e2a2e7eaf8e4e60fc..dfc27397ea123b2931e3f5f006b1752c55796359
@@@ -40,9 -40,9 +40,9 @@@ extern "C
        {
                titleclass=new Title( QString( c ) );
        }
-       void refresh_kdenlivetitle( uint8_t* buffer, int width, int height , double position )
 -      void refresh_kdenlivetitle( uint8_t* buffer, int width, int height , double position, char *templatexml, char *templatetext  )
++      void refresh_kdenlivetitle( uint8_t* buffer, int width, int height , double position, char *templatexml, char *templatetext )
        {
-               titleclass->drawKdenliveTitle( buffer,width,height,position );
+               titleclass->drawKdenliveTitle( buffer, width, height, position, templatexml, templatetext );
        }
  }
  Title::Title( const QString& filename ):m_filename( filename ),m_scene( NULL )
@@@ -64,7 -64,7 +64,7 @@@ void Title::drawKdenliveTitle( uint8_t 
                        //if (!app)
                        app=new QApplication( argc,argv );
                m_scene=new QGraphicsScene;
-               loadDocument( m_filename,start,end );
 -              loadDocument( m_filename, start, end, QString(templatexml), QString(templatetext) );
++              loadDocument( m_filename, start, end, QString( templatexml ), QString( templatetext ) );
        }
        //must be extracted from kdenlive title
  
@@@ -96,16 -96,21 +96,23 @@@ int Title::loadDocument( const QString
        QDomDocument doc;
        if ( !m_scene )
                return -1;
-       QFile file( url );
-       if ( file.open( QIODevice::ReadOnly ) )
 -      if (!templateXml.isEmpty()) {
 -              doc.setContent(templateXml);
++      if ( !templateXml.isEmpty() )
++      {
++              doc.setContent( templateXml );
+       }
 -      else {
++      else
 +      {
-               doc.setContent( &file, false );
-               file.close();
+               QFile file( url );
+               if ( file.open( QIODevice::ReadOnly ) )
+               {
+                       doc.setContent( &file, false );
+                       file.close();
+               }
        }
-       return loadFromXml( doc, startv, endv );
+       return loadFromXml( doc, startv, endv, templateText );
  }
- int Title::loadFromXml( QDomDocument doc, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv )
+ int Title::loadFromXml( QDomDocument doc, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv, const QString templateText )
  {
        QDomNodeList titles = doc.elementsByTagName( "kdenlivetitle" );
        int maxZValue = 0;
                                        else
                                                font.setPixelSize( txtProperties.namedItem( "font-pixel-size" ).nodeValue().toInt() );
                                        QColor col( stringToColor( txtProperties.namedItem( "font-color" ).nodeValue() ) );
-                                       QGraphicsTextItem *txt = m_scene->addText( items.item( i ).namedItem( "content" ).firstChild().nodeValue(), font );
+                                       QGraphicsTextItem *txt;
 -                                      if (!templateText.isEmpty()) {
 -                                              QString text = items.item(i).namedItem("content").firstChild().nodeValue();
 -                                              text = text.replace("%s", templateText);
 -                                              txt = m_scene->addText(text, font);
++                                      if ( !templateText.isEmpty() )
++                                      {
++                                              QString text = items.item( i ).namedItem( "content" ).firstChild().nodeValue();
++                                              text = text.replace( "%s", templateText );
++                                              txt = m_scene->addText( text, font );
+                                       }
+                                       else txt = m_scene->addText( items.item( i ).namedItem( "content" ).firstChild().nodeValue(), font );
                                        txt->setDefaultTextColor( col );
                                        txt->setTextInteractionFlags( Qt::NoTextInteraction );
                                        if ( txtProperties.namedItem( "alignment" ).isNull() == false )
index 490047a16e73fa2d4e06de57f608eaa020d40e5a,0713d66119971df4752dfe137e7a74f8c31c5247..31943bf2262fa9f352e58118e13b5b1ec6e36e55
@@@ -34,11 -34,11 +34,11 @@@ class Title: public QObjec
  
  public:
        Title( const QString & );
-       void drawKdenliveTitle( uint8_t*,int,int,double );
+       void drawKdenliveTitle( uint8_t*, int, int, double, char*, char* );
  private:
        QString m_filename;
-       int  loadFromXml( QDomDocument doc, QGraphicsPolygonItem* /*startv*/, QGraphicsPolygonItem* /*endv*/ );
-       int loadDocument( const QString& url, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv );
 -      int loadDocument(const QString& url, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv, const QString templateXml, const QString templateText);
 -        int  loadFromXml(QDomDocument doc, QGraphicsPolygonItem* /*startv*/, QGraphicsPolygonItem* /*endv*/, const QString templateText);
++      int loadDocument( const QString& url, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv, const QString templateXml, const QString templateText );
++      int  loadFromXml( QDomDocument doc, QGraphicsPolygonItem* /*startv*/, QGraphicsPolygonItem* /*endv*/, const QString templateText );
        QGraphicsView *view;
        QGraphicsScene *m_scene;
        QGraphicsPolygonItem *start,*end;
index 2b270cf32ac6d241d68398ee94068cbd7a20693f,36dfc8c843daec265ea47e80b5a2ac1b7d1c4aae..44821a3b44be61d1b005336af2562e2958e4e600
@@@ -57,7 -57,7 +57,7 @@@ static int producer_get_image( mlt_fram
                mlt_position out = mlt_producer_get_out( producer );
                mlt_position time = mlt_frame_get_position( frame );
                double position = ( double )( time - in ) / ( double )( out - in + 1 );
-               refresh_kdenlivetitle( *buffer, *width, *height, position );
 -              refresh_kdenlivetitle(*buffer, *width, *height, position, mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "templatexml" ), mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "templatetext" ));
++              refresh_kdenlivetitle( *buffer, *width, *height, position, mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "templatexml" ), mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "templatetext" ) );
                mlt_log_debug( MLT_PRODUCER_SERVICE( producer ), "width:%d height:%d %s\n", *width, *height, mlt_image_format_name( *format ) );
        }