[vlc-commits] commit: Qt, playlist: change the layout. This should help MacOS layout ( Jean-Baptiste Kempf )
git at videolan.org
git at videolan.org
Thu Dec 9 00:25:32 CET 2010
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Dec 9 00:24:55 2010 +0100| [bcd6bf01796132aa88d310f455a2ff9c4f474f7f] | committer: Jean-Baptiste Kempf
Qt, playlist: change the layout. This should help MacOS layout
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bcd6bf01796132aa88d310f455a2ff9c4f474f7f
---
modules/gui/qt4/components/playlist/playlist.cpp | 38 +++++++++++-----------
modules/gui/qt4/components/playlist/playlist.hpp | 3 +-
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index e722226..f857d18 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -45,7 +45,7 @@
**********************************************************************/
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
- : QSplitter( _par ), p_intf ( _p_i )
+ : QWidget( _par ), p_intf ( _p_i )
{
#ifndef Q_WS_MAC
setContentsMargins( 3, 3, 3, 3 );
@@ -53,6 +53,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
setContentsMargins( 0, 3, 0, 3 );
#endif
+ QGridLayout *layout = new QGridLayout( this );
+
/*******************
* Left *
*******************/
@@ -90,10 +92,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
playlist_item_t *p_root = THEPL->p_playing;
PL_UNLOCK;
- QWidget *rightPanel = new QWidget( this );
- QGridLayout *layout = new QGridLayout( rightPanel );
- layout->setSpacing( 0 ); layout->setMargin( 0 );
- setMinimumWidth( 300 );
+ setMinimumWidth( 350 );
PLModel *model = new PLModel( p_playlist, p_intf, p_root, this );
mainView = new StandardPLPanel( this, p_intf, p_root, selector, model );
@@ -101,7 +100,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
/* Location Bar */
locationBar = new LocationBar( model );
locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
- layout->addWidget( locationBar, 0, 0 );
+ layout->addWidget( locationBar, 0, 0, 1, 2 );
layout->setColumnStretch( 0, 5 );
CONNECT( locationBar, invoked( const QModelIndex & ),
mainView, browseInto( const QModelIndex & ) );
@@ -110,7 +109,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
QToolButton *viewButton = new QToolButton( this );
viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
viewButton->setToolTip( qtr("Change playlistview") );
- layout->addWidget( viewButton, 0, 1 );
+ layout->addWidget( viewButton, 0, 2 );
/* View selection menu */
QSignalMapper *viewSelectionMapper = new QSignalMapper( this );
@@ -136,42 +135,43 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
searchEdit = new SearchLineEdit( this );
searchEdit->setMaximumWidth( 250 );
searchEdit->setMinimumWidth( 80 );
- layout->addWidget( searchEdit, 0, 2 );
+ layout->addWidget( searchEdit, 0, 3 );
CONNECT( searchEdit, textEdited( const QString& ),
mainView, search( const QString& ) );
CONNECT( searchEdit, searchDelayedChanged( const QString& ),
mainView, searchDelayed( const QString & ) );
CONNECT( mainView, viewChanged( const QModelIndex& ),
this, changeView( const QModelIndex &) );
- layout->setColumnStretch( 2, 3 );
+ layout->setColumnStretch( 3, 3 );
/* Connect the activation of the selector to a redefining of the PL */
DCONNECT( selector, activated( playlist_item_t * ),
mainView, setRoot( playlist_item_t * ) );
- layout->addWidget( mainView, 1, 0, 1, -1 );
+
+ split = new QSplitter(this);
/* Add the two sides of the QSplitter */
- addWidget( leftSplitter );
- addWidget( rightPanel );
+ split->addWidget( leftSplitter );
+ split->addWidget( mainView );
QList<int> sizeList;
sizeList << 180 << 420 ;
- setSizes( sizeList );
- //setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
- setStretchFactor( 0, 0 );
- setStretchFactor( 1, 3 );
+ split->setSizes( sizeList );
+ split->setStretchFactor( 0, 0 );
+ split->setStretchFactor( 1, 3 );
+ split->setCollapsible( 1, false );
leftSplitter->setMaximumWidth( 250 );
- setCollapsible( 1, false );
/* In case we want to keep the splitter information */
// components shall never write there setting to a fixed location, may infer
// with other uses of the same component...
getSettings()->beginGroup("Playlist");
- restoreState( getSettings()->value("splitterSizes").toByteArray());
+ split->restoreState( getSettings()->value("splitterSizes").toByteArray());
leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() );
getSettings()->endGroup();
+ layout->addWidget( split, 1, 0, 1, -1 );
setAcceptDrops( true );
setWindowTitle( qtr( "Playlist" ) );
setWindowRole( "vlc-playlist" );
@@ -181,7 +181,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
PlaylistWidget::~PlaylistWidget()
{
getSettings()->beginGroup("Playlist");
- getSettings()->setValue( "splitterSizes", saveState() );
+ getSettings()->setValue( "splitterSizes", split->saveState() );
getSettings()->setValue( "leftSplitterGeometry", leftSplitter->saveState() );
getSettings()->endGroup();
msg_Dbg( p_intf, "Playlist Destroyed" );
diff --git a/modules/gui/qt4/components/playlist/playlist.hpp b/modules/gui/qt4/components/playlist/playlist.hpp
index f90266e..3c105c5 100644
--- a/modules/gui/qt4/components/playlist/playlist.hpp
+++ b/modules/gui/qt4/components/playlist/playlist.hpp
@@ -46,7 +46,7 @@ class QSignalMapper;
class SearchLineEdit;
class QModelIndex;
-class PlaylistWidget : public QSplitter
+class PlaylistWidget : public QWidget
{
Q_OBJECT
public:
@@ -58,6 +58,7 @@ public:
private:
QSplitter *leftSplitter;
+ QSplitter *split;
StandardPLPanel *mainView;
QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
More information about the vlc-commits
mailing list