Clearing an arcade game name in the metadata editor now sets it to the expanded MAME name.

This commit is contained in:
Leon Styhre 2021-11-26 23:24:43 +01:00
parent 2db8724f4a
commit 909f96622d

View file

@ -14,6 +14,7 @@
#include "FileData.h" #include "FileData.h"
#include "FileFilterIndex.h" #include "FileFilterIndex.h"
#include "Gamelist.h" #include "Gamelist.h"
#include "MameNames.h"
#include "SystemData.h" #include "SystemData.h"
#include "Window.h" #include "Window.h"
#include "components/ButtonComponent.h" #include "components/ButtonComponent.h"
@ -21,6 +22,7 @@
#include "components/DateTimeEditComponent.h" #include "components/DateTimeEditComponent.h"
#include "components/MenuComponent.h" #include "components/MenuComponent.h"
#include "components/RatingComponent.h" #include "components/RatingComponent.h"
#include "components/SwitchComponent.h" #include "components/SwitchComponent.h"
#include "components/TextComponent.h" #include "components/TextComponent.h"
#include "guis/GuiGameScraper.h" #include "guis/GuiGameScraper.h"
@ -422,11 +424,15 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
gamePath = Utils::FileSystem::getStem(mScraperParams.game->getPath()); gamePath = Utils::FileSystem::getStem(mScraperParams.game->getPath());
// OK callback (apply new value to ed). // OK callback (apply new value to ed).
auto updateVal = [ed, currentKey, originalValue, auto updateVal = [ed, currentKey, originalValue, gamePath,
gamePath](const std::string& newVal) { scraperParams](const std::string& newVal) {
// If the user has entered a blank game name, then set the name to the ROM // If the user has entered a blank game name, then set the name to the ROM
// filename (minus the extension). // filename (minus the extension).
if (currentKey == "name" && newVal == "") { if (currentKey == "name" && newVal == "") {
if (scraperParams.game->isArcadeGame())
ed->setValue(MameNames::getInstance().getCleanName(
scraperParams.game->getCleanName()));
else
ed->setValue(gamePath); ed->setValue(gamePath);
if (gamePath == originalValue) if (gamePath == originalValue)
ed->setColor(DEFAULT_TEXTCOLOR); ed->setColor(DEFAULT_TEXTCOLOR);