Commit f6969659 authored by Marco Gittler's avatar Marco Gittler
Browse files

newstuff and templates for title

ask if changes are made to title

svn path=/trunk/kdenlive/; revision=4334
parent 88e76c76
......@@ -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)
......
......@@ -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} )
[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
......@@ -153,6 +153,7 @@
<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>
......
......@@ -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) {
......
......@@ -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();
......
......@@ -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*/)
{
......
......@@ -29,6 +29,13 @@
#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);
};
......
......@@ -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">
......@@ -195,7 +195,7 @@
</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">
......@@ -552,14 +552,14 @@
</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>
......@@ -737,7 +737,7 @@
</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">
......@@ -785,14 +785,14 @@
</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>
......@@ -820,14 +820,14 @@
</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>
......@@ -900,14 +900,14 @@
<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>
......@@ -1085,7 +1085,7 @@
</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>
......@@ -1095,6 +1095,16 @@
</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>
......
FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.kdenlivetitle")
INSTALL (FILES ${files} DESTINATION ${DATA_INSTALL_DIR}/kdenlive/titles)
<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>
<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>
<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>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment