Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ uint8_t *folder_icon_large, *folder_icon_small;
uint8_t *invalid_icon_large, *invalid_icon_small;
uint8_t *theme_icon_large, *theme_icon_small;

int imperialtemperatureFlag=0;

void computeFrontGradient(color_t baseColor, int height);

void menuLoadFileassoc(void);
Expand Down Expand Up @@ -473,6 +475,8 @@ void menuStartup(void) {
menuScan(rootPath);

menuStartupCommon();

imperialtemperatureFlag = GetTempSettingFromConfig();
}

void themeMenuStartup(void) {
Expand Down Expand Up @@ -574,6 +578,7 @@ void drawNetwork(int tmpX, AssetId id) {
u32 drawStatus() {
bool netstatusFlag=0;
bool temperatureFlag=0;
s32 temperatureF=0;
s32 temperature=0;
AssetId id;

Expand All @@ -599,7 +604,12 @@ u32 drawStatus() {
if (statusGet(&netstatusFlag, &id, &temperatureFlag, &temperature)) {
if (netstatusFlag) drawNetwork(tmpX, id);
if (temperatureFlag) {
if (imperialtemperatureFlag == 1) {
temperatureF = (temperature * 9 / 5) + 32;
snprintf(tmpstr, sizeof(tmpstr)-1, "%d°F (%d°C)", temperatureF, temperature);
} else {
snprintf(tmpstr, sizeof(tmpstr)-1, "%d°C", temperature);
}
DrawTextFromLayout(ThemeLayoutId_Temperature, themeCurrent.textColor, tmpstr);
}
}
Expand Down
29 changes: 24 additions & 5 deletions common/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,26 +309,26 @@ void themeStartup(ThemePreset preset) {
[ThemeLayoutId_NetworkIcon] = {
.visible = true,
.posType = true,
.posStart = {0, 0 + 47 + 10 + 3},
.posStart = {-20, 0 + 47 + 10 + 3},
},

[ThemeLayoutId_BatteryCharge] = {
.visible = true,
.posType = false,
.posStart = {1180 - 10 - 24 - 8, 0 + 47 + 10 + 21 + 4},
.posStart = {1160 - 10 - 24 - 8, 0 + 47 + 10 + 21 + 4},
.font = interuiregular14,
},

[ThemeLayoutId_BatteryIcon] = {
.visible = true,
.posType = false,
.posStart = {1180 - 8 - 24 - 8, 0 + 47 + 10 + 6},
.posStart = {1160 - 8 - 24 - 8, 0 + 47 + 10 + 6},
},

[ThemeLayoutId_ChargingIcon] = {
.visible = true,
.posType = false,
.posStart = {1180 - 20, 0 + 47 + 10 + 6},
.posStart = {1160 - 20, 0 + 47 + 10 + 6},
},

[ThemeLayoutId_Status] = {
Expand All @@ -341,7 +341,7 @@ void themeStartup(ThemePreset preset) {
[ThemeLayoutId_Temperature] = {
.visible = true,
.posType = false,
.posStart = {1180 + 4, 0 + 47 + 10 + 21 + 4},
.posStart = {1160 + 4, 0 + 47 + 10 + 21 + 4},
.font = interuiregular14,
},

Expand Down Expand Up @@ -724,3 +724,22 @@ void SetThemePathToConfig(const char* themePath) {

config_destroy(&cfg);
}

int GetTempSettingFromConfig() {
int imperialtemperatureFlag=0;
config_t cfg = {0};
config_setting_t *settings = NULL;
char tmp_path[PATH_MAX+1] = {0};
snprintf(tmp_path, sizeof(tmp_path)-1, "%s/config/nx-hbmenu/settings.cfg", menuGetRootBasePath());
bool good_cfg = config_read_file(&cfg, tmp_path);
if(good_cfg) {
settings = config_lookup(&cfg, "settings");
if(settings != NULL) {
if(config_setting_lookup_int(settings, "tempinF", &imperialtemperatureFlag)) {
}

}
}
config_destroy(&cfg);
return imperialtemperatureFlag;
}
1 change: 1 addition & 0 deletions common/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ bool colorFromSetting(config_setting_t *rgba, color_t *col);
void themeStartup(ThemePreset preset);
void GetThemePathFromConfig(char* themePath, size_t size);
void SetThemePathToConfig(const char* themePath);
int GetTempSettingFromConfig();

extern theme_t themeCurrent;

Expand Down