Skip to content

Commit

Permalink
helpscreen.cpp: Silence GCC warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Sep 1, 2023
1 parent 9d1d89f commit 60a3860
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/screens/helpscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ std::string to_string(const WidgetHelp::InteractionTriggers& trigger)
case WidgetHelp::InteractionTriggers::Misc:
return _("Other");
}
return ""; // silence warning
}

std::string to_string(const std::set<WidgetHelp::InteractionTriggers>& triggers)
Expand Down Expand Up @@ -333,26 +334,26 @@ class HelpDisplayForm: public W_FORM
auto primary_mapping = gInputManager.mappings().get(keybinding.keybindingName, KeyMappingSlot::PRIMARY);
auto secondary_mapping = gInputManager.mappings().get(keybinding.keybindingName, KeyMappingSlot::SECONDARY);
WzString keybindingsStr;
const std::string *pKeyDisplayName = nullptr;
WzString keyDisplayName;
if (primary_mapping.has_value())
{
if (!keybindingsStr.isEmpty()) { keybindingsStr.append("\n"); }
keybindingsStr.append(WzString::fromUtf8(primary_mapping.value().get().toString()));
pKeyDisplayName = &(primary_mapping.value().get().info.displayName);
keyDisplayName = WzString::fromUtf8(primary_mapping.value().get().info.displayName);
}
if (secondary_mapping.has_value())
{
if (!keybindingsStr.isEmpty()) { keybindingsStr.append("\n"); }
keybindingsStr.append(WzString::fromUtf8(secondary_mapping.value().get().toString()));
pKeyDisplayName = &(secondary_mapping.value().get().info.displayName);
keyDisplayName = WzString::fromUtf8(secondary_mapping.value().get().info.displayName);
}
if (keybindingsStr.isEmpty() || !pKeyDisplayName)
if (keybindingsStr.isEmpty() || keyDisplayName.isEmpty())
{
continue;
}
auto interaction_type = std::make_shared<W_LABEL>();
interaction_type->setFont(font_regular_bold, WZCOL_TEXT_MEDIUM);
interaction_type->setString(WzString::fromUtf8(*pKeyDisplayName));
interaction_type->setString(keyDisplayName);
interaction_type->setGeometry(0, 0, std::min(interaction_type->getMaxLineWidth(), MaxWidth / 2), interaction_type->requiredHeight());

auto interaction_effect = std::make_shared<Paragraph>();
Expand Down

0 comments on commit 60a3860

Please sign in to comment.