From 60ba82303f21ccf5ee53e6e2a48ca3d4dee89acb Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Sat, 19 Jun 2004 19:31:14 +0000 Subject: [PATCH] display errors without exiting when key bindings are broken git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1564 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- po/ncmpc.pot | 210 ++++++++++++++++++++++--------------------- po/sv.po | 244 ++++++++++++++++++++++++++------------------------ src/command.c | 123 +++++++++++++++---------- src/command.h | 2 +- src/main.c | 21 +++-- 5 files changed, 328 insertions(+), 272 deletions(-) diff --git a/po/ncmpc.pot b/po/ncmpc.pot index 922c04f..0c70346 100644 --- a/po/ncmpc.pot +++ b/po/ncmpc.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-06-16 13:19+0200\n" +"POT-Creation-Date: 2004-06-19 19:21+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,20 +24,16 @@ msgstr "" msgid "n" msgstr "" -#: src/main.c:99 +#: src/main.c:101 msgid "Exiting..." msgstr "" -#: src/main.c:140 -msgid "Confusing key bindings - exiting!\n" -msgstr "" - -#: src/main.c:235 +#: src/main.c:242 #, c-format msgid "Connecting to %s... [Press %s to abort]" msgstr "" -#: src/main.c:247 +#: src/main.c:254 #, c-format msgid "Connected to %s!" msgstr "" @@ -145,31 +141,34 @@ msgstr "" msgid "Unable to find '%s'" msgstr "" -#. query the user for a filename -#: src/screen_play.c:120 +#: src/screen_play.c:142 msgid "Save playlist as: " msgstr "" -#: src/screen_play.c:140 +#: src/screen_play.c:171 #, c-format msgid "Replace %s [%s/%s] ? " msgstr "" -#: src/screen_play.c:157 src/screen_file.c:316 src/screen_keydef.c:159 +#: src/screen_play.c:188 src/screen_file.c:316 src/screen_keydef.c:159 msgid "Aborted!" msgstr "" #. success -#: src/screen_play.c:163 +#: src/screen_play.c:194 #, c-format msgid "Saved %s" msgstr "" -#: src/screen_play.c:204 +#: src/screen_play.c:252 +msgid "Add: " +msgstr "" + +#: src/screen_play.c:310 msgid "Playlist" msgstr "" -#: src/screen_play.c:206 +#: src/screen_play.c:312 #, c-format msgid "Playlist on %s" msgstr "" @@ -332,239 +331,248 @@ msgstr "" msgid "Help" msgstr "" -#: src/command.c:67 -msgid "Play/Enter directory" -msgstr "" - -#: src/command.c:69 -msgid "Pause" +#: src/command.c:68 +msgid "Key configuration screen" msgstr "" #: src/command.c:71 -msgid "Stop" -msgstr "" - -#: src/command.c:73 -msgid "Next track" +msgid "Quit" msgstr "" #: src/command.c:75 -msgid "Previous track" +msgid "Move cursor up" msgstr "" #: src/command.c:77 -msgid "Seek forward" +msgid "Move cursor down" msgstr "" #: src/command.c:79 -msgid "Seek backward" +msgid "Home " msgstr "" -#: src/command.c:82 -msgid "Increase volume" +#: src/command.c:81 +msgid "End " msgstr "" -#: src/command.c:84 -msgid "Decrease volume" +#: src/command.c:83 +msgid "Page up" msgstr "" -#: src/command.c:87 -msgid "Toggle find mode" +#: src/command.c:85 +msgid "Page down" msgstr "" -#: src/command.c:89 -msgid "Toggle auto center mode" +#: src/command.c:90 +msgid "Help screen" msgstr "" #: src/command.c:92 -msgid "Select/deselect song in playlist" +msgid "Playlist screen" msgstr "" #: src/command.c:94 -msgid "Delete song from playlist" +msgid "Browse screen" msgstr "" -#: src/command.c:96 -msgid "Shuffle playlist" +#: src/command.c:99 +msgid "Play/Enter directory" msgstr "" -#: src/command.c:98 -msgid "Clear playlist" +#: src/command.c:101 +msgid "Pause" msgstr "" -#: src/command.c:100 -msgid "Toggle repeat mode" +#: src/command.c:103 +msgid "Stop" msgstr "" -#: src/command.c:102 -msgid "Toggle random mode" +#: src/command.c:105 +msgid "Next track" msgstr "" -#: src/command.c:104 -msgid "Toggle crossfade mode" +#: src/command.c:107 +msgid "Previous track" msgstr "" -#: src/command.c:106 -msgid "Start a music database update" +#: src/command.c:109 +msgid "Seek forward" msgstr "" -#: src/command.c:109 -msgid "Save playlist" +#: src/command.c:111 +msgid "Seek backward" msgstr "" -#: src/command.c:112 -msgid "Move item up" +#: src/command.c:113 +msgid "Increase volume" msgstr "" -#: src/command.c:114 -msgid "Move item down" +#: src/command.c:115 +msgid "Decrease volume" msgstr "" #: src/command.c:117 -msgid "Move cursor up" +msgid "Select/deselect song in playlist" msgstr "" #: src/command.c:119 -msgid "Move cursor down" +msgid "Delete song from playlist" msgstr "" #: src/command.c:121 -msgid "Home " +msgid "Shuffle playlist" msgstr "" #: src/command.c:123 -msgid "End " +msgid "Clear playlist" msgstr "" #: src/command.c:125 -msgid "Page up" +msgid "Toggle repeat mode" msgstr "" #: src/command.c:127 -msgid "Page down" +msgid "Toggle random mode" msgstr "" #: src/command.c:129 -msgid "Forward find" +msgid "Toggle crossfade mode" msgstr "" #: src/command.c:131 -msgid "Forward find next" +msgid "Start a music database update" msgstr "" #: src/command.c:133 -msgid "Backward find" +msgid "Save playlist" msgstr "" #: src/command.c:135 -msgid "Backward find previous" +msgid "Add url/file to playlist" msgstr "" -#: src/command.c:139 -msgid "Next screen" +#: src/command.c:140 +msgid "Move item up" msgstr "" #: src/command.c:142 -msgid "Previous screen" -msgstr "" - -#: src/command.c:145 -msgid "Help screen" +msgid "Move item down" msgstr "" -#: src/command.c:147 -msgid "Playlist screen" +#: src/command.c:144 +msgid "Update screen" msgstr "" #: src/command.c:149 -msgid "Browse screen" +msgid "Toggle find mode" msgstr "" #: src/command.c:151 -msgid "Update screen" +msgid "Toggle auto center mode" msgstr "" -#: src/command.c:154 -msgid "Clock screen" +#: src/command.c:156 +msgid "Next screen" msgstr "" #: src/command.c:158 -msgid "Key configuration screen" +msgid "Previous screen" msgstr "" -#: src/command.c:162 -msgid "Quit" +#: src/command.c:163 +msgid "Forward find" +msgstr "" + +#: src/command.c:165 +msgid "Forward find next" msgstr "" -#: src/command.c:183 +#: src/command.c:167 +msgid "Backward find" +msgstr "" + +#: src/command.c:169 +msgid "Backward find previous" +msgstr "" + +#: src/command.c:175 +msgid "Clock screen" +msgstr "" + +#: src/command.c:199 msgid "Undefined" msgstr "" -#: src/command.c:185 +#: src/command.c:201 msgid "Space" msgstr "" -#: src/command.c:187 +#: src/command.c:203 msgid "Enter" msgstr "" -#: src/command.c:189 +#: src/command.c:205 msgid "Backspace" msgstr "" -#: src/command.c:191 +#: src/command.c:207 msgid "Delete" msgstr "" -#: src/command.c:193 +#: src/command.c:209 msgid "Up" msgstr "" -#: src/command.c:195 +#: src/command.c:211 msgid "Down" msgstr "" -#: src/command.c:197 +#: src/command.c:213 msgid "Left" msgstr "" -#: src/command.c:199 +#: src/command.c:215 msgid "Right" msgstr "" -#: src/command.c:201 +#: src/command.c:217 msgid "Home" msgstr "" -#: src/command.c:203 +#: src/command.c:219 msgid "End" msgstr "" -#: src/command.c:205 +#: src/command.c:221 msgid "PageDown" msgstr "" -#: src/command.c:207 +#: src/command.c:223 msgid "PageUp" msgstr "" -#: src/command.c:209 +#: src/command.c:225 msgid "Tab" msgstr "" -#: src/command.c:211 +#: src/command.c:227 msgid "Shift+Tab" msgstr "" -#: src/command.c:213 +#: src/command.c:229 msgid "Esc" msgstr "" -#: src/command.c:215 +#: src/command.c:231 msgid "Insert" msgstr "" -#: src/command.c:408 +#: src/command.c:427 +#, c-format +msgid "Key %s assigned to %s and %s (press %s for the key editor)" +msgstr "" + +#: src/command.c:434 src/command.c:441 #, c-format msgid "Error: Key %s assigned to %s and %s !!!\n" msgstr "" diff --git a/po/sv.po b/po/sv.po index 6f44715..2db48d8 100644 --- a/po/sv.po +++ b/po/sv.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ncmpc 0.11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-06-16 13:19+0200\n" +"POT-Creation-Date: 2004-06-19 19:21+0200\n" "PO-Revision-Date: 2004-06-05 18:16+0200\n" "Last-Translator: Kalle Wallin \n" "Language-Team: sv \n" @@ -24,20 +24,16 @@ msgstr "j" msgid "n" msgstr "" -#: src/main.c:99 +#: src/main.c:101 msgid "Exiting..." msgstr "Avslutar..." -#: src/main.c:140 -msgid "Confusing key bindings - exiting!\n" -msgstr "Felaktiga tangent definitioner!\n" - -#: src/main.c:235 +#: src/main.c:242 #, c-format msgid "Connecting to %s... [Press %s to abort]" msgstr "Ansluter till %s... [Tryck %s för att avbryta]" -#: src/main.c:247 +#: src/main.c:254 #, c-format msgid "Connected to %s!" msgstr "Ansluten till %s!" @@ -145,31 +141,34 @@ msgstr "S msgid "Unable to find '%s'" msgstr "Hittar inte '%s'" -#. query the user for a filename -#: src/screen_play.c:120 +#: src/screen_play.c:142 msgid "Save playlist as: " msgstr "Spara spellistan som: " -#: src/screen_play.c:140 +#: src/screen_play.c:171 #, c-format msgid "Replace %s [%s/%s] ? " msgstr "Ersätt '%s' [%s/%s] ? " -#: src/screen_play.c:157 src/screen_file.c:316 src/screen_keydef.c:159 +#: src/screen_play.c:188 src/screen_file.c:316 src/screen_keydef.c:159 msgid "Aborted!" msgstr "Avbröt!" #. success -#: src/screen_play.c:163 +#: src/screen_play.c:194 #, c-format msgid "Saved %s" msgstr "Sparat %s" -#: src/screen_play.c:204 +#: src/screen_play.c:252 +msgid "Add: " +msgstr "Lägg till: " + +#: src/screen_play.c:310 msgid "Playlist" msgstr "Spellista" -#: src/screen_play.c:206 +#: src/screen_play.c:312 #, c-format msgid "Playlist on %s" msgstr "Spellista på %s" @@ -332,239 +331,248 @@ msgstr "V msgid "Help" msgstr "Hjälp" -#: src/command.c:67 +#: src/command.c:68 +msgid "Key configuration screen" +msgstr "Tangentdefinitioner" + +#: src/command.c:71 +msgid "Quit" +msgstr "Avsluta" + +#: src/command.c:75 +msgid "Move cursor up" +msgstr "Markör nedåt" + +#: src/command.c:77 +msgid "Move cursor down" +msgstr "Markör uppåt" + +#: src/command.c:79 +msgid "Home " +msgstr "Markören till den första raden" + +#: src/command.c:81 +msgid "End " +msgstr "Markören till den sista raden" + +#: src/command.c:83 +msgid "Page up" +msgstr "Markören en skärm uppåt" + +#: src/command.c:85 +msgid "Page down" +msgstr "Markören en skärm nedåt" + +#: src/command.c:90 +msgid "Help screen" +msgstr "Hjälp" + +#: src/command.c:92 +msgid "Playlist screen" +msgstr "Spellista" + +#: src/command.c:94 +msgid "Browse screen" +msgstr "Filer" + +#: src/command.c:99 msgid "Play/Enter directory" msgstr "Spela/Välj" -#: src/command.c:69 +#: src/command.c:101 msgid "Pause" msgstr "Paus" -#: src/command.c:71 +#: src/command.c:103 msgid "Stop" msgstr "Stopp" -#: src/command.c:73 +#: src/command.c:105 msgid "Next track" msgstr "Nästa" -#: src/command.c:75 +#: src/command.c:107 msgid "Previous track" msgstr "Föregånde" -#: src/command.c:77 +#: src/command.c:109 msgid "Seek forward" msgstr "Spola/Sök framåt" -#: src/command.c:79 +#: src/command.c:111 msgid "Seek backward" msgstr "Spola/Sök tillbaka" -#: src/command.c:82 +#: src/command.c:113 msgid "Increase volume" msgstr "Öka volymen" -#: src/command.c:84 +#: src/command.c:115 msgid "Decrease volume" msgstr "Minska volymen" -#: src/command.c:87 -msgid "Toggle find mode" -msgstr "Ändra sök inställningar" - -#: src/command.c:89 -msgid "Toggle auto center mode" -msgstr "Automatisk centrering På/Av" - -#: src/command.c:92 +#: src/command.c:117 msgid "Select/deselect song in playlist" msgstr "Lägg till/Ta bort" -#: src/command.c:94 +#: src/command.c:119 msgid "Delete song from playlist" msgstr "Ta bort/Radera" -#: src/command.c:96 +#: src/command.c:121 msgid "Shuffle playlist" msgstr "Slumpsportera spellista" -#: src/command.c:98 +#: src/command.c:123 msgid "Clear playlist" msgstr "Rensa spellistan" -#: src/command.c:100 +#: src/command.c:125 msgid "Toggle repeat mode" msgstr "Repeat På/Av" -#: src/command.c:102 +#: src/command.c:127 msgid "Toggle random mode" msgstr "Random På/Av" -#: src/command.c:104 +#: src/command.c:129 msgid "Toggle crossfade mode" msgstr "Crossfade På/Av" -#: src/command.c:106 +#: src/command.c:131 msgid "Start a music database update" msgstr "Updatera databasen" -#: src/command.c:109 +#: src/command.c:133 msgid "Save playlist" msgstr "Spara spellista" -#: src/command.c:112 +#: src/command.c:135 +msgid "Add url/file to playlist" +msgstr "Lägger till url eller fil till spellistan" + +#: src/command.c:140 msgid "Move item up" msgstr "Flytta upp" -#: src/command.c:114 +#: src/command.c:142 msgid "Move item down" msgstr "Flytta ner" -#: src/command.c:117 -msgid "Move cursor up" -msgstr "Markör nedåt" - -#: src/command.c:119 -msgid "Move cursor down" -msgstr "Markör uppåt" +#: src/command.c:144 +msgid "Update screen" +msgstr "Updatera" -#: src/command.c:121 -msgid "Home " -msgstr "Markören till den första raden" +#: src/command.c:149 +msgid "Toggle find mode" +msgstr "Ändra sök inställningar" -#: src/command.c:123 -msgid "End " -msgstr "Markören till den sista raden" +#: src/command.c:151 +msgid "Toggle auto center mode" +msgstr "Automatisk centrering På/Av" -#: src/command.c:125 -msgid "Page up" -msgstr "Markören en skärm uppåt" +#: src/command.c:156 +msgid "Next screen" +msgstr "Nästa skärm" -#: src/command.c:127 -msgid "Page down" -msgstr "Markören en skärm nedåt" +#: src/command.c:158 +msgid "Previous screen" +msgstr "Tidigare skärm" -#: src/command.c:129 +#: src/command.c:163 msgid "Forward find" msgstr "Sök" -#: src/command.c:131 +#: src/command.c:165 msgid "Forward find next" msgstr "Upprepa Sökning" -#: src/command.c:133 +#: src/command.c:167 msgid "Backward find" msgstr "Sök bakåt" -#: src/command.c:135 +#: src/command.c:169 msgid "Backward find previous" msgstr "Upprepa Sökning bakåt" -#: src/command.c:139 -msgid "Next screen" -msgstr "Nästa skärm" - -#: src/command.c:142 -msgid "Previous screen" -msgstr "Tidigare skärm" - -#: src/command.c:145 -msgid "Help screen" -msgstr "Hjälp" - -#: src/command.c:147 -msgid "Playlist screen" -msgstr "Spellista" - -#: src/command.c:149 -msgid "Browse screen" -msgstr "Filer" - -#: src/command.c:151 -msgid "Update screen" -msgstr "Updatera" - -#: src/command.c:154 +#: src/command.c:175 msgid "Clock screen" msgstr "Klocka" -#: src/command.c:158 -msgid "Key configuration screen" -msgstr "Tangentdefinitioner" - -#: src/command.c:162 -msgid "Quit" -msgstr "Avsluta" - -#: src/command.c:183 +#: src/command.c:199 msgid "Undefined" msgstr "Ej definerad" -#: src/command.c:185 +#: src/command.c:201 msgid "Space" msgstr "Mellanslag" -#: src/command.c:187 +#: src/command.c:203 msgid "Enter" msgstr "" -#: src/command.c:189 +#: src/command.c:205 msgid "Backspace" msgstr "" -#: src/command.c:191 +#: src/command.c:207 msgid "Delete" msgstr "Del" -#: src/command.c:193 +#: src/command.c:209 msgid "Up" msgstr "Uppåtpil" -#: src/command.c:195 +#: src/command.c:211 msgid "Down" msgstr "Nedåtpil" -#: src/command.c:197 +#: src/command.c:213 msgid "Left" msgstr "Vänsterpil" -#: src/command.c:199 +#: src/command.c:215 msgid "Right" msgstr "Högerpil" -#: src/command.c:201 +#: src/command.c:217 msgid "Home" msgstr "" -#: src/command.c:203 +#: src/command.c:219 msgid "End" msgstr "" -#: src/command.c:205 +#: src/command.c:221 msgid "PageDown" msgstr "" -#: src/command.c:207 +#: src/command.c:223 msgid "PageUp" msgstr "" -#: src/command.c:209 +#: src/command.c:225 msgid "Tab" msgstr "" -#: src/command.c:211 +#: src/command.c:227 msgid "Shift+Tab" msgstr "" -#: src/command.c:213 +#: src/command.c:229 msgid "Esc" msgstr "" -#: src/command.c:215 +#: src/command.c:231 msgid "Insert" msgstr "Ins" -#: src/command.c:408 +#: src/command.c:427 +#, c-format +msgid "Key %s assigned to %s and %s (press %s for the key editor)" +msgstr "%s tilldelat kommandona %s och %s (tryck på %s och korrigera)" + +#: src/command.c:434 src/command.c:441 #, c-format msgid "Error: Key %s assigned to %s and %s !!!\n" msgstr "Fel: Tangenten %s är tilldelad både %s och %s !!!\n" @@ -595,3 +603,5 @@ msgstr "Fel vid konvertering av tecken fr #: src/support.c:215 msgid "Error: Unable to convert characters to UTF-8" msgstr "Fel vid konvertering av tecken till UTF-8" + + diff --git a/src/command.c b/src/command.c index 57f90d4..8af2d75 100644 --- a/src/command.c +++ b/src/command.c @@ -63,6 +63,38 @@ extern void screen_resize(void); static command_definition_t cmds[] = { +#ifdef ENABLE_KEYDEF_SCREEN + { {'K', 0, 0 }, CMD_SCREEN_KEYDEF, "screen-keyedit", + N_("Key configuration screen") }, +#endif + { { 'q', 'Q', 3 }, CMD_QUIT, "quit", + N_("Quit") }, + + /* movment */ + { { UP, ',', 0 }, CMD_LIST_PREVIOUS, "up", + N_("Move cursor up") }, + { { DWN, '.', 0 }, CMD_LIST_NEXT, "down", + N_("Move cursor down") }, + { { HOME, 0x01, 0 }, CMD_LIST_FIRST, "home", + N_("Home ") }, + { { END, 0x05, 0 }, CMD_LIST_LAST, "end", + N_("End ") }, + { { PGUP, 0, 0 }, CMD_LIST_PREVIOUS_PAGE, "pgup", + N_("Page up") }, + { { PGDN, 0, 0 }, CMD_LIST_NEXT_PAGE, "pgdn", + N_("Page down") }, + + + /* basic screens */ + { { '1', F1, 'h' }, CMD_SCREEN_HELP, "screen-help", + N_("Help screen") }, + { { '2', F2, 0 }, CMD_SCREEN_PLAY, "screen-playlist", + N_("Playlist screen") }, + { { '3', F3, 0 }, CMD_SCREEN_FILE, "screen-browse", + N_("Browse screen") }, + + + /* player commands */ { { 13, 0, 0 }, CMD_PLAY, "play", N_("Play/Enter directory") }, { { 'P', 0, 0 }, CMD_PAUSE,"pause", @@ -77,17 +109,10 @@ static command_definition_t cmds[] = N_("Seek forward") }, { { 'b', 0, 0 }, CMD_SEEK_BACKWARD, "seek-backward", N_("Seek backward") }, - { { '+', RGHT, 0 }, CMD_VOLUME_UP, "volume-up", N_("Increase volume") }, { { '-', LEFT, 0 }, CMD_VOLUME_DOWN, "volume-down", N_("Decrease volume") }, - - { { 'w', 0, 0 }, CMD_TOGGLE_FIND_WRAP, "wrap-mode", - N_("Toggle find mode") }, - { { 'U', 0, 0 }, CMD_TOGGLE_AUTOCENTER, "autocenter-mode", - N_("Toggle auto center mode") }, - { { ' ', 0, 0 }, CMD_SELECT, "select", N_("Select/deselect song in playlist") }, { { DEL, 'd', 0 }, CMD_DELETE, "delete", @@ -102,31 +127,38 @@ static command_definition_t cmds[] = N_("Toggle random mode") }, { { 'x', 0, 0 }, CMD_CROSSFADE, "crossfade", N_("Toggle crossfade mode") }, - { { 21, 0, 0 }, CMD_DB_UPDATE, "db-update", + { { 21, 0, 0 }, CMD_DB_UPDATE, "db-update", N_("Start a music database update") }, - { { 'S', 0, 0 }, CMD_SAVE_PLAYLIST, "save", N_("Save playlist") }, { { 'a', 0, 0 }, CMD_ADD, "add", N_("Add url/file to playlist") }, + + /* lists */ { { 0, 0, 0 }, CMD_LIST_MOVE_UP, "move-up", N_("Move item up") }, { { 0, 0, 0 }, CMD_LIST_MOVE_DOWN, "move-down", N_("Move item down") }, + { {'u', 0, 0 }, CMD_SCREEN_UPDATE, "update", + N_("Update screen") }, - { { UP, ',', 0 }, CMD_LIST_PREVIOUS, "up", - N_("Move cursor up") }, - { { DWN, '.', 0 }, CMD_LIST_NEXT, "down", - N_("Move cursor down") }, - { { HOME, 0x01, 0 }, CMD_LIST_FIRST, "home", - N_("Home ") }, - { { END, 0x05, 0 }, CMD_LIST_LAST, "end", - N_("End ") }, - { { PGUP, 'A', 0 }, CMD_LIST_PREVIOUS_PAGE, "pgup", - N_("Page up") }, - { { PGDN, 'B', 0 }, CMD_LIST_NEXT_PAGE, "pgdn", - N_("Page down") }, + + /* ncmpc options */ + { { 'w', 0, 0 }, CMD_TOGGLE_FIND_WRAP, "wrap-mode", + N_("Toggle find mode") }, + { { 'U', 0, 0 }, CMD_TOGGLE_AUTOCENTER, "autocenter-mode", + N_("Toggle auto center mode") }, + + + /* change screen */ + { { TAB, 0, 0 }, CMD_SCREEN_NEXT, "screen-next", + N_("Next screen") }, + { { STAB, 0, 0 }, CMD_SCREEN_PREVIOUS, "screen-prev", + N_("Previous screen") }, + + + /* find */ { { '/', 0, 0 }, CMD_LIST_FIND, "find", N_("Forward find") }, { { 'n', 0, 0 }, CMD_LIST_FIND_NEXT, "find-next", @@ -137,31 +169,13 @@ static command_definition_t cmds[] = N_("Backward find previous") }, - { { TAB, 0, 0 }, CMD_SCREEN_NEXT, "screen-next", - N_("Next screen") }, - - { { STAB, 0, 0 }, CMD_SCREEN_PREVIOUS, "screen-prev", - N_("Previous screen") }, - - { { '1', F1, 'h' }, CMD_SCREEN_HELP, "screen-help", - N_("Help screen") }, - { { '2', F2, 0 }, CMD_SCREEN_PLAY, "screen-playlist", - N_("Playlist screen") }, - { { '3', F3, 0 }, CMD_SCREEN_FILE, "screen-browse", - N_("Browse screen") }, - { {'u', 0, 0 }, CMD_SCREEN_UPDATE, "update", - N_("Update screen") }, + /* extra screens */ #ifdef ENABLE_CLOCK_SCREEN { {'4', F4, 0 }, CMD_SCREEN_CLOCK, "screen-clock", N_("Clock screen") }, #endif -#ifdef ENABLE_KEYDEF_SCREEN - { {'K', 0, 0 }, CMD_SCREEN_KEYDEF, "screen-keyedit", - N_("Key configuration screen") }, -#endif - { { 'q', 'Q', 3 }, CMD_QUIT, "quit", - N_("Quit") }, + { { -1, -1, -1 }, CMD_NONE, NULL, NULL } }; @@ -392,7 +406,7 @@ assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]) } int -check_key_bindings(void) +check_key_bindings(char *buf, size_t bufsize) { int i; int retval = 0; @@ -407,10 +421,27 @@ check_key_bindings(void) if( cmds[i].keys[j] && (cmd=get_key_command(cmds[i].keys[j])) != cmds[i].command ) { - fprintf(stderr, _("Error: Key %s assigned to %s and %s !!!\n"), - key2str(cmds[i].keys[j]), - get_key_command_name(cmds[i].command), - get_key_command_name(cmd)); + if( buf ) +#ifdef ENABLE_KEYDEF_SCREEN + snprintf(buf, bufsize, + _("Key %s assigned to %s and %s (press %s for the key editor)"), + key2str(cmds[i].keys[j]), + get_key_command_name(cmds[i].command), + get_key_command_name(cmd), + get_key_names(CMD_SCREEN_KEYDEF,0)); +#else + snprintf(buf, bufsize, + _("Error: Key %s assigned to %s and %s !!!\n"), + key2str(cmds[i].keys[j]), + get_key_command_name(cmds[i].command), + get_key_command_name(cmd)); +#endif + else + fprintf(stderr, + _("Error: Key %s assigned to %s and %s !!!\n"), + key2str(cmds[i].keys[j]), + get_key_command_name(cmds[i].command), + get_key_command_name(cmd)); retval = -1; } i++; diff --git a/src/command.h b/src/command.h index e96940a..c212ac0 100644 --- a/src/command.h +++ b/src/command.h @@ -63,7 +63,7 @@ command_definition_t *get_command_definitions(void); command_t find_key_command(int key, command_definition_t *cmds); void command_dump_keys(void); -int check_key_bindings(void); +int check_key_bindings(char *buf, size_t size); int write_key_bindings(FILE *f); char *key2str(int key); diff --git a/src/main.c b/src/main.c index 81522f9..b48bd00 100644 --- a/src/main.c +++ b/src/main.c @@ -34,6 +34,8 @@ #include "screen.h" #include "conf.h" +#define BUFSIZE 256 + static mpdclient_t *mpd = NULL; static gboolean connected = FALSE; static GTimer *timer = NULL; @@ -106,6 +108,7 @@ main(int argc, const char *argv[]) options_t *options; struct sigaction act; const char *charset = NULL; + gboolean key_error; #ifdef HAVE_LOCALE_H /* time and date formatting */ @@ -133,14 +136,10 @@ main(int argc, const char *argv[]) /* read configuration */ read_configuration(options); - - /* check key bindings */ - if( check_key_bindings() ) - { - fprintf(stderr, _("Confusing key bindings - exiting!\n")); - exit(EXIT_FAILURE); - } + /* check key bindings */ + key_error = check_key_bindings(NULL, 0); + /* parse command line options - 2 pass */ options_parse(argc, argv); @@ -209,6 +208,14 @@ main(int argc, const char *argv[]) { static gdouble t = G_MAXDOUBLE; + if( key_error ) + { + char buf[BUFSIZE]; + + key_error=check_key_bindings(buf, BUFSIZE); + screen_status_printf("%s", buf); + } + if( connected && (t>=MPD_UPDATE_TIME || mpd->need_update) ) { mpdclient_update(mpd); -- 2.30.2