Cleanup tracks handling

svn path=/branches/KDE4/; revision=2764
parent 0820132b
...@@ -77,7 +77,7 @@ double CustomTrackScene::scale() const { ...@@ -77,7 +77,7 @@ double CustomTrackScene::scale() const {
} }
int CustomTrackScene::tracksCount() const { int CustomTrackScene::tracksCount() const {
return m_tracksList.count(); return m_document->tracksCount();
} }
#include "customtrackscene.moc" #include "customtrackscene.moc"
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "gentime.h" #include "gentime.h"
class KdenliveDoc; class KdenliveDoc;
class TrackInfo;
/** This class holds all properties that need to be used by clip items */ /** This class holds all properties that need to be used by clip items */
...@@ -44,7 +43,6 @@ public: ...@@ -44,7 +43,6 @@ public:
double getSnapPointForPos(double pos, bool doSnap = true); double getSnapPointForPos(double pos, bool doSnap = true);
void setScale(double scale); void setScale(double scale);
double scale() const; double scale() const;
QList <TrackInfo> m_tracksList;
int tracksCount() const; int tracksCount() const;
QPixmap m_transitionPixmap; QPixmap m_transitionPixmap;
......
This diff is collapsed.
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
void cutSelectedClips(); void cutSelectedClips();
void setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition); void setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition);
void checkTrackHeight(); void checkTrackHeight();
QList <TrackInfo> tracksList() const; //QList <TrackInfo> tracksList() const;
void setTool(PROJECTTOOL tool); void setTool(PROJECTTOOL tool);
void cutClip(ItemInfo info, GenTime cutTime, bool cut); void cutClip(ItemInfo info, GenTime cutTime, bool cut);
void slotSeekToPreviousSnap(); void slotSeekToPreviousSnap();
......
...@@ -771,6 +771,7 @@ bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) { ...@@ -771,6 +771,7 @@ bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
addedXml.setAttribute("version", "0.8"); addedXml.setAttribute("version", "0.8");
addedXml.setAttribute("profile", profilePath()); addedXml.setAttribute("profile", profilePath());
addedXml.setAttribute("position", m_render->seekPosition().frames(m_fps)); addedXml.setAttribute("position", m_render->seekPosition().frames(m_fps));
addedXml.setAttribute("tracks", getTracksInfo());
addedXml.setAttribute("zoom", m_zoom); addedXml.setAttribute("zoom", m_zoom);
QDomElement e; QDomElement e;
...@@ -806,36 +807,6 @@ bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) { ...@@ -806,36 +807,6 @@ bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
return true; return true;
} }
QDomElement KdenliveDoc::documentInfoXml() {
QDomDocument doc;
QDomElement e;
QDomElement addedXml = doc.createElement("kdenlivedoc");
QDomElement markers = doc.createElement("markers");
addedXml.setAttribute("version", "0.7");
addedXml.setAttribute("profile", profilePath());
addedXml.setAttribute("position", m_render->seekPosition().frames(m_fps));
addedXml.setAttribute("zoom", m_zoom);
QList <DocClipBase*> list = m_clipManager->documentClipList();
for (int i = 0; i < list.count(); i++) {
e = list.at(i)->toXML();
e.setTagName("kdenlive_producer");
addedXml.appendChild(doc.importNode(e, true));
QList < CommentedTime > marks = list.at(i)->commentedSnapMarkers();
for (int j = 0; j < marks.count(); j++) {
QDomElement marker = doc.createElement("marker");
marker.setAttribute("time", marks.at(j).time().ms() / 1000);
marker.setAttribute("comment", marks.at(j).comment());
marker.setAttribute("id", e.attribute("id"));
markers.appendChild(marker);
}
}
addedXml.appendChild(markers);
if (!m_guidesXml.isNull()) addedXml.appendChild(doc.importNode(m_guidesXml, true));
//kDebug() << m_document.toString();
return addedXml;
}
ClipManager *KdenliveDoc::clipManager() { ClipManager *KdenliveDoc::clipManager() {
return m_clipManager; return m_clipManager;
} }
...@@ -1273,7 +1244,45 @@ void KdenliveDoc::slotCreateTextClip(QString group, const QString &groupId) { ...@@ -1273,7 +1244,45 @@ void KdenliveDoc::slotCreateTextClip(QString group, const QString &groupId) {
delete dia_ui; delete dia_ui;
} }
int KdenliveDoc::tracksCount() const {
return m_tracksList.count();
}
TrackInfo KdenliveDoc::trackInfoAt(int ix) const {
return m_tracksList.at(ix);
}
void KdenliveDoc::insertTrack(int ix, TrackInfo type) {
if (ix == -1) m_tracksList << type;
else m_tracksList.insert(ix, type);
}
void KdenliveDoc::deleteTrack(int ix) {
m_tracksList.removeAt(ix);
}
const QList <TrackInfo> KdenliveDoc::tracksList() const {
return m_tracksList;
}
QPoint KdenliveDoc::getTracksCount() const {
int audio = 0;
int video = 0;
foreach(const TrackInfo &info, m_tracksList) {
if (info.type == VIDEOTRACK) video++;
else audio++;
}
return QPoint(video, audio);
}
QString KdenliveDoc::getTracksInfo() const {
QString result;
foreach(const TrackInfo &info, m_tracksList) {
if (info.type == VIDEOTRACK) result.append('v');
else result.append('a');
}
return result;
}
#include "kdenlivedoc.moc" #include "kdenlivedoc.moc"
...@@ -43,6 +43,7 @@ class Render; ...@@ -43,6 +43,7 @@ class Render;
class ClipManager; class ClipManager;
class DocClipBase; class DocClipBase;
class MainWindow; class MainWindow;
class TrackInfo;
class KdenliveDoc: public QObject { class KdenliveDoc: public QObject {
Q_OBJECT public: Q_OBJECT public:
...@@ -90,7 +91,6 @@ Q_OBJECT public: ...@@ -90,7 +91,6 @@ Q_OBJECT public:
MltVideoProfile mltProfile() const; MltVideoProfile mltProfile() const;
QString description() const; QString description() const;
void setUrl(KUrl url); void setUrl(KUrl url);
QDomElement documentInfoXml();
void setProfilePath(QString path); void setProfilePath(QString path);
const QString&getFreeClipId(); const QString&getFreeClipId();
/** does the document need saving */ /** does the document need saving */
...@@ -105,6 +105,13 @@ Q_OBJECT public: ...@@ -105,6 +105,13 @@ Q_OBJECT public:
const double dar(); const double dar();
double projectDuration() const; double projectDuration() const;
bool saveSceneList(const QString &path, QDomDocument sceneList); bool saveSceneList(const QString &path, QDomDocument sceneList);
int tracksCount() const;
TrackInfo trackInfoAt(int ix) const;
void insertTrack(int ix, TrackInfo type);
void deleteTrack(int ix);
const QList <TrackInfo> tracksList() const;
QPoint getTracksCount() const;
QString getTracksInfo() const;
private: private:
KUrl m_url; KUrl m_url;
...@@ -131,6 +138,9 @@ private: ...@@ -131,6 +138,9 @@ private:
KUrl m_projectFolder; KUrl m_projectFolder;
double m_documentLoadingStep; double m_documentLoadingStep;
double m_documentLoadingProgress; double m_documentLoadingProgress;
QList <TrackInfo> m_tracksList;
void convertDocument(double version); void convertDocument(double version);
QDomDocument createEmptyDocument(const int videotracks, const int audiotracks); QDomDocument createEmptyDocument(const int videotracks, const int audiotracks);
QString colorToString(const QColor& c); QString colorToString(const QColor& c);
......
...@@ -1182,7 +1182,7 @@ void MainWindow::slotEditProfiles() { ...@@ -1182,7 +1182,7 @@ void MainWindow::slotEditProfiles() {
} }
void MainWindow::slotEditProjectSettings() { void MainWindow::slotEditProjectSettings() {
QPoint p = m_activeTimeline->getTracksCount(); QPoint p = m_activeDocument->getTracksCount();
ProjectSettings *w = new ProjectSettings(p.x(), p.y(), true, this); ProjectSettings *w = new ProjectSettings(p.x(), p.y(), true, this);
if (w->exec() == QDialog::Accepted) { if (w->exec() == QDialog::Accepted) {
......
...@@ -328,19 +328,8 @@ void TrackView::refresh() { ...@@ -328,19 +328,8 @@ void TrackView::refresh() {
m_trackview->viewport()->update(); m_trackview->viewport()->update();
} }
QPoint TrackView::getTracksCount() const {
QList <TrackInfo> list = m_trackview->tracksList();
int audio = 0;
int video = 0;
foreach(const TrackInfo &info, list) {
if (info.type == VIDEOTRACK) video++;
else audio++;
}
return QPoint(video, audio);
}
void TrackView::slotRebuildTrackHeaders() { void TrackView::slotRebuildTrackHeaders() {
QList <TrackInfo> list = m_trackview->tracksList(); QList <TrackInfo> list = m_doc->tracksList();
QList<HeaderTrack *> widgets = this->findChildren<HeaderTrack *>(); QList<HeaderTrack *> widgets = this->findChildren<HeaderTrack *>();
for (int i = 0; i < widgets.count(); i++) for (int i = 0; i < widgets.count(); i++)
delete widgets.at(i); delete widgets.at(i);
......
...@@ -59,7 +59,6 @@ public: ...@@ -59,7 +59,6 @@ public:
int outPoint() const; int outPoint() const;
int inPoint() const; int inPoint() const;
int fitZoom() const; int fitZoom() const;
QPoint getTracksCount() const;
public slots: public slots:
void slotDeleteClip(const QString &clipId); void slotDeleteClip(const QString &clipId);
......
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