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:
BIN
resources/gui_icon.png
Normal file
BIN
resources/gui_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -9,7 +9,7 @@
|
|||||||
AboutTab::AboutTab()
|
AboutTab::AboutTab()
|
||||||
{
|
{
|
||||||
// Logo
|
// Logo
|
||||||
this->addView(new Logo(LogoStyle::ABOUT));
|
this->addView(new Logo());
|
||||||
|
|
||||||
// Subtitle
|
// Subtitle
|
||||||
brls::Label *subTitle = new brls::Label(
|
brls::Label *subTitle = new brls::Label(
|
||||||
|
|||||||
35
src/logo.cpp
35
src/logo.cpp
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
#include "logo.h"
|
#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);
|
this->logoLabel->setParent(this);
|
||||||
|
|
||||||
int logoFont = brls::Application::findFont(LOGO_FONT_NAME);
|
int logoFont = brls::Application::findFont(LOGO_FONT_NAME);
|
||||||
@@ -16,35 +16,18 @@ Logo::Logo(LogoStyle style)
|
|||||||
this->logoLabel->setFont(logoFont);
|
this->logoLabel->setFont(logoFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style == LogoStyle::ABOUT)
|
this->logoLabel->setFontSize(LOGO_ABOUT_FONT_SIZE);
|
||||||
{
|
this->logoLabel->setHorizontalAlign(NVG_ALIGN_CENTER);
|
||||||
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()
|
Logo::~Logo()
|
||||||
{
|
{
|
||||||
delete this->logoLabel;
|
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)
|
void Logo::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx)
|
||||||
{
|
{
|
||||||
this->logoLabel->frame(ctx);
|
this->logoLabel->frame(ctx);
|
||||||
|
|
||||||
if (this->descLabel)
|
|
||||||
this->descLabel->frame(ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logo::layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash)
|
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->setBoundaries(this->x, this->y + LOGO_OFFSET, this->width, this->height);
|
||||||
this->logoLabel->layout(vg, style, stash);
|
this->logoLabel->layout(vg, style, stash);
|
||||||
this->height = this->logoLabel->getHeight();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/logo.h
12
src/logo.h
@@ -9,30 +9,20 @@
|
|||||||
|
|
||||||
#define APP_ASSET(p) APP_RESOURCES p
|
#define APP_ASSET(p) APP_RESOURCES p
|
||||||
|
|
||||||
enum class LogoStyle
|
|
||||||
{
|
|
||||||
HEADER = 0,
|
|
||||||
ABOUT
|
|
||||||
};
|
|
||||||
|
|
||||||
#define LOGO_FONT_NAME "logo"
|
#define LOGO_FONT_NAME "logo"
|
||||||
#define LOGO_FONT_PATH APP_ASSET("fira/FiraSans-Medium-rnx.ttf")
|
#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_ABOUT_FONT_SIZE 55
|
||||||
#define LOGO_DESC_FONT_SIZE 28
|
|
||||||
#define LOGO_OFFSET 2
|
#define LOGO_OFFSET 2
|
||||||
|
|
||||||
class Logo : public brls::View
|
class Logo : public brls::View
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
brls::Label* logoLabel = nullptr;
|
brls::Label* logoLabel = nullptr;
|
||||||
brls::Label* descLabel = nullptr;
|
|
||||||
void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash);
|
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;
|
void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Logo(LogoStyle style);
|
Logo();
|
||||||
virtual ~Logo();
|
virtual ~Logo();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
#include "os_config_tab.h"
|
#include "os_config_tab.h"
|
||||||
#include "settings_tab.h"
|
#include "settings_tab.h"
|
||||||
#include "about_tab.h"
|
#include "about_tab.h"
|
||||||
#include "logo.h"
|
|
||||||
#include "app_config.h"
|
#include "app_config.h"
|
||||||
|
#include "logo.h"
|
||||||
|
|
||||||
OsConfigTab* MainFrame::osTabs[(int)OsTarget::COUNT] = {};
|
OsConfigTab* MainFrame::osTabs[(int)OsTarget::COUNT] = {};
|
||||||
|
|
||||||
@@ -17,8 +17,10 @@ MainFrame::MainFrame() : TabFrame()
|
|||||||
{
|
{
|
||||||
AppConfig& cfg = AppConfig::get();
|
AppConfig& cfg = AppConfig::get();
|
||||||
|
|
||||||
// Header logo
|
this->setTitle(APP_TITLE);
|
||||||
this->setIcon(new Logo(LogoStyle::HEADER));
|
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
|
// OS configuration tabs — paths from config
|
||||||
osTabs[(int)OsTarget::ANDROID] = new OsConfigTab("Android", cfg.getPath(OsTarget::ANDROID));
|
osTabs[(int)OsTarget::ANDROID] = new OsConfigTab("Android", cfg.getPath(OsTarget::ANDROID));
|
||||||
|
|||||||
@@ -86,11 +86,8 @@ void OsConfigTab::buildUI()
|
|||||||
|
|
||||||
for (const auto& def : OC_BOOL_KEYS)
|
for (const auto& def : OC_BOOL_KEYS)
|
||||||
{
|
{
|
||||||
if (this->ini.hasKey(this->osSection, def.key))
|
bool val = this->ini.getBool(this->osSection, def.key, false);
|
||||||
{
|
addBooleanToggle(def.label, "", def.key, val);
|
||||||
bool val = this->ini.getBool(this->osSection, def.key);
|
|
||||||
addBooleanToggle(def.label, "", def.key, val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Frequency Settings ──
|
// ── Frequency Settings ──
|
||||||
@@ -101,11 +98,9 @@ void OsConfigTab::buildUI()
|
|||||||
|
|
||||||
for (const auto& def : OC_FREQ_KEYS)
|
for (const auto& def : OC_FREQ_KEYS)
|
||||||
{
|
{
|
||||||
if (this->ini.hasKey(this->osSection, def.key))
|
int defVal = def.options.empty() ? 0 : (int)def.options.front();
|
||||||
{
|
uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, defVal);
|
||||||
uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, 0);
|
addFreqDropdown(def.label, "", def.key, val, def.options);
|
||||||
addFreqDropdown(def.label, "", def.key, val, def.options);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Voltage Settings ──
|
// ── Voltage Settings ──
|
||||||
@@ -116,11 +111,9 @@ void OsConfigTab::buildUI()
|
|||||||
|
|
||||||
for (const auto& def : OC_VOLTAGE_KEYS)
|
for (const auto& def : OC_VOLTAGE_KEYS)
|
||||||
{
|
{
|
||||||
if (this->ini.hasKey(this->osSection, def.key))
|
int defVal = def.options.empty() ? 0 : (int)def.options.front();
|
||||||
{
|
uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, defVal);
|
||||||
uint32_t val = (uint32_t)this->ini.getInt(this->osSection, def.key, 0);
|
addVoltageDropdown(def.label, "", def.key, val, def.options);
|
||||||
addVoltageDropdown(def.label, "", def.key, val, def.options);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Other Keys (read-only info) ──
|
// ── Other Keys (read-only info) ──
|
||||||
|
|||||||
Reference in New Issue
Block a user