activate monitor when clicking in timeline + small renderer update

svn path=/branches/KDE4/; revision=2051
parent 856ca977
/****************************************************************************
**
** 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"
......
......@@ -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);
......
......@@ -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();
......
......@@ -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) {
......
......@@ -39,6 +39,14 @@
#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");
......
......@@ -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
......@@ -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());
......
......@@ -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
......@@ -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) {
......
......@@ -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);
};
......
......@@ -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);
......
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