Renamed the functions updateInfoPanel and legacyUpdateInfoPanel to updateView and legacyUpdateView in GamelistView.

This commit is contained in:
Leon Styhre 2022-08-19 17:14:20 +02:00
parent fa81853127
commit 7718e97d29
3 changed files with 12 additions and 14 deletions

View file

@ -94,8 +94,7 @@ void GamelistView::legacyPopulateFields()
mPrimary->setPosition(mSize.x * (0.50f + padding), mPrimary->getPosition().y); mPrimary->setPosition(mSize.x * (0.50f + padding), mPrimary->getPosition().y);
mPrimary->setSize(mSize.x * (0.50f - padding), mPrimary->getSize().y); mPrimary->setSize(mSize.x * (0.50f - padding), mPrimary->getSize().y);
mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT); mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT);
mPrimary->setCursorChangedCallback( mPrimary->setCursorChangedCallback([&](const CursorState& state) { legacyUpdateView(state); });
[&](const CursorState& state) { legacyUpdateInfoPanel(state); });
// Metadata labels + values. // Metadata labels + values.
mTextComponents.push_back(std::make_unique<TextComponent>()); mTextComponents.push_back(std::make_unique<TextComponent>());
@ -338,7 +337,7 @@ void GamelistView::legacyOnThemeChanged(const std::shared_ptr<ThemeData>& theme)
mHelpStyle.applyTheme(mTheme, getName()); mHelpStyle.applyTheme(mTheme, getName());
} }
void GamelistView::legacyUpdateInfoPanel(const CursorState& state) void GamelistView::legacyUpdateView(const CursorState& state)
{ {
FileData* file {(mPrimary->size() > 0 && state == CursorState::CURSOR_STOPPED) ? FileData* file {(mPrimary->size() > 0 && state == CursorState::CURSOR_STOPPED) ?
mPrimary->getSelected() : mPrimary->getSelected() :

View file

@ -74,9 +74,9 @@ void GamelistView::onShow()
GuiComponent::onShow(); GuiComponent::onShow();
if (mLegacyMode) if (mLegacyMode)
legacyUpdateInfoPanel(CursorState::CURSOR_STOPPED); legacyUpdateView(CursorState::CURSOR_STOPPED);
else else
updateInfoPanel(CursorState::CURSOR_STOPPED); updateView(CursorState::CURSOR_STOPPED);
mPrimary->finishAnimation(0); mPrimary->finishAnimation(0);
} }
@ -129,7 +129,7 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
mPrimary->setSize(mSize.x, mSize.y * 0.8f); mPrimary->setSize(mSize.x, mSize.y * 0.8f);
mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT); mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT);
mPrimary->setCursorChangedCallback( mPrimary->setCursorChangedCallback(
[&](const CursorState& state) { updateInfoPanel(state); }); [&](const CursorState& state) { updateView(state); });
mPrimary->setDefaultZIndex(50.0f); mPrimary->setDefaultZIndex(50.0f);
mPrimary->setZIndex(50.0f); mPrimary->setZIndex(50.0f);
mPrimary->applyTheme(theme, "gamelist", element.first, ALL); mPrimary->applyTheme(theme, "gamelist", element.first, ALL);
@ -163,7 +163,7 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
mPrimary = mCarousel.get(); mPrimary = mCarousel.get();
} }
mPrimary->setCursorChangedCallback( mPrimary->setCursorChangedCallback(
[&](const CursorState& state) { updateInfoPanel(state); }); [&](const CursorState& state) { updateView(state); });
mPrimary->setDefaultZIndex(50.0f); mPrimary->setDefaultZIndex(50.0f);
mPrimary->applyTheme(theme, "gamelist", element.first, ALL); mPrimary->applyTheme(theme, "gamelist", element.first, ALL);
addChild(mPrimary); addChild(mPrimary);
@ -303,8 +303,7 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
mPrimary->setPosition(0.0f, mSize.y * 0.1f); mPrimary->setPosition(0.0f, mSize.y * 0.1f);
mPrimary->setSize(mSize.x, mSize.y * 0.8f); mPrimary->setSize(mSize.x, mSize.y * 0.8f);
mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT); mPrimary->setAlignment(TextListComponent<FileData*>::PrimaryAlignment::ALIGN_LEFT);
mPrimary->setCursorChangedCallback( mPrimary->setCursorChangedCallback([&](const CursorState& state) { updateView(state); });
[&](const CursorState& state) { updateInfoPanel(state); });
mPrimary->setDefaultZIndex(50.0f); mPrimary->setDefaultZIndex(50.0f);
mPrimary->setZIndex(50.0f); mPrimary->setZIndex(50.0f);
mPrimary->applyTheme(theme, "gamelist", "", ALL); mPrimary->applyTheme(theme, "gamelist", "", ALL);
@ -420,10 +419,10 @@ std::vector<HelpPrompt> GamelistView::getHelpPrompts()
return prompts; return prompts;
} }
void GamelistView::updateInfoPanel(const CursorState& state) void GamelistView::updateView(const CursorState& state)
{ {
if (mLegacyMode) { if (mLegacyMode) {
legacyUpdateInfoPanel(state); legacyUpdateView(state);
return; return;
} }

View file

@ -23,7 +23,7 @@ public:
void onShow() override; void onShow() override;
void onTransition() override; void onTransition() override;
void preloadGamelist() { updateInfoPanel(CursorState::CURSOR_STOPPED); } void preloadGamelist() { updateView(CursorState::CURSOR_STOPPED); }
void launch(FileData* game) override { ViewController::getInstance()->triggerGameLaunch(game); } void launch(FileData* game) override { ViewController::getInstance()->triggerGameLaunch(game); }
std::string getName() const std::string getName() const
@ -96,13 +96,13 @@ public:
std::vector<HelpPrompt> getHelpPrompts() override; std::vector<HelpPrompt> getHelpPrompts() override;
private: private:
void updateInfoPanel(const CursorState& state); void updateView(const CursorState& state);
void setGameImage(FileData* file, GuiComponent* comp); void setGameImage(FileData* file, GuiComponent* comp);
// Legacy (backward compatibility) functions. // Legacy (backward compatibility) functions.
void legacyPopulateFields(); void legacyPopulateFields();
void legacyOnThemeChanged(const std::shared_ptr<ThemeData>& theme); void legacyOnThemeChanged(const std::shared_ptr<ThemeData>& theme);
void legacyUpdateInfoPanel(const CursorState& state); void legacyUpdateView(const CursorState& state);
void legacyUpdate(int deltaTime); void legacyUpdate(int deltaTime);
void legacyInitMDLabels(); void legacyInitMDLabels();
void legacyInitMDValues(); void legacyInitMDValues();