From 5199f0cc0276efe136d95ee6f38525d16d5d3fc4 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 21 Sep 2021 19:59:09 +0200 Subject: [PATCH] Invalid entry values are now displayed for the alternative emulators field in the metadata editor. Also made the 'clear entry' fields look nicer in the metadata editor and the alternative emulators GUI. --- es-app/src/guis/GuiAlternativeEmulators.cpp | 7 +++--- es-app/src/guis/GuiMetaDataEd.cpp | 26 ++++++++++++++------- es-app/src/views/ViewController.cpp | 2 ++ es-app/src/views/ViewController.h | 1 + 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/es-app/src/guis/GuiAlternativeEmulators.cpp b/es-app/src/guis/GuiAlternativeEmulators.cpp index 3b36d1972..2ae241799 100644 --- a/es-app/src/guis/GuiAlternativeEmulators.cpp +++ b/es-app/src/guis/GuiAlternativeEmulators.cpp @@ -95,7 +95,7 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window) row.addElement(labelText, false); row.makeAcceptInputHandler([this, it, labelText] { - if (labelText->getValue() == "") + if (labelText->getValue() == ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY") return; selectorWindow(*it); }); @@ -154,7 +154,7 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system) ComponentListRow row; if (entry.second == "") - label = ""; + label = ViewController::CROSSEDCIRCLE_CHAR + " CLEAR INVALID ENTRY"; else label = entry.second; @@ -175,7 +175,8 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system) if (entry.second == system->getSystemEnvData()->mLaunchCommands.front().second) { if (system->getSystemEnvData()->mLaunchCommands.front().second == "") { - updateMenu(system->getName(), "", + updateMenu(system->getName(), + ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY", (entry.second == system->getSystemEnvData()->mLaunchCommands.front().second)); } diff --git a/es-app/src/guis/GuiMetaDataEd.cpp b/es-app/src/guis/GuiMetaDataEd.cpp index cf53d98ed..1c73698ab 100644 --- a/es-app/src/guis/GuiMetaDataEd.cpp +++ b/es-app/src/guis/GuiMetaDataEd.cpp @@ -217,20 +217,30 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, if (mInvalidEmulatorEntry || scraperParams.system->getSystemEnvData()->mLaunchCommands.size() > 1) { - row.makeAcceptInputHandler([this, title, scraperParams, ed, updateVal] { - auto s = new GuiSettings(mWindow, title); + row.makeAcceptInputHandler([this, title, scraperParams, ed, updateVal, + originalValue] { + GuiSettings* s = nullptr; - if (!mInvalidEmulatorEntry && ed->getValue() == "" && - scraperParams.system->getSystemEnvData()->mLaunchCommands.size() == 1) + bool singleEntry = + scraperParams.system->getSystemEnvData()->mLaunchCommands.size() == 1; + + if (mInvalidEmulatorEntry && singleEntry) + s = new GuiSettings(mWindow, "CLEAR INVALID ENTRY"); + else + s = new GuiSettings(mWindow, title); + + if (!mInvalidEmulatorEntry && ed->getValue() == "" && singleEntry) return; std::vector> launchCommands = scraperParams.system->getSystemEnvData()->mLaunchCommands; - if (ed->getValue() != "" && mInvalidEmulatorEntry) - launchCommands.push_back(std::make_pair("", "")); + if (ed->getValue() != "" && mInvalidEmulatorEntry && singleEntry) + launchCommands.push_back(std::make_pair( + "", ViewController::EXCLAMATION_CHAR + " " + originalValue)); else if (ed->getValue() != "") - launchCommands.push_back(std::make_pair("", "")); + launchCommands.push_back(std::make_pair( + "", ViewController::CROSSEDCIRCLE_CHAR + " CLEAR ENTRY")); for (auto entry : launchCommands) { std::string selectedLabel = ed->getValue(); @@ -385,7 +395,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, mList->addRow(row); if (iter->type == MD_ALT_EMULATOR && mInvalidEmulatorEntry == true) - ed->setValue(ViewController::EXCLAMATION_CHAR + " INVALID ENTRY "); + ed->setValue(ViewController::EXCLAMATION_CHAR + " " + originalValue); else ed->setValue(mMetaData->get(iter->key)); diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 4add03ba4..74977005a 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -39,6 +39,7 @@ ViewController* ViewController::sInstance = nullptr; #if defined(_MSC_VER) // MSVC compiler. const std::string ViewController::CONTROLLER_CHAR = Utils::String::wideStringToString(L"\uf11b"); +const std::string ViewController::CROSSEDCIRCLE_CHAR = Utils::String::wideStringToString(L"\uf05e"); const std::string ViewController::EXCLAMATION_CHAR = Utils::String::wideStringToString(L"\uf06a"); const std::string ViewController::FAVORITE_CHAR = Utils::String::wideStringToString(L"\uf005"); const std::string ViewController::FILTER_CHAR = Utils::String::wideStringToString(L"\uf0b0"); @@ -47,6 +48,7 @@ const std::string ViewController::GEAR_CHAR = Utils::String::wideStringToString( const std::string ViewController::TICKMARK_CHAR = Utils::String::wideStringToString(L"\uf14A"); #else const std::string ViewController::CONTROLLER_CHAR = "\uf11b"; +const std::string ViewController::CROSSEDCIRCLE_CHAR = "\uf05e"; const std::string ViewController::EXCLAMATION_CHAR = "\uf06a"; const std::string ViewController::FAVORITE_CHAR = "\uf005"; const std::string ViewController::FILTER_CHAR = "\uf0b0"; diff --git a/es-app/src/views/ViewController.h b/es-app/src/views/ViewController.h index 38c0560a0..a3898e377 100644 --- a/es-app/src/views/ViewController.h +++ b/es-app/src/views/ViewController.h @@ -124,6 +124,7 @@ public: // Font Awesome symbols. static const std::string CONTROLLER_CHAR; + static const std::string CROSSEDCIRCLE_CHAR; static const std::string EXCLAMATION_CHAR; static const std::string FAVORITE_CHAR; static const std::string FILTER_CHAR;