mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Rewrote the logic for the 'none' value for the helpsystem element scope property
This commit is contained in:
parent
57815f6633
commit
db2b00a49e
|
@ -352,8 +352,6 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
||||||
else if (element.second.type == "helpsystem") {
|
else if (element.second.type == "helpsystem") {
|
||||||
mHelpComponents.emplace_back(std::make_unique<HelpComponent>());
|
mHelpComponents.emplace_back(std::make_unique<HelpComponent>());
|
||||||
mHelpComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);
|
mHelpComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);
|
||||||
if (mHelpComponents.back()->getHelpComponentScope() == HelpComponentScope::NONE)
|
|
||||||
mHelpComponents.pop_back();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -726,10 +726,6 @@ void SystemView::populate()
|
||||||
elements.helpComponents.emplace_back(std::make_unique<HelpComponent>());
|
elements.helpComponents.emplace_back(std::make_unique<HelpComponent>());
|
||||||
elements.helpComponents.back()->applyTheme(theme, "system", element.first,
|
elements.helpComponents.back()->applyTheme(theme, "system", element.first,
|
||||||
ThemeFlags::ALL);
|
ThemeFlags::ALL);
|
||||||
if (elements.helpComponents.back()->getHelpComponentScope() ==
|
|
||||||
HelpComponentScope::NONE) {
|
|
||||||
elements.helpComponents.pop_back();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,6 +608,8 @@ void Window::render()
|
||||||
if (!mRenderedHelpPrompts) {
|
if (!mRenderedHelpPrompts) {
|
||||||
if (mHelpComponents != nullptr) {
|
if (mHelpComponents != nullptr) {
|
||||||
for (auto& helpComponent : *mHelpComponents) {
|
for (auto& helpComponent : *mHelpComponents) {
|
||||||
|
if (helpComponent->getHelpComponentScope() == HelpComponentScope::NONE)
|
||||||
|
continue;
|
||||||
if (helpComponent->getHelpComponentScope() != HelpComponentScope::VIEW) {
|
if (helpComponent->getHelpComponentScope() != HelpComponentScope::VIEW) {
|
||||||
helpComponent->setVisible(true);
|
helpComponent->setVisible(true);
|
||||||
helpComponent->render(trans);
|
helpComponent->render(trans);
|
||||||
|
@ -773,6 +775,8 @@ void Window::renderHelpPromptsEarly()
|
||||||
{
|
{
|
||||||
if (mHelpComponents != nullptr) {
|
if (mHelpComponents != nullptr) {
|
||||||
for (auto& helpComponent : *mHelpComponents) {
|
for (auto& helpComponent : *mHelpComponents) {
|
||||||
|
if (helpComponent->getHelpComponentScope() == HelpComponentScope::NONE)
|
||||||
|
continue;
|
||||||
if (helpComponent->getHelpComponentScope() != HelpComponentScope::MENU) {
|
if (helpComponent->getHelpComponentScope() != HelpComponentScope::MENU) {
|
||||||
helpComponent->setVisible(true);
|
helpComponent->setVisible(true);
|
||||||
helpComponent->render(mRenderer->getIdentity());
|
helpComponent->render(mRenderer->getIdentity());
|
||||||
|
@ -855,11 +859,13 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts)
|
||||||
|
|
||||||
if (mHelpComponents != nullptr) {
|
if (mHelpComponents != nullptr) {
|
||||||
for (auto& helpComponent : *mHelpComponents) {
|
for (auto& helpComponent : *mHelpComponents) {
|
||||||
|
if (helpComponent->getHelpComponentScope() == HelpComponentScope::NONE)
|
||||||
|
continue;
|
||||||
if (mGuiStack.size() == 1 &&
|
if (mGuiStack.size() == 1 &&
|
||||||
helpComponent->getHelpComponentScope() == HelpComponentScope::MENU)
|
helpComponent->getHelpComponentScope() == HelpComponentScope::MENU)
|
||||||
continue;
|
continue;
|
||||||
else if (mGuiStack.size() > 1 &&
|
if (mGuiStack.size() > 1 &&
|
||||||
helpComponent->getHelpComponentScope() == HelpComponentScope::VIEW)
|
helpComponent->getHelpComponentScope() == HelpComponentScope::VIEW)
|
||||||
continue;
|
continue;
|
||||||
helpComponent->clearPrompts();
|
helpComponent->clearPrompts();
|
||||||
helpComponent->setPrompts(addPrompts);
|
helpComponent->setPrompts(addPrompts);
|
||||||
|
|
|
@ -270,11 +270,6 @@ void HelpComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
if (!elem)
|
if (!elem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (elem->has("scope") && elem->get<std::string>("scope") == "none") {
|
|
||||||
mHelpComponentScope = HelpComponentScope::NONE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elem->has("pos"))
|
if (elem->has("pos"))
|
||||||
mStylePosition = elem->get<glm::vec2>("pos") *
|
mStylePosition = elem->get<glm::vec2>("pos") *
|
||||||
glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()};
|
glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()};
|
||||||
|
@ -329,6 +324,9 @@ void HelpComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
else if (scope == "menu") {
|
else if (scope == "menu") {
|
||||||
mHelpComponentScope = HelpComponentScope::MENU;
|
mHelpComponentScope = HelpComponentScope::MENU;
|
||||||
}
|
}
|
||||||
|
else if (scope == "none") {
|
||||||
|
mHelpComponentScope = HelpComponentScope::NONE;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
LOG(LogWarning) << "HelpComponent: Invalid theme configuration, property "
|
LOG(LogWarning) << "HelpComponent: Invalid theme configuration, property "
|
||||||
"\"scope\" for element \""
|
"\"scope\" for element \""
|
||||||
|
|
Loading…
Reference in a new issue