cleanup & fix crash on project saving with Qt 4.5:

http://www.kdenlive.org:80/mantis/view.php?id=687

svn path=/branches/KDE4/; revision=3086
parent d1274597
......@@ -2402,13 +2402,12 @@ void CustomTrackView::doChangeClipSpeed(ItemInfo info, const double speed, const
info.track = m_document->tracksCount() - item->track();
int endPos = m_document->renderer()->mltChangeClipSpeed(info, speed, oldspeed, baseclip->producer());
if (endPos >= 0) {
item->setSpeed(speed);
item->updateRectGeometry();
if (item->cropDuration().frames(m_document->fps()) > endPos)
item->AbstractClipItem::resizeEnd(info.startPos.frames(m_document->fps()) + endPos, speed);
m_document->setModified(true);
}
else emit displayMessage(i18n("Invalid clip"), ErrorMessage);
item->setSpeed(speed);
item->updateRectGeometry();
if (item->cropDuration().frames(m_document->fps()) > endPos)
item->AbstractClipItem::resizeEnd(info.startPos.frames(m_document->fps()) + endPos, speed);
m_document->setModified(true);
} else emit displayMessage(i18n("Invalid clip"), ErrorMessage);
}
void CustomTrackView::cutSelectedClips() {
......
......@@ -194,7 +194,6 @@ bool DocClipBase::hasFileSize() const {
// virtual
QDomElement DocClipBase::toXML() const {
QDomDocument doc;
QDomElement clip = doc.createElement("producer");
QMapIterator<QString, QString> i(m_properties);
......@@ -202,9 +201,9 @@ QDomElement DocClipBase::toXML() const {
i.next();
if (!i.value().isEmpty()) clip.setAttribute(i.key(), i.value());
}
//doc.appendChild(clip);
doc.appendChild(clip);
//kDebug()<<"/// CLIP XML: "<<doc.toString();
return clip;
return doc.documentElement();
}
DocClipBase *DocClipBase::
......
......@@ -354,14 +354,14 @@ void KdenliveDoc::slotAutoSave() {
kDebug() << "ERROR; CANNOT CREATE AUTOSAVE FILE";
}
kDebug() << "// AUTOSAVE FILE: " << m_autosave->fileName();
QDomDocument doc;
QString doc;
if (KdenliveSettings::dropbframes()) {
KdenliveSettings::setDropbframes(false);
m_clipManager->updatePreviewSettings();
doc.setContent(m_render->sceneList());
doc = m_render->sceneList();
KdenliveSettings::setDropbframes(true);
m_clipManager->updatePreviewSettings();
} else doc.setContent(m_render->sceneList());
} else doc = m_render->sceneList();
saveSceneList(m_autosave->fileName(), doc);
}
}
......@@ -917,10 +917,13 @@ QPoint KdenliveDoc::zone() const {
return QPoint(m_zoneStart, m_zoneEnd);
}
bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene) {
QDomDocument sceneList;
sceneList.setContent(scene, true);
QDomNode wes = sceneList.elementsByTagName("westley").at(0);
QDomElement addedXml = sceneList.createElement("kdenlivedoc");
wes.appendChild(addedXml);
QDomElement markers = sceneList.createElement("markers");
addedXml.setAttribute("version", "0.82");
addedXml.setAttribute("profile", profilePath());
......@@ -973,7 +976,6 @@ bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
addedXml.appendChild(markers);
if (!m_guidesXml.isNull()) addedXml.appendChild(sceneList.importNode(m_guidesXml, true));
wes.appendChild(addedXml);
//wes.appendChild(doc.importNode(kdenliveData, true));
QFile file(path);
......@@ -982,6 +984,7 @@ bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
KMessageBox::error(kapp->activeWindow(), i18n("Cannot write to file %1", path));
return false;
}
QTextStream out(&file);
out << sceneList.toString();
file.close();
......@@ -1035,7 +1038,7 @@ void KdenliveDoc::moveProjectData(KUrl url) {
}
}
QString KdenliveDoc::profilePath() const {
const QString &KdenliveDoc::profilePath() const {
return m_profile.path;
}
......@@ -1244,7 +1247,7 @@ bool KdenliveDoc::isModified() const {
return m_modified;
}
QString KdenliveDoc::description() const {
const QString KdenliveDoc::description() const {
if (m_url.isEmpty())
return i18n("Untitled") + " / " + m_profile.description;
else
......
......@@ -80,9 +80,9 @@ Q_OBJECT public:
void deleteProjectClip(QList <QString> ids);
/** Inform application of the audio thumbnails generation progress */
void setThumbsProgress(const QString &message, int progress);
QString profilePath() const;
const QString &profilePath() const;
MltVideoProfile mltProfile() const;
QString description() const;
const QString description() const;
void setUrl(KUrl url);
void setProfilePath(QString path);
const QString &getFreeClipId();
......@@ -97,7 +97,7 @@ Q_OBJECT public:
int zoom() const;
const double dar();
double projectDuration() const;
bool saveSceneList(const QString &path, QDomDocument sceneList);
bool saveSceneList(const QString &path, const QString &scene);
int tracksCount() const;
TrackInfo trackInfoAt(int ix) const;
void insertTrack(int ix, TrackInfo type);
......
......@@ -1181,7 +1181,7 @@ void MainWindow::closeCurrentDocument() {
}
bool MainWindow::saveFileAs(const QString &outputFileName) {
QDomDocument currentSceneList;
QString currentSceneList;
if (KdenliveSettings::dropbframes()) {
KdenliveSettings::setDropbframes(false);
m_activeDocument->clipManager()->updatePreviewSettings();
......
......@@ -654,11 +654,9 @@ void Monitor::saveSceneList(QString path, QDomElement info) {
render->saveSceneList(path, info);
}
QDomDocument Monitor::sceneList() {
if (render == NULL) return QDomDocument();
QDomDocument doc;
doc.setContent(render->sceneList());
return doc;
const QString Monitor::sceneList() {
if (render == NULL) return QString();
return render->sceneList();
}
......
......@@ -71,7 +71,7 @@ public:
bool isActive() const;
void pause();
void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL);
QDomDocument sceneList();
const QString sceneList();
DocClipBase *activeClip();
GenTime position();
void checkOverlay();
......
......@@ -846,7 +846,7 @@ void Render::setSceneList(QString playlist, int position) {
}
/** Create the producer from the Westley QDomDocument */
QString Render::sceneList() {
const QString Render::sceneList() {
QString playlist;
Mlt::Consumer westleyConsumer(*m_mltProfile , "westley:kdenlive_playlist");
m_mltProducer->optimise();
......@@ -1649,13 +1649,13 @@ int Render::mltChangeClipSpeed(ItemInfo info, double speed, double oldspeed, Mlt
Mlt::Producer clip(trackPlaylist.get_clip(clipIndex));
if (!clip.is_valid() || clip.is_blank()) {
// invalid clip
return -1;
// invalid clip
return -1;
}
Mlt::Producer clipparent = clip.parent();
if (!clipparent.is_valid() || clipparent.is_blank()) {
// invalid clip
return -1;
// invalid clip
return -1;
}
QString serv = clipparent.get("mlt_service");
QString id = clipparent.get("id");
......
......@@ -91,7 +91,7 @@ Q_OBJECT public:
void setSceneList(QDomDocument list, int position = 0);
void setSceneList(QString playlist, int position = 0);
void setProducer(Mlt::Producer *producer, int position);
QString sceneList();
const QString sceneList();
void saveSceneList(QString path, QDomElement kdenliveData = QDomElement());
/** Wraps the VEML command of the same name. Tells the renderer to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment