]> git.sesse.net Git - kdenlive/commitdiff
newstuff and templates for title
authorMarco Gittler <marco@gitma.de>
Sun, 21 Feb 2010 19:03:33 +0000 (19:03 +0000)
committerMarco Gittler <marco@gitma.de>
Sun, 21 Feb 2010 19:03:33 +0000 (19:03 +0000)
ask if changes are made to title

svn path=/trunk/kdenlive/; revision=4334

13 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/kdenlive_titles.knsrc [new file with mode: 0644]
src/kdenliveui.rc
src/mainwindow.cpp
src/mainwindow.h
src/titlewidget.cpp
src/titlewidget.h
src/widgets/titlewidget_ui.ui
titles/CMakeLists.txt [new file with mode: 0644]
titles/simple-scroll.kdenlivetitle [new file with mode: 0644]
titles/simple-with-date.kdenlivetitle [new file with mode: 0644]
titles/simple.kdenlivetitle [new file with mode: 0644]

index 8e1d0471769a1f4396cead2c24fbbedca9f56faf..be663dcfd6ada4d74368ad920209b7b54ff13344 100644 (file)
@@ -52,6 +52,7 @@ add_subdirectory(export)
 add_subdirectory(icons)
 add_subdirectory(data)
 add_subdirectory(lumas)
+add_subdirectory(titles)
 add_subdirectory(po)
 add_subdirectory(man)
 
index 5c9cb0d6ab0beaee8ee86a27cb62cd59820f6472..4e27a1104591a72787675fe5eb2c5c2e61744147 100644 (file)
@@ -232,7 +232,7 @@ install( FILES kdenliveui.rc kdenlive.notifyrc DESTINATION  ${DATA_INSTALL_DIR}/
 install (FILES kdenlivesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR})
 install (FILES kdenlive.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
 kde4_install_icons(${ICON_INSTALL_DIR})
-install( FILES kdenlive_wipes.knsrc kdenlive_renderprofiles.knsrc kdenlive_projectprofiles.knsrc kdenlivetranscodingrc DESTINATION  ${CONFIG_INSTALL_DIR} )
+install( FILES kdenlive_titles.knsrc kdenlive_wipes.knsrc kdenlive_renderprofiles.knsrc kdenlive_projectprofiles.knsrc kdenlivetranscodingrc DESTINATION  ${CONFIG_INSTALL_DIR} )
 kde4_install_icons( ${ICON_INSTALL_DIR} )
 
 
diff --git a/src/kdenlive_titles.knsrc b/src/kdenlive_titles.knsrc
new file mode 100644 (file)
index 0000000..d502c74
--- /dev/null
@@ -0,0 +1,9 @@
+[KNewStuff2]
+ProvidersUrl=http://kdenlive.org/data/titletemplates.xml
+TargetDir=kdenlive/titles
+Uncompress=archive
+
+[KNewStuff3]
+ProvidersUrl=http://kdenlive.org/data/titletemplates.xml
+TargetDir=kdenlive/titles
+Uncompress=archive
index 3fcb2e01186a65c7f33e60dcde0e0bac8bd4638c..fa83cb678d4ec4996464a6b7fef4fe859be755e4 100644 (file)
       <Action name="get_new_lumas" />
       <Action name="get_new_profiles" />
       <Action name="get_new_mlt_profiles" />
+      <Action name="get_new_titles" />
       <Action name="run_wizard" />
       <Menu name="themes_menu" ><text>Themes</text>
       </Menu>
index 1c9f4984ad3abc381d82e229b923824c8fe12a98..4a1a0c670d46e5b628c5337125f13e86c3db3c7d 100644 (file)
@@ -956,6 +956,8 @@ void MainWindow::setupActions()
 
     KNS3::standardAction(i18n("Download New Project Profiles..."), this, SLOT(slotGetNewMltProfileStuff()), actionCollection(), "get_new_mlt_profiles");
 
+    KNS3::standardAction(i18n("Download New Title Templates..."), this, SLOT(slotGetNewTitleStuff()), actionCollection(), "get_new_titles");
+
     KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
     collection->addAction("run_wizard", wizAction);
     connect(wizAction, SIGNAL(triggered(bool)), this, SLOT(slotRunWizard()));
@@ -2930,6 +2932,13 @@ int MainWindow::getNewStuff(const QString &configFile)
     return entries.size();
 }
 
+void MainWindow::slotGetNewTitleStuff()
+{
+    if (getNewStuff("kdenlive_titles.knsrc") > 0) {
+        TitleWidget::refreshTitleTemplates();
+    }
+}
+
 void MainWindow::slotGetNewLumaStuff()
 {
     if (getNewStuff("kdenlive_wipes.knsrc") > 0) {
index 67a8d6abd57b0353fbd9ddff38650810d6b31df8..7fb488d49c09059b5837ea8992b4d19054c8da5a 100644 (file)
@@ -309,6 +309,7 @@ private slots:
     void slotDeleteTrack(int ix = 0);
     void slotChangeTrack(int ix = 0);
     void slotGetNewLumaStuff();
+    void slotGetNewTitleStuff();
     void slotGetNewRenderStuff();
     void slotGetNewMltProfileStuff();
     void slotAutoTransition();
index 48c369f0c9e6439100e71851b852013e79062183..e0e2de949f3c2b63cb2642a6c92e8cfbd0bcbba8 100644 (file)
@@ -18,7 +18,7 @@
 #include "titlewidget.h"
 #include "kdenlivesettings.h"
 #include "KoSliderCombo.h"
-
+#include "kthumb.h"
 #include <cmath>
 
 #include <KDebug>
@@ -38,6 +38,8 @@
 #include <QSignalMapper>
 #include <QTextBlockFormat>
 #include <QTextCursor>
+#include <QComboBox>
+#include <QCryptographicHash>
 
 #if QT_VERSION >= 0x040600
 #include <QGraphicsEffect>
@@ -45,6 +47,8 @@
 #include <QGraphicsDropShadowEffect>
 #endif
 
+static QList<TitleTemplate> titletemplates;
+
 int settingUp = false;
 
 const int IMAGEITEM = 7;
@@ -424,8 +428,18 @@ TitleWidget::TitleWidget(KUrl url, Timecode tc, QString projectTitlePath, Render
     initAnimation();
     connect(anim_start, SIGNAL(toggled(bool)), this, SLOT(slotAnimStart(bool)));
     connect(anim_end, SIGNAL(toggled(bool)), this, SLOT(slotAnimEnd(bool)));
+       connect(templateBox,SIGNAL(currentIndexChanged(int)),this,SLOT(templateIndexChanged(int)));
 
     buttonBox->button(QDialogButtonBox::Ok)->setEnabled(KdenliveSettings::hastitleproducer());
+       refreshTitleTemplates();
+       templateBox->setIconSize(QSize(60,60));
+       templateBox->clear();
+       templateBox->addItem("");
+       foreach (TitleTemplate t, titletemplates)
+       {
+               templateBox->addItem(t.icon,t.name,t.file);
+       }
+       lastDocumentHash=QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex();
 }
 
 TitleWidget::~TitleWidget()
@@ -507,8 +521,42 @@ QStringList TitleWidget::extractFontList(QString xml)
     }
     return result;
 }
-
-
+//static
+void TitleWidget::refreshTitleTemplates()
+{
+       QStringList titlenamelist = QStringList() << i18n("None");
+    QStringList titlefiles = QStringList() << QString();
+    QStringList filters;
+    filters << "*.kdenlivetitle" ;
+       titletemplates.clear();
+    QStringList titleTemplates = KGlobal::dirs()->findDirs("appdata", "titles");
+    foreach(const QString &folder, titleTemplates) {
+        QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
+        foreach(const QString &fname, filesnames) {
+                       //titlenamelist.append(fname);
+            //titlefiles.append(KUrl(folder).path(KUrl::AddTrailingSlash) + fname);
+                       TitleTemplate t;
+                       t.name=fname;
+                       t.file=KUrl(folder).path(KUrl::AddTrailingSlash) + fname;
+                       t.icon=QIcon(KThumb::getImage(t.file,0,60,60));
+                       titletemplates.append(t);               
+        }
+    }
+       kDebug()  << titlenamelist << titlefiles;
+}
+void TitleWidget::templateIndexChanged(int index )
+{
+       QString item=templateBox->itemData(index).toString();
+       if (item!="")
+       {
+               if (lastDocumentHash!=QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex())
+               {
+                        if (KMessageBox::questionYesNo(this, i18n("Title was changed !\nDo you realy want to load a new Template?\nAll changes in this Document are lost !!")) == KMessageBox::No) return;
+               }
+               loadTitle(item);
+               lastDocumentHash=QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex();
+       }
+}
 //virtual
 void TitleWidget::resizeEvent(QResizeEvent * /*event*/)
 {
index 44e38ced5789d40d9044c917041e13b50dc647ff..a76c085577a246fe91e38a16b86497e0c11c3dbd 100644 (file)
 #include <QMap>
 #include <QSignalMapper>
 
+class TitleTemplate
+{
+public:
+       QString file;
+       QString name;
+       QIcon icon;
+};
 
 class Transform
 {
@@ -44,6 +51,7 @@ public:
     double rotatex, rotatey, rotatez;
 };
 
+
 class TitleWidget : public QDialog , public Ui::TitleWidget_UI
 {
     Q_OBJECT
@@ -85,6 +93,8 @@ public:
 
     /** \brief Get clip duration. */
     int duration() const;
+       /** load Title Templates*/
+       static void refreshTitleTemplates();
 
 protected:
     virtual void resizeEvent(QResizeEvent * event);
@@ -124,6 +134,7 @@ private:
     /** project path for storing title clips */
     QString m_projectTitlePath;
     Timecode m_tc;
+       QString lastDocumentHash;
 
     /** See http://doc.trolltech.com/4.5/signalsandslots.html#advanced-signals-and-slots-usage */
     QSignalMapper *m_signalMapper;
@@ -290,6 +301,7 @@ private slots:
     void slotZIndexDown();
     void slotZIndexTop();
     void slotZIndexBottom();
+       void templateIndexChanged(int);
 };
 
 
index aa6e53a40d4910df5b71403229755018483d7201..d818299950ac1ab7e1419b00add87be8516d8437 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>977</width>
-    <height>633</height>
+    <width>1383</width>
+    <height>835</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -36,7 +36,7 @@
      </property>
     </widget>
    </item>
-   <item row="0" column="5" colspan="4">
+   <item row="0" column="5" colspan="6">
     <widget class="QFrame" name="frame_properties">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
      </layout>
     </widget>
    </item>
-   <item row="2" column="0" colspan="8">
+   <item row="2" column="0" colspan="10">
     <widget class="QSplitter" name="splitter">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
            </item>
            <item row="0" column="0">
             <widget class="KColorButton" name="backgroundColor">
-             <property name="color">
+             <property name="color" stdset="0">
               <color>
                <red>0</red>
                <green>0</green>
                <blue>0</blue>
               </color>
              </property>
-             <property name="defaultColor">
+             <property name="defaultColor" stdset="0">
               <color>
                <red>0</red>
                <green>0</green>
      </property>
     </widget>
    </item>
-   <item row="1" column="0" colspan="9">
+   <item row="1" column="0" colspan="11">
     <widget class="QStackedWidget" name="toolbar_stack">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
        </item>
        <item row="0" column="1">
         <widget class="KColorButton" name="rectBColor">
-         <property name="color">
+         <property name="color" stdset="0">
           <color>
            <red>0</red>
            <green>0</green>
            <blue>0</blue>
           </color>
          </property>
-         <property name="defaultColor">
+         <property name="defaultColor" stdset="0">
           <color>
            <red>0</red>
            <green>0</green>
        </item>
        <item row="0" column="5">
         <widget class="KColorButton" name="rectFColor">
-         <property name="color">
+         <property name="color" stdset="0">
           <color>
            <red>0</red>
            <green>0</green>
            <blue>0</blue>
           </color>
          </property>
-         <property name="defaultColor">
+         <property name="defaultColor" stdset="0">
           <color>
            <red>0</red>
            <green>0</green>
          <property name="flat">
           <bool>false</bool>
          </property>
-         <property name="color">
+         <property name="color" stdset="0">
           <color>
            <red>0</red>
            <green>0</green>
            <blue>0</blue>
           </color>
          </property>
-         <property name="defaultColor">
+         <property name="defaultColor" stdset="0">
           <color>
            <red>0</red>
            <green>0</green>
      </widget>
     </widget>
    </item>
-   <item row="3" column="6">
+   <item row="3" column="8">
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
+   <item row="3" column="7">
+    <widget class="QComboBox" name="templateBox"/>
+   </item>
+   <item row="3" column="6">
+    <widget class="QLabel" name="label_22">
+     <property name="text">
+      <string>Template:</string>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
diff --git a/titles/CMakeLists.txt b/titles/CMakeLists.txt
new file mode 100644 (file)
index 0000000..21ce682
--- /dev/null
@@ -0,0 +1,2 @@
+FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.kdenlivetitle")
+INSTALL (FILES ${files} DESTINATION ${DATA_INSTALL_DIR}/kdenlive/titles)
diff --git a/titles/simple-scroll.kdenlivetitle b/titles/simple-scroll.kdenlivetitle
new file mode 100644 (file)
index 0000000..24df74a
--- /dev/null
@@ -0,0 +1,11 @@
+<kdenlivetitle width="1920" height="1080" out="125">
+ <item z-index="0" type="QGraphicsTextItem">
+  <position x="728" y="443">
+   <transform>1,0,0,0,1,0,0,0,1</transform>
+  </position>
+  <content font-color="254,255,240,255" font-outline-color="0,0,0,255" font-pixel-size="79" font-italic="0" font-underline="0" font-weight="50" font="Arial Black" font-outline="2.7">Text here</content>
+ </item>
+ <startviewport rect="0,-692.22,1920,1080"/>
+ <endviewport rect="-3.64326,613.89,1920,1080"/>
+ <background color="0,0,0,0"/>
+</kdenlivetitle>
diff --git a/titles/simple-with-date.kdenlivetitle b/titles/simple-with-date.kdenlivetitle
new file mode 100644 (file)
index 0000000..724b47e
--- /dev/null
@@ -0,0 +1,23 @@
+<kdenlivetitle width="1920" height="1080" out="125">
+ <item z-index="3" type="QGraphicsTextItem">
+  <position x="106" y="869">
+   <transform>1,0,0,0,1,0,0,0,1</transform>
+  </position>
+  <content font-color="255,255,255,255" font-outline-color="0,0,0,255" font-pixel-size="46" font-italic="0" font-underline="0" font-weight="50" font="Arial Black" font-outline="1.2">2010/01/01</content>
+ </item>
+ <item z-index="2" type="QGraphicsTextItem">
+  <position x="1148" y="907">
+   <transform>1,0,0,0,1,0,0,0,1</transform>
+  </position>
+  <content font-color="254,255,240,255" font-outline-color="0,0,0,255" font-pixel-size="79" font-italic="0" font-underline="0" font-weight="50" font="Arial Black" font-outline="2.7">Text here </content>
+ </item>
+ <item z-index="1" type="QGraphicsRectItem">
+  <position x="-6" y="850">
+   <transform zoom="100">1,0,0,0,1,0,0,0,1</transform>
+  </position>
+  <content pencolor="0,0,0,0" rect="0,0,1936,234" penwidth="0" brushcolor="175,175,175,136"/>
+ </item>
+ <startviewport rect="0,0,1920,1080"/>
+ <endviewport rect="0,0,1920,1080"/>
+ <background color="0,0,0,0"/>
+</kdenlivetitle>
diff --git a/titles/simple.kdenlivetitle b/titles/simple.kdenlivetitle
new file mode 100644 (file)
index 0000000..f12503c
--- /dev/null
@@ -0,0 +1,11 @@
+<kdenlivetitle width="1920" height="1080" out="125">
+ <item z-index="0" type="QGraphicsTextItem">
+  <position x="728" y="443">
+   <transform>1,0,0,0,1,0,0,0,1</transform>
+  </position>
+  <content font-color="254,255,240,255" font-outline-color="0,0,0,255" font-pixel-size="79" font-italic="0" font-underline="0" font-weight="50" font="Arial Black" font-outline="2.7">Text here</content>
+ </item>
+ <startviewport rect="0,0,1920,1080"/>
+ <endviewport rect="0,0,1920,1080"/>
+ <background color="0,0,0,0"/>
+</kdenlivetitle>