fixed memory usage (#2380)

* fixed memory usage in ui_about_simple
* fixed memory usage in freqman_db
* fixed memory usage in tone_key
This commit is contained in:
Bernd Herzog 2024-11-22 09:54:34 +01:00 committed by GitHub
parent fc08d4ead9
commit b108d975c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 42 additions and 24 deletions

View file

@ -1,5 +1,7 @@
#include "ui_about_simple.hpp"
#include <string_view>
#define ROLL_SPEED_FRAME_PER_LINE 60
// cuz frame rate of pp screen is probably 60, scroll per sec
@ -7,7 +9,7 @@ namespace ui {
// TODO: Generate this automatically from github
// Information: a line starting with a '#' will be yellow coloured
const std::string authors_list[] = {
constexpr std::string_view authors_list[] = {
"# * List of contributors * ",
" ",
"#Mayhem:",
@ -70,18 +72,18 @@ AboutView::AboutView(NavigationView& nav) {
button_ok.focus();
};
for (const std::string& authors_line : authors_list) {
for (auto& authors_line : authors_list) {
// if it's starting with #, it's a title and we have to substract the '#' and paint yellow
if (authors_line.size() > 0) {
if (authors_line[0] == '#') {
menu_view.add_item(
{authors_line.substr(1, authors_line.size() - 1),
{(std::string)authors_line.substr(1, authors_line.size() - 1),
ui::Theme::getInstance()->fg_yellow->foreground,
nullptr,
nullptr});
} else {
menu_view.add_item(
{authors_line,
{(std::string)authors_line,
Theme::getInstance()->bg_darkest->foreground,
nullptr,
nullptr});