From c7ebe772c7bda23a8b39d1964744279760d7f26c Mon Sep 17 00:00:00 2001 From: unK Date: Tue, 26 Aug 2008 01:31:08 +0200 Subject: [PATCH] more common way of handling example config files (like in ncmpc) + add a few more functions to libmpdclient implementation --- Makefile.am | 5 ++++- NEWS | 34 ++++++++++++++++++++++++++++++++++ configure.in | 4 ++-- {examples => doc}/ncmpcpp_keys | 0 {examples => doc}/ncmpcpprc | 0 src/mpdpp.cpp | 28 +++++++++++++++++++++++++++- src/mpdpp.h | 5 ++++- src/ncmpcpp.cpp | 8 ++++---- 8 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 NEWS rename {examples => doc}/ncmpcpp_keys (100%) rename {examples => doc}/ncmpcpprc (100%) diff --git a/Makefile.am b/Makefile.am index 02520f20..c2d703b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,4 +2,7 @@ # have all needed files, that a GNU package needs AUTOMAKE_OPTIONS = foreign 1.4 -SUBDIRS = src +SUBDIRS = src doc +docdir = $(prefix)/share/doc/$(PACKAGE) +doc_DATA = AUTHORS NEWS +EXTRA_DIST = COPYING $(doc_DATA) diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..7d4a2f37 --- /dev/null +++ b/NEWS @@ -0,0 +1,34 @@ +ncmpcpp-0.2 + + + libmpd dependency dropped + + pkgconfig is not needed anymore + + ncmpcpp now shows more info if it cannot connect to mpd + + proper handling for mpd password added + + if ncmpcpp lose connection to mpd it'll try to reconnect + + playlist status added + + new screen - lyrics + + switching between playlist and browser with tab key added + + alternate movement keys added (j and k keys) + + auto center mode added + + new option - crossfade can be set to any value now (X key) + + new option - going to parent directory in browser using backspace key + + issue with backspace key fixed + + sorting items in browser is case insensitive now + + many fixes and improvements + + +ncmpcpp-0.1.2 + + + parts of interface are hideable now + + new screen - media library + + new option - crop (it removes all songs from playlist except the playing one) + + many fixes and optimizations + + +ncmpcpp-0.1.1 + + + add example configuration file + + configure.in now works as expected + + taglib dependency is optional now + + more customizable options + diff --git a/configure.in b/configure.in index 330e0b26..5d55d7fb 100644 --- a/configure.in +++ b/configure.in @@ -62,5 +62,5 @@ if test "$taglib" = "yes" ; then fi fi - -AC_OUTPUT(Makefile src/Makefile) +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile]) +AC_OUTPUT diff --git a/examples/ncmpcpp_keys b/doc/ncmpcpp_keys similarity index 100% rename from examples/ncmpcpp_keys rename to doc/ncmpcpp_keys diff --git a/examples/ncmpcpprc b/doc/ncmpcpprc similarity index 100% rename from examples/ncmpcpprc rename to doc/ncmpcpprc diff --git a/src/mpdpp.cpp b/src/mpdpp.cpp index d6fdab99..d1c2a758 100644 --- a/src/mpdpp.cpp +++ b/src/mpdpp.cpp @@ -533,6 +533,15 @@ void MPDConnection::StartSearch(bool exact_match) const mpd_startSearch(itsConnection, exact_match); } +void MPDConnection::StartFieldSearch(mpd_TagItems item) +{ + if (isConnected) + { + itsSearchedField = item; + mpd_startFieldSearch(itsConnection, item); + } +} + void MPDConnection::AddSearch(mpd_TagItems item, const string &str) const { if (isConnected) @@ -558,6 +567,23 @@ void MPDConnection::CommitSearch(SongList &v) const } } +void MPDConnection::CommitSearch(TagList &v) const +{ + if (isConnected) + { + mpd_commitSearch(itsConnection); + char *tag = NULL; + while ((tag = mpd_getNextTag(itsConnection, itsSearchedField)) != NULL) + { + string s_tag = tag; + if (v.empty() || v.back() != s_tag) + v.push_back(s_tag); + delete [] tag; + } + mpd_finishCommand(itsConnection); + } +} + void MPDConnection::GetDirectory(const string &path, ItemList &v) const { if (isConnected) @@ -612,7 +638,7 @@ int MPDConnection::CheckForErrors() { int errid = 0; if (itsConnection->error) - { + { if (itsConnection->error == MPD_ERROR_ACK) { // this is to avoid setting too small max size as we check it before fetching current status diff --git a/src/mpdpp.h b/src/mpdpp.h index b68831ea..4579a0fb 100644 --- a/src/mpdpp.h +++ b/src/mpdpp.h @@ -140,8 +140,10 @@ class MPDConnection bool SavePlaylist(const string &) const; void StartSearch(bool) const; + void StartFieldSearch(mpd_TagItems); void AddSearch(mpd_TagItems, const string &) const; - void CommitSearch(SongList &v) const; + void CommitSearch(SongList &) const; + void CommitSearch(TagList &) const; void GetArtists(TagList &) const; void GetAlbums(string, TagList &) const; @@ -173,6 +175,7 @@ class MPDConnection ErrorHandler itsErrorHandler; void *itsErrorHandlerUserdata; + mpd_TagItems itsSearchedField; std::vector itsQueue; }; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 4603c64a..acaf1836 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1739,7 +1739,7 @@ int main(int argc, char *argv[]) { found_pos = 0; vFoundPositions.clear(); - + if (mLibArtists->Empty()) { Mpd->GetArtists(vArtists); @@ -1747,13 +1747,13 @@ int main(int argc, char *argv[]) for (TagList::const_iterator it = vArtists.begin(); it != vArtists.end(); it++) mLibArtists->AddOption(*it); } - + mLibArtists->HighlightColor(Config.library_active_column_color); mLibAlbums->HighlightColor(Config.main_highlight_color); mLibSongs->HighlightColor(Config.main_highlight_color); - + wCurrent->Hide(); - + REFRESH_MEDIA_LIBRARY_SCREEN; wCurrent = mLibArtists;