From 28f24bd1521c58a64548cb42aa542b3d13ee1045 Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Thu, 28 May 2009 17:14:44 +0200 Subject: [PATCH] UI open_file menus and layout fixes Signed-off-by: Jean-Baptiste Kempf --- modules/gui/qt4/components/open_panels.cpp | 15 +- modules/gui/qt4/components/open_panels.hpp | 3 +- modules/gui/qt4/ui/open_file.ui | 233 +++++++++++---------- 3 files changed, 134 insertions(+), 117 deletions(-) diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index 3a6a4cc693..d4d23a6a26 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -93,7 +93,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* Connects */ BUTTONACT( ui.fileBrowseButton, browseFile() ); - BUTTONACT( ui.delFileButton, deleteFile() ); + BUTTONACT( ui.removeFileButton, removeFile() ); BUTTONACT( ui.subBrowseButton, browseFileSub() ); CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) ); @@ -102,6 +102,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() ); CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() ); CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() ); + updateButtons(); } inline void FileOpenPanel::BuildOldPanel() @@ -171,10 +172,11 @@ void FileOpenPanel::browseFile() item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled ); ui.fileListWidg->addItem( item ); } + updateButtons(); updateMRL(); } -void FileOpenPanel::deleteFile() +void FileOpenPanel::removeFile() { int i = ui.fileListWidg->currentRow(); if( i != -1 ) @@ -184,6 +186,7 @@ void FileOpenPanel::deleteFile() } updateMRL(); + updateButtons(); } /* Show a fileBrowser to select a subtitle */ @@ -252,6 +255,14 @@ void FileOpenPanel::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 ) * **************************************************************************/ diff --git a/modules/gui/qt4/components/open_panels.hpp b/modules/gui/qt4/components/open_panels.hpp index 6a28af993e..0fc6be3d0d 100644 --- a/modules/gui/qt4/components/open_panels.hpp +++ b/modules/gui/qt4/components/open_panels.hpp @@ -137,7 +137,8 @@ public slots: private slots: void browseFileSub(); void browseFile(); - void deleteFile(); + void removeFile(); + void updateButtons(); void toggleSubtitleFrame( bool ); }; diff --git a/modules/gui/qt4/ui/open_file.ui b/modules/gui/qt4/ui/open_file.ui index c4795880d9..f4b2d83b48 100644 --- a/modules/gui/qt4/ui/open_file.ui +++ b/modules/gui/qt4/ui/open_file.ui @@ -67,10 +67,21 @@ Add... + + + :/playlist_add:/playlist_add + - + + + false + + + + :/playlist_remove:/playlist_remove + 0 @@ -78,7 +89,7 @@ - Delete + Remove @@ -87,6 +98,9 @@ + + false + Add a subtitles file @@ -106,115 +120,110 @@ QFrame::StyledPanel - - - - - Qt::Horizontal - - - - 16 - 20 - - - - - - - - Qt::Horizontal - - - - 30 - 26 - - - - - - - - Qt::Horizontal - - - - 16 - 20 - - - - - - - - - 0 - 0 - - - - Size: - - - sizeSubComboBox - - - - - - - - 100 - 0 - - + + + + + + + + + + + + 100 + 0 + + + + Select the subtitles file + + + Browse... + + + + - - - - - 0 - 0 - - - - Alignment: - - - alignSubComboBox - - - - - - - - 100 - 0 - - - - - - - - - - - - 100 - 0 - - - - Select the subtitles file - - - Browse... - + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Font size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + sizeSubComboBox + + + + + + + + 0 + 0 + + + + Text alignment: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + alignSubComboBox + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + + + + + 100 + 0 + + + + + @@ -241,12 +250,8 @@ fileListWidg fileBrowseButton - delFileButton + removeFileButton subCheckBox - subInput - subBrowseButton - sizeSubComboBox - alignSubComboBox -- 2.39.2