diff --git a/resources/gui_icon.png b/resources/gui_icon.png new file mode 100644 index 0000000..e65eca5 Binary files /dev/null and b/resources/gui_icon.png differ diff --git a/src/about_tab.cpp b/src/about_tab.cpp index f8f67b9..a76af24 100644 --- a/src/about_tab.cpp +++ b/src/about_tab.cpp @@ -9,7 +9,7 @@ AboutTab::AboutTab() { // Logo - this->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) ──