Commit 4fe7b124 authored by Jakob Leben's avatar Jakob Leben

Qt: make playlist widget even a bit more pretty

parent 49f0cd87
......@@ -50,12 +50,22 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
/* Source Selector */
selector = new PLSelector( this, p_intf );
QLabel *selLabel = new QLabel( "Media Browser" );
QFont font;
font.setBold( true );
selLabel->setFont( font );
selLabel->setMargin( 5 );
QVBoxLayout *selBox = new QVBoxLayout();
selBox->setContentsMargins(5,5,5,0);
selBox->setContentsMargins(0,0,0,0);
selBox->setSpacing( 0 );
selBox->addWidget( selLabel );
selBox->addWidget( selector );
QGroupBox *selGroup = new QGroupBox( qtr( "Media Browser") );
selGroup->setLayout( selBox );
leftSplitter->addWidget( selGroup );
QWidget *mediaBrowser = new QWidget();
mediaBrowser->setLayout( selBox );
leftSplitter->addWidget( mediaBrowser );
/* Create a Container for the Art Label
in order to have a beautiful resizing for the selector above it */
......
......@@ -101,9 +101,9 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf )
setFrameStyle( QFrame::NoFrame );
viewport()->setAutoFillBackground( false );
setIconSize( QSize( 24,24 ) );
setIndentation( 10 );
setIndentation( 14 );
header()->hide();
setRootIsDecorated( false );
setRootIsDecorated( true );
setAlternatingRowColors( false );
podcastsParent = NULL;
podcastsParentId = -1;
......@@ -248,15 +248,10 @@ void PLSelector::createItems()
THEPL->p_media_library );
ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) );
QTreeWidgetItem *msrc = addItem( CATEGORY_TYPE, qtr( "Media Sources" ),
false )->treeItem();
QTreeWidgetItem *mfldrs = NULL;
QTreeWidgetItem *shouts = NULL;
msrc->setExpanded( true );
char **ppsz_longnames;
char **ppsz_names = vlc_sd_GetNames( THEPL, &ppsz_longnames );
if( !ppsz_names )
......@@ -272,21 +267,21 @@ void PLSelector::createItems()
SD_IS("frenchtv") || SD_IS("freebox") )
{
if( !shouts ) shouts = addItem( CATEGORY_TYPE, qtr( "Shoutcast" ),
false, msrc )->treeItem();
false )->treeItem();
putSDData( addItem( SD_TYPE, *ppsz_longname, false, shouts ),
*ppsz_name, *ppsz_longname );
}
else if( SD_IS("video_dir") || SD_IS("audio_dir") || SD_IS("picture_dir") )
{
if( !mfldrs ) mfldrs = addItem( CATEGORY_TYPE, qtr( "Media Folders" ),
false, msrc )->treeItem();
false )->treeItem();
putSDData( addItem( SD_TYPE, *ppsz_longname, false, mfldrs ),
*ppsz_name, *ppsz_longname );
}
else if( SD_IS("podcast") )
{
PLSelItem *podItem = addItem( SD_TYPE, qtr( "Podcasts" ), false, msrc );
PLSelItem *podItem = addItem( SD_TYPE, qtr( "Podcasts" ), false );
putSDData( podItem, *ppsz_name, *ppsz_longname );
podItem->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_PODCAST ) );
podItem->addAction( ADD_ACTION, qtr( "Subscribe to a podcast" ) );
......@@ -296,7 +291,7 @@ void PLSelector::createItems()
}
else
{
putSDData( addItem( SD_TYPE, qtr( *ppsz_longname ), false, msrc ),
putSDData( addItem( SD_TYPE, qtr( *ppsz_longname ), false ),
*ppsz_name, *ppsz_longname );
}
......@@ -468,3 +463,15 @@ PLSelItem * PLSelector::itemWidget( QTreeWidgetItem *item )
return ( static_cast<PLSelItem*>( QTreeWidget::itemWidget( item, 0 ) ) );
}
void PLSelector::drawBranches ( QPainter * painter, const QRect & rect, const QModelIndex & index ) const
{
if( !model()->hasChildren( index ) ) return;
QStyleOption option;
option.initFrom( this );
option.rect = rect;
/*option.state = QStyle::State_Children;
if( isExpanded( index ) ) option.state |= QStyle::State_Open;*/
style()->drawPrimitive( isExpanded( index ) ?
QStyle::PE_IndicatorArrowDown :
QStyle::PE_IndicatorArrowRight, &option, painter );
}
......@@ -108,8 +108,9 @@ protected:
friend class PlaylistWidget;
private:
QStringList mimeTypes () const;
bool dropMimeData ( QTreeWidgetItem * parent, int index, const QMimeData * data, Qt::DropAction action );
bool dropMimeData ( QTreeWidgetItem *, int, const QMimeData *, Qt::DropAction );
void createItems();
void drawBranches ( QPainter *, const QRect &, const QModelIndex & ) const;
PLSelItem * addItem (
SelectorItemType type, const QString& str, bool drop,
QTreeWidgetItem* parentItem = 0 );
......
......@@ -89,7 +89,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
layout->setColumnStretch( 4, 2 );
/* Add item to the playlist button */
addButton = new QPushButton;
addButton = new QToolButton;
addButton->setIcon( QIcon( ":/buttons/playlist/playlist_add" ) );
addButton->setMaximumWidth( 30 );
BUTTONACT( addButton, popupAdd() );
......@@ -97,7 +97,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
/* Button to switch views */
QToolButton *viewButton = new QToolButton( this );
viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogContentsView ) );
viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
layout->addWidget( viewButton, 0, 2 );
/* View selection menu */
......@@ -474,7 +474,7 @@ void LocationBar::setIndex( const QModelIndex &index )
char *fb_name = input_item_GetTitleFbName( item->inputItem() );
QString text = qfu(fb_name);
free(fb_name);
text = QString("/ ") + metrics.elidedText( text, Qt::ElideRight, 150 );
text = QString("> ") + metrics.elidedText( text, Qt::ElideRight, 150 );
btn->setText( text );
btn->setFont( font );
prev = insertWidget( prev, btn );
......
......@@ -68,7 +68,7 @@ private:
QWidget *parent;
QLabel *title;
QPushButton *addButton;
QToolButton *addButton;
QGridLayout *layout;
LocationBar *locationBar;
......
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