]> git.sesse.net Git - kdenlive/commitdiff
activate monitor when clicking in timeline + small renderer update
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 12 Mar 2008 23:02:03 +0000 (23:02 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 12 Mar 2008 23:02:03 +0000 (23:02 +0000)
svn path=/branches/KDE4/; revision=2051

renderer/kdenlive_render.cpp
renderer/renderjob.cpp
renderer/renderjob.h
src/customruler.cpp
src/customtrackview.cpp
src/customtrackview.h
src/mainwindow.cpp
src/mainwindow.h
src/renderwidget.cpp
src/renderwidget.h
src/trackview.cpp

index a79f030b3200140b289c847418f44746b5d37eeb..27dc63bc3c2694e46cbeef88d2f2b75e9f17fbc1 100644 (file)
@@ -1,45 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2006-2008 Trolltech ASA. All rights reserved.
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** This file may be used under the terms of the GNU General Public
-** License versions 2.0 or 3.0 as published by the Free Software
-** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file.  Alternatively you may (at
-** your option) use any later version of the GNU General Public
-** License if such license has been publicly approved by Trolltech ASA
-** (or its successors, if any) and the KDE Free Qt Foundation. In
-** addition, as a special exception, Trolltech gives you certain
-** additional rights. These rights are described in the Trolltech GPL
-** Exception version 1.2, which can be found at
-** http://www.trolltech.com/products/qt/gplexception/ and in the file
-** GPL_EXCEPTION.txt in this package.
-**
-** Please review the following information to ensure GNU General
-** Public Licensing requirements will be met:
-** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
-** you are unsure which license is appropriate for your use, please
-** review the following information:
-** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
-** or contact the sales department at sales@trolltech.com.
-**
-** In addition, as a special exception, Trolltech, as the sole
-** copyright holder for Qt Designer, grants users of the Qt/Eclipse
-** Integration plug-in the right for the Qt/Eclipse Integration to
-** link to functionality provided by Qt Designer and its related
-** libraries.
-**
-** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
-** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
-** granted herein.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
 
 #include <stdio.h>
 #include <QCoreApplication>
@@ -70,13 +46,15 @@ int main(int argc, char **argv) {
         }
         QString render = args.at(0);
         args.takeFirst();
+        QString rendermodule = args.at(0);
+        args.takeFirst();
         QString player = args.at(0);
         args.takeFirst();
         QString src = args.at(0);
         args.takeFirst();
         QString dest = args.at(0);
         args.takeFirst();
-        RenderJob *job = new RenderJob(erase, render, player, src, dest, args, in, out);
+        RenderJob *job = new RenderJob(erase, render, rendermodule, player, src, dest, args, in, out);
         job->start();
         app.exec();
     } else {
@@ -86,6 +64,7 @@ int main(int argc, char **argv) {
                 "  in=pos: start rendering at frame pos\n"
                 "  out=pos: end rendering at frame pos\n"
                 "  render: path to inigo rendrer\n"
+                "  rendermodule: the MLT consumer used for rendering, usually it is avformat\n"
                 "  player: path to video player to play when rendering is over, use '-' to disable playing\n"
                 "  src: source file (usually westley playlist)\n"
                 "  dest: destination file\n"
index 792f6da0d46196aef5cc1fb289155f4ee6726788..ed042f61e1d44fc34f310ec98e2d1173ca03f908 100644 (file)
@@ -24,7 +24,7 @@
 
 static QDBusConnection connection(QLatin1String(""));
 
-RenderJob::RenderJob(bool erase, QString renderer, QString player, QString scenelist, QString dest, QStringList args, int in, int out) : QObject() {
+RenderJob::RenderJob(bool erase, QString renderer, QString rendermodule, QString player, QString scenelist, QString dest, QStringList args, int in, int out) : QObject() {
     m_scenelist = scenelist;
     m_dest = dest;
     m_player = player;
@@ -35,7 +35,7 @@ RenderJob::RenderJob(bool erase, QString renderer, QString player, QString scene
     m_args << scenelist;
     if (in != -1) m_args << "in=" + QString::number(in);
     if (out != -1) m_args << "out=" + QString::number(out);
-    m_args << "-consumer" << "avformat:" + m_dest << "progress=1" << args;
+    m_args << "-consumer" << rendermodule + ":" + m_dest << "progress=1" << args;
     connect(m_renderProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotIsOver(int, QProcess::ExitStatus)));
     connect(m_renderProcess, SIGNAL(readyReadStandardError()), this, SLOT(receivedStderr()));
     m_renderProcess->setReadChannel(QProcess::StandardError);
index 106a9feb780bf33cebc3484b253b39645b83e9e7..5068d73041c48386fe8d8657a0e61062ef3f7789 100644 (file)
@@ -28,7 +28,7 @@
 class RenderJob : public QObject {
     Q_OBJECT
 public:
-    RenderJob(bool erase, QString renderer, QString player, QString scenelist, QString dest, QStringList args, int in = -1, int out = -1);
+    RenderJob(bool erase, QString renderer, QString rendermodule, QString player, QString scenelist, QString dest, QStringList args, int in = -1, int out = -1);
     ~RenderJob();
     void start();
 
index 58f6c3d76f8d9c489d6b4bdc086a814d9293a591..a56f74225e82e37f12fef038edfbb551f271d6d0 100644 (file)
@@ -90,6 +90,7 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent)
 
 // virtual
 void CustomRuler::mousePressEvent(QMouseEvent * event) {
+    m_view->activateMonitor();
     int pos = (event->x() + offset()) / pixelPerMark() / FRAME_SIZE;
     m_moveCursor = RULER_CURSOR;
     if (event->y() > 10) {
index e1ef2afe8c6a08e6b189065ef704c16673f4902b..d89292ba85a19011e5b37cb2fb05d066e99059e3 100644 (file)
 #include "kdenlivesettings.h"
 #include "transition.h"
 
+//TODO:
+// disable animation if user asked it in KDE's global settings
+// http://lists.kde.org/?l=kde-commits&m=120398724717624&w=2
+// needs something like below (taken from dolphin)
+// #include <kglobalsettings.h>
+// const bool animate = KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects;
+// const int duration = animate ? 1500 : 1;
+
 CustomTrackView::CustomTrackView(KdenliveDoc *doc, QGraphicsScene * projectscene, QWidget *parent)
         : QGraphicsView(projectscene, parent), m_tracksCount(0), m_cursorPos(0), m_dropItem(NULL), m_cursorLine(NULL), m_operationMode(NONE), m_startPos(QPointF()), m_dragItem(NULL), m_visualTip(NULL), m_moveOpMode(NONE), m_animation(NULL), m_projectDuration(0), m_scale(1.0), m_clickPoint(0), m_document(doc), m_autoScroll(KdenliveSettings::autoscroll()) {
     if (doc) m_commandStack = doc->commandStack();
@@ -311,6 +319,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
 
 // virtual
 void CustomTrackView::mousePressEvent(QMouseEvent * event) {
+    activateMonitor();
     int pos = event->x();
     if (event->modifiers() == Qt::ControlModifier) {
         setDragMode(QGraphicsView::ScrollHandDrag);
@@ -378,6 +387,10 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
     //QGraphicsView::mousePressEvent(event);
 }
 
+void CustomTrackView::activateMonitor() {
+    emit activateDocumentMonitor();
+}
+
 void CustomTrackView::dragEnterEvent(QDragEnterEvent * event) {
     if (event->mimeData()->hasFormat("kdenlive/producerslist")) {
         kDebug() << "///////////////  DRAG ENTERED, TEXT: " << event->mimeData()->data("kdenlive/producerslist");
index 6140b04843ab6bb83d1bf7b9cc11fab12cbd25f7..ce7704baf3cf0836849441e4320b97cdc35e55bb 100644 (file)
@@ -52,6 +52,7 @@ public:
     void addEffect(int track, GenTime pos, QDomElement effect);
     void deleteEffect(int track, GenTime pos, QDomElement effect);
     void updateEffect(int track, GenTime pos, QDomElement effect);
+    void activateMonitor();
 
 public slots:
     void setCursorPos(int pos, bool seek = true);
@@ -110,6 +111,7 @@ signals:
     void zoomOut();
     void mousePosition(int);
     void clipItemSelected(ClipItem*);
+    void activateDocumentMonitor();
 };
 
 #endif
index b579101d90f3194ad2ab2c52fad8d4327449eb4d..8d443e1587db3b0e77345055a7956ac73452a006 100644 (file)
@@ -475,7 +475,7 @@ void MainWindow::slotEditProjectSettings() {
 void MainWindow::slotRenderProject() {
     if (!m_renderWidget) {
         m_renderWidget = new RenderWidget(this);
-        connect(m_renderWidget, SIGNAL(doRender(const QString&, const QStringList &, bool, bool)), this, SLOT(slotDoRender(const QString&, const QStringList &, bool, bool)));
+        connect(m_renderWidget, SIGNAL(doRender(const QString&, const QString&, const QStringList &, bool, bool)), this, SLOT(slotDoRender(const QString&, const QString&, const QStringList &, bool, bool)));
     }
     /*TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
     if (currentTab) m_renderWidget->setTimeline(currentTab);
@@ -483,7 +483,7 @@ void MainWindow::slotRenderProject() {
     m_renderWidget->show();
 }
 
-void MainWindow::slotDoRender(const QString &dest, const QStringList &avformat_args, bool zoneOnly, bool playAfter) {
+void MainWindow::slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter) {
     if (dest.isEmpty()) return;
     int in;
     int out;
@@ -502,7 +502,7 @@ void MainWindow::slotDoRender(const QString &dest, const QStringList &avformat_a
         if (zoneOnly) args << "in=" + QString::number(in) << "out=" + QString::number(out);
         QString videoPlayer = "-";
         if (playAfter) videoPlayer = "kmplayer";
-        args << "inigo" << videoPlayer << temp.fileName() << dest << avformat_args;
+        args << "inigo" << render << videoPlayer << temp.fileName() << dest << avformat_args;
         QProcess::startDetached("kdenlive_render", args);
     }
 }
@@ -537,6 +537,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
             disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
             disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
             disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
+            disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
         }
         m_activeDocument->setRenderer(NULL);
         disconnect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
@@ -560,6 +561,9 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
     connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
     connect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
     connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
+    connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
+
+
     m_activeTimeline = trackView;
     if (m_renderWidget) m_renderWidget->setDocumentStandard(doc->getDocumentStandard());
     m_monitorManager->setTimecode(doc->timecode());
index 4f0cee8c1b5a4dfc56673e40709c5dedab6a9b4e..95dfb2c9b2b0ddcad68681fcc6b41fe5a21edfab 100644 (file)
@@ -134,7 +134,7 @@ private slots:
     void slotSwitchVideoThumbs();
     void slotSwitchAudioThumbs();
     void slotRenderProject();
-    void slotDoRender(const QString &dest, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
+    void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
 };
 
 #endif
index df3b039e5f98ad1ac5c00e50c7db0019f900950d..cabdd38803028d2285f82f6ef4d6d069f699f58e 100644 (file)
@@ -177,12 +177,14 @@ void RenderWidget::slotDeleteProfile() {
 }
 
 void RenderWidget::slotExport() {
+    QListWidgetItem *item = m_view.size_list->currentItem();
+    if (!item) return;
     QFile f(m_view.out_file->url().path());
     if (f.exists()) {
         if (KMessageBox::warningYesNo(this, i18n("File already exists. Doy you want to overwrite it ?")) != KMessageBox::Yes)
             return;
     }
-    emit doRender(m_view.out_file->url().path(), m_view.advanced_params->text().split(' '), m_view.zone_only->isChecked(), m_view.play_after->isChecked());
+    emit doRender(m_view.out_file->url().path(), item->data(RenderRole).toString(), m_view.advanced_params->text().split(' '), m_view.zone_only->isChecked(), m_view.play_after->isChecked());
 }
 
 void RenderWidget::setDocumentStandard(QString std) {
index e5fda19eaefc6313a59fb138f13481f5010acee7..afc586c1efc68e8d6ace585235c217df0bb20b1f 100644 (file)
@@ -48,7 +48,7 @@ private:
     void parseFile(QString exportFile, bool editable);
 
 signals:
-    void doRender(const QString&, const QStringList &, bool, bool);
+    void doRender(const QString&, const QString&, const QStringList &, bool, bool);
 };
 
 
index 55b6cd405df8b7f3a10e005ac4fada801e4171e9..ee9672c4d584128a4913266483711819ac61de0d 100644 (file)
@@ -31,7 +31,7 @@
 
 TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
         : QWidget(parent), m_doc(doc), m_scale(1.0), m_projectTracks(0), m_projectDuration(0) {
-    setMouseTracking(true);
+
     view = new Ui::TimeLine_UI();
     view->setupUi(this);