Commit 9d945cc6 authored by Jason Wood's avatar Jason Wood

Quick hack to prevent Kdenlive from firing a huge number of unnecessary...

Quick hack to prevent Kdenlive from firing a huge number of unnecessary scenelists at the renderer. It's a hack because we tell the KdenliveDoc to not render during a movement is in progress, whilst really what we want is to separate the movement command completely from the document so that it is applied as a single atomic command.

svn path=/trunk/kdenlive/; revision=314
parent bda06584
......@@ -47,7 +47,8 @@ QPtrList<KdenliveView> *KdenliveDoc::pViewList = 0L;
KdenliveDoc::KdenliveDoc(KdenliveApp *app, QWidget *parent, const char *name) :
QObject(parent, name),
m_projectClip(new DocClipProject(this)),
m_modified(false)
m_modified(false),
m_sceneListGeneration(true)
{
if(!pViewList)
{
......@@ -544,15 +545,17 @@ void KdenliveDoc::loadFromXML(QDomDocument &doc)
/** Called when the document is modifed in some way. */
void KdenliveDoc::hasBeenModified()
{
kdDebug() << "Document has changed" << endl;
if(m_projectClip) {
m_projectClip->setTrackEnd(m_projectClip->duration());
} else {
kdWarning() << "m_projectClip is Null!" << endl;
if(m_sceneListGeneration) {
kdDebug() << "Document has changed" << endl;
if(m_projectClip) {
m_projectClip->setTrackEnd(m_projectClip->duration());
} else {
kdWarning() << "m_projectClip is Null!" << endl;
}
generateSceneList();
emit documentChanged();
emit documentChanged(m_projectClip);
}
generateSceneList();
emit documentChanged();
emit documentChanged(m_projectClip);
setModified(true);
}
......@@ -640,4 +643,13 @@ DocClipBase *KdenliveDoc::selectedClip()
}
return pResult;
};
void KdenliveDoc::activeSceneListGeneration(bool active)
{
m_sceneListGeneration = active;
if(active)
{
hasBeenModified();
}
}
......@@ -109,6 +109,10 @@ class KdenliveDoc : public QObject
* This function is intended for times when you need a "master" clip. but have no preferred
* choice. */
DocClipBase *selectedClip();
// HACK HACK - we need a way to prevent the document from spewing hundreds of scenelist
// generation requests - this is it.
void activeSceneListGeneration(bool active);
public slots:
/** calls repaint() on all views connected to the document object and is called by the view
* by which the document has been changed. As this view normally repaints itself, it is
......@@ -205,6 +209,8 @@ public:
KdenliveApp * m_app;
/** This is the scenelist that get's passed from the clip to a renderer. */
QDomDocument m_domSceneList;
/** HACK HACK - generate scenelist if true, don't if false) */
bool m_sceneListGeneration;
private: // Private methods
/** Parses the XML Dom Document elements to populate the KdenliveDoc. */
void loadFromXML(QDomDocument &doc);
......
......@@ -110,6 +110,7 @@ KMMTimeLine::KMMTimeLine(KdenliveApp *app, QWidget *rulerToolWidget, QWidget *sc
m_startedClipMove = false;
m_masterClip = 0;
m_moveClipsCommand = 0;
m_document->activeSceneListGeneration(true);
m_deleteClipsCommand = 0;
m_addingClips = false;
......@@ -303,6 +304,7 @@ void KMMTimeLine::dragLeaveEvent ( QDragLeaveEvent *event )
// In a drag Leave Event, any clips in the selection are removed from the timeline.
delete m_moveClipsCommand;
m_moveClipsCommand = 0;
m_document->activeSceneListGeneration(true);
}
if(m_deleteClipsCommand) {
......@@ -344,6 +346,7 @@ void KMMTimeLine::dropEvent ( QDropEvent *event )
m_moveClipsCommand->setEndLocation(m_masterClip);
m_app->addCommand(m_moveClipsCommand, false);
m_moveClipsCommand = 0; // KdenliveApp is now managing this command, we do not need to delete it.
m_document->activeSceneListGeneration(true);
}
m_scrollTimer.stop();
......@@ -514,6 +517,7 @@ void KMMTimeLine::initiateDrag(DocClipBase *clipUnderMouse, GenTime mouseTime)
m_clipOffset = mouseTime - clipUnderMouse->trackStart();
m_moveClipsCommand = new Command::KMoveClipsCommand(this, m_document, m_masterClip);
m_document->activeSceneListGeneration(false);
m_deleteClipsCommand = createAddClipsCommand(false);
setupSnapToGrid();
......
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