Fix homebrew store button to work even after changing grid layouts (it lost its click handler)

This commit is contained in:
Henrik Rydgård
2020-05-17 14:57:12 +02:00
parent 90071fd868
commit 7c8bcb2ee4
2 changed files with 15 additions and 27 deletions
+7 -16
View File
@@ -628,7 +628,6 @@ void GameBrowser::Refresh() {
lastScale_ = g_Config.fGameGridScale;
lastLayoutWasGrid_ = *gridStyle_;
homebrewStoreButton_ = nullptr;
// Kill all the contents
Clear();
@@ -785,9 +784,7 @@ void GameBrowser::Refresh() {
if (browseFlags_ & BrowseFlags::HOMEBREW_STORE) {
Add(new Spacer());
homebrewStoreButton_ = Add(new Choice(mm->T("DownloadFromStore", "Download from the PPSSPP Homebrew Store"), new UI::LinearLayoutParams(UI::WRAP_CONTENT, UI::WRAP_CONTENT)));
} else {
homebrewStoreButton_ = nullptr;
Add(new Choice(mm->T("DownloadFromStore", "Download from the PPSSPP Homebrew Store"), new UI::LinearLayoutParams(UI::WRAP_CONTENT, UI::WRAP_CONTENT)))->OnClick.Handle(this, &GameBrowser::OnHomebrewStore);
}
if (!lastText_.empty() && gameButtons.empty()) {
@@ -908,7 +905,12 @@ UI::EventReturn GameBrowser::OnRecentClear(UI::EventParams &e) {
return UI::EVENT_DONE;
}
MainScreen::MainScreen() : highlightProgress_(0.0f), prevHighlightProgress_(0.0f), backFromStore_(false), lockBackgroundAudio_(false) {
UI::EventReturn GameBrowser::OnHomebrewStore(UI::EventParams &e) {
screenManager_->push(new StoreScreen());
return UI::EVENT_DONE;
}
MainScreen::MainScreen() {
System_SendMessage("event", "mainscreen");
SetBackgroundAudioGame("");
lastVertical_ = UseVerticalLayout();
@@ -918,7 +920,6 @@ MainScreen::~MainScreen() {
SetBackgroundAudioGame("");
}
void MainScreen::CreateViews() {
// Information in the top left.
// Back button to the bottom left.
@@ -974,11 +975,6 @@ void MainScreen::CreateViews() {
mm->T("How to get homebrew & demos", "How to get homebrew && demos"), "https://www.ppsspp.org/gethomebrew.html",
new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
Choice *hbStore = tabHomebrew->HomebrewStoreButton();
if (hbStore) {
hbStore->OnClick.Handle(this, &MainScreen::OnHomebrewStore);
}
scrollAllGames->Add(tabAllGames);
gameBrowsers_.push_back(tabAllGames);
scrollHomebrew->Add(tabHomebrew);
@@ -1323,11 +1319,6 @@ UI::EventReturn MainScreen::OnCredits(UI::EventParams &e) {
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnHomebrewStore(UI::EventParams &e) {
screenManager()->push(new StoreScreen());
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnSupport(UI::EventParams &e) {
#ifdef __ANDROID__
LaunchBrowser("market://details?id=org.ppsspp.ppssppgold");