Save zone in/out in kdenlive document:

http://www.kdenlive.org:80/mantis/view.php?id=517

svn path=/branches/KDE4/; revision=2872
parent 2854b18e
......@@ -60,8 +60,8 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent)
littleMarkDistance = FRAME_SIZE;
mediumMarkDistance = FRAME_SIZE * m_timecode.fps();
bigMarkDistance = FRAME_SIZE * m_timecode.fps() * 60;
m_zoneStart = 2 * m_timecode.fps();
m_zoneEnd = 10 * m_timecode.fps();
m_zoneStart = 0;
m_zoneEnd = 100;
m_contextMenu = new QMenu(this);
QAction *addGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Add Guide"));
connect(addGuide, SIGNAL(triggered()), m_view, SLOT(slotAddGuide()));
......
......@@ -15,7 +15,7 @@
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
***************************************************************************/
#ifndef INTERFACES_H
#define INTERFACES_H
......@@ -24,17 +24,16 @@
#include <QUrl>
#include <QtPlugin>
class ClipGenerator
{
public:
virtual ~ClipGenerator() {}
class ClipGenerator {
public:
virtual ~ClipGenerator() {}
virtual QStringList generators() const = 0;
virtual KUrl generatedClip(const QString &generator, const KUrl &projectFolder, const QStringList &lumaNames, const QStringList &lumaFiles, const double fps, const int width, const int height) = 0;
};
virtual QStringList generators() const = 0;
virtual KUrl generatedClip(const QString &generator, const KUrl &projectFolder, const QStringList &lumaNames, const QStringList &lumaFiles, const double fps, const int width, const int height) = 0;
};
Q_DECLARE_INTERFACE(ClipGenerator,
"com.kdenlive.ClipGenerator.ClipGeneratorInterface/1.0")
Q_DECLARE_INTERFACE(ClipGenerator,
"com.kdenlive.ClipGenerator.ClipGeneratorInterface/1.0")
#endif
......
......@@ -43,7 +43,7 @@
#include "titlewidget.h"
#include "mainwindow.h"
KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QPoint tracks, Render *render, MainWindow *parent): QObject(parent), m_render(render), m_url(url), m_projectFolder(projectFolder), m_commandStack(new QUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0), m_startPos(0), m_zoom(7), m_autosave(NULL) {
KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, const QString &profileName, const QPoint tracks, Render *render, MainWindow *parent): QObject(parent), m_render(render), m_url(url), m_projectFolder(projectFolder), m_commandStack(new QUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0), m_startPos(0), m_zoom(7), m_autosave(NULL), m_zoneStart(0), m_zoneEnd(100) {
m_clipManager = new ClipManager(this);
m_autoSaveTimer = new QTimer(this);
m_autoSaveTimer->setSingleShot(true);
......@@ -81,6 +81,8 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
if (m_projectFolder.isEmpty()) m_projectFolder = KUrl(KdenliveSettings::defaultprojectfolder());
m_startPos = infoXml.attribute("position").toInt();
m_zoom = infoXml.attribute("zoom", "7").toInt();
m_zoneStart = infoXml.attribute("zonein", "0").toInt();
m_zoneEnd = infoXml.attribute("zoneout", "100").toInt();
setProfilePath(profilePath);
// Build tracks
......@@ -842,6 +844,15 @@ QString KdenliveDoc::colorToString(const QColor& c) {
return ret;
}
void KdenliveDoc::setZone(int start, int end) {
m_zoneStart = start;
m_zoneEnd = end;
}
QPoint KdenliveDoc::zone() const {
return QPoint(m_zoneStart, m_zoneEnd);
}
bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
QDomNode wes = sceneList.elementsByTagName("westley").at(0);
......@@ -850,6 +861,8 @@ bool KdenliveDoc::saveSceneList(const QString &path, QDomDocument sceneList) {
addedXml.setAttribute("version", "0.81");
addedXml.setAttribute("profile", profilePath());
addedXml.setAttribute("position", m_render->seekPosition().frames(m_fps));
addedXml.setAttribute("zonein", m_zoneStart);
addedXml.setAttribute("zoneout", m_zoneEnd);
addedXml.setAttribute("projectfolder", m_projectFolder.path());
addedXml.setAttribute("tracks", getTracksInfo());
addedXml.setAttribute("zoom", m_zoom);
......
......@@ -118,6 +118,8 @@ Q_OBJECT public:
void cachePixmap(const QString &fileId, const QPixmap &pix) const;
void setProjectFolder(KUrl url);
QString getLadspaFile() const;
void setZone(int start, int end);
QPoint zone() const;
private:
KUrl m_url;
......@@ -144,6 +146,8 @@ private:
KUrl m_projectFolder;
double m_documentLoadingStep;
double m_documentLoadingProgress;
int m_zoneStart;
int m_zoneEnd;
QList <TrackInfo> m_tracksList;
......
......@@ -1253,6 +1253,8 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale) {
if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
slotGotProgressInfo(QString(), -1);
m_clipMonitor->refreshMonitor(true);
m_projectMonitor->adjustRulerSize(trackView->duration());
m_projectMonitor->slotZoneMoved(trackView->inPoint(), trackView->outPoint());
}
void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles) {
......@@ -1508,7 +1510,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
disconnect(transitionConfig, SIGNAL(transitionTrackUpdated(Transition *, int)), m_activeTimeline->projectView() , SLOT(slotTransitionTrackUpdated(Transition *, int)));
disconnect(transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
effectStack->clear();
}
......@@ -1567,7 +1569,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
connect(effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(zoneMoved(int, int)), m_projectMonitor, SLOT(slotZoneMoved(int, int)));
connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
......@@ -1591,6 +1593,11 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
m_buttonSelectTool->setChecked(true);
}
void MainWindow::slotZoneMoved(int start, int end) {
m_activeDocument->setZone(start, end);
m_projectMonitor->slotZoneMoved(start, end);
}
void MainWindow::slotGuidesUpdated() {
if (m_renderWidget) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
}
......
......@@ -282,6 +282,7 @@ private slots:
void slotAutoTransition();
void slotRunWizard();
void generateClip();
void slotZoneMoved(int start, int end);
};
......
......@@ -112,7 +112,6 @@ private:
GenTime getSnapForPos(bool previous);
private slots:
void adjustRulerSize(int length);
void seekCursor(int pos);
void rendererStopped(int pos);
void slotExtractCurrentFrame();
......@@ -148,6 +147,7 @@ public slots:
void slotZoneMoved(int start, int end);
void slotSeekToNextSnap();
void slotSeekToPreviousSnap();
void adjustRulerSize(int length);
signals:
void renderPosition(int);
......
......@@ -100,26 +100,24 @@ ProjectList::~ProjectList() {
delete m_toolbar;
}
void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction)
{
void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction) {
m_addButton->setMenu(addMenu);
m_addButton->setDefaultAction(defaultAction);
m_menu = new QMenu();
m_menu->addActions(addMenu->actions());
}
void ProjectList::setupGeneratorMenu(QMenu *addMenu)
{
void ProjectList::setupGeneratorMenu(QMenu *addMenu) {
QMenu *menu = m_addButton->menu();
menu->addMenu(addMenu);
m_addButton->setMenu(menu);
QMenu *menu = m_addButton->menu();
menu->addMenu(addMenu);
m_addButton->setMenu(menu);
m_menu->addMenu(addMenu);
if (addMenu->isEmpty()) addMenu->setEnabled(false);
m_menu->addAction(m_editAction);
m_menu->addAction(m_deleteAction);
m_menu->insertSeparator(m_deleteAction);
m_menu->addMenu(addMenu);
if (addMenu->isEmpty()) addMenu->setEnabled(false);
m_menu->addAction(m_editAction);
m_menu->addAction(m_deleteAction);
m_menu->insertSeparator(m_deleteAction);
}
......@@ -361,7 +359,7 @@ void ProjectList::requestClipInfo(const QDomElement xml, const QString id) {
}
void ProjectList::slotProcessNextClipInQueue() {
if (m_infoQueue.isEmpty()) {
if (m_infoQueue.isEmpty()) {
listView->setEnabled(true);
return;
}
......
......@@ -84,6 +84,7 @@ TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
connect(m_trackview, SIGNAL(mousePosition(int)), this, SIGNAL(mousePosition(int)));
connect(m_trackview, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotTransitionItemSelected(Transition*, bool)));
slotChangeZoom(m_doc->zoom());
slotSetZone(m_doc->zone());
}
......
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