KUrl url = KUrl(xml.attribute("resource"));
if (!m_properties.contains("file_hash") && !url.isEmpty()) getFileHash(url.path());
- int out = xml.attribute("out").toInt();
- if (out != 0) {
- setDuration(GenTime(out, KdenliveSettings::project_fps()));
+
+ if (xml.hasAttribute("duration")) {
+ setDuration(GenTime(xml.attribute("duration").toInt(), KdenliveSettings::project_fps()));
} else {
- out = xml.attribute("duration").toInt();
- if (out != 0) setDuration(GenTime(out, KdenliveSettings::project_fps()));
+ int out = xml.attribute("out").toInt();
+ int in = xml.attribute("in").toInt();
+ setDuration(GenTime(out - in, KdenliveSettings::project_fps()));
}
+
if (!m_properties.contains("name")) m_properties.insert("name", url.fileName());
//if (!url.isEmpty() && QFile::exists(url.path()))
}
m_startPos = infoXml.attribute("position").toInt();
m_zoom = infoXml.attribute("zoom", "7").toInt();
-
-
-
-
m_zoneEnd = infoXml.attribute("zoneout", "100").toInt();
setProfilePath(profilePath);
westley.removeChild(tracksinfo);
}
- QDomElement orig;
QDomNodeList producers = m_document.elementsByTagName("producer");
QDomNodeList infoproducers = m_document.elementsByTagName("kdenlive_producer");
const int max = producers.count();
if (!e.isNull() && prodId != "black" && !prodId.startsWith("slowmotion") && !m_abortLoading) {
e.setTagName("producer");
// Get MLT's original producer properties
-
+ QDomElement orig;
for (int j = 0; j < max; j++) {
QDomElement o = producers.item(j).cloneNode().toElement();
QString origId = o.attribute("id").section('_', 0, 0);
const QString producerId = clipId.section('_', 0, 0);
DocClipBase *clip = m_clipManager->getClipById(producerId);
if (clip == NULL) {
- /*kDebug()<<"// CLIP "<<clipId<<" NOT OFUND in LIST, CREATING";
- QDomDocument doc;
- doc.appendChild(doc.importNode(elem, true));
- kDebug() << "IMPORTED CLIP: \n" << doc.toString()<<"\n";*/
elem.setAttribute("id", producerId);
QString path = elem.attribute("resource");
QString extension;
extension = KUrl(path).fileName();
path = KUrl(path).directory();
}
- if (!QFile::exists(path) && elem.attribute("type").toInt() == TEXT) {
+ if (elem.attribute("type").toInt() == TEXT && !QFile::exists(path)) {
kDebug() << "// TITLE: " << elem.attribute("titlename") << " Preview file: " << elem.attribute("resource") << " DOES NOT EXIST";
QString titlename = elem.attribute("titlename");
QString titleresource;
clip = new DocClipBase(m_clipManager, elem, producerId);
m_clipManager->addClip(clip);
}
+
if (createClipItem) {
emit addProjectClip(clip);
qApp->processEvents();
m = m.nextSibling();
}
if (!meta.isEmpty()) {
- clip = m_clipManager->getClipById(clipId);
+ if (clip == NULL) clip = m_clipManager->getClipById(clipId);
if (clip) clip->setMetadata(meta);
}
}
setText(1, name);
setText(2, m_clip->description());
if ((m_clip->clipType() == AV || m_clip->clipType() == AUDIO) && KdenliveSettings::audiothumbnails()) m_clip->askForAudioThumbs();
+ GenTime duration = m_clip->duration();
+ if (duration != GenTime()) setData(1, DurationRole, Timecode::getEasyTimecode(duration, KdenliveSettings::project_fps()));
//setFlags(Qt::NoItemFlags);
//kDebug() << "Constructed with clipId: " << m_clipId;
}
setText(1, name);
setText(2, m_clip->description());
if ((m_clip->clipType() == AV || m_clip->clipType() == AUDIO) && KdenliveSettings::audiothumbnails()) m_clip->askForAudioThumbs();
+ GenTime duration = m_clip->duration();
+ if (duration != GenTime()) setData(1, DurationRole, Timecode::getEasyTimecode(duration, KdenliveSettings::project_fps()));
//setFlags(Qt::NoItemFlags);
//kDebug() << "Constructed with clipId: " << m_clipId;
}
if (m_clip == NULL) return;
//setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
if (attributes.contains("duration")) {
- //if (m_clipType == AUDIO || m_clipType == VIDEO || m_clipType == AV)
- //m_clip->setProperty("duration", attributes["duration"]);
- GenTime duration = GenTime(attributes["duration"].toInt(), KdenliveSettings::project_fps());
+ GenTime duration = GenTime(attributes.value("duration").toInt(), KdenliveSettings::project_fps());
setData(1, DurationRole, Timecode::getEasyTimecode(duration, KdenliveSettings::project_fps()));
m_clip->setDuration(duration);
//kDebug() << "//// LOADED CLIP, DURATIONĂ‚Â SET TO: " << duration.frames(KdenliveSettings::project_fps());
//extend attributes -reh
if (m_clipType == UNKNOWN) {
- if (attributes.contains("type")) {
- if (attributes["type"] == "audio")
- m_clipType = AUDIO;
- else if (attributes["type"] == "video")
- m_clipType = VIDEO;
- else if (attributes["type"] == "av")
- m_clipType = AV;
- else if (attributes["type"] == "playlist")
- m_clipType = PLAYLIST;
- } else {
- m_clipType = AV;
- }
+ QString cliptype = attributes.value("type");
+ if (cliptype == "audio") m_clipType = AUDIO;
+ else if (cliptype == "video") m_clipType = VIDEO;
+ else if (cliptype == "av") m_clipType = AV;
+ else if (cliptype == "playlist") m_clipType = PLAYLIST;
+ else m_clipType = AV;
+
m_clip->setClipType(m_clipType);
slotSetToolTip();
}
if (m_clip->description().isEmpty()) {
if (metadata.contains("description")) {
- m_clip->setProperty("description", metadata["description"]);
+ m_clip->setProperty("description", metadata.value("description"));
setText(2, m_clip->description());
} else if (metadata.contains("comment")) {
- m_clip->setProperty("description", metadata["comment"]);
+ m_clip->setProperty("description", metadata.value("comment"));
setText(2, m_clip->description());
}
}
void ProjectList::slotDeleteClip(const QString &clipId) {
ProjectItem *item = getItemById(clipId);
if (!item) {
- kDebug()<<"/// Cannot find clip to delete";
- return;
+ kDebug() << "/// Cannot find clip to delete";
+ return;
}
delete item;
}
item->setIcon(0, QPixmap(cachedPixmap));
listView->blockSignals(false);
} else requestClipThumbnail(item->clipId());
- listView->blockSignals(true);
- item->changeDuration(item->referencedClip()->producer()->get_playtime());
- listView->blockSignals(false);
+
+ if (item->data(1, DurationRole).toString().isEmpty()) {
+ listView->blockSignals(true);
+ item->changeDuration(item->referencedClip()->producer()->get_playtime());
+ listView->blockSignals(false);
+ }
}
listView->blockSignals(true);
item->setData(1, UsageRole, QString::number(item->numReferences()));
}
m_doc->clipManager()->slotAddColorClipFile(dia_ui->clip_name->text(), color, dia_ui->clip_duration->text(), group, groupId);
- m_doc->setModified(true);
+ m_doc->setModified(true);
}
delete dia_ui;
delete dia;
groupId = item->clipId();
}
- m_doc->clipManager()->slotAddSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), dia->fade(), dia->lumaDuration(), dia->lumaFile(), dia->softness(), group, groupId);
- m_doc->setModified(true);
+ m_doc->clipManager()->slotAddSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), dia->fade(), dia->lumaDuration(), dia->lumaFile(), dia->softness(), group, groupId);
+ m_doc->setModified(true);
}
delete dia;
}
}
void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bool replaceProducer) {
- int height = 50;
- int width = (int)(height * m_mltProfile->dar());
- QMap < QString, QString > filePropertyMap;
- QMap < QString, QString > metadataPropertyMap;
-
KUrl url = KUrl(xml.attribute("resource", QString()));
Mlt::Producer *producer = NULL;
if (xml.attribute("type").toInt() == TEXT && !QFile::exists(url.path())) {
- emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
+ emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer);
return;
}
if (xml.attribute("type").toInt() == COLOR) {
producer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp);
delete[] tmp;
} else {
- QString urlpath = url.path();
- /*if (urlpath.contains(':')) {
- if (!urlpath.startsWith("file:")) urlpath.prepend("file:");
- char *tmp = decodedString(urlpath);
- producer = new Mlt::Producer(*m_mltProfile, "avformat", tmp);
- delete[] tmp;
- }
- else {*/
- char *tmp = decodedString(urlpath);
+ char *tmp = decodedString(url.path());
producer = new Mlt::Producer(*m_mltProfile, tmp);
delete[] tmp;
-
- if (xml.hasAttribute("force_aspect_ratio")) {
- double aspect = xml.attribute("force_aspect_ratio").toDouble();
- if (aspect > 0) producer->set("force_aspect_ratio", aspect);
- }
- if (xml.hasAttribute("threads")) {
- int threads = xml.attribute("threads").toInt();
- if (threads != 1) producer->set("threads", threads);
- }
- if (xml.hasAttribute("video_index")) {
- int vindex = xml.attribute("video_index").toInt();
- if (vindex != 0) producer->set("video_index", vindex);
- }
- if (xml.hasAttribute("audio_index")) {
- int aindex = xml.attribute("audio_index").toInt();
- if (aindex != 0) producer->set("audio_index", aindex);
- }
- //}
}
if (producer == NULL || producer->is_blank() || !producer->is_valid()) {
return;
}
+ if (xml.hasAttribute("force_aspect_ratio")) {
+ double aspect = xml.attribute("force_aspect_ratio").toDouble();
+ if (aspect > 0) producer->set("force_aspect_ratio", aspect);
+ }
+ if (xml.hasAttribute("threads")) {
+ int threads = xml.attribute("threads").toInt();
+ if (threads != 1) producer->set("threads", threads);
+ }
+ if (xml.hasAttribute("video_index")) {
+ int vindex = xml.attribute("video_index").toInt();
+ if (vindex != 0) producer->set("video_index", vindex);
+ }
+ if (xml.hasAttribute("audio_index")) {
+ int aindex = xml.attribute("audio_index").toInt();
+ if (aindex != 0) producer->set("audio_index", aindex);
+ }
+
if (xml.hasAttribute("out")) producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt());
char *tmp = decodedString(clipId);
producer->set("id", tmp);
delete[] tmp;
+
+ int height = 50;
+ int width = (int)(height * m_mltProfile->dar());
+ QMap < QString, QString > filePropertyMap;
+ QMap < QString, QString > metadataPropertyMap;
+
int frameNumber = xml.attribute("thumbnail", "0").toInt();
if (frameNumber != 0) producer->seek(frameNumber);
QString id = nprod->get("id");
if (id.startsWith("slowmotion:")) {
// this is a slowmotion producer, add it to the list
- QString url = QString::fromUtf8(nprod->get("resource"));
+ QString url = QString::fromUtf8(nprod->get("resource"));
if (!m_slowmotionProducers.contains(url)) {
m_slowmotionProducers.insert(url, nprod);
}
// can also override profiles installed by KNewStuff
fileList.removeAll("customprofiles.xml");
foreach(const QString &filename, fileList)
- parseFile(exportFolder + '/' + filename, true);
+ parseFile(exportFolder + '/' + filename, true);
if (QFile::exists(exportFolder + "/customprofiles.xml")) parseFile(exportFolder + "/customprofiles.xml", true);
if (!meta.isEmpty()) {
QStringList filters;
QString filter = m_view.image_type->itemData(m_view.image_type->currentIndex()).toString();
filters << "*." + filter;
- // TODO: improve jpeg image detection with extension like jpeg, requires change in MLT image producers
- // << "*.jpeg";
+ // TODO: improve jpeg image detection with extension like jpeg, requires change in MLT image producers
+ // << "*.jpeg";
dir.setNameFilters(filters);
const QStringList result = dir.entryList(QDir::Files);
enum Formats { HH_MM_SS_FF, HH_MM_SS_HH, Frames, Seconds };
explicit Timecode(Formats format = HH_MM_SS_FF, int framesPerSecond =
- 25, bool dropFrame = false);
+ 25, bool dropFrame = false);
/** Set the current timecode format; this is the output format for this timecode. */
void setFormat(int framesPerSecond, bool dropFrame = false, Formats format = HH_MM_SS_FF) {