[vlc-devel] commit: Last patch to close #1479 (add a column with the track id) ( Rémi Duraffort )

git version control git at videolan.org
Tue Mar 4 19:25:17 CET 2008


vlc | branch: master | Rémi Duraffort <ivoire at via.ecp.fr> | Tue Mar  4 19:16:24 2008 +0100| [1cb7ce6dc49d1be7a1659341caa782ffd763903b]

Last patch to close #1479 (add a column with the track id)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1cb7ce6dc49d1be7a1659341caa782ffd763903b
---

 include/vlc_meta.h                                 |    3 ++-
 .../gui/qt4/components/playlist/playlist_item.cpp  |    7 +++++++
 .../gui/qt4/components/playlist/playlist_model.cpp |    6 ++++++
 .../gui/qt4/components/playlist/standardpanel.cpp  |    1 +
 src/playlist/sort.c                                |    4 ++++
 5 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/include/vlc_meta.h b/include/vlc_meta.h
index 8a8ec79..5949aff 100644
--- a/include/vlc_meta.h
+++ b/include/vlc_meta.h
@@ -206,8 +206,9 @@ struct meta_export_t
 #define VLC_META_ENGINE_DATE            0x00000200
 #define VLC_META_ENGINE_URL             0x00000400
 #define VLC_META_ENGINE_LANGUAGE        0x00000800
+#define VLC_META_ENGINE_TRACKID         0x00001000
 
-#define VLC_META_ENGINE_ART_URL         0x00001000
+#define VLC_META_ENGINE_ART_URL         0x00002000
 
 #if 0 /* unused (yet?) */
 #define VLC_META_ENGINE_MB_ARTIST_ID    0x00002000
diff --git a/modules/gui/qt4/components/playlist/playlist_item.cpp b/modules/gui/qt4/components/playlist/playlist_item.cpp
index 06c1a67..32aa4a7 100644
--- a/modules/gui/qt4/components/playlist/playlist_item.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_item.cpp
@@ -139,6 +139,9 @@ void PLItem::updateColumnHeaders()
             case VLC_META_ENGINE_RATING:
                 item_col_strings.append( qtr( VLC_META_RATING ) );
                 break;
+            case VLC_META_ENGINE_TRACKID:
+                item_col_strings.append( qtr( VLC_META_TRACKID ) );
+                break;
             default:
                 break;
             }
@@ -257,6 +260,10 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
                 break;
             case VLC_META_ENGINE_RATING:
                 ADD_META( p_item, Rating );
+                break;
+            case VLC_META_ENGINE_TRACKID:
+                item_col_strings.append( QString::number( p_item->i_id ) );
+                break;
             default:
                 break;
             }
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 53d73d2..d1ab172 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -736,6 +736,7 @@ void PLModel::sort( int column, Qt::SortOrder order )
     CHECK_COLUMN( SEQ_NUM );
     CHECK_COLUMN( DESCRIPTION );
     CHECK_COLUMN( RATING );
+    CHECK_COLUMN( TRACKID );
 
 #undef CHECK_COLUMN;
 
@@ -756,6 +757,7 @@ next:
         case VLC_META_ENGINE_SEQ_NUM:    i_mode = SORT_TRACK_NUMBER;     break;
         case VLC_META_ENGINE_DESCRIPTION:i_mode = SORT_DESCRIPTION;      break;
         case VLC_META_ENGINE_RATING:     i_mode = SORT_RATING;           break;
+        case VLC_META_ENGINE_TRACKID:    i_mode = SORT_ID;               break;
         default:                         i_mode = SORT_TITLE_NODES_FIRST;break;
         }
         if( p_root )
@@ -847,6 +849,10 @@ void PLModel::viewchanged( int meta )
             index=6; break;
         case VLC_META_ENGINE_DESCRIPTION:
             index=7; break;
+        case VLC_META_ENGINE_RATING:
+            index=8; break;
+        case VLC_META_ENGINE_TRACKID:
+            index=9; break;
         default:
             break;
         }
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index aa57a9c..058a533 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -282,6 +282,7 @@ void StandardPLPanel::popupSelectColumn( QPoint pos )
     ADD_META_ACTION( SEQ_NUM );
     ADD_META_ACTION( DESCRIPTION );
     ADD_META_ACTION( RATING );
+    ADD_META_ACTION( TRACKID );
 
 #undef ADD_META_ACTION
 
diff --git a/src/playlist/sort.c b/src/playlist/sort.c
index 620f3d6..7478f1e 100644
--- a/src/playlist/sort.c
+++ b/src/playlist/sort.c
@@ -199,6 +199,10 @@ static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
             {
                 DO_META_SORT( Rating );
             }
+            else if( i_mode == SORT_ID )
+            {
+                i_test = pp_items[i]->i_id - pp_items[i_small]->i_id;
+            }
             else if( i_mode == SORT_TITLE_NODES_FIRST )
             {
                 /* Alphabetic sort, all nodes first */




More information about the vlc-devel mailing list