svn path=/branches/KDE4/; revision=2199
: AbstractClipItem(info, QRectF()), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), m_effectsCounter(1), audioThumbWasDrawn(false), m_opacity(1.0), m_timeLine(0), m_thumbsRequested(0), m_hover(false) {
QRectF rect((double) info.startPos.frames(fps) * scale, (double)(info.track * KdenliveSettings::trackheight() + 1), (double)(info.endPos - info.startPos).frames(fps) * scale, (double)(KdenliveSettings::trackheight() - 1));
setRect(rect);
: AbstractClipItem(info, QRectF()), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), m_effectsCounter(1), audioThumbWasDrawn(false), m_opacity(1.0), m_timeLine(0), m_thumbsRequested(0), m_hover(false) {
QRectF rect((double) info.startPos.frames(fps) * scale, (double)(info.track * KdenliveSettings::trackheight() + 1), (double)(info.endPos - info.startPos).frames(fps) * scale, (double)(KdenliveSettings::trackheight() - 1));
setRect(rect);
- kDebug() << "///// NEW CLIP RECT: " << rect;
+ //kDebug() << "///// NEW CLIP RECT: " << rect;
m_fps = fps;
m_clipName = clip->name();
m_producer = clip->getId();
m_fps = fps;
m_clipName = clip->name();
m_producer = clip->getId();
#include "addfoldercommand.h"
#include "editfoldercommand.h"
#include "titlewidget.h"
#include "addfoldercommand.h"
#include "editfoldercommand.h"
#include "titlewidget.h"
-KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, QWidget *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_commandStack(new KUndoStack(undoGroup)), m_modified(false) {
+KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, MainWindow *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_commandStack(new KUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0) {
m_clipManager = new ClipManager(this);
if (!url.isEmpty()) {
QString tmpFile;
m_clipManager = new ClipManager(this);
if (!url.isEmpty()) {
QString tmpFile;
if (!profilePath.isEmpty()) setProfilePath(profilePath);
double version = infoXml.attribute("version").toDouble();
if (version < 0.7) convertDocument(version);
if (!profilePath.isEmpty()) setProfilePath(profilePath);
double version = infoXml.attribute("version").toDouble();
if (version < 0.7) convertDocument(version);
- QDomNodeList producers = m_document.elementsByTagName("producer"); //infoXmlNode.childNodes();
+ QDomNodeList producers = m_document.elementsByTagName("producer");
- for (int i = 0; i < producers.count(); i++) {
+ const int max = producers.count();
+ if (max > 0) {
+ m_documentLoadingStep = 100.0 / (max + m_document.elementsByTagName("entry").count());
+ parent->slotGotProgressInfo(i18n("Loading project clips"), (int) m_documentLoadingProgress);
+ }
+
+ for (int i = 0; i < max; i++) {
e = producers.item(i).cloneNode().toElement();
e = producers.item(i).cloneNode().toElement();
+ if (m_documentLoadingStep > 0) {
+ m_documentLoadingProgress += m_documentLoadingStep;
+ parent->slotGotProgressInfo(QString(), (int) m_documentLoadingProgress);
+ qApp->processEvents();
+ }
if (!e.isNull() && e.attribute("id") != "black") {
if (!e.isNull() && e.attribute("id") != "black") {
- //e.setTagName("producer");
addClip(e, e.attribute("id").toInt());
}
}
addClip(e, e.attribute("id").toInt());
}
}
westley0.removeChild(westley);
kDebug() << "///////////////// CONVERTED DOC:";
westley0.removeChild(westley);
kDebug() << "///////////////// CONVERTED DOC:";
- kDebug() << m_document.toString();
- kDebug() << "///////////////// END CONVERTED DOC:";
+ //kDebug() << m_document.toString();
+ //kDebug() << "///////////////// END CONVERTED DOC:";
}
QDomElement KdenliveDoc::documentInfoXml() {
}
QDomElement KdenliveDoc::documentInfoXml() {
else m_timecode.setFormat((int) m_fps);
}
else m_timecode.setFormat((int) m_fps);
}
-void KdenliveDoc::setThumbsProgress(KUrl url, int progress) {
- emit thumbsProgress(url, progress);
+void KdenliveDoc::setThumbsProgress(const QString &message, int progress) {
+ emit progressInfo(message, progress);
+}
+
+void KdenliveDoc::loadingProgressed() {
+ m_documentLoadingProgress += m_documentLoadingStep;
+ emit progressInfo(QString(), (int) m_documentLoadingProgress);
}
KUndoStack *KdenliveDoc::commandStack() {
}
KUndoStack *KdenliveDoc::commandStack() {
class Render;
class ClipManager;
class DocClipBase;
class Render;
class ClipManager;
class DocClipBase;
class KdenliveDoc: public QObject {
Q_OBJECT public:
class KdenliveDoc: public QObject {
Q_OBJECT public:
- KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, QWidget *parent = 0);
+ KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, MainWindow *parent = 0);
~KdenliveDoc();
QDomNodeList producersList();
double fps() const;
~KdenliveDoc();
QDomNodeList producersList();
double fps() const;
void deleteProjectClip(QList <int> ids);
void deleteProjectFolder(QMap <QString, int> map);
/** Inform application of the audio thumbnails generation progress */
void deleteProjectClip(QList <int> ids);
void deleteProjectFolder(QMap <QString, int> map);
/** Inform application of the audio thumbnails generation progress */
- void setThumbsProgress(KUrl url, int progress);
+ void setThumbsProgress(const QString &message, int progress);
QString profilePath() const;
QString description() const;
/** Returns the document format: PAL or NTSC */
QString profilePath() const;
QString description() const;
/** Returns the document format: PAL or NTSC */
bool isModified() const;
/** Returns project folder, used to store project files (titles, effects,...) */
KUrl projectFolder() const;
bool isModified() const;
/** Returns project folder, used to store project files (titles, effects,...) */
KUrl projectFolder() const;
+ /** Used to inform main app of the current document loading progress */
+ void loadingProgressed();
private:
KUrl m_url;
QDomDocument m_document;
private:
KUrl m_url;
QDomDocument m_document;
bool m_modified;
/** Project folder, used to store project files (titles, effects,...) */
KUrl m_projectFolder;
bool m_modified;
/** Project folder, used to store project files (titles, effects,...) */
KUrl m_projectFolder;
+ double m_documentLoadingStep;
+ double m_documentLoadingProgress;
void convertDocument(double version);
public slots:
void convertDocument(double version);
public slots:
void signalDeleteProjectClip(int);
void updateClipDisplay(int);
void deletTimelineClip(int);
void signalDeleteProjectClip(int);
void updateClipDisplay(int);
void deletTimelineClip(int);
- void thumbsProgress(KUrl, int);
+ void progressInfo(const QString &, int);
/** emited when the document state has been modified (= needs saving or not) */
void docModified(bool);
void refreshClipThumbnail(int);
/** emited when the document state has been modified (= needs saving or not) */
void docModified(bool);
void refreshClipThumbnail(int);
videotrack = (e.attribute("hide") != "video");
trackduration = slotAddProjectTrack(pos, p, videotrack);
pos--;
videotrack = (e.attribute("hide") != "video");
trackduration = slotAddProjectTrack(pos, p, videotrack);
pos--;
- kDebug() << " PRO DUR: " << trackduration << ", TRACK DUR: " << duration;
+ //kDebug() << " PRO DUR: " << trackduration << ", TRACK DUR: " << duration;
if (trackduration > duration) duration = trackduration;
} else {
// background black track
if (trackduration > duration) duration = trackduration;
} else {
// background black track
- int black_clips = e.childNodes().count();
+ for (int j = 0; j < m_projectTracks; j++) {
+ p = playlists.item(j).toElement();
+ if (p.attribute("id") == playlist_name) break;
+ }
+ int black_clips = p.childNodes().count();
for (int i = 0; i < black_clips; i++)
m_doc->loadingProgressed();
qApp->processEvents();
for (int i = 0; i < black_clips; i++)
m_doc->loadingProgressed();
qApp->processEvents();
// parse transitions
QDomNodeList transitions = doc.elementsByTagName("transition");
int projectTransitions = transitions.count();
// parse transitions
QDomNodeList transitions = doc.elementsByTagName("transition");
int projectTransitions = transitions.count();
- kDebug() << "//////////// TIMELINE FOUND: " << projectTransitions << " transitions";
+ //kDebug() << "//////////// TIMELINE FOUND: " << projectTransitions << " transitions";
for (int i = 0; i < projectTransitions; i++) {
e = transitions.item(i).toElement();
QDomNodeList transitionparams = e.childNodes();
for (int i = 0; i < projectTransitions; i++) {
e = transitions.item(i).toElement();
QDomNodeList transitionparams = e.childNodes();
// do not add audio mixing transitions
if (p.attribute("name") == "internal_added" && p.text() == "237") {
transitionAdd = false;
// do not add audio mixing transitions
if (p.attribute("name") == "internal_added" && p.text() == "237") {
transitionAdd = false;
- kDebug() << "// TRANSITRION " << i << " IS NOT VALID (INTERN ADDED)";
+ //kDebug() << "// TRANSITRION " << i << " IS NOT VALID (INTERN ADDED)";
break;
} else if (p.attribute("name") == "a_track") a_track = p.text().toInt();
else if (p.attribute("name") == "b_track") b_track = m_projectTracks - 1 - p.text().toInt();
break;
} else if (p.attribute("name") == "a_track") a_track = p.text().toInt();
else if (p.attribute("name") == "b_track") b_track = m_projectTracks - 1 - p.text().toInt();
transitionInfo.startPos = GenTime(e.attribute("in").toInt(), m_doc->fps());
transitionInfo.endPos = GenTime(e.attribute("out").toInt(), m_doc->fps());
transitionInfo.track = b_track;
transitionInfo.startPos = GenTime(e.attribute("in").toInt(), m_doc->fps());
transitionInfo.endPos = GenTime(e.attribute("out").toInt(), m_doc->fps());
transitionInfo.track = b_track;
- kDebug() << "/////////////// +++++++++++ ADDING TRANSITION ON TRACK: " << b_track << ", TOTAL TRKA: " << m_projectTracks;
+ //kDebug() << "/////////////// +++++++++++ ADDING TRANSITION ON TRACK: " << b_track << ", TOTAL TRKA: " << m_projectTracks;
Transition *tr = new Transition(transitionInfo, a_track, m_scale, m_doc->fps(), QDomElement());
m_scene->addItem(tr);
}
Transition *tr = new Transition(transitionInfo, a_track, m_scale, m_doc->fps(), QDomElement());
m_scene->addItem(tr);
}
ItemInfo clipinfo;
clipinfo.startPos = GenTime(position, m_doc->fps());
ItemInfo clipinfo;
clipinfo.startPos = GenTime(position, m_doc->fps());
- clipinfo.endPos = clipinfo.startPos + GenTime(out, m_doc->fps());
+ clipinfo.endPos = clipinfo.startPos + GenTime(out - in, m_doc->fps());
- kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
+ //kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
ClipItem *item = new ClipItem(clip, clipinfo, m_scale, m_doc->fps());
m_scene->addItem(item);
ClipItem *item = new ClipItem(clip, clipinfo, m_scale, m_doc->fps());
m_scene->addItem(item);
+ position += (out - in);
// parse clip effects
for (QDomNode n2 = elem.firstChild(); !n2.isNull(); n2 = n2.nextSibling()) {
// parse clip effects
for (QDomNode n2 = elem.firstChild(); !n2.isNull(); n2 = n2.nextSibling()) {