Add support for incremental updates to ScreenReloadSongs

This commit is contained in:
Martin Natano
2022-06-10 19:33:23 +02:00
parent 49127f6a92
commit f60707b506
7 changed files with 103 additions and 24 deletions
+37 -10
View File
@@ -35,7 +35,13 @@ public:
SongManager();
~SongManager();
void InitSongsFromDisk( LoadingWindow *ld );
/**
* @brief Initialize all songs from disk
* @param ld the loading window to be updated, or nullptr
* @param onlyAdditions only load songs added after the last
* invocation of this function
*/
void InitSongsFromDisk( LoadingWindow *ld, bool onlyAdditions );
void FreeSongs();
void UnlistSong(Song *song);
void Cleanup();
@@ -54,7 +60,13 @@ public:
void LoadGroupSymLinks( RString sDir, RString sGroupFolder );
void InitCoursesFromDisk( LoadingWindow *ld );
/**
* @brief Initialize all courses from disk
* @param ld the loading window to be updated, or nullptr
* @param onlyAdditions only load courses added after the last
* invocation of this function
*/
void InitCoursesFromDisk( LoadingWindow *ld, bool onlyAdditions );
void InitAutogenCourses();
void InitRandomAttacks();
void FreeCourses();
@@ -64,8 +76,16 @@ public:
void DeleteAutogenCourses();
void InvalidateCachedTrails();
void InitAll( LoadingWindow *ld ); // songs, courses, groups - everything.
void Reload( LoadingWindow *ld=nullptr ); // songs, courses, groups - everything.
/**
* @brief Initialize all songs and courses from disk, and update
* autogenerated courses afterwards
* @param ld the loading window to be updated, or nullptr
* @param onlyAdditions only load songs and courses added after the
* last invocation of this function
*/
void InitAll( LoadingWindow *ld, bool onlyAdditions );
void Reload( LoadingWindow *ld=nullptr );
void LoadAdditions( LoadingWindow *ld=nullptr );
void PreloadSongImages();
bool IsGroupNeverCached(const RString& group) const;
@@ -169,8 +189,14 @@ public:
void PushSelf( lua_State *L );
protected:
void LoadStepManiaSongDir( RString sDir, LoadingWindow *ld );
void LoadDWISongDir( RString sDir );
/**
* @brief Load all songs from a directory
* @param sDir the directory to be loaded
* @param ld the loading window to be updated, or nullptr
* @param onlyAdditions only load songs added after the last
* invocation of this function
*/
void LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditions );
bool GetExtraStageInfoFromCourse( bool bExtra2, RString sPreferredGroup, Song*& pSongOut, Steps*& pStepsOut, StepsType stype );
void SanityCheckGroupDir( RString sDir ) const;
void AddGroup( RString sDir, RString sGroupDirName );
@@ -181,12 +207,13 @@ protected:
vector<Song*> m_pSongs;
map<RString, Song*> m_SongsByDir;
set<RString> m_GroupsToNeverCache;
/** @brief Hold pointers to all the songs that have been deleted from disk but must at least be kept temporarily alive for smooth audio transitions. */
vector<Song*> m_pDeletedSongs;
vector<Song*> m_pDeletedSongs;
/** @brief The most popular songs ranked by number of plays. */
vector<Song*> m_pPopularSongs;
//vector<Song*> m_pRecentSongs; // songs recently played on the machine
vector<Song*> m_pShuffledSongs; // used by GetRandomSong
vector<Song*> m_pPopularSongs;
vector<Song*> m_pShuffledSongs; // used by GetRandomSong
struct PreferredSortSection
{
RString sName;