From 4a38271f6aa394f576ae0c3e3783065d7aa4d832 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 9 Jun 2020 20:03:31 +0200 Subject: [PATCH] Expanded the help system to (hopefully) the whole application, removed the completely broken command line scraper and fixed some bugs related to the game collections. --- es-app/CMakeLists.txt | 2 - es-app/src/CollectionSystemManager.cpp | 24 +- es-app/src/ScraperCmdLine.cpp | 290 ------------------ es-app/src/ScraperCmdLine.h | 7 - .../src/guis/GuiCollectionSystemsOptions.cpp | 7 +- es-app/src/guis/GuiGameScraper.cpp | 3 +- es-app/src/guis/GuiGamelistFilter.cpp | 1 + es-app/src/guis/GuiGamelistOptions.cpp | 21 +- es-app/src/guis/GuiGamelistOptions.h | 1 + es-app/src/guis/GuiMenu.cpp | 28 +- es-app/src/guis/GuiMenu.h | 1 + es-app/src/guis/GuiMetaDataEd.cpp | 64 ++-- es-app/src/guis/GuiMetaDataEd.h | 2 +- es-app/src/guis/GuiScraperMenu.cpp | 10 +- es-app/src/guis/GuiScraperMulti.cpp | 5 +- es-app/src/guis/GuiScraperSearch.cpp | 11 +- es-app/src/guis/GuiScraperSearch.h | 1 + es-app/src/guis/GuiScreensaverOptions.cpp | 23 +- es-app/src/guis/GuiSettings.cpp | 22 +- es-app/src/main.cpp | 36 +-- es-core/src/GuiComponent.cpp | 12 + es-core/src/GuiComponent.h | 6 + .../src/components/DateTimeEditComponent.cpp | 7 + .../src/components/DateTimeEditComponent.h | 2 + es-core/src/components/OptionListComponent.h | 5 +- es-core/src/components/RatingComponent.cpp | 51 ++- es-core/src/components/RatingComponent.h | 5 +- es-core/src/components/SliderComponent.cpp | 2 +- es-core/src/components/SwitchComponent.cpp | 2 +- es-core/src/components/TextEditComponent.cpp | 8 +- es-core/src/guis/GuiComplexTextEditPopup.cpp | 3 +- 31 files changed, 205 insertions(+), 457 deletions(-) delete mode 100644 es-app/src/ScraperCmdLine.cpp delete mode 100644 es-app/src/ScraperCmdLine.h diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index d5e6ea4d3..586db4f5e 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -6,7 +6,6 @@ set(ES_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/FileSorts.h ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.h ${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.h ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.h ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.h ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h @@ -60,7 +59,6 @@ set(ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp diff --git a/es-app/src/CollectionSystemManager.cpp b/es-app/src/CollectionSystemManager.cpp index 7e3fec132..301d009b2 100644 --- a/es-app/src/CollectionSystemManager.cpp +++ b/es-app/src/CollectionSystemManager.cpp @@ -354,12 +354,18 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS } else { ViewController::get()->onFileChanged(rootFolder, FILE_SORTED); - // If it's a custom collection and the collections - // are grouped, update the parent instead. + // If it's a custom collection and the setting to group the collections is + // enabled, we may have to update the parent instead. + // However it may not necessarily be so if some collections are themed and + // some are not, so we always need to check whether a parent exists. if (sysData.decl.isCustom && Settings::getInstance()->getBool("UseCustomCollectionsSystem")) { - ViewController::get()->onFileChanged( - rootFolder->getParent(), FILE_METADATA_CHANGED); + // In case of a returned null pointer, we know there is no parent. + if (rootFolder->getParent() == nullptr) + ViewController::get()->onFileChanged(rootFolder, FILE_METADATA_CHANGED); + else + ViewController::get()->onFileChanged( + rootFolder->getParent(), FILE_METADATA_CHANGED); } } } @@ -914,12 +920,14 @@ void CollectionSystemManager::addEnabledCollectionsToDisplayedSystems( FileData* rootFolder = it->second.system->getRootFolder(); rootFolder->sort(getSortTypeFromString(rootFolder->getSortTypeString()), Settings::getInstance()->getBool("FavFirstCustom")); - // Jump to the first row of the game list + // Jump to the first row of the game list, assuming it's not empty. IGameListView* gameList = ViewController::get()-> getGameListView((it->second.system)).get(); - FileData* firstRow = gameList->getCursor()-> - getParent()->getChildrenListToDisplay()[0]; - gameList->setCursor(firstRow); + if (!gameList->getCursor()->isPlaceHolder()) { + FileData* firstRow = gameList->getCursor()-> + getParent()->getChildrenListToDisplay().front(); + gameList->setCursor(firstRow); + } } } else { diff --git a/es-app/src/ScraperCmdLine.cpp b/es-app/src/ScraperCmdLine.cpp deleted file mode 100644 index dda563595..000000000 --- a/es-app/src/ScraperCmdLine.cpp +++ /dev/null @@ -1,290 +0,0 @@ -#include "ScraperCmdLine.h" - -#include "Log.h" -#include "platform.h" -#include "SystemData.h" -#include -#include -#if defined(__linux__) -#include -#elif defined(WIN32) -#include -#endif - -std::ostream& out = std::cout; - -void handle_interrupt_signal(int /*p*/) -{ - sleep(50); - - LOG(LogInfo) << "Interrupt received during scrape..."; - - SystemData::deleteSystems(); - - exit(1); -} - -int run_scraper_cmdline() -{ - out << "EmulationStation scraper\n"; - out << "========================\n"; - out << "\n"; - - signal(SIGINT, handle_interrupt_signal); - - //================================================================================== - //filter - //================================================================================== - enum FilterChoice - { - FILTER_MISSING_IMAGES, - FILTER_ALL - }; - - int filter_choice; - do { - out << "Select filter for games to be scraped:\n"; - out << FILTER_MISSING_IMAGES << " - games missing images\n"; - out << FILTER_ALL << " - all games period, can overwrite existing metadata\n"; - - std::cin >> filter_choice; - std::cin.ignore(1, '\n'); //skip the unconsumed newline - } while(filter_choice < FILTER_MISSING_IMAGES || filter_choice > FILTER_ALL); - - out << "\n"; - - //================================================================================== - //platforms - //================================================================================== - - std::vector systems; - - out << "You can scrape only specific platforms, or scrape all of them.\n"; - out << "Would you like to scrape all platforms? (y/n)\n"; - - std::string system_choice; - std::getline(std::cin, system_choice); - - if(system_choice == "y" || system_choice == "Y") - { - out << "Will scrape all platforms.\n"; - for(auto i = SystemData::sSystemVector.cbegin(); i != SystemData::sSystemVector.cend(); i++) - { - out << " " << (*i)->getName() << " (" << (*i)->getGameCount() << " games)\n"; - systems.push_back(*i); - } - - }else{ - std::string sys_name; - - out << "Enter the names of the platforms you would like to scrape, one at a time.\n"; - out << "Type nothing and press enter when you are ready to continue.\n"; - - do { - for(auto i = SystemData::sSystemVector.cbegin(); i != SystemData::sSystemVector.cend(); i++) - { - if(std::find(systems.cbegin(), systems.cend(), (*i)) != systems.cend()) - out << " C "; - else - out << " "; - - out << "\"" << (*i)->getName() << "\" (" << (*i)->getGameCount() << " games)\n"; - } - - std::getline(std::cin, sys_name); - - if(sys_name.empty()) - break; - - bool found = false; - for(auto i = SystemData::sSystemVector.cbegin(); i != SystemData::sSystemVector.cend(); i++) - { - if((*i)->getName() == sys_name) - { - systems.push_back(*i); - found = true; - break; - } - } - - if(!found) - out << "System not found.\n"; - - } while(true); - } - - //================================================================================== - //manual mode - //================================================================================== - - out << "\n"; - out << "You can let the scraper try to automatically choose the best result, or\n"; - out << "you can manually approve each result. This \"manual mode\" is much more accurate.\n"; - out << "It is highly recommended you use manual mode unless you have a very large collection.\n"; - out << "Scrape in manual mode? (y/n)\n"; - - std::string manual_mode_str; - std::getline(std::cin, manual_mode_str); - - bool manual_mode = false; - - if(manual_mode_str == "y" || manual_mode_str == "Y") - { - manual_mode = true; - out << "Scraping in manual mode!\n"; - }else{ - out << "Scraping in automatic mode!\n"; - } - - //================================================================================== - //scraping - //================================================================================== - out << "\n"; - out << "Alright, let's do this thing!\n"; - out << "=============================\n"; - - /* - std::shared_ptr scraper = Settings::getInstance()->getScraper(); - for(auto sysIt = systems.cbegin(); sysIt != systems.cend(); sysIt++) - { - std::vector files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME); - - ScraperSearchParams params; - params.system = (*sysIt); - - for(auto gameIt = files.cbegin(); gameIt != files.cend(); gameIt++) - { - params.nameOverride = ""; - params.game = *gameIt; - - //print original search term - out << getCleanFileName(params.game->getPath()) << "...\n"; - - //need to take into account filter_choice - if(filter_choice == FILTER_MISSING_IMAGES) - { - if(!params.game->metadata.get("image").empty()) //maybe should also check if the image file exists/is a URL - { - out << " Skipping, metadata \"image\" entry is not empty.\n"; - continue; - } - } - - //actually get some results - do { - std::vector mdls = scraper->getResults(params); - - //no results - if(mdls.size() == 0) - { - if(manual_mode) - { - //in manual mode let the user enter a custom search - out << " NO RESULTS FOUND! Enter a new name to search for, or nothing to skip.\n"; - - std::getline(std::cin, params.nameOverride); - - if(params.nameOverride.empty()) - { - out << " Skipping...\n"; - break; - } - - continue; - - }else{ - out << " NO RESULTS FOUND! Skipping...\n"; - break; - } - } - - //some results - if(manual_mode) - { - //print list of choices - for(unsigned int i = 0; i < mdls.size(); i++) - { - out << " " << i << " - " << mdls.at(i).get("name") << "\n"; - } - - int choice = -1; - std::string choice_str; - - out << "Your choice: "; - - std::getline(std::cin, choice_str); - std::stringstream choice_buff(choice_str); //convert to int - choice_buff >> choice; - - if(choice >= 0 && choice < (int)mdls.size()) - { - params.game->metadata = mdls.at(choice); - break; - }else{ - out << "Invalid choice.\n"; - continue; - } - - }else{ - //automatic mode - //always choose the first choice - out << " name -> " << mdls.at(0).get("name") << "\n"; - params.game->metadata = mdls.at(0); - break; - } - - } while(true); - - out << "===================\n"; - } - } - - out << "\n\n"; - out << "Downloading boxart...\n"; - - for(auto sysIt = systems.cbegin(); sysIt != systems.cend(); sysIt++) - { - std::vector files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME); - - for(auto gameIt = files.cbegin(); gameIt != files.cend(); gameIt++) - { - FileData* game = *gameIt; - const std::vector& mdd = game->metadata.getMDD(); - for(auto i = mdd.cbegin(); i != mdd.cend(); i++) - { - std::string key = i->key; - std::string url = game->metadata.get(key); - - if(i->type == MD_IMAGE_PATH && HttpReq::isUrl(url)) - { - std::string urlShort = url.substr(0, url.length() > 35 ? 35 : url.length()); - if(url.length() != urlShort.length()) urlShort += "..."; - - out << " " << game->metadata.get("name") << " [from: " << urlShort << "]...\n"; - - ScraperSearchParams p; - p.game = game; - p.system = *sysIt; - game->metadata.set(key, downloadImage(url, getSaveAsPath(p, key, url))); - if(game->metadata.get(key).empty()) - { - out << " FAILED! Skipping.\n"; - game->metadata.set(key, url); //result URL to what it was if download failed, retry some other time - } - } - } - } - } - - - out << "\n\n"; - out << "==============================\n"; - out << "SCRAPE COMPLETE!\n"; - out << "==============================\n"; - */ - - out << "\n\n"; - out << "ACTUALLY THIS IS STILL TODO\n"; - - return 0; -} diff --git a/es-app/src/ScraperCmdLine.h b/es-app/src/ScraperCmdLine.h deleted file mode 100644 index 32f238eaf..000000000 --- a/es-app/src/ScraperCmdLine.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#ifndef ES_APP_SCRAPER_CMD_LINE_H -#define ES_APP_SCRAPER_CMD_LINE_H - -int run_scraper_cmdline(); - -#endif // ES_APP_SCRAPER_CMD_LINE_H diff --git a/es-app/src/guis/GuiCollectionSystemsOptions.cpp b/es-app/src/guis/GuiCollectionSystemsOptions.cpp index 78ca87b09..179c12322 100644 --- a/es-app/src/guis/GuiCollectionSystemsOptions.cpp +++ b/es-app/src/guis/GuiCollectionSystemsOptions.cpp @@ -56,6 +56,10 @@ void GuiCollectionSystemsOptions::initializeMenu() ComponentListRow row; row.addElement(std::make_shared(mWindow, "CREATE NEW CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + auto bracket = std::make_shared(mWindow); + bracket->setImage(":/arrow.svg"); + bracket->setResize(Vector2f(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight())); + row.addElement(bracket, false); 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 @@ -65,7 +69,7 @@ void GuiCollectionSystemsOptions::initializeMenu() createCollection(name); }; row.makeAcceptInputHandler([this, createCustomCollection] { - mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "New Collection Name", "", createCustomCollection, false)); + mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "New Collection Name", "", createCustomCollection, false, "SAVE")); }); mMenu.addRow(row); @@ -220,6 +224,7 @@ bool GuiCollectionSystemsOptions::input(InputConfig* config, Input input) std::vector GuiCollectionSystemsOptions::getHelpPrompts() { std::vector prompts = mMenu.getHelpPrompts(); + prompts.push_back(HelpPrompt("a", "select")); prompts.push_back(HelpPrompt("b", "back")); return prompts; } diff --git a/es-app/src/guis/GuiGameScraper.cpp b/es-app/src/guis/GuiGameScraper.cpp index 5ae2a9298..d3ac1a676 100644 --- a/es-app/src/guis/GuiGameScraper.cpp +++ b/es-app/src/guis/GuiGameScraper.cpp @@ -54,7 +54,8 @@ GuiGameScraper::GuiGameScraper( // Buttons std::vector< std::shared_ptr > buttons; - buttons.push_back(std::make_shared(mWindow, "INPUT", "search", [&] { + buttons.push_back(std::make_shared(mWindow, "REFINE SEARCH", + "refine search", [&] { mSearch->openInputScreen(mSearchParams); mGrid.resetCursor(); })); diff --git a/es-app/src/guis/GuiGamelistFilter.cpp b/es-app/src/guis/GuiGamelistFilter.cpp index 3e43d7b26..981811672 100644 --- a/es-app/src/guis/GuiGamelistFilter.cpp +++ b/es-app/src/guis/GuiGamelistFilter.cpp @@ -126,6 +126,7 @@ std::vector GuiGamelistFilter::getHelpPrompts() { std::vector prompts = mMenu.getHelpPrompts(); prompts.push_back(HelpPrompt("b", "back")); + prompts.push_back(HelpPrompt("a", "select")); return prompts; } diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index cb1ce5c59..bdde8ca01 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -29,7 +29,8 @@ GuiGamelistOptions::GuiGamelistOptions( mSystem(system), mMenu(window, "OPTIONS"), fromPlaceholder(false), - mFiltersChanged(false) + mFiltersChanged(false), + mCancelled(false) { addChild(&mMenu); @@ -140,8 +141,8 @@ GuiGamelistOptions::GuiGamelistOptions( // Show filtered menu. if (system->getName() != "recent" && !Settings::getInstance()->getBool("ForceDisableFilters")) { row.elements.clear(); - row.addElement(std::make_shared( - mWindow, "FILTER GAMELIST", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + row.addElement(std::make_shared + (mWindow, "FILTER GAMELIST", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); row.addElement(makeArrow(mWindow), false); row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::openGamelistFilter, this)); mMenu.addRow(row); @@ -192,6 +193,9 @@ GuiGamelistOptions::GuiGamelistOptions( GuiGamelistOptions::~GuiGamelistOptions() { + if (mCancelled) + return; + if (!fromPlaceholder) { FileData* root = mSystem->getRootFolder(); @@ -316,8 +320,11 @@ void GuiGamelistOptions::jumpToFirstRow() bool GuiGamelistOptions::input(InputConfig* config, Input input) { - if ((config->isMappedTo("b", input) || - config->isMappedTo("select", input)) && input.value) { + if (input.value != 0 && config->isMappedTo("select", input)) + mCancelled = true; + + if (input.value != 0 && (config->isMappedTo("b", input) || + config->isMappedTo("select", input))) { delete this; return true; } @@ -335,7 +342,9 @@ HelpStyle GuiGamelistOptions::getHelpStyle() std::vector GuiGamelistOptions::getHelpPrompts() { auto prompts = mMenu.getHelpPrompts(); - prompts.push_back(HelpPrompt("b", "close")); + prompts.push_back(HelpPrompt("a", "select")); + prompts.push_back(HelpPrompt("b", "close (apply)")); + prompts.push_back(HelpPrompt("select", "close (cancel)")); return prompts; } diff --git a/es-app/src/guis/GuiGamelistOptions.h b/es-app/src/guis/GuiGamelistOptions.h index 0d591dafd..67d7e9420 100644 --- a/es-app/src/guis/GuiGamelistOptions.h +++ b/es-app/src/guis/GuiGamelistOptions.h @@ -55,6 +55,7 @@ private: bool mFavoritesSorting; bool fromPlaceholder; bool mFiltersChanged; + bool mCancelled; }; #endif // ES_APP_GUIS_GUI_GAME_LIST_OPTIONS_H diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index b6580d674..aa3c4e630 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -562,8 +562,7 @@ void GuiMenu::openQuitMenu() if (Settings::getInstance()->getBool("ShowExit")) { row.makeAcceptInputHandler([window, this] { window->pushGui(new GuiMsgBox(window, this->getHelpStyle(), - "REALLY QUIT?", "YES", - [] { + "REALLY QUIT?", "YES", [] { Scripting::fireEvent("quit"); quitES(); }, "NO", nullptr)); @@ -651,14 +650,30 @@ void GuiMenu::addEntry(const char* name, unsigned int color, mMenu.addRow(row); } +void GuiMenu::close(bool closeAllWindows) +{ + std::function closeFunc; + if (!closeAllWindows) { + closeFunc = [this] { delete this; }; + } + else { + Window* window = mWindow; + closeFunc = [window, this] { + while (window->peekGui() != ViewController::get()) + delete window->peekGui(); + }; + } + closeFunc(); +} + bool GuiMenu::input(InputConfig* config, Input input) { if (GuiComponent::input(config, input)) return true; - if ((config->isMappedTo("b", input) || config->isMappedTo("start", input)) && - input.value != 0) { - delete this; + const bool isStart = config->isMappedTo("start", input); + if (input.value != 0 && (config->isMappedTo("b", input) || isStart)) { + close(isStart); return true; } @@ -670,7 +685,8 @@ std::vector GuiMenu::getHelpPrompts() std::vector prompts; prompts.push_back(HelpPrompt("up/down", "choose")); prompts.push_back(HelpPrompt("a", "select")); - prompts.push_back(HelpPrompt("start", "close")); + prompts.push_back(HelpPrompt("b", "close menu")); + prompts.push_back(HelpPrompt("start", "close menu")); return prompts; } diff --git a/es-app/src/guis/GuiMenu.h b/es-app/src/guis/GuiMenu.h index 9273f9392..48c4b1654 100644 --- a/es-app/src/guis/GuiMenu.h +++ b/es-app/src/guis/GuiMenu.h @@ -23,6 +23,7 @@ public: HelpStyle getHelpStyle() override; private: + void close(bool closeAllWindows); void addEntry(const char* name, unsigned int color, bool add_arrow, const std::function& func); void addVersionInfo(); diff --git a/es-app/src/guis/GuiMetaDataEd.cpp b/es-app/src/guis/GuiMetaDataEd.cpp index 62421513c..4b2353353 100644 --- a/es-app/src/guis/GuiMetaDataEd.cpp +++ b/es-app/src/guis/GuiMetaDataEd.cpp @@ -88,6 +88,9 @@ GuiMetaDataEd::GuiMetaDataEd( // Create ed and add it (and any related components) to mMenu. // ed's value will be set below. + // It's very important to put the element with the help prompt as the last row + // entry instead of for instance the spacer. That is so because ComponentList + // always looks for the help prompt at the back of the element stack. ComponentListRow row; auto lbl = std::make_shared(mWindow, Utils::String::toUpper(iter->displayName), Font::get(FONT_SIZE_SMALL), 0x777777FF); @@ -100,28 +103,28 @@ GuiMetaDataEd::GuiMetaDataEd( break; } case MD_RATING: { + auto spacer = std::make_shared(mWindow); + spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0); + row.addElement(spacer, false); + ed = std::make_shared(window); const float height = lbl->getSize().y() * 0.71f; ed->setSize(0, height); row.addElement(ed, false, true); - auto spacer = std::make_shared(mWindow); - spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0); - row.addElement(spacer, false); - // Pass input to the actual RatingComponent instead of the spacer. row.input_handler = std::bind(&GuiComponent::input, ed.get(), std::placeholders::_1, std::placeholders::_2); break; } case MD_DATE: { - ed = std::make_shared(window); - row.addElement(ed, false); - auto spacer = std::make_shared(mWindow); spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0); row.addElement(spacer, false); + ed = std::make_shared(window); + row.addElement(ed, false); + // Pass input to the actual DateTimeEditComponent instead of the spacer. row.input_handler = std::bind(&GuiComponent::input, ed.get(), std::placeholders::_1, std::placeholders::_2); @@ -160,7 +163,7 @@ GuiMetaDataEd::GuiMetaDataEd( defaultLaunchString, ed, updateVal, multiLine] { mWindow->pushGui(new GuiComplexTextEditPopup(mWindow, getHelpStyle(), title, staticTextString, defaultLaunchString, ed->getValue(), - updateVal, multiLine)); + updateVal, multiLine, "SAVE")); }); break; } @@ -187,7 +190,7 @@ GuiMetaDataEd::GuiMetaDataEd( auto updateVal = [ed](const std::string& newVal) { ed->setValue(newVal); }; row.makeAcceptInputHandler([this, title, ed, updateVal, multiLine] { mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), title, - ed->getValue(), updateVal, multiLine)); + ed->getValue(), updateVal, multiLine, "SAVE")); }); break; } @@ -205,9 +208,9 @@ GuiMetaDataEd::GuiMetaDataEd( buttons.push_back(std::make_shared(mWindow, "SCRAPE", "scrape", std::bind(&GuiMetaDataEd::fetch, this))); - buttons.push_back(std::make_shared(mWindow, "SAVE", "save", + buttons.push_back(std::make_shared(mWindow, "SAVE", "save metadata", [&] { save(); delete this; })); - buttons.push_back(std::make_shared(mWindow, "CANCEL", "cancel", + buttons.push_back(std::make_shared(mWindow, "CANCEL", "cancel changes", [&] { delete this; })); if (mDeleteFunc) { @@ -217,7 +220,7 @@ GuiMetaDataEd::GuiMetaDataEd( "THIS WILL DELETE THE ACTUAL GAME FILE(S)!\nARE YOU SURE?", "YES", deleteFileAndSelf, "NO", nullptr)); }; buttons.push_back(std::make_shared(mWindow, "DELETE", - "delete", deleteBtnFunc)); + "delete game", deleteBtnFunc)); } mButtons = makeButtonGrid(mWindow, buttons); @@ -292,16 +295,13 @@ void GuiMetaDataEd::fetchDone(const ScraperSearchResult& result) // Update the list with the scraped metadata values. for (unsigned int i = 0; i < mEditors.size(); i++) { const std::string& key = mMetaDataDecl.at(i).key; -// if (mEditors.at(i)->getValue() != metadata->get(key)) { -// mEditors.at(i)->setOpacity(150); -// } mEditors.at(i)->setValue(metadata->get(key)); } delete metadata; } -void GuiMetaDataEd::close(bool closeAllWindows) +void GuiMetaDataEd::close() { // Find out if the user made any changes. bool dirty = mMetadataUpdated; @@ -311,9 +311,7 @@ void GuiMetaDataEd::close(bool closeAllWindows) std::string mEditorsValue = mEditors.at(i)->getValue(); // Incredibly ugly workaround to avoid the "SAVE CHANGES?" window for games - // with mising metadata for rating and release date. - if (key == "rating" && (mMetaDataValue == "" || mMetaDataValue == "0.000000")) - mMetaDataValue = "0"; + // with missing release date metadata. if (key == "releasedate" && (mMetaDataValue == "" || mMetaDataValue == "not-a-date-time")) mMetaDataValue = "19700101T010000"; @@ -323,17 +321,21 @@ void GuiMetaDataEd::close(bool closeAllWindows) } } +// Keep code for potential future use. +// std::function closeFunc; +// if (!closeAllWindows) { +// closeFunc = [this] { delete this; }; +// } +// else { +// Window* window = mWindow; +// closeFunc = [window, this] { +// while (window->peekGui() != ViewController::get()) +// delete window->peekGui(); +// }; +// } + std::function closeFunc; - if (!closeAllWindows) { closeFunc = [this] { delete this; }; - } - else { - Window* window = mWindow; - closeFunc = [window, this] { - while (window->peekGui() != ViewController::get()) - delete window->peekGui(); - }; - } if (dirty) { @@ -354,9 +356,8 @@ bool GuiMetaDataEd::input(InputConfig* config, Input input) if (GuiComponent::input(config, input)) return true; - const bool isStart = config->isMappedTo("start", input); - if (input.value != 0 && (config->isMappedTo("b", input) || isStart)) { - close(isStart); + if (input.value != 0 && (config->isMappedTo("b", input))) { + close(); return true; } @@ -367,7 +368,6 @@ std::vector GuiMetaDataEd::getHelpPrompts() { std::vector prompts = mGrid.getHelpPrompts(); prompts.push_back(HelpPrompt("b", "back")); - prompts.push_back(HelpPrompt("start", "close")); return prompts; } diff --git a/es-app/src/guis/GuiMetaDataEd.h b/es-app/src/guis/GuiMetaDataEd.h index 1751030a1..9925b37d4 100644 --- a/es-app/src/guis/GuiMetaDataEd.h +++ b/es-app/src/guis/GuiMetaDataEd.h @@ -41,7 +41,7 @@ private: void save(); void fetch(); void fetchDone(const ScraperSearchResult& result); - void close(bool closeAllWindows); + void close(); NinePatchComponent mBackground; ComponentGrid mGrid; diff --git a/es-app/src/guis/GuiScraperMenu.cpp b/es-app/src/guis/GuiScraperMenu.cpp index a4438e027..d356661e7 100644 --- a/es-app/src/guis/GuiScraperMenu.cpp +++ b/es-app/src/guis/GuiScraperMenu.cpp @@ -242,8 +242,6 @@ void GuiScraperMenu::start() "NO GAMES TO SCRAPE")); } else { - - bool testbool = Settings::getInstance()->getBool("ScraperInteractive"); GuiScraperMulti* gsm = new GuiScraperMulti(mWindow, searches, Settings::getInstance()->getBool("ScraperInteractive")); mWindow->pushGui(gsm); @@ -293,7 +291,7 @@ bool GuiScraperMenu::input(InputConfig* config, Input input) if (GuiComponent::input(config, input)) return true; - if ((config->isMappedTo("b", input) || config->isMappedTo("start", input)) && + if (config->isMappedTo("b", input) && input.value != 0) { delete this; return true; @@ -304,10 +302,8 @@ bool GuiScraperMenu::input(InputConfig* config, Input input) std::vector GuiScraperMenu::getHelpPrompts() { - std::vector prompts; - prompts.push_back(HelpPrompt("up/down", "choose")); - prompts.push_back(HelpPrompt("a", "select")); - prompts.push_back(HelpPrompt("start", "close")); + std::vector prompts = mMenu.getHelpPrompts(); + prompts.push_back(HelpPrompt("b", "back")); return prompts; } diff --git a/es-app/src/guis/GuiScraperMulti.cpp b/es-app/src/guis/GuiScraperMulti.cpp index fcb3a174b..0ff251a1f 100644 --- a/es-app/src/guis/GuiScraperMulti.cpp +++ b/es-app/src/guis/GuiScraperMulti.cpp @@ -68,12 +68,13 @@ GuiScraperMulti::GuiScraperMulti( std::vector< std::shared_ptr > buttons; if (approveResults) { - buttons.push_back(std::make_shared(mWindow, "INPUT", "search", [&] { + buttons.push_back(std::make_shared(mWindow, "REFINE SEARCH", + "refine search", [&] { mSearchComp->openInputScreen(mSearchQueue.front()); mGrid.resetCursor(); })); - buttons.push_back(std::make_shared(mWindow, "SKIP", "skip", [&] { + buttons.push_back(std::make_shared(mWindow, "SKIP", "skip game", [&] { skip(); mGrid.resetCursor(); })); diff --git a/es-app/src/guis/GuiScraperSearch.cpp b/es-app/src/guis/GuiScraperSearch.cpp index e3232712d..3541f6063 100644 --- a/es-app/src/guis/GuiScraperSearch.cpp +++ b/es-app/src/guis/GuiScraperSearch.cpp @@ -285,6 +285,7 @@ void GuiScraperSearch::onSearchDone(const std::vector& resu "FINISH", mSkipCallback)); } else { + mFoundGame = false; ComponentListRow row; row.addElement(std::make_shared(mWindow, "NO GAMES FOUND - SKIP", font, color), true); @@ -297,6 +298,7 @@ void GuiScraperSearch::onSearchDone(const std::vector& resu } } else { + mFoundGame = true; ComponentListRow row; for (size_t i = 0; i < results.size(); i++) { row.elements.clear(); @@ -587,7 +589,7 @@ void GuiScraperSearch::openInputScreen(ScraperSearchParams& params) if (params.system->hasPlatformId(PlatformIds::ARCADE) || params.system->hasPlatformId(PlatformIds::NEOGEO)) { - mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "SEARCH FOR", + mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH", // Initial value is last search if there was one, otherwise the clean path name. // If it's a MAME or Neo Geo game, expand the game name accordingly. params.nameOverride.empty() ? @@ -596,7 +598,7 @@ void GuiScraperSearch::openInputScreen(ScraperSearchParams& params) searchForFunc, false, "SEARCH", "APPLY CHANGES?")); } else { - mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "SEARCH FOR", + mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH", // Initial value is last search if there was one, otherwise the clean path name. params.nameOverride.empty() ? params.game->getCleanName() : params.nameOverride, searchForFunc, false, "SEARCH", "APPLY CHANGES?")); @@ -660,8 +662,9 @@ bool GuiScraperSearch::saveMetadata( std::vector GuiScraperSearch::getHelpPrompts() { - std::vector prompts = mGrid.getHelpPrompts(); - if (getSelectedIndex() != -1) + std::vector prompts; + + if (mFoundGame) prompts.push_back(HelpPrompt("a", "accept result")); return prompts; diff --git a/es-app/src/guis/GuiScraperSearch.h b/es-app/src/guis/GuiScraperSearch.h index 254dc008f..aca31e3b4 100644 --- a/es-app/src/guis/GuiScraperSearch.h +++ b/es-app/src/guis/GuiScraperSearch.h @@ -116,6 +116,7 @@ private: std::function mSkipCallback; std::function mCancelCallback; bool mBlockAccept; + bool mFoundGame; std::unique_ptr mSearchHandle; std::unique_ptr mMDRetrieveURLsHandle; diff --git a/es-app/src/guis/GuiScreensaverOptions.cpp b/es-app/src/guis/GuiScreensaverOptions.cpp index 095361ea7..90d88ae37 100644 --- a/es-app/src/guis/GuiScreensaverOptions.cpp +++ b/es-app/src/guis/GuiScreensaverOptions.cpp @@ -10,7 +10,7 @@ GuiScreensaverOptions::GuiScreensaverOptions(Window* window, const char* title) { addChild(&mMenu); - mMenu.addButton("BACK", "go back", [this] { delete this; }); + mMenu.addButton("BACK", "back", [this] { delete this; }); setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); mMenu.setPosition((mSize.x() - mMenu.getSize().x()) / 2, Renderer::getScreenHeight() * 0.15f); @@ -34,22 +34,16 @@ void GuiScreensaverOptions::save() bool GuiScreensaverOptions::input(InputConfig* config, Input input) { - if(config->isMappedTo("b", input) && input.value != 0) - { + if (GuiComponent::input(config, input)) + return true; + + if (config->isMappedTo("b", input) && + input.value != 0) { delete this; return true; } - if(config->isMappedTo("start", input) && input.value != 0) - { - // close everything - Window* window = mWindow; - while(window->peekGui() && window->peekGui() != ViewController::get()) - delete window->peekGui(); - return true; - } - - return GuiComponent::input(config, input); + return false; } HelpStyle GuiScreensaverOptions::getHelpStyle() @@ -62,10 +56,7 @@ HelpStyle GuiScreensaverOptions::getHelpStyle() std::vector GuiScreensaverOptions::getHelpPrompts() { std::vector prompts = mMenu.getHelpPrompts(); - prompts.push_back(HelpPrompt("b", "back")); - prompts.push_back(HelpPrompt("start", "close")); - return prompts; } diff --git a/es-app/src/guis/GuiSettings.cpp b/es-app/src/guis/GuiSettings.cpp index 98e4c0fd5..a7087af9c 100644 --- a/es-app/src/guis/GuiSettings.cpp +++ b/es-app/src/guis/GuiSettings.cpp @@ -9,7 +9,7 @@ GuiSettings::GuiSettings(Window* window, const char* title) : GuiComponent(windo { addChild(&mMenu); - mMenu.addButton("BACK", "go back", [this] { delete this; }); + mMenu.addButton("BACK", "back", [this] { delete this; }); setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); mMenu.setPosition((mSize.x() - mMenu.getSize().x()) / 2, Renderer::getScreenHeight() * 0.15f); @@ -39,14 +39,15 @@ bool GuiSettings::input(InputConfig* config, Input input) return true; } - if(config->isMappedTo("start", input) && input.value != 0) - { - // close everything - Window* window = mWindow; - while(window->peekGui() && window->peekGui() != ViewController::get()) - delete window->peekGui(); - return true; - } +// Keep code for potential future use. +// if(config->isMappedTo("start", input) && input.value != 0) +// { +// // close everything +// Window* window = mWindow; +// while(window->peekGui() && window->peekGui() != ViewController::get()) +// delete window->peekGui(); +// return true; +// } return GuiComponent::input(config, input); } @@ -61,9 +62,6 @@ HelpStyle GuiSettings::getHelpStyle() std::vector GuiSettings::getHelpPrompts() { std::vector prompts = mMenu.getHelpPrompts(); - prompts.push_back(HelpPrompt("b", "back")); - prompts.push_back(HelpPrompt("start", "close")); - return prompts; } diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index f80d47b80..41d7c7f82 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -27,7 +27,6 @@ #include "MameNames.h" #include "platform.h" #include "PowerSaver.h" -#include "ScraperCmdLine.h" #include "Settings.h" #include "SystemData.h" #include "SystemScreenSaver.h" @@ -42,8 +41,6 @@ #include -bool scrape_cmdline = false; - bool parseArgs(int argc, char* argv[]) { Utils::FileSystem::setExePath(argv[0]); @@ -168,9 +165,6 @@ bool parseArgs(int argc, char* argv[]) strcmp(argv[i + 1], "1") == 0) ? true : false; Settings::getInstance()->setBool("VSync", vsync); i++; // Skip vsync value. -// } -// else if (strcmp(argv[i], "--scrape") == 0) { -// scrape_cmdline = true; } else if (strcmp(argv[i], "--force-kiosk") == 0) { Settings::getInstance()->setBool("ForceKiosk", true); @@ -210,7 +204,6 @@ bool parseArgs(int argc, char* argv[]) #else "--debug Print debug information\n" #endif -//"--scrape Scrape using command line interface\n" "--windowed Windowed mode, should be combined with --resolution\n" "--fullscreen-normal Normal fullscreen mode\n" "--fullscreen-borderless Borderless fullscreen mode (always on top)\n" @@ -356,18 +349,16 @@ int main(int argc, char* argv[]) bool splashScreen = Settings::getInstance()->getBool("SplashScreen"); bool splashScreenProgress = Settings::getInstance()->getBool("SplashScreenProgress"); - if (!scrape_cmdline) { - if (!window.init()) { - LOG(LogError) << "Window failed to initialize!"; - return 1; - } + if (!window.init()) { + LOG(LogError) << "Window failed to initialize!"; + return 1; + } - if (splashScreen) { - std::string progressText = "Loading..."; - if (splashScreenProgress) - progressText = "Loading system config..."; - window.renderLoadingScreen(progressText); - } + if (splashScreen) { + std::string progressText = "Loading..."; + if (splashScreenProgress) + progressText = "Loading system config..."; + window.renderLoadingScreen(progressText); } const char* errorMsg = NULL; @@ -376,8 +367,7 @@ int main(int argc, char* argv[]) if (errorMsg == NULL) { LOG(LogError) << "Unknown error occured while parsing system config file."; - if (!scrape_cmdline) - Renderer::deinit(); + Renderer::deinit(); return 1; } @@ -395,12 +385,6 @@ int main(int argc, char* argv[]) })); } - // Run the command line scraper then quit. - if (scrape_cmdline) - { - return run_scraper_cmdline(); - } - // Dont generate joystick events while we're loading. // (Hopefully fixes "automatically started emulator" bug.) SDL_JoystickEventState(SDL_DISABLE); diff --git a/es-core/src/GuiComponent.cpp b/es-core/src/GuiComponent.cpp index 38f30b0ac..97cbc7a36 100644 --- a/es-core/src/GuiComponent.cpp +++ b/es-core/src/GuiComponent.cpp @@ -257,6 +257,18 @@ void GuiComponent::setOpacity(unsigned char opacity) (*it)->setOpacity(opacity); } +void GuiComponent::setColor(unsigned int color) +{ + mColor = color; + mColorOpacity = mColor & 0x000000FF; +} + +void GuiComponent::setColorShift(unsigned int color) +{ + mColorShift = color; + mColorShiftEnd = color; +} + const Transform4x4f& GuiComponent::getTransform() { mTransform = Transform4x4f::Identity(); diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h index 0e32d43c1..db8dfa960 100644 --- a/es-core/src/GuiComponent.h +++ b/es-core/src/GuiComponent.h @@ -130,6 +130,8 @@ public: virtual unsigned char getOpacity() const; virtual void setOpacity(unsigned char opacity); + virtual void setColor(unsigned int color); + virtual void setColorShift(unsigned int color); const Transform4x4f& getTransform(); @@ -170,6 +172,10 @@ protected: void updateChildren(int deltaTime); // Updates animations. unsigned char mOpacity; + unsigned int mColor; + unsigned char mColorOpacity; + unsigned int mColorShift; + unsigned int mColorShiftEnd; Window* mWindow; GuiComponent* mParent; diff --git a/es-core/src/components/DateTimeEditComponent.cpp b/es-core/src/components/DateTimeEditComponent.cpp index 87044885c..65d7f3bfd 100644 --- a/es-core/src/components/DateTimeEditComponent.cpp +++ b/es-core/src/components/DateTimeEditComponent.cpp @@ -354,3 +354,10 @@ void DateTimeEditComponent::applyTheme(const std::shared_ptr& theme, setFont(Font::getFromTheme(elem, properties, mFont)); } + +std::vector DateTimeEditComponent::getHelpPrompts() +{ + std::vector prompts; + prompts.push_back(HelpPrompt("a", "edit date")); + return prompts; +} diff --git a/es-core/src/components/DateTimeEditComponent.h b/es-core/src/components/DateTimeEditComponent.h index 3e90fa268..4b9c602ab 100644 --- a/es-core/src/components/DateTimeEditComponent.h +++ b/es-core/src/components/DateTimeEditComponent.h @@ -52,6 +52,8 @@ public: virtual void applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) override; + virtual std::vector getHelpPrompts() override; + private: std::shared_ptr getFont() const; diff --git a/es-core/src/components/OptionListComponent.h b/es-core/src/components/OptionListComponent.h index 36b700fc3..6313e95d6 100644 --- a/es-core/src/components/OptionListComponent.h +++ b/es-core/src/components/OptionListComponent.h @@ -250,7 +250,7 @@ private: { std::vector prompts; if(!mMultiSelect) - prompts.push_back(HelpPrompt("left/right", "change")); + prompts.push_back(HelpPrompt("left/right", "change value")); prompts.push_back(HelpPrompt("a", "select")); return prompts; @@ -325,7 +325,7 @@ private: mMenu.addRow(row, (!mParent->mMultiSelect && it->selected)); } - mMenu.addButton("BACK", "accept", [this] { delete this; }); + mMenu.addButton("BACK", "back", [this] { delete this; }); if(mParent->mMultiSelect) { mMenu.addButton("SELECT ALL", "select all", [this, checkboxes] { @@ -363,6 +363,7 @@ private: std::vector getHelpPrompts() override { auto prompts = mMenu.getHelpPrompts(); + prompts.push_back(HelpPrompt("a", "select")); prompts.push_back(HelpPrompt("b", "back")); return prompts; } diff --git a/es-core/src/components/RatingComponent.cpp b/es-core/src/components/RatingComponent.cpp index 8de87db8a..62ea51336 100644 --- a/es-core/src/components/RatingComponent.cpp +++ b/es-core/src/components/RatingComponent.cpp @@ -8,16 +8,16 @@ #include "components/RatingComponent.h" #include "resources/TextureResource.h" +#include "Settings.h" #include "ThemeData.h" RatingComponent::RatingComponent(Window* window) : GuiComponent(window), - mColorShift(0xFFFFFFFF), mUnfilledColor(0xFFFFFFFF) + mColorShift(0xFFFFFFFF), mColorShiftEnd(0xFFFFFFFF), mUnfilledColor(0xFFFFFFFF) { mFilledTexture = TextureResource::get(":/star_filled.svg", true); mUnfilledTexture = TextureResource::get(":/star_unfilled.svg", true); mValue = 0.5f; mSize = Vector2f(64 * NUM_RATING_STARS, 64); - mHideRatingComponent = false; updateVertices(); updateColors(); } @@ -50,12 +50,6 @@ std::string RatingComponent::getValue() const void RatingComponent::setOpacity(unsigned char opacity) { - // Completely hide component if opacity if set to zero. - if (opacity == 0) - mHideRatingComponent = true; - else - mHideRatingComponent = false; - mOpacity = opacity; mColorShift = (mColorShift >> 8 << 8) | mOpacity; updateColors(); @@ -64,6 +58,8 @@ void RatingComponent::setOpacity(unsigned char opacity) void RatingComponent::setColorShift(unsigned int color) { mColorShift = color; + mColorShiftEnd = color; + // Grab the opacity from the color shift because we may need // to apply it if fading in textures. mOpacity = color & 0xff; @@ -126,31 +122,34 @@ void RatingComponent::render(const Transform4x4f& parentTrans) if (!isVisible() || mFilledTexture == nullptr || mUnfilledTexture == nullptr) return; - // If set to true, hide rating component. - if (mHideRatingComponent) - return; - Transform4x4f trans = parentTrans * getTransform(); Renderer::setMatrix(trans); - if (mUnfilledTexture->bind()) { - if (mUnfilledColor != mColorShift) { - const unsigned int color = Renderer::convertColor(mUnfilledColor); - for (int i = 0; i < 8; ++i) - mVertices[i].col = color; + if (mOpacity > 0) { + if(Settings::getInstance()->getBool("DebugImage")) { + Renderer::drawRect(0.0f, 0.0f, mSize.y() * NUM_RATING_STARS, + mSize.y(), 0x00000033, 0x00000033); } - Renderer::drawTriangleStrips(&mVertices[4], 4); - Renderer::bindTexture(0); + if (mUnfilledTexture->bind()) { + if (mUnfilledColor != mColorShift) { + const unsigned int color = Renderer::convertColor(mUnfilledColor); + for (int i = 0; i < 8; ++i) + mVertices[i].col = color; + } - if (mUnfilledColor != mColorShift) - updateColors(); - } + Renderer::drawTriangleStrips(&mVertices[4], 4); + Renderer::bindTexture(0); - if (mFilledTexture->bind()) { - Renderer::drawTriangleStrips(&mVertices[0], 4); - Renderer::bindTexture(0); + if (mUnfilledColor != mColorShift) + updateColors(); + } + + if (mFilledTexture->bind()) { + Renderer::drawTriangleStrips(&mVertices[0], 4); + Renderer::bindTexture(0); + } } renderChildren(trans); @@ -206,6 +205,6 @@ void RatingComponent::applyTheme(const std::shared_ptr& theme, std::vector RatingComponent::getHelpPrompts() { std::vector prompts; - prompts.push_back(HelpPrompt("a", "add star")); + prompts.push_back(HelpPrompt("a", "add half star")); return prompts; } diff --git a/es-core/src/components/RatingComponent.h b/es-core/src/components/RatingComponent.h index 511acc283..9b3f573fe 100644 --- a/es-core/src/components/RatingComponent.h +++ b/es-core/src/components/RatingComponent.h @@ -46,6 +46,8 @@ public: virtual std::vector getHelpPrompts() override; private: + Vector2f mTargetSize; + void updateVertices(); void updateColors(); @@ -54,9 +56,8 @@ private: Renderer::Vertex mVertices[8]; unsigned int mColorShift; + unsigned int mColorShiftEnd; unsigned int mUnfilledColor; - // If set to true, the rating component is hidden. - bool mHideRatingComponent; std::shared_ptr mFilledTexture; std::shared_ptr mUnfilledTexture; diff --git a/es-core/src/components/SliderComponent.cpp b/es-core/src/components/SliderComponent.cpp index aba8174c4..385058cee 100644 --- a/es-core/src/components/SliderComponent.cpp +++ b/es-core/src/components/SliderComponent.cpp @@ -137,6 +137,6 @@ void SliderComponent::onValueChanged() std::vector SliderComponent::getHelpPrompts() { std::vector prompts; - prompts.push_back(HelpPrompt("left/right", "change")); + prompts.push_back(HelpPrompt("left/right", "change value")); return prompts; } diff --git a/es-core/src/components/SwitchComponent.cpp b/es-core/src/components/SwitchComponent.cpp index 61c090ee9..accd98b39 100644 --- a/es-core/src/components/SwitchComponent.cpp +++ b/es-core/src/components/SwitchComponent.cpp @@ -76,6 +76,6 @@ void SwitchComponent::onStateChanged() std::vector SwitchComponent::getHelpPrompts() { std::vector prompts; - prompts.push_back(HelpPrompt("a", "change")); + prompts.push_back(HelpPrompt("a", "toggle")); return prompts; } diff --git a/es-core/src/components/TextEditComponent.cpp b/es-core/src/components/TextEditComponent.cpp index be11d6c79..e48803d60 100644 --- a/es-core/src/components/TextEditComponent.cpp +++ b/es-core/src/components/TextEditComponent.cpp @@ -127,9 +127,10 @@ bool TextEditComponent::input(InputConfig* config, Input input) return true; } - // Stop editing. + // Done editing (accept changes). if ((config->getDeviceId() == DEVICE_KEYBOARD && input.id == SDLK_ESCAPE) || - (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedTo("b", input))) { + (config->getDeviceId() != DEVICE_KEYBOARD && (config->isMappedTo("a", input) || + config->isMappedTo("b", input)))) { mTextOrig = mText; stopEditing(); return true; @@ -305,7 +306,8 @@ std::vector TextEditComponent::getHelpPrompts() if (mEditing) { prompts.push_back(HelpPrompt("up/down/left/right", "move cursor")); prompts.push_back(HelpPrompt("y", "backspace")); - prompts.push_back(HelpPrompt("b", "stop editing")); + prompts.push_back(HelpPrompt("a", "accept changes")); + prompts.push_back(HelpPrompt("b", "accept changes")); } else { prompts.push_back(HelpPrompt("a", "edit")); diff --git a/es-core/src/guis/GuiComplexTextEditPopup.cpp b/es-core/src/guis/GuiComplexTextEditPopup.cpp index b4ee95ad7..4a8784450 100644 --- a/es-core/src/guis/GuiComplexTextEditPopup.cpp +++ b/es-core/src/guis/GuiComplexTextEditPopup.cpp @@ -54,7 +54,8 @@ GuiComplexTextEditPopup::GuiComplexTextEditPopup( buttons.push_back(std::make_shared(mWindow, acceptBtnText, acceptBtnText, [this, okCallback] { okCallback(mText->getValue()); delete this; })); buttons.push_back(std::make_shared(mWindow, "LOAD", "load default string", - [this, infoString2] { mText->setValue(infoString2); })); + [this, infoString2] { + mText->setValue(infoString2); mText->setCursor(infoString2.size()); })); buttons.push_back(std::make_shared(mWindow, "CLEAR", "clear string", [this] { mText->setValue(""); })); buttons.push_back(std::make_shared(mWindow, "CANCEL", "discard changes",