Commit 7bc28eeb authored by Rafaël Carré's avatar Rafaël Carré

meta-data handling cleanup

Remove VLC_META_ENGINE_*
Don't use VLC_META_INFO_CAT
Avoid using input_Item{Add,Get}Info
Remove disabled code in cdda
Remove "meta fetcher":
    There was only 1 module (not) implementing it (musicbrainz)
    Reduces complexity in playlist core
Use a more consistent naming
Factorize QT4 sorting and column display code
Remove unused members
parent f864df7f
...@@ -258,12 +258,6 @@ static inline bool input_item_IsPreparsed( input_item_t *p_i ) ...@@ -258,12 +258,6 @@ static inline bool input_item_IsPreparsed( input_item_t *p_i )
return p_i->p_meta ? p_i->p_meta->i_status & ITEM_PREPARSED : false ; return p_i->p_meta ? p_i->p_meta->i_status & ITEM_PREPARSED : false ;
} }
static inline bool input_item_IsMetaFetched( input_item_t *p_i )
{
return p_i->p_meta ? p_i->p_meta->i_status & ITEM_META_FETCHED : false ;
}
static inline bool input_item_IsArtFetched( input_item_t *p_i ) static inline bool input_item_IsArtFetched( input_item_t *p_i )
{ {
return p_i->p_meta ? p_i->p_meta->i_status & ITEM_ART_FETCHED : false ; return p_i->p_meta ? p_i->p_meta->i_status & ITEM_ART_FETCHED : false ;
......
...@@ -30,11 +30,9 @@ ...@@ -30,11 +30,9 @@
#include <vlc_arrays.h> #include <vlc_arrays.h>
#define VLC_META_TYPE_COUNT 17
typedef enum vlc_meta_type_t typedef enum vlc_meta_type_t
{ {
vlc_meta_Title = 0, vlc_meta_Title,
vlc_meta_Artist, vlc_meta_Artist,
vlc_meta_Genre, vlc_meta_Genre,
vlc_meta_Copyright, vlc_meta_Copyright,
...@@ -53,14 +51,15 @@ typedef enum vlc_meta_type_t ...@@ -53,14 +51,15 @@ typedef enum vlc_meta_type_t
vlc_meta_TrackID vlc_meta_TrackID
} vlc_meta_type_t; } vlc_meta_type_t;
#define VLC_META_TYPE_COUNT 17
/* Returns a localizes string describing the meta */ /* Returns a localizes string describing the meta */
VLC_EXPORT(const char *, input_MetaTypeToLocalizedString, ( vlc_meta_type_t meta_type ) ); VLC_EXPORT(const char *, input_MetaTypeToLocalizedString, ( vlc_meta_type_t meta_type ) );
#define ITEM_PREPARSED 0x01 #define ITEM_PREPARSED 0x01
#define ITEM_META_FETCHED 0x02 #define ITEM_ARTURL_FETCHED 0x02
#define ITEM_ARTURL_FETCHED 0x04 #define ITEM_ART_FETCHED 0x04
#define ITEM_ART_FETCHED 0x08 #define ITEM_ART_NOTFOUND 0x08
#define ITEM_ART_NOTFOUND 0x10
struct vlc_meta_t struct vlc_meta_t
{ {
...@@ -69,7 +68,6 @@ struct vlc_meta_t ...@@ -69,7 +68,6 @@ struct vlc_meta_t
vlc_dictionary_t extra_tags; vlc_dictionary_t extra_tags;
int i_status; int i_status;
}; };
/* Setters for meta. /* Setters for meta.
...@@ -163,15 +161,12 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src ) ...@@ -163,15 +161,12 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
free( ppsz_all_keys ); free( ppsz_all_keys );
} }
/* Shortcuts for the AddInfo */
#define VLC_META_INFO_CAT N_("Meta-information")
#define VLC_META_TITLE input_MetaTypeToLocalizedString( vlc_meta_Title ) #define VLC_META_TITLE input_MetaTypeToLocalizedString( vlc_meta_Title )
#define VLC_META_DURATION N_( "Duration" )
#define VLC_META_ARTIST input_MetaTypeToLocalizedString( vlc_meta_Artist ) #define VLC_META_ARTIST input_MetaTypeToLocalizedString( vlc_meta_Artist )
#define VLC_META_GENRE input_MetaTypeToLocalizedString( vlc_meta_Genre ) #define VLC_META_GENRE input_MetaTypeToLocalizedString( vlc_meta_Genre )
#define VLC_META_COPYRIGHT input_MetaTypeToLocalizedString( vlc_meta_Copyright ) #define VLC_META_COPYRIGHT input_MetaTypeToLocalizedString( vlc_meta_Copyright )
#define VLC_META_COLLECTION input_MetaTypeToLocalizedString( vlc_meta_Album ) #define VLC_META_ALBUM input_MetaTypeToLocalizedString( vlc_meta_Album )
#define VLC_META_SEQ_NUM input_MetaTypeToLocalizedString( vlc_meta_TrackNumber ) #define VLC_META_TRACK_NUMBER input_MetaTypeToLocalizedString( vlc_meta_TrackNumber )
#define VLC_META_DESCRIPTION input_MetaTypeToLocalizedString( vlc_meta_Description ) #define VLC_META_DESCRIPTION input_MetaTypeToLocalizedString( vlc_meta_Description )
#define VLC_META_RATING input_MetaTypeToLocalizedString( vlc_meta_Rating ) #define VLC_META_RATING input_MetaTypeToLocalizedString( vlc_meta_Rating )
#define VLC_META_DATE input_MetaTypeToLocalizedString( vlc_meta_Date ) #define VLC_META_DATE input_MetaTypeToLocalizedString( vlc_meta_Date )
...@@ -196,43 +191,4 @@ struct meta_export_t ...@@ -196,43 +191,4 @@ struct meta_export_t
const char *psz_file; const char *psz_file;
}; };
#define VLC_META_ENGINE_TRACKID 0x00000001
#define VLC_META_ENGINE_TITLE 0x00000002
#define VLC_META_ENGINE_DURATION 0x00000004
#define VLC_META_ENGINE_ARTIST 0x00000008
#define VLC_META_ENGINE_GENRE 0x00000010
#define VLC_META_ENGINE_COPYRIGHT 0x00000020
#define VLC_META_ENGINE_COLLECTION 0x00000040
#define VLC_META_ENGINE_SEQ_NUM 0x00000080
#define VLC_META_ENGINE_DESCRIPTION 0x00000100
#define VLC_META_ENGINE_RATING 0x00000200
#define VLC_META_ENGINE_DATE 0x00000400
#define VLC_META_ENGINE_URL 0x00000800
#define VLC_META_ENGINE_LANGUAGE 0x00001000
#define VLC_META_ENGINE_ART_URL 0x00002000
#if 0 /* unused (yet?) */
#define VLC_META_ENGINE_MB_ARTIST_ID 0x00002000
#define VLC_META_ENGINE_MB_RELEASE_ID 0x00004000
#define VLC_META_ENGINE_MB_TRACK_ID 0x00008000
#define VLC_META_ENGINE_MB_TRM_ID 0x00010000
#endif
typedef struct meta_engine_sys_t meta_engine_sys_t;
struct meta_engine_t
{
VLC_COMMON_MEMBERS
module_t *p_module;
uint32_t i_mandatory; /**< Stuff which we really need to get */
uint32_t i_optional; /**< Stuff which we'd like to have */
input_item_t *p_item;
};
VLC_EXPORT(uint32_t, input_CurrentMetaFlags,( const vlc_meta_t *p_meta ) );
#endif #endif
...@@ -807,16 +807,6 @@ CDDAFormatTitle( const access_t *p_access, track_t i_track ) ...@@ -807,16 +807,6 @@ CDDAFormatTitle( const access_t *p_access, track_t i_track )
return(NULL); return(NULL);
} }
/* Adds a string-valued entry to the playlist information under "Track"
if the string is not null or the null string.
*/
#define add_playlist_track_info_str(TITLE, FIELD) \
if (FIELD && strlen(FIELD)) \
{ \
input_ItemAddInfo( &p_item->input, _("Track"), _(TITLE), \
"%s", FIELD); \
}
static playlist_item_t * static playlist_item_t *
CDDACreatePlaylistItem( const access_t *p_access, cdda_data_t *p_cdda, CDDACreatePlaylistItem( const access_t *p_access, cdda_data_t *p_cdda,
playlist_t *p_playlist, playlist_item_t *p_item, playlist_t *p_playlist, playlist_item_t *p_item,
...@@ -849,58 +839,6 @@ CDDACreatePlaylistItem( const access_t *p_access, cdda_data_t *p_cdda, ...@@ -849,58 +839,6 @@ CDDACreatePlaylistItem( const access_t *p_access, cdda_data_t *p_cdda,
return p_child; return p_child;
} }
int CDDAAddMetaToItem( access_t *p_access, cdda_data_t *p_cdda,
playlist_item_t *p_item, int i_track,
bool b_single )
{
#if 0
add_playlist_track_info_str("Source", p_cdda->psz_source);
input_ItemAddInfo( &p_item->input, _("Track"), _("Track Number"),
"%d", i_track );
if (p_cdda->p_cdtext[i_track])
{
const cdtext_t *p = p_cdda->p_cdtext[i_track];
add_playlist_track_info_str("Arranger (CD-Text)",
p->field[CDTEXT_ARRANGER]);
add_playlist_track_info_str("Composer (CD-Text)",
p->field[CDTEXT_COMPOSER]);
add_playlist_track_info_str("Genre (CD-Text)",
p->field[CDTEXT_GENRE]);
add_playlist_track_info_str("Message (CD-Text)",
p->field[CDTEXT_MESSAGE]);
add_playlist_track_info_str("Performer (CD-Text)",
p->field[CDTEXT_PERFORMER]);
add_playlist_track_info_str("Songwriter (CD-Text)",
p->field[CDTEXT_SONGWRITER]);
add_playlist_track_info_str("Title (CD-Text)",
p->field[CDTEXT_TITLE]);
}
#ifdef HAVE_LIBCDDB
if (p_cdda->b_cddb_enabled)
{
cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
i_track-p_cdda->i_first_track);
if (t)
{
if (cddb_track_get_artist(t))
add_playlist_track_info_str("Artist (CDDB)",
cddb_track_get_artist(t));
if (cddb_track_get_title(t))
add_playlist_track_info_str("Title (CDDB)",
cddb_track_get_title(t));
if (cddb_track_get_ext_data(t))
add_playlist_track_info_str("Extended information (CDDB)",
cddb_track_get_ext_data(t));
}
}
#endif /*HAVE_LIBCDDB*/
#endif
return VLC_SUCCESS;
}
/* /*
Fixes up playlist. Fixes up playlist.
*/ */
...@@ -973,7 +911,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda, ...@@ -973,7 +911,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
if( p_item ) if( p_item )
{ {
CDDAAddMetaToItem( p_access, p_cdda, p_item, i_track, false );
input_item_SetDuration( p_item->p_input, (mtime_t) i_track_frames input_item_SetDuration( p_item->p_input, (mtime_t) i_track_frames
* (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) ); * (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) );
input_item_SetURI( p_item->p_input, input_item_SetURI( p_item->p_input,
...@@ -1009,8 +946,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda, ...@@ -1009,8 +946,6 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
p_child = CDDACreatePlaylistItem( p_access, p_cdda, p_playlist, p_child = CDDACreatePlaylistItem( p_access, p_cdda, p_playlist,
p_item, p_item,
i_track ); i_track );
CDDAAddMetaToItem( p_access, p_cdda, p_child, i_track,
true );
} }
} }
......
...@@ -653,10 +653,6 @@ static void ParseVorbisComments( decoder_t *p_dec ) ...@@ -653,10 +653,6 @@ static void ParseVorbisComments( decoder_t *p_dec )
if( psz_value && ( *psz_value != '\0' ) ) if( psz_value && ( *psz_value != '\0' ) )
{ {
input_item_SetArtist( p_item, psz_value ); input_item_SetArtist( p_item, psz_value );
input_ItemAddInfo( p_item,
_(VLC_META_INFO_CAT),
_(VLC_META_ARTIST),
"%s", psz_value );
} }
} }
else if( !strcasecmp( psz_name, "title" ) ) else if( !strcasecmp( psz_name, "title" ) )
......
...@@ -983,30 +983,21 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -983,30 +983,21 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
#define p_item input_GetItem( p_sys->p_input ) #define p_item input_GetItem( p_sys->p_input )
if( !strcmp( psz_meta, "ARTIST" ) ) if( !strcmp( psz_meta, "ARTIST" ) )
{ {
psz_val = input_ItemGetInfo( p_item, psz_val = input_item_GetArtist( p_item );
_(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
} }
else if( !strcmp( psz_meta, "TITLE" ) ) else if( !strcmp( psz_meta, "TITLE" ) )
{ {
psz_val = input_ItemGetInfo( p_item, psz_val = input_item_GetTitle( p_item );
_(VLC_META_INFO_CAT), _(VLC_META_TITLE) ); if( !psz_val )
if( psz_val == NULL ) psz_val = input_item_GetName( p_item );
psz_val = strdup( p_item->psz_name );
} }
else if( !strcmp( psz_meta, "ALBUM" ) ) else if( !strcmp( psz_meta, "ALBUM" ) )
{ {
psz_val = input_ItemGetInfo( p_item, psz_val = input_item_GetAlbum( p_item );
_(VLC_META_INFO_CAT), _(VLC_META_COLLECTION) );
} }
else if( !strcmp( psz_meta, "GENRE" ) ) else if( !strcmp( psz_meta, "GENRE" ) )
{ {
psz_val = input_ItemGetInfo( p_item, psz_val = input_item_GetGenre( p_item );
_(VLC_META_INFO_CAT), _(VLC_META_GENRE) );
}
else
{
psz_val = input_ItemGetInfo( p_item,
_(VLC_META_INFO_CAT), psz_meta );
} }
#undef p_item #undef p_item
} }
......
...@@ -184,9 +184,11 @@ static int Demux( demux_t *p_demux ) ...@@ -184,9 +184,11 @@ static int Demux( demux_t *p_demux )
p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name, p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
0, NULL, i_duration ); 0, NULL, i_duration );
if ( psz_artist && *psz_artist ) if ( psz_artist && *psz_artist )
input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT), input_item_SetArtist( p_input, psz_artist );
_(VLC_META_ARTIST), "%s", psz_artist ); free( psz_artist );
input_ItemAddSubItem( p_current_input, p_input ); input_ItemAddSubItem( p_current_input, p_input );
for( unsigned i = 0; i < i_options; i++ ) for( unsigned i = 0; i < i_options; i++ )
input_ItemAddOpt( p_input, ppsz_options[i], 0 ); input_ItemAddOpt( p_input, ppsz_options[i], 0 );
......
...@@ -78,8 +78,8 @@ static VLCInfo *_o_sharedInstance = nil; ...@@ -78,8 +78,8 @@ static VLCInfo *_o_sharedInstance = nil;
/* constants defined in vlc_meta.h */ /* constants defined in vlc_meta.h */
[o_genre_lbl setStringValue: _NS(VLC_META_GENRE)]; [o_genre_lbl setStringValue: _NS(VLC_META_GENRE)];
[o_copyright_lbl setStringValue: _NS(VLC_META_COPYRIGHT)]; [o_copyright_lbl setStringValue: _NS(VLC_META_COPYRIGHT)];
[o_collection_lbl setStringValue: _NS(VLC_META_COLLECTION)]; [o_collection_lbl setStringValue: _NS(VLC_META_ALBUM)];
[o_seqNum_lbl setStringValue: _NS(VLC_META_SEQ_NUM)]; [o_seqNum_lbl setStringValue: _NS(VLC_META_TRACK_NUMBER)];
[o_description_lbl setStringValue: _NS(VLC_META_DESCRIPTION)]; [o_description_lbl setStringValue: _NS(VLC_META_DESCRIPTION)];
[o_date_lbl setStringValue: _NS(VLC_META_DATE)]; [o_date_lbl setStringValue: _NS(VLC_META_DATE)];
[o_language_lbl setStringValue: _NS(VLC_META_LANGUAGE)]; [o_language_lbl setStringValue: _NS(VLC_META_LANGUAGE)];
......
...@@ -1787,14 +1787,8 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh ) ...@@ -1787,14 +1787,8 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
/* Meta data box */ /* Meta data box */
int l = 0; int l = 0;
int i_len = strlen( VLC_META_INFO_CAT ); DrawBox( p_sys->w, y++, 0, h, COLS, _("Meta-information"),
char psz_title[i_len + 3]; p_sys->b_color );
psz_title[0] = ' ';
psz_title[1] = '\0';
strcat( &psz_title[1], VLC_META_INFO_CAT );
psz_title[i_len + 1] = ' ';
psz_title[i_len + 2] = '\0';
DrawBox( p_sys->w, y++, 0, h, COLS, psz_title, p_sys->b_color );
if( p_input ) if( p_input )
{ {
...@@ -1819,9 +1813,9 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh ) ...@@ -1819,9 +1813,9 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
case 3: case 3:
psz_meta_title = VLC_META_COPYRIGHT; break; psz_meta_title = VLC_META_COPYRIGHT; break;
case 4: case 4:
psz_meta_title = VLC_META_COLLECTION; break; psz_meta_title = VLC_META_ALBUM; break;
case 5: case 5:
psz_meta_title = VLC_META_SEQ_NUM; break; psz_meta_title = VLC_META_TRACK_NUMBER; break;
case 6: case 6:
psz_meta_title = VLC_META_DESCRIPTION; break; psz_meta_title = VLC_META_DESCRIPTION; break;
case 7: case 7:
......
...@@ -149,6 +149,7 @@ noinst_HEADERS = \ ...@@ -149,6 +149,7 @@ noinst_HEADERS = \
components/playlist/panels.hpp \ components/playlist/panels.hpp \
components/playlist/playlist.hpp \ components/playlist/playlist.hpp \
components/playlist/selector.hpp \ components/playlist/selector.hpp \
components/playlist/sorting.h \
util/input_slider.hpp \ util/input_slider.hpp \
util/customwidgets.hpp \ util/customwidgets.hpp \
util/qvlcframe.hpp \ util/qvlcframe.hpp \
......
...@@ -67,7 +67,7 @@ MetaPanel::MetaPanel( QWidget *parent, ...@@ -67,7 +67,7 @@ MetaPanel::MetaPanel( QWidget *parent,
/* Title, artist and album*/ /* Title, artist and album*/
ADD_META( VLC_META_TITLE, title_text ); /* OK */ ADD_META( VLC_META_TITLE, title_text ); /* OK */
ADD_META( VLC_META_ARTIST, artist_text ); /* OK */ ADD_META( VLC_META_ARTIST, artist_text ); /* OK */
ADD_META( VLC_META_COLLECTION, collection_text ); /* OK */ ADD_META( VLC_META_ALBUM, collection_text ); /* OK */
/* Genre Name */ /* Genre Name */
/* TODO List id3genres.h is not includable yet ? */ /* TODO List id3genres.h is not includable yet ? */
...@@ -76,7 +76,7 @@ MetaPanel::MetaPanel( QWidget *parent, ...@@ -76,7 +76,7 @@ MetaPanel::MetaPanel( QWidget *parent,
metaLayout->addWidget( genre_text, line, 1, 1, 3 ); metaLayout->addWidget( genre_text, line, 1, 1, 3 );
/* Number - on the same line */ /* Number - on the same line */
metaLayout->addWidget( new QLabel( qtr( "Track Number" ) + " :" ), metaLayout->addWidget( new QLabel( qtr( VLC_META_TRACK_NUMBER ) + " :" ),
line, 5, 1, 2 ); line, 5, 1, 2 );
seqnum_text = new QLineEdit; seqnum_text = new QLineEdit;
seqnum_text->setInputMask("0000"); seqnum_text->setInputMask("0000");
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include <QSettings> #include <QSettings>
#include "sorting.h"
/************************************************************************* /*************************************************************************
* Playlist item implementation * Playlist item implementation
*************************************************************************/ *************************************************************************/
...@@ -109,40 +111,12 @@ void PLItem::updateColumnHeaders() ...@@ -109,40 +111,12 @@ void PLItem::updateColumnHeaders()
{ {
item_col_strings.clear(); item_col_strings.clear();
for( int i_index=1; i_index <= VLC_META_ENGINE_ART_URL; i_index *= 2 ) assert( i_showflags < COLUMN_END );
for( uint32_t i_index=1; i_index < COLUMN_END; i_index <<= 1 )
{ {
if( i_showflags & i_index ) if( i_showflags & i_index )
{ item_col_strings.append( psz_column_title( i_index ) );
switch( i_index )
{
case VLC_META_ENGINE_TRACKID:
item_col_strings.append( qtr( VLC_META_TRACKID ) );
break;
case VLC_META_ENGINE_ARTIST:
item_col_strings.append( qtr( VLC_META_ARTIST ) );
break;
case VLC_META_ENGINE_TITLE:
item_col_strings.append( qtr( VLC_META_TITLE ) );
break;
case VLC_META_ENGINE_DESCRIPTION:
item_col_strings.append( qtr( VLC_META_DESCRIPTION ) );
break;
case VLC_META_ENGINE_DURATION:
item_col_strings.append( qtr( VLC_META_DURATION ) );
break;
case VLC_META_ENGINE_GENRE:
item_col_strings.append( qtr( VLC_META_GENRE ) );
break;
case VLC_META_ENGINE_COLLECTION:
item_col_strings.append( qtr( VLC_META_COLLECTION ) );
break;
case VLC_META_ENGINE_SEQ_NUM:
item_col_strings.append( qtr( VLC_META_SEQ_NUM ) );
break;
default:
break;
}
}
} }
} }
...@@ -206,63 +180,15 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent ) ...@@ -206,63 +180,15 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
return; return;
} }
#define ADD_META( item, meta ) \ assert( parentItem->i_showflags < COLUMN_END );
psz_meta = input_item_Get ## meta ( item->p_input ); \
item_col_strings.append( qfu( psz_meta ) ); \
free( psz_meta );
for( int i_index=1; i_index <= VLC_META_ENGINE_ART_URL; i_index *= 2 ) for( uint32_t i_index=1; i_index < COLUMN_END; i_index <<= 1 )
{ {
if( parentItem->i_showflags & i_index ) if( parentItem->i_showflags & i_index )
{ {
switch( i_index ) char *psz = psz_column_meta( p_item->p_input, i_index );
{ item_col_strings.append( psz );
case VLC_META_ENGINE_ARTIST: free( psz );
ADD_META( p_item, Artist );
break;
case VLC_META_ENGINE_TITLE:
char *psz_title;
psz_title = input_item_GetTitle( p_item->p_input );
if( psz_title )
{
ADD_META( p_item, Title );
free( psz_title );
}
else
{
psz_title = input_item_GetName( p_item->p_input );
if( psz_title )
{
item_col_strings.append( qfu( psz_title ) );
}
free( psz_title );
}
break;
case VLC_META_ENGINE_DESCRIPTION:
ADD_META( p_item, Description );
break;
case VLC_META_ENGINE_DURATION:
secstotimestr( psz_duration,
input_item_GetDuration( p_item->p_input ) / 1000000 );
item_col_strings.append( QString( psz_duration ) );
break;
case VLC_META_ENGINE_GENRE:
ADD_META( p_item, Genre );
break;
case VLC_META_ENGINE_COLLECTION:
ADD_META( p_item, Album );
break;
case VLC_META_ENGINE_SEQ_NUM:
ADD_META( p_item, TrackNum );
break;
case VLC_META_ENGINE_TRACKID:
item_col_strings.append( QString::number( p_item->i_id ) );
break;
default:
break;
}
} }
} }
#undef ADD_META
} }
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include <QApplication> #include <QApplication>
#include <QSettings> #include <QSettings>
#include "sorting.h"
QIcon PLModel::icons[ITEM_TYPE_NUMBER]; QIcon PLModel::icons[ITEM_TYPE_NUMBER];
static int PlaylistChanged( vlc_object_t *, const char *, static int PlaylistChanged( vlc_object_t *, const char *,
...@@ -72,8 +74,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */ ...@@ -72,8 +74,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
assert( i_depth == DEPTH_SEL || i_depth == DEPTH_PL ); assert( i_depth == DEPTH_SEL || i_depth == DEPTH_PL );
p_intf = _p_intf; p_intf = _p_intf;
p_playlist = _p_playlist; p_playlist = _p_playlist;
i_items_to_append = 0;
b_need_update = false;
i_cached_id = -1; i_cached_id = -1;
i_cached_input_id = -1; i_cached_input_id = -1;
i_popup_item = i_popup_parent = -1; i_popup_item = i_popup_parent = -1;
...@@ -539,8 +539,6 @@ void PLModel::ProcessItemAppend( playlist_add_t *p_add ) ...@@ -539,8 +539,6 @@ void PLModel::ProcessItemAppend( playlist_add_t *p_add )
{ {
playlist_item_t *p_item = NULL; playlist_item_t *p_item = NULL;
PLItem *newItem = NULL; PLItem *newItem = NULL;
i_items_to_append--;
if( b_need_update ) return;
PLItem *nodeItem = FindById( rootItem, p_add->i_node ); PLItem *nodeItem = FindById( rootItem, p_add->i_node );
PL_LOCK; PL_LOCK;
...@@ -719,23 +717,23 @@ void PLModel::sort( int column, Qt::SortOrder order ) ...@@ -719,23 +717,23 @@ void PLModel::sort( int column, Qt::SortOrder order )
#define CHECK_COLUMN( meta ) \ #define CHECK_COLUMN( meta ) \
{ \ { \
if( ( shownFlags() & VLC_META_ENGINE_##meta ) ) \ if( ( shownFlags() & meta ) ) \
i_index++; \ i_index++; \
if( column == i_index ) \ if( column == i_index ) \
{ \ { \
i_flag = VLC_META_ENGINE_##meta; \ i_flag = meta; \
goto next; \ goto next; \
} \ } \
} }
CHECK_COLUMN( TRACKID ); CHECK_COLUMN( COLUMN_NUMBER );
CHECK_COLUMN( TITLE ); CHECK_COLUMN( COLUMN_TITLE );
CHECK_COLUMN( DURATION ); CHECK_COLUMN( COLUMN_DURATION );
CHECK_COLUMN( ARTIST ); CHECK_COLUMN( COLUMN_ARTIST );
CHECK_COLUMN( GENRE ); CHECK_COLUMN( COLUMN_GENRE );
CHECK_COLUMN( COLLECTION ); CHECK_COLUMN( COLUMN_ALBUM );
CHECK_COLUMN( SEQ_NUM ); CHECK_COLUMN( COLUMN_TRACK_NUMBER );
CHECK_COLUMN( DESCRIPTION ); CHECK_COLUMN( COLUMN_DESCRIPTION );
#undef CHECK_COLUMN #undef CHECK_COLUMN
...@@ -745,22 +743,10 @@ next: ...@@ -745,22 +743,10 @@ next:
playlist_item_t *p_root = playlist_ItemGetById( p_playlist, playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
rootItem->i_id, rootItem->i_id,
true ); true );
int i_mode;
switch( i_flag )
{
case VLC_META_ENGINE_TRACKID: i_mode = SORT_ID; break;
case VLC_META_ENGINE_TITLE: i_mode = SORT_TITLE_NODES_FIRST;break;
case VLC_META_ENGINE_DURATION: i_mode = SORT_DURATION; break;
case VLC_META_ENGINE_ARTIST: i_mode = SORT_ARTIST; break;
case VLC_META_ENGINE_GENRE: i_mode = SORT_GENRE; break;
case VLC_META_ENGINE_COLLECTION: i_mode = SORT_ALBUM; break;
case VLC_META_ENGINE_SEQ_NUM: i_mode = SORT_TRACK_NUMBER; break;
case VLC_META_ENGINE_DESCRIPTION:i_mode = SORT_DESCRIPTION; break;
default: i_mode = SORT_TITLE_NODES_FIRST;break;
}
if( p_root ) if( p_root )
{ {
playlist_RecursiveNodeSort( p_playlist, p_root, i_mode, playlist_RecursiveNodeSort( p_playlist, p_root,
i_column_sorting( i_flag ),
order == Qt::AscendingOrder ? order == Qt::AscendingOrder ?
ORDER_NORMAL : ORDER_REVERSE ); ORDER_NORMAL : ORDER_REVERSE );
p_playlist->b_reset_currently_playing = true; p_playlist->b_reset_currently_playing = true;
...@@ -826,32 +812,16 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list ) ...@@ -826,32 +812,16 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
void PLModel::viewchanged( int meta ) void PLModel::viewchanged( int meta )
{ {
assert( meta );
if( rootItem ) if( rootItem )
{ {
int index=0; int index=-1;
switch( meta ) while( meta )
{ {
case VLC_META_ENGINE_TRACKID: index++;
index=0; break; meta >>= 1;
case VLC_META_ENGINE_TITLE:
index=1; break;
case VLC_META_ENGINE_DURATION:
index=2; break;
case VLC_META_ENGINE_ARTIST:
index=3; break;
case VLC_META_ENGINE_GENRE:
index=4; break;
case VLC_META_ENGINE_COPYRIGHT: