aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2015-01-26 23:44:45 +0100
committerJean-Baptiste Mardelle <[email protected]>2015-01-26 23:44:45 +0100
commita5448506f2b90ad269bdf666bed510a4339d521f (patch)
tree8d6972a8b17f755573606a634c5474f4b1d3c10b
parent004a668e35dcf2e39a27aee44c73cd3c3a154784 (diff)
Several fixes for slideshow clips
-rw-r--r--src/dialogs/clipcreationdialog.cpp38
-rw-r--r--src/project/dialogs/slideshowclip.cpp8
-rw-r--r--src/project/dialogs/slideshowclip.h2
-rw-r--r--src/renderer.cpp2
4 files changed, 34 insertions, 16 deletions
diff --git a/src/dialogs/clipcreationdialog.cpp b/src/dialogs/clipcreationdialog.cpp
index 3174c5a..019db02 100644
--- a/src/dialogs/clipcreationdialog.cpp
+++ b/src/dialogs/clipcreationdialog.cpp
@@ -33,12 +33,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KMessageBox>
#include <KRecentDirs>
+#include <KFileWidget>
#include "klocalizedstring.h"
#include <QDir>
#include <QUndoStack>
#include <QUndoCommand>
#include <QStandardPaths>
+#include <QPushButton>
#include <QDebug>
#include <QDialog>
#include <QPointer>
@@ -117,10 +119,11 @@ void ClipCreationDialog::createColorClip(KdenliveDoc *doc, QStringList groupInfo
//static
void ClipCreationDialog::createSlideshowClip(KdenliveDoc *doc, QStringList groupInfo, Bin *bin)
{
- QPointer<SlideshowClip> dia = new SlideshowClip(doc->timecode(), bin);
+ QPointer<SlideshowClip> dia = new SlideshowClip(doc->timecode(), KRecentDirs::dir(":KdenliveSlideShowFolder"), bin);
if (dia->exec() == QDialog::Accepted) {
// Ready, create xml
+ KRecentDirs::add(":KdenliveSlideShowFolder", QUrl::fromLocalFile(dia->selectedPath()).adjusted(QUrl::RemoveFilename).path());
QDomDocument xml;
QDomElement prod = xml.createElement("producer");
xml.appendChild(prod);
@@ -411,8 +414,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, QStringList groupI
{
QList <QUrl> list;
QString allExtensions = getExtensions().join(" ");
- QStringList dialogFilter; //i18n("All Supported Files") + "(" + allExtensions + ");;" + i18n("All Files") + "(*)";
- dialogFilter << allExtensions << "application/octet-stream";
+ QString dialogFilter = allExtensions + "|" + i18n("All Supported Files") + "\n*|" + i18n("All Files");
QCheckBox *b = new QCheckBox(i18n("Import image sequence"));
b->setChecked(KdenliveSettings::autoimagesequence());
QCheckBox *c = new QCheckBox(i18n("Transparent background for images"));
@@ -428,15 +430,23 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, QStringList groupI
if (clipFolder.isEmpty()) {
clipFolder = QDir::homePath();
}
- QPointer<QFileDialog> d = new QFileDialog(QApplication::activeWindow(), i18n("Open Clips"), clipFolder);
- //TODO: KF5, how to add a custom widget to file dialog
- /*QGridLayout *layout = (QGridLayout*)d->layout();
- layout->addWidget(f, 0, 0);*/
- d->setMimeTypeFilters(dialogFilter);
- d->setFileMode(QFileDialog::ExistingFiles);
- if (d->exec() == QDialog::Accepted) {
+ QDialog *dlg = new QDialog(QApplication::activeWindow());
+ KFileWidget *fileWidget = new KFileWidget(QUrl::fromLocalFile(clipFolder), dlg);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(fileWidget);
+ fileWidget->setCustomWidget(f);
+ fileWidget->okButton()->show();
+ fileWidget->cancelButton()->show();
+ QObject::connect(fileWidget->okButton(), &QPushButton::clicked, fileWidget, &KFileWidget::slotOk);
+ QObject::connect(fileWidget, &KFileWidget::accepted, fileWidget, &KFileWidget::accept);
+ QObject::connect(fileWidget, &KFileWidget::accepted, dlg, &QDialog::accept);
+ QObject::connect(fileWidget->cancelButton(), &QPushButton::clicked, dlg, &QDialog::reject);
+ dlg->setLayout(layout);
+ fileWidget->setFilter(dialogFilter);
+ fileWidget->setMode(KFile::Files | KFile::ExistingOnly);
+ if (dlg->exec() == QDialog::Accepted) {
KdenliveSettings::setAutoimagetransparency(c->isChecked());
- list = d->selectedUrls();
+ list = fileWidget->selectedUrls();
if (!list.isEmpty()) {
KRecentDirs::add(":KdenliveClipFolder", list.first().adjusted(QUrl::RemoveFilename).path());
}
@@ -452,7 +462,8 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, QStringList groupI
QString pattern = SlideshowClip::selectedPath(url, false, QString(), &list);
int count = list.count();
if (count > 1) {
- delete d;
+ delete fileWidget;
+ delete dlg;
// get image sequence base name
while (fileName.at(fileName.size() - 1).isDigit()) {
fileName.chop(1);
@@ -484,7 +495,8 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, QStringList groupI
}
}
}
- delete d;
+ delete fileWidget;
+ delete dlg;
if (!list.isEmpty()) {
ClipCreationDialog::createClipsCommand(doc, list, groupInfo, bin);
}
diff --git a/src/project/dialogs/slideshowclip.cpp b/src/project/dialogs/slideshowclip.cpp
index b9dfdb0..0ad22e0 100644
--- a/src/project/dialogs/slideshowclip.cpp
+++ b/src/project/dialogs/slideshowclip.cpp
@@ -29,7 +29,7 @@
#include <QStandardPaths>
-SlideshowClip::SlideshowClip(const Timecode &tc, QWidget * parent) :
+SlideshowClip::SlideshowClip(const Timecode &tc, QString clipFolder, QWidget * parent) :
QDialog(parent),
m_count(0),
m_timecode(tc),
@@ -73,7 +73,11 @@ SlideshowClip::SlideshowClip(const Timecode &tc, QWidget * parent) :
m_view.clip_duration->setInputMask(m_timecode.mask());
m_view.luma_duration->setInputMask(m_timecode.mask());
m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))));
- m_view.folder_url->setUrl(QUrl::fromLocalFile(QDir::homePath()));
+
+ if (clipFolder.isEmpty()) {
+ clipFolder = QDir::homePath();
+ }
+ m_view.folder_url->setUrl(QUrl::fromLocalFile(clipFolder));
m_view.clip_duration_format->addItem(i18n("hh:mm:ss:ff"));
m_view.clip_duration_format->addItem(i18n("Frames"));
diff --git a/src/project/dialogs/slideshowclip.h b/src/project/dialogs/slideshowclip.h
index 85b427c..a85b578 100644
--- a/src/project/dialogs/slideshowclip.h
+++ b/src/project/dialogs/slideshowclip.h
@@ -34,7 +34,7 @@ class SlideshowClip : public QDialog
Q_OBJECT
public:
- explicit SlideshowClip(const Timecode& tc, QWidget * parent = 0);
+ explicit SlideshowClip(const Timecode& tc, QString clipFolder, QWidget * parent = 0);
virtual ~ SlideshowClip();
/** return selected path for slideshow in MLT format */
QString selectedPath();
diff --git a/src/renderer.cpp b/src/renderer.cpp
index 75606d6..bfaf87b 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -696,6 +696,8 @@ void Render::processFileProperties()
QString xmldata = ProjectClip::getXmlProperty(info.xml, "xmldata");
if (producer && producer->is_valid() && !xmldata.isEmpty())
producer->set("xmldata", xmldata.toUtf8().constData());
+ } else if (type == SlideShow) {
+ producer = new Mlt::Producer(*m_mltProfile, "xml-string", info.xml.ownerDocument().toString().toUtf8().constData());
} else if (!url.isValid()) {
//WARNING: when is this case used? Not sure it is working.. JBM/
QDomDocument doc;