From b5ba2d71df30a0642728b318d6ac01c28f34e78b Mon Sep 17 00:00:00 2001 From: Niklas Friesen Date: Mon, 30 Mar 2026 19:57:12 +0200 Subject: [PATCH] UI: header icon + title; always show OC controls; About Logo cleanup - Use gui_icon.png next to APP_TITLE in the applet header (replaces text-only header Logo). - Simplify Logo to About tab only; drop unused HEADER style. - Show frequency/voltage/toggle controls even when INI keys are absent (defaults until edited). - Add resources/gui_icon.png to RomFS. Made-with: Cursor --- resources/gui_icon.png | Bin 0 -> 2039 bytes src/about_tab.cpp | 2 +- src/logo.cpp | 35 ++++------------------------------- src/logo.h | 12 +----------- src/main_frame.cpp | 8 +++++--- src/os_config_tab.cpp | 23 ++++++++--------------- 6 files changed, 19 insertions(+), 61 deletions(-) create mode 100644 resources/gui_icon.png diff --git a/resources/gui_icon.png b/resources/gui_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..e65eca5a803cfb70aaebe49f850f26eb0524c1d1 GIT binary patch literal 2039 zcmV1->hg2qG zmo?&a>id*Ao&y|N3BY;XofM`R!hWH2QkR}ZLYp;J>z2xPBeVrqLn-SL{jRneZU1wiT z-1k!VNyMKKzeH@)^#c$7UjPOBI>!Ku5Vv?`iGnzDWnj8pzI_+sUfo!>_q+fFPj@;q zx(_kKYZVL8BS`ma2U4A;l)rk;fP#IU;}Kgx!{Q;b6pjP5SisYW+w_I+*^z`ZrV7bJ=ZK?Z!Zihl7VtHTCHX1y6N+1JUSj3NQE~%_|L2xcxy* zA9P2K9-G<+U|fn+;XI~hR{XPMpkQyuOkn-nSnwwiE$RCqh>CcaC{vWXUx9cCaXVrH zrlILDV172mvzk*exoDtZZ^tJP&zG>^cOyN9c+QXDjb-h=pKbrCL~^ld9AYxYC-eHS zSh!P2hcWNwpFkYMeA_6eTOhVsUFD1(fr2MH-r+|WF6a>ieu8PGCY2p1YSy=&a$rjl zS9K|$2e%99hc0I6j*25u{e-JeE<;SS1(hG@Ia3fnK-n-6u|~X#bh{>&?I{K%)AiIr z&j90tADx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64K8kq@PK6z7^addView(new Logo(LogoStyle::ABOUT)); + this->addView(new Logo()); // Subtitle brls::Label *subTitle = new brls::Label( diff --git a/src/logo.cpp b/src/logo.cpp index fc00fa7..d68544a 100644 --- a/src/logo.cpp +++ b/src/logo.cpp @@ -5,9 +5,9 @@ #include "logo.h" -Logo::Logo(LogoStyle style) +Logo::Logo() { - this->logoLabel = new brls::Label(brls::LabelStyle::LIST_ITEM, "SWR", style == LogoStyle::ABOUT); + this->logoLabel = new brls::Label(brls::LabelStyle::LIST_ITEM, "SWR", true); this->logoLabel->setParent(this); int logoFont = brls::Application::findFont(LOGO_FONT_NAME); @@ -16,35 +16,18 @@ Logo::Logo(LogoStyle style) this->logoLabel->setFont(logoFont); } - if (style == LogoStyle::ABOUT) - { - this->logoLabel->setFontSize(LOGO_ABOUT_FONT_SIZE); - this->logoLabel->setHorizontalAlign(NVG_ALIGN_CENTER); - } - - if (style == LogoStyle::HEADER) - { - this->logoLabel->setFontSize(LOGO_HEADER_FONT_SIZE); - this->descLabel = new brls::Label(brls::LabelStyle::LIST_ITEM, "INI Tool"); - this->descLabel->setParent(this); - this->descLabel->setFontSize(LOGO_DESC_FONT_SIZE); - } + this->logoLabel->setFontSize(LOGO_ABOUT_FONT_SIZE); + this->logoLabel->setHorizontalAlign(NVG_ALIGN_CENTER); } Logo::~Logo() { delete this->logoLabel; - - if (this->descLabel) - delete this->descLabel; } void Logo::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) { this->logoLabel->frame(ctx); - - if (this->descLabel) - this->descLabel->frame(ctx); } void Logo::layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) @@ -52,14 +35,4 @@ void Logo::layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) this->logoLabel->setBoundaries(this->x, this->y + LOGO_OFFSET, this->width, this->height); this->logoLabel->layout(vg, style, stash); this->height = this->logoLabel->getHeight(); - - if (this->descLabel) - { - this->descLabel->layout(vg, style, stash); - this->descLabel->setBoundaries( - this->x + LOGO_HEADER_SPACING + this->logoLabel->getWidth(), - this->y + style->AppletFrame.titleOffset - 1, - this->descLabel->getWidth(), - height); - } } diff --git a/src/logo.h b/src/logo.h index 59715d5..5e04611 100644 --- a/src/logo.h +++ b/src/logo.h @@ -9,30 +9,20 @@ #define APP_ASSET(p) APP_RESOURCES p -enum class LogoStyle -{ - HEADER = 0, - ABOUT -}; - #define LOGO_FONT_NAME "logo" #define LOGO_FONT_PATH APP_ASSET("fira/FiraSans-Medium-rnx.ttf") -#define LOGO_HEADER_FONT_SIZE 45 -#define LOGO_HEADER_SPACING 12 #define LOGO_ABOUT_FONT_SIZE 55 -#define LOGO_DESC_FONT_SIZE 28 #define LOGO_OFFSET 2 class Logo : public brls::View { protected: brls::Label* logoLabel = nullptr; - brls::Label* descLabel = nullptr; void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash); void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override; public: - Logo(LogoStyle style); + Logo(); virtual ~Logo(); }; diff --git a/src/main_frame.cpp b/src/main_frame.cpp index e9d3374..86e2fec 100644 --- a/src/main_frame.cpp +++ b/src/main_frame.cpp @@ -8,8 +8,8 @@ #include "os_config_tab.h" #include "settings_tab.h" #include "about_tab.h" -#include "logo.h" #include "app_config.h" +#include "logo.h" OsConfigTab* MainFrame::osTabs[(int)OsTarget::COUNT] = {}; @@ -17,8 +17,10 @@ MainFrame::MainFrame() : TabFrame() { AppConfig& cfg = AppConfig::get(); - // Header logo - this->setIcon(new Logo(LogoStyle::HEADER)); + this->setTitle(APP_TITLE); + brls::Image* headerIcon = new brls::Image(APP_ASSET("gui_icon.png")); + headerIcon->setScaleType(brls::ImageScaleType::FIT); + this->setIcon(headerIcon); // OS configuration tabs — paths from config osTabs[(int)OsTarget::ANDROID] = new OsConfigTab("Android", cfg.getPath(OsTarget::ANDROID)); diff --git a/src/os_config_tab.cpp b/src/os_config_tab.cpp index 465841b..6d2a93f 100644 --- a/src/os_config_tab.cpp +++ b/src/os_config_tab.cpp @@ -86,11 +86,8 @@ void OsConfigTab::buildUI() for (const auto& def : OC_BOOL_KEYS) { - if (this->ini.hasKey(this->osSection, def.key)) - { - bool val = this->ini.getBool(this->osSection, def.key); - addBooleanToggle(def.label, "", def.key, val); - } + bool val = this->ini.getBool(this->osSection, def.key, false); + addBooleanToggle(def.label, "", def.key, val); } // ── Frequency Settings ── @@ -101,11 +98,9 @@ void OsConfigTab::buildUI() for (const auto& def : OC_FREQ_KEYS) { - if (this->ini.hasKey(this->osSection, def.key)) - { - uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, 0); - addFreqDropdown(def.label, "", def.key, val, def.options); - } + int defVal = def.options.empty() ? 0 : (int)def.options.front(); + uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, defVal); + addFreqDropdown(def.label, "", def.key, val, def.options); } // ── Voltage Settings ── @@ -116,11 +111,9 @@ void OsConfigTab::buildUI() for (const auto& def : OC_VOLTAGE_KEYS) { - if (this->ini.hasKey(this->osSection, def.key)) - { - uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, 0); - addVoltageDropdown(def.label, "", def.key, val, def.options); - } + int defVal = def.options.empty() ? 0 : (int)def.options.front(); + uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, defVal); + addVoltageDropdown(def.label, "", def.key, val, def.options); } // ── Other Keys (read-only info) ──