[vlc-devel] commit: Qt: add a very dumb-down version of the Sout dialog for conversion. (Jean-Baptiste Kempf )
git version control
git at videolan.org
Tue Mar 3 09:17:16 CET 2009
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Mar 2 02:13:27 2009 +0100| [728ebfa0c90f30833d3cf8f6f5f3166a1728f7d9] | committer: Jean-Baptiste Kempf
Qt: add a very dumb-down version of the Sout dialog for conversion.
The code is splitted from the Sout-Mess (that needs clean up) and provide an easy GUI:
- Select profile
- Choose the file name
- Choose display or not
- Choose deinterlace or not.
Nothing more.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=728ebfa0c90f30833d3cf8f6f5f3166a1728f7d9
---
modules/gui/qt4/Modules.am | 3 +
modules/gui/qt4/dialogs/convert.cpp | 155 +++++++++++++++++++++++++++++++++++
modules/gui/qt4/dialogs/convert.hpp | 52 ++++++++++++
3 files changed, 210 insertions(+), 0 deletions(-)
diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am
index ba008fe..c899be1 100644
--- a/modules/gui/qt4/Modules.am
+++ b/modules/gui/qt4/Modules.am
@@ -31,6 +31,7 @@ nodist_SOURCES_qt4 = \
dialogs/preferences.moc.cpp \
dialogs/interaction.moc.cpp \
dialogs/sout.moc.cpp \
+ dialogs/convert.moc.cpp \
dialogs/help.moc.cpp \
dialogs/gototime.moc.cpp \
dialogs/toolbar.moc.cpp \
@@ -202,6 +203,7 @@ SOURCES_qt4 = qt4.cpp \
dialogs/plugins.cpp \
dialogs/interaction.cpp \
dialogs/sout.cpp \
+ dialogs/convert.cpp \
dialogs/help.cpp \
dialogs/gototime.cpp \
dialogs/toolbar.cpp \
@@ -246,6 +248,7 @@ noinst_HEADERS = \
dialogs/preferences.hpp \
dialogs/interaction.hpp \
dialogs/sout.hpp \
+ dialogs/convert.hpp \
dialogs/help.hpp \
dialogs/gototime.hpp \
dialogs/toolbar.hpp \
diff --git a/modules/gui/qt4/dialogs/convert.cpp b/modules/gui/qt4/dialogs/convert.cpp
new file mode 100644
index 0000000..e548c03
--- /dev/null
+++ b/modules/gui/qt4/dialogs/convert.cpp
@@ -0,0 +1,155 @@
+/*****************************************************************************
+ * Convert.cpp : Convertion dialogs
+ ****************************************************************************
+ * Copyright (C) 2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Jean-Baptiste Kempf <jb (at) videolan.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.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "dialogs/sout.hpp"
+#include "dialogs/convert.hpp"
+
+#include "util/qt_dirs.hpp"
+
+#include <QLabel>
+#include <QGroupBox>
+#include <QDialogButtonBox>
+#include <QFileDialog>
+#include <QCheckBox>
+
+ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf)
+ : QVLCDialog( parent, _p_intf )
+{
+ setWindowTitle( qtr( "Convert" ) );
+
+ QGridLayout *mainLayout = new QGridLayout( this );
+
+ /**
+ * Source Block
+ **/
+ QGroupBox *sourceBox = new QGroupBox( qtr( "Source" ) );
+ QGridLayout *sourceLayout = new QGridLayout( sourceBox );
+
+ QLabel *sourceLabel = new QLabel( qtr( "Source:" ) );
+ sourceLayout->addWidget( sourceLabel, 0, 0 );
+
+ QLineEdit *sourceLine = new QLineEdit;
+ sourceLine->setReadOnly( true );
+ sourceLabel->setBuddy( sourceLine );
+ sourceLayout->addWidget( sourceLine, 0, 1 );
+
+ QLabel *sourceTypeLabel = new QLabel( qtr( "Type:" ) );
+ sourceLayout->addWidget( sourceTypeLabel, 1, 0 );
+ QLabel *sourceValueLabel = new QLabel;
+ sourceLayout->addWidget( sourceValueLabel, 1, 1 );
+
+ /* Line */
+ QFrame *line = new QFrame;
+ line->setFrameStyle( QFrame::HLine |QFrame::Sunken );
+ sourceLayout->addWidget( line, 2, 0, 1, -1 );
+
+ mainLayout->addWidget( sourceBox, 0, 0, 1, -1 );
+
+ /**
+ * Destination
+ **/
+ QGroupBox *destBox = new QGroupBox( qtr( "Destination" ) );
+ QGridLayout *destLayout = new QGridLayout( destBox );
+
+ QLabel *destLabel = new QLabel( qtr( "Target file:" ) );
+ destLayout->addWidget( destLabel, 0, 0);
+
+ fileLine = new QLineEdit;
+ fileLine->setMinimumWidth( 300 );
+ fileLine->setFocus( Qt::ActiveWindowFocusReason );
+ destLabel->setBuddy( fileLine );
+
+ QPushButton *fileSelectButton = new QPushButton( qtr( "Browse" ) );
+ destLayout->addWidget( fileLine, 0, 1 );
+ destLayout->addWidget( fileSelectButton, 0, 2);
+ BUTTONACT( fileSelectButton, fileBrowse() );
+
+ displayBox = new QCheckBox( qtr( "Display the output" ) );
+ displayBox->setToolTip( qtr( "This display the resulting media, but can "
+ "slow things down." ) );
+ destLayout->addWidget( displayBox, 2, 0, 1, -1 );
+
+ mainLayout->addWidget( destBox, 1, 0, 1, -1 );
+
+
+ /* Profile Editor */
+ QGroupBox *settingBox = new QGroupBox( qtr( "Settings" ) );
+ QGridLayout *settingLayout = new QGridLayout( settingBox );
+
+ profile = new VLCProfileSelector( this );
+ settingLayout->addWidget( profile, 0, 0 );
+
+ deinterBox = new QCheckBox( qtr( "Deinterlace" ) );
+ settingLayout->addWidget( deinterBox, 1, 0 );
+
+ mainLayout->addWidget( settingBox, 3, 0, 1, -1 );
+
+ /* Buttons */
+ QPushButton *okButton = new QPushButton( qtr( "&Start" ) );
+ QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) );
+ QDialogButtonBox *buttonBox = new QDialogButtonBox;
+
+ okButton->setDefault( true );
+ buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole );
+ buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
+
+ mainLayout->addWidget( buttonBox, 5, 3 );
+
+ BUTTONACT( okButton, close() );
+ BUTTONACT( cancelButton, cancel() );
+}
+
+void ConvertDialog::fileBrowse()
+{
+ QString fileName = QFileDialog::getSaveFileName( this, qtr( "Save file..." ),
+ "",
+ qtr( "Containers (*.ps *.ts *.mpg *.ogg *.asf *.mp4 *.mov *.wav *.raw *.flv)" ) );
+ fileLine->setText( toNativeSeparators( fileName ) );
+}
+
+void ConvertDialog::cancel()
+{
+ hide();
+}
+
+void ConvertDialog::close()
+{
+ hide();
+
+ QString mrl = "sout=#" + profile->getTranscode();
+ if( deinterBox->isChecked() )
+ {
+ mrl.remove( '}' );
+ mrl += ",deinterlace}";
+ }
+ mrl += ":duplicate{";
+ if( displayBox->isChecked() ) mrl += "dst=display,";
+ mrl += "dst=std{access=file,mux=" + profile->getMux() +
+ ",dst='" + fileLine->text() + "'}";
+
+ msg_Dbg( p_intf, "Transcode MRL: %s", qtu( mrl ) );
+}
diff --git a/modules/gui/qt4/dialogs/convert.hpp b/modules/gui/qt4/dialogs/convert.hpp
new file mode 100644
index 0000000..e1bd39a
--- /dev/null
+++ b/modules/gui/qt4/dialogs/convert.hpp
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * GotoTime.hpp : GotoTime dialogs
+ ****************************************************************************
+ * Copyright (C) 2007 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Jean-Baptiste Kempf <jb (at) videolan.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 _CONVERT_DIALOG_H_
+#define _CONVERT_DIALOG_H_
+
+#include "util/qvlcframe.hpp"
+
+class QLineEdit;
+class QCheckBox;
+class VLCProfileSelector;
+
+class ConvertDialog : public QVLCDialog
+{
+ Q_OBJECT;
+public:
+ ConvertDialog( QWidget *, intf_thread_t * );
+ virtual ~ConvertDialog(){}
+
+private:
+ QLineEdit *fileLine;
+
+ QCheckBox *displayBox;
+ QCheckBox *deinterBox;
+ VLCProfileSelector *profile;
+private slots:
+ virtual void close();
+ virtual void cancel();
+ void fileBrowse();
+};
+
+#endif
More information about the vlc-devel
mailing list