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,27 +8,26 @@ ApplicationState::eSubState UpdaterState::UpdateShowVersionsMenu(Input *input) {
if (selectedOptionX != oldX) {
selectedOptionY = 0;
} else {
proccessMenuNavigationY(input, mTotalPackageCount);
auto &curPage = mVersionInfo[selectedOptionX];
proccessMenuNavigationY(input, curPage.getPackagesCount(mOnlyRequired));
}
int32_t offset = 0;
bool stop = false;
if (entrySelected(input)) {
for (auto &base : mVersionInfo) {
auto &curPage = mVersionInfo[selectedOptionX];
for (auto &cat : curPage.getMutableCategory()) {
if (stop) { break; }
for (auto &cat : base.getMutableCategory()) {
if (stop) { break; }
for (auto &package : cat.getMutablePackages()) {
if (!package.getRequired() && mOnlyRequired) {
continue;
}
if (offset == selectedOptionY) {
package.toggleSelect();
stop = true;
break;
}
offset++;
for (auto &package : cat.getMutablePackages()) {
if (!package.getRequired() && mOnlyRequired) {
continue;
}
if (offset == selectedOptionY) {
package.toggleSelect();
stop = true;
break;
}
offset++;
}
}
}

View File

@ -454,6 +454,14 @@ namespace VersionCheck {
}
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>;