}
mlt.removeChild(tracksinfo);
}
-
+ QStringList expandedFolders;
QDomNodeList folders = m_document.elementsByTagName("folder");
for (int i = 0; i < folders.count(); i++) {
e = folders.item(i).cloneNode().toElement();
+ if (e.hasAttribute("opened")) expandedFolders.append(e.attribute("id"));
m_clipManager->addFolder(e.attribute("id"), e.attribute("name"));
}
+ m_documentProperties["expandedfolders"] = expandedFolders.join(";");
const int infomax = infoproducers.count();
QDomNodeList producers = m_document.elementsByTagName("producer");
kDebug() << "ERROR; CANNOT CREATE AUTOSAVE FILE";
}
kDebug() << "// AUTOSAVE FILE: " << m_autosave->fileName();
- saveSceneList(m_autosave->fileName(), m_render->sceneList());
+ saveSceneList(m_autosave->fileName(), m_render->sceneList(), QStringList());
}
}
return QPoint(m_documentProperties.value("zonein").toInt(), m_documentProperties.value("zoneout").toInt());
}
-bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene)
+bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene, const QStringList expandedFolders)
{
QDomDocument sceneList;
sceneList.setContent(scene, true);
QDomElement folder = sceneList.createElement("folder");
folder.setAttribute("id", f.key());
folder.setAttribute("name", f.value());
+ if (expandedFolders.contains(f.key())) folder.setAttribute("opened", "1");
addedXml.appendChild(folder);
}
}
}
+QStringList KdenliveDoc::getExpandedFolders()
+{
+ QStringList result = m_documentProperties.value("expandedfolders").split(';');
+ // this property is only needed once when opening project, so clear it now
+ m_documentProperties.remove("expandedfolders");
+ return result;
+}
+
#include "kdenlivedoc.moc"
QPoint zoom() const;
double dar() const;
double projectDuration() const;
- bool saveSceneList(const QString &path, const QString &scene);
+ bool saveSceneList(const QString &path, const QString &scene, const QStringList expandedFolders);
int tracksCount() const;
TrackInfo trackInfoAt(int ix) const;
void insertTrack(int ix, TrackInfo type);
void setTrackEffect(int trackIndex, int effectIndex, QDomElement effect);
const EffectsList getTrackEffects(int ix);
QDomElement getTrackEffect(int trackIndex, int effectIndex) const;
-
+ /** @brief Get a list of folder id's that were opened on last save. */
+ QStringList getExpandedFolders();
+
private:
KUrl m_url;
QDomDocument m_document;
QString currentSceneList;
m_monitorManager->stopActiveMonitor();
- if (m_activeDocument->saveSceneList(outputFileName, m_projectMonitor->sceneList()) == false)
+ if (m_activeDocument->saveSceneList(outputFileName, m_projectMonitor->sceneList(), m_projectList->expandedFolders()) == false)
return false;
// Save timeline thumbnails
connect(clip, SIGNAL(abortProxy(const QString)), this, SLOT(slotAbortProxy(const QString)));
if (getProperties) {
m_listView->processLayout();
- m_refreshed = false;
QDomElement e = clip->toXML().cloneNode().toElement();
e.removeAttribute("file_hash");
m_infoQueue.insert(clip->getId(), e);
void ProjectList::requestClipInfo(const QDomElement xml, const QString id)
{
- m_refreshed = false;
m_infoQueue.insert(id, xml);
//if (m_infoQueue.count() == 1 || ) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
}
m_proxyList.clear();
QMap <QString, QString> flist = doc->clipManager()->documentFolderList();
+ QStringList openedFolders = doc->getExpandedFolders();
QMapIterator<QString, QString> f(flist);
while (f.hasNext()) {
f.next();
- (void) new FolderProjectItem(m_listView, QStringList() << f.value(), f.key());
+ FolderProjectItem *folder = new FolderProjectItem(m_listView, QStringList() << f.value(), f.key());
+ folder->setExpanded(openedFolders.contains(f.key()));
}
QList <DocClipBase*> list = doc->clipManager()->documentClipList();
void ProjectList::slotCheckForEmptyQueue()
{
- if (!m_refreshed && m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
+ if (!m_refreshed && m_processingClips.isEmpty() && m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
m_refreshed = true;
emit loadingIsOver();
emit displayMessage(QString(), -1);
{
QString toReload;
ProjectItem *item = getItemById(clipId);
+ if (!m_refreshed) {
+ // we are still finishing to load the document
+ selectClip = false;
+ }
m_processingClips.removeAll(clipId);
if (m_infoQueue.isEmpty() && m_processingClips.isEmpty()) m_listView->setEnabled(true);
if (item && producer) {
else disconnect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
}
+QStringList ProjectList::expandedFolders() const
+{
+ QStringList result;
+ FolderProjectItem *item;
+ QTreeWidgetItemIterator it(m_listView);
+ while (*it) {
+ if ((*it)->type() != PROJECTFOLDERTYPE) {
+ ++it;
+ continue;
+ }
+ if ((*it)->isExpanded()) {
+ item = static_cast<FolderProjectItem *>(*it);
+ result.append(item->clipId());
+ }
+ ++it;
+ }
+ return result;
+}
+
#include "projectlist.moc"
bool generateProxy() const;
/** @brief Should we automatically create proxy clips for newly added clips. */
bool generateImageProxy() const;
+ /** @brief Returns a list of the expanded folder ids. */
+ QStringList expandedFolders() const;
public slots:
void setDocument(KdenliveDoc *doc);
QMenu *m_transcodeAction;
KdenliveDoc *m_doc;
ItemDelegate *m_listViewDelegate;
+ /** @brief True if we have not yet finished opening the document. */
bool m_refreshed;
QToolButton *m_addButton;
QToolButton *m_deleteButton;