From 103d71ac2fb3ead96da16d25097f1f559c953fcd Mon Sep 17 00:00:00 2001 From: Michał Cichoń Date: Tue, 25 Aug 2015 18:34:55 +0200 Subject: Add new type of message MSG_DEBUG. This solve problem of playback time adding to artist when name is short. Debug messages are automatically copied to clipboard for easier debugging due to selection and copying in Windows console is not very convenient. --- src/settings.c | 4 +++- src/ui_act.c | 3 +-- src/ui_types.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/settings.c b/src/settings.c index 7ed10f5..297cfbc 100644 --- a/src/settings.c +++ b/src/settings.c @@ -197,6 +197,8 @@ void BarSettingsRead (BarSettings_t *settings) { settings->msgFormat[MSG_QUESTION].postfix = NULL; settings->msgFormat[MSG_LIST].prefix = strdup ("\t"); settings->msgFormat[MSG_LIST].postfix = NULL; + settings->msgFormat[MSG_DEBUG].prefix = NULL; + settings->msgFormat[MSG_DEBUG].postfix = NULL; for (size_t i = 0; i < BAR_KS_COUNT; i++) { settings->keys[i] = dispatchActions[i].defaultKey; @@ -331,7 +333,7 @@ void BarSettingsRead (BarSettings_t *settings) { } else if (strncmp (formatMsgPrefix, key, strlen (formatMsgPrefix)) == 0) { static const char *mapping[] = {"none", "info", "nowplaying", - "time", "err", "question", "list"}; + "time", "err", "question", "list", "debug"}; const char *typeStart = key + strlen (formatMsgPrefix); for (size_t i = 0; i < sizeof (mapping) / sizeof (*mapping); i++) { if (streq (typeStart, mapping[i])) { diff --git a/src/ui_act.c b/src/ui_act.c index 920ca6b..ad7e0fe 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -344,8 +344,7 @@ BarUiActCallback(BarUiActDebug) { assert (selSong != NULL); /* print debug-alike infos */ - BarUiMsg (&app->settings, MSG_NONE, - "\033[2K" + BarUiMsg (&app->settings, MSG_DEBUG, "album:\t%s\n" "artist:\t%s\n" "audioFormat:\t%i\n" diff --git a/src/ui_types.h b/src/ui_types.h index dd3c3f8..aab4199 100644 --- a/src/ui_types.h +++ b/src/ui_types.h @@ -32,7 +32,8 @@ typedef enum { MSG_ERR = 4, MSG_QUESTION = 5, MSG_LIST = 6, - MSG_COUNT = 7, /* invalid type */ + MSG_DEBUG = 7, + MSG_COUNT = 8, /* invalid type */ } BarUiMsg_t; #endif /* SRC_UI_TYPES_H_2HR75RII */ -- cgit v1.2.3