widgets/dvdwizardstatus_ui.ui
widgets/dvdwizardchapters_ui.ui
widgets/missingclips_ui.ui
+ widgets/cliptranscode_ui.ui
)
set(kdenlive_SRCS
documentchecker.cpp
dvdwizardchapters.cpp
documentconvert.cpp
+ cliptranscode.cpp
)
add_definitions( ${KDE4_DEFINITIONS} )
--- /dev/null
+/***************************************************************************
+ * 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 "cliptranscode.h"
+
+#include <KDebug>
+#include <KGlobalSettings>
+#include <KMessageBox>
+
+
+ClipTranscode::ClipTranscode(const KUrl &src, const QString ¶ms, QWidget * parent) :
+ QDialog(parent)
+{
+ setFont(KGlobalSettings::toolBarFont());
+ m_view.setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ setWindowTitle(i18n("Transcode Clip"));
+
+ QString fileName = src.path(); //.section('.', 0, -1);
+ QString newFile = params.section(' ', -1).replace("%1", fileName);
+ KUrl dest(newFile);
+ m_view.source_url->setUrl(src);
+ m_view.dest_url->setUrl(dest);
+ m_view.params->setPlainText(params.simplified());
+ kDebug() << "//PARAMS: " << params << "\n\nNAME: " << newFile;
+
+ connect(m_view.button_start, SIGNAL(clicked()), this, SLOT(slotStartTransCode()));
+
+ m_transcodeProcess.setProcessChannelMode(QProcess::MergedChannels);
+ connect(&m_transcodeProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(slotShowTranscodeInfo()));
+ connect(&m_transcodeProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotTranscodeFinished(int, QProcess::ExitStatus)));
+
+ //adjustSize();
+}
+
+ClipTranscode::~ClipTranscode()
+{
+ if (m_transcodeProcess.state() != QProcess::NotRunning) {
+ m_transcodeProcess.close();
+ }
+}
+
+void ClipTranscode::slotStartTransCode()
+{
+ if (m_transcodeProcess.state() != QProcess::NotRunning) {
+ return;
+ }
+ QStringList parameters;
+ parameters << "-i" << m_view.source_url->url().path();
+
+ if (QFile::exists(m_view.dest_url->url().path())) {
+ if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", m_view.dest_url->url().path())) == KMessageBox::No) return;
+ parameters << "-y";
+ }
+ m_view.buttonBox->button(QDialogButtonBox::Abort)->setText(i18n("Abort"));
+ QString params = m_view.params->toPlainText().simplified();
+ params = params.section(' ', 0, -2);
+ parameters << params.split(' ') << m_view.dest_url->url().path();
+
+ kDebug() << "/// FFMPEG ARGS: " << parameters;
+
+ m_transcodeProcess.start("ffmpeg", parameters);
+ m_view.button_start->setEnabled(false);
+
+}
+
+void ClipTranscode::slotShowTranscodeInfo()
+{
+ QString log = QString(m_transcodeProcess.readAll());
+ //kDebug() << "//LOG: " << log;
+ m_view.log->setPlainText(log);
+}
+
+void ClipTranscode::slotTranscodeFinished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+ m_view.buttonBox->button(QDialogButtonBox::Abort)->setText(i18n("Close"));
+ m_view.button_start->setEnabled(true);
+
+ if (exitCode == 0 && exitStatus == QProcess::NormalExit) {
+ m_view.log->setHtml(m_view.log->toPlainText() + "<br><b>" + i18n("Transcoding finished."));
+ if (m_view.auto_add->isChecked()) emit addClip(m_view.dest_url->url());
+ if (m_view.auto_close->isChecked()) accept();
+ } else {
+ m_view.log->setHtml(m_view.log->toPlainText() + "<br><b>" + i18n("Transcoding FAILED!"));
+ }
+
+ m_transcodeProcess.close();
+}
+
+#include "cliptranscode.moc"
+
+
--- /dev/null
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+
+#ifndef CLIPTRANSCODE_H
+#define CLIPTRANSCODE_H
+
+
+#include "ui_cliptranscode_ui.h"
+
+#include <KUrl>
+
+#include <QProcess>
+
+class ClipTranscode : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ClipTranscode(const KUrl &src, const QString ¶ms, QWidget * parent = 0);
+ ~ClipTranscode();
+
+
+private slots:
+ void slotShowTranscodeInfo();
+ void slotStartTransCode();
+ void slotTranscodeFinished(int exitCode, QProcess::ExitStatus exitStatus);
+
+private:
+ Ui::ClipTranscode_UI m_view;
+ QProcess m_transcodeProcess;
+
+signals:
+ void addClip(KUrl url);
+};
+
+
+#endif
+
#include "clipitem.h"
#include "interfaces.h"
#include "kdenlive-config.h"
+#include "cliptranscode.h"
#include <KApplication>
#include <KAction>
void MainWindow::slotTranscode()
{
- if (m_transcodeProcess.state() != QProcess::NotRunning) {
- m_messageLabel->setMessage(i18n("A transcoding job is already running"), ErrorMessage);
- return;
- }
QString url = m_projectList->currentClipUrl();
if (url.isEmpty()) return;
QAction *action = qobject_cast<QAction *>(sender());
QString params = action->data().toString();
- params = params.simplified();
- QStringList parameters;
- parameters << "-i" << url;
- QString fileName = url; //.section('.', 0, -1);
- params.replace("%1", fileName);
- QString newFile = params.section(' ', -1);
- kDebug() << "//PARAMS: " << params << "\n\nNAME: " << newFile;
- if (QFile::exists(newFile)) {
- if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", newFile)) == KMessageBox::No) return;
- parameters << "-y";
- }
- parameters << params.split(' ');
- kDebug() << "/// FFMPEG ARGS: " << parameters;
- m_transcodeProcess.setProcessChannelMode(QProcess::MergedChannels);
- connect(&m_transcodeProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(slotShowTranscodeInfo()));
- m_transcodeProcess.start("ffmpeg", parameters);
+ ClipTranscode *d = new ClipTranscode(m_projectList->currentClipUrl(), params);
+ connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
+ d->show();
- //QProcess::startDetached("ffmpeg", parameters);
-}
-void MainWindow::slotShowTranscodeInfo()
-{
- QString log = QString(m_transcodeProcess.readAll());
- kDebug() << "//LOG: " << log;
- //TODO: find better way to display transcode output info
- m_messageLabel->setMessage(log, ErrorMessage);
+ //QProcess::startDetached("ffmpeg", parameters);
}
#include "mainwindow.moc"
bool m_findActivated;
QString m_findString;
QTimer m_findTimer;
- QProcess m_transcodeProcess;
void readOptions();
void saveOptions();
void slotShowTimeline(bool show);
void slotMaximizeCurrent(bool show);
void slotTranscode();
- void slotShowTranscodeInfo();
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ClipTranscode_UI</class>
+ <widget class="QDialog" name="ClipTranscode_UI">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>304</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Source</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="KUrlRequester" name="source_url"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Destination</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="KUrlRequester" name="dest_url"/>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>FFmpeg parameters</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3">
+ <widget class="QTextEdit" name="params">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Job status</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="3">
+ <widget class="QTextEdit" name="log">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="2">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Abort</set>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QPushButton" name="button_start">
+ <property name="text">
+ <string>Start</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="2">
+ <widget class="QCheckBox" name="auto_add">
+ <property name="text">
+ <string>Add clip to project</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QCheckBox" name="auto_close">
+ <property name="text">
+ <string>Close after transcode</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KUrlRequester</class>
+ <extends>QFrame</extends>
+ <header>kurlrequester.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ClipTranscode_UI</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ClipTranscode_UI</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>