1 /*****************************************************************************
2 * playlist_model.cpp : Manage playlist model
3 ****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Ilkka Ollakkka <ileoo (at) videolan dot org>
9 * Jakob Leben <jleben@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
31 #include "dialogs_provider.hpp"
32 #include "components/playlist/playlist_model.hpp"
33 #include "dialogs/mediainfo.hpp"
34 #include "dialogs/playlist.hpp"
35 #include <vlc_intf_strings.h>
37 #include "pixmaps/types/type_unknown.xpm"
43 #include <QApplication>
48 QIcon PLModel::icons[ITEM_TYPE_NUMBER];
50 /*************************************************************************
51 * Playlist model implementation
52 *************************************************************************/
55 This model is called two times, for the selector and the standard panel
57 PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
58 intf_thread_t *_p_intf, /* main Qt p_intf */
59 playlist_item_t * p_root,
60 QObject *parent ) /* Basic Qt parent */
61 : QAbstractItemModel( parent )
64 p_playlist = _p_playlist;
66 i_cached_input_id = -1;
67 i_popup_item = i_popup_parent = -1;
70 rootItem = NULL; /* PLItem rootItem, will be set in rebuild( ) */
72 /* Icons initialization */
73 #define ADD_ICON(type, x) icons[ITEM_TYPE_##type] = QIcon( x )
74 ADD_ICON( UNKNOWN , type_unknown_xpm );
75 ADD_ICON( FILE, ":/type/file" );
76 ADD_ICON( DIRECTORY, ":/type/directory" );
77 ADD_ICON( DISC, ":/type/disc" );
78 ADD_ICON( CDDA, ":/type/cdda" );
79 ADD_ICON( CARD, ":/type/capture-card" );
80 ADD_ICON( NET, ":/type/net" );
81 ADD_ICON( PLAYLIST, ":/type/playlist" );
82 ADD_ICON( NODE, ":/type/node" );
85 rebuild( p_root, true );
86 CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
87 this, processInputItemUpdate( input_item_t *) );
88 CONNECT( THEMIM, inputChanged( input_thread_t * ),
89 this, processInputItemUpdate( input_thread_t* ) );
90 CONNECT( THEMIM, playlistItemAppended( int, int ),
91 this, processItemAppend( int, int ) );
92 CONNECT( THEMIM, playlistItemRemoved( int ),
93 this, processItemRemoval( int ) );
101 Qt::DropActions PLModel::supportedDropActions() const
103 return Qt::CopyAction; /* Why not Qt::MoveAction */
106 Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
108 Qt::ItemFlags flags = QAbstractItemModel::flags( index );
110 PLItem *item = index.isValid() ? getItem( index ) : rootItem;
115 playlist_item_t *plItem =
116 playlist_ItemGetById( p_playlist, item->i_id );
118 if ( plItem && ( plItem->i_children > -1 ) )
119 flags |= Qt::ItemIsDropEnabled;
124 flags |= Qt::ItemIsDragEnabled;
129 QStringList PLModel::mimeTypes() const
132 types << "vlc/qt-playlist-item";
136 QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
138 QMimeData *mimeData = new QMimeData();
139 QByteArray encodedData;
140 QDataStream stream( &encodedData, QIODevice::WriteOnly );
141 QModelIndexList list;
143 foreach( const QModelIndex &index, indexes ) {
144 if( index.isValid() && index.column() == 0 )
150 foreach( const QModelIndex &index, list ) {
151 PLItem *item = getItem( index );
152 stream.writeRawData( (char*) &item, sizeof( PLItem* ) );
154 mimeData->setData( "vlc/qt-playlist-item", encodedData );
159 bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
160 int row, int column, const QModelIndex &parent )
162 if( data->hasFormat( "vlc/qt-playlist-item" ) )
164 if( action == Qt::IgnoreAction )
167 PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
170 playlist_item_t *p_parent =
171 playlist_ItemGetById( p_playlist, parentItem->i_id );
172 if( !p_parent || p_parent->i_children == -1 )
179 playlist_item_t *p_pl = p_playlist->p_playing;
180 playlist_item_t *p_ml = p_playlist->p_media_library;
184 ( p_pl && p_parent == p_pl ) ||
185 ( p_ml && p_parent == p_ml ) )
190 QByteArray encodedData = data->data( "vlc/qt-playlist-item" );
192 dropAppendCopy( encodedData, parentItem );
194 dropMove( encodedData, parentItem, row );
199 void PLModel::dropAppendCopy( QByteArray& data, PLItem *target )
201 QDataStream stream( &data, QIODevice::ReadOnly );
204 playlist_item_t *p_parent =
205 playlist_ItemGetById( p_playlist, target->i_id );
206 while( !stream.atEnd() )
209 stream.readRawData( (char*)&item, sizeof(PLItem*) );
210 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
211 if( !p_item ) continue;
212 input_item_t *p_input = p_item->p_input;
213 playlist_AddExt ( p_playlist,
214 p_input->psz_uri, p_input->psz_name,
215 PLAYLIST_APPEND | PLAYLIST_SPREPARSE, PLAYLIST_END,
217 p_input->i_options, p_input->ppsz_options, p_input->optflagc,
218 p_parent == p_playlist->p_playing,
224 void PLModel::dropMove( QByteArray& data, PLItem *target, int row )
226 QDataStream stream( &data, QIODevice::ReadOnly );
227 QList<PLItem*> model_items;
229 int new_pos = row == -1 ? target->children.size() : row;
230 int model_pos = new_pos;
231 while( !stream.atEnd() )
234 stream.readRawData( (char*)&item, sizeof(PLItem*) );
236 /* better not try to move a node into itself: */
237 PLItem *climber = target;
240 if( climber == item ) break;
241 climber = climber->parentItem;
243 if( climber ) continue;
245 if( item->parentItem == target &&
246 target->children.indexOf( item ) < model_pos )
249 ids.append( item->i_id );
250 model_items.append( item );
254 int count = ids.size();
257 playlist_item_t *pp_items[count];
260 for( int i = 0; i < count; i++ )
262 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, ids[i] );
268 pp_items[i] = p_item;
270 playlist_item_t *p_parent =
271 playlist_ItemGetById( p_playlist, target->i_id );
272 playlist_TreeMoveMany( p_playlist, count, pp_items, p_parent,
276 insertChildren( target, model_items, model_pos );
280 /* remove item with its id */
281 void PLModel::removeItem( int i_id )
283 PLItem *item = findById( rootItem, i_id );
287 void PLModel::activateItem( const QModelIndex &index )
289 assert( index.isValid() );
290 PLItem *item = getItem( index );
293 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
294 activateItem( p_item );
298 /* Must be entered with lock */
299 void PLModel::activateItem( playlist_item_t *p_item )
301 if( !p_item ) return;
302 playlist_item_t *p_parent = p_item;
305 if( p_parent->i_id == rootItem->i_id ) break;
306 p_parent = p_parent->p_parent;
309 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked,
313 /****************** Base model mandatory implementations *****************/
314 QVariant PLModel::data( const QModelIndex &index, int role ) const
316 if( !index.isValid() ) return QVariant();
317 PLItem *item = getItem( index );
318 if( role == Qt::DisplayRole )
320 int metadata = columnToMeta( index.column() );
321 if( metadata == COLUMN_END ) return QVariant();
324 if( metadata == COLUMN_NUMBER )
325 returninfo = QString::number( index.row() + 1 );
328 char *psz = psz_column_meta( item->p_input, metadata );
329 returninfo = qfu( psz );
332 return QVariant( returninfo );
334 else if( role == Qt::DecorationRole && index.column() == 0 )
336 /* Used to segfault here because i_type wasn't always initialized */
337 return QVariant( PLModel::icons[item->p_input->i_type] );
339 else if( role == Qt::FontRole )
341 if( isCurrent( index ) )
343 QFont f; f.setBold( true ); return QVariant( f );
346 else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) );
350 bool PLModel::isCurrent( const QModelIndex &index ) const
352 if( !currentItem ) return false;
353 return getItem( index )->p_input == currentItem->p_input;
356 int PLModel::itemId( const QModelIndex &index ) const
358 return getItem( index )->i_id;
361 QVariant PLModel::headerData( int section, Qt::Orientation orientation,
364 if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
367 int meta_col = columnToMeta( section );
369 if( meta_col == COLUMN_END ) return QVariant();
371 return QVariant( qfu( psz_column_title( meta_col ) ) );
374 QModelIndex PLModel::index( int row, int column, const QModelIndex &parent )
377 PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
379 PLItem *childItem = parentItem->child( row );
381 return createIndex( row, column, childItem );
383 return QModelIndex();
386 QModelIndex PLModel::index( int i_id, int c )
388 return index( findById( rootItem, i_id ), c );
391 /* Return the index of a given item */
392 QModelIndex PLModel::index( PLItem *item, int column ) const
394 if( !item ) return QModelIndex();
395 const PLItem *parent = item->parent();
397 return createIndex( parent->children.lastIndexOf( item ),
399 return QModelIndex();
402 QModelIndex PLModel::parent( const QModelIndex &index ) const
404 if( !index.isValid() ) return QModelIndex();
406 PLItem *childItem = getItem( index );
409 msg_Err( p_playlist, "NULL CHILD" );
410 return QModelIndex();
413 PLItem *parentItem = childItem->parent();
414 if( !parentItem || parentItem == rootItem ) return QModelIndex();
415 if( !parentItem->parentItem )
417 msg_Err( p_playlist, "No parent parent, trying row 0 " );
418 msg_Err( p_playlist, "----- PLEASE REPORT THIS ------" );
419 return createIndex( 0, 0, parentItem );
421 QModelIndex ind = createIndex(parentItem->row(), 0, parentItem);
425 int PLModel::columnCount( const QModelIndex &i) const
427 return columnFromMeta( COLUMN_END );
430 int PLModel::rowCount( const QModelIndex &parent ) const
432 PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
433 return parentItem->childCount();
436 QStringList PLModel::selectedURIs()
439 for( int i = 0; i < current_selection.size(); i++ )
441 PLItem *item = getItem( current_selection[i] );
445 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
448 char *psz = input_item_GetURI( p_item->p_input );
451 lst.append( qfu(psz) );
462 /************************* Lookups *****************************/
464 PLItem *PLModel::findById( PLItem *root, int i_id )
466 return findInner( root, i_id, false );
469 PLItem *PLModel::findByInput( PLItem *root, int i_id )
471 PLItem *result = findInner( root, i_id, true );
475 #define CACHE( i, p ) { i_cached_id = i; p_cached_item = p; }
476 #define ICACHE( i, p ) { i_cached_input_id = i; p_cached_item_bi = p; }
478 PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input )
480 if( !root ) return NULL;
481 if( ( !b_input && i_cached_id == i_id) ||
482 ( b_input && i_cached_input_id ==i_id ) )
484 return b_input ? p_cached_item_bi : p_cached_item;
487 if( !b_input && root->i_id == i_id )
492 else if( b_input && root->p_input->i_id == i_id )
494 ICACHE( i_id, root );
498 QList<PLItem *>::iterator it = root->children.begin();
499 while ( it != root->children.end() )
501 if( !b_input && (*it)->i_id == i_id )
503 CACHE( i_id, (*it) );
504 return p_cached_item;
506 else if( b_input && (*it)->p_input->i_id == i_id )
508 ICACHE( i_id, (*it) );
509 return p_cached_item_bi;
511 if( (*it)->children.size() )
513 PLItem *childFound = findInner( (*it), i_id, b_input );
517 ICACHE( i_id, childFound )
519 CACHE( i_id, childFound )
530 int PLModel::columnToMeta( int _column ) const
535 while( column != _column && meta != COLUMN_END )
544 int PLModel::columnFromMeta( int meta_col ) const
549 while( meta != meta_col && meta != COLUMN_END )
558 bool PLModel::canEdit() const
563 rootItem->p_input == p_playlist->p_playing->p_input ||
565 p_playlist->p_media_library &&
566 rootItem->p_input == p_playlist->p_media_library->p_input
571 /************************* Updates handling *****************************/
573 /**** Events processing ****/
574 void PLModel::processInputItemUpdate( input_thread_t *p_input )
576 if( !p_input ) return;
577 if( p_input && !( p_input->b_dead || !vlc_object_alive( p_input ) ) )
579 PLItem *item = findByInput( rootItem, input_GetItem( p_input )->i_id );
581 emit currentChanged( index( item, 0 ) );
587 processInputItemUpdate( input_GetItem( p_input ) );
590 void PLModel::processInputItemUpdate( input_item_t *p_item )
592 if( !p_item || p_item->i_id <= 0 ) return;
593 PLItem *item = findByInput( rootItem, p_item->i_id );
595 updateTreeItem( item );
598 void PLModel::processItemRemoval( int i_id )
600 if( i_id <= 0 ) return;
604 void PLModel::processItemAppend( int i_item, int i_parent )
606 playlist_item_t *p_item = NULL;
607 PLItem *newItem = NULL;
608 input_thread_t *currentInputThread;
611 PLItem *nodeItem = findById( rootItem, i_parent );
612 if( !nodeItem ) return;
614 foreach( PLItem *existing, nodeItem->children )
615 if( existing->i_id == i_item ) return;
618 p_item = playlist_ItemGetById( p_playlist, i_item );
619 if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end;
621 for( pos = 0; pos < p_item->p_parent->i_children; pos++ )
622 if( p_item->p_parent->pp_children[pos] == p_item ) break;
624 newItem = new PLItem( p_item, nodeItem );
627 currentInputThread = THEMIM->getInput();
628 if( currentInputThread &&
629 newItem->p_input == input_GetItem( currentInputThread ) )
630 currentItem = newItem;
632 beginInsertRows( index( nodeItem, 0 ), pos, pos );
633 nodeItem->insertChild( newItem, pos );
636 if( currentItem == newItem )
637 emit currentChanged( index( newItem, 0 ) );
646 void PLModel::rebuild()
648 rebuild( NULL, false );
651 void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
653 playlist_item_t* p_item;
655 /* Invalidate cache */
656 i_cached_id = i_cached_input_id = -1;
658 if( rootItem ) rootItem->removeChildren();
664 rootItem = new PLItem( p_root );
667 /* Recreate from root */
668 updateChildren( rootItem );
671 /* And signal the view */
675 void PLModel::takeItem( PLItem *item )
678 PLItem *parent = item->parentItem;
680 int i_index = parent->children.indexOf( item );
682 beginRemoveRows( index( parent, 0 ), i_index, i_index );
683 parent->takeChildAt( i_index );
687 void PLModel::insertChildren( PLItem *node, QList<PLItem*>& items, int i_pos )
690 int count = items.size();
692 beginInsertRows( index( node, 0 ), i_pos, i_pos + count - 1 );
693 for( int i = 0; i < count; i++ )
695 node->children.insert( i_pos + i, items[i] );
696 items[i]->parentItem = node;
701 void PLModel::removeItem( PLItem *item )
705 if( item->i_id == i_cached_id ) i_cached_id = -1;
706 i_cached_input_id = -1;
708 if( currentItem == item || rootItem == item)
711 emit currentChanged( QModelIndex() );
717 if( item->parentItem ) {
718 int i = item->parentItem->children.indexOf( item );
719 beginRemoveRows( index( item->parentItem, 0), i, i );
720 item->parentItem->children.removeAt(i);
728 /* This function must be entered WITH the playlist lock */
729 void PLModel::updateChildren( PLItem *root )
731 playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id );
733 updateChildren( p_node, root );
734 emit currentChanged( index( currentItem, 0 ) );
737 /* This function must be entered WITH the playlist lock */
738 void PLModel::updateChildren( playlist_item_t *p_node, PLItem *root )
740 playlist_item_t *p_item = playlist_CurrentPlayingItem(p_playlist);
741 for( int i = 0; i < p_node->i_children ; i++ )
743 if( p_node->pp_children[i]->i_flags & PLAYLIST_DBL_FLAG ) continue;
744 PLItem *newItem = new PLItem( p_node->pp_children[i], root );
745 root->appendChild( newItem );
746 if( p_item && newItem->p_input == p_item->p_input )
748 currentItem = newItem;
750 if( p_node->pp_children[i]->i_children != -1 )
751 updateChildren( p_node->pp_children[i], newItem );
755 /* Function doesn't need playlist-lock, as we don't touch playlist_item_t stuff here*/
756 void PLModel::updateTreeItem( PLItem *item )
759 emit dataChanged( index( item, 0 ) , index( item, columnCount( QModelIndex() ) ) );
762 /************************* Actions ******************************/
765 * Deletion, here we have to do a ugly slow hack as we retrieve the full
766 * list of indexes to delete at once: when we delete a node and all of
767 * its children, we need to update the list.
768 * Todo: investigate whethere we can use ranges to be sure to delete all items?
770 void PLModel::doDelete( QModelIndexList selected )
772 if( !canEdit() ) return;
774 for( int i = selected.size() -1 ; i >= 0; i-- )
776 QModelIndex index = selected[i];
777 if( index.column() != 0 ) continue;
778 PLItem *item = getItem( index );
781 if( item->children.size() )
782 recurseDelete( item->children, &selected );
783 doDeleteItem( item, &selected );
785 if( i > selected.size() ) i = selected.size();
789 void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList )
791 for( int i = children.size() - 1; i >= 0 ; i-- )
793 PLItem *item = children[i];
794 if( item->children.size() )
795 recurseDelete( item->children, fullList );
796 doDeleteItem( item, fullList );
800 void PLModel::doDeleteItem( PLItem *item, QModelIndexList *fullList )
802 QModelIndex deleteIndex = index( item, 0 );
803 fullList->removeAll( deleteIndex );
806 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
812 playlist_DeleteFromInput( p_playlist, p_item->p_input, pl_Locked );
815 /* And finally, remove it from the tree */
819 /******* Volume III: Sorting and searching ********/
820 void PLModel::sort( int column, Qt::SortOrder order )
822 sort( rootItem->i_id, column, order );
825 void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
827 msg_Dbg( p_intf, "Sorting by column %i, order %i", column, order );
829 int meta = columnToMeta( column );
830 if( meta == COLUMN_END ) return;
832 PLItem *item = findById( rootItem, i_root_id );
834 QModelIndex qIndex = index( item, 0 );
835 int count = item->children.size();
838 beginRemoveRows( qIndex, 0, count - 1 );
839 item->removeChildren();
845 playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
849 playlist_RecursiveNodeSort( p_playlist, p_root,
850 i_column_sorting( meta ),
851 order == Qt::AscendingOrder ?
852 ORDER_NORMAL : ORDER_REVERSE );
856 i_cached_id = i_cached_input_id = -1;
860 beginInsertRows( qIndex, 0, count - 1 );
861 updateChildren( item );
867 void PLModel::search( const QString& search_text )
869 /** \todo Fire the search with a small delay ? */
872 playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
875 const char *psz_name = search_text.toUtf8().data();
876 playlist_LiveSearchUpdate( p_playlist , p_root, psz_name );
882 /*********** Popup *********/
883 void PLModel::popup( const QModelIndex & index, const QPoint &point, const QModelIndexList &list )
885 int i_id = index.isValid() ? itemId( index ) : rootItem->i_id;
888 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
893 i_popup_item = index.isValid() ? p_item->i_id : -1;
894 i_popup_parent = index.isValid() ?
895 ( p_item->p_parent ? p_item->p_parent->i_id : -1 ) :
897 i_popup_column = index.column();
899 bool tree = var_InheritBool( p_intf, "playlist-tree" );
903 current_selection = list;
906 if( i_popup_item > -1 )
908 menu.addAction( qtr(I_POP_PLAY), this, SLOT( popupPlay() ) );
909 menu.addAction( qtr(I_POP_DEL), this, SLOT( popupDel() ) );
911 menu.addAction( qtr(I_POP_STREAM), this, SLOT( popupStream() ) );
912 menu.addAction( qtr(I_POP_SAVE), this, SLOT( popupSave() ) );
914 menu.addAction( qtr(I_POP_INFO), this, SLOT( popupInfo() ) );
916 QMenu *sort_menu = menu.addMenu( qtr( "Sort by ") +
917 qfu( psz_column_title( columnToMeta( index.column() ) ) ) );
918 sort_menu->addAction( qtr( "Ascending" ),
919 this, SLOT( popupSortAsc() ) );
920 sort_menu->addAction( qtr( "Descending" ),
921 this, SLOT( popupSortDesc() ) );
923 if( tree && canEdit() )
924 menu.addAction( qtr(I_POP_ADD), this, SLOT( popupAddNode() ) );
925 if( i_popup_item > -1 )
928 menu.addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
930 if( !menu.isEmpty() ) menu.exec( point );
933 void PLModel::popupDel()
935 doDelete( current_selection );
938 void PLModel::popupPlay()
942 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
944 activateItem( p_item );
949 void PLModel::popupInfo()
952 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
956 input_item_t* p_input = p_item->p_input;
957 vlc_gc_incref( p_input );
959 MediaInfoDialog *mid = new MediaInfoDialog( p_intf, p_input );
960 vlc_gc_decref( p_input );
961 mid->setParent( PlaylistDialog::getInstance( p_intf ),
968 void PLModel::popupStream()
970 QStringList mrls = selectedURIs();
971 if( !mrls.isEmpty() )
972 THEDP->streamingDialog( NULL, mrls[0], false );
976 void PLModel::popupSave()
978 QStringList mrls = selectedURIs();
979 if( !mrls.isEmpty() )
980 THEDP->streamingDialog( NULL, mrls[0] );
985 #include <QDesktopServices>
986 void PLModel::popupExplore()
989 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
993 input_item_t *p_input = p_item->p_input;
994 char *psz_meta = input_item_GetURI( p_input );
998 const char *psz_access;
999 const char *psz_demux;
1001 input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_meta );
1003 if( EMPTY_STR( psz_access ) ||
1004 !strncasecmp( psz_access, "file", 4 ) ||
1005 !strncasecmp( psz_access, "dire", 4 ) )
1007 QFileInfo info( qfu( psz_meta ) );
1008 QDesktopServices::openUrl(
1009 QUrl::fromLocalFile( info.absolutePath() ) );
1018 #include <QInputDialog>
1019 void PLModel::popupAddNode()
1022 QString name = QInputDialog::getText( PlaylistDialog::getInstance( p_intf ),
1023 qtr( I_POP_ADD ), qtr( "Enter name for new node:" ),
1024 QLineEdit::Normal, QString(), &ok);
1025 if( !ok || name.isEmpty() ) return;
1027 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
1031 playlist_NodeCreate( p_playlist, qtu( name ), p_item, 0, NULL );
1036 void PLModel::popupSortAsc()
1038 sort( i_popup_parent, i_popup_column, Qt::AscendingOrder );
1041 void PLModel::popupSortDesc()
1043 sort( i_popup_parent, i_popup_column, Qt::DescendingOrder );