Use the Translit field from Group.ini, Migrate Banner code to Group class
This commit is contained in:
+100
-24
@@ -33,47 +33,123 @@ Group::~Group() {
|
||||
SONGMAN->GetGroupGroupMap().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 sDisplayTitle = sGroupDirName;
|
||||
RString SortTitle = sGroupDirName;
|
||||
RString TranslitTitle = "";
|
||||
RString Series = "";
|
||||
RString bannerPath = "";
|
||||
RString authorsNotes = "";
|
||||
float fOffset = 0;
|
||||
|
||||
if (FILEMAN->DoesFileExist(sGroupIniPath)) {
|
||||
IniFile ini;
|
||||
ini.ReadFile(sGroupIniPath);
|
||||
ini.GetValue("Group", "DisplayTitle", m_sDisplayTitle);
|
||||
if (m_sDisplayTitle.empty()) {
|
||||
m_sDisplayTitle = m_sGroupName;
|
||||
ini.ReadFile( sGroupIniPath );
|
||||
ini.GetValue( "Group", "DisplayTitle", sDisplayTitle );
|
||||
if (sDisplayTitle.empty()) {
|
||||
sDisplayTitle = Basename(sGroupDirName);
|
||||
}
|
||||
ini.GetValue("Group", "Banner", m_sBannerPath);
|
||||
ini.GetValue("Group", "SortTitle", m_sSortTitle);
|
||||
if (m_sSortTitle.empty()) {
|
||||
m_sSortTitle = m_sDisplayTitle;
|
||||
ini.GetValue( "Group", "Banner", bannerPath );
|
||||
ini.GetValue( "Group", "SortTitle", SortTitle );
|
||||
if (SortTitle.empty()) {
|
||||
SortTitle = sDisplayTitle;
|
||||
}
|
||||
ini.GetValue("Group", "TranslitTitle", m_sTranslitTitle);
|
||||
if (m_sTranslitTitle.empty()) {
|
||||
m_sTranslitTitle = m_sDisplayTitle;
|
||||
ini.GetValue( "Group", "TranslitTitle", TranslitTitle );
|
||||
if (TranslitTitle.empty()) {
|
||||
TranslitTitle = sDisplayTitle;
|
||||
}
|
||||
ini.GetValue("Group", "Series", m_sSeries);
|
||||
ini.GetValue( "Group", "Series", Series );
|
||||
RString sValue = "";
|
||||
|
||||
ini.GetValue("Group", "SyncOffset", sValue);
|
||||
if (sValue.CompareNoCase("null") == 0) {
|
||||
m_iSyncOffset = 0;
|
||||
fOffset = 0;
|
||||
} else if (sValue.CompareNoCase("itg") == 0) {
|
||||
m_iSyncOffset = 0.009f;
|
||||
fOffset = 0.009f;
|
||||
} else {
|
||||
m_iSyncOffset = StringToFloat(sValue);
|
||||
fOffset = StringToFloat(sValue);
|
||||
}
|
||||
ini.GetValue("Group", "Year", m_iYearReleased);
|
||||
ini.GetValue("Group", "AuthorsNotes", m_sAuthorsNotes);
|
||||
|
||||
std::vector<RString> credits_vector;
|
||||
ini.GetValue("Group", "Credits", credits);
|
||||
split(credits, ";", credits_vector);
|
||||
m_sCredits = credits_vector;
|
||||
m_bHasGroupIni = true;
|
||||
ini.GetValue( "Group", "Credits", credits );
|
||||
ini.GetValue( "Group", "AuthorsNotes", authorsNotes );
|
||||
} else {
|
||||
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
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ class Group
|
||||
{
|
||||
public:
|
||||
Group();
|
||||
Group( const RString &sPath);
|
||||
Group( const RString sDir, const RString &sGroupDirName);
|
||||
~Group();
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
+1
-1
@@ -758,7 +758,7 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
Group* pGroup = pSong->GetGroup();
|
||||
if( bUseSections )
|
||||
{
|
||||
RString sThisSection = pSong->GetGroup()->GetSortTitle();
|
||||
RString sThisSection = pGroup->GetGroupName();
|
||||
|
||||
if( sThisSection != sLastSection )
|
||||
{
|
||||
|
||||
@@ -226,10 +226,14 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
|
||||
sDisplayName = SONGMAN->ShortenGroupName(pWID->m_sText);
|
||||
}
|
||||
else {
|
||||
if ( pWID->m_pGroup->GetSeries().empty() )
|
||||
if ( pWID->m_pGroup->GetSeries().empty() ) {
|
||||
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());
|
||||
sTranslitName = SONGMAN->ShortenGroupName("[" + pWID->m_pGroup->GetSeries() +"] " + pWID->m_pGroup->GetTranslitTitle());
|
||||
}
|
||||
}
|
||||
if( GAMESTATE->sExpandedSectionName == pWID->m_sText )
|
||||
type = MusicWheelItemType_SectionExpanded;
|
||||
|
||||
+2
-61
@@ -279,65 +279,6 @@ void SongManager::AddGroup( RString sDir, RString sGroupDirName, Group* group )
|
||||
if( j != m_sSongGroupNames.size() )
|
||||
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 );
|
||||
// add to the group list
|
||||
m_pGroups.push_back( group );
|
||||
@@ -435,7 +376,7 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio
|
||||
|
||||
SongPointerVector& index_entry = m_mapSongGroupIndex[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
|
||||
{
|
||||
@@ -503,7 +444,7 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio
|
||||
AddGroup(sDir, sGroupDirName, group);
|
||||
|
||||
// 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)
|
||||
LoadGroupSymLinks(sDir, sGroupDirName);
|
||||
|
||||
Reference in New Issue
Block a user