]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist_model.cpp
Coding convention
[vlc] / modules / gui / qt4 / components / playlist / playlist_model.cpp
index 0d1d97dad124208322a3c9812d10ef0f9eb8fca4..46ffe0aa71d3764cdd1907bbc0dbd27568371123 100644 (file)
@@ -724,14 +724,17 @@ void PLModel::sort( int column, Qt::SortOrder order )
         switch( column )
         {
         case 0: i_mode = SORT_TITLE_NODES_FIRST;break;
-        case 1: i_mode = SORT_ARTIST;break;
-        case 2: i_mode = SORT_DURATION; break;
+        case 1: i_mode = SORT_DURATION; break;
+        case 2: i_mode = SORT_ARTIST;break;
         default: i_mode = SORT_TITLE_NODES_FIRST; break;
         }
         if( p_root )
+        {
             playlist_RecursiveNodeSort( p_playlist, p_root, i_mode,
                                         order == Qt::AscendingOrder ?
                                             ORDER_NORMAL : ORDER_REVERSE );
+            p_playlist->b_reset_currently_playing = VLC_TRUE;
+        }
     }
     PL_UNLOCK;
     rebuild();
@@ -793,52 +796,52 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
 
 void PLModel::viewchanged( int meta )
 {
-   if( rootItem )
-   {
-       int index=0;
-       switch( meta )
-       {
-       case VLC_META_ENGINE_TITLE:
-           index=0; break;
-       case VLC_META_ENGINE_DURATION:
-           index=1; break;
-       case VLC_META_ENGINE_ARTIST:
-           index=2; break;
-       case VLC_META_ENGINE_GENRE:
-           index=3; break;
-       case VLC_META_ENGINE_COPYRIGHT:
-           index=4; break;
-       case VLC_META_ENGINE_COLLECTION:
-           index=5; break;
-       case VLC_META_ENGINE_SEQ_NUM:
-           index=6; break;
-       case VLC_META_ENGINE_DESCRIPTION:
-           index=7; break;
-       default:
-           break;
-       }
-       /* UNUSED        emit layoutAboutToBeChanged(); */
-       index = __MIN( index , rootItem->item_col_strings.count() );
-       QModelIndex parent = createIndex( 0, 0, rootItem );
-
-       if( rootItem->i_showflags & meta )
-           /* Removing columns */
-       {
-           beginRemoveColumns( parent, index, index+1 );
-           rootItem->i_showflags &= ~( meta );
-           rootItem->updateColumnHeaders();
-           endRemoveColumns();
-       }
-       else
-       {
-           /* Adding columns */
-           beginInsertColumns( createIndex( 0, 0, rootItem), index, index+1 );
-           rootItem->i_showflags |= meta;
-           rootItem->updateColumnHeaders();
-           endInsertColumns();
-       }
-       rebuild();
-   }
+    if( rootItem )
+    {
+        int index=0;
+        switch( meta )
+        {
+        case VLC_META_ENGINE_TITLE:
+            index=0; break;
+        case VLC_META_ENGINE_DURATION:
+            index=1; break;
+        case VLC_META_ENGINE_ARTIST:
+            index=2; break;
+        case VLC_META_ENGINE_GENRE:
+            index=3; break;
+        case VLC_META_ENGINE_COPYRIGHT:
+            index=4; break;
+        case VLC_META_ENGINE_COLLECTION:
+            index=5; break;
+        case VLC_META_ENGINE_SEQ_NUM:
+            index=6; break;
+        case VLC_META_ENGINE_DESCRIPTION:
+            index=7; break;
+        default:
+            break;
+        }
+        /* UNUSED        emit layoutAboutToBeChanged(); */
+        index = __MIN( index, rootItem->item_col_strings.count() );
+        QModelIndex parent = createIndex( 0, 0, rootItem );
+
+        if( rootItem->i_showflags & meta )
+            /* Removing columns */
+        {
+            beginRemoveColumns( parent, index, index+1 );
+            rootItem->i_showflags &= ~( meta );
+            rootItem->updateColumnHeaders();
+            endRemoveColumns();
+        }
+        else
+        {
+            /* Adding columns */
+            beginInsertColumns( createIndex( 0, 0, rootItem), index, index+1 );
+            rootItem->i_showflags |= meta;
+            rootItem->updateColumnHeaders();
+            endInsertColumns();
+        }
+        rebuild();
+    }
 }
 
 void PLModel::popupDel()