~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to modules/gui/qt4/components/playlist/sorting.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 * sorting.h : commun sorting & column display code
 
3
 ****************************************************************************
 
4
 * Copyright © 2008 the VideoLAN team
 
5
 * $Id$
 
6
 *
 
7
 * Authors: Rafaël Carré <funman@videolanorg>
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 2 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 
22
 *****************************************************************************/
 
23
 
 
24
/* You can use these numbers with | and & to determine what you want to show */
 
25
enum
 
26
{
 
27
    COLUMN_NUMBER       = 0x0001,
 
28
    COLUMN_TITLE        = 0x0002,
 
29
    COLUMN_DURATION     = 0x0004,
 
30
    COLUMN_ARTIST       = 0x0008,
 
31
    COLUMN_GENRE        = 0x0010,
 
32
    COLUMN_ALBUM        = 0x0020,
 
33
    COLUMN_TRACK_NUMBER = 0x0040,
 
34
    COLUMN_DESCRIPTION  = 0x0080,
 
35
 
 
36
    /* Add new entries here and update the COLUMN_END value*/
 
37
 
 
38
    COLUMN_END          = 0x0100
 
39
};
 
40
 
 
41
/* Return the title of a column */
 
42
static const char * psz_column_title( uint32_t i_column )
 
43
{
 
44
    switch( i_column )
 
45
    {
 
46
    case COLUMN_NUMBER:          return _("ID");
 
47
    case COLUMN_TITLE:           return VLC_META_TITLE;
 
48
    case COLUMN_DURATION:        return _("Duration");
 
49
    case COLUMN_ARTIST:          return VLC_META_ARTIST;
 
50
    case COLUMN_GENRE:           return VLC_META_GENRE;
 
51
    case COLUMN_ALBUM:           return VLC_META_ALBUM;
 
52
    case COLUMN_TRACK_NUMBER:    return VLC_META_TRACK_NUMBER;
 
53
    case COLUMN_DESCRIPTION:     return VLC_META_DESCRIPTION;
 
54
    default: abort();
 
55
    }
 
56
}
 
57
 
 
58
/* Return the meta data associated with an item for a column
 
59
 * Returned value has to be freed */
 
60
static char * psz_column_meta( input_item_t *p_item, uint32_t i_column )
 
61
{
 
62
    char *psz;
 
63
    int i_duration;
 
64
    char psz_duration[MSTRTIME_MAX_SIZE];
 
65
    switch( i_column )
 
66
    {
 
67
    case COLUMN_NUMBER:
 
68
        return NULL;
 
69
    case COLUMN_TITLE:
 
70
        psz = input_item_GetTitle( p_item );
 
71
        if( !psz )
 
72
            psz = input_item_GetName( p_item );
 
73
        return psz;
 
74
    case COLUMN_DURATION:
 
75
        i_duration = input_item_GetDuration( p_item ) / 1000000;
 
76
        secstotimestr( psz_duration, i_duration );
 
77
        return strdup( psz_duration );
 
78
    case COLUMN_ARTIST:
 
79
        return input_item_GetArtist( p_item );
 
80
    case COLUMN_GENRE:
 
81
        return input_item_GetGenre( p_item );
 
82
    case COLUMN_ALBUM:
 
83
        return input_item_GetAlbum( p_item );
 
84
    case COLUMN_TRACK_NUMBER:
 
85
        return input_item_GetTrackNum( p_item );
 
86
    case COLUMN_DESCRIPTION:
 
87
        return input_item_GetDescription( p_item );
 
88
    default:
 
89
        abort();
 
90
    }
 
91
}
 
92
 
 
93
/* Return the playlist sorting mode for a given column */
 
94
static inline int i_column_sorting( uint32_t i_column )
 
95
{
 
96
    switch( i_column )
 
97
    {
 
98
    case COLUMN_NUMBER:         return SORT_ID;
 
99
    case COLUMN_TITLE:          return SORT_TITLE_NODES_FIRST;
 
100
    case COLUMN_DURATION:       return SORT_DURATION;
 
101
    case COLUMN_ARTIST:         return SORT_ARTIST;
 
102
    case COLUMN_GENRE:          return SORT_GENRE;
 
103
    case COLUMN_ALBUM:          return SORT_ALBUM;
 
104
    case COLUMN_TRACK_NUMBER:   return SORT_TRACK_NUMBER;
 
105
    case COLUMN_DESCRIPTION:    return SORT_DESCRIPTION;
 
106
    default: abort();
 
107
    }
 
108
}