widgets/monitor_ui.ui
widgets/recmonitor_ui.ui
widgets/colorclip_ui.ui
+ widgets/slideshowclip_ui.ui
widgets/configmisc_ui.ui
widgets/configenv_ui.ui
widgets/configdisplay_ui.ui
editfoldercommand.cpp
clipproperties.cpp
movetransitioncommand.cpp
+ slideshowclip.cpp
)
kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
setRect(rect);
kDebug() << "///// NEW CLIP RECT: " << rect;
m_fps = fps;
- m_xml = clip->toXML();
m_clipName = clip->name();
m_producer = clip->getId();
m_clipType = clip->clipType();
m_cropStart = GenTime();
- m_maxDuration = m_cropDuration;
+ m_maxDuration = clip->maxDuration();
setAcceptDrops(true);
audioThumbReady = clip->audioThumbCreated();
/*
connect(this , SIGNAL(prepareAudioThumb(double, QPainterPath, int, int)) , this, SLOT(slotPrepareAudioThumb(double, QPainterPath, int, int)));
setBrush(QColor(141, 166, 215));
- if (m_clipType == VIDEO || m_clipType == AV) {
+ if (m_clipType == VIDEO || m_clipType == AV || m_clipType == SLIDESHOW) {
m_hasThumbs = true;
connect(this, SIGNAL(getThumb(int, int)), clip->thumbProducer(), SLOT(extractImage(int, int)));
connect(clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
endThumbTimer = new QTimer(this);
endThumbTimer->setSingleShot(true);
connect(endThumbTimer, SIGNAL(timeout()), this, SLOT(slotGetEndThumb()));
-
} else if (m_clipType == COLOR) {
- m_maxDuration = GenTime(10000, m_fps);
- QString colour = m_xml.attribute("colour");
+ QString colour = clip->getProperty("colour");
colour = colour.replace(0, 2, "#");
setBrush(QColor(colour.left(7)));
} else if (m_clipType == IMAGE || m_clipType == TEXT) {
- m_maxDuration = GenTime(10000, m_fps);
- m_startPix = KThumb::getImage(KUrl(m_xml.attribute("resource")), (int)(50 * KdenliveSettings::project_display_ratio()), 50);
+ m_startPix = KThumb::getImage(KUrl(clip->getProperty("resource")), (int)(50 * KdenliveSettings::project_display_ratio()), 50);
m_endPix = m_startPix;
} else if (m_clipType == AUDIO) {
connect(clip, SIGNAL(gotAudioData()), this, SLOT(slotGotAudioData()));
audioThumbCachePic.clear();
}
+
+void ClipItem::refreshClip() {
+ m_maxDuration = m_clip->maxDuration();
+ if (m_clipType == VIDEO || m_clipType == AV || m_clipType == SLIDESHOW) slotFetchThumbs();
+ else if (m_clipType == COLOR) {
+ QString colour = m_clip->getProperty("colour");
+ colour = colour.replace(0, 2, "#");
+ setBrush(QColor(colour.left(7)));
+ } else if (m_clipType == IMAGE || m_clipType == TEXT) {
+ m_startPix = KThumb::getImage(KUrl(m_clip->getProperty("resource")), (int)(50 * KdenliveSettings::project_display_ratio()), 50);
+ m_endPix = m_startPix;
+ }
+}
+
void ClipItem::slotFetchThumbs() {
m_thumbsRequested += 2;
emit getThumb((int)m_cropStart.frames(m_fps), (int)(m_cropStart + m_cropDuration).frames(m_fps));
}
QDomElement ClipItem::xml() const {
- return m_xml;
+ return m_clip->toXML();
}
int ClipItem::clipType() {
void addTransition(Transition*);
/** regenerate audio and video thumbnails */
void resetThumbs();
+ /** update clip properties from base clip */
+ void refreshClip();
protected:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
private:
- QDomElement m_xml;
DocClipBase *m_clip;
OPERATIONTYPE m_resizeMode;
int m_grabPoint;
m_doc->commandStack()->push(command);
}
+void ClipManager::slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, QString group, const int groupId) {
+ QDomDocument doc;
+ QDomElement prod = doc.createElement("producer");
+ prod.setAttribute("resource", path);
+ prod.setAttribute("type", (int) SLIDESHOW);
+ uint id = m_clipIdCounter++;
+ prod.setAttribute("id", QString::number(id));
+ prod.setAttribute("in", "0");
+ prod.setAttribute("out", m_doc->getFramePos(duration) * count);
+ prod.setAttribute("ttl", m_doc->getFramePos(duration));
+ prod.setAttribute("name", name);
+ prod.setAttribute("loop", loop);
+ if (!group.isEmpty()) {
+ prod.setAttribute("groupname", group);
+ prod.setAttribute("groupid", groupId);
+ }
+ AddClipCommand *command = new AddClipCommand(m_doc, prod, id, true);
+ m_doc->commandStack()->push(command);
+}
+
void ClipManager::slotAddTextClipFile(const QString path, const QString group, const int groupId) {
void slotAddClipFile(const KUrl url, const QString group, const int groupId);
void slotAddTextClipFile(const QString path, const QString group, const int groupId);
void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const int groupId);
+ void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, bool loop, const QString group, const int groupId);
DocClipBase *getClipById(int clipId);
void slotDeleteClip(uint clipId);
void setThumbsProgress(KUrl url, int progress);
#include "clipproperties.h"
#include "kthumb.h"
+#define VIDEOTAB 0
+#define AUDIOTAB 1
+#define COLORTAB 2
+#define SLIDETAB 3
+#define ADVANCEDTAB 4
+
+#define TYPE_JPEG 0
+#define TYPE_PNG 1
+#define TYPE_BMP 2
+#define TYPE_GIF 3
+
ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent): QDialog(parent), m_tc(tc), m_clip(clip), m_fps(fps) {
setFont(KGlobalSettings::toolBarFont());
m_view.setupUi(this);
QMap <QString, QString> props = m_clip->properties();
if (props.contains("audiocodec"))
- m_view.clip_acodec->setText(props["audiocodec"]);
+ m_view.clip_acodec->setText(props.value("audiocodec"));
if (props.contains("frequency"))
- m_view.clip_frequency->setText(props["frequency"]);
+ m_view.clip_frequency->setText(props.value("frequency"));
if (props.contains("channels"))
- m_view.clip_channels->setText(props["channels"]);
+ m_view.clip_channels->setText(props.value("channels"));
CLIPTYPE t = m_clip->clipType();
- if (t != AUDIO) {
+ if (t == COLOR) {
+ m_view.clip_path->setEnabled(false);
+ m_view.tabWidget->removeTab(SLIDETAB);
+ m_view.tabWidget->removeTab(AUDIOTAB);
+ m_view.tabWidget->removeTab(VIDEOTAB);
+ m_view.clip_thumb->setHidden(true);
+ m_view.clip_color->setColor(QColor("#" + props.value("colour").right(8).left(6)));
+ }
+ else if (t == SLIDESHOW) {
+ m_view.tabWidget->removeTab(COLORTAB);
+ m_view.tabWidget->removeTab(AUDIOTAB);
+ m_view.tabWidget->removeTab(VIDEOTAB);
+ QStringList types;
+ types << "JPG" << "PNG" << "BMP" << "GIF";
+ m_view.image_type->addItems(types);
+ m_view.slide_loop->setChecked(props.value("loop").toInt());
+ QString path = props.value("resource");
+ if (path.endsWith("png")) m_view.image_type->setCurrentIndex(TYPE_PNG);
+ else if (path.endsWith("bmp")) m_view.image_type->setCurrentIndex(TYPE_BMP);
+ else if (path.endsWith("gif")) m_view.image_type->setCurrentIndex(TYPE_GIF);
+ m_view.slide_duration->setText(tc.getTimecodeFromFrames(props.value("ttl").toInt()));
+ }
+ else if (t != AUDIO) {
+ m_view.tabWidget->removeTab(SLIDETAB);
+ m_view.tabWidget->removeTab(COLORTAB);
if (props.contains("frame_size"))
- m_view.clip_size->setText(props["frame_size"]);
+ m_view.clip_size->setText(props.value("frame_size"));
if (props.contains("videocodec"))
- m_view.clip_vcodec->setText(props["videocodec"]);
+ m_view.clip_vcodec->setText(props.value("videocodec"));
if (props.contains("fps"))
- m_view.clip_fps->setText(props["fps"]);
+ m_view.clip_fps->setText(props.value("fps"));
if (props.contains("aspect_ratio"))
- m_view.clip_ratio->setText(props["aspect_ratio"]);
+ m_view.clip_ratio->setText(props.value("aspect_ratio"));
QPixmap pix = m_clip->thumbProducer()->getImage(url, 240, 180);
m_view.clip_thumb->setPixmap(pix);
- if (t == IMAGE || t == VIDEO || t == COLOR) m_view.tabWidget->removeTab(1);
+ if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(AUDIOTAB);
} else {
- m_view.tabWidget->removeTab(0);
+ m_view.tabWidget->removeTab(SLIDETAB);
+ m_view.tabWidget->removeTab(COLORTAB);
+ m_view.tabWidget->removeTab(VIDEOTAB);
m_view.clip_thumb->setHidden(true);
}
if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true);
return m_clip->getId();
}
+
QMap <QString, QString> ClipProperties::properties() {
QMap <QString, QString> props;
props["description"] = m_view.clip_description->text();
+ CLIPTYPE t = m_clip->clipType();
+ if (t == SLIDESHOW) {
+ props["loop"] = QString::number((int) m_view.slide_loop->isChecked());
+ }
+ else if (t == COLOR) {
+ QMap <QString, QString> old_props = m_clip->properties();
+ QString new_color = m_view.clip_color->color().name();
+ if (new_color != QString("#" + old_props.value("colour").right(8).left(6)))
+ props["colour"] = "0x" + new_color.right(6) + "ff";
+ }
return props;
}
m_document->renderer()->doRefresh();
}
+void CustomTrackView::slotUpdateClip(int clipId) {
+ QList<QGraphicsItem *> list = scene()->items();
+ ClipItem *clip = NULL;
+ for (int i = 0; i < list.size(); ++i) {
+ if (list.at(i)->type() == AVWIDGET) {
+ clip = static_cast <ClipItem *>(list.at(i));
+ if (clip->clipProducer() == clipId) {
+ clip->refreshClip();
+ m_document->renderer()->mltUpdateClip(m_tracksList.count() - clip->track(), clip->startPos(), clip->xml());
+ }
+ }
+ }
+}
+
ClipItem *CustomTrackView::getClipItemAt(int pos, int track) {
QList<QGraphicsItem *> list = scene()->items(QPointF(pos * m_scale, track * m_tracksHeight + m_tracksHeight / 2));
ClipItem *clip = NULL;
void slotTransitionUpdated(Transition *, QDomElement);
void slotSwitchTrackAudio(int ix);
void slotSwitchTrackVideo(int ix);
+ void slotUpdateClip(int clipId);
protected:
virtual void drawBackground(QPainter * painter, const QRectF & rect);
return m_duration;
}
+const GenTime &DocClipBase::maxDuration() const {
+ if (m_clipType == COLOR || m_clipType == IMAGE || m_clipType == TEXT || (m_clipType == SLIDESHOW && m_properties.value("loop") == "1")) {
+ GenTime dur(10000, KdenliveSettings::project_fps());
+ return dur;
+ }
+ return m_duration;
+}
+
bool DocClipBase::hasFileSize() const {
return true;
}
}
}
+void DocClipBase::setProperty(QString key, QString value) {
+ m_properties.insert(key, value);
+}
+
QMap <QString, QString> DocClipBase::properties() const {
return m_properties;
}
-
void DocClipBase::slotGetAudioThumbs() {
if (m_audioThumbCreated) {
/** Returns any property of this clip. */
const QString getProperty(const QString prop) const;
+ void setProperty(QString key, QString value);
/** Returns the internal unique id of the clip. */
uint getId() const;
/** returns the duration of this clip */
const GenTime & duration() const;
+ const GenTime &maxDuration() const;
/** returns the duration of this clip */
void setDuration(GenTime dur);
setModified(true);
}
+void KdenliveDoc::slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, bool loop, const QString group, const int groupId) {
+ m_clipManager->slotAddSlideshowClipFile(name, path, count, duration, loop, group, groupId);
+ setModified(true);
+}
+
void KdenliveDoc::slotCreateTextClip(QString group, int groupId) {
QString titlesFolder = projectFolder().path() + "/titles/";
KStandardDirs::makeDir(titlesFolder);
void slotDeleteFolder(const QString folderName, const int id);
void slotEditFolder(const QString folderName, const QString oldfolderName, int clipId);
void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const int groupId = -1);
+ void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, bool loop, const QString group, const int groupId = -1);
void deleteClip(const uint clipId);
int getFramePos(QString duration);
DocClipBase *getBaseClip(int clipId);
<label>Current project display ratio.</label>
<default>1.7777778</default>
</entry>
+ <entry name="project_fps" type="Double">
+ <label>Current project fps.</label>
+ <default>25</default>
+ </entry>
<entry name="default_profile" type="String">
<label>Default project format.</label>
<default>hdv_1080_50i</default>
return pix;
}
return getFrame(&producer, frame, width, height);
+}
+
+QPixmap KThumb::getImage(QDomElement xml, int frame, int width, int height) {
+ Mlt::Profile profile((char*) KdenliveSettings::current_profile().data());
+ QPixmap pix(width, height);
+ QDomDocument doc;
+ QDomElement westley = doc.createElement("westley");
+ doc.appendChild(westley);
+ westley.appendChild(doc.importNode(xml, true));
+ char *tmp = Render::decodedString(doc.toString());
+ kDebug()<<" - - - UPDATINGÂ THMB, XML: "<<doc.toString();
+ Mlt::Producer producer(profile, "westley-xml", tmp);
+ delete[] tmp;
+ if (producer.is_blank()) {
+ pix.fill(Qt::black);
+ return pix;
+ }
+ return getFrame(&producer, frame, width, height);
}
QPixmap KThumb::getFrame(Mlt::Producer* producer, int frame, int width, int height) {
public slots:
void extractImage(int frame, int frame2);
static QPixmap getImage(KUrl url, int width, int height);
+ static QPixmap getImage(QDomElement xml, int frame, 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);*/
void stopAudioThumbs();
ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
if (dia.exec() == QDialog::Accepted) {
m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
+ // update clip in timeline
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ currentTab->projectView()->slotUpdateClip(dia.clipId());
+
}
}
ProjectItem::ProjectItem(QTreeWidget * parent, const QStringList & strings, QDomElement xml, int clipId)
: QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_clipType(UNKNOWN), m_clipId(clipId) {
- m_element = xml.cloneNode().toElement();
+ QDomElement element = xml.cloneNode().toElement();
setSizeHint(0, QSize(65, 45));
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
- if (!m_element.isNull()) {
- m_element.setAttribute("id", clipId);
- QString cType = m_element.attribute("type", QString::null);
+ if (!element.isNull()) {
+ element.setAttribute("id", clipId);
+ QString cType = element.attribute("type", QString::null);
if (!cType.isEmpty()) {
m_clipType = (CLIPTYPE) cType.toInt();
slotSetToolTip();
}
- if (m_clipType == COLOR || m_clipType == IMAGE) m_element.setAttribute("duration", MAXCLIPDURATION);
- else if (m_element.attribute("duration").isEmpty() && !m_element.attribute("out").isEmpty()) {
- m_element.setAttribute("duration", m_element.attribute("out").toInt() - m_element.attribute("in").toInt());
+ if (m_clipType == COLOR || m_clipType == IMAGE) element.setAttribute("duration", MAXCLIPDURATION);
+ else if (element.attribute("duration").isEmpty() && !element.attribute("out").isEmpty()) {
+ element.setAttribute("duration", element.attribute("out").toInt() - element.attribute("in").toInt());
}
}
}
ProjectItem::ProjectItem(QTreeWidgetItem * parent, const QStringList & strings, QDomElement xml, int clipId)
: QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_clipType(UNKNOWN), m_clipId(clipId) {
- m_element = xml.cloneNode().toElement();
+ QDomElement element = xml.cloneNode().toElement();
setSizeHint(0, QSize(65, 45));
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
- if (!m_element.isNull()) {
- m_element.setAttribute("id", clipId);
- QString cType = m_element.attribute("type", QString::null);
+ if (!element.isNull()) {
+ element.setAttribute("id", clipId);
+ QString cType = element.attribute("type", QString::null);
if (!cType.isEmpty()) {
m_clipType = (CLIPTYPE) cType.toInt();
slotSetToolTip();
// folder
ProjectItem::ProjectItem(QTreeWidget * parent, const QStringList & strings, int clipId)
- : QTreeWidgetItem(parent, strings), m_element(QDomElement()), m_clipType(FOLDER), m_groupName(strings.at(1)), m_clipId(clipId), m_clip(NULL) {
+ : QTreeWidgetItem(parent, strings), m_clipType(FOLDER), m_groupName(strings.at(1)), m_clipId(clipId), m_clip(NULL) {
setSizeHint(0, QSize(65, 45));
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
setIcon(0, KIcon("folder"));
setSizeHint(0, QSize(65, 45));
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
m_clip = clip;
- m_element = clip->toXML();
m_clipId = clip->getId();
- QString name = m_element.attribute("name");
- if (name.isEmpty()) name = KUrl(m_element.attribute("resource")).fileName();
- m_clipType = (CLIPTYPE) m_element.attribute("type").toInt();
+ QString name = m_clip->getProperty("name");
+ if (name.isEmpty()) name = KUrl(m_clip->getProperty("resource")).fileName();
+ m_clipType = (CLIPTYPE) m_clip->getProperty("type").toInt();
setText(1, name);
kDebug() << "PROJECT ITE;. ADDINGÂ LCIP: " << m_clipId;
}
setSizeHint(0, QSize(65, 45));
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
m_clip = clip;
- m_element = clip->toXML();
m_clipId = clip->getId();
- QString name = m_element.attribute("name");
- if (name.isEmpty()) name = KUrl(m_element.attribute("resource")).fileName();
- m_clipType = (CLIPTYPE) m_element.attribute("type").toInt();
+ QString name = m_clip->getProperty("name");
+ if (name.isEmpty()) name = KUrl(m_clip->getProperty("resource")).fileName();
+ m_clipType = (CLIPTYPE) m_clip->getProperty("type").toInt();
setText(1, name);
kDebug() << "PROJECT ITE;. ADDINGÂ LCIP: " << m_clipId;
}
}
int ProjectItem::clipMaxDuration() const {
- return m_element.attribute("duration").toInt();
+ return m_clip->getProperty("duration").toInt();
}
bool ProjectItem::isGroup() const {
}
QDomElement ProjectItem::toXml() const {
- return m_element;
+ return m_clip->toXML();
}
const KUrl ProjectItem::clipUrl() const {
- if (m_clipType != COLOR && m_clipType != VIRTUAL && m_clipType != UNKNOWN)
- return KUrl(m_element.attribute("resource"));
+ if (m_clipType != COLOR && m_clipType != VIRTUAL && m_clipType != UNKNOWN && m_clipType != FOLDER)
+ return KUrl(m_clip->getProperty("resource"));
else return KUrl();
}
void ProjectItem::changeDuration(int frames) {
- m_element.setAttribute("duration", frames);
+ m_clip->setProperty("duration", QString::number(frames));
m_duration = GenTime(frames, 25);
setData(1, DurationRole, Timecode::getEasyTimecode(m_duration, 25));
m_durationKnown = true;
break;
case 4:
tip.append(i18n("Color clip"));
- setData(1, DurationRole, Timecode::getEasyTimecode(GenTime(m_element.attribute("out", "250").toInt(), 25), 25));
+ setData(1, DurationRole, Timecode::getEasyTimecode(GenTime(m_clip->getProperty("out").toInt(), 25), 25));
break;
case 5:
tip.append(i18n("Image clip") + "</b><br />" + clipUrl().path());
void ProjectItem::setProperties(const QMap < QString, QString > &attributes, const QMap < QString, QString > &metadata) {
if (attributes.contains("duration")) {
- if (m_clipType == AUDIO || m_clipType == VIDEO || m_clipType == AV) m_element.setAttribute("duration", attributes["duration"].toInt());
+ if (m_clipType == AUDIO || m_clipType == VIDEO || m_clipType == AV) m_clip->setProperty("duration", attributes["duration"]);
m_duration = GenTime(attributes["duration"].toInt(), 25);
setData(1, DurationRole, Timecode::getEasyTimecode(m_duration, 25));
m_durationKnown = true;
m_clip->setClipType(m_clipType);
}
slotSetToolTip();
- if (m_element.isNull()) {
- QDomDocument doc;
- m_element = doc.createElement("producer");
- }
- if (m_element.attribute("duration") == QString::null) m_element.setAttribute("duration", attributes["duration"].toInt());
- m_element.setAttribute("resource", attributes["filename"]);
- m_element.setAttribute("type", (int) m_clipType);
-
if (KdenliveSettings::audiothumbnails()) m_clip->slotRequestAudioThumbs();
m_clip->setProperties(attributes);
void setProperties(QMap <QString, QString> props);
private:
- QDomElement m_element;
GenTime m_duration;
QString m_groupName;
bool m_durationKnown;
#include "projectlist.h"
#include "projectitem.h"
#include "kdenlivesettings.h"
+#include "slideshowclip.h"
#include "ui_colorclip_ui.h"
+
#include "definitions.h"
#include "clipmanager.h"
#include "docclipbase.h"
QAction *addColorClip = addMenu->addAction(KIcon("document-new"), i18n("Add Color Clip"));
connect(addColorClip, SIGNAL(triggered()), this, SLOT(slotAddColorClip()));
+ QAction *addSlideClip = addMenu->addAction(KIcon("document-new"), i18n("Add Slideshow Clip"));
+ connect(addSlideClip, SIGNAL(triggered()), this, SLOT(slotAddSlideshowClip()));
+
QAction *addTitleClip = addMenu->addAction(KIcon("document-new"), i18n("Add Title Clip"));
connect(addTitleClip, SIGNAL(triggered()), this, SLOT(slotAddTitleClip()));
void ProjectList::slotUpdateClipProperties(int id, QMap <QString, QString> properties) {
ProjectItem *item = getItemById(id);
- if (item) slotUpdateClipProperties(item, properties);
+ if (item) {
+ slotUpdateClipProperties(item, properties);
+ if (properties.contains("colour")) slotRefreshClipThumbnail(item);
+ }
}
void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QString> properties) {
delete dia;
}
+
+void ProjectList::slotAddSlideshowClip() {
+ if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! Â NO CMD STK";
+ SlideshowClip *dia = new SlideshowClip();
+
+ if (dia->exec() == QDialog::Accepted) {
+
+ QString group = QString();
+ int groupId = -1;
+ ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
+ if (item && item->clipType() != FOLDER) {
+ while (item->parent()) {
+ item = static_cast <ProjectItem*>(item->parent());
+ if (item->clipType() == FOLDER) break;
+ }
+ }
+ if (item && item->clipType() == FOLDER) {
+ group = item->groupName();
+ groupId = item->clipId();
+ }
+
+ m_doc->slotAddSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), group, groupId);
+ }
+ delete dia;
+}
void ProjectList::slotAddTitleClip() {
QString group = QString();
int groupId = -1;
m_doc->slotCreateTextClip(group, groupId);
}
+
void ProjectList::setDocument(KdenliveDoc *doc) {
listView->clear();
QList <DocClipBase*> list = doc->clipManager()->documentClipList();
void ProjectList::slotRefreshClipThumbnail(int clipId) {
ProjectItem *item = getItemById(clipId);
+ if (item) slotRefreshClipThumbnail(item);
+}
+
+void ProjectList::slotRefreshClipThumbnail(ProjectItem *item) {
if (item) {
int height = 40;
int width = (int)(height * (double) m_render->renderWidth() / m_render->renderHeight());
- QPixmap pix = KThumb::getImage(item->clipUrl(), item->referencedClip()->getProjectThumbFrame(), width, height);
+ QPixmap pix = KThumb::getImage(item->toXml(), item->referencedClip()->getProjectThumbFrame(), width, height);
+ //QPixmap pix = KThumb::getFrame(item->toXml()), 0, width, height);
item->setIcon(0, pix);
}
}
void slotDeleteClip(int clipId);
void slotUpdateClip(int id);
void slotRefreshClipThumbnail(int clipId);
+ void slotRefreshClipThumbnail(ProjectItem *item);
private:
void slotRemoveClip();
void slotClipSelected();
void slotAddColorClip();
+ void slotAddSlideshowClip();
void slotAddTitleClip();
void slotContextMenu(const QPoint &pos, QTreeWidgetItem *);
void slotAddFolder();
QDomElement westley = doc.createElement("westley");
doc.appendChild(westley);
westley.appendChild(doc.importNode(xml, true));
- kDebug() << "////////////\n" << doc.toString() << "////////////////\n";
+ //kDebug() << "////////////\n" << doc.toString() << "////////////////\n";
char *tmp = decodedString(doc.toString());
Mlt::Producer producer(*m_mltProfile, "westley-xml", tmp);
m_isBlocked = false;
}
+void Render::mltUpdateClip(int track, GenTime position, QDomElement element) {
+ // TODO: optimize
+ mltCutClip(track, position);
+ mltInsertClip(track, position, element);
+}
+
void Render::mltRemoveClip(int track, GenTime position) {
m_isBlocked = true;
/** Playlist manipulation */
void mltInsertClip(int track, GenTime position, QDomElement element);
+ void mltUpdateClip(int track, GenTime position, QDomElement element);
void mltCutClip(int track, GenTime position);
void mltResizeClipEnd(int track, GenTime pos, GenTime in, GenTime out);
void mltResizeClipStart(int track, GenTime pos, GenTime moveEnd, GenTime moveStart, GenTime in, GenTime out);
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include <QDir>
+
+#include <KStandardDirs>
+#include <KDebug>
+#include <KFileItem>
+
+#include "kdenlivesettings.h"
+#include "slideshowclip.h"
+
+#define TYPE_JPEG 0
+#define TYPE_PNG 1
+#define TYPE_BMP 2
+#define TYPE_GIF 3
+
+SlideshowClip::SlideshowClip(QWidget * parent): QDialog(parent), m_count(0) {
+ setFont(KGlobalSettings::toolBarFont());
+ //wsetCaption(i18n("Add Slideshow Clip"));
+ m_view.setupUi(this);
+ m_view.clip_name->setText(i18n("Slideshow Clip"));
+ m_view.folder_url->setMode(KFile::Directory);
+ m_view.icon_list->setIconSize(QSize(50, 50));
+ connect(m_view.folder_url, SIGNAL(textChanged(const QString &)), this, SLOT(parseFolder()));
+ connect(m_view.image_type, SIGNAL(currentIndexChanged ( int )), this, SLOT(parseFolder()));
+ m_view.image_type->addItem("JPG");
+ m_view.image_type->addItem("PNG");
+ m_view.image_type->addItem("BMP");
+ m_view.image_type->addItem("GIF");
+ m_view.clip_duration->setText("00:00:03:00");
+ adjustSize();
+}
+
+void SlideshowClip::parseFolder() {
+ m_view.icon_list->clear();
+ QDir dir(m_view.folder_url->url().path());
+ QStringList filters;
+ switch (m_view.image_type->currentIndex()) {
+ case TYPE_PNG:
+ filters << "*.png";
+ break;
+ case TYPE_BMP:
+ filters << "*.bmp";
+ break;
+ case TYPE_GIF:
+ filters << "*.gif";
+ break;
+ default:
+ filters << "*.jpg" << "*.jpeg";
+ break;
+ }
+
+ dir.setNameFilters(filters);
+ QStringList result = dir.entryList(QDir::Files);
+ m_count = result.count();
+ m_view.label_info->setText(i18n("%1 images found", m_count));
+ foreach (QString path, result) {
+ QIcon icon(dir.filePath(path));
+ QListWidgetItem *item = new QListWidgetItem(icon, KUrl(path).fileName());
+ m_view.icon_list->addItem(item);
+ }
+}
+
+QString SlideshowClip::selectedPath() const {
+ QString extension;
+ switch (m_view.image_type->currentIndex()) {
+ case TYPE_PNG:
+ extension = "/.all.png";
+ break;
+ case TYPE_BMP:
+ extension = "/.all.bmp";
+ break;
+ case TYPE_GIF:
+ extension = "/.all.gif";
+ break;
+ default:
+ extension = "/.all.jpg";
+ break;
+ }
+ return m_view.folder_url->url().path() + extension;
+}
+
+
+QString SlideshowClip::clipName() const {
+ return m_view.clip_name->text();
+}
+
+QString SlideshowClip::clipDuration() const {
+ return m_view.clip_duration->text();
+}
+
+int SlideshowClip::imageCount() const {
+ return m_count;
+}
+
+bool SlideshowClip::loop() const {
+ return m_view.slide_loop->isChecked();
+}
+#include "slideshowclip.moc"
+
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef SLIDESHOWDIALOG_H
+#define SLIDESHOWDIALOG_H
+
+#include <QDialog>
+
+#include "definitions.h"
+#include "docclipbase.h"
+#include "timecode.h"
+#include "ui_slideshowclip_ui.h"
+
+class SlideshowClip : public QDialog {
+ Q_OBJECT
+
+public:
+ SlideshowClip(QWidget * parent = 0);
+ /** return selected path for slideshow in MLT format */
+ QString selectedPath() const;
+ QString clipName() const;
+ QString clipDuration() const;
+ int imageCount() const;
+ bool loop() const;
+
+private slots:
+ void parseFolder();
+
+private:
+ Ui::SlideshowClip_UI m_view;
+ int m_count;
+};
+
+
+#endif
+
<rect>
<x>0</x>
<y>0</y>
- <width>310</width>
- <height>459</height>
+ <width>283</width>
+ <height>435</height>
</rect>
</property>
<property name="windowTitle" >
<item row="6" column="0" colspan="4" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
- <number>0</number>
+ <number>3</number>
</property>
<widget class="QWidget" name="tab_video" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
- <width>290</width>
- <height>171</height>
+ <width>263</width>
+ <height>159</height>
</rect>
</property>
<attribute name="title" >
</layout>
</widget>
<widget class="QWidget" name="tab_audio" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>263</width>
+ <height>159</height>
+ </rect>
+ </property>
<attribute name="title" >
<string>Audio</string>
</attribute>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2" >
- <widget class="KLineEdit" name="clip_channels" >
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
<item row="2" column="1" colspan="2" >
<widget class="KLineEdit" name="clip_frequency" >
<property name="readOnly" >
</property>
</spacer>
</item>
+ <item row="1" column="1" colspan="2" >
+ <widget class="KLineEdit" name="clip_channels" >
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
<item row="0" column="0" >
<widget class="QLabel" name="label_9" >
<property name="text" >
</widget>
</item>
</layout>
- <zorder>ClipProperties_2</zorder>
<zorder>clip_acodec</zorder>
<zorder>clip_frequency</zorder>
<zorder>verticalSpacer_3</zorder>
<zorder>label_11</zorder>
<zorder>label_10</zorder>
</widget>
+ <widget class="QWidget" name="tab" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>263</width>
+ <height>159</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>Color</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_5" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_13" >
+ <property name="text" >
+ <string>Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="KColorButton" name="clip_color" />
+ </item>
+ <item row="1" column="1" >
+ <spacer name="verticalSpacer_5" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>122</width>
+ <height>118</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>263</width>
+ <height>159</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>Slideshow</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_6" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_14" >
+ <property name="text" >
+ <string>Image type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="KComboBox" name="image_type" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="clip_filesize_4" >
+ <property name="text" >
+ <string>Frame duration</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="KRestrictedLine" name="slide_duration" >
+ <property name="inputMask" >
+ <string>99:99:99:99; </string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="slide_fade" >
+ <property name="text" >
+ <string>Crossfade</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QCheckBox" name="slide_luma" >
+ <property name="text" >
+ <string>Luma file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="KComboBox" name="luma_file" />
+ </item>
+ <item row="4" column="1" >
+ <spacer name="verticalSpacer_6" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QCheckBox" name="slide_loop" >
+ <property name="text" >
+ <string>Loop</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
<widget class="QWidget" name="tab_advanced" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>263</width>
- <height>171</height>
+ <height>159</height>
</rect>
</property>
<attribute name="title" >
</layout>
</widget>
<customwidgets>
+ <customwidget>
+ <class>KColorButton</class>
+ <extends>QPushButton</extends>
+ <header>kcolorbutton.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
<customwidget>
<class>KDoubleNumInput</class>
<extends>QWidget</extends>
--- /dev/null
+<ui version="4.0" >
+ <class>SlideshowClip_UI</class>
+ <widget class="QDialog" name="SlideshowClip_UI" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>319</width>
+ <height>332</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Name</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="KLineEdit" name="clip_name" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Frame Duration</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="2" >
+ <widget class="KRestrictedLine" name="clip_duration" >
+ <property name="inputMask" >
+ <string>99:99:99:99; </string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="0" colspan="3" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2" >
+ <widget class="KUrlRequester" name="folder_url" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Folder</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="2" >
+ <widget class="KComboBox" name="image_type" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Image Type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" colspan="3" >
+ <widget class="KListWidget" name="icon_list" />
+ </item>
+ <item row="8" column="0" >
+ <widget class="QLabel" name="label_info" >
+ <property name="text" >
+ <string>No image found</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QCheckBox" name="slide_fade" >
+ <property name="text" >
+ <string>Crossfade</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QCheckBox" name="luma_fade" >
+ <property name="text" >
+ <string>Luma File</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1" colspan="2" >
+ <widget class="KComboBox" name="luma_file" />
+ </item>
+ <item row="5" column="1" >
+ <widget class="QCheckBox" name="slide_loop" >
+ <property name="text" >
+ <string>Loop</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KListWidget</class>
+ <extends>QListWidget</extends>
+ <header>klistwidget.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KRestrictedLine</class>
+ <extends>KLineEdit</extends>
+ <header>krestrictedline.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KUrlRequester</class>
+ <extends>QFrame</extends>
+ <header>kurlrequester.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>SlideshowClip_UI</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>SlideshowClip_UI</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>