#include "kdenlivesettings.h"
#include "slideshowclip.h"
#include "ui_colorclip_ui.h"
-#include "titlewidget.h"
+#include "widgets/titlewidget.h"
#include "definitions.h"
#include "clipmanager.h"
#include "docclipbase.h"
}
-
-InvalidDialog::InvalidDialog(const QString &caption, const QString &message, bool infoOnly, QWidget *parent) : KDialog(parent)
-{
- setCaption(caption);
- if (infoOnly) setButtons(KDialog::Ok);
- else setButtons(KDialog::Yes | KDialog::No);
- QWidget *w = new QWidget(this);
- QVBoxLayout *l = new QVBoxLayout;
- l->addWidget(new QLabel(message));
- m_clipList = new QListWidget;
- l->addWidget(m_clipList);
- w->setLayout(l);
- setMainWidget(w);
-}
-
-InvalidDialog::~InvalidDialog()
-{
- delete m_clipList;
-}
-
-
-void InvalidDialog::addClip(const QString &id, const QString &path)
-{
- QListWidgetItem *item = new QListWidgetItem(path);
- item->setData(Qt::UserRole, id);
- m_clipList->addItem(item);
-}
-
-QStringList InvalidDialog::getIds() const
-{
- QStringList ids;
- for (int i = 0; i < m_clipList->count(); ++i) {
- ids << m_clipList->item(i)->data(Qt::UserRole).toString();
- }
- return ids;
-}
-
-
ProjectList::ProjectList(QWidget *parent) :
QWidget(parent)
, m_render(NULL)
{
m_abortAllJobs = true;
for (int i = 0; i < m_jobList.count(); ++i) {
- m_jobList.at(i)->setStatus(JOBABORTED);
+ m_jobList.at(i)->setStatus(JobAborted);
}
m_closing = true;
m_thumbnailQueue.clear();
{
QList<QTreeWidgetItem *> list = m_listView->selectedItems();
if (list.isEmpty()) return;
- if (list.count() > 1 || list.at(0)->type() == PROJECTFOLDERTYPE) {
+ if (list.count() > 1 || list.at(0)->type() == ProjectFoldeType) {
editClipSelection(list);
return;
}
ProjectItem *item;
- if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE)
+ if (!m_listView->currentItem() || m_listView->currentItem()->type() == ProjectFoldeType)
return;
- if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE)
+ if (m_listView->currentItem()->type() == ProjectSubclipType)
item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
else
item = static_cast <ProjectItem*>(m_listView->currentItem());
ProjectItem *item;
for (int i = 0; i < list.count(); ++i) {
item = NULL;
- if (list.at(i)->type() == PROJECTFOLDERTYPE) {
+ if (list.at(i)->type() == ProjectFoldeType) {
// Add folder items to the list
int ct = list.at(i)->childCount();
for (int j = 0; j < ct; j++) {
}
continue;
}
- else if (list.at(i)->type() == PROJECTSUBCLIPTYPE)
+ else if (list.at(i)->type() == ProjectSubclipType)
item = static_cast <ProjectItem*>(list.at(i)->parent());
else
item = static_cast <ProjectItem*>(list.at(i));
// check properties
DocClipBase *clip = item->referencedClip();
if (clipList.contains(clip)) continue;
- if (clip->clipType() == IMAGE) {
+ if (clip->clipType() == Image) {
hasImages = true;
if (clip->getProperty("transparency").isEmpty() || clip->getProperty("transparency").toInt() == 0) {
if (transparency == "-") {
}
}
}
- if (clip->clipType() != COLOR && clip->clipType() != IMAGE && clip->clipType() != TEXT)
+ if (clip->clipType() != Color && clip->clipType() != Image && clip->clipType() != Text)
allowDurationChange = false;
if (allowDurationChange && commonDuration != 0) {
if (commonDuration == -1)
void ProjectList::slotOpenClip()
{
ProjectItem *item;
- if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE)
+ if (!m_listView->currentItem() || m_listView->currentItem()->type() == ProjectFoldeType)
return;
if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1)
item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
else
item = static_cast <ProjectItem*>(m_listView->currentItem());
if (item) {
- if (item->clipType() == IMAGE) {
+ if (item->clipType() == Image) {
if (KdenliveSettings::defaultimageapp().isEmpty())
KMessageBox::sorry(kapp->activeWindow(), i18n("Please set a default application to open images in the Settings dialog"));
else
QProcess::startDetached(KdenliveSettings::defaultimageapp(), QStringList() << item->clipUrl().path());
}
- if (item->clipType() == AUDIO) {
+ if (item->clipType() == Audio) {
if (KdenliveSettings::defaultaudioapp().isEmpty())
KMessageBox::sorry(kapp->activeWindow(), i18n("Please set a default application to open audio files in the Settings dialog"));
else
QTreeWidgetItemIterator it(m_listView);
ProjectItem *item;
while (*it) {
- if ((*it)->type() != PROJECTCLIPTYPE) {
+ if ((*it)->type() != ProjectClipType) {
it++;
continue;
}
QStringList ids;
QStringList urls;
while (*it) {
- if ((*it)->type() != PROJECTCLIPTYPE) {
+ if ((*it)->type() != ProjectClipType) {
it++;
continue;
}
// Check that we don't use the URL in another clip
QTreeWidgetItemIterator it2(m_listView);
while (*it2) {
- if ((*it2)->type() != PROJECTCLIPTYPE) {
+ if ((*it2)->type() != ProjectClipType) {
it2++;
continue;
}
}
ProjectItem *item;
for (int i = 0; i < selected.count(); ++i) {
- if (selected.at(i)->type() != PROJECTCLIPTYPE) {
- if (selected.at(i)->type() == PROJECTFOLDERTYPE) {
+ if (selected.at(i)->type() != ProjectClipType) {
+ if (selected.at(i)->type() == ProjectFoldeType) {
for (int j = 0; j < selected.at(i)->childCount(); j++)
selected.append(selected.at(i)->child(j));
}
kDebug()<<"//// TRYING TO RELOAD: "<<item->clipId()<<", but it is busy";
continue;
}
- CLIPTYPE t = item->clipType();
- if (t == TEXT) {
+ ClipType t = item->clipType();
+ if (t == Text) {
if (clip && !clip->getProperty("xmltemplate").isEmpty())
regenerateTemplate(item);
- } else if (t != COLOR && t != SLIDESHOW && clip && clip->checkHash() == false) {
+ } else if (t != Color && t != SlideShow && clip && clip->checkHash() == false) {
item->referencedClip()->setPlaceHolder(true);
item->setProperty("file_hash", QString());
- } else if (t == IMAGE) {
+ } else if (t == Image) {
//clip->getProducer() clip->getProducer()->set("force_reload", 1);
}
QDomElement e = item->toXml();
// Make sure we get the correct producer length if it was adjusted in timeline
- if (t == COLOR || t == IMAGE || t == SLIDESHOW || t == TEXT) {
+ if (t == Color || t == Image || t == SlideShow || t == Text) {
int length = QString(clip->producerProperty("length")).toInt();
if (length > 0 && !e.hasAttribute("length")) {
e.setAttribute("length", length);
bool missing = false;
QTreeWidgetItemIterator it(m_listView);
while (*it) {
- if ((*it)->type() == PROJECTCLIPTYPE && !((*it)->flags() & Qt::ItemIsDragEnabled)) {
+ if ((*it)->type() == ProjectClipType && !((*it)->flags() & Qt::ItemIsDragEnabled)) {
missing = true;
break;
}
QTreeWidgetItem *item = m_listView->currentItem();
ProjectItem *clip = NULL;
if (item) {
- if (item->type() == PROJECTFOLDERTYPE) {
+ if (item->type() == ProjectFoldeType) {
emit clipSelected(NULL);
m_editButton->defaultAction()->setEnabled(item->childCount() > 0);
m_deleteButton->defaultAction()->setEnabled(true);
m_transcodeAction->setEnabled(false);
m_clipsActionsMenu->setEnabled(false);
} else {
- if (item->type() == PROJECTSUBCLIPTYPE) {
+ if (item->type() == ProjectSubclipType) {
// this is a sub item, use base clip
m_deleteButton->defaultAction()->setEnabled(true);
clip = static_cast <ProjectItem*>(item->parent());
m_extractAudioAction->setEnabled(true);
m_transcodeAction->setEnabled(true);
m_clipsActionsMenu->setEnabled(true);
- if (clip && clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
+ if (clip && clip->clipType() == Image && !KdenliveSettings::defaultimageapp().isEmpty()) {
m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
m_openAction->setEnabled(true);
- } else if (clip && clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
+ } else if (clip && clip->clipType() == Audio && !KdenliveSettings::defaultaudioapp().isEmpty()) {
m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
m_openAction->setEnabled(true);
} else {
void ProjectList::adjustProxyActions(ProjectItem *clip) const
{
if (!m_proxyAction) return;
- if (clip == NULL || clip->type() != PROJECTCLIPTYPE || clip->clipType() == COLOR || clip->clipType() == TEXT || clip->clipType() == SLIDESHOW || clip->clipType() == AUDIO) {
+ if (clip == NULL || clip->type() != ProjectClipType || clip->clipType() == Color || clip->clipType() == Text || clip->clipType() == SlideShow || clip->clipType() == Audio) {
m_proxyAction->setEnabled(false);
return;
}
void ProjectList::adjustStabilizeActions(ProjectItem *clip) const
{
- if (clip == NULL || clip->type() != PROJECTCLIPTYPE || clip->clipType() == COLOR || clip->clipType() == TEXT || clip->clipType() == SLIDESHOW) {
+ if (clip == NULL || clip->type() != ProjectClipType || clip->clipType() == Color || clip->clipType() == Text || clip->clipType() == SlideShow) {
m_clipsActionsMenu->setEnabled(false);
return;
}
void ProjectList::adjustTranscodeActions(ProjectItem *clip) const
{
- if (clip == NULL || clip->type() != PROJECTCLIPTYPE || clip->clipType() == COLOR || clip->clipType() == TEXT || clip->clipType() == PLAYLIST || clip->clipType() == SLIDESHOW) {
+ if (clip == NULL || clip->type() != ProjectClipType || clip->clipType() == Color || clip->clipType() == Text || clip->clipType() == Playlist || clip->clipType() == SlideShow) {
m_transcodeAction->setEnabled(false);
m_extractAudioAction->setEnabled(false);
return;
if (properties.contains("proxy")) {
if (properties.value("proxy") == "-" || properties.value("proxy").isEmpty())
// this should only apply to proxy jobs
- clip->setConditionalJobStatus(NOJOB, PROXYJOB);
+ clip->setConditionalJobStatus(NoJob, PROXYJOB);
}
if (properties.contains("name")) {
monitorItemEditing(false);
emit clipNameChanged(clip->clipId(), properties.value("name"));
}
if (properties.contains("description")) {
- CLIPTYPE type = clip->clipType();
+ ClipType type = clip->clipType();
monitorItemEditing(false);
clip->setText(1, properties.value("description"));
monitorItemEditing(true);
#ifdef USE_NEPOMUK
- if (KdenliveSettings::activate_nepomuk() && (type == AUDIO || type == VIDEO || type == AV || type == IMAGE || type == PLAYLIST)) {
+ if (KdenliveSettings::activate_nepomuk() && (type == Audio || type == Video || type == AV || type == Image || type == Playlist)) {
// Use Nepomuk system to store clip description
Nepomuk::Resource f(clip->clipUrl().path());
f.setDescription(properties.value("description"));
void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column)
{
- if (item->type() == PROJECTSUBCLIPTYPE) {
+ if (item->type() == ProjectSubclipType) {
// this is a sub-item
if (column == 1) {
// user edited description
}
return;
}
- if (item->type() == PROJECTFOLDERTYPE) {
+ if (item->type() == ProjectFoldeType) {
if (column == 0) {
FolderProjectItem *folder = static_cast <FolderProjectItem*>(item);
if (item->text(0) == folder->groupName()) return;
oldprops["description"] = clip->referencedClip()->getProperty("description");
newprops["description"] = item->text(1);
- if (clip->clipType() == TEXT) {
+ if (clip->clipType() == Text) {
// This is a text template clip, update the image
/*oldprops.insert("xmldata", clip->referencedClip()->getProperty("xmldata"));
newprops.insert("xmldata", generateTemplateXml(clip->referencedClip()->getProperty("xmltemplate"), item->text(2)).toString());*/
m_clipsActionsMenu->setEnabled(enable);
if (enable) {
ProjectItem *clip = NULL;
- if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
+ if (m_listView->currentItem()->type() == ProjectSubclipType) {
clip = static_cast <ProjectItem*>(item->parent());
m_extractAudioAction->setEnabled(false);
m_transcodeAction->setEnabled(false);
m_clipsActionsMenu->setEnabled(false);
adjustProxyActions(clip);
- } else if (m_listView->currentItem()->type() == PROJECTCLIPTYPE) {
+ } else if (m_listView->currentItem()->type() == ProjectClipType) {
clip = static_cast <ProjectItem*>(item);
// Display relevant transcoding actions only
adjustTranscodeActions(clip);
m_transcodeAction->setEnabled(false);
m_clipsActionsMenu->setEnabled(false);
}
- if (clip && clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
+ if (clip && clip->clipType() == Image && !KdenliveSettings::defaultimageapp().isEmpty()) {
m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
m_openAction->setEnabled(true);
- } else if (clip && clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
+ } else if (clip && clip->clipType() == Audio && !KdenliveSettings::defaultaudioapp().isEmpty()) {
m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
m_openAction->setEnabled(true);
} else {
QUndoCommand *delCommand = new QUndoCommand();
delCommand->setText(i18n("Delete Clip Zone"));
for (int i = 0; i < selected.count(); ++i) {
- if (selected.at(i)->type() == PROJECTSUBCLIPTYPE) {
+ if (selected.at(i)->type() == ProjectSubclipType) {
// subitem
SubProjectItem *sub = static_cast <SubProjectItem *>(selected.at(i));
ProjectItem *item = static_cast <ProjectItem *>(sub->parent());
new AddClipCutCommand(this, item->clipId(), sub->zone().x(), sub->zone().y(), sub->description(), false, true, delCommand);
- } else if (selected.at(i)->type() == PROJECTFOLDERTYPE) {
+ } else if (selected.at(i)->type() == ProjectFoldeType) {
// folder
FolderProjectItem *folder = static_cast <FolderProjectItem *>(selected.at(i));
folderids[folder->groupName()] = folder->clipId();
if (!m_listView->currentItem())
m_listView->setCurrentItem(m_listView->topLevelItem(0));
QTreeWidgetItem *item = m_listView->currentItem();
- if (item && item->type() == PROJECTCLIPTYPE) {
+ if (item && item->type() == ProjectClipType) {
m_editButton->defaultAction()->setEnabled(true);
m_openAction->setEnabled(true);
m_reloadAction->setEnabled(true);
m_clipsActionsMenu->setEnabled(true);
return;
}
- else if (item && item->type() == PROJECTFOLDERTYPE && item->childCount() > 0) {
+ else if (item && item->type() == ProjectFoldeType && item->childCount() > 0) {
m_editButton->defaultAction()->setEnabled(true);
}
else m_editButton->defaultAction()->setEnabled(false);
if (item == NULL) {
item = new ProjectItem(m_listView, clip, pixelSize);
}
- if (item->data(0, DurationRole).isNull()) item->setData(0, DurationRole, i18n("Loading"));
+ if (item->data(0, ItemDelegate::DurationRole).isNull()) item->setData(0, ItemDelegate::DurationRole, i18n("Loading"));
connect(clip, SIGNAL(createProxy(QString)), this, SLOT(slotCreateProxy(QString)));
connect(clip, SIGNAL(abortProxy(QString,QString)), this, SLOT(slotAbortProxy(QString,QString)));
ProjectItem *item;
while (*it && !m_closing) {
- if ((*it)->type() == PROJECTCLIPTYPE) {
+ if ((*it)->type() == ProjectClipType) {
item = static_cast <ProjectItem *>(*it);
if (item->referencedClip()->getProperty("proxy") == proxyPath)
slotGotProxy(item);
QDomElement e = clip->toXML().cloneNode().toElement();
// Make sure we get the correct producer length if it was adjusted in timeline
- CLIPTYPE t = item->clipType();
- if (t == COLOR || t == IMAGE || t == SLIDESHOW || t == TEXT) {
+ ClipType t = item->clipType();
+ if (t == Color || t == Image || t == SlideShow || t == Text) {
int length = QString(clip->producerProperty("length")).toInt();
if (length > 0 && !e.hasAttribute("length")) {
e.setAttribute("length", length);
m_listView->blockSignals(true);
m_abortAllJobs = true;
for (int i = 0; i < m_jobList.count(); ++i) {
- m_jobList.at(i)->setStatus(JOBABORTED);
+ m_jobList.at(i)->setStatus(JobAborted);
}
m_closing = true;
m_jobThreads.waitForFinished();
{
ProjectItem *item = getItemById(id);
monitorItemEditing(false);
- if (item) item->setData(0, UsageRole, QString::number(item->numReferences()));
+ if (item){
+ item->setData(0, ItemDelegate::UsageRole, QString::number(item->numReferences()));
+ }
monitorItemEditing(true);
}
while (*it) {
emit displayMessage(i18n("Loading thumbnails"), (int)(100 *(max - ct++) / max));
- if ((*it)->type() == PROJECTSUBCLIPTYPE) {
+ if ((*it)->type() == ProjectSubclipType) {
// subitem
SubProjectItem *sub = static_cast <SubProjectItem *>(*it);
if (displayRatioChanged) {
}
++it;
continue;
- } else if ((*it)->type() == PROJECTFOLDERTYPE) {
+ } else if ((*it)->type() == ProjectFoldeType) {
// folder
++it;
continue;
bool replace = false;
if (brokenClips.contains(item->clipId())) {
// if this is a proxy clip, disable proxy
- item->setConditionalJobStatus(NOJOB, PROXYJOB);
+ item->setConditionalJobStatus(NoJob, PROXYJOB);
discardJobs(item->clipId(), PROXYJOB);
clip->setProperty("proxy", "-");
replace = true;
else if (!item->hasPixmap()) {
getCachedThumbnail(item);
}
- if (item->data(0, DurationRole).toString().isEmpty()) {
+ if (item->data(0, ItemDelegate::DurationRole).toString().isEmpty()) {
item->changeDuration(clip->getProducer()->get_playtime());
}
if (clip->isPlaceHolder()) {
slotCreateProxy(clip->getId());
}
}
- item->setData(0, UsageRole, QString::number(item->numReferences()));
+ item->setData(0, ItemDelegate::UsageRole, QString::number(item->numReferences()));
}
++it;
}
kDebug() << "Proxy duration is wrong, try changing transcoding parameters.";
emit displayMessage(i18n("Proxy clip unusable (duration is different from original)."), -2, ErrorMessage);
}
- slotUpdateJobStatus(item, PROXYJOB, JOBCRASHED, i18n("Failed to create proxy for %1. check parameters", item->text(0)), "project_settings");
+ slotUpdateJobStatus(item, PROXYJOB, JobCrashed, i18n("Failed to create proxy for %1. check parameters", item->text(0)), "project_settings");
QString path = item->referencedClip()->getProperty("proxy");
KUrl proxyFolder(m_doc->projectFolder().path( KUrl::AddTrailingSlash) + "proxy/");
{
QStringList result;
QTreeWidgetItem *item = m_listView->currentItem();
- while (item && item->type() != PROJECTFOLDERTYPE)
+ while (item && item->type() != ProjectFoldeType)
item = item->parent();
if (item) {
m_listView->blockSignals(true);
m_abortAllJobs = true;
for (int i = 0; i < m_jobList.count(); ++i) {
- m_jobList.at(i)->setStatus(JOBABORTED);
+ m_jobList.at(i)->setStatus(JobAborted);
}
m_closing = true;
m_jobThreads.waitForFinished();
if (!item && framePos == 0) pItem = getItemById(id);
if (!item && !pItem) return;
if (item) {
- if (item->type() == PROJECTCLIPTYPE) static_cast<ProjectItem*>(item)->setPixmap(QPixmap::fromImage(img));
+ if (item->type() == ProjectClipType) static_cast<ProjectItem*>(item)->setPixmap(QPixmap::fromImage(img));
else item->setData(0, Qt::DecorationRole, QPixmap::fromImage(img));
}
else if (pItem) pItem->setPixmap(QPixmap::fromImage(img));
doc.appendChild(prods);
QTreeWidgetItemIterator it(m_listView);
while (*it) {
- if ((*it)->type() != PROJECTCLIPTYPE) {
+ if ((*it)->type() != ProjectClipType) {
// subitem
++it;
continue;
ProjectItem *item = NULL;
bool isSubItem = false;
int frame;
- if (it->type() == PROJECTFOLDERTYPE) return;
- if (it->type() == PROJECTSUBCLIPTYPE) {
+ if (it->type() == ProjectFoldeType) return;
+ if (it->type() == ProjectSubclipType) {
item = static_cast <ProjectItem *>(it->parent());
frame = static_cast <SubProjectItem *>(it)->zone().x();
isSubItem = true;
int height = m_listView->iconSize().height();
int swidth = (int)(height * m_render->frameRenderWidth() / m_render->renderHeight()+ 0.5);
int dwidth = (int)(height * m_render->dar() + 0.5);
- if (clip->clipType() == IMAGE) {
+ if (clip->clipType() == Image) {
img = KThumb::getFrame(item->referencedClip()->getProducer(), 0, swidth, dwidth, height);
}
- else if (clip->clipType() != AUDIO) {
+ else if (clip->clipType() != Audio) {
img = item->referencedClip()->extractImage(frame, dwidth, height);
}
if (!img.isNull()) {
void ProjectList::extractMetadata(DocClipBase *clip)
{
- CLIPTYPE t = clip->clipType();
- if (t != AV && t != VIDEO) {
+ ClipType t = clip->clipType();
+ if (t != AV && t != Video) {
// Currently, we only use exiftool on video files
return;
}
// Proxy stuff
QString size = properties.value("frame_size");
if (!useProxy() && clip->getProperty("proxy").isEmpty()) {
- item->setConditionalJobStatus(NOJOB, PROXYJOB);
+ item->setConditionalJobStatus(NoJob, PROXYJOB);
discardJobs(clipId, PROXYJOB);
}
if (useProxy() && generateProxy() && clip->getProperty("proxy") == "-") {
- item->setConditionalJobStatus(NOJOB, PROXYJOB);
+ item->setConditionalJobStatus(NoJob, PROXYJOB);
discardJobs(clipId, PROXYJOB);
}
else if (useProxy() && !item->hasProxy() && !hasPendingJob(item, PROXYJOB)) {
// proxy video and image clips
int maxSize;
- CLIPTYPE t = item->clipType();
- if (t == IMAGE) maxSize = m_doc->getDocumentProperty("proxyimageminsize").toInt();
+ ClipType t = item->clipType();
+ if (t == Image) maxSize = m_doc->getDocumentProperty("proxyimageminsize").toInt();
else maxSize = m_doc->getDocumentProperty("proxyminsize").toInt();
- if ((((t == AV || t == VIDEO || t == PLAYLIST) && generateProxy()) || (t == IMAGE && generateImageProxy())) && (size.section('x', 0, 0).toInt() > maxSize || size.section('x', 1, 1).toInt() > maxSize)) {
+ if ((((t == AV || t == Video || t == Playlist) && generateProxy()) || (t == Image && generateImageProxy())) && (size.section('x', 0, 0).toInt() > maxSize || size.section('x', 1, 1).toInt() > maxSize)) {
if (clip->getProperty("proxy").isEmpty()) {
KUrl proxyPath = m_doc->projectFolder();
proxyPath.addPath("proxy/");
- proxyPath.addPath(clip->getClipHash() + '.' + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension")));
+ proxyPath.addPath(clip->getClipHash() + '.' + (t == Image ? "png" : m_doc->getDocumentProperty("proxyextension")));
QMap <QString, QString> newProps;
// insert required duration for proxy
- if (t != IMAGE) newProps.insert("proxy_out", clip->producerProperty("out"));
+ if (t != Image) newProps.insert("proxy_out", clip->producerProperty("out"));
newProps.insert("proxy", proxyPath.path());
QMap <QString, QString> oldProps = clip->properties();
oldProps.insert("proxy", QString());
m_listView->setCurrentItem(item);
bool updatedProfile = false;
if (item->parent()) {
- if (item->parent()->type() == PROJECTFOLDERTYPE)
+ if (item->parent()->type() == ProjectFoldeType)
static_cast <FolderProjectItem *>(item->parent())->switchIcon();
} else if (KdenliveSettings::checkfirstprojectclip() && m_listView->topLevelItemCount() == 1 && m_refreshed && m_allClipsProcessed) {
// this is the first clip loaded in project, check if we want to adjust project settings to the clip
bool ProjectList::adjustProjectProfileToItem(ProjectItem *item)
{
if (item == NULL) {
- if (m_listView->currentItem() && m_listView->currentItem()->type() != PROJECTFOLDERTYPE)
+ if (m_listView->currentItem() && m_listView->currentItem()->type() != ProjectFoldeType)
item = static_cast <ProjectItem*>(m_listView->currentItem());
}
if (item == NULL || item->referencedClip() == NULL) {
if (height == 1088) height = 1080;
double fps = item->referencedClip()->getProperty("fps").toDouble();
double par = item->referencedClip()->getProperty("aspect_ratio").toDouble();
- if (item->clipType() == IMAGE || item->clipType() == AV || item->clipType() == VIDEO) {
- if (ProfilesDialog::matchProfile(width, height, fps, par, item->clipType() == IMAGE, m_doc->mltProfile()) == false) {
+ if (item->clipType() == Image || item->clipType() == AV || item->clipType() == Video) {
+ if (ProfilesDialog::matchProfile(width, height, fps, par, item->clipType() == Image, m_doc->mltProfile()) == false) {
// get a list of compatible profiles
- QMap <QString, QString> suggestedProfiles = ProfilesDialog::getProfilesFromProperties(width, height, fps, par, item->clipType() == IMAGE);
+ QMap <QString, QString> suggestedProfiles = ProfilesDialog::getProfilesFromProperties(width, height, fps, par, item->clipType() == Image);
if (!suggestedProfiles.isEmpty()) {
KDialog *dialog = new KDialog(this);
dialog->setCaption(i18n("Change project profile"));
ProjectItem *result = NULL;
while (*it) {
- if ((*it)->type() != PROJECTCLIPTYPE) {
+ if ((*it)->type() != ProjectClipType) {
// subitem
++it;
continue;
ProjectItem *item;
QTreeWidgetItemIterator it(m_listView);
while (*it) {
- if ((*it)->type() != PROJECTCLIPTYPE) {
+ if ((*it)->type() != ProjectClipType) {
// subitem or folder
++it;
continue;
FolderProjectItem *item = NULL;
QList <QTreeWidgetItem *> hits = m_listView->findItems(name, Qt::MatchExactly, 0);
for (int i = 0; i < hits.count(); ++i) {
- if (hits.at(i)->type() == PROJECTFOLDERTYPE) {
+ if (hits.at(i)->type() == ProjectFoldeType) {
item = static_cast<FolderProjectItem *>(hits.at(i));
break;
}
FolderProjectItem *item;
QTreeWidgetItemIterator it(m_listView);
while (*it) {
- if ((*it)->type() == PROJECTFOLDERTYPE) {
+ if ((*it)->type() == ProjectFoldeType) {
item = static_cast<FolderProjectItem *>(*it);
if (item->clipId() == id)
return item;
m_extractAudioAction->setEnabled(true);
m_transcodeAction->setEnabled(true);
m_clipsActionsMenu->setEnabled(true);
- if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
+ if (clip->clipType() == Image && !KdenliveSettings::defaultimageapp().isEmpty()) {
m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
m_openAction->setEnabled(true);
- } else if (clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
+ } else if (clip->clipType() == Audio && !KdenliveSettings::defaultaudioapp().isEmpty()) {
m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
m_openAction->setEnabled(true);
} else {
QString ProjectList::currentClipUrl() const
{
ProjectItem *item;
- if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE) return QString();
- if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
+ if (!m_listView->currentItem() || m_listView->currentItem()->type() == ProjectFoldeType) return QString();
+ if (m_listView->currentItem()->type() == ProjectSubclipType) {
// subitem
item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
} else {
ProjectItem *item;
QList<QTreeWidgetItem *> list = m_listView->selectedItems();
for (int i = 0; i < list.count(); ++i) {
- if (list.at(i)->type() == PROJECTFOLDERTYPE)
+ if (list.at(i)->type() == ProjectFoldeType)
continue;
- if (list.at(i)->type() == PROJECTSUBCLIPTYPE) {
+ if (list.at(i)->type() == ProjectSubclipType) {
// subitem
item = static_cast <ProjectItem*>(list.at(i)->parent());
} else {
item = static_cast <ProjectItem*>(list.at(i));
}
- if (item == NULL || item->type() == COLOR || item->type() == SLIDESHOW || item->type() == TEXT)
+ if (item == NULL || item->type() == Color || item->type() == SlideShow || item->type() == Text)
continue;
DocClipBase *clip = item->referencedClip();
if (!condition.isEmpty()) {
ProjectItem *item;
QList<QTreeWidgetItem *> list = m_listView->selectedItems();
for (int i = 0; i < list.count(); ++i) {
- if (list.at(i)->type() == PROJECTFOLDERTYPE)
+ if (list.at(i)->type() == ProjectFoldeType)
continue;
- if (list.at(i)->type() == PROJECTSUBCLIPTYPE) {
+ if (list.at(i)->type() == ProjectSubclipType) {
// subitem
item = static_cast <ProjectItem*>(list.at(i)->parent());
} else {
item = static_cast <ProjectItem*>(list.at(i));
}
- if (item == NULL || item->type() == COLOR || item->type() == SLIDESHOW || item->type() == TEXT)
+ if (item == NULL || item->type() == Color || item->type() == SlideShow || item->type() == Text)
continue;
DocClipBase *clip = item->referencedClip();
if (!condition.isEmpty()) {
if (clip) {
for (int i = 0; i < clip->childCount(); ++i) {
QTreeWidgetItem *it = clip->child(i);
- if (it->type() == PROJECTSUBCLIPTYPE) {
+ if (it->type() == ProjectSubclipType) {
sub = static_cast <SubProjectItem*>(it);
if (sub->zone() == zone)
break;
void ProjectList::slotUpdateClipCut(QPoint p)
{
- if (!m_listView->currentItem() || m_listView->currentItem()->type() != PROJECTSUBCLIPTYPE)
+ if (!m_listView->currentItem() || m_listView->currentItem()->type() != ProjectSubclipType)
return;
SubProjectItem *sub = static_cast <SubProjectItem*>(m_listView->currentItem());
ProjectItem *item = static_cast <ProjectItem *>(sub->parent());
ProjectItem *item;
QTreeWidgetItemIterator it(m_listView);
while (*it) {
- if ((*it)->type() != PROJECTCLIPTYPE) {
+ if ((*it)->type() != ProjectClipType) {
++it;
continue;
}
if (!item || hasPendingJob(item, PROXYJOB) || item->referencedClip()->isPlaceHolder()) return;
QString path = item->referencedClip()->getProperty("proxy");
if (path.isEmpty()) {
- slotUpdateJobStatus(item, PROXYJOB, JOBCRASHED, i18n("Failed to create proxy, empty path."));
+ slotUpdateJobStatus(item, PROXYJOB, JobCrashed, i18n("Failed to create proxy, empty path."));
return;
}
if (QFileInfo(path).size() > 0) {
// Proxy already created
- setJobStatus(item, PROXYJOB, JOBDONE);
+ setJobStatus(item, PROXYJOB, JobDone);
slotGotProxy(path);
return;
}
QString sourcePath = item->clipUrl().path();
- if (item->clipType() == PLAYLIST) {
+ if (item->clipType() == Playlist) {
// Special case: playlists use the special 'consumer' producer to support resizing
sourcePath.prepend("consumer:");
}
}
m_jobList.append(job);
- setJobStatus(item, job->jobType, JOBWAITING, 0, job->statusMessage());
+ setJobStatus(item, job->jobType, JobWaiting, 0, job->statusMessage());
slotCheckJobProcess();
}
return;
}
m_jobList.append(job);
- setJobStatus(item, job->jobType, JOBWAITING, 0, job->statusMessage());
+ setJobStatus(item, job->jobType, JobWaiting, 0, job->statusMessage());
slotCheckJobProcess();
}
continue;
}
m_jobList.append(job);
- setJobStatus(item, job->jobType, JOBWAITING, 0, job->statusMessage());
+ setJobStatus(item, job->jobType, JobWaiting, 0, job->statusMessage());
++i;
}
delete d;
m_jobMutex.lock();
int count = 0;
for (int i = 0; i < m_jobList.count(); ++i) {
- if (m_jobList.at(i)->status() == JOBWORKING || m_jobList.at(i)->status() == JOBWAITING)
+ if (m_jobList.at(i)->status() == JobWorking || m_jobList.at(i)->status() == JobWaiting)
count ++;
else {
// remove finished jobs
ProjectItem *item = getItemById(id);
if (!item) return;
if (!item->isProxyRunning()) slotGotProxy(item);
- item->setConditionalJobStatus(NOJOB, PROXYJOB);
+ item->setConditionalJobStatus(NoJob, PROXYJOB);
discardJobs(id, PROXYJOB);
}
int count = 0;
m_jobMutex.lock();
for (int i = 0; i < m_jobList.count(); ++i) {
- if (m_jobList.at(i)->status() == JOBWAITING) {
+ if (m_jobList.at(i)->status() == JobWaiting) {
if (job == NULL) {
- m_jobList.at(i)->setStatus(JOBWORKING);
+ m_jobList.at(i)->setStatus(JobWorking);
job = m_jobList.at(i);
}
count++;
}
- else if (m_jobList.at(i)->status() == JOBWORKING)
+ else if (m_jobList.at(i)->status() == JobWorking)
count ++;
}
// Set jobs count
DocClipBase *currentClip = m_doc->clipManager()->getClipById(job->clipId());
//ProjectItem *processingItem = getItemById(job->clipId());
if (currentClip == NULL) {
- job->setStatus(JOBDONE);
+ job->setStatus(JobDone);
continue;
}
// Set clip status to started
if (!destination.isEmpty()) {
QFile file(destination);
if (!file.open(QIODevice::WriteOnly)) {
- emit updateJobStatus(job->clipId(), job->jobType, JOBCRASHED, i18n("Cannot write to path: %1", destination));
- job->setStatus(JOBCRASHED);
+ emit updateJobStatus(job->clipId(), job->jobType, JobCrashed, i18n("Cannot write to path: %1", destination));
+ job->setStatus(JobCrashed);
continue;
}
file.close();
connect(job, SIGNAL(gotFilterJobResults(QString,int,int,stringMap,stringMap)), this, SIGNAL(gotFilterJobResults(QString,int,int,stringMap,stringMap)));
}
job->startJob();
- if (job->status() == JOBDONE) {
- emit updateJobStatus(job->clipId(), job->jobType, JOBDONE);
+ if (job->status() == JobDone) {
+ emit updateJobStatus(job->clipId(), job->jobType, JobDone);
//TODO: replace with more generic clip replacement framework
if (job->jobType == PROXYJOB) emit gotProxy(job->clipId());
if (job->addClipToProject()) {
emit addClip(destination, QString(), QString());
}
- } else if (job->status() == JOBCRASHED || job->status() == JOBABORTED) {
+ } else if (job->status() == JobCrashed || job->status() == JobAborted) {
emit updateJobStatus(job->clipId(), job->jobType, job->status(), job->errorMessage(), QString(), job->logDetails());
}
}
command->setText(i18n("Update proxy settings"));
QString proxydir = m_doc->projectFolder().path( KUrl::AddTrailingSlash) + "proxy/";
while (*it) {
- if ((*it)->type() != PROJECTCLIPTYPE) {
+ if ((*it)->type() != ProjectClipType) {
++it;
continue;
}
++it;
continue;
}
- CLIPTYPE t = item->clipType();
- if ((t == VIDEO || t == AV || t == UNKNOWN) && item->referencedClip() != NULL) {
+ ClipType t = item->clipType();
+ if ((t == Video || t == AV || t == Unknown) && item->referencedClip() != NULL) {
if (generateProxy() && useProxy() && !hasPendingJob(item, PROXYJOB)) {
DocClipBase *clip = item->referencedClip();
if (clip->getProperty("frame_size").section('x', 0, 0).toInt() > m_doc->getDocumentProperty("proxyminsize").toInt()) {
new EditClipCommand(this, item->clipId(), item->referencedClip()->currentProperties(newProps), newProps, true, command);
}
}
- else if (t == IMAGE && item->referencedClip() != NULL) {
+ else if (t == Image && item->referencedClip() != NULL) {
if (generateImageProxy() && useProxy()) {
DocClipBase *clip = item->referencedClip();
int maxImageSize = m_doc->getDocumentProperty("proxyimageminsize").toInt();
void ProjectList::slotProcessLog(const QString &id, int progress, int type, const QString &message)
{
ProjectItem *item = getItemById(id);
- setJobStatus(item, (JOBTYPE) type, JOBWORKING, progress, message);
+ setJobStatus(item, (JOBTYPE) type, JobWorking, progress, message);
}
void ProjectList::slotProxyCurrentItem(bool doProxy, ProjectItem *itemToProxy)
QList<ProjectItem *> clipList;
for (int i = 0; i < list.count(); ++i) {
listItem = list.at(i);
- if (listItem->type() == PROJECTFOLDERTYPE) {
+ if (listItem->type() == ProjectFoldeType) {
for (int j = 0; j < listItem->childCount(); j++) {
QTreeWidgetItem *sub = listItem->child(j);
- if (sub->type() == PROJECTCLIPTYPE) {
+ if (sub->type() == ProjectClipType) {
ProjectItem *item = static_cast <ProjectItem*>(sub);
if (!clipList.contains(item)) clipList.append(item);
}
}
}
- else if (listItem->type() == PROJECTSUBCLIPTYPE) {
+ else if (listItem->type() == ProjectSubclipType) {
QTreeWidgetItem *sub = listItem->parent();
ProjectItem *item = static_cast <ProjectItem*>(sub);
if (!clipList.contains(item)) clipList.append(item);
}
- else if (listItem->type() == PROJECTCLIPTYPE) {
+ else if (listItem->type() == ProjectClipType) {
ProjectItem *item = static_cast <ProjectItem*>(listItem);
if (!clipList.contains(item)) clipList.append(item);
}
if (!doProxy) newProps.insert("proxy", "-");
for (int i = 0; i < clipList.count(); ++i) {
ProjectItem *item = clipList.at(i);
- CLIPTYPE t = item->clipType();
- if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE || t == PLAYLIST) && item->referencedClip()) {
+ ClipType t = item->clipType();
+ if ((t == Video || t == AV || t == Unknown || t == Image || t == Playlist) && item->referencedClip()) {
if ((doProxy && item->hasProxy()) || (!doProxy && !item->hasProxy() && item->referencedClip()->getProducer() != NULL)) continue;
DocClipBase *clip = item->referencedClip();
if (!clip || !clip->isClean() || m_render->isProcessing(item->clipId())) {
//oldProps = clip->properties();
if (doProxy) {
newProps.clear();
- QString path = proxydir + clip->getClipHash() + '.' + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension"));
+ QString path = proxydir + clip->getClipHash() + '.' + (t == Image ? "png" : m_doc->getDocumentProperty("proxyextension"));
// insert required duration for proxy
newProps.insert("proxy_out", clip->producerProperty("out"));
newProps.insert("proxy", path);
QTreeWidgetItemIterator it(m_listView);
ProjectItem *item;
while (*it) {
- if ((*it)->type() == PROJECTCLIPTYPE) {
+ if ((*it)->type() == ProjectClipType) {
item = static_cast <ProjectItem *>(*it);
if (item->referencedClip()->getProperty("proxy") == proxyPath) {
QMap <QString, QString> props;
QFile::remove(proxyPath);
}
-void ProjectList::setJobStatus(ProjectItem *item, JOBTYPE jobType, CLIPJOBSTATUS status, int progress, const QString &statusMessage)
+void ProjectList::setJobStatus(ProjectItem *item, JOBTYPE jobType, ClipJobStatus status, int progress, const QString &statusMessage)
{
if (item == NULL || (m_abortAllJobs && m_closing)) return;
monitorItemEditing(false);
item->setJobStatus(jobType, status, progress, statusMessage);
- if (status == JOBCRASHED) {
+ if (status == JobCrashed) {
DocClipBase *clip = item->referencedClip();
if (!clip) {
kDebug()<<"// PROXY CRASHED";
FolderProjectItem *item;
QTreeWidgetItemIterator it(m_listView);
while (*it) {
- if ((*it)->type() != PROJECTFOLDERTYPE) {
+ if ((*it)->type() != ProjectFoldeType) {
++it;
continue;
}
{
m_abortAllJobs = true;
for (int i = 0; i < m_jobList.count(); ++i) {
- m_jobList.at(i)->setStatus(JOBABORTED);
+ m_jobList.at(i)->setStatus(JobAborted);
}
m_jobThreads.waitForFinished();
m_jobThreads.clearFutures();
for (int i = 0; i < m_jobList.count(); ++i) {
if (m_abortAllJobs) break;
job = m_jobList.at(i);
- if (job->clipId() == item->clipId() && job->jobType == type && (job->status() == JOBWAITING || job->status() == JOBWORKING)) return true;
+ if (job->clipId() == item->clipId() && job->jobType == type && (job->status() == JobWaiting || job->status() == JobWorking)) return true;
}
return false;
QMutexLocker lock(&m_jobMutex);
for (int i = 0; i < m_jobList.count(); ++i) {
if (m_jobList.at(i)->clipId() == clipId) {
- m_jobList.at(i)->setStatus(JOBABORTED);
+ m_jobList.at(i)->setStatus(JobAborted);
}
}
}
void ProjectList::slotUpdateJobStatus(ProjectItem *item, int type, int status, const QString &label, const QString &actionName, const QString details)
{
- item->setJobStatus((JOBTYPE) type, (CLIPJOBSTATUS) status);
- if (status != JOBCRASHED) return;
+ item->setJobStatus((JOBTYPE) type, (ClipJobStatus) status);
+ if (status != JobCrashed) return;
#if KDE_IS_VERSION(4,7,0)
QList<QAction *> actions = m_infoMessage->actions();
if (m_infoMessage->isHidden()) {
QStringList result;
QMutexLocker lock(&m_jobMutex);
for (int i = 0; i < m_jobList.count(); ++i) {
- if (m_jobList.at(i)->clipId() == id && (m_jobList.at(i)->status() == JOBWAITING || m_jobList.at(i)->status() == JOBWORKING)) {
+ if (m_jobList.at(i)->clipId() == id && (m_jobList.at(i)->status() == JobWaiting || m_jobList.at(i)->status() == JobWorking)) {
// discard this job
result << m_jobList.at(i)->description;
}
for (int i = 0; i < m_jobList.count(); ++i) {
if (m_jobList.at(i)->clipId() == id && (m_jobList.at(i)->jobType == type || type == NOJOBTYPE)) {
// discard this job
- m_jobList.at(i)->setStatus(JOBABORTED);
+ m_jobList.at(i)->setStatus(JobAborted);
}
}
}
}
job->description = i18n("Filter %1", extraParams.value("finalfilter"));
m_jobList.append(job);
- setJobStatus(item, job->jobType, JOBWAITING, 0, job->statusMessage());
+ setJobStatus(item, job->jobType, JobWaiting, 0, job->statusMessage());
slotCheckJobProcess();
}
}
job->description = description;
m_jobList.append(job);
- setJobStatus(item, job->jobType, JOBWAITING, 0, job->statusMessage());
+ setJobStatus(item, job->jobType, JobWaiting, 0, job->statusMessage());
slotCheckJobProcess();
}
}
void ProjectList::slotPrepareJobsMenu()
{
ProjectItem *item;
- if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE)
+ if (!m_listView->currentItem() || m_listView->currentItem()->type() == ProjectFoldeType)
return;
- if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE)
+ if (m_listView->currentItem()->type() == ProjectSubclipType)
item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
else
item = static_cast <ProjectItem*>(m_listView->currentItem());