~ubuntu-branches/ubuntu/trusty/guayadeque/trusty

« back to all changes in this revision

Viewing changes to src/ArListBox.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-02-09 13:39:39 UTC
  • mfrom: (3.1.2 maverick)
  • Revision ID: james.westby@ubuntu.com-20110209133939-w4i25g4hvsgw4yvw
Tags: 0.2.7-3
* Upload to unstable.
* Pass -Wl,--as-needed to the linker.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -------------------------------------------------------------------------------- //
2
 
//      Copyright (C) 2008-2009 J.Rios
 
2
//      Copyright (C) 2008-2010 J.Rios
3
3
//      anonbeat@gmail.com
4
4
//
5
5
//    This Program is free software; you can redistribute it and/or modify
94
94
{
95
95
    wxMenuItem * MenuItem;
96
96
 
97
 
    int SelCount = GetSelectedItems().Count();
 
97
    int SelCount = GetSelectedCount();
98
98
 
99
99
    MenuItem = new wxMenuItem( Menu, ID_ARTIST_PLAY, _( "Play" ), _( "Play current selected artists" ) );
100
 
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_playback_start ) );
 
100
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_player_tiny_light_play ) );
101
101
    Menu->Append( MenuItem );
102
102
 
103
103
    MenuItem = new wxMenuItem( Menu, ID_ARTIST_ENQUEUE, _( "Enqueue" ), _( "Add current selected artists to playlist" ) );
104
104
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_add ) );
105
105
    Menu->Append( MenuItem );
106
106
 
 
107
    MenuItem = new wxMenuItem( Menu, ID_ARTIST_ENQUEUE_ASNEXT, _( "Enqueue Next" ), _( "Add current selected artists to playlist as Next Tracks" ) );
 
108
    MenuItem->SetBitmap( guImage( guIMAGE_INDEX_add ) );
 
109
    Menu->Append( MenuItem );
 
110
 
107
111
    if( SelCount )
108
112
    {
109
113
        Menu->AppendSeparator();
188
192
                wxArrayInt AlbumList;
189
193
                m_Db->GetArtistsAlbums( Selection, &AlbumList );
190
194
                wxArrayString AlbumPaths = m_Db->GetAlbumsPaths( AlbumList );
191
 
                wxArrayString FilteredAlbumPaths;
192
195
                count = AlbumPaths.Count();
193
196
                wxString Paths = wxEmptyString;
194
197
                for( index = 0; index < count; index++ )
195
198
                {
196
 
                    wxString Path = AlbumPaths[ index ];
197
 
                    if( Path.Last() == wxT( '/' ) )
198
 
                    {
199
 
                        Path.RemoveLast();
200
 
                    }
201
 
                    Path = Path.BeforeLast( wxT( '/' ) );
202
 
                    if( FilteredAlbumPaths.Index( Path ) == wxNOT_FOUND )
203
 
                    {
204
 
                        FilteredAlbumPaths.Add( Path );
205
 
                    }
206
 
                }
207
 
                count = FilteredAlbumPaths.Count();
208
 
                for( index = 0; index < count; index++ )
209
 
                {
210
 
                    Paths += wxT( " \"" ) + FilteredAlbumPaths[ index ] + wxT( "\"" );
 
199
                    AlbumPaths[ index ].Replace( wxT( " " ), wxT( "\\ " ) );
 
200
                    Paths += wxT( " " ) + AlbumPaths[ index ];
211
201
                }
212
202
                CurCmd.Replace( wxT( "{bp}" ), Paths.Trim( false ) );
213
203
            }
278
268
    int count = GetSelectedSongs( &Songs );
279
269
    for( index = 0; index < count; index++ )
280
270
    {
281
 
       wxString FileName = Songs[ index ].m_FileName;
282
 
       FileName.Replace( wxT( "#" ), wxT( "%23" ) );
 
271
       wxString FileName = guFileDnDEncode( Songs[ index ].m_FileName );
 
272
       //FileName.Replace( wxT( "#" ), wxT( "%23" ) );
283
273
       //FileName.Replace( wxT( "%" ), wxT( "%25" ) );
284
274
       //guLogMessage( wxT( "Adding song '%s'" ), Songs[ index ].m_FileName.c_str() );
285
275
       files->AddFile( FileName );
288
278
}
289
279
 
290
280
// -------------------------------------------------------------------------------- //
 
281
int guArListBox::FindArtist( const int artistid )
 
282
{
 
283
    int Index;
 
284
    int Count = m_Items->Count();
 
285
    for( Index = 0; Index < Count; Index++ )
 
286
    {
 
287
        if( m_Items->Item( Index ).m_Id == artistid )
 
288
        {
 
289
            return Index;
 
290
        }
 
291
    }
 
292
    return wxNOT_FOUND;
 
293
}
 
294
 
 
295
// -------------------------------------------------------------------------------- //