#include <QFile>
const int DurationRole = Qt::UserRole + 1;
-const int ProxyRole = Qt::UserRole + 5;
+const int JobProgressRole = Qt::UserRole + 5;
+const int JobTypeRole = Qt::UserRole + 6;
+const int JobStatusMessage = Qt::UserRole + 7;
const int itemHeight = 38;
ProjectItem::ProjectItem(QTreeWidget * parent, DocClipBase *clip) :
void ProjectItem::slotSetToolTip()
{
- QString tip = "<b>";
+ QString tip;
if (m_clip->isPlaceHolder()) tip.append(i18n("Missing") + " | ");
+ QString jobInfo = data(0, JobStatusMessage).toString();
+ if (!jobInfo.isEmpty()) {
+ tip.append(jobInfo + " | ");
+ }
+ if (hasProxy() && data(0, JobTypeRole).toInt() != PROXYJOB) {
+ tip.append(i18n("Proxy clip") + " | ");
+ }
+ tip.append("<b>");
switch (m_clipType) {
case AUDIO:
tip.append(i18n("Audio clip") + "</b><br />" + clipUrl().path());
tip.append(i18n("Unknown clip"));
break;
}
-
setToolTip(0, tip);
}
}
}
-void ProjectItem::setProxyStatus(PROXYSTATUS status, int progress)
+void ProjectItem::setJobStatus(JOBTYPE jobType, CLIPJOBSTATUS status, int progress, const QString &statusMessage)
{
- if (progress > 0) setData(0, ProxyRole, progress);
- else setData(0, ProxyRole, status);
+ setData(0, JobTypeRole, jobType);
+ if (progress > 0) setData(0, JobProgressRole, progress);
+ else {
+ setData(0, JobProgressRole, status);
+ setData(0, JobStatusMessage, statusMessage);
+ slotSetToolTip();
+ }
+}
+
+void ProjectItem::setConditionalJobStatus(CLIPJOBSTATUS status, JOBTYPE requestedJobType)
+{
+ if (data(0, JobTypeRole).toInt() == requestedJobType) {
+ setData(0, JobProgressRole, status);
+ }
}
bool ProjectItem::hasProxy() const
{
if (m_clip == NULL) return false;
- if (m_clip->getProperty("proxy").isEmpty() || m_clip->getProperty("proxy") == "-" || data(0, ProxyRole).toInt() == PROXYCRASHED) return false;
+ if (m_clip->getProperty("proxy").size() < 2 || data(0, JobProgressRole).toInt() == JOBCRASHED) return false;
return true;
}
bool ProjectItem::isProxyReady() const
{
- return (data(0, ProxyRole).toInt() == PROXYDONE);
+ return (data(0, JobProgressRole).toInt() == JOBDONE);
+}
+
+bool ProjectItem::isJobRunning() const
+{
+ int s = data(0, JobProgressRole).toInt();
+ if (s == JOBWAITING || s == JOBWORKING || s > 0) return true;
+ return false;
}
bool ProjectItem::isProxyRunning() const
{
- int s = data(0, ProxyRole).toInt();
- if (s == PROXYWAITING || s == CREATINGPROXY || s > 0) return true;
+ int s = data(0, JobProgressRole).toInt();
+ if ((s == JOBWORKING || s > 0) && data(0, JobTypeRole).toInt() == (int) PROXYJOB) return true;
return false;
}