Remove the UI::EventReturn return values. Makes editing the UI nicer.

This commit is contained in:
Henrik Rydgård committed 2025-09-15 11:09:00 -06:00
1 parent 730fd4754e
commit 58456ae950
62 files changed
+516 -935

No files matched your search

+11 -20
View File
@@ -264,9 +264,9 @@ public:
private:
void CreateViews();
UI::EventReturn OnInstall(UI::EventParams &e);
UI::EventReturn OnCancel(UI::EventParams &e);
UI::EventReturn OnLaunchClick(UI::EventParams &e);
void OnInstall(UI::EventParams &e);
void OnCancel(UI::EventParams &e);
void OnLaunchClick(UI::EventParams &e);
bool IsGameInstalled() const {
return g_GameManager.IsGameInstalled(entry_.file);
@@ -311,7 +311,6 @@ void ProductView::CreateViews() {
uninstallButton_ = new Button(st->T("Uninstall"));
Add(uninstallButton_)->OnClick.Add([=](UI::EventParams &e) {
g_GameManager.UninstallGameOnThread(entry_.file);
return UI::EVENT_DONE;
});
// Add(new TextView(st->T("Installed"))); // Not really needed
}
@@ -338,7 +337,6 @@ void ProductView::CreateViews() {
horiz->Add(new Button(di->T("More info"), new LinearLayoutParams(0.0, G_VCENTER)))->OnClick.Add([this](UI::EventParams) {
std::string url = StringFromFormat("https://www.ppsspp.org/docs/reference/homebrew-store-distribution/#%s", entry_.file.c_str());
System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str());
return UI::EVENT_DONE;
});
}
if (!entry_.websiteURL.empty()) {
@@ -359,7 +357,6 @@ void ProductView::CreateViews() {
}
Add(new Button(buttonText))->OnClick.Add([this](UI::EventParams) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, entry_.websiteURL.c_str());
return UI::EVENT_DONE;
});
}
}
@@ -393,7 +390,7 @@ std::string ProductView::DownloadURL() const {
}
}
UI::EventReturn ProductView::OnInstall(UI::EventParams &e) {
void ProductView::OnInstall(UI::EventParams &e) {
std::string fileUrl = DownloadURL();
if (installButton_) {
installButton_->SetEnabled(false);
@@ -403,18 +400,16 @@ UI::EventReturn ProductView::OnInstall(UI::EventParams &e) {
}
INFO_LOG(Log::System, "Triggering install of '%s'", fileUrl.c_str());
g_GameManager.DownloadAndInstall(fileUrl);
return UI::EVENT_DONE;
}
UI::EventReturn ProductView::OnCancel(UI::EventParams &e) {
void ProductView::OnCancel(UI::EventParams &e) {
g_GameManager.CancelDownload();
return UI::EVENT_DONE;
}
UI::EventReturn ProductView::OnLaunchClick(UI::EventParams &e) {
void ProductView::OnLaunchClick(UI::EventParams &e) {
if (g_GameManager.GetState() != GameManagerState::IDLE) {
// Button should have been disabled. Just a safety check.
return UI::EVENT_DONE;
return;
}
Path pspGame = GetSysDirectory(DIRECTORY_GAME);
@@ -424,7 +419,6 @@ UI::EventReturn ProductView::OnLaunchClick(UI::EventParams &e) {
e2.s = path.ToString();
// Insta-update - here we know we are already on the right thread.
OnClickLaunch.Trigger(e2);
return UI::EVENT_DONE;
}
StoreScreen::StoreScreen() {
@@ -584,10 +578,10 @@ ProductItemView *StoreScreen::GetSelectedItem() {
return nullptr;
}
UI::EventReturn StoreScreen::OnGameSelected(UI::EventParams &e) {
void StoreScreen::OnGameSelected(UI::EventParams &e) {
ProductItemView *item = static_cast<ProductItemView *>(e.v);
if (!item)
return UI::EVENT_DONE;
return;
productPanel_->Clear();
ProductView *productView = new ProductView(item->GetEntry());
@@ -598,18 +592,15 @@ UI::EventReturn StoreScreen::OnGameSelected(UI::EventParams &e) {
if (previousItem && previousItem != item)
previousItem->Release();
lastSelectedName_ = item->GetEntry().name;
return UI::EVENT_DONE;
}
UI::EventReturn StoreScreen::OnGameLaunch(UI::EventParams &e) {
void StoreScreen::OnGameLaunch(UI::EventParams &e) {
std::string path = e.s;
screenManager()->switchScreen(new EmuScreen(Path(path)));
return UI::EVENT_DONE;
}
UI::EventReturn StoreScreen::OnRetry(UI::EventParams &e) {
void StoreScreen::OnRetry(UI::EventParams &e) {
RecreateViews();
return UI::EVENT_DONE;
}
std::string StoreScreen::GetTranslatedString(const json::JsonGet json, const std::string &key, const char *fallback) const {