Add ability to delete songs from disk at the song selection screen (Ctrl+Backspace)
This commit is contained in:
+25
-3
@@ -423,16 +423,38 @@ void SongManager::FreeSongs()
|
||||
for( unsigned i=0; i<m_pSongs.size(); i++ )
|
||||
SAFE_DELETE( m_pSongs[i] );
|
||||
m_pSongs.clear();
|
||||
m_mapSongGroupIndex.clear();
|
||||
|
||||
// wait why is it cleared twice? -aj
|
||||
// also free the songs that have been deleted from disk
|
||||
for ( unsigned i=0; i<m_pDeletedSongs.size(); ++i )
|
||||
SAFE_DELETE( m_pDeletedSongs[i] );
|
||||
m_pDeletedSongs.clear();
|
||||
|
||||
m_mapSongGroupIndex.clear();
|
||||
m_sSongGroupBannerPaths.clear();
|
||||
//m_sSongGroupBackgroundPaths.clear(); // when in Rome... -aj
|
||||
|
||||
m_pPopularSongs.clear();
|
||||
m_pShuffledSongs.clear();
|
||||
}
|
||||
|
||||
void SongManager::UnlistSong(Song *song)
|
||||
{
|
||||
// cannot immediately free song data, as it is needed temporarily for smooth audio transitions, etc.
|
||||
// Instead, remove it from the m_pSongs list and store it in a special place where it can safely be deleted later.
|
||||
m_pDeletedSongs.push_back(song);
|
||||
|
||||
// remove all occurences of the song in each of our song vectors
|
||||
vector<Song*>* songVectors[3] = { &m_pSongs, &m_pPopularSongs, &m_pShuffledSongs };
|
||||
for (int songVecIdx=0; songVecIdx<3; ++songVecIdx) {
|
||||
vector<Song*>& v = *songVectors[songVecIdx];
|
||||
for (int i=0; i<v.size(); ++i) {
|
||||
if (v[i] == song) {
|
||||
v.erase(v.begin()+i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RString SongManager::GetSongGroupBannerPath( RString sSongGroup ) const
|
||||
{
|
||||
for( unsigned i = 0; i < m_sSongGroupNames.size(); ++i )
|
||||
|
||||
Reference in New Issue
Block a user