Themable menus & Full support for RB Themes

This commit is contained in:
Fabrice CARUSO
2019-08-30 17:46:19 +02:00
parent 8fb9fc21a6
commit de593cb786
73 changed files with 2714 additions and 1704 deletions
+14
View File
@@ -745,7 +745,21 @@ std::vector<BiosSystem> ApiSystem::getBiosInformations() {
BiosSystem current;
bool isCurrent = false;
#if WIN32 && _DEBUG
current.name = "atari5200";
BiosFile biosFile;
biosFile.md5 = "281f20ea4320404ec820fb7ec0693b38";
biosFile.path = "bios/5200.rom";
biosFile.status = "missing";
current.bios.push_back(biosFile);
res.push_back(current);
return res;
#endif
FILE *pipe = popen("batocera-systems", "r");
char line[1024];
if (pipe == NULL) {
+4 -1
View File
@@ -300,6 +300,9 @@ bool SystemData::loadConfig(Window* window)
CollectionSystemManager::get()->loadCollectionSystems();
}
if (SystemData::sSystemVector.size() > 0)
ThemeData::setMenuTheme(SystemData::sSystemVector.at(0)->getTheme().get());
return true;
}
@@ -618,7 +621,7 @@ void SystemData::loadTheme()
sysData.insert(std::pair<std::string, std::string>("system.theme", getThemeFolder()));
sysData.insert(std::pair<std::string, std::string>("system.fullName", getFullName()));
mTheme->loadFile(sysData, path);
mTheme->loadFile(getThemeFolder(), sysData, path);
} catch(ThemeException& e)
{
LOG(LogError) << e.what();
@@ -20,6 +20,7 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
mGrid(window, Vector2i(4, 3)), mBusyAnim(window),
mSearchType(type)
{
auto theme = ThemeData::getMenuTheme();
addChild(&mGrid);
mBlockAccept = false;
@@ -28,7 +29,7 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
mGrid.setEntry(std::make_shared<GuiComponent>(mWindow), Vector2i(0, 0), false, false, Vector2i(1, 3), GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
// selected result name
mResultName = std::make_shared<TextComponent>(mWindow, "Result name", Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
mResultName = std::make_shared<TextComponent>(mWindow, "Result name", theme->Text.font, theme->Text.color);
// selected result thumbnail
mResultThumbnail = std::make_shared<ImageComponent>(mWindow);
@@ -36,14 +37,14 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
// selected result desc + container
mDescContainer = std::make_shared<ScrollableContainer>(mWindow);
mResultDesc = std::make_shared<TextComponent>(mWindow, "Result desc", Font::get(FONT_SIZE_SMALL), 0x777777FF);
mResultDesc = std::make_shared<TextComponent>(mWindow, "Result desc", theme->TextSmall.font, theme->Text.color);
mDescContainer->addChild(mResultDesc.get());
mDescContainer->setAutoScroll(true);
// metadata
auto font = Font::get(FONT_SIZE_SMALL); // this gets replaced in onSizeChanged() so its just a placeholder
const unsigned int mdColor = 0x777777FF;
const unsigned int mdLblColor = 0x666666FF;
auto font = theme->TextSmall.font; // this gets replaced in onSizeChanged() so its just a placeholder
const unsigned int mdColor = theme->Text.color;
const unsigned int mdLblColor = theme->TextSmall.color;
mMD_Rating = std::make_shared<RatingComponent>(mWindow);
mMD_ReleaseDate = std::make_shared<DateTimeEditComponent>(mWindow);
mMD_ReleaseDate->setColor(mdColor);
@@ -229,8 +230,9 @@ void ScraperSearchComponent::onSearchDone(const std::vector<ScraperSearchResult>
mScraperResults = results;
auto font = Font::get(FONT_SIZE_MEDIUM);
unsigned int color = 0x777777FF;
auto theme = ThemeData::getMenuTheme();
auto font = theme->TextSmall.font;
unsigned int color = theme->Text.color;
if(results.empty())
{
// Check if the scraper used is still valid
+13 -7
View File
@@ -13,13 +13,15 @@
GuiBezelInstallMenu::GuiBezelInstallMenu(Window* window)
:GuiComponent(window), mMenu(window, _("THE BEZEL PROJECT").c_str())
{
auto theme = ThemeData::getMenuTheme();
addChild(&mMenu);
ComponentListRow row;
{
auto openBezelInstallNow = [this] { mWindow->pushGui(new GuiBezelInstallStart(mWindow)); };
row.makeAcceptInputHandler(openBezelInstallNow);
auto BezelInstallSettings = std::make_shared<TextComponent>(mWindow, _("INSTALL BEZELS"),
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
theme->Text.font, theme->Text.color);
auto bracket = makeArrow(mWindow);
row.addElement(BezelInstallSettings, true);
row.addElement(bracket, false);
@@ -30,7 +32,7 @@ GuiBezelInstallMenu::GuiBezelInstallMenu(Window* window)
auto openBezelUninstallNow = [this] { mWindow->pushGui(new GuiBezelUninstallStart(mWindow)); };
row.makeAcceptInputHandler(openBezelUninstallNow);
auto BezelUninstallSettings = std::make_shared<TextComponent>(mWindow, _("UNINSTALL BEZELS"),
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
theme->Text.font, theme->Text.color);
auto bracket = makeArrow(mWindow);
row.addElement(BezelUninstallSettings, true);
row.addElement(bracket, false);
@@ -75,10 +77,12 @@ std::vector<HelpPrompt> GuiBezelInstallMenu::getHelpPrompts()
GuiBezelInstallStart::GuiBezelInstallStart(Window* window)
:GuiComponent(window), mMenu(window, _("INSTALL THE BEZEL PROJECT").c_str())
{
auto theme = ThemeData::getMenuTheme();
addChild(&mMenu);
ComponentListRow row;
row.addElement(std::make_shared<TextComponent>(window, _("SELECT SYSTEM WHERE BEZELS WILL BE INSTALLED"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(std::make_shared<TextComponent>(window, _("SELECT SYSTEM WHERE BEZELS WILL BE INSTALLED"), theme->Text.font, theme->Text.color), true);
mMenu.addRow(row);
row.elements.clear();
@@ -88,7 +92,7 @@ GuiBezelInstallStart::GuiBezelInstallStart(Window* window)
for(auto it = availableBezels.begin(); it != availableBezels.end(); it++){
auto itstring = std::make_shared<TextComponent>(mWindow,
(*it).c_str(), Font::get(FONT_SIZE_SMALL), 0x777777FF);
(*it).c_str(), theme->TextSmall.font, theme->Text.color);
char *tmp=new char [(*it).length()+1];
mSelectedBezel=new char [(*it).length()+1];
@@ -157,10 +161,12 @@ std::vector<HelpPrompt> GuiBezelInstallStart::getHelpPrompts()
GuiBezelUninstallStart::GuiBezelUninstallStart(Window* window)
:GuiComponent(window), mMenu(window, _("UNINSTALL THE BEZEL PROJECT").c_str())
{
auto theme = ThemeData::getMenuTheme();
addChild(&mMenu);
ComponentListRow row;
row.addElement(std::make_shared<TextComponent>(window, _("SELECT SYSTEM WHERE BEZELS WILL BE REMOVED"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(std::make_shared<TextComponent>(window, _("SELECT SYSTEM WHERE BEZELS WILL BE REMOVED"), theme->Text.font, theme->Text.color), true);
mMenu.addRow(row);
row.elements.clear();
@@ -170,7 +176,7 @@ GuiBezelUninstallStart::GuiBezelUninstallStart(Window* window)
for(auto it = availableBezels.begin(); it != availableBezels.end(); it++){
auto itstring = std::make_shared<TextComponent>(mWindow,
(*it).c_str(), Font::get(FONT_SIZE_SMALL), 0x777777FF);
(*it).c_str(), theme->TextSmall.font, theme->Text.color);
char *tmp=new char [(*it).length()+1];
mSelectedBezel=new char [(*it).length()+1];
std::strcpy (tmp, (*it).c_str());
@@ -189,7 +195,7 @@ GuiBezelUninstallStart::GuiBezelUninstallStart(Window* window)
// Let's put the pretty name of the system
if (! strcmp ((*itSystem)->getName().c_str(), bezel_cli))
itstring = std::make_shared<TextComponent>(mWindow,
(*itSystem)->getFullName(), Font::get(FONT_SIZE_SMALL), 0x777777FF);
(*itSystem)->getFullName(), theme->TextSmall.font, theme->Text.color);
}
// Names longer than this will crash GuiMsgBox downstream
+15 -21
View File
@@ -28,7 +28,7 @@ void GuiCollectionSystemsOptions::initializeMenu()
std::vector<std::string> unusedFolders = CollectionSystemManager::get()->getUnusedSystemsFromTheme();
if (unusedFolders.size() > 0)
{
addEntry(_("CREATE NEW CUSTOM COLLECTION FROM THEME").c_str(), 0x777777FF, true,
addEntry(_("CREATE NEW CUSTOM COLLECTION FROM THEME").c_str(), true,
[this, unusedFolders] {
auto s = new GuiSettings(mWindow, _("SELECT THEME FOLDER").c_str());
std::shared_ptr< OptionListComponent<std::string> > folderThemes = std::make_shared< OptionListComponent<std::string> >(mWindow, _("SELECT THEME FOLDER"), true);
@@ -44,16 +44,14 @@ void GuiCollectionSystemsOptions::initializeMenu()
};
row.makeAcceptInputHandler(createCollectionCall);
auto themeFolder = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(name), Font::get(FONT_SIZE_SMALL), 0x777777FF);
auto themeFolder = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(name), ThemeData::getMenuTheme()->TextSmall.font, ThemeData::getMenuTheme()->Text.color);
row.addElement(themeFolder, true);
s->addRow(row);
s->addRow(row);
}
mWindow->pushGui(s);
});
}
ComponentListRow row;
row.addElement(std::make_shared<TextComponent>(mWindow, _("CREATE NEW CUSTOM COLLECTION"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
auto createCustomCollection = [this](const std::string& newVal) {
std::string name = newVal;
// we need to store the first Gui and remove it, as it'll be deleted by the actual Gui
@@ -62,16 +60,15 @@ void GuiCollectionSystemsOptions::initializeMenu()
window->removeGui(topGui);
createCollection(name);
};
row.makeAcceptInputHandler([this, createCustomCollection] {
if (Settings::getInstance()->getBool("UseOSK")) {
mWindow->pushGui(new GuiTextEditPopupKeyboard(mWindow, _("New Collection Name"), "", createCustomCollection, false));
} else {
mWindow->pushGui(new GuiTextEditPopup(mWindow, _("New Collection Name"), "", createCustomCollection, false));
}
addEntry(_("CREATE NEW CUSTOM COLLECTION").c_str(), true, [this, createCustomCollection] {
if (Settings::getInstance()->getBool("UseOSK")) {
mWindow->pushGui(new GuiTextEditPopupKeyboard(mWindow, _("New Collection Name"), "", createCustomCollection, false));
}
else {
mWindow->pushGui(new GuiTextEditPopup(mWindow, _("New Collection Name"), "", createCustomCollection, false));
}
});
mMenu.addRow(row);
bundleCustomCollections = std::make_shared<SwitchComponent>(mWindow);
bundleCustomCollections->setState(Settings::getInstance()->getBool("UseCustomCollectionsSystem"));
mMenu.addWithLabel(_("GROUP UNTHEMED CUSTOM COLLECTIONS"), bundleCustomCollections);
@@ -81,21 +78,18 @@ void GuiCollectionSystemsOptions::initializeMenu()
mMenu.addWithLabel(_("SORT CUSTOM COLLECTIONS AND SYSTEMS"), sortAllSystemsSwitch);
if(CollectionSystemManager::get()->isEditing())
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, _("FINISH EDITING COLLECTION") + " : " + Utils::String::toUpper(CollectionSystemManager::get()->getEditingCollection()), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.makeAcceptInputHandler(std::bind(&GuiCollectionSystemsOptions::exitEditMode, this));
mMenu.addRow(row);
}
addEntry((_("FINISH EDITING COLLECTION") + " : " + Utils::String::toUpper(CollectionSystemManager::get()->getEditingCollection())).c_str(), false, std::bind(&GuiCollectionSystemsOptions::exitEditMode, this));
mMenu.addButton(_("BACK"), "back", std::bind(&GuiCollectionSystemsOptions::applySettings, this));
mMenu.setPosition((Renderer::getScreenWidth() - mMenu.getSize().x()) / 2, Renderer::getScreenHeight() * 0.15f);
}
void GuiCollectionSystemsOptions::addEntry(const char* name, unsigned int color, bool add_arrow, const std::function<void()>& func)
void GuiCollectionSystemsOptions::addEntry(const char* name, bool add_arrow, const std::function<void()>& func)
{
std::shared_ptr<Font> font = Font::get(FONT_SIZE_MEDIUM);
auto theme = ThemeData::getMenuTheme();
std::shared_ptr<Font> font = theme->Text.font;
unsigned int color = theme->Text.color;
// populate the list
ComponentListRow row;
@@ -22,7 +22,7 @@ private:
void initializeMenu();
void applySettings();
void addSystemsToMenu();
void addEntry(const char* name, unsigned int color, bool add_arrow, const std::function<void()>& func);
void addEntry(const char* name, bool add_arrow, const std::function<void()>& func);
void updateSettings(std::string newAutoSettings, std::string newCustomSettings);
void createCollection(std::string inName);
void exitEditMode();
+7 -3
View File
@@ -14,6 +14,11 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
mSearchParams(params),
mClose(false)
{
auto theme = ThemeData::getMenuTheme();
mBox.setImagePath(theme->Background.path);
mBox.setCenterColor(theme->Background.color);
mBox.setEdgeColor(theme->Background.color);
PowerSaver::pause();
addChild(&mBox);
addChild(&mGrid);
@@ -21,13 +26,12 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
// row 0 is a spacer
mGameName = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(Utils::FileSystem::getFileName(mSearchParams.game->getPath())),
Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
theme->Text.font, theme->Text.color, ALIGN_CENTER);
mGrid.setEntry(mGameName, Vector2i(0, 1), false, true);
// row 2 is a spacer
mSystemName = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(mSearchParams.system->getFullName()), Font::get(FONT_SIZE_SMALL),
0x888888FF, ALIGN_CENTER);
mSystemName = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(mSearchParams.system->getFullName()), theme->TextSmall.font, theme->TextSmall.color, ALIGN_CENTER);
mGrid.setEntry(mSystemName, Vector2i(0, 3), false, true);
// row 4 is a spacer
+1 -6
View File
@@ -19,12 +19,7 @@ void GuiGamelistFilter::initializeMenu()
ComponentListRow row;
// show filtered menu
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, "RESET ALL FILTERS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.makeAcceptInputHandler(std::bind(&GuiGamelistFilter::resetAllFilters, this));
mMenu.addRow(row);
row.elements.clear();
mMenu.addEntry(_("RESET ALL FILTERS"), false, std::bind(&GuiGamelistFilter::resetAllFilters, this));
addFiltersToMenu();
+8 -6
View File
@@ -16,6 +16,8 @@
GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : GuiComponent(window),
mSystem(system), mMenu(window, "OPTIONS"), fromPlaceholder(false), mFiltersChanged(false)
{
auto theme = ThemeData::getMenuTheme();
addChild(&mMenu);
// check it's not a placeholder folder - if it is, only show "Filter Options"
@@ -52,7 +54,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
}
}
row.addElement(std::make_shared<TextComponent>(mWindow, _("JUMP TO..."), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); // batocera
row.addElement(std::make_shared<TextComponent>(mWindow, _("JUMP TO..."), theme->Text.font, theme->Text.color), true); // batocera
row.addElement(mJumpToLetterList, false);
row.input_handler = [&](InputConfig* config, Input input)
{
@@ -83,7 +85,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
if(!Settings::getInstance()->getBool("ForceDisableFilters"))
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, _("FILTER GAMELIST"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); // batocera
row.addElement(std::make_shared<TextComponent>(mWindow, _("FILTER GAMELIST"), theme->Text.font, theme->Text.color), true); // batocera
row.addElement(makeArrow(mWindow), false);
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::openGamelistFilter, this));
mMenu.addRow(row);
@@ -96,7 +98,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
CollectionSystemManager::get()->getCustomCollectionsBundle()->getName() == system->getName()))
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, _("ADD/REMOVE GAMES TO THIS GAME COLLECTION"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(std::make_shared<TextComponent>(mWindow, _("ADD/REMOVE GAMES TO THIS GAME COLLECTION"), theme->Text.font, theme->Text.color), true);
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::startEditMode, this));
mMenu.addRow(row);
}
@@ -104,7 +106,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
if(UIModeController::getInstance()->isUIModeFull() && CollectionSystemManager::get()->isEditing())
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, _("FINISH EDITING COLLECTION") + " : " + Utils::String::toUpper(CollectionSystemManager::get()->getEditingCollection()), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(std::make_shared<TextComponent>(mWindow, _("FINISH EDITING COLLECTION") + " : " + Utils::String::toUpper(CollectionSystemManager::get()->getEditingCollection()), theme->Text.font, theme->Text.color), true);
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::exitEditMode, this));
mMenu.addRow(row);
}
@@ -112,7 +114,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
if (UIModeController::getInstance()->isUIModeFull() && !fromPlaceholder && !(mSystem->isCollection() && file->getType() == FOLDER))
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, _("EDIT THIS GAME'S METADATA"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); // batocera
row.addElement(std::make_shared<TextComponent>(mWindow, _("EDIT THIS GAME'S METADATA"), theme->Text.font, theme->Text.color), true); // batocera
row.addElement(makeArrow(mWindow), false);
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::openMetaDataEd, this));
mMenu.addRow(row);
@@ -122,7 +124,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
if (UIModeController::getInstance()->isUIModeFull() && !(mSystem->isCollection() && file->getType() == FOLDER))
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, _("ADVANCED"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(std::make_shared<TextComponent>(mWindow, _("ADVANCED"), theme->Text.font, theme->Text.color), true);
row.addElement(makeArrow(mWindow), false);
row.makeAcceptInputHandler([this, file, system] { GuiMenu::popGameConfigurationGui(mWindow, Utils::FileSystem::getFileName(file->getPath()), file->getSourceFileData()->getSystem(), ""); });
mMenu.addRow(row);
@@ -10,6 +10,8 @@
GuiGeneralScreensaverOptions::GuiGeneralScreensaverOptions(Window* window, const char* title) : GuiScreensaverOptions(window, title)
{
auto theme = ThemeData::getMenuTheme();
// screensaver time
auto screensaver_time = std::make_shared<SliderComponent>(mWindow, 0.f, 30.f, 1.f, "m");
screensaver_time->setValue((float)(Settings::getInstance()->getInt("ScreenSaverTime") / (1000 * 60)));
@@ -50,13 +52,13 @@ GuiGeneralScreensaverOptions::GuiGeneralScreensaverOptions(Window* window, const
// show filtered menu
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, "VIDEO SCREENSAVER SETTINGS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(std::make_shared<TextComponent>(mWindow, "VIDEO SCREENSAVER SETTINGS", theme->Text.font, theme->Text.color), true);
row.addElement(makeArrow(mWindow), false);
row.makeAcceptInputHandler(std::bind(&GuiGeneralScreensaverOptions::openVideoScreensaverOptions, this));
addRow(row);
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, "SLIDESHOW SCREENSAVER SETTINGS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(std::make_shared<TextComponent>(mWindow, "SLIDESHOW SCREENSAVER SETTINGS", theme->Text.font, theme->Text.color), true);
row.addElement(makeArrow(mWindow), false);
row.makeAcceptInputHandler(std::bind(&GuiGeneralScreensaverOptions::openSlideshowScreensaverOptions, this));
addRow(row);
+959 -1192
View File
File diff suppressed because it is too large Load Diff
+3 -4
View File
@@ -30,18 +30,17 @@ public:
void onSizeChanged() override;
std::vector<HelpPrompt> getHelpPrompts() override;
HelpStyle getHelpStyle() override;
static void openQuitMenu_batocera_static(Window *window); // batocera
static void openQuitMenu_batocera_static(Window *window, bool forceWin32Menu=false); // batocera
static void popSystemConfigurationGui(Window* mWindow, SystemData *systemData, std::string previouslySelectedEmulator);
static void popGameConfigurationGui(Window* mWindow, std::string romFilename, SystemData *systemData, std::string previouslySelectedEmulator);
private:
void addEntry(const char* name, unsigned int color, bool add_arrow, const std::function<void()>& func);
void addEntry(std::string name, bool add_arrow, const std::function<void()>& func, const std::string iconName = "");
void addVersionInfo();
void openCollectionSystemSettings();
void openConfigInput();
void openOtherSettings();
void openQuitMenu();
void openOtherSettings();
void openScraperSettings();
void openScreensaverOptions();
void openSlideshowScreensaverOptions();
+24 -5
View File
@@ -32,14 +32,19 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
mMetaData(md),
mSavedCallback(saveCallback), mDeleteFunc(deleteFunc)
{
auto theme = ThemeData::getMenuTheme();
mBackground.setImagePath(theme->Background.path); // ":/frame.png"
mBackground.setCenterColor(theme->Background.color);
mBackground.setEdgeColor(theme->Background.color);
addChild(&mBackground);
addChild(&mGrid);
mHeaderGrid = std::make_shared<ComponentGrid>(mWindow, Vector2i(1, 5));
mTitle = std::make_shared<TextComponent>(mWindow, _("EDIT METADATA"), Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER); // batocera
mTitle = std::make_shared<TextComponent>(mWindow, _("EDIT METADATA"), theme->Title.font, theme->Title.color, ALIGN_CENTER); // batocera
mSubtitle = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(Utils::FileSystem::getFileName(scraperParams.game->getPath())),
Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER);
theme->TextSmall.font, theme->TextSmall.color, ALIGN_CENTER);
mHeaderGrid->setEntry(mTitle, Vector2i(0, 1), false, true);
mHeaderGrid->setEntry(mSubtitle, Vector2i(0, 3), false, true);
@@ -60,7 +65,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
// create ed and add it (and any related components) to mMenu
// ed's value will be set below
ComponentListRow row;
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(iter->displayName), Font::get(FONT_SIZE_SMALL), 0x777777FF);
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(iter->displayName), theme->Text.font, theme->Text.color);
row.addElement(lbl, true); // label
switch(iter->type)
@@ -111,7 +116,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
default:
{
// MD_STRING
ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT);
ed = std::make_shared<TextComponent>(window, "", theme->TextSmall.font, theme->Text.color, ALIGN_RIGHT);
row.addElement(ed, true);
auto spacer = std::make_shared<GuiComponent>(mWindow);
@@ -119,7 +124,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>(mWindow);
bracket->setImage(":/arrow.svg");
bracket->setImage(ThemeData::getMenuTheme()->Icons.arrow);
bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight()));
row.addElement(bracket, false);
@@ -162,6 +167,20 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
mButtons = makeButtonGrid(mWindow, buttons);
mGrid.setEntry(mButtons, Vector2i(0, 2), true, false);
mGrid.setUnhandledInputCallback([this](InputConfig* config, Input input) -> bool {
if (config->isMappedLike("down", input)) {
mGrid.setCursorTo(mList);
mList->setCursorIndex(0);
return true;
}
if (config->isMappedLike("up", input)) {
mList->setCursorIndex(mList->size() - 1);
mGrid.moveCursor(Vector2i(0, 1));
return true;
}
return false;
});
// resize + center
float width = (float)Math::min(Renderer::getScreenHeight(), (int)(Renderer::getScreenWidth() * 0.90f));
setSize(width, Renderer::getScreenHeight() * 0.82f);
+8 -3
View File
@@ -16,6 +16,11 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
GuiComponent(window), mBackground(window, ":/frame.png"), mGrid(window, Vector2i(1, 5)),
mSearchQueue(searches)
{
auto theme = ThemeData::getMenuTheme();
mBackground.setImagePath(theme->Background.path); // ":/frame.png"
mBackground.setCenterColor(theme->Background.color);
mBackground.setEdgeColor(theme->Background.color);
assert(mSearchQueue.size());
addChild(&mBackground);
@@ -30,13 +35,13 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
mTotalSkipped = 0;
// set up grid
mTitle = std::make_shared<TextComponent>(mWindow, _("SCRAPING IN PROGRESS"), Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER); // batocera
mTitle = std::make_shared<TextComponent>(mWindow, _("SCRAPING IN PROGRESS"), theme->Title.font, theme->Title.color, ALIGN_CENTER); // batocera
mGrid.setEntry(mTitle, Vector2i(0, 0), false, true);
mSystem = std::make_shared<TextComponent>(mWindow, _("SYSTEM"), Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER); // batocera
mSystem = std::make_shared<TextComponent>(mWindow, _("SYSTEM"), theme->Text.font, theme->Text.color, ALIGN_CENTER); // batocera
mGrid.setEntry(mSystem, Vector2i(0, 1), false, true);
mSubtitle = std::make_shared<TextComponent>(mWindow, _("subtitle text"), Font::get(FONT_SIZE_SMALL), 0x888888FF, ALIGN_CENTER); // batocera
mSubtitle = std::make_shared<TextComponent>(mWindow, _("subtitle text"), theme->TextSmall.font, theme->TextSmall.color, ALIGN_CENTER); // batocera
mGrid.setEntry(mSubtitle, Vector2i(0, 2), false, true);
mSearchComp = std::make_shared<ScraperSearchComponent>(mWindow,
+13
View File
@@ -68,3 +68,16 @@ std::vector<HelpPrompt> GuiSettings::getHelpPrompts()
return prompts;
}
void GuiSettings::addSubMenu(const std::string& label, const std::function<void()>& func)
{
ComponentListRow row;
row.makeAcceptInputHandler(func);
auto theme = ThemeData::getMenuTheme();
auto entryMenu = std::make_shared<TextComponent>(mWindow, label, theme->Text.font, theme->Text.color);
row.addElement(entryMenu, true);
row.addElement(makeArrow(mWindow), false);
mMenu.addRow(row);
};
+5 -1
View File
@@ -15,7 +15,11 @@ public:
inline void addRow(const ComponentListRow& row) { mMenu.addRow(row); };
inline void addWithLabel(const std::string& label, const std::shared_ptr<GuiComponent>& comp) { mMenu.addWithLabel(label, comp); };
inline void addSaveFunc(const std::function<void()>& func) { mSaveFuncs.push_back(func); };
inline void setSave(bool sav) { doSave = sav; }; // batocera
inline void addEntry(const std::string name, bool add_arrow = false, const std::function<void()>& func = nullptr, const std::string iconName = "") { mMenu.addEntry(name, add_arrow, func, iconName); };
void addSubMenu(const std::string& label, const std::function<void()>& func);
inline void setSave(bool sav) { doSave = sav; }; // batocera
bool input(InputConfig* config, Input input) override;
std::vector<HelpPrompt> getHelpPrompts() override;
@@ -11,6 +11,8 @@
GuiSlideshowScreensaverOptions::GuiSlideshowScreensaverOptions(Window* window, const char* title) : GuiScreensaverOptions(window, title)
{
auto theme = ThemeData::getMenuTheme();
ComponentListRow row;
// image duration (seconds)
@@ -32,7 +34,7 @@ GuiSlideshowScreensaverOptions::GuiSlideshowScreensaverOptions(Window* window, c
});
// background audio file
auto sss_bg_audio_file = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_SMALL), 0x777777FF);
auto sss_bg_audio_file = std::make_shared<TextComponent>(mWindow, "", theme->TextSmall.font, theme->Text.color);
addEditableTextComponent(row, _("BACKGROUND AUDIO"), sss_bg_audio_file, Settings::getInstance()->getString("SlideshowScreenSaverBackgroundAudioFile"));
addSaveFunc([sss_bg_audio_file] {
Settings::getInstance()->setString("SlideshowScreenSaverBackgroundAudioFile", sss_bg_audio_file->getValue());
@@ -45,7 +47,7 @@ GuiSlideshowScreensaverOptions::GuiSlideshowScreensaverOptions(Window* window, c
addSaveFunc([sss_custom_source] { Settings::getInstance()->setBool("SlideshowScreenSaverCustomImageSource", sss_custom_source->getState()); });
// custom image directory
auto sss_image_dir = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_SMALL), 0x777777FF);
auto sss_image_dir = std::make_shared<TextComponent>(mWindow, "", theme->TextSmall.font, theme->Text.color);
addEditableTextComponent(row, _("CUSTOM IMAGE DIR"), sss_image_dir, Settings::getInstance()->getString("SlideshowScreenSaverImageDir"));
addSaveFunc([sss_image_dir] {
Settings::getInstance()->setString("SlideshowScreenSaverImageDir", sss_image_dir->getValue());
@@ -60,7 +62,7 @@ GuiSlideshowScreensaverOptions::GuiSlideshowScreensaverOptions(Window* window, c
});
// custom image filter
auto sss_image_filter = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_SMALL), 0x777777FF);
auto sss_image_filter = std::make_shared<TextComponent>(mWindow, "", theme->TextSmall.font, theme->Text.color);
addEditableTextComponent(row, _("CUSTOM IMAGE FILTER"), sss_image_filter, Settings::getInstance()->getString("SlideshowScreenSaverImageFilter"));
addSaveFunc([sss_image_filter] {
Settings::getInstance()->setString("SlideshowScreenSaverImageFilter", sss_image_filter->getValue());
@@ -73,9 +75,11 @@ GuiSlideshowScreensaverOptions::~GuiSlideshowScreensaverOptions()
void GuiSlideshowScreensaverOptions::addWithLabel(ComponentListRow row, const std::string label, std::shared_ptr<GuiComponent> component)
{
auto theme = ThemeData::getMenuTheme();
row.elements.clear();
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), theme->Text.font, theme->Text.color);
row.addElement(lbl, true); // label
row.addElement(component, false, true);
@@ -85,9 +89,10 @@ void GuiSlideshowScreensaverOptions::addWithLabel(ComponentListRow row, const st
void GuiSlideshowScreensaverOptions::addEditableTextComponent(ComponentListRow row, const std::string label, std::shared_ptr<GuiComponent> ed, std::string value)
{
auto theme = ThemeData::getMenuTheme();
row.elements.clear();
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), theme->Text.font, theme->Text.color);
row.addElement(lbl, true); // label
row.addElement(ed, true);
@@ -97,7 +102,7 @@ void GuiSlideshowScreensaverOptions::addEditableTextComponent(ComponentListRow r
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>(mWindow);
bracket->setImage(":/arrow.svg");
bracket->setImage(ThemeData::getMenuTheme()->Icons.arrow);
bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight()));
row.addElement(bracket, false);
+3 -1
View File
@@ -11,13 +11,15 @@
GuiThemeInstallStart::GuiThemeInstallStart(Window* window)
:GuiComponent(window), mMenu(window, _("SELECT THEME").c_str())
{
auto theme = ThemeData::getMenuTheme();
addChild(&mMenu);
ComponentListRow row;
std::vector<std::string> availableThemes = ApiSystem::getInstance()->getBatoceraThemesList();
for(auto it = availableThemes.begin(); it != availableThemes.end(); it++){
auto itstring = std::make_shared<TextComponent>(mWindow,
(*it).c_str(), Font::get(FONT_SIZE_SMALL), 0x777777FF);
(*it).c_str(), theme->TextSmall.font, theme->Text.color);
char *tmp=new char [(*it).length()+1];
mSelectedTheme=new char [(*it).length()+1];
std::strcpy (tmp, (*it).c_str());
+3 -3
View File
@@ -51,7 +51,7 @@ void SystemView::populate()
// make logo
const ThemeData::ThemeElement* logoElem = theme->getElement("system", "logo", "image");
if(logoElem)
if(logoElem && logoElem->has("path"))
{
std::string path = logoElem->get<std::string>("path");
std::string defaultPath = logoElem->has("default") ? logoElem->get<std::string>("default") : "";
@@ -237,8 +237,8 @@ bool SystemView::input(InputConfig* config, Input input)
// batocera
if(config->isMappedTo("select", input))
{
GuiMenu::openQuitMenu_batocera_static(mWindow);
}
GuiMenu::openQuitMenu_batocera_static(mWindow, true);
}
}else{
if(config->isMappedLike("left", input) ||
config->isMappedLike("right", input) ||
+7 -4
View File
@@ -290,6 +290,7 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
std::shared_ptr<IGameListView> view;
bool themeHasVideoView = system->getTheme()->hasView("video");
bool themeHasGridView = system->getTheme()->hasView("grid");
//decide type
GameListViewType selectedViewType = AUTOMATIC;
@@ -297,11 +298,11 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
std::string viewPreference = Settings::getInstance()->getString("GamelistViewStyle");
if (viewPreference.compare("basic") == 0)
selectedViewType = BASIC;
if (viewPreference.compare("detailed") == 0)
else if (viewPreference.compare("detailed") == 0)
selectedViewType = DETAILED;
if (viewPreference.compare("grid") == 0)
else if (themeHasGridView && viewPreference.compare("grid") == 0)
selectedViewType = GRID;
if (viewPreference.compare("video") == 0)
else if (themeHasVideoView && viewPreference.compare("video") == 0)
selectedViewType = VIDEO;
if (selectedViewType == AUTOMATIC)
@@ -317,7 +318,9 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
else if (!(*it)->getThumbnailPath().empty())
{
selectedViewType = DETAILED;
// Don't break out in case any subsequent files have video
if (!themeHasVideoView)
break;
}
}
}

Some files were not shown because too many files have changed in this diff Show More