Use the Translit field from Group.ini, Migrate Banner code to Group class
This commit is contained in:
+98
-22
@@ -33,47 +33,123 @@ Group::~Group() {
|
|||||||
SONGMAN->GetGroupGroupMap().clear();
|
SONGMAN->GetGroupGroupMap().clear();
|
||||||
m_sCredits.clear();
|
m_sCredits.clear();
|
||||||
}
|
}
|
||||||
Group::Group(const RString &sPath) {
|
|
||||||
RString sGroupIniPath = sPath + "/Group.ini";
|
Group::Group(const RString sDir, const RString &sGroupDirName) {
|
||||||
|
RString sGroupIniPath = sDir + sGroupDirName + "/Group.ini";
|
||||||
RString credits = "";
|
RString credits = "";
|
||||||
|
RString sDisplayTitle = sGroupDirName;
|
||||||
|
RString SortTitle = sGroupDirName;
|
||||||
|
RString TranslitTitle = "";
|
||||||
|
RString Series = "";
|
||||||
|
RString bannerPath = "";
|
||||||
|
RString authorsNotes = "";
|
||||||
|
float fOffset = 0;
|
||||||
|
|
||||||
if (FILEMAN->DoesFileExist(sGroupIniPath)) {
|
if (FILEMAN->DoesFileExist(sGroupIniPath)) {
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
ini.ReadFile( sGroupIniPath );
|
ini.ReadFile( sGroupIniPath );
|
||||||
ini.GetValue("Group", "DisplayTitle", m_sDisplayTitle);
|
ini.GetValue( "Group", "DisplayTitle", sDisplayTitle );
|
||||||
if (m_sDisplayTitle.empty()) {
|
if (sDisplayTitle.empty()) {
|
||||||
m_sDisplayTitle = m_sGroupName;
|
sDisplayTitle = Basename(sGroupDirName);
|
||||||
}
|
}
|
||||||
ini.GetValue("Group", "Banner", m_sBannerPath);
|
ini.GetValue( "Group", "Banner", bannerPath );
|
||||||
ini.GetValue("Group", "SortTitle", m_sSortTitle);
|
ini.GetValue( "Group", "SortTitle", SortTitle );
|
||||||
if (m_sSortTitle.empty()) {
|
if (SortTitle.empty()) {
|
||||||
m_sSortTitle = m_sDisplayTitle;
|
SortTitle = sDisplayTitle;
|
||||||
}
|
}
|
||||||
ini.GetValue("Group", "TranslitTitle", m_sTranslitTitle);
|
ini.GetValue( "Group", "TranslitTitle", TranslitTitle );
|
||||||
if (m_sTranslitTitle.empty()) {
|
if (TranslitTitle.empty()) {
|
||||||
m_sTranslitTitle = m_sDisplayTitle;
|
TranslitTitle = sDisplayTitle;
|
||||||
}
|
}
|
||||||
ini.GetValue("Group", "Series", m_sSeries);
|
ini.GetValue( "Group", "Series", Series );
|
||||||
RString sValue = "";
|
RString sValue = "";
|
||||||
|
|
||||||
ini.GetValue("Group", "SyncOffset", sValue);
|
ini.GetValue("Group", "SyncOffset", sValue);
|
||||||
if (sValue.CompareNoCase("null") == 0) {
|
if (sValue.CompareNoCase("null") == 0) {
|
||||||
m_iSyncOffset = 0;
|
fOffset = 0;
|
||||||
} else if (sValue.CompareNoCase("itg") == 0) {
|
} else if (sValue.CompareNoCase("itg") == 0) {
|
||||||
m_iSyncOffset = 0.009f;
|
fOffset = 0.009f;
|
||||||
} else {
|
} else {
|
||||||
m_iSyncOffset = StringToFloat(sValue);
|
fOffset = StringToFloat(sValue);
|
||||||
}
|
}
|
||||||
ini.GetValue("Group", "Year", m_iYearReleased);
|
ini.GetValue("Group", "Year", m_iYearReleased);
|
||||||
ini.GetValue("Group", "AuthorsNotes", m_sAuthorsNotes);
|
|
||||||
|
|
||||||
std::vector<RString> credits_vector;
|
|
||||||
ini.GetValue( "Group", "Credits", credits );
|
ini.GetValue( "Group", "Credits", credits );
|
||||||
split(credits, ";", credits_vector);
|
ini.GetValue( "Group", "AuthorsNotes", authorsNotes );
|
||||||
m_sCredits = credits_vector;
|
|
||||||
m_bHasGroupIni = true;
|
|
||||||
} else {
|
} else {
|
||||||
m_bHasGroupIni = false;
|
m_bHasGroupIni = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Look for a group banner in this group folder
|
||||||
|
std::vector<RString> arrayGroupBanners;
|
||||||
|
|
||||||
|
// First check if there is a banner provided in group.ini
|
||||||
|
if( bannerPath != "" )
|
||||||
|
{
|
||||||
|
GetDirListing( sDir+sGroupDirName+"/"+bannerPath, arrayGroupBanners );
|
||||||
|
}
|
||||||
|
GetDirListing( sDir+sGroupDirName+"/*.png", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"/*.jpg", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"/*.jpeg", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"/*.gif", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"/*.bmp", arrayGroupBanners );
|
||||||
|
|
||||||
|
if( !arrayGroupBanners.empty() ) {
|
||||||
|
m_sBannerPath = sDir+sGroupDirName+"/"+arrayGroupBanners[0] ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Look for a group banner in the parent folder
|
||||||
|
GetDirListing( sDir+sGroupDirName+".png", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+".jpg", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+".jpeg", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+".gif", arrayGroupBanners );
|
||||||
|
GetDirListing( sDir+sGroupDirName+".bmp", arrayGroupBanners );
|
||||||
|
if( !arrayGroupBanners.empty() )
|
||||||
|
m_sBannerPath = sDir+arrayGroupBanners[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Other group graphics are a bit trickier, and usually don't exist.
|
||||||
|
* A themer has a few options, namely checking the aspect ratio and
|
||||||
|
* operating on it. -aj
|
||||||
|
* TODO: Once the files are implemented in Song, bring the extensions
|
||||||
|
* from there into here. -aj */
|
||||||
|
// Group background
|
||||||
|
|
||||||
|
//vector<RString> arrayGroupBackgrounds;
|
||||||
|
//GetDirListing( sDir+sGroupDirName+"/*-bg.png", arrayGroupBanners );
|
||||||
|
//GetDirListing( sDir+sGroupDirName+"/*-bg.jpg", arrayGroupBanners );
|
||||||
|
//GetDirListing( sDir+sGroupDirName+"/*-bg.jpeg", arrayGroupBanners );
|
||||||
|
//GetDirListing( sDir+sGroupDirName+"/*-bg.gif", arrayGroupBanners );
|
||||||
|
//GetDirListing( sDir+sGroupDirName+"/*-bg.bmp", arrayGroupBanners );
|
||||||
|
/*
|
||||||
|
RString sBackgroundPath;
|
||||||
|
if( !arrayGroupBackgrounds.empty() )
|
||||||
|
sBackgroundPath = sDir+sGroupDirName+"/"+arrayGroupBackgrounds[0];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Look for a group background in the parent folder
|
||||||
|
GetDirListing( sDir+sGroupDirName+"-bg.png", arrayGroupBackgrounds );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"-bg.jpg", arrayGroupBackgrounds );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"-bg.jpeg", arrayGroupBackgrounds );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"-bg.gif", arrayGroupBackgrounds );
|
||||||
|
GetDirListing( sDir+sGroupDirName+"-bg.bmp", arrayGroupBackgrounds );
|
||||||
|
if( !arrayGroupBackgrounds.empty() )
|
||||||
|
sBackgroundPath = sDir+arrayGroupBackgrounds[0];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
m_sDisplayTitle = sDisplayTitle;
|
||||||
|
m_sSortTitle = SortTitle;
|
||||||
|
m_sTranslitTitle = TranslitTitle;
|
||||||
|
m_sSeries = Series;
|
||||||
|
m_sPath = sDir + sGroupDirName;
|
||||||
|
m_sGroupName = sGroupDirName;
|
||||||
|
std::vector<RString> credits_vector;
|
||||||
|
split(credits, ";", credits_vector);
|
||||||
|
m_sCredits = credits_vector;
|
||||||
|
m_sAuthorsNotes = authorsNotes;
|
||||||
|
m_iSyncOffset = fOffset;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Song *> &Group::GetSongs() const
|
const std::vector<Song *> &Group::GetSongs() const
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ class Group
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Group();
|
Group();
|
||||||
Group( const RString &sPath);
|
Group( const RString sDir, const RString &sGroupDirName);
|
||||||
~Group();
|
~Group();
|
||||||
// Lua
|
// Lua
|
||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
|
|||||||
+1
-1
@@ -758,7 +758,7 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
|||||||
Group* pGroup = pSong->GetGroup();
|
Group* pGroup = pSong->GetGroup();
|
||||||
if( bUseSections )
|
if( bUseSections )
|
||||||
{
|
{
|
||||||
RString sThisSection = pSong->GetGroup()->GetSortTitle();
|
RString sThisSection = pGroup->GetGroupName();
|
||||||
|
|
||||||
if( sThisSection != sLastSection )
|
if( sThisSection != sLastSection )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -226,10 +226,14 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
|
|||||||
sDisplayName = SONGMAN->ShortenGroupName(pWID->m_sText);
|
sDisplayName = SONGMAN->ShortenGroupName(pWID->m_sText);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( pWID->m_pGroup->GetSeries().empty() )
|
if ( pWID->m_pGroup->GetSeries().empty() ) {
|
||||||
sDisplayName = SONGMAN->ShortenGroupName(pWID->m_sText);
|
sDisplayName = SONGMAN->ShortenGroupName(pWID->m_sText);
|
||||||
else
|
sTranslitName = SONGMAN->ShortenGroupName(pWID->m_pGroup->GetTranslitTitle());
|
||||||
|
}
|
||||||
|
else {
|
||||||
sDisplayName = SONGMAN->ShortenGroupName("[" + pWID->m_pGroup->GetSeries() +"] " + pWID->m_pGroup->GetDisplayTitle());
|
sDisplayName = SONGMAN->ShortenGroupName("[" + pWID->m_pGroup->GetSeries() +"] " + pWID->m_pGroup->GetDisplayTitle());
|
||||||
|
sTranslitName = SONGMAN->ShortenGroupName("[" + pWID->m_pGroup->GetSeries() +"] " + pWID->m_pGroup->GetTranslitTitle());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( GAMESTATE->sExpandedSectionName == pWID->m_sText )
|
if( GAMESTATE->sExpandedSectionName == pWID->m_sText )
|
||||||
type = MusicWheelItemType_SectionExpanded;
|
type = MusicWheelItemType_SectionExpanded;
|
||||||
|
|||||||
+2
-61
@@ -279,65 +279,6 @@ void SongManager::AddGroup( RString sDir, RString sGroupDirName, Group* group )
|
|||||||
if( j != m_sSongGroupNames.size() )
|
if( j != m_sSongGroupNames.size() )
|
||||||
return; // the group is already added
|
return; // the group is already added
|
||||||
|
|
||||||
RString sBannerPath;
|
|
||||||
|
|
||||||
// Look for a group banner in this group folder
|
|
||||||
std::vector<RString> arrayGroupBanners;
|
|
||||||
|
|
||||||
// First check if there is a banner provided in group.ini
|
|
||||||
if( group->GetBannerPath() != "" )
|
|
||||||
{
|
|
||||||
GetDirListing( sDir+sGroupDirName+"/"+group->GetBannerPath(), arrayGroupBanners );
|
|
||||||
}
|
|
||||||
GetDirListing( sDir+sGroupDirName+"/*.png", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"/*.jpg", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"/*.jpeg", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"/*.gif", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"/*.bmp", arrayGroupBanners );
|
|
||||||
|
|
||||||
if( !arrayGroupBanners.empty() )
|
|
||||||
sBannerPath = sDir+sGroupDirName+"/"+arrayGroupBanners[0] ;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Look for a group banner in the parent folder
|
|
||||||
GetDirListing( sDir+sGroupDirName+".png", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+".jpg", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+".jpeg", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+".gif", arrayGroupBanners );
|
|
||||||
GetDirListing( sDir+sGroupDirName+".bmp", arrayGroupBanners );
|
|
||||||
if( !arrayGroupBanners.empty() )
|
|
||||||
sBannerPath = sDir+arrayGroupBanners[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Other group graphics are a bit trickier, and usually don't exist.
|
|
||||||
* A themer has a few options, namely checking the aspect ratio and
|
|
||||||
* operating on it. -aj
|
|
||||||
* TODO: Once the files are implemented in Song, bring the extensions
|
|
||||||
* from there into here. -aj */
|
|
||||||
// Group background
|
|
||||||
|
|
||||||
//vector<RString> arrayGroupBackgrounds;
|
|
||||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.png", arrayGroupBanners );
|
|
||||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.jpg", arrayGroupBanners );
|
|
||||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.jpeg", arrayGroupBanners );
|
|
||||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.gif", arrayGroupBanners );
|
|
||||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.bmp", arrayGroupBanners );
|
|
||||||
/*
|
|
||||||
RString sBackgroundPath;
|
|
||||||
if( !arrayGroupBackgrounds.empty() )
|
|
||||||
sBackgroundPath = sDir+sGroupDirName+"/"+arrayGroupBackgrounds[0];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Look for a group background in the parent folder
|
|
||||||
GetDirListing( sDir+sGroupDirName+"-bg.png", arrayGroupBackgrounds );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"-bg.jpg", arrayGroupBackgrounds );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"-bg.jpeg", arrayGroupBackgrounds );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"-bg.gif", arrayGroupBackgrounds );
|
|
||||||
GetDirListing( sDir+sGroupDirName+"-bg.bmp", arrayGroupBackgrounds );
|
|
||||||
if( !arrayGroupBackgrounds.empty() )
|
|
||||||
sBackgroundPath = sDir+arrayGroupBackgrounds[0];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
m_sSongGroupNames.push_back( sGroupDirName );
|
m_sSongGroupNames.push_back( sGroupDirName );
|
||||||
// add to the group list
|
// add to the group list
|
||||||
m_pGroups.push_back( group );
|
m_pGroups.push_back( group );
|
||||||
@@ -435,7 +376,7 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio
|
|||||||
|
|
||||||
SongPointerVector& index_entry = m_mapSongGroupIndex[sGroupDirName];
|
SongPointerVector& index_entry = m_mapSongGroupIndex[sGroupDirName];
|
||||||
RString group_base_name= Basename(sGroupDirName);
|
RString group_base_name= Basename(sGroupDirName);
|
||||||
Group* group = new Group(sDir + sGroupDirName);
|
Group* group = new Group(sDir, sGroupDirName);
|
||||||
|
|
||||||
for( unsigned j=0; j< arraySongDirs.size(); ++j ) // for each song dir
|
for( unsigned j=0; j< arraySongDirs.size(); ++j ) // for each song dir
|
||||||
{
|
{
|
||||||
@@ -503,7 +444,7 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio
|
|||||||
AddGroup(sDir, sGroupDirName, group);
|
AddGroup(sDir, sGroupDirName, group);
|
||||||
|
|
||||||
// Cache and load the group banner. (and background if it has one -aj)
|
// Cache and load the group banner. (and background if it has one -aj)
|
||||||
IMAGECACHE->CacheImage( "Banner", GetSongGroupBannerPath(sGroupDirName) );
|
IMAGECACHE->CacheImage( "Banner", group->GetBannerPath() );
|
||||||
|
|
||||||
// Load the group sym links (if any)
|
// Load the group sym links (if any)
|
||||||
LoadGroupSymLinks(sDir, sGroupDirName);
|
LoadGroupSymLinks(sDir, sGroupDirName);
|
||||||
|
|||||||
Reference in New Issue
Block a user