summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 41d25e2)
raw | patch | inline | side by side (parent: 41d25e2)
author | Kalle Wallin <kaw@linux.se> | |
Mon, 15 Nov 2004 11:23:11 +0000 (11:23 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Mon, 15 Nov 2004 11:23:11 +0000 (11:23 +0000) |
24 files changed:
ChangeLog | patch | blob | history | |
configure.ac | patch | blob | history | |
po/POTFILES.in | patch | blob | history | |
po/ncmpc.pot | patch | blob | history | |
po/sv.po | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/command.c | patch | blob | history | |
src/command.h | patch | blob | history | |
src/conf.c | patch | blob | history | |
src/mpdclient.c | patch | blob | history | |
src/mpdclient.h | patch | blob | history | |
src/ncmpc.h | patch | blob | history | |
src/options.c | patch | blob | history | |
src/options.h | patch | blob | history | |
src/screen.c | patch | blob | history | |
src/screen_browse.h | [new file with mode: 0644] | patch | blob |
src/screen_clock.c | patch | blob | history | |
src/screen_file.c | patch | blob | history | |
src/screen_help.c | patch | blob | history | |
src/screen_keydef.c | patch | blob | history | |
src/screen_play.c | patch | blob | history | |
src/screen_search.c | patch | blob | history | |
src/screen_utils.c | patch | blob | history | |
src/screen_utils.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 45c6942e1e136d1f7f65fee874b79e11cda9dd3f..48042cb0c8e9ef6cba7af06ec55ebdde1ac1c1e5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2004-11-14 Kalle Wallin <kaw@linux.se>
+ * Added a search screen
+ * screen_browse.c: added enqueue and play feature
+ * configure.ac: made mouse support and search screen optional
+
2004-07-21 Kalle Wallin <kaw@linux.se>
* Added Spanish translations from Jose Cedeno
* command.c: dont lookup key if key==0 in find_key_command()
diff --git a/configure.ac b/configure.ac
index 60c9e0e0a7c2d0f45709f362d69d0a2d41c18821..dee7d43f0f14b321af44c5219c38dcf5847aa6f8 100644 (file)
--- a/configure.ac
+++ b/configure.ac
[initscr],
[LIBS="$LIBS -lncurses"],
[AC_MSG_ERROR(ncurses library is required)])
-AC_CHECK_LIB([ncurses],
- [getmouse],
- [AC_DEFINE([HAVE_GETMOUSE], [1], [ncurses - getmouse()])],
- [])
-
dnl Check for glib-2.4
# AC_DEFINE(ENABLE_BROWSE_SCREEN, 1, [Enable the browse screen])
#fi
+dnl Optional - curses getmouse support
+AC_MSG_CHECKING([whether to include mouse support])
+AC_ARG_ENABLE([mouse],
+ AC_HELP_STRING([--enable-mouse],
+ [Enable curses getmouse support @<:@default=yes@:>@]),
+ [getmouse="$enableval"],
+ [getmouse=yes])
+AC_MSG_RESULT([$getmouse])
+if test "x$getmouse" = "xyes" ; then
+ AC_CHECK_LIB([ncurses],
+ [getmouse],
+ [AC_DEFINE([HAVE_GETMOUSE], [1], [ncurses - getmouse()])],
+ [])
+fi
+
+dnl search screen
+AC_MSG_CHECKING([whether to include the search screen])
+AC_ARG_ENABLE([search-screen],
+ AC_HELP_STRING([--enable-search-screen],
+ [Enable search screen @<:@default=yes@:>@]),
+ [search_screen="$enableval"],
+ [search_screen=yes])
+AC_MSG_RESULT([$search_screen])
+if test "x$search_screen" != "xyes" ; then
+ AC_DEFINE(DISABLE_SEARCH_SCREEN, 1, [Disable search screen])
+fi
+
dnl Optional screen - key editor
AC_MSG_CHECKING([whether to include the key editor screen])
AC_ARG_ENABLE([key-screen],
[keydef_screen="$enableval"],
[keydef_screen=yes])
AC_MSG_RESULT([$keydef_screen])
-if test "x$keydef_screen" = "xyes" ; then
- AC_DEFINE(ENABLE_KEYDEF_SCREEN, 1, [Enable key editor screen])
+if test "x$keydef_screen" != "xyes" ; then
+ AC_DEFINE(DISABLE_KEYDEF_SCREEN, 1, [Disable key editor screen])
fi
dnl Optional screen - clock
[clock_screen="$enableval"],
[clock_screen=no])
AC_MSG_RESULT([$clock_screen])
-if test "x$clock_screen" = "xyes" ; then
- AC_DEFINE(ENABLE_CLOCK_SCREEN, 1, [Enable clock screen])
+if test "x$clock_screen" != "xyes" ; then
+ AC_DEFINE(DISABLE_CLOCK_SCREEN, 1, [Disable clock screen])
fi
dnl Default host
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c4c58ba98156af8f6db271df14735e6e7bd7b8dd..6a29351e04e8c3580388345439eea97847bd299f 100644 (file)
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
src/screen_utils.c
src/screen_play.c
src/screen_file.c
+src/screen_search.c
src/screen_keydef.c
src/screen_clock.c
src/screen_help.c
diff --git a/po/ncmpc.pot b/po/ncmpc.pot
index 0c54f93a0bb29551a49ab3a749ffe1163fa7aae5..def7ac43027a1c62f0f295bbb9470d794cc5d955 100644 (file)
--- a/po/ncmpc.pot
+++ b/po/ncmpc.pot
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-07-03 19:36+0200\n"
+"POT-Creation-Date: 2004-11-14 22:38+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/ncmpc.h:26
+#: src/ncmpc.h:36
msgid "y"
msgstr ""
-#: src/ncmpc.h:27
+#: src/ncmpc.h:37
msgid "n"
msgstr ""
-#: src/main.c:132
+#: src/main.c:133
msgid "Exiting..."
msgstr ""
-#: src/main.c:237
+#: src/main.c:266
#, c-format
msgid "Error: MPD version %d.%d.%d is to old (0.11.0 needed).\n"
msgstr ""
-#: src/main.c:289
+#: src/main.c:318
#, c-format
msgid "Connecting to %s... [Press %s to abort]"
msgstr ""
-#: src/main.c:301
+#: src/main.c:330
#, c-format
msgid "Connected to %s!"
msgstr ""
-#: src/screen.c:149
+#: src/screen.c:170
msgid ":Help "
msgstr ""
-#: src/screen.c:153
+#: src/screen.c:174
msgid ":Playlist "
msgstr ""
-#: src/screen.c:157
-msgid ":Browse"
+#: src/screen.c:178
+msgid ":Browse "
msgstr ""
-#: src/screen.c:161
+#: src/screen.c:183
+msgid ":Search "
+msgstr ""
+
+#: src/screen.c:188
msgid "Volume n/a "
msgstr ""
-#: src/screen.c:165
+#: src/screen.c:192
#, c-format
msgid " Volume %d%%"
msgstr ""
-#: src/screen.c:245
+#: src/screen.c:271
msgid "Playing:"
msgstr ""
-#: src/screen.c:248
+#: src/screen.c:274
msgid "[Paused]"
msgstr ""
-#: src/screen.c:380 src/screen.c:484
+#: src/screen.c:390 src/screen.c:499
+#, c-format
msgid "Error: Screen to small!\n"
msgstr ""
-#: src/screen.c:640
+#: src/screen.c:644
msgid "Repeat is on"
msgstr ""
-#: src/screen.c:641
+#: src/screen.c:645
msgid "Repeat is off"
msgstr ""
-#: src/screen.c:644
+#: src/screen.c:648
msgid "Random is on"
msgstr ""
-#: src/screen.c:645
+#: src/screen.c:649
msgid "Random is off"
msgstr ""
-#: src/screen.c:648
+#: src/screen.c:652
#, c-format
msgid "Crossfade %d seconds"
msgstr ""
-#: src/screen.c:651
+#: src/screen.c:655
msgid "Database updated!"
msgstr ""
-#: src/screen.c:815
+#: src/screen.c:817
msgid "Shuffled playlist!"
msgstr ""
-#: src/screen.c:819
+#: src/screen.c:821
msgid "Cleared playlist!"
msgstr ""
-#: src/screen.c:834
+#: src/screen.c:839
msgid "Database update started!"
msgstr ""
-#: src/screen.c:837 src/screen_file.c:626
+#: src/screen.c:842 src/screen_file.c:662
msgid "Database update running..."
msgstr ""
-#: src/screen.c:850
+#: src/screen.c:855
msgid "Find mode: Wrapped"
msgstr ""
-#: src/screen.c:851
+#: src/screen.c:856
msgid "Find mode: Normal"
msgstr ""
-#: src/screen.c:856
+#: src/screen.c:861
msgid "Auto center mode: On"
msgstr ""
-#: src/screen.c:857
+#: src/screen.c:862
msgid "Auto center mode: Off"
msgstr ""
msgid "Find backward: "
msgstr ""
-#: src/screen_utils.c:169
+#: src/screen_utils.c:165
#, c-format
msgid "Unable to find '%s'"
msgstr ""
msgid "Replace %s [%s/%s] ? "
msgstr ""
-#: src/screen_play.c:197 src/screen_file.c:317 src/screen_keydef.c:161
+#: src/screen_play.c:198 src/screen_file.c:319 src/screen_keydef.c:162
msgid "Aborted!"
msgstr ""
#. success
-#: src/screen_play.c:203
+#: src/screen_play.c:204
#, c-format
msgid "Saved %s"
msgstr ""
-#: src/screen_play.c:267
+#: src/screen_play.c:268
msgid "Add: "
msgstr ""
-#: src/screen_play.c:322
+#: src/screen_play.c:323
msgid "Playlist"
msgstr ""
-#: src/screen_play.c:324
+#: src/screen_play.c:325
#, c-format
msgid "Playlist on %s"
msgstr ""
-#: src/screen_file.c:281
+#: src/screen_file.c:282
#, c-format
msgid "Loading playlist %s..."
msgstr ""
-#: src/screen_file.c:303
+#: src/screen_file.c:304
msgid "You can only delete playlists!"
msgstr ""
-#: src/screen_file.c:310
+#: src/screen_file.c:311
#, c-format
msgid "Delete playlist %s [%s/%s] ? "
msgstr ""
-#: src/screen_file.c:325
+#: src/screen_file.c:327
msgid "Playlist deleted!"
msgstr ""
-#: src/screen_file.c:362
+#: src/screen_file.c:345 src/screen_file.c:462 src/screen_file.c:488
#, c-format
-msgid "Adding directory %s...\n"
+msgid "Adding '%s' to playlist\n"
msgstr ""
-#: src/screen_file.c:427 src/screen_file.c:453
+#: src/screen_file.c:394
#, c-format
-msgid "Adding '%s' to playlist\n"
+msgid "Adding directory %s...\n"
msgstr ""
-#: src/screen_file.c:529
+#: src/screen_file.c:564
#, c-format
msgid "Browse: %s"
msgstr ""
-#: src/screen_file.c:611
+#: src/screen_file.c:647
msgid "Screen updated!"
msgstr ""
-#: src/screen_file.c:618
+#: src/screen_file.c:654
#, c-format
msgid "Database update of %s started!"
msgstr ""
+#: src/screen_search.c:50
+msgid "Title"
+msgstr ""
+
+#: src/screen_search.c:51
+msgid "Artist"
+msgstr ""
+
+#: src/screen_search.c:52
+msgid "Album"
+msgstr ""
+
+#: src/screen_search.c:53
+msgid "Filename"
+msgstr ""
+
+#: src/screen_search.c:114
+msgid "Search: "
+msgstr ""
+
+#: src/screen_search.c:162
+#, c-format
+msgid "Press %s for a new search"
+msgstr ""
+
+#: src/screen_search.c:214
+#, c-format
+msgid "Search: Results for %s [%s]"
+msgstr ""
+
+#: src/screen_search.c:218
+#, c-format
+msgid "Search: Press %s for a new search [%s]"
+msgstr ""
+
+#: src/screen_search.c:252
+#, c-format
+msgid "Search mode: %s"
+msgstr ""
+
#: src/screen_keydef.c:46
msgid "===> Apply & Save key bindings "
msgstr ""
msgid "Enter new key for %s: "
msgstr ""
-#: src/screen_keydef.c:167
+#: src/screen_keydef.c:168
#, c-format
msgid "Error: key %s is already used for %s"
msgstr ""
-#: src/screen_keydef.c:176
+#: src/screen_keydef.c:177
#, c-format
msgid "Assigned %s to %s"
msgstr ""
-#: src/screen_keydef.c:219
+#: src/screen_keydef.c:220
#, c-format
msgid "%d. Add new key "
msgstr ""
-#: src/screen_keydef.c:266
+#: src/screen_keydef.c:267
msgid "Welcome to the key editor!"
msgstr ""
-#: src/screen_keydef.c:282
+#: src/screen_keydef.c:283
msgid "Note: Did you forget to 'Apply' your changes?"
msgstr ""
-#: src/screen_keydef.c:289
+#: src/screen_keydef.c:290
msgid "Edit key bindings"
msgstr ""
-#: src/screen_keydef.c:291
+#: src/screen_keydef.c:292
#, c-format
msgid "Edit keys for %s"
msgstr ""
msgid "Keys - Movement"
msgstr ""
-#: src/screen_help.c:65
+#: src/screen_help.c:68
msgid "Keys - Global"
msgstr ""
-#: src/screen_help.c:92
+#: src/screen_help.c:95
msgid "Keys - Playlist screen"
msgstr ""
-#: src/screen_help.c:94
+#: src/screen_help.c:97
msgid "Play"
msgstr ""
-#: src/screen_help.c:97
+#: src/screen_help.c:100
msgid "Move song up"
msgstr ""
-#: src/screen_help.c:98
+#: src/screen_help.c:101
msgid "Move song down"
msgstr ""
-#: src/screen_help.c:101
+#: src/screen_help.c:104
msgid "Center"
msgstr ""
-#: src/screen_help.c:106
+#: src/screen_help.c:109
msgid "Keys - Browse screen"
msgstr ""
-#: src/screen_help.c:108
-msgid "Enter directory"
+#: src/screen_help.c:111
+msgid "Enter directory/Select and play song"
+msgstr ""
+
+#: src/screen_help.c:113
+msgid "Delete playlist"
+msgstr ""
+
+#: src/screen_help.c:119
+msgid "Keys - Search screen"
msgstr ""
-#: src/screen_help.c:210
+#: src/screen_help.c:121
+msgid "Search"
+msgstr ""
+
+#: src/screen_help.c:122
+msgid "Select and play"
+msgstr ""
+
+#: src/screen_help.c:209
msgid "Help"
msgstr ""
-#: src/command.c:68
+#: src/command.c:70
msgid "Key configuration screen"
msgstr ""
-#: src/command.c:71
+#: src/command.c:73
msgid "Quit"
msgstr ""
-#: src/command.c:75
+#: src/command.c:77
msgid "Move cursor up"
msgstr ""
-#: src/command.c:77
+#: src/command.c:79
msgid "Move cursor down"
msgstr ""
-#: src/command.c:79
+#: src/command.c:81
msgid "Home "
msgstr ""
-#: src/command.c:81
+#: src/command.c:83
msgid "End "
msgstr ""
-#: src/command.c:83
+#: src/command.c:85
msgid "Page up"
msgstr ""
-#: src/command.c:85
+#: src/command.c:87
msgid "Page down"
msgstr ""
-#: src/command.c:90
+#: src/command.c:92
msgid "Help screen"
msgstr ""
-#: src/command.c:92
+#: src/command.c:94
msgid "Playlist screen"
msgstr ""
-#: src/command.c:94
+#: src/command.c:96
msgid "Browse screen"
msgstr ""
-#: src/command.c:99
+#: src/command.c:101
msgid "Play/Enter directory"
msgstr ""
-#: src/command.c:101
+#: src/command.c:103
msgid "Pause"
msgstr ""
-#: src/command.c:103
+#: src/command.c:105
msgid "Stop"
msgstr ""
-#: src/command.c:105
+#: src/command.c:107
msgid "Next track"
msgstr ""
-#: src/command.c:107
+#: src/command.c:109
msgid "Previous track"
msgstr ""
-#: src/command.c:109
+#: src/command.c:111
msgid "Seek forward"
msgstr ""
-#: src/command.c:111
+#: src/command.c:113
msgid "Seek backward"
msgstr ""
-#: src/command.c:113
+#: src/command.c:115
msgid "Increase volume"
msgstr ""
-#: src/command.c:115
+#: src/command.c:117
msgid "Decrease volume"
msgstr ""
-#: src/command.c:117
+#: src/command.c:119
msgid "Select/deselect song in playlist"
msgstr ""
-#: src/command.c:119
+#: src/command.c:121
msgid "Delete song from playlist"
msgstr ""
-#: src/command.c:121
+#: src/command.c:123
msgid "Shuffle playlist"
msgstr ""
-#: src/command.c:123
+#: src/command.c:125
msgid "Clear playlist"
msgstr ""
-#: src/command.c:125
+#: src/command.c:127
msgid "Toggle repeat mode"
msgstr ""
-#: src/command.c:127
+#: src/command.c:129
msgid "Toggle random mode"
msgstr ""
-#: src/command.c:129
+#: src/command.c:131
msgid "Toggle crossfade mode"
msgstr ""
-#: src/command.c:131
+#: src/command.c:133
msgid "Start a music database update"
msgstr ""
-#: src/command.c:133
+#: src/command.c:135
msgid "Save playlist"
msgstr ""
-#: src/command.c:135
+#: src/command.c:137
msgid "Add url/file to playlist"
msgstr ""
-#: src/command.c:140
+#: src/command.c:142
msgid "Move item up"
msgstr ""
-#: src/command.c:142
+#: src/command.c:144
msgid "Move item down"
msgstr ""
-#: src/command.c:144
+#: src/command.c:146
msgid "Update screen"
msgstr ""
-#: src/command.c:149
+#: src/command.c:151
msgid "Toggle find mode"
msgstr ""
-#: src/command.c:151
+#: src/command.c:153
msgid "Toggle auto center mode"
msgstr ""
-#: src/command.c:156
+#: src/command.c:158
msgid "Next screen"
msgstr ""
-#: src/command.c:158
+#: src/command.c:160
msgid "Previous screen"
msgstr ""
-#: src/command.c:163
+#: src/command.c:165
msgid "Forward find"
msgstr ""
-#: src/command.c:165
+#: src/command.c:167
msgid "Forward find next"
msgstr ""
-#: src/command.c:167
+#: src/command.c:169
msgid "Backward find"
msgstr ""
-#: src/command.c:169
+#: src/command.c:171
msgid "Backward find previous"
msgstr ""
-#: src/command.c:175
+#: src/command.c:177
+msgid "Search screen"
+msgstr ""
+
+#: src/command.c:179
+msgid "Change search mode"
+msgstr ""
+
+#: src/command.c:184
msgid "Clock screen"
msgstr ""
-#: src/command.c:197
+#: src/command.c:206
msgid "Undefined"
msgstr ""
-#: src/command.c:199
+#: src/command.c:208
msgid "Space"
msgstr ""
-#: src/command.c:201
+#: src/command.c:210
msgid "Enter"
msgstr ""
-#: src/command.c:203
+#: src/command.c:212
msgid "Backspace"
msgstr ""
-#: src/command.c:205
+#: src/command.c:214
msgid "Delete"
msgstr ""
-#: src/command.c:207
+#: src/command.c:216
msgid "Up"
msgstr ""
-#: src/command.c:209
+#: src/command.c:218
msgid "Down"
msgstr ""
-#: src/command.c:211
+#: src/command.c:220
msgid "Left"
msgstr ""
-#: src/command.c:213
+#: src/command.c:222
msgid "Right"
msgstr ""
-#: src/command.c:215
+#: src/command.c:224
msgid "Home"
msgstr ""
-#: src/command.c:217
+#: src/command.c:226
msgid "End"
msgstr ""
-#: src/command.c:219
+#: src/command.c:228
msgid "PageDown"
msgstr ""
-#: src/command.c:221
+#: src/command.c:230
msgid "PageUp"
msgstr ""
-#: src/command.c:223
+#: src/command.c:232
msgid "Tab"
msgstr ""
-#: src/command.c:225
+#: src/command.c:234
msgid "Shift+Tab"
msgstr ""
-#: src/command.c:227
+#: src/command.c:236
msgid "Esc"
msgstr ""
-#: src/command.c:229
+#: src/command.c:238
msgid "Insert"
msgstr ""
-#: src/command.c:459
+#: src/command.c:488
#, c-format
msgid "Key %s assigned to %s and %s (press %s for the key editor)"
msgstr ""
-#: src/command.c:466 src/command.c:473
+#: src/command.c:495 src/command.c:502
#, c-format
msgid "Error: Key %s assigned to %s and %s !!!\n"
msgstr ""
msgstr ""
#: src/colors.c:267
+#, c-format
msgid "Terminal lacks support for changing colors!\n"
msgstr ""
#: src/colors.c:284
+#, c-format
msgid "Terminal lacks color capabilities!\n"
msgstr ""
-#: src/support.c:166
+#: src/support.c:168
#, c-format
msgid "Error: Unable to convert characters to %s"
msgstr ""
-#: src/support.c:195
+#: src/support.c:197
msgid "Error: Unable to convert characters to UTF-8"
msgstr ""
diff --git a/po/sv.po b/po/sv.po
index 8461436878779b6cce15a0fee198c3c789428a4a..a28cfa74aad1b1b03a8c9b8be7c575b15c371fc8 100644 (file)
--- a/po/sv.po
+++ b/po/sv.po
msgid ""
msgstr ""
"Project-Id-Version: ncmpc 0.11.0\n"
-"Report-Msgid-Bugs-To: Kalle Wallin <kaw@linux.se>\n"
-"POT-Creation-Date: 2004-07-03 19:36+0200\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2004-11-14 22:38+0100\n"
"PO-Revision-Date: 2004-06-05 18:16+0200\n"
"Last-Translator: Kalle Wallin <kaw@linux.se>\n"
"Language-Team: sv <sv@li.org>\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/ncmpc.h:26
+#: src/ncmpc.h:36
msgid "y"
msgstr "j"
-#: src/ncmpc.h:27
+#: src/ncmpc.h:37
msgid "n"
msgstr ""
-#: src/main.c:132
+#: src/main.c:133
msgid "Exiting..."
msgstr "Avslutar..."
-#: src/main.c:237
+#: src/main.c:266
#, c-format
msgid "Error: MPD version %d.%d.%d is to old (0.11.0 needed).\n"
msgstr "MPD version %d.%d.%d är för gammal - uppgradera till version 0.11.x \n"
-#: src/main.c:289
+#: src/main.c:318
#, c-format
msgid "Connecting to %s... [Press %s to abort]"
msgstr "Ansluter till %s... [Tryck %s för att avbryta]"
-#: src/main.c:301
+#: src/main.c:330
#, c-format
msgid "Connected to %s!"
msgstr "Ansluten till %s!"
-#: src/screen.c:149
+#: src/screen.c:170
msgid ":Help "
msgstr ":Hjälp "
-#: src/screen.c:153
+#: src/screen.c:174
msgid ":Playlist "
msgstr ":Spellista "
-#: src/screen.c:157
-msgid ":Browse"
+#: src/screen.c:178
+msgid ":Browse "
msgstr ":Filer "
-#: src/screen.c:161
+#: src/screen.c:183
+msgid ":Search "
+msgstr ":Sök "
+
+#: src/screen.c:188
msgid "Volume n/a "
msgstr "Volym: n/a "
-#: src/screen.c:165
+#: src/screen.c:192
#, c-format
msgid " Volume %d%%"
msgstr " Volym: %d%%"
-#: src/screen.c:245
+#: src/screen.c:271
msgid "Playing:"
msgstr "Spelar:"
-#: src/screen.c:248
+#: src/screen.c:274
msgid "[Paused]"
msgstr "[Pausad]"
-#: src/screen.c:380 src/screen.c:484
+#: src/screen.c:390 src/screen.c:499
+#, c-format
msgid "Error: Screen to small!\n"
msgstr "Fel: Terminal är för liten!\n"
-#: src/screen.c:640
+#: src/screen.c:644
msgid "Repeat is on"
msgstr "Repeat är på"
-#: src/screen.c:641
+#: src/screen.c:645
msgid "Repeat is off"
msgstr "Repeat är av"
-#: src/screen.c:644
+#: src/screen.c:648
msgid "Random is on"
msgstr "Random är på"
-#: src/screen.c:645
+#: src/screen.c:649
msgid "Random is off"
msgstr "Random är av"
-#: src/screen.c:648
+#: src/screen.c:652
#, c-format
msgid "Crossfade %d seconds"
msgstr "Crossfade %d sekunder"
-#: src/screen.c:651
+#: src/screen.c:655
msgid "Database updated!"
msgstr "Databasen är uppdaterad!"
-#: src/screen.c:815
+#: src/screen.c:817
msgid "Shuffled playlist!"
msgstr "Slumpsorterat spellistan!"
-#: src/screen.c:819
+#: src/screen.c:821
msgid "Cleared playlist!"
msgstr "Rensar spellistan!"
-#: src/screen.c:834
+#: src/screen.c:839
msgid "Database update started!"
msgstr "Uppdaterar databasen!"
-#: src/screen.c:837 src/screen_file.c:626
+#: src/screen.c:842 src/screen_file.c:662
msgid "Database update running..."
msgstr "Databasen uppdateras..."
-#: src/screen.c:850
+#: src/screen.c:855
msgid "Find mode: Wrapped"
msgstr "Sök runt (börja om)"
-#: src/screen.c:851
+#: src/screen.c:856
msgid "Find mode: Normal"
msgstr "Sök normalt (till slut/början)"
-#: src/screen.c:856
+#: src/screen.c:861
msgid "Auto center mode: On"
msgstr "Automatisk centrering är på"
-#: src/screen.c:857
+#: src/screen.c:862
msgid "Auto center mode: Off"
msgstr "Automatisk centrering är av"
msgid "Find backward: "
msgstr "Sök (bakåt): "
-#: src/screen_utils.c:169
+#: src/screen_utils.c:165
#, c-format
msgid "Unable to find '%s'"
msgstr "Hittar inte '%s'"
msgid "Replace %s [%s/%s] ? "
msgstr "Ersätt '%s' [%s/%s] ? "
-#: src/screen_play.c:197 src/screen_file.c:317 src/screen_keydef.c:161
+#: src/screen_play.c:198 src/screen_file.c:319 src/screen_keydef.c:162
msgid "Aborted!"
msgstr "Avbröt!"
#. success
-#: src/screen_play.c:203
+#: src/screen_play.c:204
#, c-format
msgid "Saved %s"
msgstr "Sparat %s"
-#: src/screen_play.c:267
+#: src/screen_play.c:268
msgid "Add: "
msgstr "Lägg till: "
-#: src/screen_play.c:322
+#: src/screen_play.c:323
msgid "Playlist"
msgstr "Spellista"
-#: src/screen_play.c:324
+#: src/screen_play.c:325
#, c-format
msgid "Playlist on %s"
msgstr "Spellista på %s"
-#: src/screen_file.c:281
+#: src/screen_file.c:282
#, c-format
msgid "Loading playlist %s..."
msgstr "Laddar %s..."
-#: src/screen_file.c:303
+#: src/screen_file.c:304
msgid "You can only delete playlists!"
msgstr "Du kan endast radera spellistor!"
-#: src/screen_file.c:310
+#: src/screen_file.c:311
#, c-format
msgid "Delete playlist %s [%s/%s] ? "
msgstr "Radera '%s' [%s/%s] ? "
-#: src/screen_file.c:325
+#: src/screen_file.c:327
msgid "Playlist deleted!"
msgstr "Spellistan raderad!"
-#: src/screen_file.c:362
-#, c-format
-msgid "Adding directory %s...\n"
-msgstr "Lägger till alla filer i %s...\n"
-
-#: src/screen_file.c:427 src/screen_file.c:453
+#: src/screen_file.c:345 src/screen_file.c:462 src/screen_file.c:488
#, c-format
msgid "Adding '%s' to playlist\n"
msgstr "Lägger till '%s'...\n"
-#: src/screen_file.c:529
+#: src/screen_file.c:394
+#, c-format
+msgid "Adding directory %s...\n"
+msgstr "Lägger till alla filer i %s...\n"
+
+#: src/screen_file.c:564
#, c-format
msgid "Browse: %s"
msgstr "Filer: %s"
-#: src/screen_file.c:611
+#: src/screen_file.c:647
msgid "Screen updated!"
msgstr "Uppdaterat!"
-#: src/screen_file.c:618
+#: src/screen_file.c:654
#, c-format
msgid "Database update of %s started!"
msgstr "Uppdaterar databasen ifrån %s!"
+#: src/screen_search.c:50
+msgid "Title"
+msgstr "Titel"
+
+#: src/screen_search.c:51
+msgid "Artist"
+msgstr ""
+
+#: src/screen_search.c:52
+msgid "Album"
+msgstr ""
+
+#: src/screen_search.c:53
+msgid "Filename"
+msgstr "Filnamn"
+
+#: src/screen_search.c:114
+msgid "Search: "
+msgstr "Sök: "
+
+#: src/screen_search.c:162
+#, c-format
+msgid "Press %s for a new search"
+msgstr "Tryck på %s för en ny sökning"
+
+#: src/screen_search.c:214
+#, c-format
+msgid "Search: Results for %s [%s]"
+msgstr "Sök: %s [%s]"
+
+#: src/screen_search.c:218
+#, c-format
+msgid "Search: Press %s for a new search [%s]"
+msgstr "Tryck ppå %s för en ny sökning [%s]"
+
+#: src/screen_search.c:252
+#, c-format
+msgid "Search mode: %s"
+msgstr "Sök efter: %s"
+
#: src/screen_keydef.c:46
msgid "===> Apply & Save key bindings "
msgstr "==> Verkställ och Spara"
msgid "Enter new key for %s: "
msgstr "Ny tangent för %s: "
-#: src/screen_keydef.c:167
+#: src/screen_keydef.c:168
#, c-format
msgid "Error: key %s is already used for %s"
msgstr "Tangenten %s används redan för %s"
-#: src/screen_keydef.c:176
+#: src/screen_keydef.c:177
#, c-format
msgid "Assigned %s to %s"
msgstr "%s = %s"
-#: src/screen_keydef.c:219
+#: src/screen_keydef.c:220
#, c-format
msgid "%d. Add new key "
msgstr "%d. Lägg till ny tangent"
-#: src/screen_keydef.c:266
+#: src/screen_keydef.c:267
msgid "Welcome to the key editor!"
msgstr "Här kan du ändra tangentdefinitioner"
-#: src/screen_keydef.c:282
+#: src/screen_keydef.c:283
msgid "Note: Did you forget to 'Apply' your changes?"
msgstr "OBS! Du glömde väl inte att Verkställa?"
-#: src/screen_keydef.c:289
+#: src/screen_keydef.c:290
msgid "Edit key bindings"
msgstr "Ändra tangentdefinitioner"
-#: src/screen_keydef.c:291
+#: src/screen_keydef.c:292
#, c-format
msgid "Edit keys for %s"
msgstr "Ändra tangenter för kommandot '%s'"
msgid "Keys - Movement"
msgstr "Tangenter - Navigation"
-#: src/screen_help.c:65
+#: src/screen_help.c:68
msgid "Keys - Global"
msgstr "Tangenter - Globala"
-#: src/screen_help.c:92
+#: src/screen_help.c:95
msgid "Keys - Playlist screen"
msgstr "Tangenter - Spellista"
-#: src/screen_help.c:94
+#: src/screen_help.c:97
msgid "Play"
msgstr "Starta/Spela markerad"
-#: src/screen_help.c:97
+#: src/screen_help.c:100
msgid "Move song up"
msgstr "Flytta markerad uppåt i spellistan"
-#: src/screen_help.c:98
+#: src/screen_help.c:101
msgid "Move song down"
msgstr "Flytta markerad nedåt i spellistan"
-#: src/screen_help.c:101
+#: src/screen_help.c:104
msgid "Center"
msgstr "Centrera"
-#: src/screen_help.c:106
+#: src/screen_help.c:109
msgid "Keys - Browse screen"
msgstr "Tangenter - Filer"
-#: src/screen_help.c:108
-msgid "Enter directory"
-msgstr "Välj bibliotek"
+#: src/screen_help.c:111
+msgid "Enter directory/Select and play song"
+msgstr "Välj bibliotek/Lägg till spellistan och spela"
+
+#: src/screen_help.c:113
+msgid "Delete playlist"
+msgstr "Radera spellista"
+
+#: src/screen_help.c:119
+msgid "Keys - Search screen"
+msgstr "Tangenter - Databas sökning"
+
+#: src/screen_help.c:121
+msgid "Search"
+msgstr "Sök"
+
+#: src/screen_help.c:122
+msgid "Select and play"
+msgstr "Lägg till spellistan och spela"
-#: src/screen_help.c:210
+#: src/screen_help.c:209
msgid "Help"
msgstr "Hjälp"
-#: src/command.c:68
+#: src/command.c:70
msgid "Key configuration screen"
msgstr "Tangentdefinitioner"
-#: src/command.c:71
+#: src/command.c:73
msgid "Quit"
msgstr "Avsluta"
-#: src/command.c:75
+#: src/command.c:77
msgid "Move cursor up"
msgstr "Markör nedåt"
-#: src/command.c:77
+#: src/command.c:79
msgid "Move cursor down"
msgstr "Markör uppåt"
-#: src/command.c:79
+#: src/command.c:81
msgid "Home "
msgstr "Markören till den första raden"
-#: src/command.c:81
+#: src/command.c:83
msgid "End "
msgstr "Markören till den sista raden"
-#: src/command.c:83
+#: src/command.c:85
msgid "Page up"
msgstr "Markören en skärm uppåt"
-#: src/command.c:85
+#: src/command.c:87
msgid "Page down"
msgstr "Markören en skärm nedåt"
-#: src/command.c:90
+#: src/command.c:92
msgid "Help screen"
msgstr "Hjälp"
-#: src/command.c:92
+#: src/command.c:94
msgid "Playlist screen"
msgstr "Spellista"
-#: src/command.c:94
+#: src/command.c:96
msgid "Browse screen"
msgstr "Filer"
-#: src/command.c:99
+#: src/command.c:101
msgid "Play/Enter directory"
msgstr "Spela/Välj"
-#: src/command.c:101
+#: src/command.c:103
msgid "Pause"
msgstr "Paus"
-#: src/command.c:103
+#: src/command.c:105
msgid "Stop"
msgstr "Stopp"
-#: src/command.c:105
+#: src/command.c:107
msgid "Next track"
msgstr "Nästa"
-#: src/command.c:107
+#: src/command.c:109
msgid "Previous track"
msgstr "Föregånde"
-#: src/command.c:109
+#: src/command.c:111
msgid "Seek forward"
msgstr "Spola/Sök framåt"
-#: src/command.c:111
+#: src/command.c:113
msgid "Seek backward"
msgstr "Spola/Sök tillbaka"
-#: src/command.c:113
+#: src/command.c:115
msgid "Increase volume"
msgstr "Öka volymen"
-#: src/command.c:115
+#: src/command.c:117
msgid "Decrease volume"
msgstr "Minska volymen"
-#: src/command.c:117
+#: src/command.c:119
msgid "Select/deselect song in playlist"
-msgstr "Lägg till/Ta bort"
+msgstr "Lägg till/Ta bort ifrån spellistan"
-#: src/command.c:119
+#: src/command.c:121
msgid "Delete song from playlist"
msgstr "Ta bort/Radera"
-#: src/command.c:121
+#: src/command.c:123
msgid "Shuffle playlist"
msgstr "Slumpsportera spellista"
-#: src/command.c:123
+#: src/command.c:125
msgid "Clear playlist"
msgstr "Rensa spellistan"
-#: src/command.c:125
+#: src/command.c:127
msgid "Toggle repeat mode"
msgstr "Repeat PÃ¥/Av"
-#: src/command.c:127
+#: src/command.c:129
msgid "Toggle random mode"
msgstr "Random PÃ¥/Av"
-#: src/command.c:129
+#: src/command.c:131
msgid "Toggle crossfade mode"
msgstr "Crossfade PÃ¥/Av"
-#: src/command.c:131
+#: src/command.c:133
msgid "Start a music database update"
msgstr "Updatera databasen"
-#: src/command.c:133
+#: src/command.c:135
msgid "Save playlist"
msgstr "Spara spellista"
-#: src/command.c:135
+#: src/command.c:137
msgid "Add url/file to playlist"
msgstr "Lägger till url eller fil till spellistan"
-#: src/command.c:140
+#: src/command.c:142
msgid "Move item up"
msgstr "Flytta upp"
-#: src/command.c:142
+#: src/command.c:144
msgid "Move item down"
msgstr "Flytta ner"
-#: src/command.c:144
+#: src/command.c:146
msgid "Update screen"
msgstr "Updatera"
-#: src/command.c:149
+#: src/command.c:151
msgid "Toggle find mode"
msgstr "Ändra sök inställningar"
-#: src/command.c:151
+#: src/command.c:153
msgid "Toggle auto center mode"
msgstr "Automatisk centrering PÃ¥/Av"
-#: src/command.c:156
+#: src/command.c:158
msgid "Next screen"
msgstr "Nästa skärm"
-#: src/command.c:158
+#: src/command.c:160
msgid "Previous screen"
msgstr "Tidigare skärm"
-#: src/command.c:163
+#: src/command.c:165
msgid "Forward find"
msgstr "Sök"
-#: src/command.c:165
+#: src/command.c:167
msgid "Forward find next"
msgstr "Upprepa Sökning"
-#: src/command.c:167
+#: src/command.c:169
msgid "Backward find"
msgstr "Sök bakåt"
-#: src/command.c:169
+#: src/command.c:171
msgid "Backward find previous"
msgstr "Upprepa Sökning bakåt"
-#: src/command.c:175
+#: src/command.c:177
+msgid "Search screen"
+msgstr "Databas sökning"
+
+#: src/command.c:179
+msgid "Change search mode"
+msgstr "Ändra måltyp för databas sökning"
+
+#: src/command.c:184
msgid "Clock screen"
msgstr "Klocka"
-#: src/command.c:197
+#: src/command.c:206
msgid "Undefined"
msgstr "Ej definerad"
-#: src/command.c:199
+#: src/command.c:208
msgid "Space"
msgstr "Mellanslag"
-#: src/command.c:201
+#: src/command.c:210
msgid "Enter"
msgstr ""
-#: src/command.c:203
+#: src/command.c:212
msgid "Backspace"
msgstr ""
-#: src/command.c:205
+#: src/command.c:214
msgid "Delete"
msgstr "Del"
-#: src/command.c:207
+#: src/command.c:216
msgid "Up"
msgstr "Uppåtpil"
-#: src/command.c:209
+#: src/command.c:218
msgid "Down"
msgstr "Nedåtpil"
-#: src/command.c:211
+#: src/command.c:220
msgid "Left"
msgstr "Vänsterpil"
-#: src/command.c:213
+#: src/command.c:222
msgid "Right"
msgstr "Högerpil"
-#: src/command.c:215
+#: src/command.c:224
msgid "Home"
msgstr ""
-#: src/command.c:217
+#: src/command.c:226
msgid "End"
msgstr ""
-#: src/command.c:219
+#: src/command.c:228
msgid "PageDown"
msgstr ""
-#: src/command.c:221
+#: src/command.c:230
msgid "PageUp"
msgstr ""
-#: src/command.c:223
+#: src/command.c:232
msgid "Tab"
msgstr ""
-#: src/command.c:225
+#: src/command.c:234
msgid "Shift+Tab"
msgstr ""
-#: src/command.c:227
+#: src/command.c:236
msgid "Esc"
msgstr ""
-#: src/command.c:229
+#: src/command.c:238
msgid "Insert"
msgstr "Ins"
-#: src/command.c:459
+#: src/command.c:488
#, 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:466 src/command.c:473
+#: src/command.c:495 src/command.c:502
#, c-format
msgid "Error: Key %s assigned to %s and %s !!!\n"
msgstr "Fel: Tangenten %s är tilldelad både %s och %s !!!\n"
msgstr "Varning: %s ej definerad.\n"
#: src/colors.c:267
+#, c-format
msgid "Terminal lacks support for changing colors!\n"
msgstr "Terminalen saknar stöd för omdefinition av färger!\n"
#: src/colors.c:284
+#, c-format
msgid "Terminal lacks color capabilities!\n"
msgstr "Terminalen saknar stöd för färger!\n"
-#: src/support.c:166
+#: src/support.c:168
#, c-format
msgid "Error: Unable to convert characters to %s"
msgstr "Fel vid konvertering av tecken från UTF-8 till %s"
-#: src/support.c:195
+#: src/support.c:197
msgid "Error: Unable to convert characters to UTF-8"
msgstr "Fel vid konvertering av tecken till UTF-8"
+
+#~ msgid "Enter directory"
+#~ msgstr "Välj bibliotek"
diff --git a/src/Makefile.am b/src/Makefile.am
index fc81ed9b9a584ad06ac3902fecc7227d18723f54..796ac8d9d2a7a83fec0a6ead0b97b1984230d55a 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
ncmpc_headers = libmpdclient.h mpdclient.h options.h conf.h command.h \
screen.h screen_utils.h list_window.h colors.h support.h \
- wreadln.h strfsong.h utils.h ncmpc.h
+ wreadln.h strfsong.h utils.h ncmpc.h screen_browse.h
ncmpc_SOURCES = libmpdclient.c main.c mpdclient.c options.c conf.c command.c \
screen.c screen_utils.c screen_play.c screen_file.c \
diff --git a/src/command.c b/src/command.c
index aecf31ab716a72140ec000dd8fd22efae5a38dec..5b235e6787371445900521e535d2f01dabf8935c 100644 (file)
--- a/src/command.c
+++ b/src/command.c
/* extra screens */
+#ifdef ENABLE_SEARCH_SCREEN
+ { {'4', F4, 0 }, 0, CMD_SCREEN_SEARCH, "screen-search",
+ N_("Search screen") },
+ { {'m', 0, 0 }, 0, CMD_SEARCH_MODE, "search-mode",
+ N_("Change search mode") },
+#endif
+
#ifdef ENABLE_CLOCK_SCREEN
- { {'4', F4, 0 }, 0, CMD_SCREEN_CLOCK, "screen-clock",
+ { {'5', F5, 0 }, 0, CMD_SCREEN_CLOCK, "screen-clock",
N_("Clock screen") },
#endif
diff --git a/src/command.h b/src/command.h
index fc436a4435a66f7ef105cbbae2acca9030dc7722..29e6a0637e2d5d6b5e9a63bbf2f283f556d0635b 100644 (file)
--- a/src/command.h
+++ b/src/command.h
CMD_SAVE_PLAYLIST,
CMD_TOGGLE_FIND_WRAP,
CMD_TOGGLE_AUTOCENTER,
+ CMD_SEARCH_MODE,
CMD_LIST_PREVIOUS,
CMD_LIST_NEXT,
CMD_LIST_FIRST,
diff --git a/src/conf.c b/src/conf.c
index 740939d10ec432594cd229e9067c588d8e0ce4c2..11dba99933b1967a04f8ce0927d8346c9ab3146f 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
#define CONF_XTERM_TITLE "set-xterm-title"
#define CONF_ENABLE_MOUSE "enable-mouse"
#define CONF_CROSSFADE_TIME "crossfade-time"
+#define CONF_SEARCH_MODE "search-mode"
typedef enum {
KEY_PARSER_UNKNOWN,
{
options->crossfade_time = atoi(value);
}
+ else if( !strcasecmp(CONF_SEARCH_MODE, name) )
+ {
+ options->search_mode = atoi(value);
+ }
else
{
match_found = 0;
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 1f7c737905b5299c1c7ce46501326512e5b08aee..7cec3c9675a83ae90585b3950d7ce07b368795db 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
GList *list = g_list_first(filelist->list);
D("mpdclient_filelist_free()\n");
+ if( list == NULL )
+ return NULL;
while( list!=NULL )
{
filelist_entry_t *entry = list->data;
return filelist;
}
+mpdclient_filelist_t *
+mpdclient_filelist_search(mpdclient_t *c, int table, gchar *filter)
+{
+ mpdclient_filelist_t *filelist;
+ mpd_InfoEntity *entity;
+ gchar *filter_utf8 = locale_to_utf8(filter);
+
+ D("mpdclient_filelist_filter(%s)\n", filter);
+ mpd_sendSearchCommand(c->connection, table, filter_utf8);
+ filelist = g_malloc0(sizeof(mpdclient_filelist_t));
+
+ while( (entity=mpd_getNextInfoEntity(c->connection)) )
+ {
+ filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
+
+ entry->entity = entity;
+ filelist->list = g_list_append(filelist->list, (gpointer) entry);
+ filelist->length++;
+ }
+
+ if( mpdclient_finish_command(c) )
+ {
+ g_free(filter_utf8);
+ return mpdclient_filelist_free(filelist);
+ }
+
+ g_free(filter_utf8);
+ filelist->updated = TRUE;
+
+ return filelist;
+}
+
mpdclient_filelist_t *
mpdclient_filelist_update(mpdclient_t *c, mpdclient_filelist_t *filelist)
{
diff --git a/src/mpdclient.h b/src/mpdclient.h
index 016d1ba1b1fa54a564251a68015fe658e101a0ee..89a2e63277941fa437ba2a97a6ef3cdeb765b8b3 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
/*** filelist functions ***************************************************/
mpdclient_filelist_t *mpdclient_filelist_free(mpdclient_filelist_t *filelist);
mpdclient_filelist_t *mpdclient_filelist_get(mpdclient_t *c, gchar *path);
+mpdclient_filelist_t *mpdclient_filelist_search(mpdclient_t *c,
+ int table,
+ gchar *path);
mpdclient_filelist_t *mpdclient_filelist_update(mpdclient_t *c,
mpdclient_filelist_t *flist);
diff --git a/src/ncmpc.h b/src/ncmpc.h
index 75fbf8e4a565ba18e8b20936b036313267176a2a..0c72a099f2a2ac9a2ffad728aac4934444fb953b 100644 (file)
--- a/src/ncmpc.h
+++ b/src/ncmpc.h
#include "config.h"
#endif
+#ifndef DISABLE_SEARCH_SCREEN
+#define ENABLE_SEARCH_SCREEN 1
+#endif
+#ifndef DISABLE_KEYDEF_SCREEN
+#define ENABLE_KEYDEF_SCREEN 1
+#endif
+#ifndef DISABLE_CLOCK_SCREEN
+#define ENABLE_CLOCK_SCREEN 1
+#endif
+
#ifdef DEBUG
void D(char *format, ...);
#else
diff --git a/src/options.c b/src/options.c
index 4f1100f9d9f0ce2fed50b9f4eea25d5c32d4f647..a5289105b6730bcd23121abb270af8c610f676dc 100644 (file)
--- a/src/options.c
+++ b/src/options.c
#ifdef ENABLE_NLS
printf(" nls");
#endif
+#ifdef HAVE_GETMOUSE
+ printf(" getmouse");
+#endif
+#ifdef ENABLE_SEARCH_SCREEN
+ printf(" search-screen");
+#endif
#ifdef ENABLE_KEYDEF_SCREEN
printf(" key-screen");
#endif
diff --git a/src/options.h b/src/options.h
index e4d61e87828a2c0b941d94d2171e666bab2c2baf..d264dd1fa01cb78de3dcfe5aee2fc802c5736bb4 100644 (file)
--- a/src/options.h
+++ b/src/options.h
char *xterm_title_format;
int port;
int crossfade_time;
+ int search_mode;
gboolean reconnect;
gboolean debug;
gboolean find_wrap;
diff --git a/src/screen.c b/src/screen.c
index e390720b83df2ca41269924514fb0cb6393dcf0f..be4865f0457bc34a20878e8538a2913372387f58 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
#define SCREEN_HELP_ID 100
#define SCREEN_KEYDEF_ID 101
#define SCREEN_CLOCK_ID 102
+#define SCREEN_SEARCH_ID 103
+
/* screens */
extern screen_functions_t *get_screen_playlist(void);
extern screen_functions_t *get_screen_browse(void);
extern screen_functions_t *get_screen_help(void);
+extern screen_functions_t *get_screen_search(void);
extern screen_functions_t *get_screen_keydef(void);
extern screen_functions_t *get_screen_clock(void);
{ SCREEN_PLAYLIST_ID, "playlist", get_screen_playlist },
{ SCREEN_BROWSE_ID, "browse", get_screen_browse },
{ SCREEN_HELP_ID, "help", get_screen_help },
+#ifdef ENABLE_SEARCH_SCREEN
+ { SCREEN_SEARCH_ID, "search", get_screen_search },
+#endif
#ifdef ENABLE_KEYDEF_SCREEN
{ SCREEN_KEYDEF_ID, "keydef", get_screen_keydef },
#endif
colors_use(w, COLOR_TITLE_BOLD);
waddstr(w, get_key_names(CMD_SCREEN_FILE, FALSE));
colors_use(w, COLOR_TITLE);
- waddstr(w, _(":Browse"));
+ waddstr(w, _(":Browse "));
+#ifdef ENABLE_SEARCH_SCREEN
+ colors_use(w, COLOR_TITLE_BOLD);
+ waddstr(w, get_key_names(CMD_SCREEN_SEARCH, FALSE));
+ colors_use(w, COLOR_TITLE);
+ waddstr(w, _(":Search "));
+#endif
}
if( c->status->volume==MPD_STATUS_NO_VOLUME )
{
case CMD_SCREEN_HELP:
switch_screen_mode(SCREEN_HELP_ID, c);
break;
+ case CMD_SCREEN_SEARCH:
+ switch_screen_mode(SCREEN_SEARCH_ID, c);
+ break;
case CMD_SCREEN_KEYDEF:
switch_screen_mode(SCREEN_KEYDEF_ID, c);
break;
diff --git a/src/screen_browse.h b/src/screen_browse.h
--- /dev/null
+++ b/src/screen_browse.h
@@ -0,0 +1,30 @@
+
+void clear_highlights(mpdclient_filelist_t *filelist);
+void sync_highlights(mpdclient_t *c, mpdclient_filelist_t *filelist);
+void set_highlight(mpdclient_filelist_t *filelist,
+ mpd_Song *song,
+ int highlight);
+
+
+char *browse_lw_callback(int index, int *highlight, void *filelist);
+
+int browse_handle_select(screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist);
+int browse_handle_enter(screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist);
+
+#ifdef HAVE_GETMOUSE
+int browse_handle_mouse_event(screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist);
+#else
+#define browse_handle_mouse_event(s,c,lw,filelist) (0)
+#endif
+
+
+
diff --git a/src/screen_clock.c b/src/screen_clock.c
index d3d4925592a7aab55559842166736ad78b77e568..c996c192409d32db1a6d05606644f9acc0647848 100644 (file)
--- a/src/screen_clock.c
+++ b/src/screen_clock.c
#include "config.h"
-#ifdef ENABLE_CLOCK_SCREEN
+#ifndef DISABLE_CLOCK_SCREEN
#include "ncmpc.h"
#include "mpdclient.h"
#include "options.h"
diff --git a/src/screen_file.c b/src/screen_file.c
index d25229d1e1a41070179b1296ab584ca8dc374914..75095db9a1bfdbe2e5e9fb9253aba700f7b52a3b 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
#include "command.h"
#include "screen.h"
#include "screen_utils.h"
+#include "screen_browse.h"
#define USE_OLD_LAYOUT
/* clear the highlight flag for all items in the filelist */
-static void
+void
clear_highlights(mpdclient_filelist_t *filelist)
{
GList *list = g_list_first(filelist->list);
}
/* change the highlight flag for a song */
-static void
+void
set_highlight(mpdclient_filelist_t *filelist, mpd_Song *song, int highlight)
{
GList *list = g_list_first(filelist->list);
}
/* sync highlight flags with playlist */
-static void
+void
sync_highlights(mpdclient_t *c, mpdclient_filelist_t *filelist)
{
GList *list = g_list_first(filelist->list);
}
/* list_window callback */
-static char *
-list_callback(int index, int *highlight, void *data)
+char *
+browse_lw_callback(int index, int *highlight, void *data)
{
static char buf[BUFSIZE];
- /*mpdclient_t *c = (mpdclient_t *) data;*/
+ mpdclient_filelist_t *filelist = (mpdclient_filelist_t *) data;
filelist_entry_t *entry;
mpd_InfoEntity *entity;
return 0;
}
-
static int
-handle_enter(screen_t *screen, mpdclient_t *c)
+enqueue_and_play(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry)
+{
+ mpd_InfoEntity *entity = entry->entity;
+ mpd_Song *song = entity->info.song;
+
+ if(!( entry->flags & HIGHLIGHT ))
+ {
+ if( mpdclient_cmd_add(c, song) == 0 )
+ {
+ char buf[BUFSIZE];
+
+ entry->flags |= HIGHLIGHT;
+ strfsong(buf, BUFSIZE, LIST_FORMAT, song);
+ screen_status_printf(_("Adding \'%s\' to playlist\n"), buf);
+ mpdclient_update(c); /* get song id */
+ }
+ else
+ return -1;
+ }
+
+ int index = playlist_get_index_from_file(c, song->file);
+ mpdclient_cmd_play(c, index);
+ return 0;
+}
+
+int
+browse_handle_enter(screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist)
{
filelist_entry_t *entry;
mpd_InfoEntity *entity;
return change_directory(screen, c, entry);
else if( entity->type==MPD_INFO_ENTITY_TYPE_PLAYLISTFILE )
return load_playlist(screen, c, entry);
+ else if( entity->type==MPD_INFO_ENTITY_TYPE_SONG )
+ return enqueue_and_play(screen, c, entry);
return -1;
}
}
#endif
-static int
-handle_select(screen_t *screen, mpdclient_t *c)
+int
+browse_handle_select(screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist)
{
filelist_entry_t *entry;
{
lw->clear = 1;
- list_window_paint(lw, list_callback, (void *) c);
+ list_window_paint(lw, browse_lw_callback, (void *) filelist);
wnoutrefresh(lw->w);
}
filelist->updated = FALSE;
return;
}
- list_window_paint(lw, list_callback, (void *) c);
+ list_window_paint(lw, browse_lw_callback, (void *) filelist);
wnoutrefresh(lw->w);
}
#ifdef HAVE_GETMOUSE
-static int
-handle_mouse_event(screen_t *screen, mpdclient_t *c)
+int
+browse_handle_mouse_event(screen_t *screen,
+ mpdclient_t *c,
+ list_window_t *lw,
+ mpdclient_filelist_t *filelist)
{
int row;
int prev_selected = lw->selected;
if( bstate & BUTTON1_CLICKED )
{
if( prev_selected == lw->selected )
- handle_enter(screen, c);
+ browse_handle_enter(screen, c, lw, filelist);
}
else if( bstate & BUTTON3_CLICKED )
{
if( prev_selected == lw->selected )
- handle_select(screen, c);
+ browse_handle_select(screen, c, lw, filelist);
}
return 1;
}
-#else
-#define handle_mouse_event(s,c) (0)
-#endif
+#endif
static int
browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
switch(cmd)
{
case CMD_PLAY:
- handle_enter(screen, c);
+ browse_handle_enter(screen, c, lw, filelist);
return 1;
case CMD_SELECT:
- if( handle_select(screen, c) == 0 )
+ if( browse_handle_select(screen, c, lw, filelist) == 0 )
{
/* continue and select next item... */
cmd = CMD_LIST_NEXT;
case CMD_LIST_RFIND_NEXT:
return screen_find(screen, c,
lw, filelist->length,
- cmd, list_callback);
+ cmd, browse_lw_callback, (void *) filelist);
case CMD_MOUSE_EVENT:
- return handle_mouse_event(screen,c);
+ return browse_handle_mouse_event(screen,c,lw,filelist);
default:
break;
}
diff --git a/src/screen_help.c b/src/screen_help.c
index 73ccd674386478bf58750965fa4fb796d106d806..66acc3d87e53ae4a856af528eec02c2030df4596 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
{ 0, CMD_SCREEN_HELP, NULL },
{ 0, CMD_SCREEN_PLAY, NULL },
{ 0, CMD_SCREEN_FILE, NULL },
+#ifdef ENABLE_SEARCH_SCREEN
+ { 0, CMD_SCREEN_SEARCH, NULL },
+#endif
#ifdef ENABLE_CLOCK_SCREEN
{ 0, CMD_SCREEN_CLOCK, NULL },
#endif
{ 0, CMD_NONE, NULL },
{ 1, CMD_NONE, N_("Keys - Browse screen") },
{ 2, CMD_NONE, NULL },
- { 0, CMD_PLAY, N_("Enter directory") },
+ { 0, CMD_PLAY, N_("Enter directory/Select and play song") },
{ 0, CMD_SELECT, NULL },
- { 0, CMD_DELETE, NULL },
+ { 0, CMD_DELETE, N_("Delete playlist") },
{ 0, CMD_SCREEN_UPDATE, NULL },
+#ifdef ENABLE_SEARCH_SCREEN
+ { 0, CMD_NONE, NULL },
+ { 0, CMD_NONE, NULL },
+ { 1, CMD_NONE, N_("Keys - Search screen") },
+ { 2, CMD_NONE, NULL },
+ { 0, CMD_SCREEN_SEARCH, N_("Search") },
+ { 0, CMD_PLAY, N_("Select and play") },
+ { 0, CMD_SELECT, NULL },
+ { 0, CMD_SEARCH_MODE, NULL },
+#endif
+
{ 0, CMD_NONE, NULL },
{-1, CMD_NONE, NULL }
};
lw->selected = lw->start+lw->rows;
if( screen_find(screen, c,
lw, help_text_rows,
- cmd, list_callback) )
+ cmd, list_callback, NULL) )
{
/* center the row */
lw->start = lw->selected-(lw->rows/2);
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index 3451dd2ed9ac019c56281525d77e86ce17319568..081b6ec39bd52aef228175ad4e90e38230ec93e0 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
#include "config.h"
-#ifdef ENABLE_KEYDEF_SCREEN
+#ifndef DISABLE_KEYDEF_SCREEN
#include "ncmpc.h"
#include "mpdclient.h"
#include "options.h"
case CMD_LIST_RFIND_NEXT:
return screen_find(screen, c,
lw, length,
- cmd, list_callback);
+ cmd, list_callback, NULL);
default:
break;
diff --git a/src/screen_play.c b/src/screen_play.c
index 307471f2cbdd03840e6feb598503584061690647..a86ab01287601d923a3c4f6169e08ddddaa2c04d 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
case CMD_LIST_RFIND_NEXT:
return screen_find(screen, c,
lw, c->playlist.length,
- cmd, list_callback);
+ cmd, list_callback, (void *) c);
case CMD_MOUSE_EVENT:
return handle_mouse_event(screen,c);
default:
diff --git a/src/screen_search.c b/src/screen_search.c
index d82a049ef9ae5efebdc1ac04abcdaa06d0b924e6..95c3830c1f53c667bbfb1e8ff07fb3d9b3383fb0 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
+/*
+ * $Id$
+ *
+ * (c) 2004 by Kalle Wallin <kaw@linux.se>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <ncurses.h>
#include "config.h"
+#ifndef DISABLE_SEARCH_SCREEN
+#include "ncmpc.h"
+#include "options.h"
+#include "support.h"
#include "mpdclient.h"
+#include "strfsong.h"
#include "command.h"
#include "screen.h"
+#include "screen_utils.h"
+#include "screen_browse.h"
+
+#define SEARCH_TITLE 0
+#define SEARCH_ARTIST 1
+#define SEARCH_ALBUM 2
+#define SEARCH_FILE 3
+
+typedef struct {
+ int table;
+ char *label;
+} search_type_t;
+
+static search_type_t mode[] = {
+ { MPD_TABLE_TITLE, N_("Title") },
+ { MPD_TABLE_ARTIST, N_("Artist") },
+ { MPD_TABLE_ALBUM, N_("Album") },
+ { MPD_TABLE_FILENAME, N_("Filename") },
+ { 0, NULL }
+};
+
+static list_window_t *lw = NULL;
+static mpdclient_filelist_t *filelist = NULL;
+static gchar *pattern = NULL;
+
+/* the playlist have been updated -> fix highlights */
+static void
+playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
+{
+ if( filelist==NULL )
+ return;
+ D("screen_search.c> playlist_callback() [%d]\n", event);
+ switch(event)
+ {
+ case PLAYLIST_EVENT_CLEAR:
+ clear_highlights(filelist);
+ break;
+ default:
+ sync_highlights(c, filelist);
+ break;
+ }
+}
+
+/* sanity check search mode value */
+static void
+search_check_mode(void)
+{
+ int max = 0;
+
+ while( mode[max].label != NULL )
+ max++;
+ if( options.search_mode<0 )
+ options.search_mode = 0;
+ else if( options.search_mode>=max )
+ options.search_mode = max-1;
+}
+
+static void
+search_clear(screen_t *screen, mpdclient_t *c, gboolean clear_pattern)
+{
+ if( filelist )
+ {
+ mpdclient_remove_playlist_callback(c, playlist_changed_callback);
+ filelist = mpdclient_filelist_free(filelist);
+ }
+ if( clear_pattern && pattern )
+ {
+ g_free(pattern);
+ pattern = NULL;
+ }
+}
+
+static void
+search_new(screen_t *screen, mpdclient_t *c)
+{
+ search_clear(screen, c, TRUE);
+
+ pattern = screen_readln(screen->status_window.w,
+ _("Search: "),
+ NULL,
+ NULL,
+ NULL);
+
+ if( pattern && strcmp(pattern,"")==0 )
+ {
+ g_free(pattern);
+ pattern=NULL;
+ }
+
+ if( pattern==NULL )
+ {
+ list_window_reset(lw);
+ return;
+ }
+
+ filelist = mpdclient_filelist_search(c,
+ mode[options.search_mode].table,
+ pattern);
+ sync_highlights(c, filelist);
+ mpdclient_install_playlist_callback(c, playlist_changed_callback);
+ list_window_check_selected(lw, filelist->length);
+}
+
+static void
+init(WINDOW *w, int cols, int rows)
+{
+ lw = list_window_init(w, cols, rows);
+}
+
+static void
+quit(void)
+{
+ if( filelist )
+ filelist = mpdclient_filelist_free(filelist);
+ list_window_free(lw);
+ if( pattern )
+ g_free(pattern);
+ pattern = NULL;
+}
+
+static void
+open(screen_t *screen, mpdclient_t *c)
+{
+ if( pattern==NULL )
+ search_new(screen, c);
+ else
+ screen_status_printf(_("Press %s for a new search"),
+ get_key_names(CMD_SCREEN_SEARCH,0));
+ search_check_mode();
+}
+
+static void
+resize(int cols, int rows)
+{
+ lw->cols = cols;
+ lw->rows = rows;
+}
+
+static void
+close(void)
+{
+}
+
+static void
+paint(screen_t *screen, mpdclient_t *c)
+{
+ lw->clear = 1;
+
+ if( filelist )
+ {
+ list_window_paint(lw, browse_lw_callback, (void *) filelist);
+ filelist->updated = FALSE;
+ }
+ else
+ {
+ wmove(lw->w, 0, 0);
+ wclrtobot(lw->w);
+ }
+ wnoutrefresh(lw->w);
+}
+
+void
+update(screen_t *screen, mpdclient_t *c)
+{
+ if( filelist==NULL || filelist->updated )
+ {
+ paint(screen, c);
+ return;
+ }
+ list_window_paint(lw, browse_lw_callback, (void *) filelist);
+ wnoutrefresh(lw->w);
+}
+
+static char *
+get_title(char *str, size_t size)
+{
+ if( pattern )
+ g_snprintf(str, size,
+ _("Search: Results for %s [%s]"),
+ pattern,
+ _(mode[options.search_mode].label));
+ else
+ g_snprintf(str, size, _("Search: Press %s for a new search [%s]"),
+ get_key_names(CMD_SCREEN_SEARCH,0),
+ _(mode[options.search_mode].label));
+
+ return str;
+}
+
+static list_window_t *
+get_filelist_window()
+{
+ return lw;
+}
+
+static int
+search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
+{
+ switch(cmd)
+ {
+ case CMD_PLAY:
+ browse_handle_enter(screen, c, lw, filelist);
+ return 1;
+
+ case CMD_SELECT:
+ if( browse_handle_select(screen, c, lw, filelist) == 0 )
+ {
+ /* continue and select next item... */
+ cmd = CMD_LIST_NEXT;
+ }
+ return 1;
+
+ case CMD_SEARCH_MODE:
+ options.search_mode++;
+ if( mode[options.search_mode].label == NULL )
+ options.search_mode = 0;
+ screen_status_printf(_("Search mode: %s"),
+ _(mode[options.search_mode].label));
+ /* continue and update... */
+ case CMD_SCREEN_UPDATE:
+ if( pattern )
+ {
+ search_clear(screen, c, FALSE);
+ filelist = mpdclient_filelist_search(c,
+ mode[options.search_mode].table,
+ pattern);
+ sync_highlights(c, filelist);
+ }
+ return 1;
+
+ case CMD_SCREEN_SEARCH:
+ search_new(screen, c);
+ return 1;
+
+ case CMD_CLEAR:
+ search_clear(screen, c, TRUE);
+ list_window_reset(lw);
+ return 1;
+
+ case CMD_LIST_FIND:
+ case CMD_LIST_RFIND:
+ case CMD_LIST_FIND_NEXT:
+ case CMD_LIST_RFIND_NEXT:
+ if( filelist )
+ return screen_find(screen, c,
+ lw, filelist->length,
+ cmd, browse_lw_callback, (void *) filelist);
+ case CMD_MOUSE_EVENT:
+ return browse_handle_mouse_event(screen,c,lw,filelist);
+
+ default:
+ if( filelist )
+ return list_window_cmd(lw, filelist->length, cmd);
+ }
+
+ return 0;
+}
+
+screen_functions_t *
+get_screen_search(void)
+{
+ static screen_functions_t functions;
+
+ memset(&functions, 0, sizeof(screen_functions_t));
+ functions.init = init;
+ functions.exit = quit;
+ functions.open = open;
+ functions.close = close;
+ functions.resize = resize;
+ functions.paint = paint;
+ functions.update = update;
+ functions.cmd = search_cmd;
+ functions.get_lw = get_filelist_window;
+ functions.get_title = get_title;
+
+ return &functions;
+}
+
+#endif /* ENABLE_SEARCH_SCREEN */
diff --git a/src/screen_utils.c b/src/screen_utils.c
index baa371be1aec79ae12c1ece3bd4691b1cb995869..09ce857873a874f02b17e4c8bbba4a896a38fd6f 100644 (file)
--- a/src/screen_utils.c
+++ b/src/screen_utils.c
list_window_t *lw,
int rows,
command_t findcmd,
- list_window_callback_fn_t callback_fn)
+ list_window_callback_fn_t callback_fn,
+ void *callback_data)
{
int reversed = 0;
int retval = 0;
if( reversed )
retval = list_window_rfind(lw,
callback_fn,
- c,
+ callback_data,
screen->findbuf,
options.find_wrap,
rows);
else
retval = list_window_find(lw,
callback_fn,
- c,
+ callback_data,
screen->findbuf,
options.find_wrap);
if( retval == 0 )
diff --git a/src/screen_utils.h b/src/screen_utils.h
index 56e44d533d882ea095b73df3924d785247d2ae65..d68867a46987538963cfd47c8dbe2ab540c3dbdd 100644 (file)
--- a/src/screen_utils.h
+++ b/src/screen_utils.h
list_window_t *lw,
int rows,
command_t findcmd,
- list_window_callback_fn_t callback_fn);
+ list_window_callback_fn_t callback_fn,
+ void *callback_data);
void screen_display_completion_list(screen_t *screen, GList *list);