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

« back to all changes in this revision

Viewing changes to modules/gui/skins2/vars/playlist.cpp

  • 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
 
 * playlist.cpp
3
 
 *****************************************************************************
4
 
 * Copyright (C) 2003 the VideoLAN team
5
 
 * $Id: 80d77d78096018f4df4bce5d65583eeebffc03dc $
6
 
 *
7
 
 * Authors: Cyril Deguet     <asmax@via.ecp.fr>
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
 
#include <vlc/vlc.h>
25
 
 
26
 
#include "playlist.hpp"
27
 
#include "../utils/ustring.hpp"
28
 
 
29
 
Playlist::Playlist( intf_thread_t *pIntf ): VarList( pIntf )
30
 
{
31
 
    // Get the playlist VLC object
32
 
    m_pPlaylist = pIntf->p_sys->p_playlist;
33
 
 
34
 
    buildList();
35
 
}
36
 
 
37
 
 
38
 
Playlist::~Playlist()
39
 
{
40
 
}
41
 
 
42
 
 
43
 
void Playlist::delSelected()
44
 
{
45
 
    // Remove the items from the VLC playlist
46
 
    int index = 0;
47
 
    ConstIterator it;
48
 
    for( it = begin(); it != end(); it++ )
49
 
    {
50
 
        if( (*it).m_selected )
51
 
        {
52
 
            playlist_item_t *p_item = playlist_LockItemGetByPos( m_pPlaylist,
53
 
                                                                 index );
54
 
            playlist_LockDelete( m_pPlaylist, p_item->input.i_id );
55
 
        }
56
 
        else
57
 
        {
58
 
            index++;
59
 
        }
60
 
    }
61
 
 
62
 
    notify();
63
 
}
64
 
 
65
 
 
66
 
void Playlist::action( Elem_t *pItem )
67
 
{
68
 
    // Find the index of the item
69
 
    int index = 0;
70
 
    ConstIterator it;
71
 
    for( it = begin(); it != end(); it++ )
72
 
    {
73
 
        if( &*it == pItem ) break;
74
 
        index++;
75
 
    }
76
 
    // Item found ?
77
 
    if( index < size() )
78
 
    {
79
 
        playlist_Goto( m_pPlaylist, index );
80
 
    }
81
 
}
82
 
 
83
 
 
84
 
void Playlist::onChange()
85
 
{
86
 
    buildList();
87
 
    notify();
88
 
}
89
 
 
90
 
 
91
 
void Playlist::buildList()
92
 
{
93
 
    clear();
94
 
 
95
 
    vlc_mutex_lock( &m_pPlaylist->object_lock );
96
 
    for( int i = 0; i < m_pPlaylist->i_size; i++ )
97
 
    {
98
 
        // Get the name of the playlist item
99
 
        UString *pName =
100
 
            new UString( getIntf(), m_pPlaylist->pp_items[i]->input.psz_name );
101
 
        // Is it the played stream ?
102
 
        bool playing = (i == m_pPlaylist->i_index );
103
 
        // Add the item in the list
104
 
        m_list.push_back( Elem_t( UStringPtr( pName ), false, playing ) );
105
 
    }
106
 
    vlc_mutex_unlock( &m_pPlaylist->object_lock );
107
 
}
108