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 *************************************************************************/
54 PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
55 intf_thread_t *_p_intf, /* main Qt p_intf */
56 playlist_item_t * p_root,
57 QObject *parent ) /* Basic Qt parent */
58 : QAbstractItemModel( parent )
61 p_playlist = _p_playlist;
63 i_cached_input_id = -1;
64 i_popup_item = i_popup_parent = -1;
66 rootItem = NULL; /* PLItem rootItem, will be set in rebuild( ) */
68 /* Icons initialization */
69 #define ADD_ICON(type, x) icons[ITEM_TYPE_##type] = QIcon( x )
70 ADD_ICON( UNKNOWN , type_unknown_xpm );
71 ADD_ICON( FILE, ":/type/file" );
72 ADD_ICON( DIRECTORY, ":/type/directory" );
73 ADD_ICON( DISC, ":/type/disc" );
74 ADD_ICON( CDDA, ":/type/cdda" );
75 ADD_ICON( CARD, ":/type/capture-card" );
76 ADD_ICON( NET, ":/type/net" );
77 ADD_ICON( PLAYLIST, ":/type/playlist" );
78 ADD_ICON( NODE, ":/type/node" );
82 CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
83 this, processInputItemUpdate( input_item_t *) );
84 CONNECT( THEMIM, inputChanged( input_thread_t * ),
85 this, processInputItemUpdate( input_thread_t* ) );
86 CONNECT( THEMIM, playlistItemAppended( int, int ),
87 this, processItemAppend( int, int ) );
88 CONNECT( THEMIM, playlistItemRemoved( int ),
89 this, processItemRemoval( int ) );
97 Qt::DropActions PLModel::supportedDropActions() const
99 return Qt::CopyAction; /* Why not Qt::MoveAction */
102 Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
104 Qt::ItemFlags flags = QAbstractItemModel::flags( index );
106 PLItem *item = index.isValid() ? getItem( index ) : rootItem;
111 playlist_item_t *plItem =
112 playlist_ItemGetById( p_playlist, item->i_id );
114 if ( plItem && ( plItem->i_children > -1 ) )
115 flags |= Qt::ItemIsDropEnabled;
120 flags |= Qt::ItemIsDragEnabled;
125 QStringList PLModel::mimeTypes() const
128 types << "vlc/qt-playlist-item";
132 QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
134 QMimeData *mimeData = new QMimeData();
135 QByteArray encodedData;
136 QDataStream stream( &encodedData, QIODevice::WriteOnly );
137 QModelIndexList list;
139 foreach( const QModelIndex &index, indexes ) {
140 if( index.isValid() && index.column() == 0 )
146 foreach( const QModelIndex &index, list ) {
147 PLItem *item = getItem( index );
148 stream.writeRawData( (char*) &item, sizeof( PLItem* ) );
150 mimeData->setData( "vlc/qt-playlist-item", encodedData );
155 bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
156 int row, int column, const QModelIndex &parent )
158 if( data->hasFormat( "vlc/qt-playlist-item" ) )
160 if( action == Qt::IgnoreAction )
163 PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
166 playlist_item_t *p_parent =
167 playlist_ItemGetById( p_playlist, parentItem->i_id );
168 if( !p_parent || p_parent->i_children == -1 )
175 playlist_item_t *p_pl = p_playlist->p_playing;
176 playlist_item_t *p_ml = p_playlist->p_media_library;
180 ( p_pl && p_parent == p_pl ) ||
181 ( p_ml && p_parent == p_ml ) )
186 QByteArray encodedData = data->data( "vlc/qt-playlist-item" );
188 dropAppendCopy( encodedData, parentItem );
190 dropMove( encodedData, parentItem, row );
195 void PLModel::dropAppendCopy( QByteArray& data, PLItem *target )
197 QDataStream stream( &data, QIODevice::ReadOnly );
200 playlist_item_t *p_parent =
201 playlist_ItemGetById( p_playlist, target->i_id );
202 while( !stream.atEnd() )
205 stream.readRawData( (char*)&item, sizeof(PLItem*) );
206 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
207 if( !p_item ) continue;
208 input_item_t *p_input = p_item->p_input;
209 playlist_AddExt ( p_playlist,
210 p_input->psz_uri, p_input->psz_name,
211 PLAYLIST_APPEND | PLAYLIST_SPREPARSE, PLAYLIST_END,
213 p_input->i_options, p_input->ppsz_options, p_input->optflagc,
214 p_parent == p_playlist->p_playing,
220 void PLModel::dropMove( QByteArray& data, PLItem *target, int row )
222 QDataStream stream( &data, QIODevice::ReadOnly );
223 QList<PLItem*> model_items;
225 int new_pos = row == -1 ? target->children.size() : row;
226 int model_pos = new_pos;
227 while( !stream.atEnd() )
230 stream.readRawData( (char*)&item, sizeof(PLItem*) );
232 /* better not try to move a node into itself: */
233 PLItem *climber = target;
236 if( climber == item ) break;
237 climber = climber->parentItem;
239 if( climber ) continue;
241 if( item->parentItem == target &&
242 target->children.indexOf( item ) < model_pos )
245 ids.append( item->i_id );
246 model_items.append( item );
250 int count = ids.size();
253 playlist_item_t *pp_items[count];
256 for( int i = 0; i < count; i++ )
258 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, ids[i] );
264 pp_items[i] = p_item;
266 playlist_item_t *p_parent =
267 playlist_ItemGetById( p_playlist, target->i_id );
268 playlist_TreeMoveMany( p_playlist, count, pp_items, p_parent,
272 insertChildren( target, model_items, model_pos );
276 /* remove item with its id */
277 void PLModel::removeItem( int i_id )
279 PLItem *item = findById( rootItem, i_id );
283 void PLModel::activateItem( const QModelIndex &index )
285 assert( index.isValid() );
286 PLItem *item = getItem( index );
289 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
290 activateItem( p_item );
294 /* Must be entered with lock */
295 void PLModel::activateItem( playlist_item_t *p_item )
297 if( !p_item ) return;
298 playlist_item_t *p_parent = p_item;
301 if( p_parent->i_id == rootItem->i_id ) break;
302 p_parent = p_parent->p_parent;
305 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked,
309 /****************** Base model mandatory implementations *****************/
310 QVariant PLModel::data( const QModelIndex &index, int role ) const
312 if( !index.isValid() ) return QVariant();
313 PLItem *item = getItem( index );
314 if( role == Qt::DisplayRole )
316 int metadata = columnToMeta( index.column() );
317 if( metadata == COLUMN_END ) return QVariant();
320 if( metadata == COLUMN_NUMBER )
321 returninfo = QString::number( index.row() + 1 );
324 char *psz = psz_column_meta( item->p_input, metadata );
325 returninfo = qfu( psz );
328 return QVariant( returninfo );
330 else if( role == Qt::DecorationRole && index.column() == 0 )
332 /* Used to segfault here because i_type wasn't always initialized */
333 return QVariant( PLModel::icons[item->p_input->i_type] );
335 else if( role == Qt::FontRole )
337 if( isCurrent( index ) )
339 QFont f; f.setBold( true ); return QVariant( f );
342 else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) );
346 bool PLModel::isCurrent( const QModelIndex &index ) const
348 input_thread_t *p_input_thread = THEMIM->getInput();
349 if( !p_input_thread ) return false;
350 return getItem( index )->p_input == input_GetItem( p_input_thread );
353 int PLModel::itemId( const QModelIndex &index ) const
355 return getItem( index )->i_id;
358 QVariant PLModel::headerData( int section, Qt::Orientation orientation,
361 if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
364 int meta_col = columnToMeta( section );
366 if( meta_col == COLUMN_END ) return QVariant();
368 return QVariant( qfu( psz_column_title( meta_col ) ) );
371 QModelIndex PLModel::index( int row, int column, const QModelIndex &parent )
374 PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
376 PLItem *childItem = parentItem->child( row );
378 return createIndex( row, column, childItem );
380 return QModelIndex();
383 QModelIndex PLModel::index( int i_id, int c )
385 return index( findById( rootItem, i_id ), c );
388 /* Return the index of a given item */
389 QModelIndex PLModel::index( PLItem *item, int column ) const
391 if( !item ) return QModelIndex();
392 const PLItem *parent = item->parent();
394 return createIndex( parent->children.lastIndexOf( item ),
396 return QModelIndex();
399 QModelIndex PLModel::currentIndex()
401 input_thread_t *p_input_thread = THEMIM->getInput();
402 if( !p_input_thread ) return QModelIndex();
403 PLItem *item = findByInput( rootItem, input_GetItem( p_input_thread )->i_id );
404 return index( item, 0 );
407 QModelIndex PLModel::parent( const QModelIndex &index ) const
409 if( !index.isValid() ) return QModelIndex();
411 PLItem *childItem = getItem( index );
414 msg_Err( p_playlist, "NULL CHILD" );
415 return QModelIndex();
418 PLItem *parentItem = childItem->parent();
419 if( !parentItem || parentItem == rootItem ) return QModelIndex();
420 if( !parentItem->parentItem )
422 msg_Err( p_playlist, "No parent parent, trying row 0 " );
423 msg_Err( p_playlist, "----- PLEASE REPORT THIS ------" );
424 return createIndex( 0, 0, parentItem );
426 QModelIndex ind = createIndex(parentItem->row(), 0, parentItem);
430 int PLModel::columnCount( const QModelIndex &i) const
432 return columnFromMeta( COLUMN_END );
435 int PLModel::rowCount( const QModelIndex &parent ) const
437 PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
438 return parentItem->childCount();
441 QStringList PLModel::selectedURIs()
444 for( int i = 0; i < current_selection.size(); i++ )
446 PLItem *item = getItem( current_selection[i] );
450 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
453 char *psz = input_item_GetURI( p_item->p_input );
456 lst.append( qfu(psz) );
467 /************************* Lookups *****************************/
469 PLItem *PLModel::findById( PLItem *root, int i_id )
471 return findInner( root, i_id, false );
474 PLItem *PLModel::findByInput( PLItem *root, int i_id )
476 PLItem *result = findInner( root, i_id, true );
480 #define CACHE( i, p ) { i_cached_id = i; p_cached_item = p; }
481 #define ICACHE( i, p ) { i_cached_input_id = i; p_cached_item_bi = p; }
483 PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input )
485 if( !root ) return NULL;
486 if( ( !b_input && i_cached_id == i_id) ||
487 ( b_input && i_cached_input_id ==i_id ) )
489 return b_input ? p_cached_item_bi : p_cached_item;
492 if( !b_input && root->i_id == i_id )
497 else if( b_input && root->p_input->i_id == i_id )
499 ICACHE( i_id, root );
503 QList<PLItem *>::iterator it = root->children.begin();
504 while ( it != root->children.end() )
506 if( !b_input && (*it)->i_id == i_id )
508 CACHE( i_id, (*it) );
509 return p_cached_item;
511 else if( b_input && (*it)->p_input->i_id == i_id )
513 ICACHE( i_id, (*it) );
514 return p_cached_item_bi;
516 if( (*it)->children.size() )
518 PLItem *childFound = findInner( (*it), i_id, b_input );
522 ICACHE( i_id, childFound )
524 CACHE( i_id, childFound )
535 int PLModel::columnToMeta( int _column ) const
540 while( column != _column && meta != COLUMN_END )
549 int PLModel::columnFromMeta( int meta_col ) const
554 while( meta != meta_col && meta != COLUMN_END )
563 bool PLModel::canEdit() const
568 rootItem->p_input == p_playlist->p_playing->p_input ||
570 p_playlist->p_media_library &&
571 rootItem->p_input == p_playlist->p_media_library->p_input
576 /************************* Updates handling *****************************/
578 /**** Events processing ****/
579 void PLModel::processInputItemUpdate( input_thread_t *p_input )
581 if( !p_input ) return;
582 if( p_input && !( p_input->b_dead || !vlc_object_alive( p_input ) ) )
584 PLItem *item = findByInput( rootItem, input_GetItem( p_input )->i_id );
585 if( item ) 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 beginInsertRows( index( nodeItem, 0 ), pos, pos );
628 nodeItem->insertChild( newItem, pos );
638 void PLModel::rebuild()
643 void PLModel::rebuild( playlist_item_t *p_root )
645 playlist_item_t* p_item;
647 /* Invalidate cache */
648 i_cached_id = i_cached_input_id = -1;
650 if( rootItem ) rootItem->removeChildren();
656 rootItem = new PLItem( p_root );
659 /* Recreate from root */
660 updateChildren( rootItem );
663 /* And signal the view */
666 if( p_root ) emit rootChanged();
669 void PLModel::takeItem( PLItem *item )
672 PLItem *parent = item->parentItem;
674 int i_index = parent->children.indexOf( item );
676 beginRemoveRows( index( parent, 0 ), i_index, i_index );
677 parent->takeChildAt( i_index );
681 void PLModel::insertChildren( PLItem *node, QList<PLItem*>& items, int i_pos )
684 int count = items.size();
686 beginInsertRows( index( node, 0 ), i_pos, i_pos + count - 1 );
687 for( int i = 0; i < count; i++ )
689 node->children.insert( i_pos + i, items[i] );
690 items[i]->parentItem = node;
695 void PLModel::removeItem( PLItem *item )
699 if( item->i_id == i_cached_id ) i_cached_id = -1;
700 i_cached_input_id = -1;
702 if( item->parentItem ) {
703 int i = item->parentItem->children.indexOf( item );
704 beginRemoveRows( index( item->parentItem, 0), i, i );
705 item->parentItem->children.removeAt(i);
714 rebuild( p_playlist->p_playing );
718 /* This function must be entered WITH the playlist lock */
719 void PLModel::updateChildren( PLItem *root )
721 playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id );
722 updateChildren( p_node, root );
725 /* This function must be entered WITH the playlist lock */
726 void PLModel::updateChildren( playlist_item_t *p_node, PLItem *root )
728 for( int i = 0; i < p_node->i_children ; i++ )
730 if( p_node->pp_children[i]->i_flags & PLAYLIST_DBL_FLAG ) continue;
731 PLItem *newItem = new PLItem( p_node->pp_children[i], root );
732 root->appendChild( newItem );
733 if( p_node->pp_children[i]->i_children != -1 )
734 updateChildren( p_node->pp_children[i], newItem );
738 /* Function doesn't need playlist-lock, as we don't touch playlist_item_t stuff here*/
739 void PLModel::updateTreeItem( PLItem *item )
742 emit dataChanged( index( item, 0 ) , index( item, columnCount( QModelIndex() ) ) );
745 /************************* Actions ******************************/
748 * Deletion, here we have to do a ugly slow hack as we retrieve the full
749 * list of indexes to delete at once: when we delete a node and all of
750 * its children, we need to update the list.
751 * Todo: investigate whethere we can use ranges to be sure to delete all items?
753 void PLModel::doDelete( QModelIndexList selected )
755 if( !canEdit() ) return;
757 while( !selected.isEmpty() )
759 QModelIndex index = selected[0];
760 selected.removeAt( 0 );
762 if( index.column() != 0 ) continue;
764 PLItem *item = getItem( index );
765 if( item->children.size() )
766 recurseDelete( item->children, &selected );
769 playlist_DeleteFromInput( p_playlist, item->p_input, pl_Locked );
776 void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList )
778 for( int i = children.size() - 1; i >= 0 ; i-- )
780 PLItem *item = children[i];
781 if( item->children.size() )
782 recurseDelete( item->children, fullList );
783 fullList->removeAll( index( item, 0 ) );
787 /******* Volume III: Sorting and searching ********/
788 void PLModel::sort( int column, Qt::SortOrder order )
790 sort( rootItem->i_id, column, order );
793 void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
795 msg_Dbg( p_intf, "Sorting by column %i, order %i", column, order );
797 int meta = columnToMeta( column );
798 if( meta == COLUMN_END ) return;
800 PLItem *item = findById( rootItem, i_root_id );
802 QModelIndex qIndex = index( item, 0 );
803 int count = item->children.size();
806 beginRemoveRows( qIndex, 0, count - 1 );
807 item->removeChildren();
813 playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
817 playlist_RecursiveNodeSort( p_playlist, p_root,
818 i_column_sorting( meta ),
819 order == Qt::AscendingOrder ?
820 ORDER_NORMAL : ORDER_REVERSE );
824 i_cached_id = i_cached_input_id = -1;
828 beginInsertRows( qIndex, 0, count - 1 );
829 updateChildren( item );
835 void PLModel::search( const QString& search_text )
837 /** \todo Fire the search with a small delay ? */
840 playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
843 const char *psz_name = search_text.toUtf8().data();
844 playlist_LiveSearchUpdate( p_playlist , p_root, psz_name );
850 /*********** Popup *********/
851 void PLModel::popup( const QModelIndex & index, const QPoint &point, const QModelIndexList &list )
853 int i_id = index.isValid() ? itemId( index ) : rootItem->i_id;
856 playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
861 i_popup_item = index.isValid() ? p_item->i_id : -1;
862 i_popup_parent = index.isValid() ?
863 ( p_item->p_parent ? p_item->p_parent->i_id : -1 ) :
865 i_popup_column = index.column();
867 bool tree = var_InheritBool( p_intf, "playlist-tree" );
871 current_selection = list;
874 if( i_popup_item > -1 )
876 menu.addAction( qtr(I_POP_PLAY), this, SLOT( popupPlay() ) );
877 menu.addAction( qtr(I_POP_DEL), this, SLOT( popupDel() ) );
879 menu.addAction( qtr(I_POP_STREAM), this, SLOT( popupStream() ) );
880 menu.addAction( qtr(I_POP_SAVE), this, SLOT( popupSave() ) );
882 menu.addAction( qtr(I_POP_INFO), this, SLOT( popupInfo() ) );
884 QMenu *sort_menu = menu.addMenu( qtr( "Sort by ") +
885 qfu( psz_column_title( columnToMeta( index.column() ) ) ) );
886 sort_menu->addAction( qtr( "Ascending" ),
887 this, SLOT( popupSortAsc() ) );
888 sort_menu->addAction( qtr( "Descending" ),
889 this, SLOT( popupSortDesc() ) );
891 if( tree && canEdit() )
892 menu.addAction( qtr(I_POP_ADD), this, SLOT( popupAddNode() ) );
893 if( i_popup_item > -1 )
896 menu.addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
898 if( !menu.isEmpty() ) menu.exec( point );
901 void PLModel::popupDel()
903 doDelete( current_selection );
906 void PLModel::popupPlay()
910 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
912 activateItem( p_item );
917 void PLModel::popupInfo()
920 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
924 input_item_t* p_input = p_item->p_input;
925 vlc_gc_incref( p_input );
927 MediaInfoDialog *mid = new MediaInfoDialog( p_intf, p_input );
928 vlc_gc_decref( p_input );
929 mid->setParent( PlaylistDialog::getInstance( p_intf ),
936 void PLModel::popupStream()
938 QStringList mrls = selectedURIs();
939 if( !mrls.isEmpty() )
940 THEDP->streamingDialog( NULL, mrls[0], false );
944 void PLModel::popupSave()
946 QStringList mrls = selectedURIs();
947 if( !mrls.isEmpty() )
948 THEDP->streamingDialog( NULL, mrls[0] );
953 #include <QDesktopServices>
954 void PLModel::popupExplore()
957 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
961 input_item_t *p_input = p_item->p_input;
962 char *psz_meta = input_item_GetURI( p_input );
966 const char *psz_access;
967 const char *psz_demux;
969 input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_meta );
971 if( EMPTY_STR( psz_access ) ||
972 !strncasecmp( psz_access, "file", 4 ) ||
973 !strncasecmp( psz_access, "dire", 4 ) )
975 QFileInfo info( qfu( psz_meta ) );
976 QDesktopServices::openUrl(
977 QUrl::fromLocalFile( info.absolutePath() ) );
986 #include <QInputDialog>
987 void PLModel::popupAddNode()
990 QString name = QInputDialog::getText( PlaylistDialog::getInstance( p_intf ),
991 qtr( I_POP_ADD ), qtr( "Enter name for new node:" ),
992 QLineEdit::Normal, QString(), &ok);
993 if( !ok || name.isEmpty() ) return;
995 playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
999 playlist_NodeCreate( p_playlist, qtu( name ), p_item, 0, NULL );
1004 void PLModel::popupSortAsc()
1006 sort( i_popup_parent, i_popup_column, Qt::AscendingOrder );
1009 void PLModel::popupSortDesc()
1011 sort( i_popup_parent, i_popup_column, Qt::DescendingOrder );