#include "mainwindow.h"
-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_startPos(0) {
+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_startPos(0), m_zoom(4) {
kDebug() << "// init profile, ratnum: " << profile.frame_rate_num << ", " << profile.frame_rate_num << ", width: " << profile.width;
m_clipManager = new ClipManager(this);
if (!url.isEmpty()) {
QDomElement infoXml = infoXmlNode.toElement();
QString profilePath = infoXml.attribute("profile");
m_startPos = infoXml.attribute("position").toInt();
+ m_zoom = infoXml.attribute("zoom").toInt();
if (!profilePath.isEmpty()) setProfilePath(profilePath);
double version = infoXml.attribute("version").toDouble();
if (version < 0.7) convertDocument(version);
}
+void KdenliveDoc::setZoom(int factor) {
+ m_zoom = factor;
+}
+
+int KdenliveDoc::zoom() const {
+ return m_zoom;
+}
+
void KdenliveDoc::convertDocument(double version) {
// Opening a old Kdenlive document
QDomNode westley = m_document.elementsByTagName("westley").at(1);
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();
void loadingProgressed();
void updateAllProjectClips();
void syncGuides(QList <Guide *> guides);
+ void setZoom(int factor);
+ int zoom() const;
private:
KUrl m_url;
QDomDocument m_document;
QString m_projectName;
double m_fps;
+ int m_zoom;
/** Cursor position at document opening */
int m_startPos;
int m_width;
m_zoomSlider = new QSlider(Qt::Horizontal, this);
m_zoomSlider->setMaximum(13);
+ m_zoomSlider->setPageStep(1);
m_zoomSlider->setMaximumWidth(150);
m_zoomSlider->setMinimumWidth(100);
connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
connect(trackView, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
connect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
- m_zoomSlider->setValue(trackView->currentZoom());
+ m_zoomSlider->setValue(doc->zoom());
connect(m_zoomSlider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
#include "customtrackview.h"
TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
- : QWidget(parent), m_doc(doc), m_scale(1.0), m_projectTracks(0), m_currentZoom(4) {
+ : QWidget(parent), m_doc(doc), m_scale(1.0), m_projectTracks(0) {
view = new Ui::TimeLine_UI();
view->setupUi(this);
connect(m_trackview->verticalScrollBar(), SIGNAL(valueChanged(int)), view->headers_area->verticalScrollBar(), SLOT(setValue(int)));
connect(m_trackview, SIGNAL(trackHeightChanged()), this, SLOT(slotRebuildTrackHeaders()));
- parseDocument(doc->toXml());
+ parseDocument(m_doc->toXml());
connect(m_trackview, SIGNAL(cursorMoved(int, int)), m_ruler, SLOT(slotCursorMoved(int, int)));
connect(m_trackview->horizontalScrollBar(), SIGNAL(valueChanged(int)), m_ruler, SLOT(slotMoveRuler(int)));
connect(m_trackview, SIGNAL(mousePosition(int)), this, SIGNAL(mousePosition(int)));
connect(m_trackview, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotClipItemSelected(ClipItem*)));
connect(m_trackview, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotTransitionItemSelected(Transition*)));
- slotChangeZoom(m_currentZoom);
+ slotChangeZoom(m_doc->zoom());
}
-int TrackView::currentZoom() const {
- return m_currentZoom;
-}
int TrackView::duration() const {
return m_trackview->duration();
}
void TrackView::slotChangeZoom(int factor) {
-
+ m_doc->setZoom(factor);
m_ruler->setPixelPerMark(factor);
m_scale = (double) FRAME_SIZE / m_ruler->comboScale[factor]; // m_ruler->comboScale[m_currentZoom] /
- m_currentZoom = factor;
m_trackview->setScale(m_scale);
}
void refresh() ;
int outPoint() const;
int inPoint() const;
- int currentZoom() const;
int fitZoom() const;
int m_projectTracks;
QString m_editMode;
QGraphicsScene *m_scene;
- uint m_currentZoom;
KdenliveDoc *m_doc;
QVBoxLayout *m_tracksLayout;