Example #1
0
void ThemeMenu::SetupMainButtons()
{
	ThemeList.clear();

	DirList ThemeDir(Settings.theme_path, ".them", DirList::Files);
	if (ThemeDir.GetFilecount() == 0)
	{
		WindowPrompt(tr( "No themes found." ), 0, "OK");
	}

	for(int i = 0; i < ThemeDir.GetFilecount(); ++i)
	{
		u8 *buffer = NULL;
		u32 filesize;
		debughelper_printf("%i %s\n", i, ThemeDir.GetFilepath(i));
		LoadFileToMem(ThemeDir.GetFilepath(i), &buffer, &filesize);

		if(!buffer) continue;

		buffer[filesize-1] = '\0';

		int size = ThemeList.size();
		ThemeList.resize(size+1);

		ThemeList[size].Filepath = ThemeDir.GetFilepath(i);
		GetNodeText(buffer, "Theme-Title:", ThemeList[size].Title);
		GetNodeText(buffer, "Theme-Team:", ThemeList[size].Team);
		GetNodeText(buffer, "Theme-Version:", ThemeList[size].Version);
		GetNodeText(buffer, "Image-Folder:", ThemeList[size].ImageFolder);

		if(ThemeList[size].Title.size() == 0 && ThemeDir.GetFilename(i))
		{
			ThemeList[size].Title = ThemeDir.GetFilename(i);
			size_t pos = ThemeList[size].Title.rfind('.');
			if(pos != std::string::npos)
				ThemeList[size].Title.erase(pos);
		}

		if(ThemeList[size].ImageFolder.size() == 0)
		{
			ThemeList[size].ImageFolder = ThemeDir.GetFilepath(i);
			size_t pos = ThemeList[size].ImageFolder.rfind('.');
			if(pos != std::string::npos)
				ThemeList[size].ImageFolder.erase(pos);
			ThemeList[size].ImageFolder += '/';
		}
		else
		{
			std::string tempString = ThemeList[size].ImageFolder;
			ThemeList[size].ImageFolder = Settings.theme_path;
			ThemeList[size].ImageFolder += tempString;
			ThemeList[size].ImageFolder += '/';
		}

		SetMainButton(size, ThemeList[size].Title.c_str(), MainButtonImgData, NULL);

		free(buffer);
	}
}
void GlobalSettings::SetupMainButtons()
{
    int pos = 0;

    SetMainButton(pos++, tr("GUI Settings"), MainButtonImgData, MainButtonImgOverData);
    SetMainButton(pos++, tr("Audio Settings"), MainButtonImgData, MainButtonImgOverData);
    SetMainButton(pos++, tr("Custom Paths"), MainButtonImgData, MainButtonImgOverData);
    SetMainButton(pos++, tr("WiiTDB"), MainButtonImgData, MainButtonImgOverData);
    SetMainButton(pos++, tr("Updates"), MainButtonImgData, MainButtonImgOverData);
    SetMainButton(pos++, tr("Default Settings"), MainButtonImgData, MainButtonImgOverData);
    SetMainButton(pos++, tr("Credits"), creditsImgData, creditsOverImgData);
	
}