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
This commit is contained in:
Niklas Friesen
2026-03-30 19:57:12 +02:00
parent a61fa67dca
commit b5ba2d71df
6 changed files with 19 additions and 61 deletions

BIN
resources/gui_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -9,7 +9,7 @@
AboutTab::AboutTab()
{
// Logo
this->addView(new Logo(LogoStyle::ABOUT));
this->addView(new Logo());
// Subtitle
brls::Label *subTitle = new brls::Label(

View File

@@ -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);
}
}
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);
}
}

View File

@@ -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();
};

View File

@@ -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));

View File

@@ -86,12 +86,9 @@ 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);
bool val = this->ini.getBool(this->osSection, def.key, false);
addBooleanToggle(def.label, "", def.key, val);
}
}
// ── Frequency Settings ──
brls::Rectangle* spacer1 = new brls::Rectangle(nvgRGBA(0, 0, 0, 0));
@@ -101,12 +98,10 @@ 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);
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 ──
brls::Rectangle* spacer2 = new brls::Rectangle(nvgRGBA(0, 0, 0, 0));
@@ -116,12 +111,10 @@ 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);
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) ──
// Show any keys that aren't covered by the known definitions above