Skip to content

Commit 07f8777

Browse files
committed
More widget category type corrections
1 parent 79b5778 commit 07f8777

File tree

4 files changed

+76
-44
lines changed

4 files changed

+76
-44
lines changed

command.c

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,7 @@ bool command_event_save_core_config(
19271927
{
19281928
const char *_msg = msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET);
19291929
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
1930-
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
1930+
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
19311931
RARCH_ERR("[Config] %s\n", _msg);
19321932
return false;
19331933
}
@@ -2010,24 +2010,32 @@ void command_event_save_current_config(enum override_type type)
20102010
{
20112011
size_t _len;
20122012
char msg[256];
2013+
uint8_t msg_cat = MESSAGE_QUEUE_CATEGORY_INFO;
20132014

20142015
msg[0] = '\0';
20152016

20162017
if (path_is_empty(RARCH_PATH_CONFIG))
20172018
{
2018-
_len = strlcpy(msg, "Config directory not set, cannot save configuration.", sizeof(msg));
2019-
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
2020-
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
2019+
msg_cat = MESSAGE_QUEUE_CATEGORY_ERROR;
2020+
_len = strlcpy(msg, "Config directory not set, cannot save configuration.", sizeof(msg));
20212021
}
20222022
else
20232023
{
20242024
if (runloop_st->flags & RUNLOOP_FLAG_OVERRIDES_ACTIVE)
2025-
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ACTIVE_NOT_SAVING), sizeof(msg));
2025+
{
2026+
msg_cat = MESSAGE_QUEUE_CATEGORY_ERROR;
2027+
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ACTIVE_NOT_SAVING), sizeof(msg));
2028+
}
20262029
else
2027-
_len = command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
2028-
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
2029-
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
2030+
{
2031+
msg_cat = MESSAGE_QUEUE_CATEGORY_SUCCESS;
2032+
_len = command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
2033+
}
20302034
}
2035+
2036+
RARCH_LOG("[Overrides] %s\n", msg);
2037+
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
2038+
MESSAGE_QUEUE_ICON_DEFAULT, msg_cat);
20312039
}
20322040
break;
20332041
case OVERRIDE_GAME:
@@ -2036,29 +2044,33 @@ void command_event_save_current_config(enum override_type type)
20362044
{
20372045
size_t _len;
20382046
char msg[256];
2039-
int8_t ret = config_save_overrides(type, &runloop_st->system, false, NULL);
2047+
int8_t ret = config_save_overrides(type, &runloop_st->system, false, NULL);
2048+
uint8_t msg_cat = MESSAGE_QUEUE_CATEGORY_INFO;
20402049

20412050
switch (ret)
20422051
{
20432052
case 1:
2044-
_len = strlcpy(msg,
2053+
msg_cat = MESSAGE_QUEUE_CATEGORY_SUCCESS;
2054+
_len = strlcpy(msg,
20452055
msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg));
20462056
/* set overrides to active so the original config can be
20472057
restored after closing content */
20482058
runloop_st->flags |= RUNLOOP_FLAG_OVERRIDES_ACTIVE;
20492059
break;
20502060
case -1:
2051-
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_NOT_SAVED), sizeof(msg));
2061+
msg_cat = MESSAGE_QUEUE_CATEGORY_WARNING;
2062+
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_NOT_SAVED), sizeof(msg));
20522063
break;
20532064
default:
20542065
case 0:
2066+
msg_cat = MESSAGE_QUEUE_CATEGORY_ERROR;
20552067
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg));
20562068
break;
20572069
}
20582070

20592071
RARCH_LOG("[Overrides] %s\n", msg);
20602072
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
2061-
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
2073+
MESSAGE_QUEUE_ICON_DEFAULT, msg_cat);
20622074

20632075
#ifdef HAVE_MENU
20642076
{
@@ -2087,14 +2099,22 @@ void command_event_remove_current_config(enum override_type type)
20872099
{
20882100
size_t _len;
20892101
char msg[256];
2102+
uint8_t msg_cat = MESSAGE_QUEUE_CATEGORY_INFO;
2103+
20902104
if (config_save_overrides(type, &runloop_st->system, true, NULL))
2091-
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_REMOVED_SUCCESSFULLY), sizeof(msg));
2105+
{
2106+
msg_cat = MESSAGE_QUEUE_CATEGORY_SUCCESS;
2107+
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_REMOVED_SUCCESSFULLY), sizeof(msg));
2108+
}
20922109
else
2093-
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_REMOVING), sizeof(msg));
2110+
{
2111+
msg_cat = MESSAGE_QUEUE_CATEGORY_ERROR;
2112+
_len = strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_REMOVING), sizeof(msg));
2113+
}
20942114

20952115
RARCH_LOG("[Overrides] %s\n", msg);
20962116
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
2097-
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
2117+
MESSAGE_QUEUE_ICON_DEFAULT, msg_cat);
20982118
#ifdef HAVE_MENU
20992119
{
21002120
struct menu_state *menu_st = menu_state_get_ptr();

gfx/gfx_widgets.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ void gfx_widgets_msg_queue_push(
216216
msg_widget->flags |= DISPWIDG_FLAG_CATEGORY_WARNING;
217217
else if (category == MESSAGE_QUEUE_CATEGORY_ERROR)
218218
msg_widget->flags |= DISPWIDG_FLAG_CATEGORY_ERROR;
219+
else if (category == MESSAGE_QUEUE_CATEGORY_SUCCESS)
220+
msg_widget->flags |= DISPWIDG_FLAG_CATEGORY_SUCCESS;
219221

220222
if (prio > 1 && category != MESSAGE_QUEUE_CATEGORY_ERROR)
221223
msg_widget->flags |= DISPWIDG_FLAG_SMALL;
@@ -1371,6 +1373,7 @@ static void gfx_widgets_draw_regular_msg(
13711373
static float msg_queue_info_blue[16] = COLOR_HEX_TO_FLOAT(ICON_COLOR_BLUE, 1.0f);
13721374
static float msg_queue_info_yellow[16] = COLOR_HEX_TO_FLOAT(ICON_COLOR_YELLOW, 1.0f);
13731375
static float msg_queue_info_red[16] = COLOR_HEX_TO_FLOAT(ICON_COLOR_RED, 1.0f);
1376+
static float msg_queue_info_green[16] = COLOR_HEX_TO_FLOAT(ICON_COLOR_GREEN, 1.0f);
13741377
static float msg_queue_bar[16] = COLOR_HEX_TO_FLOAT(BG_COLOR_MARGIN, 1.0f);
13751378
float* msg_queue_info;
13761379
float text_y_base;
@@ -1382,11 +1385,14 @@ static void gfx_widgets_draw_regular_msg(
13821385
msg->flags &= ~DISPWIDG_FLAG_UNFOLDING;
13831386
msg->flags |= DISPWIDG_FLAG_UNFOLDED;
13841387

1385-
/* Tint icon yellow for warnings and red for errors, otherwise use blue */
1388+
/* Tint icon yellow for warnings, red for errors,
1389+
* green for success, and blue for info */
13861390
if (msg->flags & DISPWIDG_FLAG_CATEGORY_WARNING)
13871391
msg_queue_info = msg_queue_info_yellow;
13881392
else if (msg->flags & DISPWIDG_FLAG_CATEGORY_ERROR)
13891393
msg_queue_info = msg_queue_info_red;
1394+
else if (msg->flags & DISPWIDG_FLAG_CATEGORY_SUCCESS)
1395+
msg_queue_info = msg_queue_info_green;
13901396
else
13911397
msg_queue_info = msg_queue_info_blue;
13921398

gfx/gfx_widgets.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ enum disp_widget_flags_enum
124124
DISPWIDG_FLAG_NEGATIVE = (1 << 9),
125125
DISPWIDG_FLAG_CATEGORY_WARNING = (1 << 10),
126126
DISPWIDG_FLAG_CATEGORY_ERROR = (1 << 11),
127+
DISPWIDG_FLAG_CATEGORY_SUCCESS = (1 << 12),
127128
/* Size */
128-
DISPWIDG_FLAG_SMALL = (1 << 12)
129+
DISPWIDG_FLAG_SMALL = (1 << 13)
129130
};
130131

131132
/* There can only be one message animation at a time to

0 commit comments

Comments
 (0)