From 1cb7ce6dc49d1be7a1659341caa782ffd763903b Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Tue, 4 Mar 2008 19:16:24 +0100 Subject: [PATCH] Last patch to close #1479 (add a column with the track id) --- include/vlc_meta.h | 3 ++- modules/gui/qt4/components/playlist/playlist_item.cpp | 7 +++++++ modules/gui/qt4/components/playlist/playlist_model.cpp | 6 ++++++ modules/gui/qt4/components/playlist/standardpanel.cpp | 1 + src/playlist/sort.c | 4 ++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/vlc_meta.h b/include/vlc_meta.h index 8a8ec797b0..5949aff081 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 06c1a679c6..32aa4a7e4b 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 53d73d2110..d1ab172a9e 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 aa57a9c920..058a53381d 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 620f3d6b1b..7478f1eb7c 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 */ -- 2.39.2