Display "Applet Mode" indicator when running under an applet
This commit is contained in:
parent
78da39d0a2
commit
ce35f40f31
@ -46,6 +46,12 @@ const char* const g_strings[StrId_Max][16] =
|
|||||||
STR_TW("加載中…"),
|
STR_TW("加載中…"),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[StrId_AppletMode] =
|
||||||
|
{
|
||||||
|
STR_EN("● Applet Mode ●"),
|
||||||
|
STR_ES("● Modo Applet ●"),
|
||||||
|
},
|
||||||
|
|
||||||
[StrId_Directory] =
|
[StrId_Directory] =
|
||||||
{
|
{
|
||||||
STR_EN("Directory"),
|
STR_EN("Directory"),
|
||||||
@ -292,7 +298,7 @@ const char* const g_strings[StrId_Max][16] =
|
|||||||
STR_ZH("打开"),
|
STR_ZH("打开"),
|
||||||
STR_TW("開啟"),
|
STR_TW("開啟"),
|
||||||
},
|
},
|
||||||
|
|
||||||
[StrId_Actions_Back] =
|
[StrId_Actions_Back] =
|
||||||
{
|
{
|
||||||
STR_EN("Back"),
|
STR_EN("Back"),
|
||||||
@ -336,13 +342,13 @@ const char* const g_strings[StrId_Max][16] =
|
|||||||
STR_EN("Star"),
|
STR_EN("Star"),
|
||||||
STR_ES("Agregar a favoritos"),
|
STR_ES("Agregar a favoritos"),
|
||||||
},
|
},
|
||||||
|
|
||||||
[StrId_Actions_Unstar] =
|
[StrId_Actions_Unstar] =
|
||||||
{
|
{
|
||||||
STR_EN("Unstar"),
|
STR_EN("Unstar"),
|
||||||
STR_ES("Borrar de favoritos"),
|
STR_ES("Borrar de favoritos"),
|
||||||
},
|
},
|
||||||
|
|
||||||
[StrId_ThemeMenu] =
|
[StrId_ThemeMenu] =
|
||||||
{
|
{
|
||||||
STR_EN("Theme Menu"),
|
STR_EN("Theme Menu"),
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
StrId_Loading = 0,
|
StrId_Loading = 0,
|
||||||
|
StrId_AppletMode,
|
||||||
StrId_Directory,
|
StrId_Directory,
|
||||||
StrId_DefaultPublisher,
|
StrId_DefaultPublisher,
|
||||||
StrId_IOError,
|
StrId_IOError,
|
||||||
|
@ -104,7 +104,7 @@ void menuHandleAButton(void) {
|
|||||||
|
|
||||||
void menuHandleXButton(void) {
|
void menuHandleXButton(void) {
|
||||||
menu_s* menu = menuGetCurrent();
|
menu_s* menu = menuGetCurrent();
|
||||||
|
|
||||||
if (menu->nEntries > 0 && hbmenu_state == HBMENU_DEFAULT) {
|
if (menu->nEntries > 0 && hbmenu_state == HBMENU_DEFAULT) {
|
||||||
int i;
|
int i;
|
||||||
menuEntry_s* me;
|
menuEntry_s* me;
|
||||||
@ -118,7 +118,7 @@ void launchApplyThemeTask(menuEntry_s* arg) {
|
|||||||
const char* themePath = arg->path;
|
const char* themePath = arg->path;
|
||||||
SetThemePathToConfig(themePath);
|
SetThemePathToConfig(themePath);
|
||||||
themeStartup(themeGlobalPreset);
|
themeStartup(themeGlobalPreset);
|
||||||
computeFrontGradient(themeCurrent.frontWaveColor, 280);
|
computeFrontGradient(themeCurrent.frontWaveColor, 280);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menuIsNetloaderActive(void) {
|
bool menuIsNetloaderActive(void) {
|
||||||
@ -471,13 +471,13 @@ void drawCharge() {
|
|||||||
bool validPower;
|
bool validPower;
|
||||||
|
|
||||||
validPower = powerGetDetails(&batteryCharge, &isCharging);
|
validPower = powerGetDetails(&batteryCharge, &isCharging);
|
||||||
|
|
||||||
if (validPower)
|
if (validPower)
|
||||||
{
|
{
|
||||||
batteryCharge = (batteryCharge > 100) ? 100 : batteryCharge;
|
batteryCharge = (batteryCharge > 100) ? 100 : batteryCharge;
|
||||||
|
|
||||||
sprintf(chargeString, "%d%%", batteryCharge);
|
sprintf(chargeString, "%d%%", batteryCharge);
|
||||||
|
|
||||||
int tmpX = GetTextXCoordinate(interuiregular14, 1180 - 10, chargeString, 'r');
|
int tmpX = GetTextXCoordinate(interuiregular14, 1180 - 10, chargeString, 'r');
|
||||||
|
|
||||||
DrawText(interuiregular14, tmpX - 24 - 8, 0 + 47 + 10 + 21 + 4, themeCurrent.textColor, chargeString);
|
DrawText(interuiregular14, tmpX - 24 - 8, 0 + 47 + 10 + 21 + 4, themeCurrent.textColor, chargeString);
|
||||||
@ -604,6 +604,12 @@ void menuLoop(void) {
|
|||||||
|
|
||||||
drawImage(40, 20, 140, 60, themeCurrent.hbmenuLogoImage, IMAGE_MODE_RGBA32);
|
drawImage(40, 20, 140, 60, themeCurrent.hbmenuLogoImage, IMAGE_MODE_RGBA32);
|
||||||
DrawText(interuiregular14, 180, 46 + 18, themeCurrent.textColor, VERSION);
|
DrawText(interuiregular14, 180, 46 + 18, themeCurrent.textColor, VERSION);
|
||||||
|
#ifdef __SWITCH__
|
||||||
|
AppletType at = appletGetAppletType();
|
||||||
|
if (at != AppletType_Application && at != AppletType_SystemApplication) {
|
||||||
|
DrawText(interuimedium30, 640-32, 46 + 18, themeCurrent.attentionTextColor, textGetString(StrId_AppletMode));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PERF_LOG_DRAW//Seperate from the PERF_LOG define since this might affect perf.
|
#ifdef PERF_LOG_DRAW//Seperate from the PERF_LOG define since this might affect perf.
|
||||||
extern u64 g_tickdiff_frame;
|
extern u64 g_tickdiff_frame;
|
||||||
@ -699,7 +705,7 @@ void menuLoop(void) {
|
|||||||
//DrawText(interuiregular18, getX, 30 + 26 + 32 + 10, themeCurrent.textColor, textGetString(StrId_ThemeMenu));
|
//DrawText(interuiregular18, getX, 30 + 26 + 32 + 10, themeCurrent.textColor, textGetString(StrId_ThemeMenu));
|
||||||
//DrawText(fontscale7, getX - 40, 30 + 26 + 32 + 10, themeCurrent.textColor, themeCurrent.buttonMText);
|
//DrawText(fontscale7, getX - 40, 30 + 26 + 32 + 10, themeCurrent.textColor, themeCurrent.buttonMText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(active_entry != NULL) {
|
if(active_entry != NULL) {
|
||||||
if (active_entry->type == ENTRY_TYPE_THEME) {
|
if (active_entry->type == ENTRY_TYPE_THEME) {
|
||||||
DrawText(fontscale7, 1280 - 126 - 30 - 32, 720 - 47 + 24, themeCurrent.textColor, themeCurrent.buttonAText);
|
DrawText(fontscale7, 1280 - 126 - 30 - 32, 720 - 47 + 24, themeCurrent.textColor, themeCurrent.buttonAText);
|
||||||
|
@ -12,8 +12,9 @@ bool colorFromSetting(config_setting_t *rgba, color_t *col) {
|
|||||||
|
|
||||||
void themeStartup(ThemePreset preset) {
|
void themeStartup(ThemePreset preset) {
|
||||||
themeGlobalPreset = preset;
|
themeGlobalPreset = preset;
|
||||||
theme_t themeLight = (theme_t) {
|
theme_t themeLight = (theme_t) {
|
||||||
.textColor = MakeColor(0, 0, 0, 255),
|
.textColor = MakeColor(0, 0, 0, 255),
|
||||||
|
.attentionTextColor = MakeColor(255, 0, 0, 255),
|
||||||
.frontWaveColor = MakeColor(100, 212, 250, 255),
|
.frontWaveColor = MakeColor(100, 212, 250, 255),
|
||||||
.middleWaveColor = MakeColor(100, 153, 255, 255),
|
.middleWaveColor = MakeColor(100, 153, 255, 255),
|
||||||
.backWaveColor = MakeColor(154, 171, 255, 255),
|
.backWaveColor = MakeColor(154, 171, 255, 255),
|
||||||
@ -34,9 +35,10 @@ void themeStartup(ThemePreset preset) {
|
|||||||
.labelStarOffText = "\u2606",
|
.labelStarOffText = "\u2606",
|
||||||
.hbmenuLogoImage = assetsGetDataBuffer(AssetId_hbmenu_logo_light),
|
.hbmenuLogoImage = assetsGetDataBuffer(AssetId_hbmenu_logo_light),
|
||||||
};
|
};
|
||||||
|
|
||||||
theme_t themeDark = (theme_t) {
|
theme_t themeDark = (theme_t) {
|
||||||
.textColor = MakeColor(255, 255, 255, 255),
|
.textColor = MakeColor(255, 255, 255, 255),
|
||||||
|
.attentionTextColor = MakeColor(255, 0, 0, 255),
|
||||||
.frontWaveColor = MakeColor(96, 204, 204, 255),
|
.frontWaveColor = MakeColor(96, 204, 204, 255),
|
||||||
.middleWaveColor = MakeColor(66, 154, 159, 255),
|
.middleWaveColor = MakeColor(66, 154, 159, 255),
|
||||||
.backWaveColor = MakeColor(73, 103, 169, 255),
|
.backWaveColor = MakeColor(73, 103, 169, 255),
|
||||||
@ -65,7 +67,7 @@ void themeStartup(ThemePreset preset) {
|
|||||||
config_t cfg = {0};
|
config_t cfg = {0};
|
||||||
config_init(&cfg);
|
config_init(&cfg);
|
||||||
config_setting_t *theme = NULL;
|
config_setting_t *theme = NULL;
|
||||||
color_t text, frontWave, middleWave, backWave, background, highlight, separator, borderColor, borderTextColor, progressBarColor;
|
color_t text, attentionText, frontWave, middleWave, backWave, background, highlight, separator, borderColor, borderTextColor, progressBarColor;
|
||||||
int waveBlending;
|
int waveBlending;
|
||||||
const char *AText, *BText, *XText, *YText, *PText, *MText, *starOnText, *starOffText;
|
const char *AText, *BText, *XText, *YText, *PText, *MText, *starOnText, *starOffText;
|
||||||
bool good_cfg = false;
|
bool good_cfg = false;
|
||||||
@ -92,6 +94,8 @@ void themeStartup(ThemePreset preset) {
|
|||||||
if (theme != NULL) {
|
if (theme != NULL) {
|
||||||
if (!colorFromSetting(config_setting_lookup(theme, "textColor"), &text))
|
if (!colorFromSetting(config_setting_lookup(theme, "textColor"), &text))
|
||||||
text = themeDefault->textColor;
|
text = themeDefault->textColor;
|
||||||
|
if (!colorFromSetting(config_setting_lookup(theme, "attentionTextColor"), &attentionText))
|
||||||
|
attentionText = themeDefault->attentionTextColor;
|
||||||
if (!colorFromSetting(config_setting_lookup(theme, "frontWaveColor"), &frontWave))
|
if (!colorFromSetting(config_setting_lookup(theme, "frontWaveColor"), &frontWave))
|
||||||
frontWave = themeDefault->frontWaveColor;
|
frontWave = themeDefault->frontWaveColor;
|
||||||
if (!colorFromSetting(config_setting_lookup(theme, "middleWaveColor"), &middleWave))
|
if (!colorFromSetting(config_setting_lookup(theme, "middleWaveColor"), &middleWave))
|
||||||
@ -130,6 +134,7 @@ void themeStartup(ThemePreset preset) {
|
|||||||
starOffText = themeDefault->labelStarOffText;
|
starOffText = themeDefault->labelStarOffText;
|
||||||
themeCurrent = (theme_t) {
|
themeCurrent = (theme_t) {
|
||||||
.textColor = text,
|
.textColor = text,
|
||||||
|
.attentionTextColor = attentionText,
|
||||||
.frontWaveColor = frontWave,
|
.frontWaveColor = frontWave,
|
||||||
.middleWaveColor = middleWave,
|
.middleWaveColor = middleWave,
|
||||||
.backWaveColor = backWave,
|
.backWaveColor = backWave,
|
||||||
@ -169,7 +174,7 @@ void GetThemePathFromConfig(char* themePath, size_t size) {
|
|||||||
snprintf(tmp_path, sizeof(tmp_path)-1, "%s/config/nx-hbmenu/settings.cfg", menuGetRootBasePath());
|
snprintf(tmp_path, sizeof(tmp_path)-1, "%s/config/nx-hbmenu/settings.cfg", menuGetRootBasePath());
|
||||||
snprintf(tmp_path_theme, sizeof(tmp_path_theme)-1, "%s/config/nx-hbmenu/themes/", menuGetRootBasePath());
|
snprintf(tmp_path_theme, sizeof(tmp_path_theme)-1, "%s/config/nx-hbmenu/themes/", menuGetRootBasePath());
|
||||||
bool good_cfg = config_read_file(&cfg, tmp_path);
|
bool good_cfg = config_read_file(&cfg, tmp_path);
|
||||||
|
|
||||||
if(good_cfg) {
|
if(good_cfg) {
|
||||||
settings = config_lookup(&cfg, "settings");
|
settings = config_lookup(&cfg, "settings");
|
||||||
if(settings != NULL) {
|
if(settings != NULL) {
|
||||||
@ -187,7 +192,7 @@ void SetThemePathToConfig(const char* themePath) {
|
|||||||
|
|
||||||
char settingPath[PATH_MAX] = {0};
|
char settingPath[PATH_MAX] = {0};
|
||||||
config_setting_t *root = NULL,
|
config_setting_t *root = NULL,
|
||||||
*group = NULL,
|
*group = NULL,
|
||||||
*settings = NULL;
|
*settings = NULL;
|
||||||
|
|
||||||
themePath = getSlash(themePath);
|
themePath = getSlash(themePath);
|
||||||
@ -199,7 +204,7 @@ void SetThemePathToConfig(const char* themePath) {
|
|||||||
|
|
||||||
snprintf(settingPath, sizeof(settingPath)-1, "%s/config/nx-hbmenu/settings.cfg", menuGetRootBasePath());
|
snprintf(settingPath, sizeof(settingPath)-1, "%s/config/nx-hbmenu/settings.cfg", menuGetRootBasePath());
|
||||||
bool good_cfg = config_read_file(&cfg, settingPath);
|
bool good_cfg = config_read_file(&cfg, settingPath);
|
||||||
|
|
||||||
if(good_cfg) {
|
if(good_cfg) {
|
||||||
group = config_lookup(&cfg, "settings");
|
group = config_lookup(&cfg, "settings");
|
||||||
if(group != NULL)
|
if(group != NULL)
|
||||||
@ -210,9 +215,9 @@ void SetThemePathToConfig(const char* themePath) {
|
|||||||
root = config_root_setting(&cfg);
|
root = config_root_setting(&cfg);
|
||||||
if(root != NULL)
|
if(root != NULL)
|
||||||
group = config_setting_add(root, "settings", CONFIG_TYPE_GROUP);
|
group = config_setting_add(root, "settings", CONFIG_TYPE_GROUP);
|
||||||
if(group != NULL)
|
if(group != NULL)
|
||||||
settings = config_setting_add(group, "themePath", CONFIG_TYPE_STRING);
|
settings = config_setting_add(group, "themePath", CONFIG_TYPE_STRING);
|
||||||
if(settings != NULL)
|
if(settings != NULL)
|
||||||
config_setting_set_string(settings, themePath);
|
config_setting_set_string(settings, themePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
color_t textColor;
|
color_t textColor;
|
||||||
|
color_t attentionTextColor;
|
||||||
color_t frontWaveColor;
|
color_t frontWaveColor;
|
||||||
color_t middleWaveColor;
|
color_t middleWaveColor;
|
||||||
color_t backWaveColor;
|
color_t backWaveColor;
|
||||||
|
Loading…
Reference in New Issue
Block a user