Commit b4dc602b authored by Vivek Yadav's avatar Vivek Yadav
Browse files

import img seq added

parent e0a6495c
......@@ -824,9 +824,10 @@ bool LineEventEater::eventFilter(QObject *obj, QEvent *event)
return QObject::eventFilter(obj, event);
}
void ClipWidget::init(QDockWidget* m_DockClipWidget)
void ClipWidget::init(QDockWidget* m_DockClipWidget, KdenliveDoc* doc,
std::shared_ptr<ProjectItemModel> model)
{
ClipCreationDialog::clipWidget(m_DockClipWidget);
ClipCreationDialog::clipWidget(m_DockClipWidget, doc, model);
/*QString clipFolder = KRecentDirs::dir(QStringLiteral(":KdenliveClipFolder"));
KFileWidget* fileWidget = new KFileWidget(QUrl::fromLocalFile(clipFolder), m_DockClipWidget);
fileWidget->setMode(KFile::Files);
......@@ -4382,3 +4383,7 @@ QList<int> Bin::getUsedClipIds()
ClipWidget* Bin::getWidget(){
return m_clipWidget;
}
void Bin::dockWidgetInit(QDockWidget* m_DockClipWidget){
m_clipWidget->init(m_DockClipWidget, m_doc, m_itemModel);
}
......@@ -172,7 +172,8 @@ class ClipWidget : public QWidget
public:
explicit ClipWidget(){}
~ClipWidget() override;
void init(QDockWidget* m_DockClipWidget);
void init(QDockWidget* m_DockClipWidget, KdenliveDoc* doc,
std::shared_ptr<ProjectItemModel> model );
};
class Bin : public QWidget
......@@ -187,7 +188,7 @@ public:
~Bin() override;
bool isLoading;
void dockWidgetInit(QDockWidget* m_DockClipWidget);
/** @brief Sets the document for the bin and initialize some stuff */
void setDocument(KdenliveDoc *project);
/** @brief Delete all project related data, to be called before setDocument */
......
......@@ -417,6 +417,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QString &par
while (fileName.size() > 0 && fileName.at(fileName.size() - 1).isDigit()) {
fileName.chop(1);
}
QString duration = doc->timecode().reformatSeparators(KdenliveSettings::sequence_duration());
std::unordered_map<QString, QString> properties;
properties[QStringLiteral("ttl")] = QString::number(doc->getFramePos(duration));
......@@ -449,24 +450,46 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QString &par
}
}
void ClipCreationDialog::clipWidget(QDockWidget* m_DockClipWidget)
void ClipCreationDialog::clipWidget(QDockWidget* m_DockClipWidget,
KdenliveDoc* doc, const std::shared_ptr<ProjectItemModel> model)
{
QString clipFolder = KRecentDirs::dir(QStringLiteral(":KdenliveClipFolder"));
KFileWidget* fileWidget = new KFileWidget(QUrl::fromLocalFile(clipFolder), m_DockClipWidget);
fileWidget->setMode(KFile::Files | KFile::ExistingOnly | KFile::LocalOnly | KFile::Directory);
/*QPushButton* importseq = new QPushButton("Import image sequence");
QPushButton* importseq = new QPushButton("Import image sequence");
fileWidget->setCustomWidget(importseq);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, &KFileWidget::slotOk);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, &KFileWidget::accepted);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, &KFileWidget::accept);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, [&]{
//fileWidget->slotOk();
//fileWidget->accepted();
//fileWidget->accept();
QList<QUrl> list;
list = fileWidget->selectedUrls(); // work if this line is commented
});*/
QObject::connect(importseq, &QPushButton::clicked, fileWidget, [=, &doc]{
QUrl url;
url = fileWidget->selectedUrl();
QStringList patternlist;
QString pattern = SlideshowClip::selectedPath(url, false, QString(), &patternlist);
int count = patternlist.size();
QString fileName = url.fileName().section(QLatin1Char('.'), 0, -2);
if (count >= 1) {
// get image sequence base name
while (fileName.size() > 0 && fileName.at(fileName.size() - 1).isDigit()) {
fileName.chop(1);
}
QString parentFolder = "-1";
QString duration = doc->timecode().reformatSeparators(KdenliveSettings::sequence_duration());
std::unordered_map<QString, QString> properties;
properties[QStringLiteral("ttl")] = QString::number(doc->getFramePos(duration));
properties[QStringLiteral("loop")] = QString::number(0);
properties[QStringLiteral("crop")] = QString::number(0);
properties[QStringLiteral("fade")] = QString::number(0);
properties[QStringLiteral("luma_duration")] =
QString::number(doc->getFramePos(doc->timecode().getTimecodeFromFrames(int(ceil(doc->timecode().fps())))));
int frame_duration = doc->getFramePos(duration) * count;
ClipCreator::createSlideshowClip(pattern, frame_duration, fileName, parentFolder, properties, model);
return;
}
});
m_DockClipWidget->setWidget(fileWidget);
}
......@@ -46,7 +46,7 @@ void createSlideshowClip(KdenliveDoc *doc, const QString &parentId, std::shared_
void createTitleClip(KdenliveDoc *doc, const QString &parentFolder, const QString &templatePath, std::shared_ptr<ProjectItemModel> model);
void createTitleTemplateClip(KdenliveDoc *doc, const QString &parentFolder, std::shared_ptr<ProjectItemModel> model);
void createClipsCommand(KdenliveDoc *doc, const QString &parentFolder, const std::shared_ptr<ProjectItemModel> &model);
void clipWidget(QDockWidget* m_DockClipWidget);
void clipWidget(QDockWidget* m_DockClipWidget, KdenliveDoc* doc, const std::shared_ptr<ProjectItemModel> model);
} // namespace ClipCreationDialog
#endif
......@@ -347,7 +347,7 @@ void MainWindow::init()
m_projectBinDock = addDock(i18n("Project Bin"), QStringLiteral("project_bin"), pCore->bin());
QDockWidget* m_ClipDockWidget = addDock(i18n("Clips"), QStringLiteral("bin_clip"), pCore->bin()->getWidget());
pCore->bin()->getWidget()->init(m_ClipDockWidget);
pCore->bin()->dockWidgetInit(m_ClipDockWidget);
m_assetPanel = new AssetPanel(this);
m_effectStackDock = addDock(i18n("Effect/Composition Stack"), QStringLiteral("effect_stack"), m_assetPanel);
connect(m_assetPanel, &AssetPanel::doSplitEffect, m_projectMonitor, &Monitor::slotSwitchCompare);
......
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