Add version to game screen

This commit is contained in:
iota97 2022-03-11 07:23:42 +01:00
parent 2abe3d6152
commit ccef3de34c
2 changed files with 9 additions and 2 deletions

View file

@ -111,7 +111,8 @@ void GameScreen::CreateViews() {
tvTitle_ = infoLayout->Add(new TextView(info->GetTitle(), ALIGN_LEFT | FLAG_WRAP_TEXT, false, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
tvTitle_->SetShadow(true);
infoLayout->Add(new Spacer(12));
tvID_ = infoLayout->Add(new TextView("", ALIGN_LEFT | FLAG_WRAP_TEXT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
tvID_->SetShadow(true);
// This one doesn't need to be updated.
infoLayout->Add(new TextView(gamePath_.ToVisualString(), ALIGN_LEFT | FLAG_WRAP_TEXT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetShadow(true);
tvGameSize_ = infoLayout->Add(new TextView("...", ALIGN_LEFT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
@ -133,6 +134,7 @@ void GameScreen::CreateViews() {
tvInstallDataSize_ = nullptr;
tvRegion_ = nullptr;
tvCRC_ = nullptr;
tvID_ = nullptr;
}
ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
@ -256,7 +258,7 @@ void GameScreen::render() {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(thin3d, gamePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE);
if (tvTitle_) {
tvTitle_->SetText(info->GetTitle() + " (" + info->id + ")");
tvTitle_->SetText(info->GetTitle());
}
if (info->gameSize) {
@ -299,6 +301,10 @@ void GameScreen::render() {
tvCRC_->SetVisibility(UI::V_VISIBLE);
}
if (tvID_) {
tvID_->SetText(ReplaceAll(info->id_version, "_", " v"));
}
if (!info->id.empty()) {
btnGameSettings_->SetVisibility(info->hasConfig ? UI::V_VISIBLE : UI::V_GONE);
btnDeleteGameConfig_->SetVisibility(info->hasConfig ? UI::V_VISIBLE : UI::V_GONE);

View file

@ -72,6 +72,7 @@ private:
UI::TextView *tvInstallDataSize_ = nullptr;
UI::TextView *tvRegion_ = nullptr;
UI::TextView *tvCRC_ = nullptr;
UI::TextView *tvID_ = nullptr;
UI::Choice *btnGameSettings_ = nullptr;
UI::Choice *btnCreateGameConfig_ = nullptr;