Commit f9ac9c2e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: Change open dialog behaviour and layout in most categories.

Internal is now QStringList items and QString options (for the first Item, of course)

    There shouldn't be too many regressions, but testing is welcome
parent cdbdb9ca
This diff is collapsed.
/*****************************************************************************
* open.hpp : Panels for the open dialogs
****************************************************************************
* Copyright (C) 2006-2008 the VideoLAN team
* Copyright (C) 2006-2009 the VideoLAN team
* Copyright (C) 2007 Société des arts technologiques
* Copyright (C) 2007 Savoir-faire Linux
* $Id$
......@@ -91,22 +91,10 @@ protected:
public slots:
virtual void updateMRL() = 0;
signals:
void mrlUpdated( QString );
void mrlUpdated( QStringList, QString );
void methodChanged( QString method );
};
class FileOpenBox: public QFileDialog
{
Q_OBJECT;
public:
FileOpenBox( QWidget *parent, const QString &caption,
const QString &directory, const QString &filter ):
QFileDialog( parent, caption, directory, filter ) {}
public slots:
void accept();
void reject();
};
class FileOpenPanel: public OpenPanel
{
Q_OBJECT;
......@@ -117,15 +105,12 @@ public:
virtual void accept() ;
private:
Ui::OpenFile ui;
QStringList browse( QString );
FileOpenBox *dialogBox;
QLineEdit *lineFileEdit;
QStringList fileCompleteList ;
public slots:
virtual void updateMRL();
private slots:
void browseFileSub();
void toggleSubtitleFrame();
void browseFile();
void toggleSubtitleFrame( bool );
};
class NetOpenPanel: public OpenPanel
......
/*****************************************************************************
* open.cpp : Advanced open dialog
*****************************************************************************
* Copyright © 2006-2008 the VideoLAN team
* Copyright © 2006-2009 the VideoLAN team
* $Id$
*
* Authors: Jean-Baptiste Kempf <jb@videolan.org>
......@@ -85,9 +85,7 @@ OpenDialog::OpenDialog( QWidget *parent,
/* Basic Creation of the Window */
ui.setupUi( this );
setWindowTitle( qtr( "Open" ) );
/* resize( 410, 600 ); */
setMinimumSize( 520, 490 );
setWindowTitle( qtr( "Open a Media" ) );
/* Tab definition and creation */
fileOpenPanel = new FileOpenPanel( ui.Tab, p_intf );
......@@ -140,10 +138,14 @@ OpenDialog::OpenDialog( QWidget *parent,
/* Force MRL update on tab change */
CONNECT( ui.Tab, currentChanged( int ), this, signalCurrent( int ) );
CONNECT( fileOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
CONNECT( netOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
CONNECT( discOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
CONNECT( captureOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
CONNECT( fileOpenPanel, mrlUpdated( QStringList, QString ),
this, updateMRL( QStringList, QString ) );
CONNECT( netOpenPanel, mrlUpdated( QStringList, QString ),
this, updateMRL( QStringList, QString ) );
CONNECT( discOpenPanel, mrlUpdated( QStringList, QString ),
this, updateMRL( QStringList, QString ) );
CONNECT( captureOpenPanel, mrlUpdated( QStringList, QString ),
this, updateMRL( QStringList, QString ) );
CONNECT( fileOpenPanel, methodChanged( QString ),
this, newCachingMethod( QString ) );
......@@ -155,6 +157,7 @@ OpenDialog::OpenDialog( QWidget *parent,
this, newCachingMethod( QString ) );
/* Advanced frame Connects */
CONNECT( ui.slaveCheckbox, toggled( bool ), this, updateMRL() );
CONNECT( ui.slaveText, textChanged( QString ), this, updateMRL() );
CONNECT( ui.cacheSpinBox, valueChanged( int ), this, updateMRL() );
CONNECT( ui.startTimeSpinBox, valueChanged( int ), this, updateMRL() );
......@@ -176,7 +179,7 @@ OpenDialog::OpenDialog( QWidget *parent,
storedMethod = "";
newCachingMethod( "file-caching" );
resize( getSettings()->value( "opendialog-size", QSize( 520, 490 ) ).toSize() );
resize( getSettings()->value( "opendialog-size", QSize( 400, 490 ) ).toSize() );
}
OpenDialog::~OpenDialog()
......@@ -184,6 +187,13 @@ OpenDialog::~OpenDialog()
getSettings()->setValue( "opendialog-size", size() );
}
/* Used by VLM dialog and inputSlave selection */
QString OpenDialog::getMRL( bool b_all )
{
return b_all ? itemsMRL[0] + ui.advancedLineInput->text()
: itemsMRL[0];
}
/* Finish the dialog and decide if you open another one after */
void OpenDialog::setMenuAction()
{
......@@ -237,7 +247,6 @@ void OpenDialog::toggleAdvancedPanel()
if( ui.advancedFrame->isVisible() )
{
ui.advancedFrame->hide();
//setMinimumSize( 520, 460 );
if( size().isValid() )
resize( size().width(), size().height()
- ui.advancedFrame->height() );
......@@ -245,7 +254,6 @@ void OpenDialog::toggleAdvancedPanel()
else
{
ui.advancedFrame->show();
//setMinimumSize( 520, 460 + ui.advancedFrame->height() );
if( size().isValid() )
resize( size().width(), size().height()
+ ui.advancedFrame->height() );
......@@ -263,8 +271,8 @@ void OpenDialog::cancel()
dynamic_cast<OpenPanel*>( ui.Tab->widget( i ) )->clear();
/* Clear the variables */
mrl.clear();
mainMRL.clear();
itemsMRL.clear();
optionsMRL.clear();
/* If in Select Mode, reject instead of hiding */
if( i_action_flag == SELECT ) reject();
......@@ -315,23 +323,38 @@ void OpenDialog::enqueue()
void OpenDialog::finish( bool b_enqueue = false )
{
toggleVisible();
mrl = ui.advancedLineInput->text();
if( i_action_flag != SELECT )
if( i_action_flag == SELECT )
{
QStringList tempMRL = SeparateEntries( mrl );
for( int i = 0; i < tempMRL.size(); i++ )
accept();
return;
}
/* Go through the item list */
for( int i = 0; i < itemsMRL.size(); i++ )
{
bool b_start = !i && !b_enqueue;
input_item_t *p_input;
p_input = input_item_New( p_intf, qtu( itemsMRL[i] ), NULL );
p_input = input_item_New( p_intf, qtu( tempMRL[i] ), NULL );
/* Insert options only for the first element.
We don't know how to edit that anyway. */
if( i == 0 )
{
/* Take options from the UI, not from what we stored */
QStringList optionsList = ui.advancedLineInput->text().split( ":" );
/* Insert options */
while( i + 1 < tempMRL.size() && tempMRL[i + 1].startsWith( ":" ) )
for( int j = 0; j < optionsList.size(); j++ )
{
i++;
input_item_AddOption( p_input, qtu( tempMRL[i] ), VLC_INPUT_OPTION_TRUSTED );
QString qs = optionsList[j].trimmed();
if( !qs.isEmpty() )
{
input_item_AddOption( p_input, qtu( qs ), VLC_INPUT_OPTION_TRUSTED );
// msg_Err( p_intf, "Here %s", qtu( qs ));
}
}
}
/* Switch between enqueuing and starting the item */
......@@ -342,11 +365,8 @@ void OpenDialog::finish( bool b_enqueue = false )
vlc_gc_decref( p_input );
/* Do not add the current MRL if playlist_AddInput fail */
RecentsMRL::getInstance( p_intf )->addRecent( tempMRL[i] );
RecentsMRL::getInstance( p_intf )->addRecent( itemsMRL[i] );
}
}
else
accept();
}
void OpenDialog::transcode()
......@@ -356,43 +376,24 @@ void OpenDialog::transcode()
void OpenDialog::stream( bool b_transcode_only )
{
mrl = ui.advancedLineInput->text();
QString soutMRL = getMRL();
toggleVisible();
/* Separate the entries */
QStringList listMRL = SeparateEntries( mrl );
/* We can only take the first entry since we have no idea what
to do with many files ? Gather ? */
if( listMRL.size() > 0 )
{
/* First item */
QString soutMRL = listMRL[0];
/* Keep all the :xxx options because they are needed see v4l and dshow */
for( int i = 1; i < listMRL.size(); i++ )
{
if( listMRL[i].at( 0 ) == ':' )
soutMRL.append( " " + listMRL[i] );
else
break;
}
/* Dbg and send :D */
msg_Dbg( p_intf, "MRL passed to the Sout: %s", qtu( soutMRL ) );
THEDP->streamingDialog( this, soutMRL, b_transcode_only );
}
}
/* Update the MRL */
void OpenDialog::updateMRL( QString tempMRL )
void OpenDialog::updateMRL( QStringList item, QString tempMRL )
{
mainMRL = tempMRL;
optionsMRL = tempMRL;
itemsMRL = item;
updateMRL();
}
void OpenDialog::updateMRL() {
mrl = mainMRL;
QString mrl = optionsMRL;
if( ui.slaveCheckbox->isChecked() ) {
mrl += " :input-slave=" + ui.slaveText->text();
}
......@@ -406,6 +407,7 @@ void OpenDialog::updateMRL() {
arg( ui.startTimeSpinBox->value() );
}
ui.advancedLineInput->setText( mrl );
ui.mrlLine->setText( itemsMRL.join( " " ) );
}
void OpenDialog::newCachingMethod( QString method )
......@@ -469,6 +471,6 @@ void OpenDialog::browseInputSlave()
{
OpenDialog *od = new OpenDialog( this, p_intf, true, SELECT );
od->exec();
ui.slaveText->setText( od->getMRL() );
ui.slaveText->setText( od->getMRL( false ) );
delete od;
}
......@@ -56,8 +56,6 @@ class QTabWidget;
class OpenDialog : public QVLCDialog
{
friend class FileOpenBox;
Q_OBJECT;
public:
static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf,
......@@ -72,7 +70,7 @@ public:
virtual ~OpenDialog();
void showTab( int = OPEN_FILE_TAB );
QString getMRL(){ return mrl; }
QString getMRL( bool b = true );
public slots:
void selectSlots();
......@@ -88,9 +86,9 @@ private:
static OpenDialog *instance;
input_thread_t *p_input;
QString mrl;
QString mainMRL;
QString optionsMRL;
QString storedMethod;
QStringList itemsMRL;
Ui::Open ui;
FileOpenPanel *fileOpenPanel;
......@@ -112,7 +110,7 @@ private slots:
void cancel();
void close();
void toggleAdvancedPanel();
void updateMRL( QString );
void updateMRL( QStringList, QString );
void updateMRL();
void newCachingMethod( QString );
void signalCurrent( int );
......
......@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<height>532</height>
<width>556</width>
<height>387</height>
</rect>
</property>
<property name="sizePolicy" >
......@@ -55,7 +55,7 @@
</property>
</widget>
</item>
<item row="0" column="1" >
<item row="0" column="2" >
<widget class="QSpinBox" name="cacheSpinBox" >
<property name="toolTip" >
<string>_("Change the caching for the media")</string>
......@@ -71,7 +71,7 @@
</property>
</widget>
</item>
<item row="0" column="2" >
<item row="0" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
......@@ -84,7 +84,7 @@
</property>
</spacer>
</item>
<item row="0" column="3" >
<item row="0" column="4" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>_("Start Time")</string>
......@@ -94,7 +94,7 @@
</property>
</widget>
</item>
<item row="0" column="4" colspan="2" >
<item row="0" column="5" colspan="2" >
<widget class="QSpinBox" name="startTimeSpinBox" >
<property name="toolTip" >
<string>_("Change the start time for the media")</string>
......@@ -110,7 +110,7 @@
</property>
</widget>
</item>
<item row="0" column="6" >
<item row="0" column="7" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
......@@ -123,10 +123,10 @@
</property>
</spacer>
</item>
<item row="1" column="1" colspan="6" >
<item row="1" column="2" colspan="6" >
<widget class="Line" name="line" />
</item>
<item row="2" column="0" colspan="7" >
<item row="2" column="0" colspan="8" >
<widget class="QCheckBox" name="slaveCheckbox" >
<property name="text" >
<string>_("Play another media synchronously (extra audio file, ...)")</string>
......@@ -143,10 +143,10 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="4" >
<item row="3" column="2" colspan="4" >
<widget class="QLineEdit" name="slaveText" />
</item>
<item row="3" column="5" colspan="2" >
<item row="3" column="6" colspan="2" >
<widget class="QPushButton" name="slaveBrowseButton" >
<property name="toolTip" >
<string>_("Select the file")</string>
......@@ -156,26 +156,40 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="6" >
<item row="4" column="2" colspan="6" >
<widget class="Line" name="line" />
</item>
<item row="5" column="0" >
<widget class="QLabel" name="advancedLabel" >
<property name="text" >
<string>_("Customize")</string>
<string>_("MRL")</string>
</property>
<property name="buddy" >
<cstring>advancedLineInput</cstring>
</property>
</widget>
</item>
<item row="5" column="1" colspan="6" >
<item row="5" column="2" colspan="6" >
<widget class="QLineEdit" name="mrlLine" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="2" colspan="6" >
<widget class="QLineEdit" name="advancedLineInput" >
<property name="toolTip" >
<string>_("Complete MRL for VLC internal")</string>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>_("Edit Options")</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -252,22 +266,6 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
......@@ -278,7 +276,6 @@
<tabstop>slaveCheckbox</tabstop>
<tabstop>slaveText</tabstop>
<tabstop>slaveBrowseButton</tabstop>
<tabstop>advancedLineInput</tabstop>
<tabstop>playButton</tabstop>
<tabstop>menuButton</tabstop>
<tabstop>buttonsBox</tabstop>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>358</width>
<height>177</height>
<width>365</width>
<height>129</height>
</rect>
</property>
<layout class="QGridLayout" >
......@@ -63,7 +63,7 @@
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>30</height>
<height>0</height>
</size>
</property>
</spacer>
......
This diff is collapsed.
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>530</width>
<height>216</height>
<width>519</width>
<height>282</height>
</rect>
</property>
<property name="sizePolicy" >
......@@ -19,31 +19,67 @@
<property name="windowTitle" >
<string>_("Open File")</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QWidget" native="1" name="tempWidget" >
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QGroupBox" name="tempWidget" >
<property name="toolTip" >
<string>_("Choose one or more media file to open")</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
<property name="title" >
<string>_("Select one or more files")</string>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
<layout class="QGridLayout" name="gridLayout" >
<item rowspan="2" row="0" column="0" >
<widget class="QListWidget" name="fileListWidg" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<property name="sizeHint" stdset="0" >
<property name="contextMenuPolicy" >
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="verticalScrollBarPolicy" >
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy" >
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers" >
<set>QAbstractItemView::AllEditTriggers</set>
</property>
<property name="alternatingRowColors" >
<bool>true</bool>
</property>
<property name="selectionMode" >
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectItems</enum>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="fileBrowseButton" >
<property name="minimumSize" >
<size>
<width>273</width>
<height>16</height>
<width>100</width>
<height>0</height>
</size>
</property>
</spacer>
<property name="toolTip" >
<string>_("Select the subtitles file")</string>
</property>
<property name="text" >
<string>_("Browse...")</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" >
<item>
<widget class="QCheckBox" name="subCheckBox" >
<property name="toolTip" >
<string>_("Add a subtitles file")</string>
......@@ -53,7 +89,7 @@
</property>
</widget>
</item>
<item row="3" column="0" >
<item>
<widget class="QFrame" name="subFrame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
......@@ -64,7 +100,7 @@
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QGridLayout" >
<layout class="QGridLayout" name="gridLayout_2" >
<item row="1" column="0" >
<spacer>
<property name="orientation" >
......@@ -78,6 +114,32 @@
</property>
</spacer>
</item>
<item row="1" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>30</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="7" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="sizeSubLabel" >
<property name="sizePolicy" >
......@@ -89,6 +151,9 @@
<property name="text" >
<string>_("Size:")</string>
</property>
<property name="buddy" >
<cstring>sizeSubComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="2" >
......@@ -101,19 +166,6 @@
</property>
</widget>
</item>
<item row="1" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>30</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4" >
<widget class="QLabel" name="alignSubLabel" >
<property name="sizePolicy" >
......@@ -125,9 +177,12 @@
<property name="text" >
<string>_("Alignment:")</string>
</property>
<property name="buddy" >
<cstring>alignSubComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="5" >
<item row="1" column="5" colspan="2" >
<widget class="QComboBox" name="alignSubComboBox" >
<property name="minimumSize" >
<size>
......@@ -137,37 +192,11 @@
</property>
</widget>
</item>
<item row="1" column="6" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="6" >
<widget class="QLineEdit" name="subInput" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" name="subInput" />
</item>
<item row="0" column="6" colspan="2" >
<widget class="QPushButton" name="subBrowseButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>100</width>
......@@ -185,9 +214,27 @@
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>273</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>fileListWidg</tabstop>
<tabstop>fileBrowseButton</tabstop>
<tabstop>subCheckBox</tabstop>
<tabstop>subInput</tabstop>
<tabstop>subBrowseButton</tabstop>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>431</width>
<height>233</height>
<width>409</width>
<height>137</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -89,31 +89,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>_("Options")</string>
</property>
<layout class="QHBoxLayout" >
<item>
<widget class="QCheckBox" name="timeShift" >
<property name="toolTip" >
<string/>
</property>
<property name="text" >
<string>_("Allow timeshifting")</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
......@@ -136,7 +111,6 @@
<tabstop>protocolCombo</tabstop>
<tabstop>addressText</tabstop>
<tabstop>portSpin</tabstop>
<tabstop>timeShift</tabstop>
</tabstops>
<resources/>
<connections/>
......
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