Fix package selection on page 2

This commit is contained in:
Maschell 2023-01-26 20:09:28 +01:00
parent 804fe518e4
commit 9a1cf20366
2 changed files with 21 additions and 14 deletions

View File

@ -8,15 +8,15 @@ ApplicationState::eSubState UpdaterState::UpdateShowVersionsMenu(Input *input) {
if (selectedOptionX != oldX) { if (selectedOptionX != oldX) {
selectedOptionY = 0; selectedOptionY = 0;
} else { } else {
proccessMenuNavigationY(input, mTotalPackageCount); auto &curPage = mVersionInfo[selectedOptionX];
proccessMenuNavigationY(input, curPage.getPackagesCount(mOnlyRequired));
} }
int32_t offset = 0; int32_t offset = 0;
bool stop = false; bool stop = false;
if (entrySelected(input)) { if (entrySelected(input)) {
for (auto &base : mVersionInfo) { auto &curPage = mVersionInfo[selectedOptionX];
if (stop) { break; } for (auto &cat : curPage.getMutableCategory()) {
for (auto &cat : base.getMutableCategory()) {
if (stop) { break; } if (stop) { break; }
for (auto &package : cat.getMutablePackages()) { for (auto &package : cat.getMutablePackages()) {
if (!package.getRequired() && mOnlyRequired) { if (!package.getRequired() && mOnlyRequired) {
@ -31,7 +31,6 @@ ApplicationState::eSubState UpdaterState::UpdateShowVersionsMenu(Input *input) {
} }
} }
} }
}
if (buttonPressed(input, Input::BUTTON_PLUS)) { if (buttonPressed(input, Input::BUTTON_PLUS)) {
uint32_t countValid = 0; uint32_t countValid = 0;

View File

@ -454,6 +454,14 @@ namespace VersionCheck {
} }
return res; return res;
} }
const size_t getPackagesCount(bool required) const {
size_t result = 0;
for (auto &cur : category) {
result += cur.getPackagesCount(required);
}
return result;
}
}; };
using VersionInfo = std::vector<BaseCategory>; using VersionInfo = std::vector<BaseCategory>;