#include "qt4.hpp"
#include "../../dialogs_provider.hpp"
#include "playlist.hpp"
+#include "util/customwidgets.hpp"
#include <QVBoxLayout>
#include <QHeaderView>
#include <vlc_services_discovery.h>
PLSelItem::PLSelItem ( QTreeWidgetItem *i, const QString& text )
- : qitem(i), btnAction( NULL )
+ : qitem(i), lblAction( NULL)
{
layout = new QHBoxLayout();
layout->setContentsMargins(0,0,0,0);
+ layout->addSpacing( 3 );
lbl = new QLabel( text );
- lbl->setMargin(3);
- layout->addWidget(lbl);
+
+ layout->addWidget(lbl, 1);
setLayout( layout );
+
+ setMinimumHeight( 22 ); //Action icon height plus 6
}
void PLSelItem::addAction( ItemAction act, const QString& tooltip )
{
- if( btnAction ) return;
+ if( lblAction ) return; //might change later
+
+ QIcon icon;
switch( act )
{
case ADD_ACTION:
- btnAction = new QPushButton("+"); break;
+ icon = QIcon( ":/buttons/playlist/playlist_add" ); break;
case RM_ACTION:
- btnAction = new QPushButton("-"); break;
+ icon = QIcon( ":/buttons/playlist/playlist_remove" ); break;
}
- if( !tooltip.isEmpty() ) btnAction->setToolTip( tooltip );
- btnAction->setMaximumWidth(23);
- layout->addWidget( btnAction );
- btnAction->hide();
+ lblAction = new QVLCIconLabel( icon );
+
+ if( !tooltip.isEmpty() ) lblAction->setToolTip( tooltip );
+
+ layout->addWidget( lblAction, 0 );
+ lblAction->hide();
+ layout->addSpacing( 3 );
- CONNECT( btnAction, clicked(), this, triggerAction() );
+ CONNECT( lblAction, clicked(), this, triggerAction() );
}
-void PLSelItem::showAction() { if( btnAction ) btnAction->show(); }
+void PLSelItem::showAction() { if( lblAction ) lblAction->show(); }
-void PLSelItem::hideAction() { if( btnAction ) btnAction->hide(); }
+void PLSelItem::hideAction() { if( lblAction ) lblAction->hide(); }
void PLSelItem::setText( const QString& text ) { lbl->setText( text ); }
PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf )
: QTreeWidget( p ), p_intf(_p_intf)
{
- /* custom QItemDelegate just to assure the minimum row height,
- which otherwise fails when new child item is inserted */
setFrameStyle( QFrame::NoFrame );
viewport()->setAutoFillBackground( false );
setIconSize( QSize( 24,24 ) );
setIndentation( 10 );
header()->hide();
- //setHeaderLabel( qtr( "Medias" ) );
- //header()->setMovable( false );
setRootIsDecorated( false );
setAlternatingRowColors( false );
- setItemDelegate( new PLSelectorDelegate() );
podcastsParent = NULL;
podcastsParentId = -1;
setDropIndicatorShown(true);
invisibleRootItem()->setFlags( invisibleRootItem()->flags() & ~Qt::ItemIsDropEnabled );
- plEM = new PlaylistEventManager( THEPL );
-
- CONNECT( plEM, itemAdded( int, int ),
+ CONNECT( THEMIM, playlistItemAppended( int, int ),
this, plItemAdded( int, int ) );
- CONNECT( plEM, itemRemoved( int ),
+ CONNECT( THEMIM, playlistItemRemoved( int ),
this, plItemRemoved( int ) );
CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
this, inputItemUpdate( input_item_t * ) );
PLSelector::~PLSelector()
{
- delete plEM;
-
if( podcastsParent )
{
int c = podcastsParent->childCount();
msrc->setExpanded( true );
char **ppsz_longnames;
- char **ppsz_names = vlc_sd_GetNames( &ppsz_longnames );
+ char **ppsz_names = vlc_sd_GetNames( THEPL, &ppsz_longnames );
if( !ppsz_names )
return;
PLSelItem * PLSelector::itemWidget( QTreeWidgetItem *item )
{
return ( static_cast<PLSelItem*>( QTreeWidget::itemWidget( item, 0 ) ) );
-}
\ No newline at end of file
+}
+