display progress for song loading
This commit is contained in:
+23
-1
@@ -238,10 +238,15 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
|
|||||||
StripCvsAndSvn( arrayGroupDirs );
|
StripCvsAndSvn( arrayGroupDirs );
|
||||||
StripMacResourceForks( arrayGroupDirs );
|
StripMacResourceForks( arrayGroupDirs );
|
||||||
|
|
||||||
|
vector< vector<RString> > arrayGroupSongDirs;
|
||||||
|
int groupIndex, songCount, songIndex;
|
||||||
|
|
||||||
|
groupIndex = 0;
|
||||||
|
songCount = 0;
|
||||||
FOREACH_CONST( RString, arrayGroupDirs, s ) // foreach dir in /Songs/
|
FOREACH_CONST( RString, arrayGroupDirs, s ) // foreach dir in /Songs/
|
||||||
{
|
{
|
||||||
RString sGroupDirName = *s;
|
|
||||||
|
|
||||||
|
RString sGroupDirName = *s;
|
||||||
SanityCheckGroupDir(sDir+sGroupDirName);
|
SanityCheckGroupDir(sDir+sGroupDirName);
|
||||||
|
|
||||||
// Find all Song folders in this group directory
|
// Find all Song folders in this group directory
|
||||||
@@ -251,6 +256,21 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
|
|||||||
StripMacResourceForks( arraySongDirs );
|
StripMacResourceForks( arraySongDirs );
|
||||||
SortRStringArray( arraySongDirs );
|
SortRStringArray( arraySongDirs );
|
||||||
|
|
||||||
|
arrayGroupSongDirs.push_back(arraySongDirs);
|
||||||
|
songCount += arraySongDirs.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pLoadingWindow )
|
||||||
|
pLoadingWindow->SetTotalWork( songCount );
|
||||||
|
|
||||||
|
groupIndex = 0;
|
||||||
|
songIndex = 0;
|
||||||
|
FOREACH_CONST( RString, arrayGroupDirs, s ) // foreach dir in /Songs/
|
||||||
|
{
|
||||||
|
RString sGroupDirName = *s;
|
||||||
|
vector<RString> &arraySongDirs = arrayGroupSongDirs[groupIndex++];
|
||||||
|
|
||||||
LOG->Trace("Attempting to load %i songs from \"%s\"", int(arraySongDirs.size()),
|
LOG->Trace("Attempting to load %i songs from \"%s\"", int(arraySongDirs.size()),
|
||||||
(sDir+sGroupDirName).c_str() );
|
(sDir+sGroupDirName).c_str() );
|
||||||
int loaded = 0;
|
int loaded = 0;
|
||||||
@@ -264,6 +284,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
|
|||||||
// this is a song directory. Load a new song.
|
// this is a song directory. Load a new song.
|
||||||
if( pLoadingWindow )
|
if( pLoadingWindow )
|
||||||
{
|
{
|
||||||
|
pLoadingWindow->SetProgress(songIndex);
|
||||||
pLoadingWindow->SetText( LOADING_SONGS.GetValue()+ssprintf("\n%s\n%s",
|
pLoadingWindow->SetText( LOADING_SONGS.GetValue()+ssprintf("\n%s\n%s",
|
||||||
Basename(sGroupDirName).c_str(),
|
Basename(sGroupDirName).c_str(),
|
||||||
Basename(sSongDirName).c_str()));
|
Basename(sSongDirName).c_str()));
|
||||||
@@ -279,6 +300,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
|
|||||||
m_pSongs.push_back( pNewSong );
|
m_pSongs.push_back( pNewSong );
|
||||||
index_entry.push_back( pNewSong );
|
index_entry.push_back( pNewSong );
|
||||||
loaded++;
|
loaded++;
|
||||||
|
songIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG->Trace("Loaded %i songs from \"%s\"", loaded, (sDir+sGroupDirName).c_str() );
|
LOG->Trace("Loaded %i songs from \"%s\"", loaded, (sDir+sGroupDirName).c_str() );
|
||||||
|
|||||||
Reference in New Issue
Block a user