BLE Rx/Tx App Cleanup (#1570)

* Showing highest dB first
* Including namestring in search
* Using replace seems to work better.
* bletx cleanup
* removing pop
* pop is needed on this view.
* cleanup switching
* reduce to 1 entry list
* Setting to use the name of BLE with a toggle checkbox.
* Removed &nav reference.
* Removing const
* Fixed issue with memory being run out when switching from a previous app
* Fixed not setting updated progressbar for each new packet.
This commit is contained in:
Netro 2023-11-11 14:46:51 -05:00 committed by GitHub
parent f7f784c0f4
commit a3249cae26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 119 additions and 159 deletions

View file

@ -103,19 +103,28 @@ void sortEntriesBy(ContainerType& entries, KeySelector keySelector, SortOrder as
}
template <typename ContainerType, typename KeySelector>
void removeEntriesWithoutKey(ContainerType& entries, ContainerType& filteredEntries, KeySelector keySelector) {
void resetFilteredEntries(ContainerType& entries, KeySelector keySelector) {
// Clear the filteredEntries container
filteredEntries.clear();
auto it = entries.begin();
while (it != entries.end()) {
if (!keySelector(*it)) {
filteredEntries.emplace_back(*it); // Add a new entry to filteredEntries
if (keySelector(*it)) {
entries.erase(it); // Add a new entry to filteredEntries
}
++it; // Move to the next element, outside of the if block
}
}
template <typename ContainerType, typename MemberPtr, typename KeyValue>
void setAllMembersToValue(ContainerType& entries, MemberPtr memberPtr, const KeyValue& keyValue) {
for (auto& entry : entries) {
// Check if the member specified by memberPtr is equal to keyValue
if (entry.*memberPtr != keyValue) {
// Update the member with keyValue
entry.*memberPtr = keyValue;
}
}
}
namespace ui {
using RecentEntriesColumn = std::pair<std::string, size_t>;