]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist_model.cpp
i18n: Fix in the popup menu
[vlc] / modules / gui / qt4 / components / playlist / playlist_model.cpp
index 6d3a7ef77eb50615a08e98a90bfa3e5aea4cbe3d..fd45e755a2cae961b51b46a2d75499cc9060e460 100644 (file)
@@ -133,7 +133,7 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
     QByteArray encodedData;
     QDataStream stream( &encodedData, QIODevice::WriteOnly );
 
-    foreach( QModelIndex index, indexes ) {
+    foreach( const QModelIndex &index, indexes ) {
         if( index.isValid() && index.column() == 0 )
             stream << itemId( index );
     }
@@ -395,8 +395,7 @@ QStringList PLModel::selectedURIs()
         if( !item )
             continue;
 
-        input_item_t *p_item = input_item_GetById( p_playlist,
-                                                   item->i_input_id );
+        input_item_t *p_item = NULL;
         if( !p_item )
             continue;
 
@@ -586,6 +585,7 @@ void PLModel::rebuild()
 
 void PLModel::rebuild( playlist_item_t *p_root )
 {
+    playlist_item_t* p_item;
     /* Remove callbacks before locking to avoid deadlocks */
     delCallbacks();
     /* Invalidate cache */
@@ -612,13 +612,13 @@ void PLModel::rebuild( playlist_item_t *p_root )
     assert( rootItem );
     /* Recreate from root */
     UpdateNodeChildren( rootItem );
-    if( p_playlist->status.p_item )
+    if( (p_item = playlist_CurrentPlayingItem(p_playlist)) )
     {
         PLItem *currentItem = FindByInput( rootItem,
-                                     p_playlist->status.p_item->p_input->i_id );
+                                           p_item->p_input->i_id );
         if( currentItem )
         {
-            UpdateTreeItem( p_playlist->status.p_item, currentItem,
+            UpdateTreeItem( p_item, currentItem,
                             true, false );
         }
     }
@@ -668,7 +668,7 @@ void PLModel::UpdateTreeItem( playlist_item_t *p_item, PLItem *item,
     if( !force && i_depth == DEPTH_SEL && p_item->p_parent &&
                                  p_item->p_parent->i_id != rootItem->i_id )
         return;
-    item->update( p_item, p_item == p_playlist->status.p_item );
+    item->update( p_item, p_item == playlist_CurrentPlayingItem( p_playlist ) );
     if( signal )
         emit dataChanged( index( item, 0 ) , index( item, 1 ) );
 }
@@ -735,16 +735,6 @@ void PLModel::sort( int column, Qt::SortOrder order )
     int i_index = -1;
     int i_flag = 0;
 
-    // FIXME: Disable sorting on startup by ignoring
-    // first call of sorting caused by showing dialog
-    // see: standardpanel.cpp:65
-    static bool b_first_time = true;
-    if( b_first_time )
-    {
-        b_first_time = false;
-        return;
-    }
-
     int i_column = 1;
     for( i_column = 1; i_column != COLUMN_END; i_column<<=1 )
     {
@@ -770,7 +760,6 @@ next:
                                         i_column_sorting( i_flag ),
                                         order == Qt::AscendingOrder ?
                                             ORDER_NORMAL : ORDER_REVERSE );
-            p_playlist->b_reset_currently_playing = true;
         }
     }
     PL_UNLOCK;
@@ -807,21 +796,21 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
         PL_UNLOCK;
         current_selection = list;
         QMenu *menu = new QMenu;
-        menu->addAction( qfu(I_POP_PLAY), this, SLOT( popupPlay() ) );
-        menu->addAction( qfu(I_POP_DEL), this, SLOT( popupDel() ) );
+        menu->addAction( qtr(I_POP_PLAY), this, SLOT( popupPlay() ) );
+        menu->addAction( qtr(I_POP_DEL), this, SLOT( popupDel() ) );
         menu->addSeparator();
-        menu->addAction( qfu(I_POP_STREAM), this, SLOT( popupStream() ) );
-        menu->addAction( qfu(I_POP_SAVE), this, SLOT( popupSave() ) );
+        menu->addAction( qtr(I_POP_STREAM), this, SLOT( popupStream() ) );
+        menu->addAction( qtr(I_POP_SAVE), this, SLOT( popupSave() ) );
         menu->addSeparator();
-        menu->addAction( qfu(I_POP_INFO), this, SLOT( popupInfo() ) );
+        menu->addAction( qtr(I_POP_INFO), this, SLOT( popupInfo() ) );
         if( p_item->i_children > -1 )
         {
             menu->addSeparator();
-            menu->addAction( qfu(I_POP_SORT), this, SLOT( popupSort() ) );
-            menu->addAction( qfu(I_POP_ADD), this, SLOT( popupAdd() ) );
+            menu->addAction( qtr(I_POP_SORT), this, SLOT( popupSort() ) );
+            menu->addAction( qtr(I_POP_ADD), this, SLOT( popupAdd() ) );
         }
         menu->addSeparator();
-        menu->addAction( qfu( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
+        menu->addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
         menu->popup( point );
     }
     else
@@ -851,6 +840,7 @@ void PLModel::viewchanged( int meta )
         {
             beginRemoveColumns( parent, index, index+1 );
             rootItem->i_showflags &= ~( meta );
+            getSettings()->setValue( "qt-pl-showflags", rootItem->i_showflags );
             rootItem->updateColumnHeaders();
             endRemoveColumns();
         }
@@ -859,6 +849,7 @@ void PLModel::viewchanged( int meta )
             /* Adding columns */
             beginInsertColumns( parent, index, index+1 );
             rootItem->i_showflags |= meta;
+            getSettings()->setValue( "qt-pl-showflags", rootItem->i_showflags );
             rootItem->updateColumnHeaders();
             endInsertColumns();
         }
@@ -952,7 +943,7 @@ static int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
 {
     PLModel *p_model = (PLModel *) param;
     PLEvent *event = new PLEvent( PLUpdate_Type, 0 );
-    QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+    QApplication::postEvent( p_model, event );
     return VLC_SUCCESS;
 }
 
@@ -961,9 +952,9 @@ static int PlaylistNext( vlc_object_t *p_this, const char *psz_variable,
 {
     PLModel *p_model = (PLModel *) param;
     PLEvent *event = new PLEvent( ItemUpdate_Type, oval.i_int );
-    QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+    QApplication::postEvent( p_model, event );
     event = new PLEvent( ItemUpdate_Type, nval.i_int );
-    QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+    QApplication::postEvent( p_model, event );
     return VLC_SUCCESS;
 }
 
@@ -972,7 +963,7 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_variable,
 {
     PLModel *p_model = (PLModel *) param;
     PLEvent *event = new PLEvent( ItemUpdate_Type, nval.i_int );
-    QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+    QApplication::postEvent( p_model, event );
     return VLC_SUCCESS;
 }
 
@@ -981,7 +972,7 @@ static int ItemDeleted( vlc_object_t *p_this, const char *psz_variable,
 {
     PLModel *p_model = (PLModel *) param;
     PLEvent *event = new PLEvent( ItemDelete_Type, nval.i_int );
-    QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+    QApplication::postEvent( p_model, event );
     return VLC_SUCCESS;
 }
 
@@ -992,8 +983,8 @@ static int ItemAppended( vlc_object_t *p_this, const char *psz_variable,
     playlist_add_t *p_add = (playlist_add_t *)malloc( sizeof( playlist_add_t));
     memcpy( p_add, nval.p_address, sizeof( playlist_add_t ) );
 
-    PLEvent *event = new PLEvent(  p_add );
-    QApplication::postEvent( p_model, static_cast<QEvent*>(event) );
+    PLEvent *event = new PLEvent( p_add );
+    QApplication::postEvent( p_model, event );
     return VLC_SUCCESS;
 }