connect(this, SIGNAL(cancelRunningJob(const QString, stringMap )), this, SLOT(slotCancelRunningJob(const QString, stringMap)));
connect(this, SIGNAL(processLog(const QString, int , int, const QString)), this, SLOT(slotProcessLog(const QString, int , int, const QString)));
- connect(this, SIGNAL(updateJobStatus(const QString &, int, int, const QString &, const QString &, const QString)), this, SLOT(slotUpdateJobStatus(const QString &, int, int, const QString &, const QString &, const QString)));
+ connect(this, SIGNAL(updateJobStatus(const QString, int, int, const QString, const QString, const QString)), this, SLOT(slotUpdateJobStatus(const QString, int, int, const QString, const QString, const QString)));
connect(this, SIGNAL(gotProxy(const QString)), this, SLOT(slotGotProxyForId(const QString)));
{
m_render = projectRender;
m_listView->setIconSize(QSize((ProjectItem::itemDefaultHeight() - 2) * m_render->dar(), ProjectItem::itemDefaultHeight() - 2));
+ connect(m_render, SIGNAL(requestProxy(QString)), this, SLOT(slotCreateProxy(QString)));
}
void ProjectList::slotClipSelected()
KUrl url = clip->fileURL();
#ifdef USE_NEPOMUK
- if (!url.isEmpty() && KdenliveSettings::activate_nepomuk()) {
+ if (!url.isEmpty() && KdenliveSettings::activate_nepomuk() && clip->getProperty("description").isEmpty()) {
// if file has Nepomuk comment, use it
Nepomuk::Resource f(url.path());
QString annotation = f.description();
- if (!annotation.isEmpty()) item->setText(1, annotation);
+ if (!annotation.isEmpty()) {
+ item->setText(1, annotation);
+ clip->setProperty("description", annotation);
+ }
item->setText(2, QString::number(f.rating()));
}
#endif
} else {
item = static_cast <ProjectItem *>(*it);
clip = item->referencedClip();
- if (item->referencedClip()->getProducer() == NULL) {
+ if (clip->getProducer() == NULL) {
bool replace = false;
if (brokenClips.contains(item->clipId())) {
// if this is a proxy clip, disable proxy
xml.removeAttribute("file_hash");
xml.removeAttribute("proxy_out");
}
- if (!replace) replace = xml.attribute("replace") == "1";
+ if (!replace) replace = xml.attribute("_replaceproxy") == "1";
+ xml.removeAttribute("_replaceproxy");
if (replace) {
resetThumbsProducer(clip);
}
getCachedThumbnail(item);
}
if (item->data(0, DurationRole).toString().isEmpty()) {
- item->changeDuration(item->referencedClip()->getProducer()->get_playtime());
+ item->changeDuration(clip->getProducer()->get_playtime());
}
if (clip->isPlaceHolder()) {
QPixmap pixmap = qVariantValue<QPixmap>(item->data(0, Qt::DecorationRole));
p.end();
item->setData(0, Qt::DecorationRole, pixmap);
}
+ else if (clip->getProperty("_replaceproxy") == "1") {
+ clip->setProperty("_replaceproxy", QString());
+ slotCreateProxy(clip->getId());
+ }
}
item->setData(0, UsageRole, QString::number(item->numReferences()));
}
slotUpdateJobStatus(item, PROXYJOB, JOBCRASHED, i18n("Failed to create proxy, empty path."));
return;
}
-
- ProxyJob *job = new ProxyJob(item->clipType(), id, QStringList() << path << item->clipUrl().path() << item->referencedClip()->producerProperty("_exif_orientation") << m_doc->getDocumentProperty("proxyparams").simplified() << QString::number(m_render->frameRenderWidth()) << QString::number(m_render->renderHeight()));
- if (job->isExclusive() && hasPendingJob(item, job->jobType)) {
- delete job;
- return;
- }
-
+
if (QFileInfo(path).size() > 0) {
// Proxy already created
setJobStatus(item, PROXYJOB, JOBDONE);
return;
}
+ ProxyJob *job = new ProxyJob(item->clipType(), id, QStringList() << path << item->clipUrl().path() << item->referencedClip()->producerProperty("_exif_orientation") << m_doc->getDocumentProperty("proxyparams").simplified() << QString::number(m_render->frameRenderWidth()) << QString::number(m_render->renderHeight()));
+ if (job->isExclusive() && hasPendingJob(item, job->jobType)) {
+ delete job;
+ return;
+ }
+
m_jobList.append(job);
setJobStatus(item, job->jobType, JOBWAITING, 0, job->statusMessage());
slotCheckJobProcess();
void ProjectList::slotAbortProxy(const QString id, const QString path)
{
+ Q_UNUSED(path)
+
ProjectItem *item = getItemById(id);
if (!item) return;
if (!item->isProxyRunning()) slotGotProxy(item);
break;
}
QString destination = job->destination();
-
// Check if the clip is still here
- ProjectItem *processingItem = getItemById(job->clipId());
- if (processingItem == NULL) {
+ DocClipBase *currentClip = m_doc->clipManager()->getClipById(job->clipId());
+ //ProjectItem *processingItem = getItemById(job->clipId());
+ if (currentClip == NULL) {
job->setStatus(JOBDONE);
continue;
}
if (job->jobType == MLTJOB) {
MeltJob *jb = static_cast<MeltJob *> (job);
- jb->setProducer(processingItem->referencedClip()->getProducer());
+ jb->setProducer(currentClip->getProducer());
}
job->startJob();
if (job->jobStatus == JOBDONE) {
if (job->addClipToProject) {
emit addClip(destination, QString(), QString());
}
- }
- else if (job->jobStatus == JOBCRASHED) {
- emit updateJobStatus(job->clipId(), job->jobType, JOBCRASHED, job->errorMessage());
+ } else if (job->jobStatus == JOBCRASHED || job->jobStatus == JOBABORTED) {
+ emit updateJobStatus(job->clipId(), job->jobType, job->jobStatus, job->errorMessage(), QString(), job->logDetails());
}
}
// Thread finished, cleanup & update count
// remove proxy
QMap <QString, QString> newProps;
newProps.insert("proxy", QString());
- newProps.insert("replace", "1");
// insert required duration for proxy
newProps.insert("proxy_out", item->referencedClip()->producerProperty("out"));
new EditClipCommand(this, item->clipId(), item->referencedClip()->currentProperties(newProps), newProps, true, command);
// remove proxy
QMap <QString, QString> newProps;
newProps.insert("proxy", QString());
- newProps.insert("replace", "1");
new EditClipCommand(this, item->clipId(), item->referencedClip()->properties(), newProps, true, command);
}
}
{
if (item->hasProxy()) {
QPainter p(&pix);
- QColor c = QPalette().base().color();
- c.setAlpha(160);
- QBrush br(c);
- p.setBrush(br);
- p.setPen(Qt::NoPen);
- QRect r(1, 1, 10, 10);
- p.drawRect(r);
- p.setPen(QPalette().text().color());
+ QColor c(220, 220, 10, 200);
+ QRect r(0, 0, 12, 12);
+ p.fillRect(r, c);
+ QFont font = p.font();
+ font.setBold(true);
+ p.setFont(font);
+ p.setPen(Qt::black);
p.drawText(r, Qt::AlignCenter, i18nc("The first letter of Proxy, used as abbreviation", "P"));
}
}
command->setText(i18np("Cancel job", "Cancel jobs", m_jobList.count()));
m_jobMutex.lock();
for (int i = 0; i < m_jobList.count(); i++) {
- ProjectItem *item = getItemById(m_jobList.at(i)->clipId());
- if (!item || !item->referencedClip()) continue;
+ DocClipBase *currentClip = m_doc->clipManager()->getClipById(m_jobList.at(i)->clipId());
+ if (!currentClip) continue;
QMap <QString, QString> newProps = m_jobList.at(i)->cancelProperties();
if (newProps.isEmpty()) continue;
- QMap <QString, QString> oldProps = item->referencedClip()->currentProperties(newProps);
+ QMap <QString, QString> oldProps = currentClip->currentProperties(newProps);
new EditClipCommand(this, m_jobList.at(i)->clipId(), oldProps, newProps, true, command);
}
m_jobMutex.unlock();
void ProjectList::slotCancelRunningJob(const QString id, stringMap newProps)
{
if (newProps.isEmpty() || m_closing) return;
- ProjectItem *item = getItemById(id);
- if (!item || !item->referencedClip()) return;
- QMap <QString, QString> oldProps = item->referencedClip()->currentProperties(newProps);
+ DocClipBase *currentClip = m_doc->clipManager()->getClipById(id);
+ if (!currentClip) return;
+ QMap <QString, QString> oldProps = currentClip->currentProperties(newProps);
if (newProps == oldProps) return;
QMapIterator<QString, QString> i(oldProps);
EditClipCommand *command = new EditClipCommand(this, id, oldProps, newProps, true);
}
}
-void ProjectList::slotUpdateJobStatus(const QString &id, int type, int status, const QString &label, const QString &actionName, const QString details)
+void ProjectList::slotUpdateJobStatus(const QString id, int type, int status, const QString label, const QString actionName, const QString details)
{
ProjectItem *item = getItemById(id);
if (!item) return;