Remove a vector while keeping settings search working.

This commit is contained in:
Henrik Rydgård committed 2025-03-23 22:48:57 +01:00
1 parent 4d43ee5f59
commit 76ce11ad2c
4 files changed
+28 -11

No files matched your search

+5 -1
View File
@@ -71,7 +71,7 @@ public:
void Clear();
void PersistData(PersistStatus status, std::string anonId, PersistMap &storage) override;
View *GetViewByIndex(int index) { return views_[index]; }
View *GetViewByIndex(int index) const { return views_[index]; }
int GetNumSubviews() const { return (int)views_.size(); }
void SetHasDropShadow(bool has) { hasDropShadow_ = has; }
void SetDropShadowExpand(float s) { dropShadowExpand_ = s; }
@@ -313,6 +313,10 @@ public:
LinearLayout *Container() { return tabContainer_; }
const std::vector<ViewGroup *> &GetTabContentViews() const {
return tabs_;
}
private:
void AddTabContents(std::string_view title, View *tabContents);
EventReturn OnTabClick(EventParams &e);
+2 -2
View File
@@ -1351,7 +1351,7 @@ PPGeImage::PPGeImage(std::string_view pspFilename)
PPGeImage::PPGeImage(u32 pngPointer, size_t pngSize)
: filename_(""), png_(pngPointer), size_(pngSize) {
if (!Memory::IsValidRange(this->png_, this->size_)) {
if (!Memory::IsValidRange(this->png_, (u32)this->size_)) {
WARN_LOG(Log::sceGe, "Created PPGeImage from invalid memory range %08x (%08x bytes). Will not be drawn.");
}
}
@@ -1417,7 +1417,7 @@ bool PPGeImage::IsValid() {
if (loadFailed_)
return false;
if (!Memory::IsValidRange(this->png_, this->size_)) {
if (!Memory::IsValidRange(this->png_, (u32)this->size_)) {
return false;
}
+21 -7
View File
@@ -16,10 +16,6 @@ UI::LinearLayout *TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag
scroll->Add(contents);
tabHolder_->AddTab(title, scroll);
if (!isSearch) {
settingTabContents_.push_back(contents);
}
return contents;
}
@@ -56,7 +52,6 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() {
tabHolder_->SetTag(tag()); // take the tag from the screen.
root_->SetDefaultFocusView(tabHolder_);
settingTabContents_.clear();
float leftSide = 40.0f;
if (!vertical) {
@@ -120,6 +115,7 @@ void TabbedUIDialogScreenWithGameBackground::RecreateViews() {
}
void TabbedUIDialogScreenWithGameBackground::ApplySearchFilter() {
using namespace UI;
auto se = GetI18NCategory(I18NCat::SEARCH);
// Show an indicator that a filter is applied.
@@ -127,8 +123,26 @@ void TabbedUIDialogScreenWithGameBackground::ApplySearchFilter() {
filterNotice_->SetText(ApplySafeSubstitutions(se->T("Filtering settings by '%1'"), searchFilter_));
bool matches = searchFilter_.empty();
for (int t = 0; t < (int)settingTabContents_.size(); ++t) {
auto tabContents = settingTabContents_[t];
const std::vector<ViewGroup *> settingTabs = tabHolder_->GetTabContentViews();
for (int t = 0; t < (int)settingTabs.size(); ++t) {
const ViewGroup *tabContents = settingTabs[t];
std::string_view tag = tabContents->Tag();
// Dive down to the actual list of settings.
// TODO: Do this recursively instead.
while (tabContents->GetNumSubviews() == 1) {
View *v = tabContents->GetViewByIndex(0);
if (v->IsViewGroup()) {
tabContents = (ViewGroup *)v;
}
}
if (tag == "GameSettingsSearch") {
continue;
}
bool tabMatches = searchFilter_.empty();
UI::View *lastHeading = nullptr;
-1
View File
@@ -30,7 +30,6 @@ private:
void ApplySearchFilter();
UI::TabHolder *tabHolder_ = nullptr;
std::vector<UI::LinearLayout *> settingTabContents_;
UI::TextView *filterNotice_ = nullptr;
UI::Choice *clearSearchChoice_ = nullptr;
UI::TextView *noSearchResults_ = nullptr;