Commit 984f452f authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch 'vivekkde/kdenlive-develop'

parents 8d41f152 c877a1f3
Pipeline #46571 passed with stage
in 10 minutes and 36 seconds
......@@ -824,6 +824,16 @@ bool LineEventEater::eventFilter(QObject *obj, QEvent *event)
return QObject::eventFilter(obj, event);
}
void ClipWidget::init(QDockWidget* m_DockClipWidget, KdenliveDoc* doc,
std::shared_ptr<ProjectItemModel> model)
{
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);
m_DockClipWidget->setWidget(fileWidget);*/
}
Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
: QWidget(parent)
, isLoading(false)
......@@ -847,6 +857,7 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
, m_gainedFocus(false)
, m_audioDuration(0)
, m_processedAudio(0)
, m_clipWidget()
{
m_layout = new QVBoxLayout(this);
......@@ -4368,3 +4379,11 @@ QList<int> Bin::getUsedClipIds()
}
return timelineClipIds;
}
ClipWidget* Bin::getWidget(){
return m_clipWidget;
}
void Bin::dockWidgetInit(QDockWidget* m_DockClipWidget){
m_clipWidget->init(m_DockClipWidget, m_doc, m_itemModel);
}
......@@ -40,6 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QUrl>
#include <QWidget>
#include <QActionGroup>
#include <QtWidgets>
#include "KFileWidget"
#include "KRecentDirs"
class AbstractProjectItem;
class BinItemDelegate;
......@@ -163,6 +167,15 @@ signals:
* @brief The bin widget takes care of both item model and view upon project opening.
*/
class ClipWidget : public QWidget
{
public:
explicit ClipWidget(){}
~ClipWidget() override;
void init(QDockWidget* m_DockClipWidget, KdenliveDoc* doc,
std::shared_ptr<ProjectItemModel> model );
};
class Bin : public QWidget
{
Q_OBJECT
......@@ -175,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 */
......@@ -298,6 +311,7 @@ public:
void loadFolderState(QStringList foldersToExpand);
/** @brief gets a QList of all clips used in timeline */
QList<int> getUsedClipIds();
ClipWidget* getWidget();
// TODO refac: remove this and call directly the function in ProjectItemModel
void cleanupUnused();
......@@ -471,6 +485,7 @@ private:
QActionGroup *m_sortGroup;
SmallJobLabel *m_infoLabel;
TagWidget *m_tagsWidget;
ClipWidget *m_clipWidget;
QMenu *m_filterMenu;
QActionGroup m_filterGroup;
QActionGroup m_filterRateGroup;
......
......@@ -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));
......@@ -448,3 +449,46 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QString &par
pCore->pushUndo(undo, redo, i18np("Add clip", "Add clips", list.size()));
}
}
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(i18n("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, [=, &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) {
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);
}
......@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define CLIPCREATIONDIALOG_H
#include "definitions.h"
#include <QDockWidget>
class KdenliveDoc;
class Bin;
......@@ -45,6 +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, KdenliveDoc* doc, const std::shared_ptr<ProjectItemModel> model);
} // namespace ClipCreationDialog
#endif
......@@ -346,7 +346,8 @@ void MainWindow::init()
spectrumDock->close();
m_projectBinDock = addDock(i18n("Project Bin"), QStringLiteral("project_bin"), pCore->bin());
QDockWidget* m_ClipDockWidget = addDock(i18n("Media Browser"), QStringLiteral("bin_clip"), pCore->bin()->getWidget());
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);
......
......@@ -89,7 +89,7 @@ public:
*/
void saveWithUpdatedProfile(const QString &updatedProfile);
/** @brief Get the number of tracks in this projec (video, audio).
/** @brief Get the number of tracks in this project (video, audio).
*/
QPair<int, int> tracksCount();
......
......@@ -216,7 +216,6 @@ Item {
anchors.fill: displayRect
anchors.margins: displayRect.border.width
clip: true
Rectangle {
// text background
id: labelRect
......
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