mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-18 04:45:39 +00:00
Fixed an issue where the game count info text would sometimes pop in during initial system view navigation.
This commit is contained in:
parent
28ff747514
commit
57a6747bf4
|
@ -496,6 +496,7 @@ void SystemView::populate()
|
||||||
|
|
||||||
if (mLegacyMode) {
|
if (mLegacyMode) {
|
||||||
SystemViewElements elements;
|
SystemViewElements elements;
|
||||||
|
elements.system = it;
|
||||||
elements.name = it->getName();
|
elements.name = it->getName();
|
||||||
elements.legacyExtras = ThemeData::makeExtras(theme, "system");
|
elements.legacyExtras = ThemeData::makeExtras(theme, "system");
|
||||||
|
|
||||||
|
@ -510,6 +511,7 @@ void SystemView::populate()
|
||||||
|
|
||||||
if (!mLegacyMode) {
|
if (!mLegacyMode) {
|
||||||
SystemViewElements elements;
|
SystemViewElements elements;
|
||||||
|
elements.system = it;
|
||||||
if (theme->hasView("system")) {
|
if (theme->hasView("system")) {
|
||||||
elements.name = it->getName();
|
elements.name = it->getName();
|
||||||
elements.fullName = it->getFullName();
|
elements.fullName = it->getFullName();
|
||||||
|
@ -796,6 +798,9 @@ void SystemView::populate()
|
||||||
entry.data.entryType = TextListEntryType::PRIMARY;
|
entry.data.entryType = TextListEntryType::PRIMARY;
|
||||||
mTextList->addEntry(entry);
|
mTextList->addEntry(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the game counter here so the text doesn't pop in during initial navigation.
|
||||||
|
updateGameCount(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mGrid != nullptr)
|
if (mGrid != nullptr)
|
||||||
|
@ -829,21 +834,22 @@ void SystemView::populate()
|
||||||
"TransitionsSystemToSystem")) == ViewTransitionAnimation::FADE);
|
"TransitionsSystemToSystem")) == ViewTransitionAnimation::FADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemView::updateGameCount()
|
void SystemView::updateGameCount(SystemData* system)
|
||||||
{
|
{
|
||||||
std::pair<unsigned int, unsigned int> gameCount {
|
SystemData* sourceSystem {system == nullptr ? mPrimary->getSelected() : system};
|
||||||
mPrimary->getSelected()->getDisplayedGameCount()};
|
|
||||||
|
std::pair<unsigned int, unsigned int> gameCount {sourceSystem->getDisplayedGameCount()};
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
std::stringstream ssGames;
|
std::stringstream ssGames;
|
||||||
std::stringstream ssFavorites;
|
std::stringstream ssFavorites;
|
||||||
bool games {false};
|
bool games {false};
|
||||||
const bool favoriteSystem {mPrimary->getSelected()->getName() == "favorites"};
|
const bool favoriteSystem {sourceSystem->getName() == "favorites"};
|
||||||
const bool recentSystem {mPrimary->getSelected()->getName() == "recent"};
|
const bool recentSystem {sourceSystem->getName() == "recent"};
|
||||||
|
|
||||||
if (mPrimary->getSelected()->isCollection() && favoriteSystem) {
|
if (sourceSystem->isCollection() && favoriteSystem) {
|
||||||
ss << gameCount.first << " Game" << (gameCount.first == 1 ? " " : "s");
|
ss << gameCount.first << " Game" << (gameCount.first == 1 ? " " : "s");
|
||||||
}
|
}
|
||||||
else if (mPrimary->getSelected()->isCollection() && recentSystem) {
|
else if (sourceSystem->isCollection() && recentSystem) {
|
||||||
// The "recent" gamelist has probably been trimmed after sorting, so we'll cap it at
|
// The "recent" gamelist has probably been trimmed after sorting, so we'll cap it at
|
||||||
// its maximum limit of 50 games.
|
// its maximum limit of 50 games.
|
||||||
ss << (gameCount.first > 50 ? 50 : gameCount.first) << " Game"
|
ss << (gameCount.first > 50 ? 50 : gameCount.first) << " Game"
|
||||||
|
@ -861,7 +867,11 @@ void SystemView::updateGameCount()
|
||||||
mLegacySystemInfo->setText(ss.str());
|
mLegacySystemInfo->setText(ss.str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (auto& gameCountComp : mSystemElements[mPrimary->getCursor()].gameCountComponents) {
|
auto elementsIt = std::find_if(mSystemElements.cbegin(), mSystemElements.cend(),
|
||||||
|
[sourceSystem](const SystemViewElements& systemElements) {
|
||||||
|
return systemElements.system == sourceSystem;
|
||||||
|
});
|
||||||
|
for (auto& gameCountComp : (*elementsIt).gameCountComponents) {
|
||||||
if (gameCountComp->getThemeSystemdata() == "gamecount") {
|
if (gameCountComp->getThemeSystemdata() == "gamecount") {
|
||||||
gameCountComp->setValue(ss.str());
|
gameCountComp->setValue(ss.str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,12 +105,13 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void populate();
|
void populate();
|
||||||
void updateGameCount();
|
void updateGameCount(SystemData* system = nullptr);
|
||||||
void updateGameSelectors();
|
void updateGameSelectors();
|
||||||
void legacyApplyTheme(const std::shared_ptr<ThemeData>& theme);
|
void legacyApplyTheme(const std::shared_ptr<ThemeData>& theme);
|
||||||
void renderElements(const glm::mat4& parentTrans, bool abovePrimary);
|
void renderElements(const glm::mat4& parentTrans, bool abovePrimary);
|
||||||
|
|
||||||
struct SystemViewElements {
|
struct SystemViewElements {
|
||||||
|
SystemData* system;
|
||||||
HelpStyle helpStyle;
|
HelpStyle helpStyle;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string fullName;
|
std::string fullName;
|
||||||
|
|
Loading…
Reference in a new issue