* done here. If a new clip type is added then it should be possible to combine it with both audio
* and video. */
- DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id);
+ DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id, bool placeHolder = false);
// DocClipBase & operator=(const DocClipBase & clip);
virtual ~ DocClipBase();
/** Get default play zone for clip monitor */
QPoint zone() const;
+ /** Returns true is clip is missing but user wants to keep it as placeholder */
+ bool isPlaceHolder() const;
+
private: // Private attributes
/** A description of this clip */
/** a unique numeric id */
QString m_id;
+
+ /** Wheter the clip is a placeholder (clip missing but user wants to see it) */
+ bool m_placeHolder;
+
void setAudioThumbCreated(bool isDone);
/** Holds clip infos like fps, size,... */
QMap <QString, QString> m_properties;
{
const QString producerId = clipId.section('_', 0, 0);
DocClipBase *clip = m_clipManager->getClipById(producerId);
+ bool placeHolder = false;
if (clip == NULL) {
elem.setAttribute("id", producerId);
QString path = elem.attribute("resource");
setNewClipResource(clipId, titleresource);
delete dia_ui;
}
+
if (path.isEmpty() == false && QFile::exists(path) == false && elem.attribute("type").toInt() != TEXT) {
kDebug() << "// FOUND MISSING CLIP: " << path << ", TYPE: " << elem.attribute("type").toInt();
const QString size = elem.attribute("file_size");
int res = KMessageBox::questionYesNoCancel(kapp->activeWindow(), i18n("Clip <b>%1</b><br>is invalid or missing, what do you want to do?", path), i18n("File not found"), KGuiItem(i18n("Search manually")), KGuiItem(i18n("Keep as placeholder")));
if (res == KMessageBox::Yes)
newpath = KFileDialog::getExistingDirectory(KUrl("kfiledialog:///clipfolder"), kapp->activeWindow(), i18n("Looking for %1", path));
- else if (res == KMessageBox::Cancel) {
+ else {
// Abort project loading
- action = KMessageBox::Cancel;
+ action = res;
}
} else {
int res = KMessageBox::questionYesNoCancel(kapp->activeWindow(), i18n("Clip <b>%1</b><br>is invalid or missing, what do you want to do?", path), i18n("File not found"), KGuiItem(i18n("Search manually")), KGuiItem(i18n("Keep as placeholder")));
if (res == KMessageBox::Yes)
newpath = KFileDialog::getOpenFileName(KUrl("kfiledialog:///clipfolder"), QString(), kapp->activeWindow(), i18n("Looking for %1", path));
- else if (res == KMessageBox::Cancel) {
+ else {
// Abort project loading
- action = KMessageBox::Cancel;
+ action = res;
}
}
}
} else if (action == KMessageBox::Cancel) {
m_abortLoading = true;
return;
+ } else if (action == KMessageBox::No) {
+ // Keep clip as placeHolder
+ placeHolder = true;
}
if (!newpath.isEmpty()) {
if (elem.attribute("type").toInt() == SLIDESHOW) newpath.append('/' + extension);
setModified(true);
}
}
- clip = new DocClipBase(m_clipManager, elem, producerId);
+ clip = new DocClipBase(m_clipManager, elem, producerId, placeHolder);
m_clipManager->addClip(clip);
}
tip.append(i18n("Text clip") + "</b><br />" + clipUrl().path());
break;
case SLIDESHOW:
- tip.append(i18n("Slideshow clip"));
+ tip.append(i18n("Slideshow clip") + "</b><br />" + clipUrl().directory());
break;
case VIRTUAL:
tip.append(i18n("Virtual clip"));
void ProjectList::slotEditClip()
{
ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
+ if (!(item->flags() & Qt::ItemIsDragEnabled)) return;
if (item && !item->isGroup()) {
emit clipSelected(item->referencedClip());
emit showClipProperties(item->referencedClip());
pix.save(clip->fileURL().path());
delete dia_ui;
}
- requestClipInfo(clip->toXML(), clip->getId());
+ if (clip->isPlaceHolder() == false) requestClipInfo(clip->toXML(), clip->getId());
+ else item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
} else {
QString cachedPixmap = m_doc->projectFolder().path() + "/thumbs/" + item->getClipHash() + ".png";
if (QFile::exists(cachedPixmap)) {
{
ProjectItem *item = static_cast <ProjectItem *>(itemAt(event->pos()));
if (!item) emit addClip();
+ if (!(item->flags() & Qt::ItemIsDragEnabled)) return;
else if (item->isGroup()) {
if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
} else {
return;
{
- ProjectItem *clickItem = (ProjectItem *) itemAt(m_DragStartPosition); //event->pos());
- if (clickItem) {
+ ProjectItem *clickItem = static_cast <ProjectItem *>(itemAt(m_DragStartPosition));
+ if (clickItem && (clickItem->flags() & Qt::ItemIsDragEnabled)) {
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
const QList <QTreeWidgetItem *> list = selectedItems();
producerXml.setAttribute("length", "15000");
producerXml.setAttribute("id", id);
missingClip = new DocClipBase(m_doc->clipManager(), producerXml, id);
- m_documentErrors.append(i18n("Boken clip producer %1", id) + '\n');
+ m_documentErrors.append(i18n("Broken clip producer %1", id) + '\n');
} else m_documentErrors.append(i18n("Replaced wrong clip producer %1 with %2", id, missingClip->getId()) + '\n');
ClipItem *item = new ClipItem(missingClip, clipinfo, m_doc->fps(), 1.0, false);
m_scene->addItem(item);
QDomNodeList params = missingXml.childNodes();
QString resource;
- QString mlt_service;
for (int j = 0; j < params.count(); j++) {
QDomElement e = params.item(j).toElement();
if (e.attribute("name") == "resource") {
resource = e.firstChild().nodeValue();
- } else if (e.attribute("name") == "mlt_service") {
- mlt_service = e.firstChild().nodeValue();
+ break;
}
}
- resource.prepend(docRoot);
+ // prepend westley document root if no path in clip resource and not a color clip
+ if (!resource.contains('/') && !resource.startsWith("0x")) resource.prepend(docRoot);
DocClipBase *missingClip = NULL;
if (!resource.isEmpty())
missingClip = m_doc->clipManager()->getClipByResource(resource);