2024-04-08 01:45:33 -04:00
|
|
|
#include "ui_about_simple.hpp"
|
2024-11-22 03:54:34 -05:00
|
|
|
#include <string_view>
|
|
|
|
|
2024-11-14 08:52:43 -05:00
|
|
|
#define ROLL_SPEED_FRAME_PER_LINE 60
|
|
|
|
// cuz frame rate of pp screen is probably 60, scroll per sec
|
|
|
|
|
2024-04-08 01:45:33 -04:00
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
// Information: a line starting with a '#' will be yellow coloured
|
2024-11-22 03:54:34 -05:00
|
|
|
constexpr std::string_view authors_list[] = {
|
2024-04-08 01:45:33 -04:00
|
|
|
"# * List of contributors * ",
|
|
|
|
" ",
|
2024-11-22 11:41:20 -05:00
|
|
|
"#Mayhem-Firmware:",
|
|
|
|
"jboone,eried,furrtek,",
|
|
|
|
"NotherNgineer,gullradriel,",
|
|
|
|
"jLynx,kallanreed,Brumi-2021,",
|
|
|
|
"htotoo,bernd-herzog,zxkmm,",
|
|
|
|
"ArjanOnwezen,euquiq,u-foka,",
|
|
|
|
"iNetro,heurist1,dqs105,",
|
|
|
|
"teixeluis,jwetzell,",
|
|
|
|
"jimilinuxguy,gregoryfenton,",
|
|
|
|
"notpike,strijar,BehleZebub,",
|
|
|
|
"arneluehrs,rascafr,joyel24,",
|
|
|
|
"ImDroided,zigad,johnelder,",
|
|
|
|
"klockee,nnesetto,LupusE,",
|
|
|
|
"argilo,dc2dc,formtapez,",
|
|
|
|
"RocketGod-git,mrmookie,",
|
|
|
|
"ITAxReal,F33RNI,F4GEV,",
|
|
|
|
"rusty-labs,mjwaxios,andrej-mk,",
|
|
|
|
"RedFox-Fr,nemanjan00,",
|
|
|
|
"MichalLeonBorsuk,",
|
|
|
|
"MatiasFernandez,Giorgiofox,",
|
|
|
|
"ckuethe",
|
2024-04-08 01:45:33 -04:00
|
|
|
" ",
|
|
|
|
"#Havoc:",
|
2024-11-22 11:41:20 -05:00
|
|
|
"jboone,furrtek,eried,argilo,",
|
|
|
|
"mrmookie,Giorgiofox,ImDroided,",
|
|
|
|
"mjwaxios,F4GEV,OpCode1300,",
|
|
|
|
"ZeroChaos-,RndmNmbr,",
|
|
|
|
"silascutler,troussos,z4ziggy,",
|
|
|
|
"clem-42,dhoetger,NickBouwhuis,",
|
|
|
|
"xmycroftx,Maescool,KimIV,",
|
|
|
|
"joakar,leres,brianlechthaler,",
|
|
|
|
"N0vaPixel",
|
2024-04-08 01:45:33 -04:00
|
|
|
" ",
|
|
|
|
"#PortaPack:",
|
2024-11-22 11:41:20 -05:00
|
|
|
"jboone,mossmann,martinling,",
|
|
|
|
"argilo,eried,ZeroChaos-,",
|
|
|
|
"RndmNmbr",
|
2024-04-08 01:45:33 -04:00
|
|
|
" ",
|
|
|
|
"#HackRF:",
|
2024-11-22 11:41:20 -05:00
|
|
|
"mossmann,jboone,dominicgs,",
|
|
|
|
"martinling,bvernoux,miek,",
|
|
|
|
"bgamari,schneider42,straithe,",
|
|
|
|
"grvvy,willcode,hessu,yhetti,",
|
|
|
|
"Sec42,ckuethe",
|
|
|
|
" "};
|
2024-04-08 01:45:33 -04:00
|
|
|
|
|
|
|
AboutView::AboutView(NavigationView& nav) {
|
|
|
|
add_children({&menu_view,
|
|
|
|
&button_ok});
|
|
|
|
|
|
|
|
button_ok.on_select = [&nav](Button&) {
|
|
|
|
nav.pop();
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_view.on_left = [this]() {
|
|
|
|
button_ok.focus();
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_view.on_right = [this]() {
|
|
|
|
button_ok.focus();
|
|
|
|
};
|
|
|
|
|
2024-11-22 03:54:34 -05:00
|
|
|
for (auto& authors_line : authors_list) {
|
2024-04-08 01:45:33 -04:00
|
|
|
// 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(
|
2024-11-22 03:54:34 -05:00
|
|
|
{(std::string)authors_line.substr(1, authors_line.size() - 1),
|
2024-05-27 15:02:52 -04:00
|
|
|
ui::Theme::getInstance()->fg_yellow->foreground,
|
2024-04-08 01:45:33 -04:00
|
|
|
nullptr,
|
|
|
|
nullptr});
|
|
|
|
} else {
|
|
|
|
menu_view.add_item(
|
2024-11-22 03:54:34 -05:00
|
|
|
{(std::string)authors_line,
|
2024-05-27 15:02:52 -04:00
|
|
|
Theme::getInstance()->bg_darkest->foreground,
|
2024-04-08 01:45:33 -04:00
|
|
|
nullptr,
|
|
|
|
nullptr});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-14 08:52:43 -05:00
|
|
|
void AboutView::on_frame_sync() {
|
|
|
|
if (interacted) return;
|
|
|
|
|
|
|
|
if (frame_sync_count++ % ROLL_SPEED_FRAME_PER_LINE == 0) {
|
|
|
|
const auto current = menu_view.highlighted_index();
|
|
|
|
const auto count = menu_view.item_count();
|
|
|
|
|
|
|
|
if (current < count - 1) {
|
|
|
|
menu_view.set_highlighted(current + 1);
|
|
|
|
} else {
|
|
|
|
menu_view.set_highlighted(0);
|
|
|
|
// ^ to go back to the REAL top instead of make the 2 at the top to make the title disappeares
|
|
|
|
menu_view.set_highlighted(2); // the first line that has human name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-08 01:45:33 -04:00
|
|
|
void AboutView::focus() {
|
2024-11-14 08:52:43 -05:00
|
|
|
button_ok.focus();
|
|
|
|
menu_view.set_highlighted(2); // the first line that has human name
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AboutView::on_touch(const TouchEvent) {
|
|
|
|
interacted = true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AboutView::on_key(const KeyEvent) {
|
|
|
|
interacted = true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AboutView::on_encoder(const EncoderEvent) {
|
|
|
|
interacted = true;
|
2024-04-08 01:45:33 -04:00
|
|
|
menu_view.focus();
|
2024-11-14 08:52:43 -05:00
|
|
|
return false;
|
2024-04-08 01:45:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
} /* namespace ui */
|