aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2015-06-21 01:27:39 +0200
committerJean-Baptiste Mardelle <[email protected]>2015-06-21 01:27:39 +0200
commit86408dffa45c618164781ad93d7573239f946c0f (patch)
tree19bbff06edfb2d7c461b303d9edbc28ca47a2a67
parent171cdd8bfba1cbc212351757be2db7e118db37f7 (diff)
Fix deletion of bin clips with timeline occurrence, deleting folder correctly deletes timeline clips
-rw-r--r--src/bin/bin.cpp29
-rw-r--r--src/bin/projectclip.cpp2
-rw-r--r--src/doc/doccommands.cpp2
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/project/clipmanager.cpp17
-rw-r--r--src/project/clipmanager.h4
-rw-r--r--src/renderer.cpp5
-rw-r--r--src/timeline/customtrackview.cpp13
8 files changed, 52 insertions, 22 deletions
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index fd4ccc3..0ea3236 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -47,7 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KColorScheme>
#include <KMessageBox>
#include <KSplitterCollapserButton>
-
+#include <KMessageBox>
#include <QDialogButtonBox>
#include <QVBoxLayout>
@@ -268,7 +268,6 @@ Bin::Bin(QWidget* parent) :
m_slider->setMaximumWidth(100);
m_slider->setMinimumWidth(40);
m_slider->setRange(0, 10);
- // TODO: fix view zoom on startup
m_slider->setValue(KdenliveSettings::bin_zoom());
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSetIconSize(int)));
QWidgetAction * widgetslider = new QWidgetAction(this);
@@ -739,6 +738,32 @@ void Bin::removeFolder(const QString &id, QUndoCommand *deleteCommand)
// Check parent item
ProjectFolder *folder = m_rootFolder->folder(id);
AbstractProjectItem *parent = folder->parent();
+ if (folder->count() > 0) {
+ // Folder has clips inside, warn user
+ if (KMessageBox::warningContinueCancel(this, i18np("Folder contains a clip, delete anyways ?", "Folder contains %1 clips, delete anyways ?", folder->count())) != KMessageBox::Continue) {
+ return;
+ }
+ QStringList clipIds;
+ QStringList folderIds;
+ // TODO: manage subclips
+ for (int i = 0; i < folder->count(); i++) {
+ AbstractProjectItem *child = folder->at(i);
+ switch (child->itemType()) {
+ case AbstractProjectItem::ClipItem:
+ clipIds << child->clipId();
+ break;
+ case AbstractProjectItem::FolderItem:
+ folderIds << child->clipId();
+ break;
+ default:
+ break;
+ }
+ }
+ foreach(const QString &folderId, folderIds) {
+ removeFolder(folderId, deleteCommand);
+ }
+ m_doc->clipManager()->deleteProjectItems(clipIds, folderIds, QStringList(), deleteCommand);
+ }
new AddBinFolderCommand(this, folder->clipId(), folder->name(), parent->clipId(), true, deleteCommand);
}
diff --git a/src/bin/projectclip.cpp b/src/bin/projectclip.cpp
index 143393c..713bb43 100644
--- a/src/bin/projectclip.cpp
+++ b/src/bin/projectclip.cpp
@@ -312,7 +312,7 @@ ClipController *ProjectClip::controller()
bool ProjectClip::isReady() const
{
- return m_controller!= NULL;
+ return m_controller != NULL;
}
/*void ProjectClip::setZone(const QPoint &zone)
diff --git a/src/doc/doccommands.cpp b/src/doc/doccommands.cpp
index 5f33390..fc96086 100644
--- a/src/doc/doccommands.cpp
+++ b/src/doc/doccommands.cpp
@@ -39,7 +39,6 @@ AddClipCommand::AddClipCommand(KdenliveDoc *doc, const QDomElement &xml, const Q
// virtual
void AddClipCommand::undo()
{
- qDebug()<<"/ / / /UNDOING COMMAND";
if (m_doIt)
m_doc->deleteClip(m_id);
else
@@ -48,7 +47,6 @@ void AddClipCommand::undo()
// virtual
void AddClipCommand::redo()
{
- qDebug()<<"/ / / /REDOING COMMAND";
if (m_doIt)
m_doc->addClip(m_xml, m_id);
else
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index aa3e998..5a53889 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -698,7 +698,7 @@ void MainWindow::slotConnectMonitors()
{
//connect(m_projectList, SIGNAL(deleteProjectClips(QStringList,QMap<QString,QString>)), this, SLOT(slotDeleteProjectClips(QStringList,QMap<QString,QString>)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(QString,QImage)), pCore->bin(), SLOT(slotThumbnailReady(QString,QImage)));
- connect(m_projectMonitor->render, SIGNAL(gotFileProperties(requestClipInfo,ClipController *)), pCore->bin(), SLOT(slotProducerReady(requestClipInfo,ClipController *)));
+ connect(m_projectMonitor->render, SIGNAL(gotFileProperties(requestClipInfo,ClipController *)), pCore->bin(), SLOT(slotProducerReady(requestClipInfo,ClipController *)), Qt::DirectConnection);
//DirectConnection was necessary not to mess the analyze queue, but the monitor thread shouldn't show any UI widget (profile dialog), so adding an AutoConnection in between?
diff --git a/src/project/clipmanager.cpp b/src/project/clipmanager.cpp
index d528b30..b31bb29 100644
--- a/src/project/clipmanager.cpp
+++ b/src/project/clipmanager.cpp
@@ -216,10 +216,13 @@ QMap <QString, QString> ClipManager::documentFolderList() const
return m_folderList;
}
-void ClipManager::deleteProjectItems(QStringList clipIds, QStringList folderIds, QStringList subClipIds)
+void ClipManager::deleteProjectItems(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand)
{
// Create meta command
- QUndoCommand *deleteCommand = new QUndoCommand();
+ bool execute = deleteCommand == NULL;
+ if (execute) {
+ deleteCommand = new QUndoCommand();
+ }
if (clipIds.isEmpty()) {
// Deleting folder only
if (!subClipIds.isEmpty()) {
@@ -238,7 +241,8 @@ void ClipManager::deleteProjectItems(QStringList clipIds, QStringList folderIds,
}
}
// remove clips and folders from bin
- slotDeleteClips(clipIds, folderIds, subClipIds, deleteCommand);
+ qDebug()<<" + ++ +DELETING CLIPs: "<<clipIds;
+ slotDeleteClips(clipIds, folderIds, subClipIds, deleteCommand, execute);
}
}
@@ -248,7 +252,7 @@ void ClipManager::deleteProjectClip(const QString &clipId)
pCore->bin()->deleteClip(clipId);
}
-void ClipManager::slotDeleteClips(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand)
+void ClipManager::slotDeleteClips(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand, bool execute)
{
for (int i = 0; i < clipIds.size(); ++i) {
QString xml = pCore->binController()->xmlFromId(clipIds.at(i));
@@ -265,7 +269,10 @@ void ClipManager::slotDeleteClips(QStringList clipIds, QStringList folderIds, QS
pCore->bin()->removeSubClip(subClipIds.at(i), deleteCommand);
}
- m_doc->commandStack()->push(deleteCommand);
+ if (execute) {
+ qDebug()<<" // / /EXECUTE DELETION";
+ m_doc->commandStack()->push(deleteCommand);
+ }
}
void ClipManager::deleteClip(const QString &clipId)
diff --git a/src/project/clipmanager.h b/src/project/clipmanager.h
index e0a1ff2..e9312dc 100644
--- a/src/project/clipmanager.h
+++ b/src/project/clipmanager.h
@@ -77,7 +77,7 @@ Q_OBJECT public:
void slotAddTextTemplateClip(QString titleName, const QUrl &path, const QString &group, const QString &groupId);
void slotAddXmlClipFile(const QString &name, const QDomElement &xml, const QString &group, const QString &groupId);
//const QList <DocClipBase *> getClipByResource(const QString &resource);
- void slotDeleteClips(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand);
+ void slotDeleteClips(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand, bool execute);
void setThumbsProgress(const QString &message, int progress);
QMap <QString, QString> documentFolderList() const;
int getFreeFolderId();
@@ -85,7 +85,7 @@ Q_OBJECT public:
QString projectFolder() const;
void clearUnusedProducers();
/** @brief Prepare deletion of clips and folders from the Bin. */
- void deleteProjectItems(QStringList clipIds, QStringList folderIds, QStringList subClipIds);
+ void deleteProjectItems(QStringList clipIds, QStringList folderIds, QStringList subClipIds, QUndoCommand *deleteCommand = NULL);
void clear();
void clearCache();
AbstractGroupItem *createGroup();
diff --git a/src/renderer.cpp b/src/renderer.cpp
index 2694836..d589f12 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -545,7 +545,7 @@ void Render::forceProcessing(const QString &id)
// Make sure we load the clip producer now so that we can use it in timeline
QList <requestClipInfo> requestListCopy;
if (m_processingClipId.contains(id)) {
- m_infoMutex.lock();
+ m_infoMutex.lock();
requestListCopy = m_requestList;
m_requestList.clear();
m_infoMutex.unlock();
@@ -577,7 +577,6 @@ void Render::forceProcessing(const QString &id)
if (!m_infoThread.isRunning()) {
m_infoThread = QtConcurrent::run(this, &Render::processFileProperties);
}
-
}
int Render::processingItems()
@@ -870,6 +869,7 @@ void Render::processFileProperties()
}
// replace clip
qDebug()<<" / / /CREATED PROD: "<<producer->get("resource");
+ m_processingClipId.removeAll(info.clipId);
m_binController->replaceProducer(info.clipId, *producer);
emit gotFileProperties(info, NULL);
continue;
@@ -1128,6 +1128,7 @@ void Render::processFileProperties()
m_binController->addClipToBin(info.clipId, controller);
emit gotFileProperties(info, controller);
}
+ m_processingClipId.removeAll(info.clipId);
}
}
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index 08679a0..a6b62e6 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -3531,14 +3531,10 @@ void CustomTrackView::deleteClip(const QString &clipId, QUndoCommand *deleteComm
}
}
}
- if (count == 0) {
- // No clip to delete
- //delete deleteCommand;
- } else {
- deleteCommand->setText(i18np("Delete timeline clip", "Delete timeline clips", count));
+ qDebug()<<"+ + +Found timeline clips: "<<count;
+ if (count > 0) {
new RefreshMonitorCommand(this, true, false, deleteCommand);
updateTrackDuration(-1, deleteCommand);
- //m_commandStack->push(deleteCommand);
}
}
@@ -4227,8 +4223,11 @@ void CustomTrackView::deleteClip(ItemInfo info, bool refresh)
if (m_dragItem == item) m_dragItem = NULL;
+ delete item;
+ item = NULL;
// animate item deletion
- item->closeAnimation();
+ //item->closeAnimation();
+
/*if (refresh) item->closeAnimation();
else {
// no refresh, means we have several operations chained, we need to delete clip immediately