mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-28 00:27:17 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -30,146 +30,131 @@
|
|||
#include "freqman.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
class FreqManBaseView : public View {
|
||||
public:
|
||||
FreqManBaseView(
|
||||
NavigationView& nav
|
||||
);
|
||||
|
||||
void focus() override;
|
||||
|
||||
protected:
|
||||
using option_t = std::pair<std::string, int32_t>;
|
||||
using options_t = std::vector<option_t>;
|
||||
|
||||
NavigationView& nav_;
|
||||
freqman_error error_ { NO_ERROR };
|
||||
options_t categories { };
|
||||
std::function<void(int32_t category_id)> on_change_category { nullptr };
|
||||
std::function<void(void)> on_select_frequency { nullptr };
|
||||
std::function<void(bool)> on_refresh_widgets { nullptr };
|
||||
std::vector<std::string> file_list { };
|
||||
int32_t current_category_id { 0 };
|
||||
|
||||
void populate_categories();
|
||||
void change_category(int32_t category_id);
|
||||
void refresh_list();
|
||||
|
||||
freqman_db database { };
|
||||
|
||||
Labels label_category {
|
||||
{ { 0, 4 }, "Category:", Color::light_grey() }
|
||||
};
|
||||
|
||||
OptionsField options_category {
|
||||
{ 9 * 8, 4 },
|
||||
14,
|
||||
{ }
|
||||
};
|
||||
|
||||
MenuView menu_view {
|
||||
{ 0, 3 * 8, 240, 23 * 8 },
|
||||
true
|
||||
};
|
||||
Text text_empty {
|
||||
{ 7 * 8, 12 * 8, 16 * 8, 16 },
|
||||
"Empty category !",
|
||||
};
|
||||
|
||||
Button button_exit {
|
||||
{ 20 * 8, 34 * 8, 10 * 8, 4 * 8 },
|
||||
"Exit"
|
||||
};
|
||||
class FreqManBaseView : public View {
|
||||
public:
|
||||
FreqManBaseView(
|
||||
NavigationView& nav);
|
||||
|
||||
void focus() override;
|
||||
|
||||
protected:
|
||||
using option_t = std::pair<std::string, int32_t>;
|
||||
using options_t = std::vector<option_t>;
|
||||
|
||||
NavigationView& nav_;
|
||||
freqman_error error_{NO_ERROR};
|
||||
options_t categories{};
|
||||
std::function<void(int32_t category_id)> on_change_category{nullptr};
|
||||
std::function<void(void)> on_select_frequency{nullptr};
|
||||
std::function<void(bool)> on_refresh_widgets{nullptr};
|
||||
std::vector<std::string> file_list{};
|
||||
int32_t current_category_id{0};
|
||||
|
||||
void populate_categories();
|
||||
void change_category(int32_t category_id);
|
||||
void refresh_list();
|
||||
|
||||
freqman_db database{};
|
||||
|
||||
Labels label_category{
|
||||
{{0, 4}, "Category:", Color::light_grey()}};
|
||||
|
||||
OptionsField options_category{
|
||||
{9 * 8, 4},
|
||||
14,
|
||||
{}};
|
||||
|
||||
MenuView menu_view{
|
||||
{0, 3 * 8, 240, 23 * 8},
|
||||
true};
|
||||
Text text_empty{
|
||||
{7 * 8, 12 * 8, 16 * 8, 16},
|
||||
"Empty category !",
|
||||
};
|
||||
|
||||
Button button_exit{
|
||||
{20 * 8, 34 * 8, 10 * 8, 4 * 8},
|
||||
"Exit"};
|
||||
};
|
||||
|
||||
class FrequencySaveView : public FreqManBaseView {
|
||||
public:
|
||||
FrequencySaveView(NavigationView& nav, const rf::Frequency value);
|
||||
public:
|
||||
FrequencySaveView(NavigationView& nav, const rf::Frequency value);
|
||||
|
||||
std::string title() const override { return "Save freq."; };
|
||||
|
||||
private:
|
||||
std::string desc_buffer { };
|
||||
rf::Frequency value_ { };
|
||||
|
||||
void on_save_name();
|
||||
void on_save_timestamp();
|
||||
void save_current_file();
|
||||
|
||||
BigFrequency big_display {
|
||||
{ 4, 2 * 16, 28 * 8, 32 },
|
||||
0
|
||||
};
|
||||
|
||||
Labels labels {
|
||||
{ { 1 * 8, 12 * 8 }, "Save as:", Color::white() }
|
||||
};
|
||||
|
||||
Button button_save_name {
|
||||
{ 1 * 8, 17 * 8, 12 * 8, 48 },
|
||||
"Name (set)"
|
||||
};
|
||||
Button button_save_timestamp {
|
||||
{ 1 * 8, 25 * 8, 12 * 8, 48 },
|
||||
"Timestamp:"
|
||||
};
|
||||
LiveDateTime live_timestamp {
|
||||
{ 14 * 8, 27 * 8, 16 * 8, 16 }
|
||||
};
|
||||
std::string title() const override { return "Save freq."; };
|
||||
|
||||
private:
|
||||
std::string desc_buffer{};
|
||||
rf::Frequency value_{};
|
||||
|
||||
void on_save_name();
|
||||
void on_save_timestamp();
|
||||
void save_current_file();
|
||||
|
||||
BigFrequency big_display{
|
||||
{4, 2 * 16, 28 * 8, 32},
|
||||
0};
|
||||
|
||||
Labels labels{
|
||||
{{1 * 8, 12 * 8}, "Save as:", Color::white()}};
|
||||
|
||||
Button button_save_name{
|
||||
{1 * 8, 17 * 8, 12 * 8, 48},
|
||||
"Name (set)"};
|
||||
Button button_save_timestamp{
|
||||
{1 * 8, 25 * 8, 12 * 8, 48},
|
||||
"Timestamp:"};
|
||||
LiveDateTime live_timestamp{
|
||||
{14 * 8, 27 * 8, 16 * 8, 16}};
|
||||
};
|
||||
|
||||
class FrequencyLoadView : public FreqManBaseView {
|
||||
public:
|
||||
std::function<void(rf::Frequency)> on_frequency_loaded { };
|
||||
std::function<void(rf::Frequency, rf::Frequency)> on_range_loaded { };
|
||||
|
||||
FrequencyLoadView(NavigationView& nav);
|
||||
public:
|
||||
std::function<void(rf::Frequency)> on_frequency_loaded{};
|
||||
std::function<void(rf::Frequency, rf::Frequency)> on_range_loaded{};
|
||||
|
||||
std::string title() const override { return "Load freq."; };
|
||||
|
||||
private:
|
||||
void refresh_widgets(const bool v);
|
||||
FrequencyLoadView(NavigationView& nav);
|
||||
|
||||
std::string title() const override { return "Load freq."; };
|
||||
|
||||
private:
|
||||
void refresh_widgets(const bool v);
|
||||
};
|
||||
|
||||
class FrequencyManagerView : public FreqManBaseView {
|
||||
public:
|
||||
FrequencyManagerView(NavigationView& nav);
|
||||
~FrequencyManagerView();
|
||||
public:
|
||||
FrequencyManagerView(NavigationView& nav);
|
||||
~FrequencyManagerView();
|
||||
|
||||
std::string title() const override { return "Freqman"; };
|
||||
|
||||
private:
|
||||
std::string desc_buffer { };
|
||||
|
||||
void refresh_widgets(const bool v);
|
||||
void on_edit_freq(rf::Frequency f);
|
||||
void on_edit_desc(NavigationView& nav);
|
||||
void on_new_category(NavigationView& nav);
|
||||
void on_delete();
|
||||
std::string title() const override { return "Freqman"; };
|
||||
|
||||
Labels labels {
|
||||
{ { 4 * 8 + 4, 26 * 8 }, "Edit:", Color::light_grey() }
|
||||
};
|
||||
|
||||
Button button_new_category {
|
||||
{ 23 * 8, 2, 7 * 8, 20 },
|
||||
"New"
|
||||
};
|
||||
private:
|
||||
std::string desc_buffer{};
|
||||
|
||||
Button button_edit_freq {
|
||||
{ 0 * 8, 29 * 8, 14 * 8, 32 },
|
||||
"Frequency"
|
||||
};
|
||||
Button button_edit_desc {
|
||||
{ 0 * 8, 34 * 8, 14 * 8, 32 },
|
||||
"Description"
|
||||
};
|
||||
|
||||
Button button_delete {
|
||||
{ 18 * 8, 27 * 8, 12 * 8, 32 },
|
||||
"Delete"
|
||||
};
|
||||
void refresh_widgets(const bool v);
|
||||
void on_edit_freq(rf::Frequency f);
|
||||
void on_edit_desc(NavigationView& nav);
|
||||
void on_new_category(NavigationView& nav);
|
||||
void on_delete();
|
||||
|
||||
Labels labels{
|
||||
{{4 * 8 + 4, 26 * 8}, "Edit:", Color::light_grey()}};
|
||||
|
||||
Button button_new_category{
|
||||
{23 * 8, 2, 7 * 8, 20},
|
||||
"New"};
|
||||
|
||||
Button button_edit_freq{
|
||||
{0 * 8, 29 * 8, 14 * 8, 32},
|
||||
"Frequency"};
|
||||
Button button_edit_desc{
|
||||
{0 * 8, 34 * 8, 14 * 8, 32},
|
||||
"Description"};
|
||||
|
||||
Button button_delete{
|
||||
{18 * 8, 27 * 8, 12 * 8, 32},
|
||||
"Delete"};
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue