Commit 28f24bd1 authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Baptiste Kempf

UI open_file menus and layout fixes

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8681fa9a
...@@ -93,7 +93,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ...@@ -93,7 +93,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
/* Connects */ /* Connects */
BUTTONACT( ui.fileBrowseButton, browseFile() ); BUTTONACT( ui.fileBrowseButton, browseFile() );
BUTTONACT( ui.delFileButton, deleteFile() ); BUTTONACT( ui.removeFileButton, removeFile() );
BUTTONACT( ui.subBrowseButton, browseFileSub() ); BUTTONACT( ui.subBrowseButton, browseFileSub() );
CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) ); CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
...@@ -102,6 +102,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ...@@ -102,6 +102,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() ); CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() );
CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() ); CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() ); CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
updateButtons();
} }
inline void FileOpenPanel::BuildOldPanel() inline void FileOpenPanel::BuildOldPanel()
...@@ -171,10 +172,11 @@ void FileOpenPanel::browseFile() ...@@ -171,10 +172,11 @@ void FileOpenPanel::browseFile()
item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled ); item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled );
ui.fileListWidg->addItem( item ); ui.fileListWidg->addItem( item );
} }
updateButtons();
updateMRL(); updateMRL();
} }
void FileOpenPanel::deleteFile() void FileOpenPanel::removeFile()
{ {
int i = ui.fileListWidg->currentRow(); int i = ui.fileListWidg->currentRow();
if( i != -1 ) if( i != -1 )
...@@ -184,6 +186,7 @@ void FileOpenPanel::deleteFile() ...@@ -184,6 +186,7 @@ void FileOpenPanel::deleteFile()
} }
updateMRL(); updateMRL();
updateButtons();
} }
/* Show a fileBrowser to select a subtitle */ /* Show a fileBrowser to select a subtitle */
...@@ -252,6 +255,14 @@ void FileOpenPanel::clear() ...@@ -252,6 +255,14 @@ void FileOpenPanel::clear()
ui.subInput->clear(); ui.subInput->clear();
} }
/* Update buttons depending on current selection */
void FileOpenPanel::updateButtons()
{
bool b_has_files = ( ui.fileListWidg->count() > 0 );
ui.removeFileButton->setEnabled( b_has_files );
ui.subCheckBox->setEnabled( b_has_files );
}
/************************************************************************** /**************************************************************************
* Open Discs ( DVD, CD, VCD and similar devices ) * * Open Discs ( DVD, CD, VCD and similar devices ) *
**************************************************************************/ **************************************************************************/
......
...@@ -137,7 +137,8 @@ public slots: ...@@ -137,7 +137,8 @@ public slots:
private slots: private slots:
void browseFileSub(); void browseFileSub();
void browseFile(); void browseFile();
void deleteFile(); void removeFile();
void updateButtons();
void toggleSubtitleFrame( bool ); void toggleSubtitleFrame( bool );
}; };
......
...@@ -67,10 +67,21 @@ ...@@ -67,10 +67,21 @@
<property name="text"> <property name="text">
<string>Add...</string> <string>Add...</string>
</property> </property>
<property name="icon">
<iconset>
<normaloff>:/playlist_add</normaloff>:/playlist_add</iconset>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QPushButton" name="delFileButton"> <widget class="QPushButton" name="removeFileButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<normaloff>:/playlist_remove</normaloff>:/playlist_remove</iconset>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
...@@ -78,7 +89,7 @@ ...@@ -78,7 +89,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Delete</string> <string>Remove</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -87,6 +98,9 @@ ...@@ -87,6 +98,9 @@
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="subCheckBox"> <widget class="QCheckBox" name="subCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Add a subtitles file</string> <string>Add a subtitles file</string>
</property> </property>
...@@ -106,115 +120,110 @@ ...@@ -106,115 +120,110 @@
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout2"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="1" column="0"> <item>
<spacer> <widget class="QWidget" name="widget" native="true">
<property name="orientation"> <layout class="QHBoxLayout" name="horizontalLayout">
<enum>Qt::Horizontal</enum> <item>
</property> <widget class="QLineEdit" name="subInput"/>
<property name="sizeHint" stdset="0"> </item>
<size> <item>
<width>16</width> <widget class="QPushButton" name="subBrowseButton">
<height>20</height> <property name="minimumSize">
</size> <size>
</property> <width>100</width>
</spacer> <height>0</height>
</item> </size>
<item row="1" column="3"> </property>
<spacer> <property name="toolTip">
<property name="orientation"> <string>Select the subtitles file</string>
<enum>Qt::Horizontal</enum> </property>
</property> <property name="text">
<property name="sizeHint" stdset="0"> <string>Browse...</string>
<size> </property>
<width>30</width> </widget>
<height>26</height> </item>
</size> </layout>
</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">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Size:</string>
</property>
<property name="buddy">
<cstring>sizeSubComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="sizeSubComboBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item>
<widget class="QLabel" name="alignSubLabel"> <widget class="QWidget" name="widget_2" native="true">
<property name="sizePolicy"> <layout class="QGridLayout" name="gridLayout_2">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <item row="0" column="0">
<horstretch>0</horstretch> <widget class="QLabel" name="sizeSubLabel">
<verstretch>0</verstretch> <property name="sizePolicy">
</sizepolicy> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
</property> <horstretch>0</horstretch>
<property name="text"> <verstretch>0</verstretch>
<string>Alignment:</string> </sizepolicy>
</property> </property>
<property name="buddy"> <property name="layoutDirection">
<cstring>alignSubComboBox</cstring> <enum>Qt::LeftToRight</enum>
</property> </property>
</widget> <property name="text">
</item> <string>Font size:</string>
<item row="1" column="5" colspan="2"> </property>
<widget class="QComboBox" name="alignSubComboBox"> <property name="alignment">
<property name="minimumSize"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<size> </property>
<width>100</width> <property name="buddy">
<height>0</height> <cstring>sizeSubComboBox</cstring>
</size> </property>
</property> </widget>
</widget> </item>
</item> <item row="1" column="0">
<item row="0" column="0" colspan="6"> <widget class="QLabel" name="alignSubLabel">
<widget class="QLineEdit" name="subInput"/> <property name="sizePolicy">
</item> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<item row="0" column="6" colspan="2"> <horstretch>0</horstretch>
<widget class="QPushButton" name="subBrowseButton"> <verstretch>0</verstretch>
<property name="minimumSize"> </sizepolicy>
<size> </property>
<width>100</width> <property name="text">
<height>0</height> <string>Text alignment:</string>
</size> </property>
</property> <property name="alignment">
<property name="toolTip"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>Select the subtitles file</string> </property>
</property> <property name="buddy">
<property name="text"> <cstring>alignSubComboBox</cstring>
<string>Browse...</string> </property>
</property> </widget>
</item>
<item row="0" column="2">
<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>
<item row="1" column="1">
<widget class="QComboBox" name="alignSubComboBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="sizeSubComboBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>
...@@ -241,12 +250,8 @@ ...@@ -241,12 +250,8 @@
<tabstops> <tabstops>
<tabstop>fileListWidg</tabstop> <tabstop>fileListWidg</tabstop>
<tabstop>fileBrowseButton</tabstop> <tabstop>fileBrowseButton</tabstop>
<tabstop>delFileButton</tabstop> <tabstop>removeFileButton</tabstop>
<tabstop>subCheckBox</tabstop> <tabstop>subCheckBox</tabstop>
<tabstop>subInput</tabstop>
<tabstop>subBrowseButton</tabstop>
<tabstop>sizeSubComboBox</tabstop>
<tabstop>alignSubComboBox</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <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