From ce3a9c15d4f1fb2d8a62e68198811cfd34f3bb7f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sun, 20 Jul 2008 19:06:45 +0000 Subject: [PATCH] slideshow update svn path=/branches/KDE4/; revision=2332 --- src/clipmanager.cpp | 3 +- src/clipmanager.h | 2 +- src/clipproperties.cpp | 1 + src/docclipbase.cpp | 10 ++++++- src/kdenlivedoc.cpp | 4 +-- src/kdenlivedoc.h | 2 +- src/projectlist.cpp | 2 +- src/renderer.cpp | 4 +++ src/slideshowclip.cpp | 6 ++++ src/slideshowclip.h | 1 + src/widgets/clipproperties_ui.ui | 45 +++++++++++++++++++--------- src/widgets/slideshowclip_ui.ui | 51 +++++++++++++++++++++++--------- 12 files changed, 96 insertions(+), 35 deletions(-) diff --git a/src/clipmanager.cpp b/src/clipmanager.cpp index 40a6485c..2596e75d 100644 --- a/src/clipmanager.cpp +++ b/src/clipmanager.cpp @@ -131,7 +131,7 @@ void ClipManager::slotAddColorClipFile(const QString name, const QString color, m_doc->commandStack()->push(command); } -void ClipManager::slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, QString group, const int groupId) { +void ClipManager::slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, QString group, const int groupId) { QDomDocument doc; QDomElement prod = doc.createElement("producer"); prod.setAttribute("resource", path); @@ -145,6 +145,7 @@ void ClipManager::slotAddSlideshowClipFile(const QString name, const QString pat prod.setAttribute("name", name); prod.setAttribute("loop", loop); prod.setAttribute("fade", fade); + prod.setAttribute("softness", QString::number(softness)); prod.setAttribute("luma_file", luma_file); if (!group.isEmpty()) { prod.setAttribute("groupname", group); diff --git a/src/clipmanager.h b/src/clipmanager.h index 9c9b54c1..32c3fbba 100644 --- a/src/clipmanager.h +++ b/src/clipmanager.h @@ -51,7 +51,7 @@ Q_OBJECT public: void slotAddClipFile(const KUrl url, const QString group, const int groupId); void slotAddTextClipFile(const QString path, const QString xml, 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, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const QString group, const int groupId); + void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, const QString group, const int groupId); DocClipBase *getClipById(int clipId); void slotDeleteClip(uint clipId); void setThumbsProgress(const QString &message, int progress); diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp index 5383988f..bcb697a2 100644 --- a/src/clipproperties.cpp +++ b/src/clipproperties.cpp @@ -72,6 +72,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg m_view.image_type->addItems(types); m_view.slide_loop->setChecked(props.value("loop").toInt()); m_view.slide_fade->setChecked(props.value("fade").toInt()); + m_view.luma_softness->setValue(props.value("softness").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); diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index 4abf90fb..0cdc17a7 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -398,6 +398,10 @@ void DocClipBase::slotRefreshProducer() { char *tmp = (char *) qstrdup(resource.toUtf8().data()); filter->set("luma.resource", tmp); delete[] tmp; + if (getProperty("softness") != QString()) { + int soft = getProperty("softness").toInt(); + filter->set("luma.softness", (double) soft / 100.0); + } } else { // filter does not exist, create it... Mlt::Filter *filter = new Mlt::Filter(*(m_clipProducer->profile()), "luma"); @@ -407,6 +411,10 @@ void DocClipBase::slotRefreshProducer() { char *tmp = (char *) qstrdup(resource.toUtf8().data()); filter->set("luma.resource", tmp); delete[] tmp; + if (getProperty("softness") != QString()) { + int soft = getProperty("softness").toInt(); + filter->set("luma.softness", (double) soft / 100.0); + } clipService.attach(*filter); } } else { @@ -430,7 +438,7 @@ void DocClipBase::setProperties(QMap properties) { QMapIterator i(properties); bool refreshProducer = false; QStringList keys; - keys << "luma_duration" << "luma_file" << "fade" << "ttl"; + keys << "luma_duration" << "luma_file" << "fade" << "ttl" << "softness"; while (i.hasNext()) { i.next(); m_properties.insert(i.key(), i.value()); diff --git a/src/kdenlivedoc.cpp b/src/kdenlivedoc.cpp index 0c1c6aa3..c0fd48c3 100644 --- a/src/kdenlivedoc.cpp +++ b/src/kdenlivedoc.cpp @@ -646,8 +646,8 @@ void KdenliveDoc::slotAddColorClipFile(const QString name, const QString color, setModified(true); } -void KdenliveDoc::slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const QString group, const int groupId) { - m_clipManager->slotAddSlideshowClipFile(name, path, count, duration, loop, fade, luma_duration, luma_file, group, groupId); +void KdenliveDoc::slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, const QString group, const int groupId) { + m_clipManager->slotAddSlideshowClipFile(name, path, count, duration, loop, fade, luma_duration, luma_file, softness, group, groupId); setModified(true); } diff --git a/src/kdenlivedoc.h b/src/kdenlivedoc.h index 89747508..e3a325a0 100644 --- a/src/kdenlivedoc.h +++ b/src/kdenlivedoc.h @@ -73,7 +73,7 @@ Q_OBJECT public: 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, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const QString group, const int groupId = -1); + void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, const QString group, const int groupId = -1); void deleteClip(const uint clipId); int getFramePos(QString duration); DocClipBase *getBaseClip(int clipId); diff --git a/src/projectlist.cpp b/src/projectlist.cpp index c93a7031..8cec2bcf 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -386,7 +386,7 @@ void ProjectList::slotAddSlideshowClip() { groupId = item->clipId(); } - m_doc->slotAddSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), dia->fade(), dia->lumaDuration(), dia->lumaFile(), group, groupId); + m_doc->slotAddSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), dia->fade(), dia->lumaDuration(), dia->lumaFile(), dia->softness(),group, groupId); } delete dia; } diff --git a/src/renderer.cpp b/src/renderer.cpp index 7166e753..324d03a3 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -437,6 +437,10 @@ void Render::getFileProperties(const QDomElement &xml, int clipId) { char *tmp = decodedString(xml.attribute("luma_file")); filter->set("luma.resource", tmp); delete[] tmp; + if (xml.hasAttribute("softness")) { + int soft = xml.attribute("softness").toInt(); + filter->set("luma.softness", (double) soft / 100.0); + } } Mlt::Service clipService(producer->get_service()); clipService.attach(*filter); diff --git a/src/slideshowclip.cpp b/src/slideshowclip.cpp index 6fba3673..56b75b00 100644 --- a/src/slideshowclip.cpp +++ b/src/slideshowclip.cpp @@ -83,6 +83,8 @@ void SlideshowClip::slotEnableLumaFile(int state) { bool enable = false; if (state == Qt::Checked) enable = true; m_view.luma_file->setEnabled(enable); + m_view.luma_softness->setEnabled(enable); + m_view.label_softness->setEnabled(enable); } void SlideshowClip::parseFolder() { @@ -150,6 +152,10 @@ int SlideshowClip::imageCount() const { return m_count; } +int SlideshowClip::softness() const { + return m_view.luma_softness->value(); +} + bool SlideshowClip::loop() const { return m_view.slide_loop->isChecked(); } diff --git a/src/slideshowclip.h b/src/slideshowclip.h index 024d008f..116219ea 100644 --- a/src/slideshowclip.h +++ b/src/slideshowclip.h @@ -42,6 +42,7 @@ public: bool loop() const; bool fade() const; QString lumaFile() const; + int softness() const; private slots: void parseFolder(); diff --git a/src/widgets/clipproperties_ui.ui b/src/widgets/clipproperties_ui.ui index 4f23f5fb..2aded4a9 100644 --- a/src/widgets/clipproperties_ui.ui +++ b/src/widgets/clipproperties_ui.ui @@ -6,7 +6,7 @@ 0 0 315 - 440 + 469 @@ -108,8 +108,8 @@ 0 0 - 288 - 210 + 299 + 223 @@ -192,8 +192,8 @@ 0 0 - 288 - 210 + 299 + 223 @@ -269,8 +269,8 @@ 0 0 - 288 - 210 + 299 + 223 @@ -308,7 +308,7 @@ 0 0 299 - 194 + 223 @@ -370,14 +370,14 @@ - + No image found - + Qt::Vertical @@ -390,6 +390,23 @@ + + + + 100 + + + Qt::Horizontal + + + + + + + Softness + + + @@ -397,8 +414,8 @@ 0 0 - 288 - 210 + 299 + 223 @@ -475,8 +492,8 @@ 0 0 - 288 - 210 + 299 + 223 diff --git a/src/widgets/slideshowclip_ui.ui b/src/widgets/slideshowclip_ui.ui index c818c547..c86e02b2 100644 --- a/src/widgets/slideshowclip_ui.ui +++ b/src/widgets/slideshowclip_ui.ui @@ -5,8 +5,8 @@ 0 0 - 251 - 392 + 252 + 415 @@ -71,7 +71,17 @@ - + + + + false + + + 99:99:99:99; + + + + false @@ -81,13 +91,36 @@ - + false + + + + false + + + Softness + + + + + + + false + + + 100 + + + Qt::Horizontal + + + @@ -108,16 +141,6 @@ - - - - false - - - 99:99:99:99; - - - -- 2.39.2