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.
This commit is contained in:
Leon Styhre 2021-09-21 19:59:09 +02:00
parent e08d3c6c1d
commit 5199f0cc02
4 changed files with 25 additions and 11 deletions

View file

@ -95,7 +95,7 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
row.addElement(labelText, false);
row.makeAcceptInputHandler([this, it, labelText] {
if (labelText->getValue() == "<CLEARED ENTRY>")
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 = "<CLEAR INVALID ENTRY>";
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(), "<CLEARED ENTRY>",
updateMenu(system->getName(),
ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY",
(entry.second ==
system->getSystemEnvData()->mLaunchCommands.front().second));
}

View file

@ -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<std::pair<std::string, std::string>> launchCommands =
scraperParams.system->getSystemEnvData()->mLaunchCommands;
if (ed->getValue() != "" && mInvalidEmulatorEntry)
launchCommands.push_back(std::make_pair("", "<CLEAR INVALID ENTRY>"));
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("", "<CLEAR ENTRY>"));
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));

View file

@ -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";

View file

@ -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;