Projects
Multimedia
ncmpc
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 11
View file
ncmpc.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Mon Jan 13 20:20:20 UTC 2020 - olaf@aepfle.de + +- Update to version 0.36 + +------------------------------------------------------------------- Thu Oct 11 07:38:47 UTC 2018 - aloisio@gmx.com - Update to version 0.32
View file
ncmpc.spec
Changed
@@ -17,7 +17,7 @@ Name: ncmpc -Version: 0.32 +Version: 0.36 Release: 0 Summary: Curses Client for the Music Player Daemon License: GPL-2.0-or-later @@ -25,14 +25,14 @@ URL: http://mpd.wikia.com/wiki/Client:Ncmpc Source: https://www.musicpd.org/download/ncmpc/0/ncmpc-%{version}.tar.xz Patch3: ncmpc-fix_meson_docdir.patch -BuildRequires: gcc-c++ >= 7 +BuildRequires: gcc-c++ BuildRequires: libboost_iostreams-devel >= 1.62 BuildRequires: ncurses-devel BuildRequires: pkgconfig BuildRequires: pkgconfig(glib-2.0) >= 2.30 BuildRequires: pkgconfig(libmpdclient) >= 2.9 -BuildRequires: python-Sphinx -BuildRequires: meson +BuildRequires: python3-Sphinx +BuildRequires: meson >= 0.47 BuildRequires: ninja %description @@ -42,11 +42,11 @@ %lang_package %prep -%setup -q -%patch3 +%autosetup -p1 %build %meson \ + -Dlirc=disabled \ -Dhtml_manual=false %meson_build
View file
ncmpc-fix_meson_docdir.patch
Changed
@@ -1,8 +1,6 @@ -Index: meson.build -=================================================================== ---- meson.build.orig -+++ meson.build -@@ -384,8 +384,8 @@ ncmpc = executable('ncmpc', +--- a/meson.build ++++ b/meson.build +@@ -376,8 +376,8 @@ ncmpc = executable('ncmpc', configure_file(output: 'config.h', configuration: conf) @@ -13,17 +11,3 @@ 'doc/config.sample', 'doc/keys.sample', 'doc/ncmpc.lirc', -Index: doc/meson.build -=================================================================== ---- doc/meson.build.orig -+++ doc/meson.build -@@ -20,7 +20,8 @@ if sphinx.found() - command: [sphinx, '-q', '-b', 'man', '-d', '@OUTDIR@/man_doctrees', meson.current_source_dir(), '@OUTPUT@/man1'], - build_by_default: true, - install: true, -- install_dir: get_option('mandir'), -+ install_dir: get_option('datadir'), - ) - endif - endif -+
View file
ncmpc-0.32.tar.xz/src/AlbumListPage.cxx
Deleted
@@ -1,233 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "AlbumListPage.hxx" -#include "screen_status.hxx" -#include "screen_find.hxx" -#include "FileListPage.hxx" -#include "Command.hxx" -#include "i18n.h" -#include "charset.hxx" -#include "mpdclient.hxx" -#include "util/StringUTF8.hxx" - -#include <algorithm> - -#include <assert.h> -#include <string.h> - -#define BUFSIZE 1024 - -gcc_pure -static bool -CompareUTF8(const std::string &a, const std::string &b) -{ - return CollateUTF8(a.c_str(), b.c_str()) < 0; -} - -const char * -AlbumListPage::GetListItemText(char *buffer, size_t size, - unsigned idx) const noexcept -{ - if (idx == 0) - return ".."; - else if (idx == album_list.size() + 1) - return _("All tracks"); - - --idx; - - assert(idx < album_list.size()); - - return utf8_to_locale(album_list[idx].c_str(), buffer, size); -} - -static void -recv_tag_values(struct mpd_connection *connection, enum mpd_tag_type tag, - std::vector<std::string> &list) -{ - struct mpd_pair *pair; - - while ((pair = mpd_recv_pair_tag(connection, tag)) != nullptr) { - list.emplace_back(pair->value); - mpd_return_pair(connection, pair); - } -} - -void -AlbumListPage::LoadAlbumList(struct mpdclient &c) -{ - auto *connection = c.GetConnection(); - - album_list.clear(); - - if (connection != nullptr) { - mpd_search_db_tags(connection, MPD_TAG_ALBUM); - mpd_search_add_tag_constraint(connection, - MPD_OPERATOR_DEFAULT, - MPD_TAG_ARTIST, - artist.c_str()); - mpd_search_commit(connection); - - recv_tag_values(connection, MPD_TAG_ALBUM, album_list); - - c.FinishCommand(); - } - - /* sort list */ - std::sort(album_list.begin(), album_list.end(), CompareUTF8); - lw.SetLength(album_list.size() + 2); -} - -void -AlbumListPage::Reload(struct mpdclient &c) -{ - LoadAlbumList(c); -} - -/** - * Paint one item in the album list. There are two virtual items - * inserted: at the beginning, there's the special item ".." to go to - * the parent directory, and at the end, there's the item "All tracks" - * to view the tracks of all albums. - */ -void -AlbumListPage::PaintListItem(WINDOW *w, unsigned i, - gcc_unused unsigned y, unsigned width, - bool selected) const noexcept -{ - if (i == 0) - screen_browser_paint_directory(w, width, selected, ".."); - else if (i == album_list.size() + 1) - screen_browser_paint_directory(w, width, selected, - _("All tracks")); - else - screen_browser_paint_directory(w, width, selected, - Utf8ToLocale(album_list[i - 1].c_str()).c_str()); -} - -void -AlbumListPage::Paint() const noexcept -{ - lw.Paint(*this); -} - -const char * -AlbumListPage::GetTitle(char *str, size_t size) const noexcept -{ - if (artist.empty()) - return _("Albums"); - - snprintf(str, size, _("Albums of artist: %s"), - Utf8ToLocale(artist.c_str()).c_str()); - return str; -} - -void -AlbumListPage::Update(struct mpdclient &c, unsigned events) noexcept -{ - if (events & MPD_IDLE_DATABASE) { - /* the db has changed -> update the list */ - Reload(c); - SetDirty(); - } -} - -/* add_query - Add all songs satisfying specified criteria. - _artist is actually only used in the ALBUM case to distinguish albums with - the same name from different artists. */ -static void -add_query(struct mpdclient *c, enum mpd_tag_type table, const char *_filter, - const char *_artist) -{ - assert(_filter != nullptr); - - auto *connection = c->GetConnection(); - if (connection == nullptr) - return; - - screen_status_printf(_("Adding \'%s\' to queue"), - Utf8ToLocale(_filter).c_str()); - - mpd_search_add_db_songs(connection, true); - mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, - table, _filter); - if (table == MPD_TAG_ALBUM) - mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, - MPD_TAG_ARTIST, _artist); - mpd_search_commit(connection); - c->FinishCommand(); -} - -bool -AlbumListPage::OnCommand(struct mpdclient &c, Command cmd) -{ - switch(cmd) { - const char *selected; - - case Command::PLAY: - if (lw.selected == 0 && parent != nullptr) - /* handle ".." */ - return parent->OnCommand(c, Command::GO_PARENT_DIRECTORY); - - break; - - case Command::SELECT: - case Command::ADD: - for (const unsigned i : lw.GetRange()) { - if(i == album_list.size() + 1) - add_query(&c, MPD_TAG_ARTIST, artist.c_str(), - nullptr); - else if (i > 0) { - selected = album_list[lw.selected - 1].c_str(); - add_query(&c, MPD_TAG_ALBUM, selected, - artist.c_str());
View file
ncmpc-0.32.tar.xz/src/AlbumListPage.hxx
Deleted
@@ -1,83 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef NCMPC_ALBUM_LIST_PAGE_HXX -#define NCMPC_ALBUM_LIST_PAGE_HXX - -#include "ListPage.hxx" -#include "ListRenderer.hxx" -#include "ListText.hxx" - -#include <vector> -#include <string> - -class ScreenManager; - -class AlbumListPage final : public ListPage, ListRenderer, ListText { - ScreenManager &screen; - Page *const parent; - std::vector<std::string> album_list; - std::string artist; - -public: - AlbumListPage(ScreenManager &_screen, Page *_parent, - WINDOW *_w, Size size) noexcept - :ListPage(_w, size), screen(_screen), parent(_parent) {} - - template<typename A> - void SetArtist(A &&_artist) { - artist = std::forward<A>(_artist); - AddPendingEvents(~0u); - } - - const std::string &GetArtist() const { - return artist; - } - - bool IsShowAll() const { - return lw.selected == album_list.size() + 1; - } - - const char *GetSelectedValue() const { - return lw.selected >= 1 && lw.selected <= album_list.size() - ? album_list[lw.selected - 1].c_str() - : nullptr; - } - -private: - void LoadAlbumList(struct mpdclient &c); - void Reload(struct mpdclient &c); - -public: - /* virtual methods from class Page */ - void Paint() const noexcept override; - void Update(struct mpdclient &c, unsigned events) noexcept override; - bool OnCommand(struct mpdclient &c, Command cmd) override; - const char *GetTitle(char *s, size_t size) const noexcept override; - - /* virtual methods from class ListRenderer */ - void PaintListItem(WINDOW *w, unsigned i, unsigned y, unsigned width, - bool selected) const noexcept override; - - /* virtual methods from class ListText */ - const char *GetListItemText(char *buffer, size_t size, - unsigned i) const noexcept override; -}; - -#endif
View file
ncmpc-0.32.tar.xz/src/ArtistListPage.cxx
Deleted
@@ -1,198 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "ArtistListPage.hxx" -#include "screen_status.hxx" -#include "screen_find.hxx" -#include "FileListPage.hxx" -#include "Command.hxx" -#include "i18n.h" -#include "charset.hxx" -#include "mpdclient.hxx" -#include "util/StringUTF8.hxx" - -#include <algorithm> - -#include <assert.h> -#include <string.h> - -#define BUFSIZE 1024 - -gcc_pure -static bool -CompareUTF8(const std::string &a, const std::string &b) -{ - return CollateUTF8(a.c_str(), b.c_str()) < 0; -} - -const char * -ArtistListPage::GetListItemText(char *buffer, size_t size, - unsigned idx) const noexcept -{ - assert(idx < artist_list.size()); - - return utf8_to_locale(artist_list[idx].c_str(), buffer, size); -} - -static void -recv_tag_values(struct mpd_connection *connection, enum mpd_tag_type tag, - std::vector<std::string> &list) -{ - struct mpd_pair *pair; - - while ((pair = mpd_recv_pair_tag(connection, tag)) != nullptr) { - list.emplace_back(pair->value); - mpd_return_pair(connection, pair); - } -} - -void -ArtistListPage::LoadArtistList(struct mpdclient &c) -{ - auto *connection = c.GetConnection(); - - artist_list.clear(); - - if (connection != nullptr) { - mpd_search_db_tags(connection, MPD_TAG_ARTIST); - mpd_search_commit(connection); - recv_tag_values(connection, MPD_TAG_ARTIST, artist_list); - - c.FinishCommand(); - } - - /* sort list */ - std::sort(artist_list.begin(), artist_list.end(), CompareUTF8); - lw.SetLength(artist_list.size()); -} - -void -ArtistListPage::Reload(struct mpdclient &c) -{ - LoadArtistList(c); -} - -void -ArtistListPage::PaintListItem(WINDOW *w, unsigned i, - gcc_unused unsigned y, unsigned width, - bool selected) const noexcept -{ - screen_browser_paint_directory(w, width, selected, - Utf8ToLocale(artist_list[i].c_str()).c_str()); -} - -void -ArtistListPage::Paint() const noexcept -{ - lw.Paint(*this); -} - -const char * -ArtistListPage::GetTitle(char *, size_t) const noexcept -{ - return _("All artists"); -} - -void -ArtistListPage::Update(struct mpdclient &c, unsigned events) noexcept -{ - if (events & MPD_IDLE_DATABASE) { - /* the db has changed -> update the list */ - Reload(c); - SetDirty(); - } -} - -/* add_query - Add all songs satisfying specified criteria */ -static void -add_query(struct mpdclient *c, enum mpd_tag_type table, const char *_filter) -{ - assert(_filter != nullptr); - - auto *connection = c->GetConnection(); - if (connection == nullptr) - return; - - screen_status_printf(_("Adding \'%s\' to queue"), - Utf8ToLocale(_filter).c_str()); - - mpd_search_add_db_songs(connection, true); - mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, - table, _filter); - mpd_search_commit(connection); - c->FinishCommand(); -} - -inline bool -ArtistListPage::OnListCommand(Command cmd) -{ - if (lw.HandleCommand(cmd)) { - SetDirty(); - return true; - } - - return false; -} - -bool -ArtistListPage::OnCommand(struct mpdclient &c, Command cmd) -{ - switch(cmd) { - const char *selected; - - case Command::SELECT: - case Command::ADD: - if (lw.selected >= artist_list.size()) - return true; - - for (const unsigned i : lw.GetRange()) { - selected = artist_list[i].c_str(); - add_query(&c, MPD_TAG_ARTIST, selected); - cmd = Command::LIST_NEXT; /* continue and select next item... */ - } - - break; - - /* continue and update... */ - case Command::SCREEN_UPDATE: - Reload(c); - return false; - - case Command::LIST_FIND: - case Command::LIST_RFIND: - case Command::LIST_FIND_NEXT: - case Command::LIST_RFIND_NEXT: - screen_find(screen, lw, cmd, *this); - SetDirty(); - return true; - - case Command::LIST_JUMP: - screen_jump(screen, lw, *this, *this); - SetDirty(); - return true; - - default: - break; - } - - if (OnListCommand(cmd)) - return true; - - return false; -}
View file
ncmpc-0.32.tar.xz/src/ArtistListPage.hxx
Deleted
@@ -1,68 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef NCMPC_ARTIST_LIST_PAGE_HXX -#define NCMPC_ARTIST_LIST_PAGE_HXX - -#include "ListPage.hxx" -#include "ListRenderer.hxx" -#include "ListText.hxx" - -#include <vector> -#include <string> - -class ScreenManager; - -class ArtistListPage final : public ListPage, ListRenderer, ListText { - ScreenManager &screen; - std::vector<std::string> artist_list; - -public: - ArtistListPage(ScreenManager &_screen, WINDOW *_w, Size _size) - :ListPage(_w, _size), screen(_screen) {} - - const char *GetSelectedValue() const { - return lw.selected < artist_list.size() - ? artist_list[lw.selected].c_str() - : nullptr; - } - -private: - void LoadArtistList(struct mpdclient &c); - void Reload(struct mpdclient &c); - - bool OnListCommand(Command cmd); - -public: - /* virtual methods from class Page */ - void Paint() const noexcept override; - void Update(struct mpdclient &c, unsigned events) noexcept override; - bool OnCommand(struct mpdclient &c, Command cmd) override; - const char *GetTitle(char *s, size_t size) const noexcept override; - - /* virtual methods from class ListRenderer */ - void PaintListItem(WINDOW *w, unsigned i, unsigned y, unsigned width, - bool selected) const noexcept override; - - /* virtual methods from class ListText */ - const char *GetListItemText(char *buffer, size_t size, - unsigned i) const noexcept override; -}; - -#endif
View file
ncmpc-0.32.tar.xz/src/conf.cxx
Deleted
@@ -1,857 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "conf.hxx" -#include "config.h" -#include "Bindings.hxx" -#include "GlobalBindings.hxx" -#include "defaults.hxx" -#include "i18n.h" -#include "Command.hxx" -#include "Styles.hxx" -#include "BasicColors.hxx" -#include "CustomColors.hxx" -#include "screen_list.hxx" -#include "Options.hxx" -#include "io/Path.hxx" -#include "util/CharUtil.hxx" -#include "util/ScopeExit.hxx" -#include "util/StringStrip.hxx" - -#include <assert.h> -#include <sys/stat.h> -#include <ctype.h> -#include <stdio.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> - -#ifdef _WIN32 -#include <glib.h> -#endif - -#define MAX_LINE_LENGTH 1024 -#define COMMENT_TOKEN '#' - -/* configuration field names */ -#define CONF_ENABLE_COLORS "enable-colors" -#define CONF_SCROLL_OFFSET "scroll-offset" -#define CONF_AUTO_CENTER "auto-center" -#define CONF_WIDE_CURSOR "wide-cursor" -#define CONF_KEY_DEFINITION "key" -#define CONF_COLOR "color" -#define CONF_COLOR_DEFINITION "colordef" -#define CONF_LIST_FORMAT "list-format" -#define CONF_SEARCH_FORMAT "search-format" -#define CONF_STATUS_FORMAT "status-format" -#define CONF_XTERM_TITLE_FORMAT "xterm-title-format" -#define CONF_LIST_WRAP "wrap-around" -#define CONF_FIND_WRAP "find-wrap" -#define CONF_FIND_SHOW_LAST "find-show-last" -#define CONF_AUDIBLE_BELL "audible-bell" -#define CONF_VISIBLE_BELL "visible-bell" -#define CONF_BELL_ON_WRAP "bell-on-wrap" -#define CONF_STATUS_MESSAGE_TIME "status-message-time" -#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" -#define CONF_HIDE_CURSOR "hide-cursor" -#define CONF_SEEK_TIME "seek-time" -#define CONF_SCREEN_LIST "screen-list" -#define CONF_TIMEDISPLAY_TYPE "timedisplay-type" -#define CONF_HOST "host" -#define CONF_PORT "port" -#define CONF_PASSWORD "password" -#define CONF_TIMEOUT "timeout" -#define CONF_LYRICS_TIMEOUT "lyrics-timeout" -#define CONF_SCROLL "scroll" -#define CONF_SCROLL_SEP "scroll-sep" -#define CONF_VISIBLE_BITRATE "visible-bitrate" -#define CONF_HARDWARE_CURSOR "hardware-cursor" -#define CONF_WELCOME_SCREEN_LIST "welcome-screen-list" -#define CONF_DISPLAY_TIME "display-time" -#define CONF_JUMP_PREFIX_ONLY "jump-prefix-only" -#define CONF_LYRICS_AUTOSAVE "lyrics-autosave" -#define CONF_LYRICS_SHOW_PLUGIN "lyrics-show-plugin" -#define CONF_TEXT_EDITOR "text-editor" -#define CONF_TEXT_EDITOR_ASK "text-editor-ask" -#define CONF_CHAT_PREFIX "chat-prefix" -#define CONF_SECOND_COLUMN "second-column" - -#ifdef _WIN32 -#define CONFIG_FILENAME "ncmpc.conf" -#define KEYS_FILENAME "keys.conf" -#else -#define CONFIG_FILENAME "config" -#define KEYS_FILENAME "keys" -#endif - -static bool -str2bool(char *str) -{ - return strcasecmp(str, "yes") == 0 || strcasecmp(str, "true") == 0 || - strcasecmp(str, "on") == 0 || strcasecmp(str, "1") == 0; -} - -static void -print_error(const char *msg, const char *input) -{ - fprintf(stderr, "%s: %s ('%s')\n", - /* To translators: prefix for error messages */ - _("Error"), msg, input); -} - -gcc_const -static bool -is_word_char(char ch) -{ - return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_'; -} - -static char * -after_unquoted_word(char *p) -{ - if (!is_word_char(*p)) { - print_error(_("Word expected"), p); - return nullptr; - } - - ++p; - - while (is_word_char(*p)) - ++p; - - return p; -} - -static int -parse_key_value(char *str, char **end) -{ - if (*str == '\'') { - if (str[1] == '\'' || str[2] != '\'') { - print_error(_("Malformed hotkey definition"), str); - return -1; - } - - *end = str + 3; - return str[1]; - } else { - long value = strtol(str, end, 0); - if (*end == str) { - print_error(_("Malformed hotkey definition"), str); - return -1; - } - - return (int)value; - } -} - -static bool -parse_key_definition(char *str) -{ - /* get the command name */ - char *eq = strchr(str, '='); - if (eq == nullptr) { - /* the hotkey configuration line is incomplete */ - print_error(_("Incomplete hotkey configuration"), str); - return false; - } - - char *command_name = str; - str = StripLeft(eq + 1); - - *eq = '\0'; - StripRight(command_name); - const auto cmd = get_key_command_from_name(command_name); - if(cmd == Command::NONE) { - /* the hotkey configuration contains an unknown - command */ - print_error(_("Unknown command"), command_name); - return false; - } - - /* parse key values */ - size_t i = 0; - int key = 0; - char *p = str; - - std::array<int, MAX_COMMAND_KEYS> keys{0}; - while (i < MAX_COMMAND_KEYS && *p != 0 && - (key = parse_key_value(p, &p)) >= 0) { - keys[i++] = key; - while (*p==',' || *p==' ' || *p=='\t')
View file
ncmpc-0.32.tar.xz/src/conf.hxx
Deleted
@@ -1,37 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <string> - -std::string -MakeKeysPath(); - -#ifndef _WIN32 -std::string -GetHomeConfigPath(); -#endif - -std::string -GetUserConfigPath(); - -std::string -GetSystemConfigPath(); - -void read_configuration(); -
View file
ncmpc-0.32.tar.xz/src/keyboard.cxx
Deleted
@@ -1,107 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" -#include "keyboard.hxx" -#include "Command.hxx" -#include "Bindings.hxx" -#include "GlobalBindings.hxx" -#include "ncmpc.hxx" -#include "Point.hxx" -#include "util/Compiler.h" - -static bool -ignore_key(int key) -{ - return key == ERR || key == '\0'; -} - -gcc_pure -static Command -translate_key(int key) -{ - return GetGlobalKeyBindings().FindKey(key); -} - -void -UserInput::OnReadable(const boost::system::error_code &error) -{ - if (error) { - d.get_io_service().stop(); - return; - } - - int key = wgetch(&w); - if (ignore_key(key)) { - AsyncWait(); - return; - } - -#ifdef HAVE_GETMOUSE - if (key == KEY_MOUSE) { - MEVENT event; - - /* retrieve the mouse event from curses */ -#ifdef PDCURSES - nc_getmouse(&event); -#else - getmouse(&event); -#endif - - begin_input_event(); - do_mouse_event({event.x, event.y}, event.bstate); - end_input_event(); - - AsyncWait(); - return; - } -#endif - - Command cmd = translate_key(key); - if (cmd == Command::NONE) { - AsyncWait(); - return; - } - - begin_input_event(); - - if (!do_input_event(d.get_io_service(), cmd)) - return; - - end_input_event(); - AsyncWait(); -} - -UserInput::UserInput(boost::asio::io_service &io_service, WINDOW &_w) - :d(io_service), w(_w) -{ - d.assign(STDIN_FILENO); - AsyncWait(); -} - -void -keyboard_unread(boost::asio::io_service &io_service, int key) -{ - if (ignore_key(key)) - return; - - Command cmd = translate_key(key); - if (cmd != Command::NONE) - do_input_event(io_service, cmd); -}
View file
ncmpc-0.32.tar.xz/src/keyboard.hxx
Deleted
@@ -1,49 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef KEYBOARD_H -#define KEYBOARD_H - -#include "AsioServiceFwd.hxx" - -#include <boost/asio/posix/stream_descriptor.hpp> - -#include <curses.h> - -class UserInput { - boost::asio::posix::stream_descriptor d; - WINDOW &w; - -public: - UserInput(boost::asio::io_service &io_service, WINDOW &_w); - -private: - void AsyncWait() { - d.async_read_some(boost::asio::null_buffers(), - std::bind(&UserInput::OnReadable, this, - std::placeholders::_1)); - } - - void OnReadable(const boost::system::error_code &error); -}; - -void -keyboard_unread(boost::asio::io_service &io_service, int key); - -#endif
View file
ncmpc-0.32.tar.xz/src/screen_artist.cxx
Deleted
@@ -1,304 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "screen_artist.hxx" -#include "ArtistListPage.hxx" -#include "AlbumListPage.hxx" -#include "PageMeta.hxx" -#include "screen_status.hxx" -#include "screen_find.hxx" -#include "FileListPage.hxx" -#include "Command.hxx" -#include "screen.hxx" -#include "ProxyPage.hxx" -#include "i18n.h" -#include "charset.hxx" -#include "mpdclient.hxx" -#include "filelist.hxx" -#include "Options.hxx" -#include "util/NulledString.hxx" - -#include <vector> -#include <string> -#include <algorithm> - -#include <assert.h> -#include <string.h> - -class SongListPage final : public FileListPage { - Page *const parent; - - std::string artist; - - /** - * The current album filter. If IsNulled() is true, then the - * album filter is not used (i.e. all songs from all albums - * are displayed). - */ - std::string album; - -public: - SongListPage(ScreenManager &_screen, Page *_parent, - WINDOW *_w, Size size) noexcept - :FileListPage(_screen, _w, size, - options.list_format.c_str()), - parent(_parent) {} - - template<typename A> - void SetArtist(A &&_artist) { - artist = std::forward<A>(_artist); - AddPendingEvents(~0u); - } - - const std::string &GetArtist() { - return artist; - } - - template<typename A> - void SetAlbum(A &&_album) { - album = std::forward<A>(_album); - AddPendingEvents(~0u); - } - - const std::string &GetAlbum() { - return album; - } - - void LoadSongList(struct mpdclient &c); - - /* virtual methods from class Page */ - void Update(struct mpdclient &c, unsigned events) noexcept override; - bool OnCommand(struct mpdclient &c, Command cmd) override; - const char *GetTitle(char *s, size_t size) const noexcept override; -}; - -void -SongListPage::Update(struct mpdclient &c, unsigned events) noexcept -{ - if (events & MPD_IDLE_DATABASE) { - LoadSongList(c); - } -} - -class ArtistBrowserPage final : public ProxyPage { - ArtistListPage artist_list_page; - AlbumListPage album_list_page; - SongListPage song_list_page; - -public: - ArtistBrowserPage(ScreenManager &_screen, WINDOW *_w, - Size size) - :ProxyPage(_w), - artist_list_page(_screen, _w, size), - album_list_page(_screen, this, _w, size), - song_list_page(_screen, this, _w, size) {} - -private: - void OpenArtistList(struct mpdclient &c); - void OpenAlbumList(struct mpdclient &c, std::string _artist); - void OpenSongList(struct mpdclient &c, std::string _artist, - std::string _album); - -public: - /* virtual methods from class Page */ - void OnOpen(struct mpdclient &c) noexcept override; - void Update(struct mpdclient &c, unsigned events) noexcept override; - bool OnCommand(struct mpdclient &c, Command cmd) override; -}; - -void -SongListPage::LoadSongList(struct mpdclient &c) -{ - auto *connection = c.GetConnection(); - - delete filelist; - - filelist = new FileList(); - /* add a dummy entry for ".." */ - filelist->emplace_back(nullptr); - - if (connection != nullptr) { - mpd_search_db_songs(connection, true); - mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, - MPD_TAG_ARTIST, artist.c_str()); - if (!IsNulled(album)) - mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, - MPD_TAG_ALBUM, album.c_str()); - mpd_search_commit(connection); - - filelist->Receive(*connection); - - c.FinishCommand(); - } - - /* fix highlights */ - screen_browser_sync_highlights(filelist, &c.playlist); - lw.SetLength(filelist->size()); -} - -void -ArtistBrowserPage::OpenArtistList(struct mpdclient &c) -{ - SetCurrentPage(c, &artist_list_page); -} - -void -ArtistBrowserPage::OpenAlbumList(struct mpdclient &c, std::string _artist) -{ - album_list_page.SetArtist(std::move(_artist)); - SetCurrentPage(c, &album_list_page); -} - -void -ArtistBrowserPage::OpenSongList(struct mpdclient &c, std::string _artist, - std::string _album) -{ - song_list_page.SetArtist(std::move(_artist)); - song_list_page.SetAlbum(std::move(_album)); - SetCurrentPage(c, &song_list_page); -} - -static std::unique_ptr<Page> -screen_artist_init(ScreenManager &_screen, WINDOW *w, Size size) -{ - return std::make_unique<ArtistBrowserPage>(_screen, w, size); -} - -const char * -SongListPage::GetTitle(char *str, size_t size) const noexcept -{ - const Utf8ToLocale artist_locale(artist.c_str()); - - if (IsNulled(album)) - snprintf(str, size, - _("All tracks of artist: %s"), - artist_locale.c_str()); - else if (!album.empty()) { - const Utf8ToLocale album_locale(album.c_str()); - snprintf(str, size, "%s: %s - %s", - _("Album"), - artist_locale.c_str(), album_locale.c_str()); - } else - snprintf(str, size, - _("Tracks of no album of artist: %s"),
View file
ncmpc-0.32.tar.xz/src/screen_artist.hxx
Deleted
@@ -1,30 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef NCMPC_SCREEN_ARTIST_H -#define NCMPC_SCREEN_ARTIST_H - -#include "config.h" - -#ifdef ENABLE_ARTIST_SCREEN -struct PageMeta; -extern const PageMeta screen_artist; -#endif - -#endif
View file
ncmpc-0.32.tar.xz/src/screen_keydef.cxx
Deleted
@@ -1,611 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "screen_keydef.hxx" -#include "PageMeta.hxx" -#include "ListPage.hxx" -#include "ListText.hxx" -#include "TextListRenderer.hxx" -#include "ProxyPage.hxx" -#include "screen_status.hxx" -#include "screen_find.hxx" -#include "screen.hxx" -#include "KeyName.hxx" -#include "i18n.h" -#include "conf.hxx" -#include "Bindings.hxx" -#include "GlobalBindings.hxx" -#include "screen_utils.hxx" -#include "Options.hxx" -#include "util/Compiler.h" - -#include <algorithm> - -#include <assert.h> -#include <errno.h> -#include <string.h> - -class CommandKeysPage final : public ListPage, ListText { - ScreenManager &screen; - Page *const parent; - - const KeyBindings *bindings; - KeyBinding *binding; - - /** - * The command being edited, represented by a array subscript - * to #bindings, or -1, if no command is being edited - */ - int subcmd = -1; - - /** The number of keys assigned to the current command */ - unsigned subcmd_n_keys = 0; - -public: - CommandKeysPage(ScreenManager &_screen, Page *_parent, - WINDOW *w, Size size) noexcept - :ListPage(w, size), screen(_screen), parent(_parent) {} - - void SetCommand(KeyBindings *_bindings, unsigned _cmd) { - bindings = _bindings; - binding = &_bindings->key_bindings[_cmd]; - subcmd = _cmd; - lw.Reset(); - check_subcmd_length(); - } - -private: - /** The position of the up ("[..]") item */ - static constexpr unsigned subcmd_item_up() { - return 0; - } - - /** The position of the "add a key" item */ - gcc_pure - unsigned subcmd_item_add() const { - return subcmd_n_keys + 1; - } - - /** The number of items in the list_window, if there's a command being edited */ - gcc_pure - unsigned subcmd_length() const { - return subcmd_item_add() + 1; - } - - /** Check whether a given item is a key */ - gcc_pure - bool subcmd_item_is_key(unsigned i) const { - return (i > subcmd_item_up() && i < subcmd_item_add()); - } - - /** - * Convert an item id (as in lw.selected) into a "key id", which is an array - * subscript to cmds[subcmd].keys. - */ - static constexpr unsigned subcmd_item_to_key_id(unsigned i) { - return i - 1; - } - - /* TODO: rename to check_n_keys / subcmd_count_keys? */ - void check_subcmd_length(); - - /** - * Delete a key from a given command's definition. - * - * @param key_index the key (see below) - */ - void DeleteKey(int key_index); - - /** - * Assigns a new key to a key slot. - */ - void OverwriteKey(int key_index); - - /** - * Assign a new key to a new slot. - */ - void AddKey(); - -public: - /* virtual methods from class Page */ - void OnOpen(struct mpdclient &c) noexcept override; - void Paint() const noexcept override; - bool OnCommand(struct mpdclient &c, Command cmd) override; - const char *GetTitle(char *s, size_t size) const noexcept override; - -private: - /* virtual methods from class ListText */ - const char *GetListItemText(char *buffer, size_t size, - unsigned i) const noexcept override; -}; - -/* TODO: rename to check_n_keys / subcmd_count_keys? */ -void -CommandKeysPage::check_subcmd_length() -{ - subcmd_n_keys = binding->GetKeyCount(); - - lw.SetLength(subcmd_length()); -} - -void -CommandKeysPage::DeleteKey(int key_index) -{ - /* shift the keys to close the gap that appeared */ - int i = key_index+1; - while (i < MAX_COMMAND_KEYS && binding->keys[i]) - binding->keys[key_index++] = binding->keys[i++]; - - /* As key_index now holds the index of the last key slot that contained - a key, we use it to empty this slot, because this key has been copied - to the previous slot in the loop above */ - binding->keys[key_index] = 0; - - binding->modified = true; - check_subcmd_length(); - - screen_status_message(_("Deleted")); - - /* repaint */ - SetDirty(); - - /* update key conflict flags */ - bindings->Check(nullptr, 0); -} - -void -CommandKeysPage::OverwriteKey(int key_index) -{ - assert(key_index < MAX_COMMAND_KEYS); - - char prompt[256]; - snprintf(prompt, sizeof(prompt), - _("Enter new key for %s: "), - get_key_command_name(Command(subcmd))); - const int key = screen_getch(prompt); - - if (key == ERR) { - screen_status_message(_("Aborted")); - return; - } - - if (key == '\0') { - screen_status_message(_("Ctrl-Space can't be used")); - return; - } - - const Command cmd = bindings->FindKey(key); - if (cmd != Command::NONE) { - screen_status_printf(_("Error: key %s is already used for %s"), - key2str(key), get_key_command_name(cmd)); - screen_bell(); - return; - }
View file
ncmpc-0.32.tar.xz/src/screen_keydef.hxx
Deleted
@@ -1,30 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef NCMPC_SCREEN_KEYDEF_H -#define NCMPC_SCREEN_KEYDEF_H - -#include "config.h" - -#ifdef ENABLE_KEYDEF_SCREEN -struct PageMeta; -extern const PageMeta screen_keydef; -#endif /* ENABLE_KEYDEF_SCREEN */ - -#endif
View file
ncmpc-0.32.tar.xz/src/song_paint.cxx
Deleted
@@ -1,61 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "song_paint.hxx" -#include "paint.hxx" -#include "strfsong.hxx" -#include "time_format.hxx" -#include "hscroll.hxx" -#include "config.h" -#include "util/LocaleString.hxx" - -#include <mpd/client.h> - -#include <string.h> - -void -paint_song_row(WINDOW *w, gcc_unused unsigned y, unsigned width, - bool selected, bool highlight, const struct mpd_song *song, - gcc_unused class hscroll *hscroll, const char *format) -{ - char buffer[1024]; - - strfsong(buffer, sizeof(buffer), format, song); - row_paint_text(w, width, highlight ? Style::LIST_BOLD : Style::LIST, - selected, buffer); - -#ifndef NCMPC_MINI - if (options.second_column && mpd_song_get_duration(song) > 0) { - char duration[32]; - format_duration_short(duration, sizeof(duration), - mpd_song_get_duration(song)); - width -= strlen(duration) + 1; - wmove(w, y, width); - waddch(w, ' '); - waddstr(w, duration); - } - - if (hscroll != nullptr && StringWidthMB(buffer) >= width) { - hscroll->Set(0, y, width, buffer, - highlight ? Style::LIST_BOLD : Style::LIST, - selected ? A_REVERSE : 0); - hscroll->Paint(); - } -#endif -}
View file
ncmpc-0.32.tar.xz/src/song_paint.hxx
Deleted
@@ -1,46 +0,0 @@ -/* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project - * Project homepage: http://musicpd.org - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef NCMPC_SONG_PAINT_H -#define NCMPC_SONG_PAINT_H - -#include <curses.h> - -struct mpd_song; -class hscroll; - -/** - * Paints a song into a list window row. The cursor must be set to - * the first character in the row prior to calling this function. - * - * @param w the ncurses window - * @param y the row number in the window - * @param width the width of the row - * @param selected true if the row is selected - * @param highlight true if the row is highlighted - * @param song the song object - * @param hscroll an optional hscroll object - * @param format the song format - */ -void -paint_song_row(WINDOW *w, unsigned y, unsigned width, - bool selected, bool highlight, const struct mpd_song *song, - class hscroll *hscroll, const char *format); - -#endif
View file
ncmpc-0.32.tar.xz/src/util/NulledString.hxx
Deleted
@@ -1,65 +0,0 @@ -/* - * Copyright (C) 2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef NULLED_STRING_HXX -#define NULLED_STRING_HXX - -#include "Compiler.h" - -#include <string> - -/** - * Make a special "nulled" std::string instance. It contains a - * special/magic value (i.e. a single null byte) which allows us to - * differentiate it from an empty string. - */ -inline std::string -MakeNulledString() noexcept -{ - return { "", 1u }; -} - -/** - * Check whether this string was made with MakeNulled(). - */ -gcc_pure -inline bool -IsNulled(const std::string &s) noexcept -{ - return !s.empty() && s.front() == '\0'; -} - -gcc_pure -inline const char * -NullableToC(const std::string &s) noexcept -{ - return IsNulled(s) ? nullptr : s.c_str(); -} - -#endif
View file
ncmpc-0.32.tar.xz/NEWS -> ncmpc-0.36.tar.xz/NEWS
Changed
@@ -1,3 +1,33 @@ +ncmpc 0.36 - (2019-11-05) +* screen_keydef: show "Add new key" only if there is room for more keys +* support the Alt modifier in hotkeys +* reduce network transfer + +ncmpc 0.35 - (2019-09-14) +* fall back to "AlbumArtist" tag in the default format +* fix crash with a very narrow terminal window +* config: allow escaping single quote with backslash in key bindings +* config: fix bug with deprecated names in "screen-list" setting + +ncmpc 0.34 - (2019-04-10) +* show total duration of range selection in status bar +* fix high CPU usage in key bindings check +* fix high CPU usage during text input +* fix background color "none" +* adapt to Boost 1.70.0 API changes +* fixed manual install dir + +ncmpc 0.33 - (2018-10-22) +* artist page: rename to "library" +* library page: make tag list configurable +* fix color configuration parser bug +* fix build failure when libpcre is not found +* remove support for liblircclient (only liblirc) +* build: require Meson 0.47 +* build: use Meson option type `feature` +* build: remove obsolete option `tcp` +* build: add option to disable regular expression support + ncmpc 0.32 - (2018-10-05) * fix crash bug on queue page * fix crash bug on lyrics page
View file
ncmpc-0.32.tar.xz/build/configure.py -> ncmpc-0.36.tar.xz/build/configure.py
Changed
@@ -7,10 +7,10 @@ flavors = { 'debug': { 'options': [ - '-Ddocumentation=true', + '-Ddocumentation=enabled', '-Dcurses=ncursesw', - '-Dmouse=true', - '-Dlirc=true', + '-Dmouse=enabled', + '-Dlirc=enabled', '-Dlyrics_screen=true', '-Dchat_screen=true', ], @@ -19,11 +19,11 @@ 'clang': { 'options': [ '-Dcurses=ncursesw', - '-Dmouse=true', - '-Dlirc=true', + '-Dmouse=enabled', + '-Dlirc=enabled', '-Dlyrics_screen=true', '-Dchat_screen=true', - '-Ddocumentation=false', + '-Ddocumentation=disabled', ], 'env': { 'CC': 'clang', @@ -38,8 +38,8 @@ '-Db_ndebug=true', '-Db_lto=true', '-Dcurses=ncursesw', - '-Dmouse=true', - '-Ddocumentation=false', + '-Dmouse=enabled', + '-Ddocumentation=disabled', ], 'env': { 'LDFLAGS': '-fuse-ld=gold -Wl,--gc-sections,--icf=all', @@ -52,8 +52,8 @@ '-Db_ndebug=true', '-Db_lto=true', '-Dcurses=ncursesw', - '-Dmouse=true', - '-Ddocumentation=false', + '-Dmouse=enabled', + '-Ddocumentation=disabled', ], 'env': { 'CC': 'clang', @@ -67,17 +67,17 @@ '--buildtype', 'minsize', '-Db_ndebug=true', '-Db_lto=true', - '-Dlirc=false', + '-Dlirc=disabled', '-Dcurses=ncurses', '-Dcolors=false', - '-Dmouse=false', + '-Dmouse=disabled', '-Dmultibyte=false', - '-Dlocale=false', - '-Dnls=false', + '-Dlocale=disabled', + '-Dnls=disabled', '-Dtcp=false', '-Dasync_connect=false', '-Dmini=true', - '-Ddocumentation=false', + '-Ddocumentation=disabled', ], 'env': { 'LDFLAGS': '-fuse-ld=gold -Wl,--gc-sections,--icf=all',
View file
ncmpc-0.32.tar.xz/doc/conf.py -> ncmpc-0.36.tar.xz/doc/conf.py
Changed
@@ -30,7 +30,7 @@ # General information about the project. project = 'ncmpc' -copyright = 'Copyright (C) 2004-2018 The Music Player Daemon Project' +copyright = 'Copyright (C) 2004-2019 The Music Player Daemon Project' author = 'Max Kellermann' # The version info for the project you're documenting, acts as replacement for @@ -38,7 +38,7 @@ # built documents. # # The short X.Y version. -version = '0.32' +version = '0.36' # The full version, including alpha/beta/rc tags. release = version
View file
ncmpc-0.32.tar.xz/doc/config.sample -> ncmpc-0.36.tar.xz/doc/config.sample
Changed
@@ -19,9 +19,12 @@ ## Enable mouse support (if enabled at compile time). #enable-mouse = no +# Which tags shall be grouped on the library page? +#library-page-tags = artist album + ## A list of screens to cycle through when using ## the previous/next screen commands (tab and shift+tab). -## names: playlist browse help artist search song keydef lyrics outputs chat +## names: playlist browse help library search song keydef lyrics outputs chat #screen-list = playlist browse ## Default search mode for the search screen. The mode is an
View file
ncmpc-0.32.tar.xz/doc/index.rst -> ncmpc-0.36.tar.xz/doc/index.rst
Changed
@@ -111,12 +111,15 @@ :command:`screen-list = SCREEN1 SCREEN2...` - A list of screens to cycle through when using the previous/next screen commands. Valid -choices, if enabled at compile time, are playlist, browse, artist, +choices, if enabled at compile time, are playlist, browse, library, help, search, song, keydef, lyrics, outputs, and chat. +:command:`library-page-tags = TAG1 TAG2 ...` - A list of tags to group +the library page. The default is ``artist album``. + :command:`search-mode = MODE` - Default search mode for the search screen. MODE must be one of title, artist, album, filename, and -artist+title, or an interger index (0 for title, 1 for artist etc.). +artist+title, or an integer index (0 for title, 1 for artist etc.). :command:`auto-center = yes|no` - Enable/disable auto center mode. When auto center mode is enabled ncmpc centers the current track @@ -269,10 +272,11 @@ color. :command:`color title = COLOR[,ATTRIBUTE]...` - Set the text color and -attributes for the title row. +attributes for the title row, which displays the page names. -:command:`color title-bold = COLOR[,ATTRIBUTE]...` - Set the text -color for the title row (the bold part). +:command:`color title-bold = COLOR[,ATTRIBUTE]...` - Like ``title``, +but refers to emphasized parts of the title row, i.e. the hot keys for +switching to a specific page. :command:`color line = COLOR` - Set the color of the line on the second row.
View file
ncmpc-0.32.tar.xz/doc/meson.build -> ncmpc-0.36.tar.xz/doc/meson.build
Changed
@@ -1,26 +1,40 @@ -sphinx = find_program('sphinx-build', required: enable_documentation == 'true') -if sphinx.found() - if get_option('html_manual') - custom_target( - 'HTML documentation', - output: 'html', - input: ['index.rst', 'conf.py'], - command: [sphinx, '-q', '-b', 'html', '-d', '@OUTDIR@/html_doctrees', meson.current_source_dir(), '@OUTPUT@'], - build_by_default: true, - install: true, - install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()), - ) - endif +sphinx = find_program('sphinx-build', required: get_option('documentation')) +if not sphinx.found() + subdir_done() +endif + +if get_option('html_manual') + sphinx_output = custom_target( + 'HTML documentation', + output: 'html', + input: ['index.rst', 'conf.py'], + command: [sphinx, '-q', '-b', 'html', '-d', '@OUTDIR@/html_doctrees', meson.current_source_dir(), '@OUTPUT@'], + build_by_default: true, + install: true, + install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()), + ) + + custom_target( + 'upload', + input: sphinx_output, + output: 'upload', + build_always_stale: true, + command: [ + 'rsync', '-vpruz', '--delete', '@INPUT@', + 'www.musicpd.org:/var/www/mpd/doc/ncmpc/', + '--chmod=a+rX', + ], + ) +endif - if get_option('manual') - custom_target( - 'Manpage documentation', - output: 'man', - input: ['index.rst', 'conf.py'], - command: [sphinx, '-q', '-b', 'man', '-d', '@OUTDIR@/man_doctrees', meson.current_source_dir(), '@OUTPUT@/man1'], - build_by_default: true, - install: true, - install_dir: get_option('mandir'), - ) - endif +if get_option('manual') + custom_target( + 'Manpage documentation', + output: 'man1', + input: ['index.rst', 'conf.py'], + command: [sphinx, '-q', '-b', 'man', '-d', '@OUTDIR@/man_doctrees', meson.current_source_dir(), '@OUTPUT@'], + build_by_default: true, + install: true, + install_dir: get_option('mandir'), + ) endif
View file
ncmpc-0.32.tar.xz/lyrics/10-hd.sh -> ncmpc-0.36.tar.xz/lyrics/10-hd.sh
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -e # -# (c) 2004-2018 The Music Player Daemon Project +# (c) 2004-2019 The Music Player Daemon Project # http://www.musicpd.org/ # # This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/lyrics/20-lyricwiki.rb -> ncmpc-0.36.tar.xz/lyrics/20-lyricwiki.rb
Changed
@@ -1,6 +1,6 @@ #!/usr/bin/env ruby # -# (c) 2004-2018 The Music Player Daemon Project +# (c) 2004-2019 The Music Player Daemon Project # http://www.musicpd.org/ # # This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/meson.build -> ncmpc-0.36.tar.xz/meson.build
Changed
@@ -1,5 +1,6 @@ project('ncmpc', 'cpp', - version: '0.32', + version: '0.36', + meson_version: '>= 0.47', default_options: [ 'cpp_std=c++14' ], @@ -18,11 +19,11 @@ conf.set('NCMPC_MINI', mini) enable_locale = get_option('locale') -if enable_locale == 'false' or mini +if enable_locale.disabled() or mini enable_locale = false elif cc.has_header('locale.h') enable_locale = true -elif enable_locale == 'auto' +elif enable_locale.auto() enable_locale = false else error('locale.h not found') @@ -30,11 +31,11 @@ conf.set('ENABLE_LOCALE', enable_locale) enable_nls = get_option('nls') -if enable_nls == 'false' or mini +if enable_nls.disabled() or mini enable_nls = false elif cc.has_header('libintl.h') enable_nls = true -elif enable_nls == 'auto' +elif enable_nls.auto() enable_nls = false else error('libintl.h not found') @@ -48,10 +49,6 @@ conf.set('HAVE_LOCALE_T', enable_locale and cc.has_header_symbol('locale.h', 'locale_t')) conf.set('HAVE_ICONV', enable_locale and cc.has_function('iconv')) -if get_option('tcp') - conf.set('ENABLE_TCP', true) -endif - async_connect = get_option('async_connect') conf.set('ENABLE_ASYNC_CONNECT', async_connect) @@ -102,36 +99,19 @@ conf.set('HAVE_CURSES_ENHANCED', curses_enhanced) enable_mouse = get_option('mouse') -if enable_mouse == 'false' +if enable_mouse.disabled() enable_mouse = false elif cc.has_function('getmouse', dependencies: curses_dep) enable_mouse = true -elif enable_mouse == 'auto' +elif enable_mouse.auto() enable_mouse = false else error('getmouse() not available') endif conf.set('HAVE_GETMOUSE', enable_mouse) -enable_lirc = get_option('lirc') -if enable_lirc == 'false' - enable_lirc = false - lirc_dep = [] -else - lirc_dep = dependency('lirc', required: false) - if not lirc_dep.found() - lirc_dep = dependency('liblircclient0', required: false) - endif - - if lirc_dep.found() - enable_lirc = true - elif enable_lirc == 'auto' - enable_lirc = false - else - error('liblirc not found') - endif -endif -conf.set('ENABLE_LIRC', enable_lirc) +lirc_dep = dependency('lirc', required: get_option('lirc')) +conf.set('ENABLE_LIRC', lirc_dep.found()) conf.set('ENABLE_COLORS', curses_color and get_option('colors')) @@ -188,7 +168,7 @@ libmpdclient_dep = dependency('libmpdclient', version: '>= 2.9') if not mini - pcre_dep = dependency('libpcre', required: false) + pcre_dep = dependency('libpcre', required: get_option('regex')) conf.set('HAVE_PCRE', pcre_dep.found()) else pcre_dep = declare_dependency() @@ -218,8 +198,15 @@ 'src/xterm_title.cxx', 'src/BasicMarquee.cxx', 'src/hscroll.cxx', - 'src/conf.cxx', + 'src/ConfigFile.cxx', + 'src/ConfigParser.cxx', ] + + if host_machine.system() != 'windows' + sources += [ + 'src/XdgBaseDirectory.cxx', + ] + endif endif if async_connect @@ -230,7 +217,7 @@ ] endif -if enable_lirc +if lirc_dep.found() sources += [ 'src/lirc.cxx', ] @@ -242,13 +229,13 @@ sources += ['src/HelpPage.cxx'] endif -enable_artist_screen = get_option('artist_screen') and not mini -conf.set('ENABLE_ARTIST_SCREEN', enable_artist_screen) -if enable_artist_screen +enable_library_screen = get_option('library_screen') and not mini +conf.set('ENABLE_LIBRARY_PAGE', enable_library_screen) +if enable_library_screen sources += [ - 'src/screen_artist.cxx', - 'src/ArtistListPage.cxx', - 'src/AlbumListPage.cxx', + 'src/LibraryPage.cxx', + 'src/TagListPage.cxx', + 'src/TagFilter.cxx', ] endif @@ -267,7 +254,7 @@ enable_keydef_screen = get_option('key_screen') and not mini conf.set('ENABLE_KEYDEF_SCREEN', enable_keydef_screen) if enable_keydef_screen - sources += ['src/screen_keydef.cxx'] + sources += ['src/KeyDefPage.cxx'] endif enable_lyrics_screen = get_option('lyrics_screen') and not mini @@ -331,7 +318,8 @@ 'src/Command.cxx', 'src/Bindings.cxx', 'src/GlobalBindings.cxx', - 'src/keyboard.cxx', + 'src/UserInput.cxx', + 'src/AsyncUserInput.cxx', 'src/KeyName.cxx', 'src/Match.cxx', 'src/ncu.cxx', @@ -353,10 +341,11 @@ 'src/FileListPage.cxx', 'src/FileBrowserPage.cxx', 'src/ProxyPage.cxx', + 'src/ListCursor.cxx', 'src/ListWindow.cxx', 'src/TextListRenderer.cxx', 'src/save_playlist.cxx', - 'src/song_paint.cxx', + 'src/SongRowPaint.cxx', 'src/BasicColors.cxx', 'src/CustomColors.cxx', 'src/Styles.cxx', @@ -366,8 +355,11 @@ 'src/strfsong.cxx', 'src/time_format.cxx', 'src/util/LocaleString.cxx', + 'src/util/PrintException.cxx', + 'src/util/StringCompare.cxx', 'src/util/StringStrip.cxx', 'src/util/StringUTF8.cxx', + 'src/util/StringView.cxx', 'src/util/UriUtil.cxx', sources, include_directories: inc, @@ -395,7 +387,4 @@ subdir('test') endif -enable_documentation = get_option('documentation') -if enable_documentation != 'false' - subdir('doc') -endif +subdir('doc')
View file
ncmpc-0.32.tar.xz/meson_options.txt -> ncmpc-0.36.tar.xz/meson_options.txt
Changed
@@ -3,9 +3,10 @@ value: 'auto', description: 'Choose which curses implementation to use') -option('mouse', type: 'combo', - choices: ['true', 'false', 'auto'], - value: 'auto', +option('regex', type: 'feature', + description: 'Enable regular expression support (using libpcre)') + +option('mouse', type: 'feature', description: 'Enable mouse support') option('colors', type: 'boolean', @@ -16,25 +17,15 @@ value: true, description: 'Enable multibyte character support') -option('locale', type: 'combo', - choices: ['true', 'false', 'auto'], - value: 'auto', +option('locale', type: 'feature', description: 'Enable locale support') -option('nls', type: 'combo', - choices: ['true', 'false', 'auto'], - value: 'auto', +option('nls', type: 'feature', description: 'Enable NLS support') -option('lirc', type: 'combo', - choices: ['true', 'false', 'auto'], - value: 'auto', +option('lirc', type: 'feature', description: 'Enable LIRC support') -option('tcp', type: 'boolean', - value: true, - description: 'Enable TCP support') - option('async_connect', type: 'boolean', value: true, description: 'Enable asynchronous connect') @@ -47,9 +38,9 @@ value: true, description: 'Enable the help screen') -option('artist_screen', type: 'boolean', +option('library_screen', type: 'boolean', value: true, - description: 'Enable the artist screen') + description: 'Enable the library screen') option('search_screen', type: 'boolean', value: true, @@ -79,8 +70,7 @@ value: false, description: 'Enable the chat screen') -option('documentation', type: 'combo', - choices: ['true', 'false', 'auto'], value: 'auto', +option('documentation', type: 'feature', description: 'Build documentation') option('manual', type: 'boolean',
View file
ncmpc-0.32.tar.xz/po/LINGUAS -> ncmpc-0.36.tar.xz/po/LINGUAS
Changed
@@ -1,6 +1,7 @@ cs da de +en eo es fi
View file
ncmpc-0.32.tar.xz/po/POTFILES -> ncmpc-0.36.tar.xz/po/POTFILES
Changed
@@ -1,32 +1,31 @@ -src/AlbumListPage.cxx -src/ArtistListPage.cxx src/Bindings.cxx src/ChatPage.cxx src/Command.cxx -src/conf.cxx +src/ConfigParser.cxx src/CustomColors.cxx src/FileBrowserPage.cxx src/FileListPage.cxx src/HelpPage.cxx src/i18n.h +src/KeyDefPage.cxx src/KeyName.cxx +src/LibraryPage.cxx src/ListWindow.cxx src/LyricsPage.cxx src/Main.cxx -src/options.cxx +src/Options.cxx src/OutputsPage.cxx src/player_command.cxx src/QueuePage.cxx src/save_playlist.cxx -src/screen_artist.cxx src/screen_client.cxx src/screen.cxx src/screen_find.cxx -src/screen_keydef.cxx src/screen_utils.cxx src/SearchPage.cxx src/SongPage.cxx src/StatusBar.cxx src/Styles.cxx +src/TagListPage.cxx src/time_format.cxx src/TitleBar.cxx
View file
ncmpc-0.32.tar.xz/po/cs.po -> ncmpc-0.36.tar.xz/po/cs.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2011-03-02 13:59+0000\n" "Last-Translator: Zbyněk Schwarz <Unknown>\n" "Language-Team: Czech <cs@li.org>\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2011-06-23 08:56+0000\n" "X-Generator: Launchpad (build 13265)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Všechny skladby" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Alba interpreta: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Přidávám '%s' do seznamu skladeb" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Všichni interpreti" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Klávesa %s je přiřazena k %s a %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -307,8 +283,8 @@ msgstr "Skočit na" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Obrazovka interpretů" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -349,116 +325,131 @@ msgid "Chat screen" msgstr "Další obrazovka" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Chyba" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Neplatná definice klávesové zkratky" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Neúplné nastavení klávesových zkratek" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Neznámý příkaz" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Neúplné nastavení klávesových zkratek" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Chybný typ zobrazení času" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Chybí '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Chybné jméno barvy" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Neúplná definice barvy" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Neplatné číslo" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Neplatná definice barvy" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Neznámé jméno obrazovky" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Neznámý příkaz" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Chybný vyhledávací mód" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Neznámý vyhledávací mód" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Neznámý parametr nastavení" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Terminál postrádá podporu změny barev" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Smazání této položky není možné" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/da.po -> ncmpc-0.36.tar.xz/po/da.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc 0.11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2009-09-24 10:26+0200\n" "Last-Translator: Niels Anker <nanker@webspeed.dk>\n" "Language-Team: da <da@li.org>\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2009-09-24 08:24+0000\n" "X-Generator: Launchpad (build Unknown)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Alle spor" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Album fra kunstneren: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Tilføjer '%s' til listen" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Alle kunstnere" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Tast %s tildelt %s og %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -307,8 +283,8 @@ msgstr "Spring til" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Kunstner skærm" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -349,116 +325,131 @@ msgid "Chat screen" msgstr "Næste skærm" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Fejl" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Forkert hotkey definition" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Ufuldstændig hotkey konfiguration" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Ukendt kommando" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Ufuldstændig hotkey konfiguration" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Ringe tidsvisningstype" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Mangler '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Dårligt farvenavn" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Ufuldstændig farve definition" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Ugyldigt tal." -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Forkert farve definition" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Ukendt skærm navn" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Ukendt kommando" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Ugyldig søgetilstand" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Ukendt søgetilstand" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Ukendt konfigurations parameter" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Terminalen understøtter ikke at ændre farver" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Sletning af dette emne ikke muligt" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/de.po -> ncmpc-0.36.tar.xz/po/de.po
Changed
@@ -8,9 +8,9 @@ msgstr "" "Project-Id-Version: ncmpc 0.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" -"PO-Revision-Date: 2018-09-10 18:18+0000\n" -"Last-Translator: Max Kellermann <max.kellermann@gmail.com>\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2019-09-08 13:57+0200\n" +"Last-Translator: ssantos <ssantos@web.de>\n" "Language-Team: German <https://hosted.weblate.org/projects/ncmpc/" "translations/de/>\n" "Language: de\n" @@ -18,46 +18,23 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.2-dev\n" +"X-Generator: Weblate 3.7-dev\n" "X-Launchpad-Export-Date: 2011-06-23 08:56+0000\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Alle Stücke" - -#: src/AlbumListPage.cxx:144 -msgid "Albums" -msgstr "Alben" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Alben des Künstlers: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Füge '%s' der Playlist hinzu" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Alle Künstler" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Taste %s ist %s und %s zugeordnet" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" -msgstr "" +msgstr "Chat" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "Deine Nachricht" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "Nachricht konnte nicht gesendet werden" @@ -134,9 +111,8 @@ msgstr "Hilfeanzeige" #: src/Command.cxx:71 src/HelpPage.cxx:140 -#, fuzzy msgid "Queue screen" -msgstr "Tastenbelegungsanzeige" +msgstr "Warteschlangenanzeige" #: src/Command.cxx:73 src/HelpPage.cxx:155 msgid "Browse screen" @@ -183,26 +159,24 @@ msgstr "Lautstärke verringern" #: src/Command.cxx:98 -#, fuzzy msgid "Select/deselect song in queue" -msgstr "Wähle Stück in der Playlist an/ab" +msgstr "Stück in der Warteschlange auswählen/abwählen" #: src/Command.cxx:100 msgid "Select all listed items" msgstr "Alle angezeigten Lieder zur Playlist hinzufügen" #: src/Command.cxx:102 -#, fuzzy msgid "Delete song from queue" -msgstr "Lösche Song aus der Playlist" +msgstr "Lösche Song aus der Warteschlange" #: src/Command.cxx:104 msgid "Shuffle queue" -msgstr "" +msgstr "Warteschlange mischen" #: src/Command.cxx:106 msgid "Clear queue" -msgstr "" +msgstr "Warteschlange leeren" #: src/Command.cxx:108 msgid "Toggle repeat mode" @@ -230,12 +204,11 @@ #: src/Command.cxx:120 msgid "Save queue" -msgstr "" +msgstr "Warteschlange speichern" #: src/Command.cxx:122 src/HelpPage.cxx:174 -#, fuzzy msgid "Append song to queue" -msgstr "Song zur Playlist hinzufügen" +msgstr "Song zur Warteschlange hinzufügen" #: src/Command.cxx:125 msgid "Go to root directory" @@ -309,8 +282,8 @@ msgstr "Springe zu" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Künstlerdatenbank" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -340,126 +313,140 @@ #: src/Command.cxx:204 msgid "Edit the current item" -msgstr "" +msgstr "Aktuelles Element bearbeiten" #: src/Command.cxx:209 src/HelpPage.cxx:196 msgid "Outputs screen" msgstr "Anzeige der Ausgabegeräte" #: src/Command.cxx:214 src/HelpPage.cxx:203 -#, fuzzy msgid "Chat screen" -msgstr "Nächste Anzeige" +msgstr "Chat-Bildschirm" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Fehler" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "Wort erwartet" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Fehlerhafte Definition der Tastenbelegung" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Unvollständige Konfiguration für Tastenbelegung" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Unbekannter Befehl" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Unvollständige Konfiguration für Tastenbelegung" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223
View file
ncmpc-0.36.tar.xz/po/en.po
Added
@@ -0,0 +1,1189 @@ +# English translations for ncmpc package. +# Copyright (C) 2019 THE ncmpc'S COPYRIGHT HOLDER +# This file is distributed under the same license as the ncmpc package. +# Automatically generated, 2019. +# +msgid "" +msgstr "" +"Project-Id-Version: ncmpc\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2019-09-08 13:58+0200\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: en\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/Bindings.cxx:81 src/Bindings.cxx:87 +#, c-format +msgid "Key %s assigned to %s and %s" +msgstr "Key %s assigned to %s and %s" + +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 +msgid "Chat" +msgstr "Chat" + +#: src/ChatPage.cxx:163 +msgid "Your message" +msgstr "Your message" + +#: src/ChatPage.cxx:172 +msgid "Message could not be sent" +msgstr "Message could not be sent" + +#: src/Command.cxx:29 +msgid "Key configuration screen" +msgstr "Key configuration screen" + +#: src/Command.cxx:32 +msgid "Quit" +msgstr "Quit" + +#: src/Command.cxx:36 +msgid "Move cursor up" +msgstr "Move cursor up" + +#: src/Command.cxx:38 +msgid "Move cursor down" +msgstr "Move cursor down" + +#: src/Command.cxx:40 +msgid "Move cursor to the top of screen" +msgstr "Move cursor to the top of screen" + +#: src/Command.cxx:42 +msgid "Move cursor to the middle of screen" +msgstr "Move cursor to the middle of screen" + +#: src/Command.cxx:44 +msgid "Move cursor to the bottom of screen" +msgstr "Move cursor to the bottom of screen" + +#: src/Command.cxx:46 +msgid "Move cursor to the top of the list" +msgstr "Move cursor to the top of the list" + +#: src/Command.cxx:48 +msgid "Move cursor to the bottom of the list" +msgstr "Move cursor to the bottom of the list" + +#: src/Command.cxx:50 +msgid "Page up" +msgstr "Page up" + +#: src/Command.cxx:52 +msgid "Page down" +msgstr "Page down" + +#: src/Command.cxx:54 +msgid "Range selection" +msgstr "Range selection" + +#: src/Command.cxx:56 +msgid "Scroll down one line" +msgstr "Scroll down one line" + +#: src/Command.cxx:58 +msgid "Scroll up one line" +msgstr "Scroll up one line" + +#: src/Command.cxx:60 +msgid "Scroll up half a screen" +msgstr "Scroll up half a screen" + +#: src/Command.cxx:62 +msgid "Scroll down half a screen" +msgstr "Scroll down half a screen" + +#: src/Command.cxx:64 +msgid "Select currently playing song" +msgstr "Select currently playing song" + +#: src/Command.cxx:69 +msgid "Help screen" +msgstr "Help screen" + +#: src/Command.cxx:71 src/HelpPage.cxx:140 +msgid "Queue screen" +msgstr "Queue screen" + +#: src/Command.cxx:73 src/HelpPage.cxx:155 +msgid "Browse screen" +msgstr "Browse screen" + +#: src/Command.cxx:78 +msgid "Play/Enter directory" +msgstr "Play/Enter directory" + +#: src/Command.cxx:80 +msgid "Pause" +msgstr "Pause" + +#: src/Command.cxx:82 +msgid "Stop" +msgstr "Stop" + +#: src/Command.cxx:84 +msgid "Crop" +msgstr "Crop" + +#: src/Command.cxx:86 +msgid "Next track" +msgstr "Next track" + +#: src/Command.cxx:88 +msgid "Previous track" +msgstr "Previous track" + +#: src/Command.cxx:90 +msgid "Seek forward" +msgstr "Seek forward" + +#: src/Command.cxx:92 +msgid "Seek backward" +msgstr "Seek backward" + +#: src/Command.cxx:94 +msgid "Increase volume" +msgstr "Increase volume" + +#: src/Command.cxx:96 +msgid "Decrease volume" +msgstr "Decrease volume" + +#: src/Command.cxx:98 +msgid "Select/deselect song in queue" +msgstr "Select/deselect song in queue" + +#: src/Command.cxx:100 +msgid "Select all listed items" +msgstr "Select all listed items" + +#: src/Command.cxx:102 +msgid "Delete song from queue" +msgstr "Delete song from queue" + +#: src/Command.cxx:104 +msgid "Shuffle queue" +msgstr "Shuffle queue" + +#: src/Command.cxx:106 +msgid "Clear queue" +msgstr "Clear queue" + +#: src/Command.cxx:108 +msgid "Toggle repeat mode" +msgstr "Toggle repeat mode" + +#: src/Command.cxx:110 +msgid "Toggle random mode" +msgstr "Toggle random mode" + +#: src/Command.cxx:112 +msgid "Toggle single mode" +msgstr "Toggle single mode" + +#: src/Command.cxx:114 +msgid "Toggle consume mode" +msgstr "Toggle consume mode" + +#: src/Command.cxx:116 +msgid "Toggle crossfade mode" +msgstr "Toggle crossfade mode" + +#: src/Command.cxx:118 +msgid "Start a music database update" +msgstr "Start a music database update"
View file
ncmpc-0.32.tar.xz/po/eo.po -> ncmpc-0.36.tar.xz/po/eo.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2011-05-16 15:13+0000\n" "Last-Translator: Aleksej <Unknown>\n" "Language-Team: Esperanto <eo@li.org>\n" @@ -18,43 +18,20 @@ "X-Launchpad-Export-Date: 2011-06-23 08:56+0000\n" "X-Generator: Launchpad (build 13265)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "" - -#: src/AlbumListPage.cxx:144 -msgid "Albums" -msgstr "" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Aldonas \"%s\" al la ludlisto" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -302,7 +279,7 @@ msgstr "" #: src/Command.cxx:180 -msgid "Artist screen" +msgid "Library page" msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 @@ -343,116 +320,130 @@ msgid "Chat screen" msgstr "" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "" -#. the hotkey configuration contains an unknown -#. command -#: src/conf.cxx:178 -msgid "Unknown command" +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" msgstr "" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" +#. the hotkey configuration +#. contains an unknown +#. command +#: src/ConfigParser.cxx:187 +msgid "Unknown command" msgstr "" -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +msgid "Unknown MPD tag" +msgstr "" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, c-format msgid "Delete playlist %s?" msgstr "" #. translators: a dialog was aborted by the user
View file
ncmpc-0.32.tar.xz/po/es.po -> ncmpc-0.36.tar.xz/po/es.po
Changed
@@ -12,7 +12,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2012-01-30 07:08+0000\n" "Last-Translator: Adolfo Jayme Barrientos <fitoschido@gmail.com>\n" "Language-Team: es\n" @@ -23,44 +23,20 @@ "X-Launchpad-Export-Date: 2013-04-11 07:56+0000\n" "X-Generator: Launchpad (build 16550)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Todas las pistas" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Álbum" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Álbumes del artista: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Añadiendo '%s' a la lista de canciones" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Todos los artistas" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Tecla %s asignada a %s y %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -312,8 +288,8 @@ msgstr "Saltar a" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Artistas" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -354,116 +330,131 @@ msgid "Chat screen" msgstr "Pantalla siguiente" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Error" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Definición incorrecta de la tecla de acceso" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Configuración incompleta de la tecla de acceso" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Comando desconocido" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Configuración incompleta de la tecla de acceso" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Configuración incorrecta del tipo de duración mostrada" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Falta un '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Nombre de color incorrecto" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Definición de color incompleta" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Número inválido" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Definición de color erronea" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Nombre de pantalla desconocido" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Comando desconocido" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Modo de búsqueda inválido" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "No se reconoce el modo de búsqueda" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Parámetro de configuración desconocido" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "La terminal no soporta el cambio de colores" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "No se puede borrar el elemento" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/fi.po -> ncmpc-0.36.tar.xz/po/fi.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2011-03-06 16:02+0000\n" "Last-Translator: Sami Sankala <Unknown>\n" "Language-Team: Finnish <fi@li.org>\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2011-06-23 08:56+0000\n" "X-Generator: Launchpad (build 13265)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Kaikki kappaleet" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Albumi" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Kaikki albumit esittäjältä: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Soittolistaan lisätään '%s'" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Kaikki esittäjät" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -305,7 +281,7 @@ msgstr "" #: src/Command.cxx:180 -msgid "Artist screen" +msgid "Library page" msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 @@ -347,116 +323,130 @@ msgid "Chat screen" msgstr "Soittolista näyttö" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "" -#. the hotkey configuration contains an unknown -#. command -#: src/conf.cxx:178 -msgid "Unknown command" +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" msgstr "" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" +#. the hotkey configuration +#. contains an unknown +#. command +#: src/ConfigParser.cxx:187 +msgid "Unknown command" msgstr "" -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +msgid "Unknown MPD tag" +msgstr "" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Tämän kohteen poistaminen ei ole mahdollista" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format msgid "Delete playlist %s?" msgstr "Poista soittolista"
View file
ncmpc-0.32.tar.xz/po/fr.po -> ncmpc-0.36.tar.xz/po/fr.po
Changed
@@ -9,57 +9,35 @@ msgstr "" "Project-Id-Version: ncmpc 0.14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" -"PO-Revision-Date: 2010-09-23 11:15+0000\n" -"Last-Translator: Thibault Févry <Unknown>\n" -"Language-Team: <fr@li.org>\n" -"Language: \n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2019-01-22 14:05+0000\n" +"Last-Translator: Nathan <bonnemainsnathan@gmail.com>\n" +"Language-Team: French <https://hosted.weblate.org/projects/ncmpc/" +"translations/fr/>\n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.4\n" "X-Launchpad-Export-Date: 2011-01-05 20:00+0000\n" -"X-Generator: Launchpad (build 12138)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Toutes les pistes" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Albums de l'artiste : %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Ajout de '%s' à la liste de lecture" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Tous les artistes" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "La touche %s est assignée à %s et à %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" -msgstr "" +msgstr "Tchat" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" -msgstr "" +msgstr "Votre message" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" -msgstr "" +msgstr "Le message n'a pas pu être envoyé" #: src/Command.cxx:29 msgid "Key configuration screen" @@ -134,9 +112,8 @@ msgstr "Ecran d'aide" #: src/Command.cxx:71 src/HelpPage.cxx:140 -#, fuzzy msgid "Queue screen" -msgstr "Écran du paramétrage des raccourcis" +msgstr "Écran de file d'attente" #: src/Command.cxx:73 src/HelpPage.cxx:155 msgid "Browse screen" @@ -183,26 +160,24 @@ msgstr "Diminuer le volume" #: src/Command.cxx:98 -#, fuzzy msgid "Select/deselect song in queue" -msgstr "Sélectionner/Désélectionner la chanson dans la liste de lecture" +msgstr "Sélectionner/désélectionner un morceau dans la file d'attente" #: src/Command.cxx:100 msgid "Select all listed items" msgstr "Selectionner tous les éléments listés" #: src/Command.cxx:102 -#, fuzzy msgid "Delete song from queue" -msgstr "Enlever la chanson de la liste de lecture" +msgstr "Supprimer un morceau de la file d'attente" #: src/Command.cxx:104 msgid "Shuffle queue" -msgstr "" +msgstr "Mélanger la file d'attente" #: src/Command.cxx:106 msgid "Clear queue" -msgstr "" +msgstr "Vider la file d'attente" #: src/Command.cxx:108 msgid "Toggle repeat mode" @@ -230,12 +205,11 @@ #: src/Command.cxx:120 msgid "Save queue" -msgstr "" +msgstr "Enregistrer la file d'attente" #: src/Command.cxx:122 src/HelpPage.cxx:174 -#, fuzzy msgid "Append song to queue" -msgstr "Ajouter la chanson à la liste de lecture" +msgstr "Ajouter la chanson à la file d'attente" #: src/Command.cxx:125 msgid "Go to root directory" @@ -309,8 +283,8 @@ msgstr "Aller à" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Ecran sur l'Artiste" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -340,126 +314,140 @@ #: src/Command.cxx:204 msgid "Edit the current item" -msgstr "" +msgstr "Modifier l'élément en cours" #: src/Command.cxx:209 src/HelpPage.cxx:196 msgid "Outputs screen" msgstr "Ecran des sorties" #: src/Command.cxx:214 src/HelpPage.cxx:203 -#, fuzzy msgid "Chat screen" -msgstr "Ecran suivant" - -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Erreur" +msgstr "Écran de discussion" -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" -msgstr "" +msgstr "Mot attendu" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Définition de raccourci malformée" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Configuration de raccourci incomplète" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Commande inconnue" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Configuration de raccourci incomplète" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc
View file
ncmpc-0.32.tar.xz/po/gl.po -> ncmpc-0.36.tar.xz/po/gl.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2011-03-25 19:34+0000\n" "Last-Translator: Miguel Anxo Bouzada <mbouzada@gmail.com>\n" "Language-Team: galician\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2011-06-23 08:56+0000\n" "X-Generator: Launchpad (build 13265)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Todas as pistas" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Álbum" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Álbumes do artista: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Engadindo «%s» á lista de reprodución" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Todos os artistas" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "A tecla %s asignouse a %s e a %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -307,8 +283,8 @@ msgstr "Ir a" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Pantalla de Artistas" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -349,116 +325,131 @@ msgid "Chat screen" msgstr "Seguinte pantalla" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Erro" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Definición incorrecta da tecla de acceso rápido." -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Configuraión incompleta da tecla de acceso rápido" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Orde descoñecida" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Configuraión incompleta da tecla de acceso rápido" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Configuración incorrecta da duración mostrada" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Falta o signo «=»" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Nome de cor incorrecto" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Definición incompleta da cor" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Número incorrecto" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Definición incorrecta da cor" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Nome de pantalla descoñecido" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Orde descoñecida" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "O modo de busca é incorrecto" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Modo de busca descoñecido" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Parámetro de configuración descoñecido" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "A terminal non admite o cambio das cores" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Non é possíbel borrar este elemento" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/he.po -> ncmpc-0.36.tar.xz/po/he.po
Changed
@@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2010-09-07 20:35+0200\n" "Last-Translator: zeltak <Unknown>\n" "Language-Team: he <he@li.org>\n" @@ -13,44 +13,20 @@ "X-Launchpad-Export-Date: 2010-09-07 18:28+0000\n" "X-Generator: Launchpad (build Unknown)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "כל השירים" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "אלבום" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "אלבום של אומן %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "מוסיף %s לרשימת השירים" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "כל האמנים" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "מקש %s מוקצה ל %s ו %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -302,8 +278,8 @@ msgstr "קפוץ ל" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "מסך אומן" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -344,116 +320,131 @@ msgid "Chat screen" msgstr "מסך הבא" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "שגיאה" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "הגדרת המקשים החמים שגויה" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "הגדרת המקשים החמים חסרה" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "פקודה לא ידועה" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "הגדרת המקשים החמים חסרה" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "תצוגת זמן שגויה" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "חסר '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "צבע שגוי" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "הגדרת צבעים חסרה" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "מספר לא תקין" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "הגדרת צבעים שגויה" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "שם מסך לא ידוע" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "פקודה לא ידועה" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "חיפוש לא תקין" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "מצב חיפוש לא ידוע" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "פרמטר קונפיג לא ידוע" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "המסוף ללא תמיכה בצבעים" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "מחיקת פריט זה בלתי אפשרית" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/hu.po -> ncmpc-0.36.tar.xz/po/hu.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2009-09-24 21:45+0000\n" "Last-Translator: Kiszel Kristóf <Unknown>\n" "Language-Team: Hungarian <hu@li.org>\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2010-09-07 18:28+0000\n" "X-Generator: Launchpad (build Unknown)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Minden szám" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "%s előadó albumai" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "'%s' hozzáadása a lejátszólistához" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Minden előadó" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "A(z) %s gomb a követlezőkhoz van rendelve: %s és %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -307,8 +283,8 @@ msgstr "Ugrás oda" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Előadó képernyő" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -349,116 +325,131 @@ msgid "Chat screen" msgstr "Kövezkező képernyő" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Hiba" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Hibás gyorsbillentyű definíció" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Hiányos gyorsbillentyű definíció" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Ismeretlen parancs" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Hiányos gyorsbillentyű definíció" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Hibás időkijelzési típus" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Hiányzó egyenlőség jel" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Hibás szín megnevezés" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Hiányos szín megadás" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Érvénytelen szám" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Hibás szín megadás" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Ismeretlen képernyő név" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Ismeretlen parancs" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Érvénytelen keresési mód" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Ismeretlen keresési mód" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Ismeretlen konfigurációs paraméter" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "A terminál nem támogatja a színek változtatását" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Ez az elem nem törölhető" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.36.tar.xz/po/ie.po
Added
@@ -0,0 +1,1168 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the ncmpc package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: ncmpc\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-10-17 11:53+0200\n" +"PO-Revision-Date: 2019-05-19 12:49+0000\n" +"Last-Translator: OIS <mistresssilvara@hotmail.com>\n" +"Language-Team: Occidental <https://hosted.weblate.org/projects/ncmpc/" +"translations/ie/>\n" +"Language: ie\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.7-dev\n" + +#: src/Bindings.cxx:81 src/Bindings.cxx:87 +#, c-format +msgid "Key %s assigned to %s and %s" +msgstr "" + +#: src/ChatPage.cxx:63 src/ChatPage.cxx:181 +msgid "Chat" +msgstr "Conversation" + +#: src/ChatPage.cxx:162 +msgid "Your message" +msgstr "Vor missage" + +#: src/ChatPage.cxx:171 +msgid "Message could not be sent" +msgstr "" + +#: src/Command.cxx:29 +msgid "Key configuration screen" +msgstr "Ecran de rapid-tastes" + +#: src/Command.cxx:32 +msgid "Quit" +msgstr "Surtir" + +#: src/Command.cxx:36 +msgid "Move cursor up" +msgstr "" + +#: src/Command.cxx:38 +msgid "Move cursor down" +msgstr "" + +#: src/Command.cxx:40 +msgid "Move cursor to the top of screen" +msgstr "" + +#: src/Command.cxx:42 +msgid "Move cursor to the middle of screen" +msgstr "" + +#: src/Command.cxx:44 +msgid "Move cursor to the bottom of screen" +msgstr "" + +#: src/Command.cxx:46 +msgid "Move cursor to the top of the list" +msgstr "" + +#: src/Command.cxx:48 +msgid "Move cursor to the bottom of the list" +msgstr "" + +#: src/Command.cxx:50 +msgid "Page up" +msgstr "Págine ad-up" + +#: src/Command.cxx:52 +msgid "Page down" +msgstr "Págine a-bass" + +#: src/Command.cxx:54 +msgid "Range selection" +msgstr "Selection de un range" + +#: src/Command.cxx:56 +msgid "Scroll down one line" +msgstr "" + +#: src/Command.cxx:58 +msgid "Scroll up one line" +msgstr "" + +#: src/Command.cxx:60 +msgid "Scroll up half a screen" +msgstr "" + +#: src/Command.cxx:62 +msgid "Scroll down half a screen" +msgstr "" + +#: src/Command.cxx:64 +msgid "Select currently playing song" +msgstr "Selecter li reproductet canzone" + +#: src/Command.cxx:69 +msgid "Help screen" +msgstr "Ecran de auxilie" + +#: src/Command.cxx:71 src/HelpPage.cxx:140 +msgid "Queue screen" +msgstr "Ecran de linea" + +#: src/Command.cxx:73 src/HelpPage.cxx:155 +msgid "Browse screen" +msgstr "Ecran de navigator" + +#: src/Command.cxx:78 +msgid "Play/Enter directory" +msgstr "Reproducter/Intrar un directoria" + +#: src/Command.cxx:80 +msgid "Pause" +msgstr "Pausar" + +#: src/Command.cxx:82 +msgid "Stop" +msgstr "Stoppar" + +#: src/Command.cxx:84 +msgid "Crop" +msgstr "Tonder" + +#: src/Command.cxx:86 +msgid "Next track" +msgstr "Sequent track" + +#: src/Command.cxx:88 +msgid "Previous track" +msgstr "Precedent track" + +#: src/Command.cxx:90 +msgid "Seek forward" +msgstr "Ear avan" + +#: src/Command.cxx:92 +msgid "Seek backward" +msgstr "Ear retro" + +#: src/Command.cxx:94 +msgid "Increase volume" +msgstr "Augmentar li volúmine" + +#: src/Command.cxx:96 +msgid "Decrease volume" +msgstr "Diminuer li volúmine" + +#: src/Command.cxx:98 +msgid "Select/deselect song in queue" +msgstr "(De)selecter un canzone in linea" + +#: src/Command.cxx:100 +msgid "Select all listed items" +msgstr "Selecter omni elementes de un liste" + +#: src/Command.cxx:102 +msgid "Delete song from queue" +msgstr "Deleter un canzone ex li linea" + +#: src/Command.cxx:104 +msgid "Shuffle queue" +msgstr "Mixter li linea" + +#: src/Command.cxx:106 +msgid "Clear queue" +msgstr "Vacuar li linea" + +#: src/Command.cxx:108 +msgid "Toggle repeat mode" +msgstr "Repetir yes/no" + +#: src/Command.cxx:110 +msgid "Toggle random mode" +msgstr "Órdine hasardal yes/no" + +#: src/Command.cxx:112 +msgid "Toggle single mode" +msgstr "Singul mode on/off" + +#: src/Command.cxx:114 +msgid "Toggle consume mode" +msgstr "Consumption yes/no" + +#: src/Command.cxx:116 +msgid "Toggle crossfade mode" +msgstr "" + +#: src/Command.cxx:118
View file
ncmpc-0.32.tar.xz/po/it.po -> ncmpc-0.36.tar.xz/po/it.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2010-10-31 19:53+0000\n" "Last-Translator: simone.sandri <Unknown>\n" "Language-Team: Italian <it@li.org>\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2011-01-05 20:00+0000\n" "X-Generator: Launchpad (build 12138)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Tutte le piste" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Album del artista: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Aggiungendo '%s' alla lista di canzoni" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Tutti gli artisti" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -305,7 +281,7 @@ msgstr "" #: src/Command.cxx:180 -msgid "Artist screen" +msgid "Library page" msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 @@ -347,116 +323,130 @@ msgid "Chat screen" msgstr "Lista di canzoni" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "" -#. the hotkey configuration contains an unknown -#. command -#: src/conf.cxx:178 -msgid "Unknown command" +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" msgstr "" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" +#. the hotkey configuration +#. contains an unknown +#. command +#: src/ConfigParser.cxx:187 +msgid "Unknown command" msgstr "" -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +msgid "Unknown MPD tag" +msgstr "" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Non è possibile rimuovere questo elemento." -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format msgid "Delete playlist %s?" msgstr "Rimuove la playlist"
View file
ncmpc-0.32.tar.xz/po/ko.po -> ncmpc-0.36.tar.xz/po/ko.po
Changed
@@ -7,57 +7,35 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" -"PO-Revision-Date: 2009-10-16 17:35+0000\n" -"Last-Translator: Jay Whang <jaypedia@gmail.com>\n" -"Language-Team: Korean <ko@li.org>\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2019-09-16 09:02+0000\n" +"Last-Translator: Min Ho Park <parkmino@gmail.com>\n" +"Language-Team: Korean <https://hosted.weblate.org/projects/ncmpc/" +"translations/ko/>\n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.9-dev\n" "X-Launchpad-Export-Date: 2009-10-19 13:36+0000\n" -"X-Generator: Launchpad (build Unknown)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "모든 트랙" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "앨범" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "아티스트의 앨범: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "'%s'(을)를 연주목록에 더하기" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "모든 아티스트" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" -msgstr "키 %s (이)가 %s (와)과 %s (으)로 지정되었습니다." +msgstr "%s 키가 %s 및 %s 에 지정됨" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" -msgstr "" +msgstr "채팅" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" -msgstr "" +msgstr "나의 메시지" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" -msgstr "" +msgstr "메시지를 보낼 수 없습니다" #: src/Command.cxx:29 msgid "Key configuration screen" @@ -65,7 +43,7 @@ #: src/Command.cxx:32 msgid "Quit" -msgstr "끝내기" +msgstr "나가기" #: src/Command.cxx:36 msgid "Move cursor up" @@ -89,11 +67,11 @@ #: src/Command.cxx:46 msgid "Move cursor to the top of the list" -msgstr "커서를 리스트 맨 위로 옮기기" +msgstr "커서를 목록 맨 위로 옮기기" #: src/Command.cxx:48 msgid "Move cursor to the bottom of the list" -msgstr "커서를 리스트 맨 아래로 옮기기" +msgstr "커서를 목록 맨 아래로 옮기기" #: src/Command.cxx:50 msgid "Page up" @@ -125,28 +103,27 @@ #: src/Command.cxx:64 msgid "Select currently playing song" -msgstr "현재 재생중인 곡을 선택" +msgstr "지금 연주 중인 곡을 선택" #: src/Command.cxx:69 msgid "Help screen" -msgstr "도움말 화면" +msgstr "도움 화면" #: src/Command.cxx:71 src/HelpPage.cxx:140 -#, fuzzy msgid "Queue screen" -msgstr "키설정 화면" +msgstr "순서 화면" #: src/Command.cxx:73 src/HelpPage.cxx:155 msgid "Browse screen" -msgstr "열람하기 화면" +msgstr "음원 화면" #: src/Command.cxx:78 msgid "Play/Enter directory" -msgstr "연주/디렉토리 입력" +msgstr "연주/디렉터리 입력" #: src/Command.cxx:80 msgid "Pause" -msgstr "일시정지" +msgstr "잠깐 멈춤" #: src/Command.cxx:82 msgid "Stop" @@ -154,15 +131,15 @@ #: src/Command.cxx:84 msgid "Crop" -msgstr "연주중인 곡만 선택" +msgstr "선택" #: src/Command.cxx:86 msgid "Next track" -msgstr "다음 트랙" +msgstr "다음 곡" #: src/Command.cxx:88 msgid "Previous track" -msgstr "이전 트랙" +msgstr "이전 곡" #: src/Command.cxx:90 msgid "Seek forward" @@ -181,38 +158,36 @@ msgstr "음량 낮추기" #: src/Command.cxx:98 -#, fuzzy msgid "Select/deselect song in queue" -msgstr "연주목록에서 곡 선택/해제" +msgstr "순서에서 곡 선택함/안 함" #: src/Command.cxx:100 msgid "Select all listed items" -msgstr "나열한 항목 모두 선택하기" +msgstr "목록의 모든 항목 선택" #: src/Command.cxx:102 -#, fuzzy msgid "Delete song from queue" -msgstr "연주목록에서 곡 삭제하기" +msgstr "순서에서 곡 지우기" #: src/Command.cxx:104 msgid "Shuffle queue" -msgstr "" +msgstr "순서 뒤섞기" #: src/Command.cxx:106 msgid "Clear queue" -msgstr "" +msgstr "순서 지우기" #: src/Command.cxx:108 msgid "Toggle repeat mode" -msgstr "반복연주 모드 토클" +msgstr "반복연주 모드 토글" #: src/Command.cxx:110 msgid "Toggle random mode" -msgstr "무작위연주 모드 토클" +msgstr "무작위연주 모드 토글" #: src/Command.cxx:112 msgid "Toggle single mode" -msgstr "싱글 모드 토글" +msgstr "한 곡 모드 토글" #: src/Command.cxx:114 msgid "Toggle consume mode" @@ -220,32 +195,31 @@ #: src/Command.cxx:116
View file
ncmpc-0.32.tar.xz/po/meson.build -> ncmpc-0.36.tar.xz/po/meson.build
Changed
@@ -1,28 +1,3 @@ i18n = import('i18n') -langs = [ - 'cs', - 'da', - 'de', - 'eo', - 'es', - 'fi', - 'fr', - 'gl', - 'he', - 'hu', - 'it', - 'ko', - 'nb', - 'nl', - 'pl', - 'pt_BR', - 'ru', - 'sk', - 'sv', - 'uk', - 'zh_CN', -] - -#i18n.gettext('ncmpc', languages: langs) i18n.gettext('ncmpc', preset: 'glib')
View file
ncmpc-0.32.tar.xz/po/nb.po -> ncmpc-0.36.tar.xz/po/nb.po
Changed
@@ -7,56 +7,33 @@ msgstr "" "Project-Id-Version: ncmpc 0.11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" -"PO-Revision-Date: 2018-09-18 11:08+0000\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2019-09-09 12:25+0000\n" "Last-Translator: Allan Nordhøy <epost@anotheragency.no>\n" "Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/ncmpc/" -"translations/nb/>\n" +"translations/nb_NO/>\n" "Language: nb\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.2-dev\n" +"X-Generator: Weblate 3.9-dev\n" "X-Launchpad-Export-Date: 2010-07-21 05:36+0000\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Alle spor" - -#: src/AlbumListPage.cxx:144 -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Albumer fra artist: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, c-format -msgid "Adding '%s' to queue" -msgstr "Legger til \"%s\" i spillelisten" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Alle artister" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "%s-tasten satt til %s og %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "Sludre" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "Din melding" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "Meldingen kunne ikke sendes" @@ -307,8 +284,8 @@ msgstr "Gå til" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Artistskjerm" +msgid "Library page" +msgstr "Biblioteksside" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -349,116 +326,131 @@ msgid "Chat screen" msgstr "Sludreskjerm" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Feil" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "Ord forventet" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Malformert hurtigtastdefinisjon" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Uferdig hurtigtastkonfigurasjon" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Ukjent kommando" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Uferdig hurtigtastkonfigurasjon" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Ugyldig tidsvisningstype" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Mangler '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Ugyldig fargenavn" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Uferdig fargedefinisjon" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Ugyldig tall" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Malformert fargedefinisjon" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Ukjent skjermnavn" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Ukjent kommando" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Ugyldig søkemodus" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Ukjent søkemodus" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Ukjent konfiurasjonsparameter" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Terminalen mangler støtte for omdefinering av farger" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260
View file
ncmpc-0.32.tar.xz/po/ncmpc.pot -> ncmpc-0.36.tar.xz/po/ncmpc.pot
Changed
@@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\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" @@ -17,43 +17,20 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "" - -#: src/AlbumListPage.cxx:144 -msgid "Albums" -msgstr "" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, c-format -msgid "Adding '%s' to queue" -msgstr "" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -301,7 +278,7 @@ msgstr "" #: src/Command.cxx:180 -msgid "Artist screen" +msgid "Library page" msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 @@ -342,116 +319,130 @@ msgid "Chat screen" msgstr "" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "" -#. the hotkey configuration contains an unknown -#. command -#: src/conf.cxx:178 -msgid "Unknown command" +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" msgstr "" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" +#. the hotkey configuration +#. contains an unknown +#. command +#: src/ConfigParser.cxx:187 +msgid "Unknown command" msgstr "" -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +msgid "Unknown MPD tag" +msgstr "" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, c-format msgid "Delete playlist %s?" msgstr "" #. translators: a dialog was aborted by the user
View file
ncmpc-0.32.tar.xz/po/nl.po -> ncmpc-0.36.tar.xz/po/nl.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2010-02-24 11:17+0000\n" "Last-Translator: Tom Postma <tom-postma@hetnet.nl>\n" "Language-Team: Dutch <nl@li.org>\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2010-04-05 17:16+0000\n" "X-Generator: Launchpad (build Unknown)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Alle nummers" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Albums van artiest: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Toevoegen '%s' aan afspeellijst" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Alle artiesten" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -303,7 +279,7 @@ msgstr "" #: src/Command.cxx:180 -msgid "Artist screen" +msgid "Library page" msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 @@ -344,116 +320,130 @@ msgid "Chat screen" msgstr "" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "" -#. the hotkey configuration contains an unknown -#. command -#: src/conf.cxx:178 -msgid "Unknown command" +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" msgstr "" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" +#. the hotkey configuration +#. contains an unknown +#. command +#: src/ConfigParser.cxx:187 +msgid "Unknown command" msgstr "" -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +msgid "Unknown MPD tag" +msgstr "" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format msgid "Delete playlist %s?" msgstr "Afspeellijst verwijderen"
View file
ncmpc-0.32.tar.xz/po/pl.po -> ncmpc-0.36.tar.xz/po/pl.po
Changed
@@ -8,57 +8,35 @@ msgstr "" "Project-Id-Version: ncmpc 0.19\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" -"PO-Revision-Date: 2011-07-23 21:08+0200\n" -"Last-Translator: <krzysztof.krakowiak@gmail.com>\n" -"Language-Team: Polish\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2018-10-05 17:33+0000\n" +"Last-Translator: Mirosław Borodeńko <myros@outlook.com>\n" +"Language-Team: Polish <https://hosted.weblate.org/projects/ncmpc/" +"translations/pl/>\n" "Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.2\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Wszystkie ścieżki" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Albumy artysty: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Dodawanie '%s' do listy odtwarzania" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Wszyscy artyści" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Klawisz %s przypisany do %s oraz %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" -msgstr "" +msgstr "Rozmowa" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" -msgstr "" +msgstr "Twoja wiadomość" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" -msgstr "" +msgstr "Wiadomość nie mogła zostać wysłana" #: src/Command.cxx:29 msgid "Key configuration screen" @@ -133,9 +111,8 @@ msgstr "Ekran pomocy" #: src/Command.cxx:71 src/HelpPage.cxx:140 -#, fuzzy msgid "Queue screen" -msgstr "Ekran definicji klawiszy" +msgstr "Ekran listy odtwarzania" #: src/Command.cxx:73 src/HelpPage.cxx:155 msgid "Browse screen" @@ -163,7 +140,7 @@ #: src/Command.cxx:88 msgid "Previous track" -msgstr "Poprzednia ściężka" +msgstr "Poprzednia ścieżka" #: src/Command.cxx:90 msgid "Seek forward" @@ -182,26 +159,24 @@ msgstr "Przycisz" #: src/Command.cxx:98 -#, fuzzy msgid "Select/deselect song in queue" -msgstr "Zaznacz/odznacz piosenkę na liście odtwarzania" +msgstr "Zaznacz/odznacz utwór na liście odtwarzania" #: src/Command.cxx:100 msgid "Select all listed items" -msgstr "Zazczacz wszystkie wylistowane pozycje" +msgstr "Zaznacz wszystkie wyświetlone pozycje" #: src/Command.cxx:102 -#, fuzzy msgid "Delete song from queue" -msgstr "Usuń piosenkę z listy odtwarzania" +msgstr "Usuń utwór z listy odtwarzania" #: src/Command.cxx:104 msgid "Shuffle queue" -msgstr "" +msgstr "Przetasuj listę odtwarzania" #: src/Command.cxx:106 msgid "Clear queue" -msgstr "" +msgstr "Wyczyść listę odtwarzania" #: src/Command.cxx:108 msgid "Toggle repeat mode" @@ -225,16 +200,15 @@ #: src/Command.cxx:118 msgid "Start a music database update" -msgstr "Włącz aktualizacje bazy piosenek" +msgstr "Rozpocznij aktualizacje bazy piosenek" #: src/Command.cxx:120 msgid "Save queue" -msgstr "" +msgstr "Zapisz listę odtwarzania" #: src/Command.cxx:122 src/HelpPage.cxx:174 -#, fuzzy msgid "Append song to queue" -msgstr "Dodaj piosenkę do listy odtwarzania" +msgstr "Dodaj utwór do listy odtwarzania" #: src/Command.cxx:125 msgid "Go to root directory" @@ -258,7 +232,7 @@ #: src/Command.cxx:138 msgid "Refresh screen" -msgstr "Odświerz ekran" +msgstr "Odśwież ekran" #. translators: toggle between wrapping and non-wrapping #. search @@ -282,7 +256,7 @@ #: src/Command.cxx:158 msgid "Swap to most recent screen" -msgstr "Przełącz do najbardziej aktualnego ekranu" +msgstr "Przełącz do najnowszego ekranu" #: src/Command.cxx:163 msgid "Forward find" @@ -308,8 +282,8 @@ msgstr "Skocz do" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Ekran artysty" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -335,130 +309,144 @@ #: src/Command.cxx:200 msgid "Update Lyrics" -msgstr "Zaktualizuj tekst piosenki" +msgstr "Zaktualizuj tekst utworu" #: src/Command.cxx:204 msgid "Edit the current item" -msgstr "" +msgstr "Edytuj bieżący element" #: src/Command.cxx:209 src/HelpPage.cxx:196 msgid "Outputs screen" msgstr "Ekran z wyjściami dźwiękowymi" #: src/Command.cxx:214 src/HelpPage.cxx:203 -#, fuzzy msgid "Chat screen" -msgstr "Następny ekran" +msgstr "Ekran rozmowy" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Błąd"
View file
ncmpc-0.32.tar.xz/po/pt_BR.po -> ncmpc-0.36.tar.xz/po/pt_BR.po
Changed
@@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2010-12-19 01:05+0000\n" "Last-Translator: Jamerson Albuquerque Tiossi <jamersontiossi@yahoo.com.br>\n" "Language-Team: \n" @@ -16,44 +16,20 @@ "X-Poedit-Language: Portuguese\n" "X-Poedit-SourceCharset: utf-8\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Todas as faixas" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Álbum" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Álbuns do artista: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Adicionando '%s' á Lista de Reprodução" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Todos os artistas" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Tecla %s definida para %s e %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -305,8 +281,8 @@ msgstr "Pular para" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Tela de artista" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -347,116 +323,131 @@ msgid "Chat screen" msgstr "Próxima tela" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Erro" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Definição de tecla de atalho malformada" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Configuração de teclas de atalho incompleta" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Comando desconhecido" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Configuração de teclas de atalho incompleta" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Tipo de visualização de tempo ruim" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Falta '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Nome de cor ruim" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Definição de cor incompleta" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Número inválido" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Definição de cor malformada" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Nome de tela desconhecido" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Comando desconhecido" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Modo de pesquisa inválido" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Modo de pesquisa desconhecido" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Parâmetro de configuração desconhecido" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Terminal não tem suporte para mudar cores" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Deletar este item não é possível" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/ru.po -> ncmpc-0.36.tar.xz/po/ru.po
Changed
@@ -7,53 +7,33 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" -"PO-Revision-Date: 2017-09-05 20:47+0700\n" -"Last-Translator: Max Arnold <lwarxx@gmail.com>\n" -"Language-Team: ru <ru@li.org>\n" -"Language: \n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2019-05-19 12:49+0000\n" +"Last-Translator: OIS <mistresssilvara@hotmail.com>\n" +"Language-Team: Russian <https://hosted.weblate.org/projects/ncmpc/" +"translations/ru/>\n" +"Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.7-dev\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Все композиции" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Альбом" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Альбомы исполнителя: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, c-format -msgid "Adding '%s' to queue" -msgstr "В очередь добавляется '%s'" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Все исполнители" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Клавиша %s назначена для %s и %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "Чат" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "Ваше сообщение" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "Сообщение не может быть отправлено" @@ -301,8 +281,8 @@ msgstr "Перейти к" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Экран исполнителей" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -342,115 +322,130 @@ msgid "Chat screen" msgstr "Экран чата" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Ошибка" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" -msgstr "" +msgstr "Ожидалось слово" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Неправильное значение клавиатурной комбинации" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Неопределённое значение клавиатурной комбинации" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Неизвестная команда" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Неопределённое значение клавиатурной комбинации" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Неверный тип отображения времени" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Пропущен символ '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Неверное название цвета" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Неопределённое значение цвета" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Неверное число" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Неправильное значение цвета" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Неизвестное название экрана" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Неизвестная команда" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Неверный режим поиска" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Неизвестный режим поиска" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Неизвестный параметр конфигурации" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Терминал не поддерживает смену цветов" #. translators: the "delete" command is only possible
View file
ncmpc-0.32.tar.xz/po/sk.po -> ncmpc-0.36.tar.xz/po/sk.po
Changed
@@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: ncmpc 0.11.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2010-04-07 01:36+0000\n" "Last-Translator: Roman Horník <Unknown>\n" "Language-Team: sk <sk@li.org>\n" @@ -17,44 +17,20 @@ "X-Launchpad-Export-Date: 2010-06-19 15:12+0000\n" "X-Generator: Launchpad (build Unknown)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Všetky stopy" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Albumy od interpreta: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Pridávam '%s' do playlistu" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Všetci interpreti" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Kláves %s priradený k %s a %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -306,8 +282,8 @@ msgstr "Skok na" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Okno interpreta" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -348,116 +324,131 @@ msgid "Chat screen" msgstr "Ďalšia obrazovka" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Chyba" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Chybne zadaná definícia klávesovej skratky" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Neúplná konfigurácie klavesových skratiek" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Neznámy príkaz" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Neúplná konfigurácie klavesových skratiek" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Nesprávny typ zobrazovania času" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Chýba '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Nesprávny názov farby" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Neúplná definícia farby" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Neplatné číslo" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Zle zadaná definícia farby" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Neznámy názov obrazovky" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Neznámy príkaz" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Neplatný režim vyhľadávania" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Neznámy režim vyhľadávania" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Neznámy parameter konfigurácie" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Terminál nemá podporu pre zmenu farieb" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Zmazanie tejto položky nie je možné" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/sv.po -> ncmpc-0.36.tar.xz/po/sv.po
Changed
@@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: ncmpc 0.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2010-04-14 05:21+0000\n" "Last-Translator: Rickard Närström <rickard.narstrom@gmail.com>\n" "Language-Team: sv <sv@li.org>\n" @@ -18,44 +18,20 @@ "X-Launchpad-Export-Date: 2010-06-19 15:12+0000\n" "X-Generator: Launchpad (build Unknown)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Alla spår" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Album" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Album av artist: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Lägger till '%s' till spellista" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Alla artister" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Tangent %s tilldelad %s och %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -307,8 +283,8 @@ msgstr "Hoppa till" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Artister" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -349,116 +325,131 @@ msgid "Chat screen" msgstr "Nästa skärm" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Fel" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Dålig tangentdefinition" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Inkomplett tangentdefinition" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Okänt kommando" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Inkomplett tangentdefinition" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Felaktigt tidsformat" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Saknar '='" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Felaktigt färgnamn" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Inkomplett färgdefinition" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Ogiltigt nummer" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Felaktig färgdefinition" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Skärmnamn okänt" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Okänt kommando" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Okänd konfigurationsinställning" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Terminalen saknar stöd för växling av färger" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Du kan inte ta bort det här föremålet" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/uk.po -> ncmpc-0.36.tar.xz/po/uk.po
Changed
@@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" "PO-Revision-Date: 2011-08-11 10:30+0300\n" "Last-Translator: Oleksandr Kovalenko <alx.kovalenko@gmail.com>\n" "Language-Team: Ukrainian <uk@li.org>\n" @@ -19,44 +19,20 @@ "X-Poedit-Language: Ukrainian\n" "X-Poedit-Country: UKRAINE\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "Всі доріжки" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "Альбом" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "Альбоми виконавця: %s" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "Додається '%s' до переліку програвання" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "Всі виконавці" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "Клавіша %s призначена до %s та %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" msgstr "" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" msgstr "" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" msgstr "" @@ -308,8 +284,8 @@ msgstr "Перейти до" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "Екран виконавців" +msgid "Library page" +msgstr "" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -350,116 +326,131 @@ msgid "Chat screen" msgstr "Наступний екран" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "Помилка" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" msgstr "" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "Неправильне визначення гарячої клавіші" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "Незавершена конфігурація гарячих клавіш" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "Невідома команда" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "Незавершена конфігурація гарячих клавіш" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being +#. played; in this case, the +#. configuration file +#. contained an invalid +#. setting +#: src/ConfigParser.cxx:223 msgid "Bad time display type" msgstr "Неправильний тип показу часу" #. an equals sign '=' was expected while parsing a #. configuration file line -#: src/conf.cxx:240 src/conf.cxx:418 +#: src/ConfigParser.cxx:239 src/ConfigParser.cxx:469 msgid "Missing '='" msgstr "Відсутній \"=\"" -#: src/conf.cxx:291 +#: src/ConfigParser.cxx:288 msgid "Bad color name" msgstr "Неправильна назва кольору" -#: src/conf.cxx:301 +#: src/ConfigParser.cxx:297 msgid "Incomplete color definition" msgstr "Незавершене визначення кольору" -#: src/conf.cxx:307 +#: src/ConfigParser.cxx:303 msgid "Invalid number" msgstr "Неправильне число" -#: src/conf.cxx:315 +#: src/ConfigParser.cxx:310 msgid "Malformed color definition" msgstr "Неправильне визначення кольору" -#. an unknown screen name was specified in the -#. configuration file -#: src/conf.cxx:353 +#. an unknown screen +#. name was specified +#. in the +#. configuration +#. file +#: src/ConfigParser.cxx:374 msgid "Unknown screen name" msgstr "Невідома назва екрану" -#: src/conf.cxx:378 +#: src/ConfigParser.cxx:403 +#, fuzzy +msgid "Unknown MPD tag" +msgstr "Невідома команда" + +#: src/ConfigParser.cxx:430 msgid "Invalid search mode" msgstr "Помилковий режим пошуку" -#: src/conf.cxx:398 +#: src/ConfigParser.cxx:448 msgid "Unknown search mode" msgstr "Невідомий режим пошуку" -#: src/conf.cxx:581 +#: src/ConfigParser.cxx:636 msgid "Unknown configuration parameter" msgstr "Невідомий конфігураційний параметр" -#: src/CustomColors.cxx:56 +#: src/CustomColors.cxx:57 msgid "Terminal lacks support for changing colors" msgstr "Терміналу бракує підтримки зміни кольорів" #. translators: the "delete" command is only possible #. for playlists; the user attempted to delete a song #. or a directory or something else -#: src/FileBrowserPage.cxx:260 +#: src/FileBrowserPage.cxx:248 msgid "Deleting this item is not possible" msgstr "Видалити цей елемент неможливо" -#: src/FileBrowserPage.cxx:268 +#: src/FileBrowserPage.cxx:256 #, fuzzy, c-format
View file
ncmpc-0.32.tar.xz/po/zh_CN.po -> ncmpc-0.36.tar.xz/po/zh_CN.po
Changed
@@ -7,57 +7,35 @@ msgstr "" "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 22:53+0200\n" -"PO-Revision-Date: 2011-05-12 15:00+0000\n" -"Last-Translator: snowdream <yanghui1986527@gmail.com>\n" -"Language-Team: Simplified Chinese <zh_CN@li.org>\n" -"Language: \n" +"POT-Creation-Date: 2019-10-08 17:59+0200\n" +"PO-Revision-Date: 2019-09-16 09:02+0000\n" +"Last-Translator: 谭志新 <tanzhxin@hotmail.com>\n" +"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/" +"ncmpc/translations/zh_Hans/>\n" +"Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.9-dev\n" "X-Launchpad-Export-Date: 2011-06-23 08:56+0000\n" -"X-Generator: Launchpad (build 13265)\n" -#: src/AlbumListPage.cxx:54 src/AlbumListPage.cxx:126 -msgid "All tracks" -msgstr "全部音轨" - -#: src/AlbumListPage.cxx:144 -#, fuzzy -msgid "Albums" -msgstr "专辑" - -#: src/AlbumListPage.cxx:146 -#, c-format -msgid "Albums of artist: %s" -msgstr "%s 的专辑:" - -#: src/AlbumListPage.cxx:174 src/ArtistListPage.cxx:137 -#: src/FileListPage.cxx:161 src/FileListPage.cxx:248 src/FileListPage.cxx:273 -#, fuzzy, c-format -msgid "Adding '%s' to queue" -msgstr "添加 '%s' 到播放列表" - -#: src/ArtistListPage.cxx:114 -msgid "All artists" -msgstr "全部艺术家" - -#: src/Bindings.cxx:79 src/Bindings.cxx:85 +#: src/Bindings.cxx:81 src/Bindings.cxx:87 #, c-format msgid "Key %s assigned to %s and %s" msgstr "按键 %s 分配给 %s 和 %s" -#: src/ChatPage.cxx:57 src/ChatPage.cxx:179 +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" -msgstr "" +msgstr "对话" -#: src/ChatPage.cxx:160 +#: src/ChatPage.cxx:163 msgid "Your message" -msgstr "" +msgstr "你的讯息" -#: src/ChatPage.cxx:169 +#: src/ChatPage.cxx:172 msgid "Message could not be sent" -msgstr "" +msgstr "讯息无法送出" #: src/Command.cxx:29 msgid "Key configuration screen" @@ -132,9 +110,8 @@ msgstr "帮助页面" #: src/Command.cxx:71 src/HelpPage.cxx:140 -#, fuzzy msgid "Queue screen" -msgstr "键定义页面" +msgstr "列表页面" #: src/Command.cxx:73 src/HelpPage.cxx:155 msgid "Browse screen" @@ -181,26 +158,24 @@ msgstr "降低音量" #: src/Command.cxx:98 -#, fuzzy msgid "Select/deselect song in queue" -msgstr "添加/删除选中文件到播放列表" +msgstr "选中/不选当前列表的歌曲" #: src/Command.cxx:100 msgid "Select all listed items" msgstr "选中所有列出的项" #: src/Command.cxx:102 -#, fuzzy msgid "Delete song from queue" -msgstr "从播放列表中删除歌曲" +msgstr "从播放列表中移除歌曲" #: src/Command.cxx:104 msgid "Shuffle queue" -msgstr "" +msgstr "随机播放列表" #: src/Command.cxx:106 msgid "Clear queue" -msgstr "" +msgstr "清空播放列表" #: src/Command.cxx:108 msgid "Toggle repeat mode" @@ -228,10 +203,9 @@ #: src/Command.cxx:120 msgid "Save queue" -msgstr "" +msgstr "保存播放列表" #: src/Command.cxx:122 src/HelpPage.cxx:174 -#, fuzzy msgid "Append song to queue" msgstr "添加到播放列表" @@ -307,8 +281,8 @@ msgstr "跳转到" #: src/Command.cxx:180 -msgid "Artist screen" -msgstr "艺术家页面" +msgid "Library page" +msgstr "曲库页面" #: src/Command.cxx:184 src/HelpPage.cxx:169 msgid "Search screen" @@ -338,126 +312,139 @@ #: src/Command.cxx:204 msgid "Edit the current item" -msgstr "" +msgstr "编辑当前条目" #: src/Command.cxx:209 src/HelpPage.cxx:196 msgid "Outputs screen" msgstr "输出页面" #: src/Command.cxx:214 src/HelpPage.cxx:203 -#, fuzzy msgid "Chat screen" -msgstr "下一页面" +msgstr "对话页面" -#. To translators: prefix for error messages -#: src/conf.cxx:114 src/screen_keydef.cxx:414 src/screen_keydef.cxx:423 -msgid "Error" -msgstr "错误" - -#: src/conf.cxx:128 +#: src/ConfigParser.cxx:119 msgid "Word expected" -msgstr "" +msgstr "建议字符" -#: src/conf.cxx:145 src/conf.cxx:154 +#: src/ConfigParser.cxx:145 src/ConfigParser.cxx:154 msgid "Malformed hotkey definition" msgstr "不正确的快捷键定义" -#. the hotkey configuration contains an unknown +#. the hotkey configuration +#. line is incomplete +#: src/ConfigParser.cxx:173 +msgid "Incomplete hotkey configuration" +msgstr "不完整的快捷键配置" + +#. the hotkey configuration +#. contains an unknown #. command -#: src/conf.cxx:178 +#: src/ConfigParser.cxx:187 msgid "Unknown command" msgstr "未知命令" -#. the hotkey configuration line is incomplete -#: src/conf.cxx:191 -msgid "Incomplete hotkey configuration" -msgstr "不完整的快捷键配置" - -#. translators: ncmpc supports displaying the -#. "elapsed" or "remaining" time of a song being -#. played; in this case, the configuration file -#. contained an invalid setting -#: src/conf.cxx:227 +#. translators: ncmpc +#. supports displaying the +#. "elapsed" or "remaining" +#. time of a song being
View file
ncmpc-0.36.tar.xz/src/AsioGetIoService.hxx
Added
@@ -0,0 +1,54 @@ +/* + * Copyright 2019 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ASIO_GET_IO_SERVICE_HXX +#define ASIO_GET_IO_SERVICE_HXX + +#if BOOST_VERSION >= 106600 +#include <boost/asio/io_service.hpp> +#endif + +/** + * Returns the #io_service/#io_context reference from a boost::asio + * object. This is a compatibility function which works with Boost + * 1.68+ where #io_service was renamed to #io_context and + * get_io_service() was replaced with get_executor(). + */ +template<typename T> +inline auto & +get_io_service(T &t) noexcept +{ +#if BOOST_VERSION >= 106600 + return (boost::asio::io_context &)t.get_executor().context(); +#else + return t.get_io_service(); +#endif +} + +#endif
View file
ncmpc-0.32.tar.xz/src/AsioServiceFwd.hxx -> ncmpc-0.36.tar.xz/src/AsioServiceFwd.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -33,7 +33,7 @@ boost::asio::io_context; eventually, we'll switch to the new API, but this would require dropping support for older Boost versions */ -#include <boost/asio/io_service.hpp> +#include <boost/asio/io_service.hpp> // IWYU pragma: export #else namespace boost { namespace asio { class io_service; }}
View file
ncmpc-0.36.tar.xz/src/AsyncUserInput.cxx
Added
@@ -0,0 +1,106 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "AsyncUserInput.hxx" +#include "Command.hxx" +#include "Bindings.hxx" +#include "GlobalBindings.hxx" +#include "ncmpc.hxx" +#include "Point.hxx" +#include "util/Compiler.h" + +static bool +ignore_key(int key) +{ + return key == ERR || key == '\0'; +} + +gcc_pure +static Command +translate_key(int key) +{ + return GetGlobalKeyBindings().FindKey(key); +} + +void +AsyncUserInput::OnReadable(const boost::system::error_code &error) +{ + if (error) { + get_io_context().stop(); + return; + } + + int key = wgetch(&w); + if (ignore_key(key)) { + AsyncWait(); + return; + } + +#ifdef HAVE_GETMOUSE + if (key == KEY_MOUSE) { + MEVENT event; + + /* retrieve the mouse event from curses */ +#ifdef PDCURSES + nc_getmouse(&event); +#else + getmouse(&event); +#endif + + begin_input_event(); + do_mouse_event({event.x, event.y}, event.bstate); + end_input_event(); + + AsyncWait(); + return; + } +#endif + + Command cmd = translate_key(key); + if (cmd == Command::NONE) { + AsyncWait(); + return; + } + + begin_input_event(); + + if (!do_input_event(get_io_context(), cmd)) + return; + + end_input_event(); + AsyncWait(); +} + +AsyncUserInput::AsyncUserInput(boost::asio::io_service &io_service, WINDOW &_w) + :UserInput(io_service), w(_w) +{ + AsyncWait(); +} + +void +keyboard_unread(boost::asio::io_service &io_service, int key) +{ + if (ignore_key(key)) + return; + + Command cmd = translate_key(key); + if (cmd != Command::NONE) + do_input_event(io_service, cmd); +}
View file
ncmpc-0.36.tar.xz/src/AsyncUserInput.hxx
Added
@@ -0,0 +1,45 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef ASYNC_USER_INPUT_HXX +#define ASYNC_USER_INPUT_HXX + +#include "UserInput.hxx" + +#include <curses.h> + +class AsyncUserInput : public UserInput { + WINDOW &w; + +public: + AsyncUserInput(boost::asio::io_service &io_service, WINDOW &_w); + +private: + void AsyncWait() { + UserInput::AsyncWait(std::bind(&AsyncUserInput::OnReadable, this, + std::placeholders::_1)); + } + + void OnReadable(const boost::system::error_code &error); +}; + +void +keyboard_unread(boost::asio::io_service &io_service, int key); + +#endif
View file
ncmpc-0.32.tar.xz/src/BasicColors.cxx -> ncmpc-0.36.tar.xz/src/BasicColors.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ #include <curses.h> -#include <string.h> +#include <strings.h> #include <stdlib.h> static constexpr const char *basic_color_names[] = { @@ -46,7 +46,7 @@ static_assert(COLOR_WHITE == 7, "Unexpected color value"); short -ParseBasicColorName(const char *name) +ParseBasicColorName(const char *name) noexcept { for (size_t i = 0; basic_color_names[i] != nullptr; ++i) if (strcasecmp(basic_color_names[i], name) == 0) @@ -56,7 +56,7 @@ } short -ParseColorNameOrNumber(const char *s) +ParseColorNameOrNumber(const char *s) noexcept { short basic = ParseBasicColorName(s); if (basic >= 0)
View file
ncmpc-0.32.tar.xz/src/BasicColors.hxx -> ncmpc-0.36.tar.xz/src/BasicColors.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -29,7 +29,7 @@ */ gcc_pure short -ParseBasicColorName(const char *name); +ParseBasicColorName(const char *name) noexcept; /** * Like ParseBasicColorName(), but also allow numeric colors. @@ -38,6 +38,6 @@ */ gcc_pure short -ParseColorNameOrNumber(const char *s); +ParseColorNameOrNumber(const char *s) noexcept; #endif
View file
ncmpc-0.32.tar.xz/src/BasicMarquee.cxx -> ncmpc-0.36.tar.xz/src/BasicMarquee.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,8 +20,6 @@ #include "BasicMarquee.hxx" #include "util/LocaleString.hxx" -#include <algorithm> - #include <assert.h> #include <string.h>
View file
ncmpc-0.32.tar.xz/src/BasicMarquee.hxx -> ncmpc-0.36.tar.xz/src/BasicMarquee.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,6 +23,7 @@ #include "util/Compiler.h" #include <string> +#include <utility> /** * This class is used to auto-scroll text which does not fit on the
View file
ncmpc-0.32.tar.xz/src/Bindings.cxx -> ncmpc-0.36.tar.xz/src/Bindings.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,6 @@ #include "Command.hxx" #include "KeyName.hxx" #include "i18n.h" -#include "util/CharUtil.hxx" #include <assert.h> #include <stdio.h> @@ -31,7 +30,7 @@ { const auto &b = key_bindings[size_t(command)]; return b.keys.front() != 0 - ? key2str(b.keys[0]) + ? GetLocalizedKeyName(b.keys[0]) : nullptr; } @@ -40,17 +39,17 @@ { const auto &b = key_bindings[size_t(command)]; - std::string s = key2str(b.keys[0]); + std::string s = GetLocalizedKeyName(b.keys[0]); for (size_t i = 1; i < b.keys.size() && b.keys[i] != 0; ++i) { s.push_back(' '); - s.append(key2str(b.keys[i])); + s.append(GetLocalizedKeyName(b.keys[i])); } return s; } Command -KeyBindings::FindKey(int key) const +KeyBindings::FindKey(int key) const noexcept { assert(key != 0); @@ -65,7 +64,7 @@ #ifndef NCMPC_MINI bool -KeyBindings::Check(char *buf, size_t bufsize) const +KeyBindings::Check(char *buf, size_t bufsize) const noexcept { bool success = true; @@ -79,13 +78,13 @@ if (buf) { snprintf(buf, bufsize, _("Key %s assigned to %s and %s"), - key2str(key), + GetLocalizedKeyName(key), get_key_command_name(Command(i)), get_key_command_name(cmd)); } else { fprintf(stderr, _("Key %s assigned to %s and %s"), - key2str(key), + GetLocalizedKeyName(key), get_key_command_name(Command(i)), get_key_command_name(cmd)); fputc('\n', stderr); @@ -100,7 +99,7 @@ void KeyBinding::WriteToFile(FILE *f, const command_definition_t &cmd, - bool comment) const + bool comment) const noexcept { fprintf(f, "## %s\n", cmd.description); if (comment) @@ -122,16 +121,13 @@ else fprintf(f, ", "); - if (key < 256 && IsAlphaNumericASCII(key)) - fprintf(f, "\'%c\'", key); - else - fprintf(f, "%d", key); + fputs(GetKeyName(key), f); } fprintf(f,"\n\n"); } bool -KeyBindings::WriteToFile(FILE *f, int flags) const +KeyBindings::WriteToFile(FILE *f, int flags) const noexcept { const auto *cmds = get_command_definitions();
View file
ncmpc-0.32.tar.xz/src/Bindings.hxx -> ncmpc-0.36.tar.xz/src/Bindings.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,7 +20,7 @@ #ifndef BINDINGS_HXX #define BINDINGS_HXX -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "Command.hxx" #include "util/Compiler.h" @@ -47,17 +47,17 @@ :keys{{a, b, c}} {} gcc_pure - bool HasKey(int key) const { + bool HasKey(int key) const noexcept { return std::find(keys.begin(), keys.end(), key) != keys.end(); } gcc_pure - size_t GetKeyCount() const { + size_t GetKeyCount() const noexcept { return std::distance(keys.begin(), std::find(keys.begin(), keys.end(), 0)); } - void SetKey(const std::array<int, MAX_COMMAND_KEYS> &_keys) { + void SetKey(const std::array<int, MAX_COMMAND_KEYS> &_keys) noexcept { keys = _keys; #ifndef NCMPC_MINI modified = true; @@ -66,7 +66,7 @@ #ifndef NCMPC_MINI void WriteToFile(FILE *f, const command_definition_t &cmd, - bool comment) const; + bool comment) const noexcept; #endif }; @@ -74,7 +74,7 @@ std::array<KeyBinding, size_t(Command::NONE)> key_bindings; gcc_pure - Command FindKey(int key) const; + Command FindKey(int key) const noexcept; /** * Returns the name of the first key bound to the given @@ -87,7 +87,7 @@ std::string GetKeyNames(Command command) const noexcept; void SetKey(Command command, - const std::array<int, MAX_COMMAND_KEYS> &keys) { + const std::array<int, MAX_COMMAND_KEYS> &keys) noexcept { auto &b = key_bindings[size_t(command)]; b.SetKey(keys); } @@ -96,12 +96,12 @@ /** * @return true on success, false on error */ - bool Check(char *buf, size_t size) const; + bool Check(char *buf, size_t size) const noexcept; /** * @return true on success, false on error */ - bool WriteToFile(FILE *f, int all) const; + bool WriteToFile(FILE *f, int all) const noexcept; #endif };
View file
ncmpc-0.32.tar.xz/src/ChatPage.cxx -> ncmpc-0.36.tar.xz/src/ChatPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,7 @@ #include "mpdclient.hxx" #include "i18n.h" #include "charset.hxx" +#include "Command.hxx" #include "Options.hxx" #include <mpd/idle.h>
View file
ncmpc-0.32.tar.xz/src/ChatPage.hxx -> ncmpc-0.36.tar.xz/src/ChatPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/Command.cxx -> ncmpc-0.36.tar.xz/src/Command.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -175,9 +175,9 @@ /* extra screens */ -#ifdef ENABLE_ARTIST_SCREEN - { "screen-artist", - N_("Artist screen") }, +#ifdef ENABLE_LIBRARY_PAGE + { "library-page", + N_("Library page") }, #endif #ifdef ENABLE_SEARCH_SCREEN { "screen-search", @@ -264,5 +264,11 @@ if (strcmp(name, cmds[i].name) == 0) return Command(i); +#ifdef ENABLE_LIBRARY_PAGE + /* compatibility with 0.32 and older */ + if (strcmp(name, "screen-artist") == 0) + return Command::LIBRARY_PAGE; +#endif + return Command::NONE; }
View file
ncmpc-0.32.tar.xz/src/Command.hxx -> ncmpc-0.36.tar.xz/src/Command.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -104,8 +104,8 @@ LIST_JUMP, /* extra screens */ -#ifdef ENABLE_ARTIST_SCREEN - SCREEN_ARTIST, +#ifdef ENABLE_LIBRARY_PAGE + LIBRARY_PAGE, #endif #ifdef ENABLE_SEARCH_SCREEN SCREEN_SEARCH,
View file
ncmpc-0.32.tar.xz/src/Completion.cxx -> ncmpc-0.36.tar.xz/src/Completion.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -22,14 +22,14 @@ #include <assert.h> static bool -StartsWith(const std::string &haystack, const std::string &needle) +StartsWith(const std::string &haystack, const std::string &needle) noexcept { return haystack.length() >= needle.length() && std::equal(needle.begin(), needle.end(), haystack.begin()); } Completion::Result -Completion::Complete(const std::string &prefix) const +Completion::Complete(const std::string &prefix) const noexcept { auto lower = list.lower_bound(prefix); if (lower == list.end() || !StartsWith(*lower, prefix))
View file
ncmpc-0.32.tar.xz/src/Completion.hxx -> ncmpc-0.36.tar.xz/src/Completion.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -34,21 +34,21 @@ Completion(const Completion &) = delete; Completion &operator=(const Completion &) = delete; - bool empty() const { + bool empty() const noexcept { return list.empty(); } - void clear() { + void clear() noexcept { list.clear(); } template<typename T> - void emplace(T &&value) { + void emplace(T &&value) noexcept { list.emplace(std::forward<T>(value)); } template<typename T> - void remove(T &&value) { + void remove(T &&value) noexcept { auto i = list.find(std::forward<T>(value)); if (i != list.end()) list.erase(i); @@ -58,19 +58,19 @@ using const_iterator = List::const_iterator; const_iterator _begin, _end; - bool operator==(const Range other) const { + bool operator==(const Range other) const noexcept { return _begin == other._begin && _end == other._end; } - bool operator!=(const Range other) const { + bool operator!=(const Range other) const noexcept { return !(*this == other); } - const_iterator begin() const { + const_iterator begin() const noexcept { return _begin; } - const_iterator end() const { + const_iterator end() const noexcept { return _end; } }; @@ -81,10 +81,10 @@ Range range; }; - Result Complete(const std::string &prefix) const; + Result Complete(const std::string &prefix) const noexcept; - virtual void Pre(const char *value) = 0; - virtual void Post(const char *value, Range range) = 0; + virtual void Pre(const char *value) noexcept = 0; + virtual void Post(const char *value, Range range) noexcept = 0; }; #endif
View file
ncmpc-0.36.tar.xz/src/ConfigFile.cxx
Added
@@ -0,0 +1,210 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "ConfigFile.hxx" +#include "ConfigParser.hxx" +#include "config.h" +#include "Options.hxx" +#include "io/Path.hxx" +#include "util/Compiler.h" + +#include <sys/stat.h> + +#ifdef _WIN32 +#include <glib.h> +#else +#include "XdgBaseDirectory.hxx" +#endif + +#ifdef _WIN32 +#define CONFIG_FILENAME "ncmpc.conf" +#define KEYS_FILENAME "keys.conf" +#else +#define CONFIG_FILENAME "config" +#define KEYS_FILENAME "keys" +#endif + +gcc_pure +static bool +IsFile(const char *path) noexcept +{ + struct stat st; + return stat(path, &st) == 0 && S_ISREG(st.st_mode); +} + +std::string +MakeKeysPath() +{ + return MakeUserConfigPath(KEYS_FILENAME); +} + +#ifndef _WIN32 + +std::string +GetHomeConfigPath() noexcept +{ + const char *home = GetHomeDirectory(); + if (home == nullptr) + return {}; + + return BuildPath(home, "." PACKAGE, CONFIG_FILENAME); +} + +#endif + +std::string +GetUserConfigPath() noexcept +{ + const auto dir = GetHomeConfigDirectory(); + if (dir.empty()) + return {}; + + return BuildPath(dir, PACKAGE, CONFIG_FILENAME); +} + +std::string +GetSystemConfigPath() noexcept +{ +#ifdef _WIN32 + const gchar* const *system_data_dirs; + + for (system_data_dirs = g_get_system_config_dirs (); *system_data_dirs != nullptr; system_data_dirs++) + { + auto path = BuildPath(*system_data_dirs, PACKAGE, CONFIG_FILENAME); + if (IsFile(path.c_str())) + return path; + } + return {}; +#else + return BuildPath(SYSCONFDIR, PACKAGE, CONFIG_FILENAME); +#endif +} + +#ifndef _WIN32 + +gcc_pure +static std::string +GetHomeKeysPath() noexcept +{ + const char *home = GetHomeDirectory(); + if (home == nullptr) + return {}; + + return BuildPath(home, "." PACKAGE, KEYS_FILENAME); +} + +#endif + +gcc_pure +static std::string +GetUserKeysPath() noexcept +{ + const auto dir = GetHomeConfigDirectory(); + if (dir.empty()) + return {}; + + return BuildPath(dir, PACKAGE, KEYS_FILENAME); +} + +gcc_pure +static std::string +GetSystemKeysPath() noexcept +{ +#ifdef _WIN32 + const gchar* const *system_data_dirs; + + for (system_data_dirs = g_get_system_config_dirs (); *system_data_dirs != nullptr; system_data_dirs++) + { + auto path = BuildPath(*system_data_dirs, PACKAGE, KEYS_FILENAME); + if (IsFile(pathname.c_str())) + return path; + } + return {} +#else + return BuildPath(SYSCONFDIR, PACKAGE, KEYS_FILENAME); +#endif +} + +static std::string +find_config_file() noexcept +{ + /* check for command line configuration file */ + if (!options.config_file.empty()) + return options.config_file; + + /* check for user configuration ~/.config/ncmpc/config */ + auto filename = GetUserConfigPath(); + if (!filename.empty() && IsFile(filename.c_str())) + return filename; + +#ifndef _WIN32 + /* check for user configuration ~/.ncmpc/config */ + filename = GetHomeConfigPath(); + if (!filename.empty() && IsFile(filename.c_str())) + return filename; +#endif + + /* check for global configuration SYSCONFDIR/ncmpc/config */ + filename = GetSystemConfigPath(); + if (IsFile(filename.c_str())) + return filename; + + return {}; +} + +static std::string +find_keys_file() noexcept +{ + /* check for command line key binding file */ + if (!options.key_file.empty()) + return options.key_file; + + /* check for user key bindings ~/.config/ncmpc/keys */ + auto filename = GetUserKeysPath(); + if (!filename.empty() && IsFile(filename.c_str())) + return filename; + +#ifndef _WIN32 + /* check for user key bindings ~/.ncmpc/keys */ + filename = GetHomeKeysPath(); + if (!filename.empty() && IsFile(filename.c_str())) + return filename; +#endif + + /* check for global key bindings SYSCONFDIR/ncmpc/keys */ + filename = GetSystemKeysPath(); + if (IsFile(filename.c_str())) + return filename; + + return {}; +} + +void +read_configuration()
View file
ncmpc-0.36.tar.xz/src/ConfigFile.hxx
Added
@@ -0,0 +1,42 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef CONFIG_FILE_HXX +#define CONFIG_FILE_HXX + +#include <string> + +std::string +MakeKeysPath(); + +#ifndef _WIN32 +std::string +GetHomeConfigPath() noexcept; +#endif + +std::string +GetUserConfigPath() noexcept; + +std::string +GetSystemConfigPath() noexcept; + +void +read_configuration(); + +#endif
View file
ncmpc-0.36.tar.xz/src/ConfigParser.cxx
Added
@@ -0,0 +1,659 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "ConfigParser.hxx" +#include "config.h" +#include "Bindings.hxx" +#include "KeyName.hxx" +#include "GlobalBindings.hxx" +#include "defaults.hxx" +#include "i18n.h" +#include "Command.hxx" +#include "Styles.hxx" +#include "BasicColors.hxx" +#include "CustomColors.hxx" +#include "screen_list.hxx" +#include "PageMeta.hxx" +#include "Options.hxx" +#include "util/CharUtil.hxx" +#include "util/Compiler.h" +#include "util/PrintException.hxx" +#include "util/RuntimeError.hxx" +#include "util/ScopeExit.hxx" +#include "util/StringStrip.hxx" + +#include <algorithm> +#include <array> + +#include <assert.h> +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> + +#define MAX_LINE_LENGTH 1024 +#define COMMENT_TOKEN '#' + +/* configuration field names */ +#define CONF_ENABLE_COLORS "enable-colors" +#define CONF_SCROLL_OFFSET "scroll-offset" +#define CONF_AUTO_CENTER "auto-center" +#define CONF_WIDE_CURSOR "wide-cursor" +#define CONF_KEY_DEFINITION "key" +#define CONF_COLOR "color" +#define CONF_COLOR_DEFINITION "colordef" +#define CONF_LIST_FORMAT "list-format" +#define CONF_SEARCH_FORMAT "search-format" +#define CONF_STATUS_FORMAT "status-format" +#define CONF_XTERM_TITLE_FORMAT "xterm-title-format" +#define CONF_LIST_WRAP "wrap-around" +#define CONF_FIND_WRAP "find-wrap" +#define CONF_FIND_SHOW_LAST "find-show-last" +#define CONF_AUDIBLE_BELL "audible-bell" +#define CONF_VISIBLE_BELL "visible-bell" +#define CONF_BELL_ON_WRAP "bell-on-wrap" +#define CONF_STATUS_MESSAGE_TIME "status-message-time" +#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" +#define CONF_HIDE_CURSOR "hide-cursor" +#define CONF_SEEK_TIME "seek-time" +#define CONF_LIBRARY_PAGE_TAGS "library-page-tags" +#define CONF_SCREEN_LIST "screen-list" +#define CONF_TIMEDISPLAY_TYPE "timedisplay-type" +#define CONF_HOST "host" +#define CONF_PORT "port" +#define CONF_PASSWORD "password" +#define CONF_TIMEOUT "timeout" +#define CONF_LYRICS_TIMEOUT "lyrics-timeout" +#define CONF_SCROLL "scroll" +#define CONF_SCROLL_SEP "scroll-sep" +#define CONF_VISIBLE_BITRATE "visible-bitrate" +#define CONF_HARDWARE_CURSOR "hardware-cursor" +#define CONF_WELCOME_SCREEN_LIST "welcome-screen-list" +#define CONF_DISPLAY_TIME "display-time" +#define CONF_JUMP_PREFIX_ONLY "jump-prefix-only" +#define CONF_LYRICS_AUTOSAVE "lyrics-autosave" +#define CONF_LYRICS_SHOW_PLUGIN "lyrics-show-plugin" +#define CONF_TEXT_EDITOR "text-editor" +#define CONF_TEXT_EDITOR_ASK "text-editor-ask" +#define CONF_CHAT_PREFIX "chat-prefix" +#define CONF_SECOND_COLUMN "second-column" + +gcc_pure +static bool +str2bool(char *str) noexcept +{ + return strcasecmp(str, "yes") == 0 || strcasecmp(str, "true") == 0 || + strcasecmp(str, "on") == 0 || strcasecmp(str, "1") == 0; +} + +static constexpr bool +is_word_char(char ch) noexcept +{ + return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_'; +} + +static char * +after_unquoted_word(char *p) +{ + if (!is_word_char(*p)) + throw FormatRuntimeError("%s: %s", + _("Word expected"), p); + + ++p; + + while (is_word_char(*p)) + ++p; + + return p; +} + +/** + * Throws on error. + */ +static int +parse_key_value(const char *str, const char **end) +{ + auto result = ParseKeyName(str); + if (result.first == -1) + throw FormatRuntimeError("%s: %s", + _("Malformed hotkey definition"), + result.second); + + *end = result.second; + return result.first; +} + +/** + * Throws on error. + */ +static void +parse_key_definition(char *str) +{ + /* get the command name */ + char *eq = strchr(str, '='); + if (eq == nullptr) + throw FormatRuntimeError("%s: %s", + /* the hotkey configuration + line is incomplete */ + _("Incomplete hotkey configuration"), + str); + + char *command_name = str; + str = StripLeft(eq + 1); + + *eq = '\0'; + StripRight(command_name); + const auto cmd = get_key_command_from_name(command_name); + if (cmd == Command::NONE) + throw FormatRuntimeError("%s: %s", + /* the hotkey configuration + contains an unknown + command */ + _("Unknown command"), command_name); + + /* parse key values */ + size_t i = 0; + const char *p = str; + + std::array<int, MAX_COMMAND_KEYS> keys{0}; + while (i < MAX_COMMAND_KEYS && *p != 0) { + keys[i++] = parse_key_value(p, &p); + while (*p==',' || *p==' ' || *p=='\t') + p++; + } + + GetGlobalKeyBindings().SetKey(cmd, keys); +} + +/** + * Throws on error. + */ +static bool +parse_timedisplay_type(const char *str) +{ + if (strcmp(str, "elapsed") == 0) + return false; + else if (strcmp(str, "remaining") == 0) + return true; + else { + throw FormatRuntimeError("%s: %s",
View file
ncmpc-0.36.tar.xz/src/ConfigParser.hxx
Added
@@ -0,0 +1,26 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef CONFIG_PARSER_HXX +#define CONFIG_PARSER_HXX + +bool +ReadConfigFile(const char *filename); + +#endif
View file
ncmpc-0.32.tar.xz/src/CustomColors.cxx -> ncmpc-0.36.tar.xz/src/CustomColors.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include <curses.h> -#include <list> +#include <forward_list> #include <stdio.h> @@ -30,23 +30,24 @@ short color; short r,g,b; - constexpr CustomColor(short _color, short _r, short _g, short _b) + constexpr CustomColor(short _color, + short _r, short _g, short _b) noexcept :color(_color), r(_r), g(_g), b(_b) {} }; -static std::list<CustomColor> custom_colors; +static std::forward_list<CustomColor> custom_colors; /* This function is called from conf.c before curses have been started, * it adds the definition to the color_definition_list and init_color() is * done in colors_start() */ void -colors_define(short color, short r, short g, short b) +colors_define(short color, short r, short g, short b) noexcept { - custom_colors.emplace_back(color, r, g, b); + custom_colors.emplace_front(color, r, g, b); } void -ApplyCustomColors() +ApplyCustomColors() noexcept { if (custom_colors.empty()) return;
View file
ncmpc-0.32.tar.xz/src/CustomColors.hxx -> ncmpc-0.36.tar.xz/src/CustomColors.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,9 +21,9 @@ #define CUSTOM_COLORS_HXX void -colors_define(short color, short r, short g, short b); +colors_define(short color, short r, short g, short b) noexcept; void -ApplyCustomColors(); +ApplyCustomColors() noexcept; #endif
View file
ncmpc-0.32.tar.xz/src/DelayedSeek.cxx -> ncmpc-0.36.tar.xz/src/DelayedSeek.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/DelayedSeek.hxx -> ncmpc-0.36.tar.xz/src/DelayedSeek.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/FileBrowserPage.cxx -> ncmpc-0.36.tar.xz/src/FileBrowserPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,13 +23,14 @@ #include "screen_status.hxx" #include "save_playlist.hxx" #include "screen.hxx" -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "i18n.h" #include "charset.hxx" #include "mpdclient.hxx" #include "filelist.hxx" #include "screen_utils.hxx" #include "screen_client.hxx" +#include "Command.hxx" #include "Options.hxx" #include "util/UriUtil.hxx"
View file
ncmpc-0.32.tar.xz/src/FileBrowserPage.hxx -> ncmpc-0.36.tar.xz/src/FileBrowserPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/FileListPage.cxx -> ncmpc-0.36.tar.xz/src/FileListPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -34,7 +34,8 @@ #include "filelist.hxx" #include "Styles.hxx" #include "paint.hxx" -#include "song_paint.hxx" +#include "SongRowPaint.hxx" +#include "time_format.hxx" #include "util/UriUtil.hxx" #include <mpd/client.h> @@ -340,18 +341,18 @@ FileListPage::OnMouse(struct mpdclient &c, Point p, mmask_t bstate) { - unsigned prev_selected = lw.selected; + unsigned prev_selected = lw.GetCursorIndex(); if (ListPage::OnMouse(c, p, bstate)) return true; - lw.SetCursor(lw.start + p.y); + lw.SetCursorFromOrigin(p.y); if( bstate & BUTTON1_CLICKED ) { - if (prev_selected == lw.selected) + if (prev_selected == lw.GetCursorIndex()) HandleEnter(c); } else if (bstate & BUTTON3_CLICKED) { - if (prev_selected == lw.selected) + if (prev_selected == lw.GetCursorIndex()) HandleSelect(c); } @@ -533,3 +534,38 @@ { lw.Paint(*this); } + +bool +FileListPage::PaintStatusBarOverride(const Window &window) const noexcept +{ + if (!lw.HasRangeSelection()) + return false; + + WINDOW *const w = window.w; + + wmove(w, 0, 0); + wclrtoeol(w); + + unsigned duration = 0; + + assert(filelist != nullptr); + for (const unsigned i : lw.GetRange()) { + assert(i < filelist->size()); + const auto &entry = (*filelist)[i]; + + if (mpd_entity_get_type(entry.entity) == MPD_ENTITY_TYPE_SONG) + duration += mpd_song_get_duration(mpd_entity_get_song(entry.entity)); + } + + char duration_string[32]; + format_duration_short(duration_string, sizeof(duration_string), + duration); + const unsigned duration_width = strlen(duration_string); + + SelectStyle(w, Style::STATUS_TIME); + mvwaddstr(w, 0, window.size.width - duration_width, duration_string); + + wnoutrefresh(w); + + return true; +}
View file
ncmpc-0.32.tar.xz/src/FileListPage.hxx -> ncmpc-0.36.tar.xz/src/FileListPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -85,6 +85,7 @@ public: /* virtual methods from class Page */ void Paint() const noexcept override; + bool PaintStatusBarOverride(const Window &window) const noexcept override; bool OnCommand(struct mpdclient &c, Command cmd) override; #ifdef HAVE_GETMOUSE
View file
ncmpc-0.32.tar.xz/src/GlobalBindings.cxx -> ncmpc-0.36.tar.xz/src/GlobalBindings.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,6 +19,7 @@ #include "GlobalBindings.hxx" #include "Bindings.hxx" +#include "config.h" #include <curses.h> @@ -132,7 +133,7 @@ /* extra screens */ -#ifdef ENABLE_ARTIST_SCREEN +#ifdef ENABLE_LIBRARY_PAGE {'4', F4}, #endif #ifdef ENABLE_SEARCH_SCREEN @@ -159,7 +160,7 @@ }}}; KeyBindings & -GetGlobalKeyBindings() +GetGlobalKeyBindings() noexcept { return global_key_bindings; }
View file
ncmpc-0.32.tar.xz/src/GlobalBindings.hxx -> ncmpc-0.36.tar.xz/src/GlobalBindings.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -26,6 +26,6 @@ gcc_const KeyBindings & -GetGlobalKeyBindings(); +GetGlobalKeyBindings() noexcept; #endif
View file
ncmpc-0.32.tar.xz/src/HelpPage.cxx -> ncmpc-0.36.tar.xz/src/HelpPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -81,8 +81,8 @@ Command::SCREEN_HELP, Command::SCREEN_PLAY, Command::SCREEN_FILE, -#ifdef ENABLE_ARTIST_SCREEN - Command::SCREEN_ARTIST, +#ifdef ENABLE_LIBRARY_PAGE + Command::LIBRARY_PAGE, #endif #ifdef ENABLE_SEARCH_SCREEN Command::SCREEN_SEARCH, @@ -223,7 +223,7 @@ public: HelpPage(ScreenManager &_screen, WINDOW *w, Size size) :ListPage(w, size), screen(_screen) { - lw.hide_cursor = true; + lw.DisableCursor(); lw.SetLength(ARRAY_SIZE(help_text)); } @@ -313,10 +313,10 @@ if (ListPage::OnCommand(c, cmd)) return true; - lw.SetCursor(lw.start); + lw.SetCursorFromOrigin(0); if (screen_find(screen, lw, cmd, *this)) { /* center the row */ - lw.Center(lw.selected); + lw.Center(lw.GetCursorIndex()); SetDirty(); return true; }
View file
ncmpc-0.32.tar.xz/src/HelpPage.hxx -> ncmpc-0.36.tar.xz/src/HelpPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/History.hxx -> ncmpc-0.36.tar.xz/src/History.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/Instance.cxx -> ncmpc-0.36.tar.xz/src/Instance.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,8 +19,29 @@ #include "Instance.hxx" #include "Options.hxx" -#include "keyboard.hxx" -#include "xterm_title.hxx" + +#include <signal.h> + +#ifdef HAVE_TAG_WHITELIST + +#include "strfsong.hxx" +#include "TagMask.hxx" + +static constexpr TagMask global_tag_whitelist{ + /* these tags are used by SongPage.cxx */ + MPD_TAG_ARTIST, + MPD_TAG_TITLE, + MPD_TAG_ALBUM, + MPD_TAG_COMPOSER, + MPD_TAG_NAME, + MPD_TAG_DISC, + MPD_TAG_TRACK, + MPD_TAG_DATE, + MPD_TAG_GENRE, + MPD_TAG_COMMENT, +}; + +#endif Instance::Instance() :io_service(), @@ -54,6 +75,18 @@ #ifndef _WIN32 AsyncWaitSigwinch(); #endif + +#ifdef HAVE_TAG_WHITELIST + TagMask tag_mask = global_tag_whitelist; + tag_mask |= SongFormatToTagMask(options.list_format.c_str()); + tag_mask |= SongFormatToTagMask(options.search_format.c_str()); + tag_mask |= SongFormatToTagMask(options.status_format.c_str()); +#ifndef NCMPC_MINI + tag_mask |= SongFormatToTagMask(options.xterm_title_format.c_str()); +#endif + + client.WhitelistTags(tag_mask); +#endif } Instance::~Instance()
View file
ncmpc-0.32.tar.xz/src/Instance.hxx -> ncmpc-0.36.tar.xz/src/Instance.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ #define NCMPC_INSTANCE_HXX #include "config.h" -#include "keyboard.hxx" +#include "AsyncUserInput.hxx" #include "mpdclient.hxx" #include "DelayedSeek.hxx" #include "screen.hxx" @@ -70,7 +70,7 @@ LircInput lirc_input; #endif - UserInput user_input; + AsyncUserInput user_input; public: Instance(); @@ -125,9 +125,9 @@ boost::system::error_code error; check_key_bindings_timer.expires_from_now(std::chrono::seconds(10), error); - reconnect_timer.async_wait(std::bind(&Instance::OnCheckKeyBindings, - this, - std::placeholders::_1)); + check_key_bindings_timer.async_wait(std::bind(&Instance::OnCheckKeyBindings, + this, + std::placeholders::_1)); } #endif
View file
ncmpc-0.36.tar.xz/src/KeyDefPage.cxx
Added
@@ -0,0 +1,610 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "KeyDefPage.hxx" +#include "PageMeta.hxx" +#include "ListPage.hxx" +#include "ListText.hxx" +#include "TextListRenderer.hxx" +#include "ProxyPage.hxx" +#include "screen_status.hxx" +#include "screen_find.hxx" +#include "KeyName.hxx" +#include "i18n.h" +#include "ConfigFile.hxx" +#include "Bindings.hxx" +#include "GlobalBindings.hxx" +#include "screen_utils.hxx" +#include "Options.hxx" +#include "util/Compiler.h" + +#include <assert.h> +#include <errno.h> +#include <string.h> + +class CommandKeysPage final : public ListPage, ListText { + ScreenManager &screen; + Page *const parent; + + const KeyBindings *bindings; + KeyBinding *binding; + + /** + * The command being edited, represented by a array subscript + * to #bindings, or -1, if no command is being edited + */ + int subcmd = -1; + + /** The number of keys assigned to the current command */ + unsigned n_keys = 0; + +public: + CommandKeysPage(ScreenManager &_screen, Page *_parent, + WINDOW *w, Size size) noexcept + :ListPage(w, size), screen(_screen), parent(_parent) {} + + void SetCommand(KeyBindings *_bindings, unsigned _cmd) { + bindings = _bindings; + binding = &_bindings->key_bindings[_cmd]; + subcmd = _cmd; + lw.Reset(); + UpdateListLength(); + } + +private: + /** The position of the up ("[..]") item */ + static constexpr unsigned GetLeavePosition() { + return 0; + } + + /** The position of the "add a key" item */ + gcc_pure + unsigned GetAddPosition() const noexcept { + return n_keys + 1; + } + + /** The number of items in the list_window, if there's a command being edited */ + gcc_pure + unsigned CalculateListLength() const noexcept { + /* show "add key" only if there is room for more keys */ + return GetAddPosition() + (n_keys < MAX_COMMAND_KEYS); + } + + /** Check whether a given item is a key */ + gcc_pure + bool IsKeyPosition(unsigned i) const noexcept { + return (i > GetLeavePosition() && i < GetAddPosition()); + } + + /** + * Convert an item id (as in lw.GetCursorIndex()) into a "key + * id", which is an array subscript to cmds[subcmd].keys. + */ + static constexpr unsigned PositionToKeyIndex(unsigned i) { + return i - 1; + } + + /* TODO: rename to check_n_keys / subcmd_count_keys? */ + void UpdateListLength() noexcept; + + /** + * Delete a key from a given command's definition. + * + * @param key_index the key (see below) + */ + void DeleteKey(int key_index); + + /** + * Assigns a new key to a key slot. + */ + void OverwriteKey(int key_index); + + /** + * Assign a new key to a new slot. + */ + void AddKey(); + +public: + /* virtual methods from class Page */ + void OnOpen(struct mpdclient &c) noexcept override; + void Paint() const noexcept override; + bool OnCommand(struct mpdclient &c, Command cmd) override; + const char *GetTitle(char *s, size_t size) const noexcept override; + +private: + /* virtual methods from class ListText */ + const char *GetListItemText(char *buffer, size_t size, + unsigned i) const noexcept override; +}; + +/* TODO: rename to check_n_keys / subcmd_count_keys? */ +void +CommandKeysPage::UpdateListLength() noexcept +{ + n_keys = binding->GetKeyCount(); + + lw.SetLength(CalculateListLength()); +} + +void +CommandKeysPage::DeleteKey(int key_index) +{ + /* shift the keys to close the gap that appeared */ + int i = key_index+1; + while (i < MAX_COMMAND_KEYS && binding->keys[i]) + binding->keys[key_index++] = binding->keys[i++]; + + /* As key_index now holds the index of the last key slot that contained + a key, we use it to empty this slot, because this key has been copied + to the previous slot in the loop above */ + binding->keys[key_index] = 0; + + binding->modified = true; + UpdateListLength(); + + screen_status_message(_("Deleted")); + + /* repaint */ + SetDirty(); + + /* update key conflict flags */ + bindings->Check(nullptr, 0); +} + +void +CommandKeysPage::OverwriteKey(int key_index) +{ + assert(key_index < MAX_COMMAND_KEYS); + + char prompt[256]; + snprintf(prompt, sizeof(prompt), + _("Enter new key for %s: "), + get_key_command_name(Command(subcmd))); + const int key = screen_getch(prompt); + + if (key == ERR) { + screen_status_message(_("Aborted")); + return; + } + + if (key == '\0') { + screen_status_message(_("Ctrl-Space can't be used")); + return; + } + + const Command cmd = bindings->FindKey(key); + if (cmd != Command::NONE) { + screen_status_printf(_("Error: key %s is already used for %s"), + GetLocalizedKeyName(key), + get_key_command_name(cmd)); + screen_bell(); + return; + } +
View file
ncmpc-0.36.tar.xz/src/KeyDefPage.hxx
Added
@@ -0,0 +1,30 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NCMPC_KEY_DEF_PAGE_HXX +#define NCMPC_KEY_DEF_PAGE_HXX + +#include "config.h" + +#ifdef ENABLE_KEYDEF_SCREEN +struct PageMeta; +extern const PageMeta screen_keydef; +#endif /* ENABLE_KEYDEF_SCREEN */ + +#endif
View file
ncmpc-0.32.tar.xz/src/KeyName.cxx -> ncmpc-0.36.tar.xz/src/KeyName.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,15 +19,98 @@ #include "KeyName.hxx" #include "i18n.h" +#include "util/CharUtil.hxx" +#include "util/StringCompare.hxx" #include <curses.h> +#include <stdio.h> +#include <stdlib.h> + +std::pair<int, const char *> +ParseKeyName(const char *s) noexcept +{ + if (*s == '\'') { + if (s[1] == '\\' && s[2] == '\'' && s[3] == '\'') + /* the single quote can be escaped with a + backslash */ + return std::make_pair(s[2], s + 4); + + if (s[1] == '\'' || s[2] != '\'') + return std::make_pair(-1, s); + + return std::make_pair(s[1], s + 3); + } else if (*s == 'F') { + char *end; + const auto value = strtoul(s + 1, &end, 0); + if (end == s + 1) + return std::make_pair(-1, end); + + if (value >= 64) + return std::make_pair(-1, s); + + return std::make_pair(KEY_F(value), end); + } else if (auto ctrl = StringAfterPrefixIgnoreCase(s, "ctrl-")) { + int ch = *ctrl++; + if (ch >= 0x40 && ch < 0x60) + return std::make_pair(ch - 0x40, ctrl); + + return std::make_pair(-1, s); + } else if (auto alt = StringAfterPrefixIgnoreCase(s, "alt-")) { + int ch = *alt++; + if (ch >= 0x40 && ch < 0x80) + return std::make_pair(0xc0 | (ch - 0x40), alt); + + return std::make_pair(-1, s); + } else { + char *end; + const auto value = strtol(s, &end, 0); + if (end == s) + return std::make_pair(-1, end); + + return std::make_pair(int(value), end); + } +} + const char * -key2str(int key) +GetKeyName(int key) noexcept { - switch(key) { - static char buf[32]; + static char buf[32]; + + for (int i = 0; i < 64; ++i) { + if (key == KEY_F(i)) { + snprintf(buf, sizeof(buf), "F%u", i); + return buf; + } + } + + const char *name = keyname(key); + if (name != nullptr) { + if (name[0] == '^' && name[1] != 0 && name[2] == 0) { + /* translate "^X" to "Ctrl-X" */ + snprintf(buf, sizeof(buf), "Ctrl-%c", name[1]); + return buf; + } + + if (name[0] == 'M' && name[1] == '-' && name[2] != 0 && name[3] == 0) { + /* translate "M-X" to "Alt-X" */ + snprintf(buf, sizeof(buf), "Alt-%c", name[2]); + return buf; + } + } + if (key < 256 && IsAlphaNumericASCII(key)) + snprintf(buf, sizeof(buf), "\'%c\'", key); + else + snprintf(buf, sizeof(buf), "%d", key); + + return buf; +} + +const char * +GetLocalizedKeyName(int key) noexcept +{ + switch(key) { case 0: return _("Undefined"); case ' ': @@ -62,20 +145,34 @@ return _("Esc"); case KEY_IC: return _("Insert"); - default: - for (int i = 0; i <= 63; i++) - if (key == KEY_F(i)) { - snprintf(buf, 32, "F%d", i ); - return buf; - } - if (!(key & ~037)) - snprintf(buf, 32, _("Ctrl-%c"), 'A'+(key & 037)-1 ); - else if ((key & ~037) == 224) - snprintf(buf, 32, _("Alt-%c"), 'A'+(key & 037)-1 ); - else if (key > 32 && key < 256) - snprintf(buf, 32, "%c", key); - else - snprintf(buf, 32, "0x%03X", key); + } + + static char buf[32]; + + for (int i = 0; i <= 63; i++) { + if (key == KEY_F(i)) { + snprintf(buf, sizeof(buf), "F%d", i ); + return buf; + } + } + + const char *name = keyname(key); + if (name == nullptr) { + snprintf(buf, sizeof(buf), "0x%03X", key); + return buf; + } + + if (name[0] == '^' && name[1] != 0 && name[2] == 0) { + /* translate "^X" to "Ctrl-X" */ + snprintf(buf, sizeof(buf), _("Ctrl-%c"), name[1]); return buf; } + + if (name[0] == 'M' && name[1] == '-' && name[2] != 0 && name[3] == 0) { + /* translate "M-X" to "Alt-X" */ + snprintf(buf, sizeof(buf), _("Alt-%c"), name[2]); + return buf; + } + + return name; }
View file
ncmpc-0.32.tar.xz/src/KeyName.hxx -> ncmpc-0.36.tar.xz/src/KeyName.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -22,8 +22,35 @@ #include "util/Compiler.h" +#include <utility> + +/** + * Parse a string (from the configuration file) to a keycode. + * + * @return the keycode and the first unparsed character; -1 indicates + * error + */ +gcc_pure +std::pair<int, const char *> +ParseKeyName(const char *s) noexcept; + +/** + * Convert a keycode to a canonical string, to be used in the + * configuration file. + * + * The returned pointer is invalidated by the next call. + */ +gcc_pure +const char * +GetKeyName(int key) noexcept; + +/** + * Convert a keycode to a human-readable localized string. + * + * The returned pointer is invalidated by the next call. + */ gcc_pure const char * -key2str(int key); +GetLocalizedKeyName(int key) noexcept; #endif
View file
ncmpc-0.36.tar.xz/src/LibraryPage.cxx
Added
@@ -0,0 +1,303 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "LibraryPage.hxx" +#include "TagListPage.hxx" +#include "PageMeta.hxx" +#include "FileListPage.hxx" +#include "Command.hxx" +#include "ProxyPage.hxx" +#include "i18n.h" +#include "charset.hxx" +#include "mpdclient.hxx" +#include "filelist.hxx" +#include "Options.hxx" + +#include <list> +#include <string> +#include <vector> + +#include <assert.h> +#include <string.h> + +gcc_const +static const char * +GetTagPlural(enum mpd_tag_type tag) noexcept +{ + switch (tag) { + case MPD_TAG_ARTIST: + return _("Artists"); + + case MPD_TAG_ALBUM: + return _("Albums"); + + default: + return mpd_tag_name(tag); + } +} + +static const char * +MakePageTitle(char *buffer, size_t size, const char *prefix, + const TagFilter &filter) +{ + if (filter.empty()) + return prefix; + + snprintf(buffer, size, "%s: %s", prefix, + Utf8ToLocale(ToString(filter).c_str()).c_str()); + return buffer; +} + +class SongListPage final : public FileListPage { + Page *const parent; + + TagFilter filter; + +public: + SongListPage(ScreenManager &_screen, Page *_parent, + WINDOW *_w, Size size) noexcept + :FileListPage(_screen, _w, size, + options.list_format.c_str()), + parent(_parent) {} + + const auto &GetFilter() const noexcept { + return filter; + } + + template<typename F> + void SetFilter(F &&_filter) noexcept { + filter = std::forward<F>(_filter); + AddPendingEvents(~0u); + } + + void LoadSongList(struct mpdclient &c); + + /* virtual methods from class Page */ + void Update(struct mpdclient &c, unsigned events) noexcept override; + bool OnCommand(struct mpdclient &c, Command cmd) override; + const char *GetTitle(char *s, size_t size) const noexcept override; +}; + +void +SongListPage::Update(struct mpdclient &c, unsigned events) noexcept +{ + if (events & MPD_IDLE_DATABASE) { + LoadSongList(c); + } +} + +class ArtistBrowserPage final : public ProxyPage { + std::list<TagListPage> tag_list_pages; + std::list<TagListPage>::iterator current_tag_list_page; + + SongListPage song_list_page; + +public: + ArtistBrowserPage(ScreenManager &_screen, WINDOW *_w, + Size size) + :ProxyPage(_w), + song_list_page(_screen, this, + _w, size) { + + bool first = true; + for (const auto &tag : options.library_page_tags) { + tag_list_pages.emplace_back(_screen, + first ? nullptr : this, + tag, + first ? nullptr : _("All"), + _w, size); + first = false; + } + } + +private: + void OpenTagPage(struct mpdclient &c, + TagFilter &&filter) noexcept; + void OpenSongList(struct mpdclient &c, TagFilter &&filter); + +public: + /* virtual methods from class Page */ + void OnOpen(struct mpdclient &c) noexcept override; + void Update(struct mpdclient &c, unsigned events) noexcept override; + bool OnCommand(struct mpdclient &c, Command cmd) override; +}; + +void +SongListPage::LoadSongList(struct mpdclient &c) +{ + auto *connection = c.GetConnection(); + + delete filelist; + + filelist = new FileList(); + /* add a dummy entry for ".." */ + filelist->emplace_back(nullptr); + + if (connection != nullptr) { + mpd_search_db_songs(connection, true); + AddConstraints(connection, filter); + mpd_search_commit(connection); + + filelist->Receive(*connection); + + c.FinishCommand(); + } + + /* fix highlights */ + screen_browser_sync_highlights(filelist, &c.playlist); + lw.SetLength(filelist->size()); +} + +void +ArtistBrowserPage::OpenTagPage(struct mpdclient &c, + TagFilter &&filter) noexcept +{ + auto page = current_tag_list_page; + + page->SetFilter(std::move(filter)); + + char buffer[64]; + page->SetTitle(MakePageTitle(buffer, sizeof(buffer), + _("Albums"), + page->GetFilter())); + + SetCurrentPage(c, &*page); +} + +void +ArtistBrowserPage::OpenSongList(struct mpdclient &c, TagFilter &&filter) +{ + song_list_page.SetFilter(std::move(filter)); + SetCurrentPage(c, &song_list_page); +} + +static std::unique_ptr<Page> +InitLibraryPage(ScreenManager &_screen, WINDOW *w, Size size) +{ + return std::make_unique<ArtistBrowserPage>(_screen, w, size); +} + +const char * +SongListPage::GetTitle(char *str, size_t size) const noexcept +{ + return MakePageTitle(str, size, _("Songs"), filter);
View file
ncmpc-0.36.tar.xz/src/LibraryPage.hxx
Added
@@ -0,0 +1,30 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NCMPC_LIBRARY_PAGE_HXX +#define NCMPC_LIBRARY_PAGE_HXX + +#include "config.h" + +#ifdef ENABLE_LIBRARY_PAGE +struct PageMeta; +extern const PageMeta library_page; +#endif + +#endif
View file
ncmpc-0.36.tar.xz/src/ListCursor.cxx
Added
@@ -0,0 +1,313 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "ListCursor.hxx" +#include "Options.hxx" + +void +ListCursor::Reset() noexcept +{ + selected = 0; + range_selection = false; + range_base = 0; + start = 0; +} + +unsigned +ListCursor::ValidateIndex(unsigned i) const noexcept +{ + if (length == 0) + return 0; + else if (i >= length) + return length - 1; + else + return i; +} + +void +ListCursor::CheckSelected() noexcept +{ + selected = ValidateIndex(selected); + + if (range_selection) + range_base = ValidateIndex(range_base); +} + +void +ListCursor::SetHeight(unsigned _height) noexcept +{ + height = _height; + CheckOrigin(); +} + +void +ListCursor::SetLength(unsigned _length) noexcept +{ + if (_length == length) + return; + + length = _length; + + CheckSelected(); + CheckOrigin(); +} + +void +ListCursor::Center(unsigned n) noexcept +{ + if (n > GetHeight() / 2) + start = n - GetHeight() / 2; + else + start = 0; + + if (start + GetHeight() > length) { + if (GetHeight() < length) + start = length - GetHeight(); + else + start = 0; + } +} + +void +ListCursor::ScrollTo(unsigned n) noexcept +{ + int new_start = start; + + if ((unsigned) options.scroll_offset * 2 >= GetHeight()) + // Center if the offset is more than half the screen + new_start = n - GetHeight() / 2; + else { + if (n < start + options.scroll_offset) + new_start = n - options.scroll_offset; + + if (n >= start + GetHeight() - options.scroll_offset) + new_start = n - GetHeight() + 1 + options.scroll_offset; + } + + if (new_start + GetHeight() > length) + new_start = length - GetHeight(); + + if (new_start < 0 || length == 0) + new_start = 0; + + start = new_start; +} + +void +ListCursor::SetCursor(unsigned i) noexcept +{ + range_selection = false; + selected = i; + + CheckSelected(); + CheckOrigin(); +} + +void +ListCursor::MoveCursor(unsigned n) noexcept +{ + selected = n; + + CheckSelected(); + CheckOrigin(); +} + +void +ListCursor::FetchCursor() noexcept +{ + if (start > 0 && + selected < start + options.scroll_offset) + MoveCursor(start + options.scroll_offset); + else if (start + GetHeight() < length && + selected > start + GetHeight() - 1 - options.scroll_offset) + MoveCursor(start + GetHeight() - 1 - options.scroll_offset); +} + +ListWindowRange +ListCursor::GetRange() const noexcept +{ + if (length == 0) { + /* empty list - no selection */ + return {0, 0}; + } else if (range_selection) { + /* a range selection */ + if (range_base < selected) { + return {range_base, selected + 1}; + } else { + return {selected, range_base + 1}; + } + } else { + /* no range, just the cursor */ + return {selected, selected + 1}; + } +} + +void +ListCursor::MoveCursorNext() noexcept +{ + if (selected + 1 < length) + MoveCursor(selected + 1); + else if (options.list_wrap) + MoveCursor(0); +} + +void +ListCursor::MoveCursorPrevious() noexcept +{ + if (selected > 0) + MoveCursor(selected - 1); + else if (options.list_wrap) + MoveCursor(length - 1); +} + +void +ListCursor::MoveCursorTop() noexcept +{ + if (start == 0) + MoveCursor(start); + else + if ((unsigned) options.scroll_offset * 2 >= GetHeight()) + MoveCursor(start + GetHeight() / 2); + else + MoveCursor(start + options.scroll_offset); +} + +void +ListCursor::MoveCursorMiddle() noexcept +{ + if (length >= GetHeight()) + MoveCursor(start + GetHeight() / 2); + else + MoveCursor(length / 2); +} +
View file
ncmpc-0.36.tar.xz/src/ListCursor.hxx
Added
@@ -0,0 +1,268 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIST_CURSOR_HXX +#define LIST_CURSOR_HXX + +#include "util/Compiler.h" + +/** + * The bounds of a range selection, see list_window_get_range(). + */ +struct ListWindowRange { + /** + * The index of the first selected item. + */ + unsigned start_index; + + /** + * The index after the last selected item. The selection is + * empty when this is the same as "start". + */ + unsigned end_index; + + constexpr bool empty() const noexcept { + return start_index >= end_index; + } + + constexpr bool Contains(unsigned i) const noexcept { + return i >= start_index && i < end_index; + } + + struct const_iterator { + unsigned value; + + const_iterator &operator++() noexcept { + ++value; + return *this; + } + + constexpr bool operator==(const const_iterator &other) const noexcept { + return value == other.value; + } + + constexpr bool operator!=(const const_iterator &other) const noexcept { + return !(*this == other); + } + + const unsigned &operator *() const noexcept { + return value; + } + }; + + constexpr const_iterator begin() const noexcept { + return {start_index}; + } + + constexpr const_iterator end() const noexcept { + return {end_index}; + } +}; + +class ListCursor { + unsigned height; + + /** + * Number of items in this list. + */ + unsigned length = 0; + + unsigned start = 0; + unsigned selected = 0; + + /** + * Represents the base item. + */ + unsigned range_base = 0; + + /** + * Range selection activated? + */ + bool range_selection = false; + + bool hide_cursor = false; + +public: + explicit constexpr ListCursor(unsigned _height) noexcept + :height(_height) {} + + constexpr unsigned GetHeight() const noexcept { + return height; + } + + constexpr unsigned GetOrigin() const noexcept { + return start; + } + + constexpr bool IsVisible(unsigned i) const noexcept { + return i >= GetOrigin() && i < GetOrigin() + GetHeight(); + } + + void SetOrigin(unsigned new_orign) noexcept { + start = new_orign; + } + + void DisableCursor() { + hide_cursor = true; + } + + void EnableCursor() { + hide_cursor = false; + } + + constexpr bool HasCursor() const noexcept { + return !hide_cursor; + } + + constexpr bool HasRangeSelection() const noexcept { + return range_selection; + } + + /** + * Is the cursor currently pointing to a single valid item? + */ + constexpr bool IsSingleCursor() const noexcept { + return !HasRangeSelection() && selected < length; + } + + constexpr unsigned GetCursorIndex() const noexcept { + return selected; + } + + void SelectionMovedUp() noexcept { + selected--; + range_base--; + + EnsureSelectionVisible(); + } + + void SelectionMovedDown() noexcept { + selected++; + range_base++; + + EnsureSelectionVisible(); + } + + void EnsureSelectionVisible() noexcept { + if (range_selection) + ScrollTo(range_base); + ScrollTo(selected); + } + + /** reset a list window (selected=0, start=0) */ + void Reset() noexcept; + + void SetHeight(unsigned _height) noexcept; + + void SetLength(unsigned length) noexcept; + + constexpr unsigned GetLength() const noexcept { + return length; + } + + /** + * Centers the visible range around item n on the list. + */ + void Center(unsigned n) noexcept; + + /** + * Scrolls the view to item n, as if the cursor would have been moved + * to the position. + */ + void ScrollTo(unsigned n) noexcept; + + /** + * Sets the position of the cursor. Disables range selection. + */ + void SetCursor(unsigned i) noexcept; + + void SetCursorFromOrigin(unsigned i) noexcept { + SetCursor(GetOrigin() + i); + } + + void EnableRangeSelection() noexcept {
View file
ncmpc-0.32.tar.xz/src/ListPage.hxx -> ncmpc-0.36.tar.xz/src/ListPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -41,9 +41,9 @@ } bool OnCommand(struct mpdclient &, Command cmd) override { - if (lw.hide_cursor - ? lw.HandleScrollCommand(cmd) - : lw.HandleCommand(cmd)) { + if (lw.HasCursor() + ? lw.HandleCommand(cmd) + : lw.HandleScrollCommand(cmd)) { SetDirty(); return true; }
View file
ncmpc-0.32.tar.xz/src/ListRenderer.hxx -> ncmpc-0.36.tar.xz/src/ListRenderer.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/ListText.hxx -> ncmpc-0.36.tar.xz/src/ListText.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/ListWindow.cxx -> ncmpc-0.36.tar.xz/src/ListWindow.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,9 +21,8 @@ #include "ListRenderer.hxx" #include "ListText.hxx" #include "config.h" -#include "Options.hxx" -#include "charset.hxx" #include "Match.hxx" +#include "Options.hxx" #include "Command.hxx" #include "paint.hxx" #include "screen_status.hxx" @@ -31,296 +30,37 @@ #include "i18n.h" #include <assert.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -void -ListWindow::Reset() noexcept -{ - selected = 0; - range_selection = false; - range_base = 0; - start = 0; -} - -unsigned -ListWindow::ValidateIndex(unsigned i) const noexcept -{ - if (length == 0) - return 0; - else if (i >= length) - return length - 1; - else - return i; -} - -void -ListWindow::CheckSelected() noexcept -{ - selected = ValidateIndex(selected); - - if (range_selection) - range_base = ValidateIndex(range_base); -} - -void -ListWindow::Resize(Size _size) noexcept -{ - size = _size; - CheckOrigin(); -} - -void -ListWindow::SetLength(unsigned _length) noexcept -{ - if (_length == length) - return; - - length = _length; - - CheckSelected(); - CheckOrigin(); -} - -void -ListWindow::Center(unsigned n) noexcept -{ - if (n > size.height / 2) - start = n - size.height / 2; - else - start = 0; - - if (start + size.height > length) { - if (size.height < length) - start = length - size.height; - else - start = 0; - } -} - -void -ListWindow::ScrollTo(unsigned n) noexcept -{ - int new_start = start; - - if ((unsigned) options.scroll_offset * 2 >= size.height) - // Center if the offset is more than half the screen - new_start = n - size.height / 2; - else { - if (n < start + options.scroll_offset) - new_start = n - options.scroll_offset; - - if (n >= start + size.height - options.scroll_offset) - new_start = n - size.height + 1 + options.scroll_offset; - } - - if (new_start + size.height > length) - new_start = length - size.height; - - if (new_start < 0 || length == 0) - new_start = 0; - - start = new_start; -} - -void -ListWindow::SetCursor(unsigned i) noexcept -{ - range_selection = false; - selected = i; - - CheckSelected(); - CheckOrigin(); -} - -void -ListWindow::MoveCursor(unsigned n) noexcept -{ - selected = n; - - CheckSelected(); - CheckOrigin(); -} - -void -ListWindow::FetchCursor() noexcept -{ - if (start > 0 && - selected < start + options.scroll_offset) - MoveCursor(start + options.scroll_offset); - else if (start + size.height < length && - selected > start + size.height - 1 - options.scroll_offset) - MoveCursor(start + size.height - 1 - options.scroll_offset); -} - -ListWindowRange -ListWindow::GetRange() const noexcept -{ - if (length == 0) { - /* empty list - no selection */ - return {0, 0}; - } else if (range_selection) { - /* a range selection */ - if (range_base < selected) { - return {range_base, selected + 1}; - } else { - return {selected, range_base + 1}; - } - } else { - /* no range, just the cursor */ - return {selected, selected + 1}; - } -} - -void -ListWindow::MoveCursorNext() noexcept -{ - if (selected + 1 < length) - MoveCursor(selected + 1); - else if (options.list_wrap) - MoveCursor(0); -} - -void -ListWindow::MoveCursorPrevious() noexcept -{ - if (selected > 0) - MoveCursor(selected - 1); - else if (options.list_wrap) - MoveCursor(length - 1); -} - -void -ListWindow::MoveCursorTop() noexcept -{ - if (start == 0) - MoveCursor(start); - else - if ((unsigned) options.scroll_offset * 2 >= size.height) - MoveCursor(start + size.height / 2); - else - MoveCursor(start + options.scroll_offset); -} - -void -ListWindow::MoveCursorMiddle() noexcept -{ - if (length >= size.height) - MoveCursor(start + size.height / 2); - else
View file
ncmpc-0.32.tar.xz/src/ListWindow.hxx -> ncmpc-0.36.tar.xz/src/ListWindow.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,9 +20,9 @@ #ifndef LIST_WINDOW_HXX #define LIST_WINDOW_HXX -#include "config.h" +#include "ListCursor.hxx" #include "Size.hxx" -#include "util/Compiler.h" +#include "config.h" #include <curses.h> @@ -30,93 +30,27 @@ class ListText; class ListRenderer; -/** - * The bounds of a range selection, see list_window_get_range(). - */ -struct ListWindowRange { - /** - * The index of the first selected item. - */ - unsigned start_index; +class ListWindow : public ListCursor { + WINDOW *const w; - /** - * The index after the last selected item. The selection is - * empty when this is the same as "start". - */ - unsigned end_index; + unsigned width; - constexpr bool empty() const noexcept { - return start_index >= end_index; - } +public: + ListWindow(WINDOW *_w, Size _size) noexcept + :ListCursor(_size.height), w(_w), width(_size.width) {} - constexpr bool Contains(unsigned i) const noexcept { - return i >= start_index && i < end_index; + unsigned GetWidth() const noexcept { + return width; } - struct const_iterator { - unsigned value; - - const_iterator &operator++() noexcept { - ++value; - return *this; - } - - constexpr bool operator==(const const_iterator &other) const noexcept { - return value == other.value; - } - - constexpr bool operator!=(const const_iterator &other) const noexcept { - return !(*this == other); - } - - const unsigned &operator *() const noexcept { - return value; - } - }; - - constexpr const_iterator begin() const noexcept { - return {start_index}; + void Resize(Size _size) noexcept { + SetHeight(_size.height); + width = _size.width; } - constexpr const_iterator end() const noexcept { - return {end_index}; + void Refresh() const noexcept { + wrefresh(w); } -}; - -class ListWindow { -public: - WINDOW *w; - Size size; - - /** - * Number of items in this list. - */ - unsigned length = 0; - - unsigned start = 0; - unsigned selected = 0; - - /** - * Represents the base item. - */ - unsigned range_base = 0; - - /** - * Range selection activated? - */ - bool range_selection = false; - - bool hide_cursor = false; - - ListWindow(WINDOW *_w, Size _size) noexcept - :w(_w), size(_size) {} - - /** reset a list window (selected=0, start=0) */ - void Reset() noexcept; - - void Resize(Size _size) noexcept; - - void SetLength(unsigned length) noexcept; void Paint(const ListRenderer &renderer) const noexcept; @@ -138,55 +72,6 @@ #endif /** - * Centers the visible range around item n on the list. - */ - void Center(unsigned n) noexcept; - - /** - * Scrolls the view to item n, as if the cursor would have been moved - * to the position. - */ - void ScrollTo(unsigned n) noexcept; - - /** - * Sets the position of the cursor. Disables range selection. - */ - void SetCursor(unsigned i) noexcept; - - /** - * Moves the cursor. Modifies the range if range selection is - * enabled. - */ - void MoveCursor(unsigned n) noexcept; - - void MoveCursorNext() noexcept; - void MoveCursorPrevious() noexcept; - void MoveCursorTop() noexcept; - void MoveCursorMiddle() noexcept; - void MoveCursorBottom() noexcept; - void MoveCursorFirst() noexcept; - void MoveCursorLast() noexcept; - void MoveCursorNextPage() noexcept; - void MoveCursorPreviousPage() noexcept; - - void ScrollUp(unsigned n) noexcept; - void ScrollDown(unsigned n) noexcept; - - /** - * Ensures that the cursor is visible on the screen, i.e. it is not - * outside the current scrolling range. - */ - void FetchCursor() noexcept; - - /** - * Determines the lower and upper bound of the range selection. If - * range selection is disabled, it returns the cursor position (range - * length is 1). - */ - gcc_pure - ListWindowRange GetRange() const noexcept; - - /** * Find a string in a list window. */ bool Find(const ListText &text, @@ -207,20 +92,6 @@ * characters in *str. */ bool Jump(const ListText &text, const char *str) noexcept; - -private: - gcc_pure - unsigned ValidateIndex(unsigned i) const noexcept; - - void CheckSelected() noexcept; - - /** - * Scroll after the cursor was moved, the list was changed or - * the window was resized. - */ - void CheckOrigin() noexcept { - ScrollTo(selected); - }
View file
ncmpc-0.32.tar.xz/src/LyricsPage.cxx -> ncmpc-0.36.tar.xz/src/LyricsPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,10 +23,12 @@ #include "FileBrowserPage.hxx" #include "SongPage.hxx" #include "i18n.h" +#include "Command.hxx" #include "Options.hxx" #include "mpdclient.hxx" #include "screen.hxx" #include "lyrics.hxx" +#include "plugin.hxx" #include "TextPage.hxx" #include "screen_utils.hxx" #include "ncu.hxx" @@ -47,7 +49,7 @@ static struct mpd_song *next_song; static bool follow = false; -class LyricsPage final : public TextPage { +class LyricsPage final : public TextPage, PluginResponseHandler { /** Set if the cursor position shall be kept during the next lyrics update. */ bool reloading = false; @@ -75,7 +77,7 @@ } auto &get_io_service() noexcept { - return loader_timeout.get_io_service(); + return screen.get_io_service(); } private: @@ -109,15 +111,6 @@ /** save current lyrics to a file and run editor on it */ void Edit(); - static void PluginCallback(std::string &&result, bool success, - const char *plugin_name, void *data) { - auto &p = *(LyricsPage *)data; - p.PluginCallback(std::move(result), success, plugin_name); - } - - void PluginCallback(std::string &&result, bool success, - const char *plugin_name); - void OnTimeout(const boost::system::error_code &error) noexcept; public: @@ -126,6 +119,12 @@ void Update(struct mpdclient &c, unsigned events) noexcept override; bool OnCommand(struct mpdclient &c, Command cmd) override; const char *GetTitle(char *, size_t) const noexcept override; + +private: + /* virtual methods from class PluginResponseHandler */ + void OnPluginSuccess(const char *plugin_name, + std::string result) noexcept override; + void OnPluginError(std::string error) noexcept override; }; void @@ -208,12 +207,12 @@ LyricsPage::Set(const char *s) { if (reloading) { - unsigned saved_start = lw.start; + unsigned saved_start = lw.GetOrigin(); TextPage::Set(s); /* restore the cursor and ensure that it's still valid */ - lw.start = saved_start; + lw.SetOrigin(saved_start); lw.FetchCursor(); } else { TextPage::Set(s); @@ -226,28 +225,32 @@ RepaintIfActive(); } -inline void -LyricsPage::PluginCallback(std::string &&result, const bool success, - const char *_plugin_name) +void +LyricsPage::OnPluginSuccess(const char *_plugin_name, + std::string result) noexcept { - assert(loader != nullptr); - - if (_plugin_name != nullptr) - plugin_name = _plugin_name; - else - plugin_name.clear(); + plugin_name = _plugin_name; - /* Display result, which may be lyrics or error messages */ Set(result.c_str()); - if (success == true) { - if (options.lyrics_autosave && - !exists_lyr_file(artist, title)) - Save(); - } else { - /* translators: no lyrics were found for the song */ - screen_status_message (_("No lyrics")); - } + if (options.lyrics_autosave && !exists_lyr_file(artist, title)) + Save(); + + loader_timeout.cancel(); + + plugin_stop(loader); + loader = nullptr; +} + +void +LyricsPage::OnPluginError(std::string error) noexcept +{ + plugin_name.clear(); + + Set(error.c_str()); + + /* translators: no lyrics were found for the song */ + screen_status_message(_("No lyrics")); loader_timeout.cancel(); @@ -278,8 +281,13 @@ artist = mpd_song_get_tag(song, MPD_TAG_ARTIST, 0); title = mpd_song_get_tag(song, MPD_TAG_TITLE, 0); + if (artist == nullptr || title == nullptr) { + Cancel(); + return; + } + loader = lyrics_load(get_io_service(), - artist, title, PluginCallback, this); + artist, title, *this); if (options.lyrics_timeout > std::chrono::steady_clock::duration::zero()) { boost::system::error_code error; @@ -305,7 +313,7 @@ if (loader == nullptr && artist != nullptr && title != nullptr) { reloading = true; loader = lyrics_load(get_io_service(), - artist, title, PluginCallback, nullptr); + artist, title, *this); Repaint(); } }
View file
ncmpc-0.32.tar.xz/src/LyricsPage.hxx -> ncmpc-0.36.tar.xz/src/LyricsPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/Main.cxx -> ncmpc-0.36.tar.xz/src/Main.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -33,12 +33,13 @@ #include "xterm_title.hxx" #include "strfsong.hxx" #include "i18n.h" -#include "player_command.hxx" +#include "util/PrintException.hxx" #include "util/ScopeExit.hxx" #include "util/StringUTF8.hxx" +#include "util/Compiler.h" #ifndef NCMPC_MINI -#include "conf.hxx" +#include "ConfigFile.hxx" #endif #ifdef ENABLE_LYRICS_SCREEN @@ -47,10 +48,10 @@ #include <mpd/client.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <signal.h> +#include <curses.h> + +#include <assert.h> +#include <stdio.h> #include <string.h> #ifdef ENABLE_LOCALE @@ -277,7 +278,7 @@ int main(int argc, const char *argv[]) -{ +try { #ifdef ENABLE_LOCALE /* time and date formatting */ setlocale(LC_TIME,""); @@ -346,5 +347,8 @@ #endif instance.Run(); - return 0; + return EXIT_SUCCESS; +} catch (...) { + PrintException(std::current_exception()); + return EXIT_FAILURE; }
View file
ncmpc-0.32.tar.xz/src/Match.cxx -> ncmpc-0.36.tar.xz/src/Match.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,7 +18,6 @@ */ #include "Match.hxx" -#include "charset.hxx" #include <assert.h> #include <string.h> @@ -34,8 +33,6 @@ MatchExpression::Compile(const char *src, bool anchor) noexcept { #ifndef HAVE_PCRE - assert(expression == nullptr); - expression = src; length = strlen(expression); anchored = anchor; @@ -58,7 +55,7 @@ bool MatchExpression::operator()(const char *line) const noexcept { -#ifdef NCMPC_MINI +#ifndef HAVE_PCRE assert(expression != nullptr); return anchored
View file
ncmpc-0.32.tar.xz/src/Match.hxx -> ncmpc-0.36.tar.xz/src/Match.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -25,9 +25,9 @@ #ifdef HAVE_PCRE #include <pcre.h> -#endif - +#else #include <stddef.h> +#endif class MatchExpression { #ifndef HAVE_PCRE
View file
ncmpc-0.32.tar.xz/src/Options.cxx -> ncmpc-0.36.tar.xz/src/Options.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -22,7 +22,7 @@ #include "GlobalBindings.hxx" #include "config.h" #include "charset.hxx" -#include "conf.hxx" +#include "ConfigFile.hxx" #include "i18n.h" #include <stdlib.h> @@ -174,7 +174,7 @@ #ifdef HAVE_GETMOUSE " getmouse" #endif -#ifdef ENABLE_ARTIST_SCREEN +#ifdef ENABLE_LIBRARY_PAGE " artist-screen" #endif #ifdef ENABLE_HELP_SCREEN
View file
ncmpc-0.32.tar.xz/src/Options.hxx -> ncmpc-0.36.tar.xz/src/Options.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,6 +23,8 @@ #include "config.h" #include "defaults.hxx" +#include <mpd/tag.h> + #include <vector> #include <string> #include <chrono> @@ -47,6 +49,11 @@ int search_mode; std::chrono::steady_clock::duration hide_cursor; int seek_time = 1; + +#ifdef ENABLE_LIBRARY_PAGE + std::vector<enum mpd_tag_type> library_page_tags{MPD_TAG_ARTIST, MPD_TAG_ALBUM}; +#endif + #ifdef ENABLE_LYRICS_SCREEN std::chrono::steady_clock::duration lyrics_timeout = std::chrono::minutes(1); bool lyrics_autosave = false;
View file
ncmpc-0.32.tar.xz/src/OutputsPage.cxx -> ncmpc-0.36.tar.xz/src/OutputsPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -184,7 +184,7 @@ switch (cmd) { case Command::PLAY: - Toggle(c, lw.selected); + Toggle(c, lw.GetCursorIndex()); return true; case Command::SCREEN_UPDATE:
View file
ncmpc-0.32.tar.xz/src/OutputsPage.hxx -> ncmpc-0.36.tar.xz/src/OutputsPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/Page.hxx -> ncmpc-0.36.tar.xz/src/Page.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -33,6 +33,7 @@ enum class Command : unsigned; struct mpdclient; +struct Window; class Page { Size last_size{0, 0}; @@ -85,6 +86,18 @@ virtual void OnClose() noexcept {} virtual void OnResize(Size size) noexcept = 0; virtual void Paint() const noexcept = 0; + + /** + * Give this object a chance to override painting the status bar. + * + * @return true if the status bar was painted, false if this + * object is not interested in overriding the status bar + * contents + */ + virtual bool PaintStatusBarOverride(const Window &) const noexcept { + return false; + } + virtual void Update(struct mpdclient &, unsigned) noexcept {} /**
View file
ncmpc-0.32.tar.xz/src/PageMeta.hxx -> ncmpc-0.36.tar.xz/src/PageMeta.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/Point.hxx -> ncmpc-0.36.tar.xz/src/Point.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/ProgressBar.cxx -> ncmpc-0.36.tar.xz/src/ProgressBar.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,10 +20,11 @@ #include "ProgressBar.hxx" #include "Styles.hxx" #include "Options.hxx" +#include "config.h" #include <assert.h> -ProgressBar::ProgressBar(Point p, unsigned _width) +ProgressBar::ProgressBar(Point p, unsigned _width) noexcept :window(p, {_width, 1u}) { leaveok(window.w, true); @@ -34,7 +35,7 @@ } void -ProgressBar::Paint() const +ProgressBar::Paint() const noexcept { if (max > 0) { assert(width < window.size.width); @@ -61,7 +62,7 @@ } bool -ProgressBar::Calculate() +ProgressBar::Calculate() noexcept { if (max == 0) return false; @@ -74,7 +75,7 @@ } void -ProgressBar::OnResize(Point p, unsigned _width) +ProgressBar::OnResize(Point p, unsigned _width) noexcept { window.Resize({_width, 1u}); window.Move(p); @@ -83,7 +84,7 @@ } bool -ProgressBar::Set(unsigned _current, unsigned _max) +ProgressBar::Set(unsigned _current, unsigned _max) noexcept { if (_current > _max) _current = _max;
View file
ncmpc-0.32.tar.xz/src/ProgressBar.hxx -> ncmpc-0.36.tar.xz/src/ProgressBar.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -30,16 +30,16 @@ unsigned width = 0; public: - ProgressBar(Point p, unsigned _width); + ProgressBar(Point p, unsigned _width) noexcept; - void OnResize(Point p, unsigned _width); + void OnResize(Point p, unsigned _width) noexcept; - bool Set(unsigned current, unsigned max); + bool Set(unsigned current, unsigned max) noexcept; - void Paint() const; + void Paint() const noexcept; private: - bool Calculate(); + bool Calculate() noexcept; }; #endif
View file
ncmpc-0.32.tar.xz/src/ProxyPage.cxx -> ncmpc-0.36.tar.xz/src/ProxyPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/ProxyPage.hxx -> ncmpc-0.36.tar.xz/src/ProxyPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,6 +21,7 @@ #define NCMPC_PROXY_PAGE_HXX #include "Page.hxx" +#include "config.h" class ProxyPage : public Page { WINDOW *const w;
View file
ncmpc-0.32.tar.xz/src/Queue.cxx -> ncmpc-0.36.tar.xz/src/Queue.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/Queue.hxx -> ncmpc-0.36.tar.xz/src/Queue.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/QueuePage.cxx -> ncmpc-0.36.tar.xz/src/QueuePage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -29,12 +29,14 @@ #include "config.h" #include "i18n.h" #include "charset.hxx" +#include "Command.hxx" #include "Options.hxx" #include "mpdclient.hxx" #include "strfsong.hxx" #include "Completion.hxx" #include "Styles.hxx" -#include "song_paint.hxx" +#include "SongRowPaint.hxx" +#include "time_format.hxx" #include "screen.hxx" #include "screen_utils.hxx" #include "SongPage.hxx" @@ -97,7 +99,7 @@ void Repaint() const { Paint(); - wrefresh(lw.w); + lw.Refresh(); } void CenterPlayingItem(const struct mpd_status *status, @@ -131,6 +133,7 @@ void OnOpen(struct mpdclient &c) noexcept override; void OnClose() noexcept override; void Paint() const noexcept override; + bool PaintStatusBarOverride(const Window &window) const noexcept override; void Update(struct mpdclient &c, unsigned events) noexcept override; bool OnCommand(struct mpdclient &c, Command cmd) override; @@ -144,9 +147,8 @@ const struct mpd_song * QueuePage::GetSelectedSong() const { - return !lw.range_selection && - lw.selected < playlist->size() - ? &(*playlist)[lw.selected] + return lw.IsSingleCursor() + ? &(*playlist)[lw.GetCursorIndex()] : nullptr; } @@ -237,7 +239,7 @@ current_song_id = get_current_song_id(status); /* center the cursor */ - if (options.auto_center && !lw.range_selection) + if (options.auto_center && !lw.HasRangeSelection()) CenterPlayingItem(status, false); return true; @@ -257,17 +259,17 @@ std::set<std::string> dir_list; public: - explicit DatabaseCompletion(struct mpdclient &_c) + explicit DatabaseCompletion(struct mpdclient &_c) noexcept :c(_c) {} protected: /* virtual methods from class Completion */ - void Pre(const char *value) override; - void Post(const char *value, Range range) override; + void Pre(const char *value) noexcept override; + void Post(const char *value, Range range) noexcept override; }; void -DatabaseCompletion::Pre(const char *line) +DatabaseCompletion::Pre(const char *line) noexcept { if (empty()) { /* create initial list */ @@ -281,7 +283,7 @@ } void -DatabaseCompletion::Post(const char *line, Range range) +DatabaseCompletion::Post(const char *line, Range range) noexcept { if (range.begin() != range.end() && std::next(range.begin()) != range.end()) @@ -339,7 +341,7 @@ /* hide the cursor when mpd is playing and the user is inactive */ if (playing) { - lw.hide_cursor = true; + lw.DisableCursor(); Repaint(); } else ScheduleHideCursor(); @@ -351,7 +353,7 @@ playlist = &c.playlist; if (options.hide_cursor > std::chrono::steady_clock::duration::zero()) { - lw.hide_cursor = false; + lw.EnableCursor(); ScheduleHideCursor(); } @@ -390,7 +392,7 @@ class hscroll *row_hscroll = nullptr; #ifndef NCMPC_MINI - row_hscroll = selected && options.scroll && lw.selected == i + row_hscroll = selected && options.scroll && lw.GetCursorIndex() == i ? &hscroll : nullptr; #endif @@ -410,6 +412,40 @@ lw.Paint(*this); } +bool +QueuePage::PaintStatusBarOverride(const Window &window) const noexcept +{ + if (!lw.HasRangeSelection()) + return false; + + WINDOW *const w = window.w; + + wmove(w, 0, 0); + wclrtoeol(w); + + unsigned duration = 0; + + assert(playlist != nullptr); + for (const unsigned i : lw.GetRange()) { + assert(i < playlist->size()); + const auto &song = (*playlist)[i]; + + duration += mpd_song_get_duration(&song); + } + + char duration_string[32]; + format_duration_short(duration_string, sizeof(duration_string), + duration); + const unsigned duration_width = strlen(duration_string); + + SelectStyle(w, Style::STATUS_TIME); + mvwaddstr(w, 0, window.size.width - duration_width, duration_string); + + wnoutrefresh(w); + + return true; +} + void QueuePage::Update(struct mpdclient &c, unsigned events) noexcept { @@ -451,8 +487,8 @@ return true; } - const unsigned old_selected = lw.selected; - lw.SetCursor(lw.start + p.y); + const unsigned old_selected = lw.GetCursorIndex(); + lw.SetCursorFromOrigin(p.y); if (bstate & BUTTON1_CLICKED) { /* play */ @@ -466,8 +502,8 @@ } } else if (bstate & BUTTON3_CLICKED) { /* delete */ - if (lw.selected == old_selected) - c.RunDelete(lw.selected); + if (lw.GetCursorIndex() == old_selected) + c.RunDelete(lw.GetCursorIndex()); lw.SetLength(playlist->size()); } @@ -488,7 +524,7 @@ const Command prev_cmd = cached_cmd; cached_cmd = cmd; - lw.hide_cursor = false; + lw.EnableCursor(); if (options.hide_cursor > std::chrono::steady_clock::duration::zero()) { ScheduleHideCursor(); @@ -542,8 +578,8 @@ #ifdef ENABLE_LYRICS_SCREEN case Command::SCREEN_LYRICS: - if (lw.selected < playlist->size()) { - struct mpd_song &selected = (*playlist)[lw.selected]; + if (lw.GetCursorIndex() < playlist->size()) { + struct mpd_song &selected = (*playlist)[lw.GetCursorIndex()]; bool follow = false;
View file
ncmpc-0.32.tar.xz/src/QueuePage.hxx -> ncmpc-0.36.tar.xz/src/QueuePage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/SearchPage.cxx -> ncmpc-0.36.tar.xz/src/SearchPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -27,7 +27,6 @@ #include "GlobalBindings.hxx" #include "charset.hxx" #include "mpdclient.hxx" -#include "strfsong.hxx" #include "screen_utils.hxx" #include "FileListPage.hxx" #include "filelist.hxx" @@ -114,8 +113,8 @@ !options.search_format.empty() ? options.search_format.c_str() : options.list_format.c_str()) { + lw.DisableCursor(); lw.SetLength(ARRAY_SIZE(help_text)); - lw.hide_cursor = true; } private: @@ -344,7 +343,7 @@ if (pattern.empty()) return; - lw.hide_cursor = false; + lw.EnableCursor(); delete filelist; filelist = do_search(&c, pattern.c_str()); if (filelist == nullptr)
View file
ncmpc-0.32.tar.xz/src/SearchPage.hxx -> ncmpc-0.36.tar.xz/src/SearchPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/Size.hxx -> ncmpc-0.36.tar.xz/src/Size.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/SongPage.cxx -> ncmpc-0.36.tar.xz/src/SongPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -115,7 +115,7 @@ SongPage(ScreenManager &_screen, WINDOW *w, Size size) noexcept :ListPage(w, size), screen(_screen) { - lw.hide_cursor = true; + lw.DisableCursor(); } ~SongPage() noexcept override { @@ -223,7 +223,7 @@ /* +2 for ': ' */ label_col += 2; - const int value_col = lw.size.width - label_col; + const int value_col = lw.GetWidth() - label_col; /* calculate the number of required linebreaks */ const Utf8ToLocale value_locale(value_utf8); const char *value = value_locale.c_str(); @@ -542,7 +542,7 @@ if (screen_find(screen, lw, cmd, *this)) { /* center the row */ - lw.Center(lw.selected); + lw.Center(lw.GetCursorIndex()); SetDirty(); return true; }
View file
ncmpc-0.32.tar.xz/src/SongPage.hxx -> ncmpc-0.36.tar.xz/src/SongPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.36.tar.xz/src/SongRowPaint.cxx
Added
@@ -0,0 +1,61 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "SongRowPaint.hxx" +#include "paint.hxx" +#include "strfsong.hxx" +#include "time_format.hxx" +#include "hscroll.hxx" +#include "config.h" // IWYU pragma: keep +#include "util/LocaleString.hxx" + +#include <mpd/client.h> + +#include <string.h> + +void +paint_song_row(WINDOW *w, gcc_unused unsigned y, unsigned width, + bool selected, bool highlight, const struct mpd_song *song, + gcc_unused class hscroll *hscroll, const char *format) +{ + char buffer[1024]; + + strfsong(buffer, sizeof(buffer), format, song); + row_paint_text(w, width, highlight ? Style::LIST_BOLD : Style::LIST, + selected, buffer); + +#ifndef NCMPC_MINI + if (options.second_column && mpd_song_get_duration(song) > 0) { + char duration[32]; + format_duration_short(duration, sizeof(duration), + mpd_song_get_duration(song)); + width -= strlen(duration) + 1; + wmove(w, y, width); + waddch(w, ' '); + waddstr(w, duration); + } + + if (hscroll != nullptr && StringWidthMB(buffer) >= width) { + hscroll->Set(0, y, width, buffer, + highlight ? Style::LIST_BOLD : Style::LIST, + selected ? A_REVERSE : 0); + hscroll->Paint(); + } +#endif +}
View file
ncmpc-0.36.tar.xz/src/SongRowPaint.hxx
Added
@@ -0,0 +1,46 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NCMPC_SONG_ROW_PAINT_HXX +#define NCMPC_SONG_ROW_PAINT_HXX + +#include <curses.h> + +struct mpd_song; +class hscroll; + +/** + * Paints a song into a list window row. The cursor must be set to + * the first character in the row prior to calling this function. + * + * @param w the ncurses window + * @param y the row number in the window + * @param width the width of the row + * @param selected true if the row is selected + * @param highlight true if the row is highlighted + * @param song the song object + * @param hscroll an optional hscroll object + * @param format the song format + */ +void +paint_song_row(WINDOW *w, unsigned y, unsigned width, + bool selected, bool highlight, const struct mpd_song *song, + class hscroll *hscroll, const char *format); + +#endif
View file
ncmpc-0.32.tar.xz/src/StatusBar.cxx -> ncmpc-0.36.tar.xz/src/StatusBar.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,6 @@ #include <mpd/client.h> -#include <assert.h> #include <string.h> StatusBar::StatusBar(boost::asio::io_service &io_service, @@ -171,7 +170,8 @@ /* scroll if the song name is to long */ #ifndef NCMPC_MINI center_width = StringWidthMB(center_text.c_str()); - if (options.scroll && center_width > (unsigned)width) { + if (options.scroll && width > 3 && + center_width > (unsigned)width) { hscroll.Set(left_width, 0, width, center_text.c_str(), Style::STATUS); } else {
View file
ncmpc-0.32.tar.xz/src/StatusBar.hxx -> ncmpc-0.36.tar.xz/src/StatusBar.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,15 +20,14 @@ #ifndef NCMPC_STATUS_BAR_HXX #define NCMPC_STATUS_BAR_HXX -#include "config.h" +#include "config.h" // IWYU pragma: keep +#include "AsioServiceFwd.hxx" #include "Window.hxx" #ifndef NCMPC_MINI #include "hscroll.hxx" #endif -#include <mpd/status.h> - #include <boost/asio/steady_timer.hpp> #include <string> @@ -62,7 +61,7 @@ Point p, unsigned width) noexcept; ~StatusBar() noexcept; - Window &GetWindow() noexcept { + const Window &GetWindow() const noexcept { return window; }
View file
ncmpc-0.32.tar.xz/src/Styles.cxx -> ncmpc-0.36.tar.xz/src/Styles.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,9 @@ #include "BasicColors.hxx" #include "CustomColors.hxx" #include "i18n.h" +#include "util/RuntimeError.hxx" #include "util/StringStrip.hxx" +#include "util/Compiler.h" #ifdef ENABLE_COLORS #include "Options.hxx" @@ -29,7 +31,7 @@ #include <assert.h> #include <stdio.h> -#include <stdlib.h> +#include <strings.h> #include <string.h> /** @@ -46,12 +48,6 @@ static constexpr short COLOR_INHERIT = -2; /** - * A magic value for certain parser functions to indicate that the - * parser has failed to recognize the string. - */ -static constexpr short COLOR_ERROR = -3; - -/** * A non-standad magic value which means "inherit attributes from the * parent style". */ @@ -94,7 +90,7 @@ #ifndef ENABLE_COLORS constexpr StyleData(const char *_name, Style, - short, short, attr_t, attr_t _mono) + short, short, attr_t, attr_t _mono) noexcept :name(_name), mono(_mono) {} #endif }; @@ -192,7 +188,7 @@ }; static constexpr auto & -GetStyle(Style style) +GetStyle(Style style) noexcept { return styles[size_t(style)]; } @@ -201,7 +197,7 @@ gcc_pure static Style -StyleByName(const char *name) +StyleByName(const char *name) noexcept { for (size_t i = 1; i < size_t(Style::END); ++i) if (!strcasecmp(styles[i].name, name)) @@ -211,7 +207,7 @@ } static void -colors_update_pair(Style style) +colors_update_pair(Style style) noexcept { auto &data = GetStyle(style); @@ -240,7 +236,9 @@ init_pair(short(style), fg, bg); } -gcc_pure +/** + * Throws on error. + */ static short ParseBackgroundColor(const char *s) { @@ -251,10 +249,13 @@ if (!strcasecmp(s, "none")) return COLOR_NONE; - return COLOR_ERROR; + throw FormatRuntimeError("%s: %s", _("Unknown color"), s); } -static bool +/** + * Throws on error. + */ +static void ParseStyle(StyleData &d, const char *str) { std::string copy(str); @@ -265,14 +266,7 @@ char *slash = strchr(cur, '/'); if (slash != nullptr) { const char *name = slash + 1; - short color = ParseBackgroundColor(name); - if (color < 0) { - fprintf(stderr, "%s: %s\n", - _("Unknown color"), name); - return false; - } - - d.bg_color = color; + d.bg_color = ParseBackgroundColor(name); *slash = 0; @@ -314,26 +308,19 @@ d.attr |= A_DIM; else if (!strcasecmp(cur, "bold")) d.attr |= A_BOLD; - else { - fprintf(stderr, "%s: %s\n", - _("Unknown color"), str); - return false; - } - + else + throw FormatRuntimeError("%s: %s", + _("Unknown color"), str); } - - return true; } -bool +void ModifyStyle(const char *name, const char *value) { const auto style = StyleByName(name); - if (style == Style::END) { - fprintf(stderr, "%s: %s", - _("Unknown color field"), name); - return false; - } + if (style == Style::END) + throw FormatRuntimeError("%s: %s", + _("Unknown color field"), name); auto &data = GetStyle(style); @@ -342,22 +329,15 @@ styles inherit their background color from; if the user configures a color, it will be the background color, but no attributes */ - short color = ParseBackgroundColor(value); - if (color != COLOR_ERROR) { - data.bg_color = color; - return true; - } else { - fprintf(stderr, "%s: %s\n", - _("Unknown color"), value); - return false; - } + data.bg_color = ParseBackgroundColor(value); + return; } return ParseStyle(data, value); } void -ApplyStyles() +ApplyStyles() noexcept { if (has_colors()) { /* initialize color support */ @@ -380,7 +360,7 @@ #endif void -SelectStyle(WINDOW *w, Style style) +SelectStyle(WINDOW *w, Style style) noexcept { const auto &data = GetStyle(style);
View file
ncmpc-0.32.tar.xz/src/Styles.hxx -> ncmpc-0.36.tar.xz/src/Styles.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -52,14 +52,19 @@ }; #ifdef ENABLE_COLORS -bool + +/** + * Throws on error. + */ +void ModifyStyle(const char *name, const char *value); void -ApplyStyles(); +ApplyStyles() noexcept; + #endif void -SelectStyle(WINDOW *w, Style style); +SelectStyle(WINDOW *w, Style style) noexcept; #endif
View file
ncmpc-0.32.tar.xz/src/TabBar.cxx -> ncmpc-0.36.tar.xz/src/TabBar.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -26,7 +26,7 @@ #include "i18n.h" static void -PaintPageTab(WINDOW *w, Command cmd, const char *label, bool selected) +PaintPageTab(WINDOW *w, Command cmd, const char *label, bool selected) noexcept { SelectStyle(w, selected ? Style::TITLE : Style::TITLE_BOLD); if (selected) @@ -52,7 +52,7 @@ void PaintTabBar(WINDOW *w, const PageMeta ¤t_page_meta, - const char *current_page_title) + const char *current_page_title) noexcept { for (unsigned i = 0;; ++i) { const auto *page = GetPageMeta(i);
View file
ncmpc-0.32.tar.xz/src/TabBar.hxx -> ncmpc-0.36.tar.xz/src/TabBar.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -26,6 +26,6 @@ void PaintTabBar(WINDOW *w, const PageMeta ¤t_page_meta, - const char *current_page_title); + const char *current_page_title) noexcept; #endif
View file
ncmpc-0.36.tar.xz/src/TagFilter.cxx
Added
@@ -0,0 +1,56 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "TagFilter.hxx" + +#include <mpd/client.h> + +const char * +FindTag(const TagFilter &filter, enum mpd_tag_type tag) noexcept +{ + for (const auto &i : filter) + if (i.first == tag) + return i.second.c_str(); + + return nullptr; +} + +void +AddConstraints(struct mpd_connection *connection, + const TagFilter &filter) noexcept +{ + for (const auto &i : filter) + mpd_search_add_tag_constraint(connection, + MPD_OPERATOR_DEFAULT, + i.first, i.second.c_str()); +} + +std::string +ToString(const TagFilter &filter) noexcept +{ + std::string result; + + for (const auto &i : filter) { + if (!result.empty()) + result.insert(0, " - "); + result.insert(0, i.second); + } + + return result; +}
View file
ncmpc-0.36.tar.xz/src/TagFilter.hxx
Added
@@ -0,0 +1,46 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NCMPC_TAG_FILTER_HXX +#define NCMPC_TAG_FILTER_HXX + +#include "util/Compiler.h" + +#include <mpd/tag.h> + +#include <string> +#include <forward_list> + +class ScreenManager; + +using TagFilter = std::forward_list<std::pair<enum mpd_tag_type, std::string>>; + +gcc_pure +const char * +FindTag(const TagFilter &filter, enum mpd_tag_type tag) noexcept; + +void +AddConstraints(struct mpd_connection *connection, + const TagFilter &filter) noexcept; + +gcc_pure +std::string +ToString(const TagFilter &filter) noexcept; + +#endif
View file
ncmpc-0.36.tar.xz/src/TagListPage.cxx
Added
@@ -0,0 +1,254 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "TagListPage.hxx" +#include "screen_status.hxx" +#include "screen_find.hxx" +#include "FileListPage.hxx" +#include "Command.hxx" +#include "i18n.h" +#include "charset.hxx" +#include "mpdclient.hxx" +#include "util/StringUTF8.hxx" + +#include <algorithm> + +#include <assert.h> +#include <string.h> + +TagFilter +TagListPage::MakeCursorFilter() const noexcept +{ + unsigned i = lw.GetCursorIndex(); + if (parent != nullptr) { + if (i == 0) + return {}; + + --i; + } + + auto new_filter = filter; + if (i < values.size()) + new_filter.emplace_front(tag, values[i]); + return new_filter; +} + +gcc_pure +static bool +CompareUTF8(const std::string &a, const std::string &b) +{ + return CollateUTF8(a.c_str(), b.c_str()) < 0; +} + +const char * +TagListPage::GetListItemText(char *buffer, size_t size, + unsigned idx) const noexcept +{ + if (parent != nullptr) { + if (idx == 0) + return ".."; + + --idx; + } + + if (idx == values.size() + 1) + return _("All tracks"); + + assert(idx < values.size()); + + return utf8_to_locale(values[idx].c_str(), buffer, size); +} + +static void +recv_tag_values(struct mpd_connection *connection, enum mpd_tag_type tag, + std::vector<std::string> &list) +{ + struct mpd_pair *pair; + + while ((pair = mpd_recv_pair_tag(connection, tag)) != nullptr) { + list.emplace_back(pair->value); + mpd_return_pair(connection, pair); + } +} + +void +TagListPage::LoadValues(struct mpdclient &c) noexcept +{ + auto *connection = c.GetConnection(); + + values.clear(); + + if (connection != nullptr) { + mpd_search_db_tags(connection, tag); + AddConstraints(connection, filter); + mpd_search_commit(connection); + + recv_tag_values(connection, tag, values); + + c.FinishCommand(); + } + + /* sort list */ + std::sort(values.begin(), values.end(), CompareUTF8); + lw.SetLength((parent != nullptr) + values.size() + (all_text != nullptr)); +} + +void +TagListPage::Reload(struct mpdclient &c) +{ + LoadValues(c); +} + +/** + * Paint one item in the album list. There are two virtual items + * inserted: at the beginning, there's the special item ".." to go to + * the parent directory, and at the end, there's the item "All tracks" + * to view the tracks of all albums. + */ +void +TagListPage::PaintListItem(WINDOW *w, unsigned i, + gcc_unused unsigned y, unsigned width, + bool selected) const noexcept +{ + if (parent != nullptr) { + if (i == 0) { + screen_browser_paint_directory(w, width, selected, + ".."); + return; + } + + --i; + } + + if (i < values.size()) + screen_browser_paint_directory(w, width, selected, + Utf8ToLocale(values[i].c_str()).c_str()); + else + screen_browser_paint_directory(w, width, selected, + all_text); +} + +void +TagListPage::Paint() const noexcept +{ + lw.Paint(*this); +} + +const char * +TagListPage::GetTitle(char *, size_t) const noexcept +{ + return title.c_str(); +} + +void +TagListPage::Update(struct mpdclient &c, unsigned events) noexcept +{ + if (events & MPD_IDLE_DATABASE) { + /* the db has changed -> update the list */ + Reload(c); + SetDirty(); + } +} + +/* add_query - Add all songs satisfying specified criteria. + _artist is actually only used in the ALBUM case to distinguish albums with + the same name from different artists. */ +static void +add_query(struct mpdclient *c, const TagFilter &filter, + enum mpd_tag_type tag, const char *value) noexcept +{ + auto *connection = c->GetConnection(); + if (connection == nullptr) + return; + + const char *text = value; + if (value == nullptr) + value = filter.empty() ? "?" : filter.front().second.c_str(); + + screen_status_printf(_("Adding \'%s\' to queue"), + Utf8ToLocale(text).c_str()); + + mpd_search_add_db_songs(connection, true); + AddConstraints(connection, filter); + + if (value != nullptr) + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, + tag, value); + + mpd_search_commit(connection); + c->FinishCommand(); +} + +bool +TagListPage::OnCommand(struct mpdclient &c, Command cmd)
View file
ncmpc-0.36.tar.xz/src/TagListPage.hxx
Added
@@ -0,0 +1,113 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef NCMPC_TAG_LIST_PAGE_HXX +#define NCMPC_TAG_LIST_PAGE_HXX + +#include "TagFilter.hxx" +#include "ListPage.hxx" +#include "ListRenderer.hxx" +#include "ListText.hxx" + +#include <vector> +#include <string> + +class ScreenManager; + +class TagListPage final : public ListPage, ListRenderer, ListText { + ScreenManager &screen; + Page *const parent; + + const enum mpd_tag_type tag; + const char *const all_text; + + TagFilter filter; + std::string title; + + std::vector<std::string> values; + +public: + TagListPage(ScreenManager &_screen, Page *_parent, + const enum mpd_tag_type _tag, + const char *_all_text, + WINDOW *_w, Size size) noexcept + :ListPage(_w, size), screen(_screen), parent(_parent), + tag(_tag), all_text(_all_text) {} + + auto GetTag() const noexcept { + return tag; + } + + const auto &GetFilter() const noexcept { + return filter; + } + + template<typename F> + void SetFilter(F &&_filter) noexcept { + filter = std::forward<F>(_filter); + AddPendingEvents(~0u); + } + + template<typename T> + void SetTitle(T &&_title) noexcept { + title = std::forward<T>(_title); + } + + /** + * Create a filter for the item below the cursor. + */ + TagFilter MakeCursorFilter() const noexcept; + + gcc_pure + const char *GetSelectedValue() const { + unsigned i = lw.GetCursorIndex(); + + if (parent != nullptr) { + if (i == 0) + return nullptr; + + --i; + } + + return i < values.size() + ? values[i].c_str() + : nullptr; + } + +private: + void LoadValues(struct mpdclient &c) noexcept; + void Reload(struct mpdclient &c); + +public: + /* virtual methods from class Page */ + void Paint() const noexcept override; + void Update(struct mpdclient &c, unsigned events) noexcept override; + bool OnCommand(struct mpdclient &c, Command cmd) override; + const char *GetTitle(char *s, size_t size) const noexcept override; + + /* virtual methods from class ListRenderer */ + void PaintListItem(WINDOW *w, unsigned i, unsigned y, unsigned width, + bool selected) const noexcept override; + + /* virtual methods from class ListText */ + const char *GetListItemText(char *buffer, size_t size, + unsigned i) const noexcept override; +}; + +#endif
View file
ncmpc-0.36.tar.xz/src/TagMask.hxx
Added
@@ -0,0 +1,105 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef TAG_MASK_HXX +#define TAG_MASK_HXX + +#include <mpd/tag.h> + +#include <initializer_list> + +#include <stdint.h> + +class TagMask { + typedef uint_least32_t mask_t; + mask_t value; + + explicit constexpr TagMask(uint_least32_t _value) noexcept + :value(_value) {} + +public: + TagMask() = default; + + constexpr TagMask(enum mpd_tag_type tag) noexcept + :value(mask_t(1) << mask_t(tag)) {} + + constexpr TagMask(std::initializer_list<enum mpd_tag_type> il) noexcept + :value(0) + { + for (auto i : il) + *this |= TagMask(i); + } + + static constexpr TagMask None() noexcept { + return TagMask(mask_t(0)); + } + + static constexpr TagMask All() noexcept { + return ~None(); + } + + constexpr TagMask operator~() const noexcept { + return TagMask(~value); + } + + constexpr TagMask operator&(TagMask other) const noexcept { + return TagMask(value & other.value); + } + + constexpr TagMask operator|(TagMask other) const noexcept { + return TagMask(value | other.value); + } + + constexpr TagMask operator^(TagMask other) const noexcept { + return TagMask(value ^ other.value); + } + + constexpr TagMask &operator&=(TagMask other) noexcept { + value &= other.value; + return *this; + } + + constexpr TagMask &operator|=(TagMask other) noexcept { + value |= other.value; + return *this; + } + + constexpr TagMask &operator^=(TagMask other) noexcept { + value ^= other.value; + return *this; + } + + constexpr bool TestAny() const noexcept { + return value != 0; + } + + constexpr bool Test(enum mpd_tag_type tag) const noexcept { + return (*this & tag).TestAny(); + } + + void Set(enum mpd_tag_type tag) noexcept { + *this |= tag; + } + + void Unset(enum mpd_tag_type tag) noexcept { + *this |= ~TagMask(tag); + } +}; + +#endif
View file
ncmpc-0.32.tar.xz/src/TextListRenderer.cxx -> ncmpc-0.36.tar.xz/src/TextListRenderer.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -17,7 +17,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "config.h" #include "TextListRenderer.hxx" #include "ListText.hxx" #include "paint.hxx"
View file
ncmpc-0.32.tar.xz/src/TextListRenderer.hxx -> ncmpc-0.36.tar.xz/src/TextListRenderer.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -22,7 +22,6 @@ #include "ListRenderer.hxx" -class ScreenManager; class ListText; class TextListRenderer final : public ListRenderer {
View file
ncmpc-0.32.tar.xz/src/TextPage.cxx -> ncmpc-0.36.tar.xz/src/TextPage.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -89,10 +89,10 @@ if (ListPage::OnCommand(c, cmd)) return true; - lw.SetCursor(lw.start); + lw.SetCursorFromOrigin(0); if (screen_find(screen, lw, cmd, *this)) { /* center the row */ - lw.Center(lw.selected); + lw.Center(lw.GetCursorIndex()); SetDirty(); return true; }
View file
ncmpc-0.32.tar.xz/src/TextPage.hxx -> ncmpc-0.36.tar.xz/src/TextPage.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -42,7 +42,7 @@ TextPage(ScreenManager &_screen, WINDOW *w, Size size) noexcept :ListPage(w, size), screen(_screen) { - lw.hide_cursor = true; + lw.DisableCursor(); } protected: @@ -70,7 +70,7 @@ */ void Repaint() noexcept { Paint(); - wrefresh(lw.w); + lw.Refresh(); } public:
View file
ncmpc-0.32.tar.xz/src/TitleBar.cxx -> ncmpc-0.36.tar.xz/src/TitleBar.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -30,7 +30,7 @@ #include <string.h> -TitleBar::TitleBar(Point p, unsigned width) +TitleBar::TitleBar(Point p, unsigned width) noexcept :window(p, {width, GetHeight()}) { leaveok(window.w, true); @@ -43,7 +43,7 @@ } static inline int -get_volume(const struct mpd_status *status) +get_volume(const struct mpd_status *status) noexcept { return status != nullptr ? mpd_status_get_volume(status) @@ -51,7 +51,7 @@ } void -TitleBar::Update(const struct mpd_status *status) +TitleBar::Update(const struct mpd_status *status) noexcept { volume = get_volume(status); @@ -74,7 +74,8 @@ } void -TitleBar::Paint(const PageMeta ¤t_page_meta, const char *title) const +TitleBar::Paint(const PageMeta ¤t_page_meta, + const char *title) const noexcept { WINDOW *w = window.w; @@ -122,7 +123,7 @@ } void -TitleBar::OnResize(unsigned width) +TitleBar::OnResize(unsigned width) noexcept { window.Resize({width, GetHeight()}); }
View file
ncmpc-0.32.tar.xz/src/TitleBar.hxx -> ncmpc-0.36.tar.xz/src/TitleBar.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -32,15 +32,16 @@ char flags[8]; public: - TitleBar(Point p, unsigned width); + TitleBar(Point p, unsigned width) noexcept; - static constexpr unsigned GetHeight() { + static constexpr unsigned GetHeight() noexcept { return 2; } - void OnResize(unsigned width); - void Update(const struct mpd_status *status); - void Paint(const PageMeta ¤t_page_meta, const char *title) const; + void OnResize(unsigned width) noexcept; + void Update(const struct mpd_status *status) noexcept; + void Paint(const PageMeta ¤t_page_meta, + const char *title) const noexcept; }; #endif
View file
ncmpc-0.36.tar.xz/src/UserInput.cxx
Added
@@ -0,0 +1,28 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "UserInput.hxx" + +#include <unistd.h> + +UserInput::UserInput(boost::asio::io_service &io_service) + :d(io_service) +{ + d.assign(STDIN_FILENO); +}
View file
ncmpc-0.36.tar.xz/src/UserInput.hxx
Added
@@ -0,0 +1,45 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef USER_INPUT_HXX +#define USER_INPUT_HXX + +#include "AsioServiceFwd.hxx" +#include "AsioGetIoService.hxx" + +#include <boost/asio/posix/stream_descriptor.hpp> + +class UserInput { + boost::asio::posix::stream_descriptor d; + +public: + explicit UserInput(boost::asio::io_service &io_service); + + auto &get_io_context() noexcept { + return ::get_io_service(d); + } + + template<typename F> + void AsyncWait(F &&f) noexcept { + d.async_read_some(boost::asio::null_buffers(), + std::forward<F>(f)); + } +}; + +#endif
View file
ncmpc-0.36.tar.xz/src/WaitUserInput.hxx
Added
@@ -0,0 +1,49 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef WAIT_USER_INPUT_HXX +#define WAIT_USER_INPUT_HXX + +#include <sys/poll.h> +#include <unistd.h> + +class WaitUserInput { + struct pollfd pfd; + +public: + WaitUserInput() noexcept { + pfd.fd = STDIN_FILENO; + pfd.events = POLLIN; + } + + bool IsReady() noexcept { + return Poll(0); + } + + bool Wait() noexcept { + return Poll(-1); + } + +private: + bool Poll(int timeout) noexcept { + return poll(&pfd, 1, timeout) > 0; + } +}; + +#endif
View file
ncmpc-0.32.tar.xz/src/Window.hxx -> ncmpc-0.36.tar.xz/src/Window.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.36.tar.xz/src/XdgBaseDirectory.cxx
Added
@@ -0,0 +1,76 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "XdgBaseDirectory.hxx" +#include "config.h" +#include "io/Path.hxx" + +#include <stdlib.h> +#include <sys/stat.h> + +gcc_pure +static bool +IsDirectory(const char *path) noexcept +{ + struct stat st; + return stat(path, &st) == 0 && S_ISDIR(st.st_mode); +} + +const char * +GetHomeDirectory() noexcept +{ + return getenv("HOME"); +} + +std::string +GetHomeConfigDirectory() noexcept +{ + const char *config_home = getenv("XDG_CONFIG_HOME"); + if (config_home != nullptr && *config_home != 0) + return config_home; + + const char *home = GetHomeDirectory(); + if (home != nullptr) + return BuildPath(home, ".config"); + + return {}; +} + +std::string +GetHomeConfigDirectory(const char *package) noexcept +{ + const auto dir = GetHomeConfigDirectory(); + if (dir.empty()) + return {}; + + return BuildPath(dir, package); +} + +std::string +MakeUserConfigPath(const char *filename) noexcept +{ + const auto directory = GetHomeConfigDirectory(PACKAGE); + if (directory.empty()) + return {}; + + return IsDirectory(directory.c_str()) || + mkdir(directory.c_str(), 0755) == 0 + ? BuildPath(directory, filename) + : std::string(); +}
View file
ncmpc-0.36.tar.xz/src/XdgBaseDirectory.hxx
Added
@@ -0,0 +1,48 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef XDG_BASE_DIRECTORY_HXX +#define XDG_BASE_DIRECTORY_HXX + +#include "util/Compiler.h" + +#include <string> + +gcc_const +const char * +GetHomeDirectory() noexcept; + +gcc_const +std::string +GetHomeConfigDirectory() noexcept; + +gcc_pure +std::string +GetHomeConfigDirectory(const char *package) noexcept; + +/** + * Find or create the directory for writing configuration files. + * + * @return the absolute path; an empty string indicates that no + * directory could be created + */ +std::string +MakeUserConfigPath(const char *filename) noexcept; + +#endif
View file
ncmpc-0.32.tar.xz/src/aconnect.cxx -> ncmpc-0.36.tar.xz/src/aconnect.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without @@ -125,7 +125,7 @@ *acp = ac; - ac->rconnect.Start(host, port); + ac->rconnect.Start(io_service, host, port); } void
View file
ncmpc-0.32.tar.xz/src/aconnect.hxx -> ncmpc-0.36.tar.xz/src/aconnect.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without
View file
ncmpc-0.32.tar.xz/src/callbacks.cxx -> ncmpc-0.36.tar.xz/src/callbacks.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/callbacks.hxx -> ncmpc-0.36.tar.xz/src/callbacks.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,8 +20,6 @@ #ifndef NCMPC_CALLBACKS_H #define NCMPC_CALLBACKS_H -#include <mpd/client.h> - struct mpdclient; /**
View file
ncmpc-0.32.tar.xz/src/charset.cxx -> ncmpc-0.36.tar.xz/src/charset.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/charset.hxx -> ncmpc-0.36.tar.xz/src/charset.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/db_completion.cxx -> ncmpc-0.36.tar.xz/src/db_completion.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/db_completion.hxx -> ncmpc-0.36.tar.xz/src/db_completion.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/defaults.hxx -> ncmpc-0.36.tar.xz/src/defaults.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -27,10 +27,10 @@ #define DEFAULT_SCREEN_LIST {"playlist", "browse"} /* song format - list window */ -#define DEFAULT_LIST_FORMAT "%name%|[[%artist%|%performer%|%composer%] - ][%title%|%shortfile%]" +#define DEFAULT_LIST_FORMAT "%name%|[[%artist%|%performer%|%composer%|%albumartist%] - ][%title%|%shortfile%]" /* song format - status window */ -#define DEFAULT_STATUS_FORMAT "[[%artist%|%performer%|%composer%] - ][%title%|%shortfile%]" +#define DEFAULT_STATUS_FORMAT "[[%artist%|%performer%|%composer%|%albumartist%] - ][%title%|%shortfile%]" #define DEFAULT_LYRICS_TIMEOUT 100
View file
ncmpc-0.32.tar.xz/src/filelist.cxx -> ncmpc-0.36.tar.xz/src/filelist.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/filelist.hxx -> ncmpc-0.36.tar.xz/src/filelist.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/gidle.cxx -> ncmpc-0.36.tar.xz/src/gidle.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without @@ -27,14 +27,12 @@ */ #include "gidle.hxx" -#include "util/Compiler.h" #include <mpd/async.h> #include <mpd/parser.h> #include <assert.h> #include <string.h> -#include <errno.h> MpdIdleSource::MpdIdleSource(boost::asio::io_service &io_service, struct mpd_connection &_connection,
View file
ncmpc-0.32.tar.xz/src/gidle.hxx -> ncmpc-0.36.tar.xz/src/gidle.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without
View file
ncmpc-0.32.tar.xz/src/hscroll.cxx -> ncmpc-0.36.tar.xz/src/hscroll.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,9 +19,6 @@ #include "hscroll.hxx" #include "Styles.hxx" -#include "charset.hxx" - -#include <algorithm> #include <assert.h>
View file
ncmpc-0.32.tar.xz/src/hscroll.hxx -> ncmpc-0.36.tar.xz/src/hscroll.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/i18n.h -> ncmpc-0.36.tar.xz/src/i18n.h
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -24,7 +24,7 @@ #ifdef ENABLE_NLS -#include <libintl.h> +#include <libintl.h> // IWYU pragma: export #define _(x) gettext(x)
View file
ncmpc-0.32.tar.xz/src/io/Path.hxx -> ncmpc-0.36.tar.xz/src/io/Path.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/lirc.cxx -> ncmpc-0.36.tar.xz/src/lirc.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,8 +19,8 @@ #include "lirc.hxx" #include "ncmpc.hxx" -#include "Bindings.hxx" -#include "util/Compiler.h" +#include "Command.hxx" +#include "config.h" #include <lirc/lirc_client.h> @@ -37,7 +37,7 @@ if (lirc_nextcode(&code) == 0) { while (lirc_code2char(lc, code, &txt) == 0 && txt != nullptr) { const auto cmd = get_key_command_from_name(txt); - if (!do_input_event(d.get_io_service(), cmd)) + if (!do_input_event(get_io_context(), cmd)) return; } }
View file
ncmpc-0.32.tar.xz/src/lirc.hxx -> ncmpc-0.36.tar.xz/src/lirc.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,17 +21,23 @@ #define LIRC_H #include "AsioServiceFwd.hxx" +#include "AsioGetIoService.hxx" #include <boost/asio/posix/stream_descriptor.hpp> class LircInput { boost::asio::posix::stream_descriptor d; + struct lirc_config *lc = nullptr; public: explicit LircInput(boost::asio::io_service &io_service); ~LircInput(); + auto &get_io_context() noexcept { + return ::get_io_service(d); + } + private: void AsyncWait() { d.async_read_some(boost::asio::null_buffers(),
View file
ncmpc-0.32.tar.xz/src/lyrics.cxx -> ncmpc-0.36.tar.xz/src/lyrics.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,26 +18,25 @@ */ #include "lyrics.hxx" +#include "plugin.hxx" #include "config.h" -#include <assert.h> - -static PluginList empty, plugins; +static PluginList plugins; void lyrics_init() { - plugin_list_load_directory(&plugins, LYRICS_PLUGIN_DIR); + plugins = plugin_list_load_directory(LYRICS_PLUGIN_DIR); } PluginCycle * lyrics_load(boost::asio::io_service &io_service, const char *artist, const char *title, - plugin_callback_t callback, void *data) + PluginResponseHandler &handler) { - const char *args[3] = { artist, title, nullptr }; + assert(artist != nullptr); + assert(title != nullptr); - if (artist == nullptr || title == nullptr) - return plugin_run(io_service, &empty, args, callback, data); + const char *args[3] = { artist, title, nullptr }; - return plugin_run(io_service, &plugins, args, callback, data); + return plugin_run(io_service, &plugins, args, handler); }
View file
ncmpc-0.32.tar.xz/src/lyrics.hxx -> ncmpc-0.36.tar.xz/src/lyrics.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,16 +20,16 @@ #ifndef LYRICS_H #define LYRICS_H -#include "plugin.hxx" #include "AsioServiceFwd.hxx" struct PluginCycle; +class PluginResponseHandler; void lyrics_init(); PluginCycle * lyrics_load(boost::asio::io_service &io_service, const char *artist, const char *title, - plugin_callback_t callback, void *callback_data); + PluginResponseHandler &handler); #endif
View file
ncmpc-0.32.tar.xz/src/mpdclient.cxx -> ncmpc-0.36.tar.xz/src/mpdclient.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,6 @@ #include "mpdclient.hxx" #include "callbacks.hxx" -#include "filelist.hxx" #include "config.h" #include "gidle.hxx" #include "charset.hxx" @@ -156,6 +155,9 @@ const char *_host, unsigned _port, unsigned _timeout_ms, const char *_password) :timeout_ms(_timeout_ms), password(_password), +#if BOOST_VERSION >= 107000 + io_context(io_service), +#endif enter_idle_timer(io_service) { #ifdef ENABLE_ASYNC_CONNECT @@ -186,7 +188,7 @@ if (host == nullptr) host = "unknown"; - if (host[0] == '/') + if (host[0] == '/' || host[0] == '@') return host; unsigned port = mpd_settings_get_port(settings); @@ -215,6 +217,21 @@ #endif } +#ifdef HAVE_TAG_WHITELIST + +void +mpdclient::WhitelistTags(TagMask mask) noexcept +{ + if (!enable_tag_whitelist) { + enable_tag_whitelist = true; + tag_whitelist = TagMask::None(); + } + + tag_whitelist |= mask; +} + +#endif + void mpdclient::ClearStatus() noexcept { @@ -262,6 +279,32 @@ events |= MPD_IDLE_ALL; } +#ifdef HAVE_TAG_WHITELIST + +static bool +SendTagWhitelist(struct mpd_connection *c, const TagMask whitelist) noexcept +{ + if (!mpd_command_list_begin(c, false) || + !mpd_send_clear_tag_types(c)) + return false; + + /* convert the "tag_bits" mask to an array of enum + mpd_tag_type for mpd_send_enable_tag_types() */ + + enum mpd_tag_type types[64]; + unsigned n = 0; + + for (unsigned i = 0; i < MPD_TAG_COUNT; ++i) + if (whitelist.Test((enum mpd_tag_type)i)) + types[n++] = (enum mpd_tag_type)i; + + return (n == 0 || mpd_send_enable_tag_types(c, types, n)) && + mpd_command_list_end(c) && + mpd_response_finish(c); +} + +#endif + bool mpdclient::OnConnected(struct mpd_connection *_connection) noexcept { @@ -288,6 +331,16 @@ return false; } +#ifdef HAVE_TAG_WHITELIST + if (enable_tag_whitelist && + !SendTagWhitelist(connection, tag_whitelist)) { + InvokeErrorCallback(); + Disconnect(); + mpdclient_failed_callback(); + return false; + } +#endif + source = new MpdIdleSource(get_io_service(), *connection, *this); ScheduleEnterIdle();
View file
ncmpc-0.32.tar.xz/src/mpdclient.hxx -> ncmpc-0.36.tar.xz/src/mpdclient.hxx
Changed
@@ -1,5 +1,24 @@ -#ifndef MPDCLIENT_H -#define MPDCLIENT_H +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2019 The Music Player Daemon Project + * Project homepage: http://musicpd.org + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPDCLIENT_HXX +#define MPDCLIENT_HXX #include "config.h" #include "Queue.hxx" @@ -11,16 +30,18 @@ #include "aconnect.hxx" #endif -#include <mpd/client.h> +#include <mpd/client.h> // IWYU pragma: export + +#if LIBMPDCLIENT_CHECK_VERSION(2,12,0) +#define HAVE_TAG_WHITELIST +#include "TagMask.hxx" +#endif #include <boost/asio/steady_timer.hpp> #include <string> struct AsyncMpdConnect; -struct MpdQueue; -class MpdIdleSource; -class FileList; struct mpdclient final : MpdIdleHandler @@ -71,6 +92,10 @@ struct mpd_status *status = nullptr; const struct mpd_song *current_song = nullptr; +#if BOOST_VERSION >= 107000 + boost::asio::io_context &io_context; +#endif + /** * A timer which re-enters MPD idle mode before the next main * loop iteration. @@ -92,6 +117,11 @@ enum mpd_state state = MPD_STATE_UNKNOWN; +#ifdef HAVE_TAG_WHITELIST + bool enable_tag_whitelist = false; + TagMask tag_whitelist; +#endif + #if defined(ENABLE_ASYNC_CONNECT) && !defined(_WIN32) bool connecting2; #endif @@ -130,7 +160,11 @@ } auto &get_io_service() noexcept { +#if BOOST_VERSION >= 107000 + return io_context; +#else return enter_idle_timer.get_io_service(); +#endif } #ifdef ENABLE_ASYNC_CONNECT @@ -155,6 +189,10 @@ */ std::string GetSettingsName() const; +#ifdef HAVE_TAG_WHITELIST + void WhitelistTags(TagMask mask) noexcept; +#endif + bool IsConnected() const { return connection != nullptr; } @@ -272,23 +310,21 @@ const char *message) noexcept override; }; -enum { - /** - * all idle events the version of libmpdclient, ncmpc is compiled - * against, supports - */ - MPD_IDLE_ALL = MPD_IDLE_DATABASE - | MPD_IDLE_STORED_PLAYLIST - | MPD_IDLE_QUEUE - | MPD_IDLE_PLAYER - | MPD_IDLE_MIXER - | MPD_IDLE_OUTPUT - | MPD_IDLE_OPTIONS - | MPD_IDLE_UPDATE - | MPD_IDLE_STICKER - | MPD_IDLE_SUBSCRIPTION - | MPD_IDLE_MESSAGE -}; +/** + * All idle events the version of libmpdclient, ncmpc is compiled + * against, supports. + */ +static constexpr unsigned MPD_IDLE_ALL = MPD_IDLE_DATABASE + | MPD_IDLE_STORED_PLAYLIST + | MPD_IDLE_QUEUE + | MPD_IDLE_PLAYER + | MPD_IDLE_MIXER + | MPD_IDLE_OUTPUT + | MPD_IDLE_OPTIONS + | MPD_IDLE_UPDATE + | MPD_IDLE_STICKER + | MPD_IDLE_SUBSCRIPTION + | MPD_IDLE_MESSAGE; /*** MPD Commands **********************************************************/
View file
ncmpc-0.32.tar.xz/src/ncmpc.hxx -> ncmpc-0.36.tar.xz/src/ncmpc.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/ncu.cxx -> ncmpc-0.36.tar.xz/src/ncu.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,10 @@ #include <curses.h> +#ifdef NCURSES_VERSION +#include <string.h> +#endif + static SCREEN *ncu_screen; void @@ -55,6 +59,26 @@ /* enable extra keys */ keypad(stdscr, true); +#ifdef NCURSES_VERSION + /* define Alt-* keys which for some reasons aren't defined by + default (tested with ncurses 6.1 on Linux) */ + + if (!key_defined("M-^@")) { + char buffer[8]; + buffer[0] = 033; + + for (int i = 0x80; i <= 0xff; ++i) { + const char *name = keyname(i); + if (name != nullptr && name[0] == 'M' && + name[1] == '-' && name[2] != 0 && + (name[3] == 0 || name[4] == 0)) { + strcpy(buffer + 1, name + 2); + define_key(buffer, i); + } + } + } +#endif + /* initialize mouse support */ #ifdef HAVE_GETMOUSE if (options.enable_mouse)
View file
ncmpc-0.32.tar.xz/src/ncu.hxx -> ncmpc-0.36.tar.xz/src/ncu.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/net/AsyncConnect.cxx -> ncmpc-0.36.tar.xz/src/net/AsyncConnect.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without
View file
ncmpc-0.32.tar.xz/src/net/AsyncConnect.hxx -> ncmpc-0.36.tar.xz/src/net/AsyncConnect.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without
View file
ncmpc-0.32.tar.xz/src/net/AsyncHandler.hxx -> ncmpc-0.36.tar.xz/src/net/AsyncHandler.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without
View file
ncmpc-0.32.tar.xz/src/net/AsyncResolveConnect.cxx -> ncmpc-0.36.tar.xz/src/net/AsyncResolveConnect.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without @@ -54,7 +54,8 @@ } void -AsyncResolveConnect::Start(const char *host, unsigned port) noexcept +AsyncResolveConnect::Start(boost::asio::io_service &io_service, + const char *host, unsigned port) noexcept { #ifndef _WIN32 if (host[0] == '/' || host[0] == '@') { @@ -64,7 +65,7 @@ s.front() = 0; boost::asio::local::stream_protocol::endpoint ep(std::move(s)); - boost::asio::local::stream_protocol::socket socket(resolver.get_io_service()); + boost::asio::local::stream_protocol::socket socket(io_service); boost::system::error_code error; socket.connect(ep, error); @@ -76,6 +77,8 @@ handler.OnConnect(std::move(socket)); return; } +#else + (void)io_service; #endif /* _WIN32 */ char service[20];
View file
ncmpc-0.32.tar.xz/src/net/AsyncResolveConnect.hxx -> ncmpc-0.36.tar.xz/src/net/AsyncResolveConnect.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - (c) 2004-2018 The Music Player Daemon Project + (c) 2004-2019 The Music Player Daemon Project Project homepage: http://musicpd.org Redistribution and use in source and binary forms, with or without @@ -47,7 +47,8 @@ /** * Resolve a host name and connect to it asynchronously. */ - void Start(const char *host, unsigned port) noexcept; + void Start(boost::asio::io_service &io_service, + const char *host, unsigned port) noexcept; private: void OnResolved(const boost::system::error_code &error,
View file
ncmpc-0.32.tar.xz/src/paint.hxx -> ncmpc-0.36.tar.xz/src/paint.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ * true. */ static inline void -row_color(WINDOW *w, Style style, bool selected) +row_color(WINDOW *w, Style style, bool selected) noexcept { SelectStyle(w, style); @@ -43,7 +43,7 @@ * "reverse" mode. */ static inline void -row_color_end(WINDOW *w) +row_color_end(WINDOW *w) noexcept { wattroff(w, A_REVERSE); } @@ -54,7 +54,7 @@ * on the space. */ static inline void -row_clear_to_eol(WINDOW *w, unsigned width, bool selected) +row_clear_to_eol(WINDOW *w, unsigned width, bool selected) noexcept { if (selected && options.wide_cursor) whline(w, ' ', width); @@ -68,7 +68,7 @@ static inline void row_paint_text(WINDOW *w, unsigned width, Style style, bool selected, - const char *text) + const char *text) noexcept { row_color(w, style, selected);
View file
ncmpc-0.32.tar.xz/src/player_command.cxx -> ncmpc-0.36.tar.xz/src/player_command.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/player_command.hxx -> ncmpc-0.36.tar.xz/src/player_command.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/plugin.cxx -> ncmpc-0.36.tar.xz/src/plugin.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,6 @@ #include "plugin.hxx" #include "io/Path.hxx" -#include "util/Compiler.h" #include "util/ScopeExit.hxx" #include "util/UriUtil.hxx" @@ -33,15 +32,14 @@ #include <stdlib.h> #include <unistd.h> #include <dirent.h> -#include <string.h> #include <signal.h> #include <sys/stat.h> #include <sys/wait.h> struct PluginCycle; -struct PluginPipe { - PluginCycle *cycle; +class PluginPipe { + PluginCycle &cycle; /** the pipe to the plugin process */ boost::asio::posix::stream_descriptor fd; @@ -51,23 +49,20 @@ std::array<char, 256> buffer; - PluginPipe(boost::asio::io_service &io_service) noexcept - :fd(io_service) {} +public: + PluginPipe(boost::asio::io_service &io_service, + PluginCycle &_cycle) noexcept + :cycle(_cycle), fd(io_service) {} ~PluginPipe() noexcept { Close(); } - void AsyncRead() noexcept { - fd.async_read_some(boost::asio::buffer(buffer), - std::bind(&PluginPipe::OnRead, this, - std::placeholders::_1, - std::placeholders::_2)); + void Start(int _fd) noexcept { + fd.assign(_fd); + AsyncRead(); } - void OnRead(const boost::system::error_code &error, - std::size_t bytes_transferred) noexcept; - void Close() noexcept { if (!fd.is_open()) return; @@ -75,19 +70,44 @@ fd.cancel(); fd.close(); } + + bool IsOpen() const noexcept { + return fd.is_open(); + } + + bool IsEmpty() const noexcept { + return data.empty(); + } + + std::string TakeData() noexcept { + return std::move(data); + } + + void Clear() { + data.clear(); + } + +private: + void AsyncRead() noexcept { + fd.async_read_some(boost::asio::buffer(buffer), + std::bind(&PluginPipe::OnRead, this, + std::placeholders::_1, + std::placeholders::_2)); + } + + void OnRead(const boost::system::error_code &error, + std::size_t bytes_transferred) noexcept; }; struct PluginCycle { /** the plugin list; used for traversing to the next plugin */ - PluginList *list; + const PluginList &list; /** arguments passed to execv() */ std::unique_ptr<char *[]> argv; - /** caller defined callback function */ - plugin_callback_t callback; - /** caller defined pointer passed to #callback */ - void *callback_data; + /** caller defined handler object */ + PluginResponseHandler &handler; /** the index of the next plugin which is going to be invoked */ @@ -108,15 +128,18 @@ boost::asio::steady_timer delayed_fail_timer; PluginCycle(boost::asio::io_service &io_service, - PluginList &_list, std::unique_ptr<char *[]> &&_argv, - plugin_callback_t _callback, void *_callback_data) noexcept - :list(&_list), argv(std::move(_argv)), - callback(_callback), callback_data(_callback_data), - pipe_stdout(io_service), pipe_stderr(io_service), + const PluginList &_list, std::unique_ptr<char *[]> &&_argv, + PluginResponseHandler &_handler) noexcept + :list(_list), argv(std::move(_argv)), + handler(_handler), + pipe_stdout(io_service, *this), + pipe_stderr(io_service, *this), delayed_fail_timer(io_service) {} void TryNextPlugin() noexcept; + void Stop() noexcept; + void ScheduleDelayedFail() noexcept { boost::system::error_code error; delayed_fail_timer.expires_from_now(std::chrono::seconds(0), @@ -135,13 +158,13 @@ }; static bool -register_plugin(PluginList *list, std::string &&path) noexcept +register_plugin(PluginList &list, std::string &&path) noexcept { struct stat st; if (stat(path.c_str(), &st) < 0) return false; - list->plugins.emplace_back(std::move(path)); + list.plugins.emplace_back(std::move(path)); return true; } @@ -151,12 +174,14 @@ return name[0] == '.' && (name[1] == 0 || (name[1] == '.' && name[2] == 0)); } -bool -plugin_list_load_directory(PluginList *list, const char *path) noexcept +PluginList +plugin_list_load_directory(const char *path) noexcept { + PluginList list; + DIR *dir = opendir(path); if (dir == nullptr) - return false; + return list; AtScopeExit(dir) { closedir(dir); }; @@ -166,16 +191,16 @@ register_plugin(list, BuildPath(path, name)); } - std::sort(list->plugins.begin(), list->plugins.end()); + std::sort(list.plugins.begin(), list.plugins.end()); - return true; + return list; } void PluginCycle::OnEof() noexcept { /* Only if both pipes are have EOF status we are done */ - if (pipe_stdout.fd.is_open() || pipe_stderr.fd.is_open()) + if (pipe_stdout.IsOpen() || pipe_stderr.IsOpen()) return; int status, ret = waitpid(pid, &status, 0); @@ -185,24 +210,23 @@ /* If we encountered an error other than service unavailable * (69), log it for later. If all plugins fail, we may get * some hints for debugging.*/ - if (!pipe_stderr.data.empty() && - WEXITSTATUS(status) != 69) { + const auto data = pipe_stderr.TakeData(); + if (!data.empty() && WEXITSTATUS(status) != 69) {
View file
ncmpc-0.32.tar.xz/src/plugin.hxx -> ncmpc-0.36.tar.xz/src/plugin.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -26,26 +26,27 @@ #include <string> /** - * A list of registered plugins. + * When a plugin cycle is finished, one method of this class is called. In any + * case, plugin_stop() has to be called to free all memory. */ -struct PluginList { - std::vector<std::string> plugins; +class PluginResponseHandler { +public: + /** + * @param plugin_name the name of the plugin which succeeded + * @param result the plugin's output (stdout) + */ + virtual void OnPluginSuccess(const char *plugin_name, + std::string result) noexcept = 0; + + virtual void OnPluginError(std::string error) noexcept = 0; }; /** - * When a plugin cycle is finished, this function is called. In any - * case, plugin_stop() has to be called to free all memory. - * - * @param result the plugin's output (stdout) on success; summary of all error - * messages on failure as determined by success - * @param success result of the plugin cycle; true if result is meaningful - * output, false if result contains error messages - * @param plugin_name the name of the plugin which succeeded; becomes invalid - * when plugin_stop is called (i.e. strdup it if you need it afterwards). - * @param data the caller defined pointer passed to plugin_run() + * A list of registered plugins. */ -typedef void (*plugin_callback_t)(std::string &&result, const bool success, - const char *plugin_name, void *data); +struct PluginList { + std::vector<std::string> plugins; +}; /** * This object represents a cycle through all available plugins, until @@ -56,8 +57,8 @@ /** * Load all plugins (executables) in a directory. */ -bool -plugin_list_load_directory(PluginList *list, const char *path) noexcept; +PluginList +plugin_list_load_directory(const char *path) noexcept; /** * Run plugins in this list, until one returns success (or until the @@ -66,15 +67,13 @@ * @param list the plugin list * @param args nullptr terminated command line arguments passed to the * plugin programs; they must remain valid while the plugin runs - * @param callback the callback function which will be called when a - * result is available - * @param callback_data caller defined pointer which is passed to the - * callback function + * @param handler the handler which will be called when a result is + * available */ PluginCycle * plugin_run(boost::asio::io_service &io_service, PluginList *list, const char *const*args, - plugin_callback_t callback, void *callback_data) noexcept; + PluginResponseHandler &handler) noexcept; /** * Stops the plugin cycle and frees resources. This can be called to
View file
ncmpc-0.32.tar.xz/src/save_playlist.cxx -> ncmpc-0.36.tar.xz/src/save_playlist.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,18 +20,17 @@ #include "save_playlist.hxx" #include "db_completion.hxx" #include "screen_status.hxx" -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "i18n.h" #include "charset.hxx" #include "mpdclient.hxx" -#include "wreadln.hxx" #include "Completion.hxx" #include "screen_utils.hxx" #include "util/Compiler.h" #include <mpd/client.h> -#include <string.h> +#include <stdio.h> #ifndef NCMPC_MINI @@ -39,17 +38,17 @@ struct mpdclient &c; public: - explicit PlaylistNameCompletion(struct mpdclient &_c) + explicit PlaylistNameCompletion(struct mpdclient &_c) noexcept :c(_c) {} protected: /* virtual methods from class Completion */ - void Pre(const char *value) override; - void Post(const char *value, Range range) override; + void Pre(const char *value) noexcept override; + void Post(const char *value, Range range) noexcept override; }; void -PlaylistNameCompletion::Pre(gcc_unused const char *value) +PlaylistNameCompletion::Pre(gcc_unused const char *value) noexcept { if (empty()) { /* create completion list */ @@ -58,7 +57,8 @@ } void -PlaylistNameCompletion::Post(gcc_unused const char *value, Range range) +PlaylistNameCompletion::Post(gcc_unused const char *value, + Range range) noexcept { if (range.begin() != range.end() && std::next(range.begin()) != range.end())
View file
ncmpc-0.32.tar.xz/src/save_playlist.hxx -> ncmpc-0.36.tar.xz/src/save_playlist.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/screen.cxx -> ncmpc-0.36.tar.xz/src/screen.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -25,7 +25,6 @@ #include "Command.hxx" #include "config.h" #include "i18n.h" -#include "charset.hxx" #include "mpdclient.hxx" #include "Options.hxx" #include "DelayedSeek.hxx" @@ -35,13 +34,10 @@ #include <mpd/client.h> -#include <stdlib.h> -#include <unistd.h> #include <string.h> -#include <time.h> ScreenManager::PageMap::iterator -ScreenManager::MakePage(const PageMeta &sf) +ScreenManager::MakePage(const PageMeta &sf) noexcept { auto i = pages.find(&sf); if (i != pages.end()) @@ -55,7 +51,7 @@ } void -ScreenManager::Switch(const PageMeta &sf, struct mpdclient &c) +ScreenManager::Switch(const PageMeta &sf, struct mpdclient &c) noexcept { if (&sf == current_page->first) return; @@ -79,7 +75,7 @@ } void -ScreenManager::Swap(struct mpdclient &c, const struct mpd_song *song) +ScreenManager::Swap(struct mpdclient &c, const struct mpd_song *song) noexcept { if (song != nullptr) { @@ -100,8 +96,9 @@ Switch(*mode_fn_prev, c); } +gcc_pure static int -find_configured_screen(const char *name) +find_configured_screen(const char *name) noexcept { unsigned i; @@ -113,7 +110,7 @@ } void -ScreenManager::NextMode(struct mpdclient &c, int offset) +ScreenManager::NextMode(struct mpdclient &c, int offset) noexcept { int max = options.screen_list.size();
View file
ncmpc-0.32.tar.xz/src/screen.hxx -> ncmpc-0.36.tar.xz/src/screen.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -32,13 +32,13 @@ #include <curses.h> -#include <mpd/client.h> - +#include <map> #include <memory> #include <string> -#include <map> +#include <utility> enum class Command : unsigned; +struct mpd_song; struct mpdclient; struct PageMeta; class Page; @@ -102,39 +102,38 @@ std::string findbuf; History find_history; - explicit ScreenManager(boost::asio::io_service &io_service); - ~ScreenManager(); + explicit ScreenManager(boost::asio::io_service &io_service) noexcept; + ~ScreenManager() noexcept; - auto &get_io_service() const { + auto &get_io_service() const noexcept { return io_service; } - void Init(struct mpdclient *c); - void Exit(); + void Init(struct mpdclient *c) noexcept; + void Exit() noexcept; - Point GetMainPosition() const { + Point GetMainPosition() const noexcept { return {0, (int)title_bar.GetHeight()}; } - const PageMeta &GetCurrentPageMeta() const { + const PageMeta &GetCurrentPageMeta() const noexcept { return *current_page->first; } - PageMap::iterator MakePage(const PageMeta &sf); + PageMap::iterator MakePage(const PageMeta &sf) noexcept; - void OnResize(); + void OnResize() noexcept; gcc_pure - bool IsVisible(const Page &page) const { + bool IsVisible(const Page &page) const noexcept { return &page == current_page->second.get(); } - void Switch(const PageMeta &sf, struct mpdclient &c); - void Swap(struct mpdclient &c, const struct mpd_song *song); - + void Switch(const PageMeta &sf, struct mpdclient &c) noexcept; + void Swap(struct mpdclient &c, const struct mpd_song *song) noexcept; - void PaintTopWindow(); - void Paint(bool main_dirty); + void PaintTopWindow() noexcept; + void Paint(bool main_dirty) noexcept; void Update(struct mpdclient &c, const DelayedSeek &seek) noexcept; void OnCommand(struct mpdclient &c, DelayedSeek &seek, Command cmd); @@ -145,7 +144,7 @@ #endif private: - void NextMode(struct mpdclient &c, int offset); + void NextMode(struct mpdclient &c, int offset) noexcept; }; #endif
View file
ncmpc-0.32.tar.xz/src/screen_client.cxx -> ncmpc-0.36.tar.xz/src/screen_client.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/screen_client.hxx -> ncmpc-0.36.tar.xz/src/screen_client.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/screen_find.cxx -> ncmpc-0.36.tar.xz/src/screen_find.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -22,8 +22,9 @@ #include "screen_status.hxx" #include "screen.hxx" #include "ListWindow.hxx" -#include "keyboard.hxx" +#include "AsyncUserInput.hxx" #include "i18n.h" +#include "Command.hxx" #include "Options.hxx" #include "util/LocaleString.hxx" @@ -127,7 +128,7 @@ /* repaint the list_window */ lw.Paint(renderer); - wrefresh(lw.w); + lw.Refresh(); } screen.findbuf = search_str;
View file
ncmpc-0.32.tar.xz/src/screen_find.hxx -> ncmpc-0.36.tar.xz/src/screen_find.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/screen_init.cxx -> ncmpc-0.36.tar.xz/src/screen_init.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,20 +19,16 @@ #include "screen.hxx" #include "Page.hxx" -#include "screen_list.hxx" #include "QueuePage.hxx" #include "config.h" -#include "i18n.h" #include "Options.hxx" #include "Styles.hxx" -#include <stdlib.h> - /* minimum window size */ static const unsigned SCREEN_MIN_COLS = 14; static const unsigned SCREEN_MIN_ROWS = 5; -ScreenManager::ScreenManager(boost::asio::io_service &_io_service) +ScreenManager::ScreenManager(boost::asio::io_service &_io_service) noexcept :io_service(_io_service), layout({std::max<unsigned>(COLS, SCREEN_MIN_COLS), std::max<unsigned>(LINES, SCREEN_MIN_ROWS)}), @@ -60,13 +56,13 @@ #endif } -ScreenManager::~ScreenManager() +ScreenManager::~ScreenManager() noexcept { delete[] buf; } void -ScreenManager::Exit() +ScreenManager::Exit() noexcept { current_page->second->OnClose(); current_page = pages.end(); @@ -74,7 +70,7 @@ } void -ScreenManager::OnResize() +ScreenManager::OnResize() noexcept { layout = Layout({std::max<unsigned>(COLS, SCREEN_MIN_COLS), std::max<unsigned>(LINES, SCREEN_MIN_ROWS)}); @@ -113,7 +109,7 @@ } void -ScreenManager::Init(struct mpdclient *c) +ScreenManager::Init(struct mpdclient *c) noexcept { current_page = MakePage(screen_queue); current_page->second->OnOpen(*c);
View file
ncmpc-0.32.tar.xz/src/screen_list.cxx -> ncmpc-0.36.tar.xz/src/screen_list.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,18 +19,18 @@ #include "screen_list.hxx" #include "PageMeta.hxx" -#include "screen.hxx" #include "HelpPage.hxx" #include "QueuePage.hxx" #include "FileBrowserPage.hxx" -#include "screen_artist.hxx" +#include "LibraryPage.hxx" #include "SearchPage.hxx" #include "SongPage.hxx" -#include "screen_keydef.hxx" +#include "KeyDefPage.hxx" #include "LyricsPage.hxx" #include "OutputsPage.hxx" #include "ChatPage.hxx" #include "util/Macros.hxx" +#include "config.h" #include <string.h> @@ -40,8 +40,8 @@ #endif &screen_queue, &screen_browse, -#ifdef ENABLE_ARTIST_SCREEN - &screen_artist, +#ifdef ENABLE_LIBRARY_PAGE + &library_page, #endif #ifdef ENABLE_SEARCH_SCREEN &screen_search, @@ -64,7 +64,7 @@ }; const PageMeta * -GetPageMeta(unsigned i) +GetPageMeta(unsigned i) noexcept { return i < ARRAY_SIZE(screens) ? screens[i] @@ -72,17 +72,23 @@ } const PageMeta * -screen_lookup_name(const char *name) +screen_lookup_name(const char *name) noexcept { for (const auto *i : screens) if (strcmp(name, i->name) == 0) return i; +#ifdef ENABLE_LIBRARY_PAGE + /* compatibility with 0.32 and older */ + if (strcmp(name, "artist") == 0) + return &library_page; +#endif + return nullptr; } const PageMeta * -PageByCommand(Command cmd) +PageByCommand(Command cmd) noexcept { for (const auto *i : screens) if (i->command == cmd)
View file
ncmpc-0.32.tar.xz/src/screen_list.hxx -> ncmpc-0.36.tar.xz/src/screen_list.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -27,14 +27,14 @@ gcc_const const PageMeta * -GetPageMeta(unsigned i); +GetPageMeta(unsigned i) noexcept; gcc_pure const PageMeta * -screen_lookup_name(const char *name); +screen_lookup_name(const char *name) noexcept; gcc_const const PageMeta * -PageByCommand(Command cmd); +PageByCommand(Command cmd) noexcept; #endif
View file
ncmpc-0.32.tar.xz/src/screen_paint.cxx -> ncmpc-0.36.tar.xz/src/screen_paint.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,16 +19,12 @@ #include "screen.hxx" #include "Page.hxx" -#include "config.h" -#include "mpdclient.hxx" #include "Options.hxx" -#include <mpd/client.h> - #include <assert.h> void -ScreenManager::PaintTopWindow() +ScreenManager::PaintTopWindow() noexcept { const char *title = current_page->second->GetTitle(buf, buf_size); assert(title != nullptr); @@ -37,7 +33,7 @@ } void -ScreenManager::Paint(bool main_dirty) +ScreenManager::Paint(bool main_dirty) noexcept { /* update title/header window */ PaintTopWindow(); @@ -45,7 +41,9 @@ /* paint the bottom window */ progress_bar.Paint(); - status_bar.Paint(); + + if (!current_page->second->PaintStatusBarOverride(status_bar.GetWindow())) + status_bar.Paint(); /* paint the main window */
View file
ncmpc-0.32.tar.xz/src/screen_status.cxx -> ncmpc-0.36.tar.xz/src/screen_status.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -24,13 +24,13 @@ #include <stdarg.h> void -screen_status_message(const char *msg) +screen_status_message(const char *msg) noexcept { screen->status_bar.SetMessage(msg); } void -screen_status_printf(const char *format, ...) +screen_status_printf(const char *format, ...) noexcept { va_list ap; va_start(ap,format);
View file
ncmpc-0.32.tar.xz/src/screen_status.hxx -> ncmpc-0.36.tar.xz/src/screen_status.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,10 +23,10 @@ #include "util/Compiler.h" void -screen_status_message(const char *msg); +screen_status_message(const char *msg) noexcept; gcc_printf(1, 2) void -screen_status_printf(const char *format, ...); +screen_status_printf(const char *format, ...) noexcept; #endif
View file
ncmpc-0.32.tar.xz/src/screen_utils.cxx -> ncmpc-0.36.tar.xz/src/screen_utils.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,15 +19,17 @@ #include "screen_utils.hxx" #include "screen.hxx" -#include "mpdclient.hxx" #include "config.h" #include "i18n.h" #include "Options.hxx" #include "Styles.hxx" #include "wreadln.hxx" #include "ncmpc.hxx" +#include "config.h" -#include <mpd/client.h> +#ifndef _WIN32 +#include "WaitUserInput.hxx" +#endif #include <string.h> @@ -64,8 +66,23 @@ echo(); curs_set(1); +#ifndef _WIN32 + WaitUserInput wui; +#endif + int key; - while (ignore_key(key = wgetch(w))) {} + do { + key = wgetch(w); + +#ifndef _WIN32 + if (key == ERR && errno == EAGAIN) { + if (wui.Wait()) + continue; + else + break; + } +#endif + } while (ignore_key(key)); noecho(); curs_set(0);
View file
ncmpc-0.32.tar.xz/src/screen_utils.hxx -> ncmpc-0.36.tar.xz/src/screen_utils.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,14 +20,9 @@ #ifndef SCREEN_UTILS_H #define SCREEN_UTILS_H -#include "config.h" -#include "Command.hxx" #include "History.hxx" #include "Completion.hxx" -struct mpdclient; -class Completion; - /* sound an audible and/or visible bell */ void screen_bell() noexcept;
View file
ncmpc-0.32.tar.xz/src/signals.cxx -> ncmpc-0.36.tar.xz/src/signals.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/strfsong.cxx -> ncmpc-0.36.tar.xz/src/strfsong.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,6 +21,7 @@ #include "charset.hxx" #include "time_format.hxx" #include "util/UriUtil.hxx" +#include "TagMask.hxx" #include <mpd/client.h> @@ -279,3 +280,28 @@ { return _strfsong(s, s + max, format, song, nullptr); } + +TagMask +SongFormatToTagMask(const char *format) noexcept +{ + TagMask mask = TagMask::None(); + + /* TODO: this is incomplete and not correct; the missing tags + are already in global_tag_whitelist (see Instance.cxx); but + for now, this implementation may be good enough */ + + static constexpr struct { + const char *s; + enum mpd_tag_type tag; + } tag_references[] = { + {"%albumartist%", MPD_TAG_ALBUM_ARTIST}, + {"%composer%", MPD_TAG_COMPOSER}, + {"%performer%", MPD_TAG_PERFORMER}, + }; + + for (const auto &i : tag_references) + if (strstr(format, i.s) != nullptr) + mask |= i.tag; + + return mask; +}
View file
ncmpc-0.32.tar.xz/src/strfsong.hxx -> ncmpc-0.36.tar.xz/src/strfsong.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,12 +20,22 @@ #ifndef STRFSONG_H #define STRFSONG_H +#include "util/Compiler.h" + #include <stddef.h> struct mpd_song; +class TagMask; size_t strfsong(char *s, size_t max, const char *format, const struct mpd_song *song) noexcept; +/** + * Check which tags are referenced by the given song format. + */ +gcc_pure +TagMask +SongFormatToTagMask(const char *format) noexcept; + #endif
View file
ncmpc-0.32.tar.xz/src/time_format.cxx -> ncmpc-0.36.tar.xz/src/time_format.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ #include <stdio.h> void -format_duration_short(char *buffer, size_t length, unsigned duration) +format_duration_short(char *buffer, size_t length, unsigned duration) noexcept { if (duration < 3600) snprintf(buffer, length, @@ -35,7 +35,7 @@ } void -format_duration_long(char *p, size_t length, unsigned long duration) +format_duration_long(char *p, size_t length, unsigned long duration) noexcept { unsigned bytes_written = 0;
View file
ncmpc-0.32.tar.xz/src/time_format.hxx -> ncmpc-0.36.tar.xz/src/time_format.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,9 +23,9 @@ #include <stddef.h> void -format_duration_short(char *buffer, size_t length, unsigned duration); +format_duration_short(char *buffer, size_t length, unsigned duration) noexcept; void -format_duration_long(char *buffer, size_t length, unsigned long duration); +format_duration_long(char *buffer, size_t length, unsigned long duration) noexcept; #endif
View file
ncmpc-0.32.tar.xz/src/util/CharUtil.hxx -> ncmpc-0.36.tar.xz/src/util/CharUtil.hxx
Changed
@@ -34,30 +34,26 @@ #include "WCharUtil.hxx" #endif -constexpr -static inline bool -IsASCII(const unsigned char ch) +constexpr bool +IsASCII(const unsigned char ch) noexcept { return ch < 0x80; } -constexpr -static inline bool -IsASCII(const char ch) +constexpr bool +IsASCII(const char ch) noexcept { return IsASCII((unsigned char)ch); } -constexpr -static inline bool -IsWhitespaceOrNull(const char ch) +constexpr bool +IsWhitespaceOrNull(const char ch) noexcept { return (unsigned char)ch <= 0x20; } -constexpr -static inline bool -IsWhitespaceNotNull(const char ch) +constexpr bool +IsWhitespaceNotNull(const char ch) noexcept { return ch > 0 && ch <= 0x20; } @@ -68,51 +64,44 @@ * want the fastest implementation, and you don't care if a null byte * matches. */ -constexpr -static inline bool -IsWhitespaceFast(const char ch) +constexpr bool +IsWhitespaceFast(const char ch) noexcept { return IsWhitespaceOrNull(ch); } -constexpr -static inline bool -IsPrintableASCII(char ch) +constexpr bool +IsPrintableASCII(char ch) noexcept { return (signed char)ch >= 0x20; } -constexpr -static inline bool -IsDigitASCII(char ch) +constexpr bool +IsDigitASCII(char ch) noexcept { return ch >= '0' && ch <= '9'; } -constexpr -static inline bool -IsUpperAlphaASCII(char ch) +constexpr bool +IsUpperAlphaASCII(char ch) noexcept { return ch >= 'A' && ch <= 'Z'; } -constexpr -static inline bool -IsLowerAlphaASCII(char ch) +constexpr bool +IsLowerAlphaASCII(char ch) noexcept { return ch >= 'a' && ch <= 'z'; } -constexpr -static inline bool -IsAlphaASCII(char ch) +constexpr bool +IsAlphaASCII(char ch) noexcept { return IsUpperAlphaASCII(ch) || IsLowerAlphaASCII(ch); } -constexpr -static inline bool -IsAlphaNumericASCII(char ch) +constexpr bool +IsAlphaNumericASCII(char ch) noexcept { return IsAlphaASCII(ch) || IsDigitASCII(ch); } @@ -121,9 +110,8 @@ * Convert the specified ASCII character (0x00..0x7f) to upper case. * Unlike toupper(), it ignores the system locale. */ -constexpr -static inline char -ToUpperASCII(char ch) +constexpr char +ToUpperASCII(char ch) noexcept { return ch >= 'a' && ch <= 'z' ? (ch - ('a' - 'A')) @@ -134,9 +122,8 @@ * Convert the specified ASCII character (0x00..0x7f) to lower case. * Unlike tolower(), it ignores the system locale. */ -constexpr -static inline char -ToLowerASCII(char ch) +constexpr char +ToLowerASCII(char ch) noexcept { return ch >= 'A' && ch <= 'Z' ? (ch + ('a' - 'A'))
View file
ncmpc-0.36.tar.xz/src/util/ConstBuffer.hxx
Added
@@ -0,0 +1,307 @@ +/* + * Copyright (C) 2013-2017 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CONST_BUFFER_HXX +#define CONST_BUFFER_HXX + +#include "Compiler.h" + +#include <cstddef> + +#ifndef NDEBUG +#include <assert.h> +#endif + +template<typename T> +struct ConstBuffer; + +template<> +struct ConstBuffer<void> { + typedef size_t size_type; + typedef void value_type; + typedef const void *pointer_type; + typedef pointer_type const_pointer_type; + typedef pointer_type iterator; + typedef pointer_type const_iterator; + + pointer_type data; + size_type size; + + ConstBuffer() = default; + + constexpr ConstBuffer(std::nullptr_t):data(nullptr), size(0) {} + + constexpr ConstBuffer(pointer_type _data, size_type _size) + :data(_data), size(_size) {} + + constexpr static ConstBuffer<void> FromVoid(ConstBuffer<void> other) { + return other; + } + + constexpr ConstBuffer<void> ToVoid() const { + return *this; + } + + constexpr bool IsNull() const { + return data == nullptr; + } + + constexpr bool operator==(std::nullptr_t) const { + return data == nullptr; + } + + constexpr bool operator!=(std::nullptr_t) const { + return data != nullptr; + } + + constexpr bool empty() const { + return size == 0; + } +}; + +/** + * A reference to a memory area that is read-only. + */ +template<typename T> +struct ConstBuffer { + typedef size_t size_type; + typedef T value_type; + typedef const T &reference_type; + typedef reference_type const_reference_type; + typedef const T *pointer_type; + typedef pointer_type const_pointer_type; + typedef pointer_type iterator; + typedef pointer_type const_iterator; + + pointer_type data; + size_type size; + + ConstBuffer() = default; + + constexpr ConstBuffer(std::nullptr_t):data(nullptr), size(0) {} + + constexpr ConstBuffer(pointer_type _data, size_type _size) + :data(_data), size(_size) {} + + constexpr ConstBuffer(pointer_type _data, pointer_type _end) + :data(_data), size(_end - _data) {} + + /** + * Convert array to ConstBuffer instance. + */ + template<size_type _size> + constexpr ConstBuffer(const T (&_data)[_size]) + :data(_data), size(_size) {} + + /** + * Cast a ConstBuffer<void> to a ConstBuffer<T>, rounding down + * to the next multiple of T's size. + */ + static constexpr ConstBuffer<T> FromVoidFloor(ConstBuffer<void> other) { + static_assert(sizeof(T) > 0, "Empty base type"); + return ConstBuffer<T>(pointer_type(other.data), + other.size / sizeof(T)); + } + + /** + * Cast a ConstBuffer<void> to a ConstBuffer<T>. A "void" + * buffer records its size in bytes, and when casting to "T", + * the assertion below ensures that the size is a multiple of + * sizeof(T). + */ +#ifdef NDEBUG + constexpr +#endif + static ConstBuffer<T> FromVoid(ConstBuffer<void> other) { + static_assert(sizeof(T) > 0, "Empty base type"); +#ifndef NDEBUG + assert(other.size % sizeof(T) == 0); +#endif + return FromVoidFloor(other); + } + + constexpr ConstBuffer<void> ToVoid() const { + static_assert(sizeof(T) > 0, "Empty base type"); + return ConstBuffer<void>(data, size * sizeof(T)); + } + + constexpr bool IsNull() const { + return data == nullptr; + } + + constexpr bool operator==(std::nullptr_t) const { + return data == nullptr; + } + + constexpr bool operator!=(std::nullptr_t) const { + return data != nullptr; + } + + constexpr bool empty() const { + return size == 0; + } + + template<typename U> + gcc_pure + bool Contains(U &&u) const noexcept { + for (const auto &i : *this) + if (u == i) + return true; + + return false; + } + + constexpr iterator begin() const { + return data; + } + + constexpr iterator end() const { + return data + size; + } + + constexpr const_iterator cbegin() const { + return data; + } + + constexpr const_iterator cend() const { + return data + size; + } + +#ifdef NDEBUG + constexpr +#endif + reference_type operator[](size_type i) const {
View file
ncmpc-0.36.tar.xz/src/util/PrintException.cxx
Added
@@ -0,0 +1,64 @@ +/* + * Copyright 2007-2019 Content Management AG + * All rights reserved. + * + * author: Max Kellermann <mk@cm4all.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PrintException.hxx" + +#include <stdio.h> + +void +PrintException(const std::exception &e) noexcept +{ + fprintf(stderr, "%s\n", e.what()); + try { + std::rethrow_if_nested(e); + } catch (const std::exception &nested) { + PrintException(nested); + } catch (const char *s) { + fprintf(stderr, "%s\n", s); + } catch (...) { + fprintf(stderr, "Unrecognized nested exception\n"); + } +} + +void +PrintException(const std::exception_ptr &ep) noexcept +{ + try { + std::rethrow_exception(ep); + } catch (const std::exception &e) { + PrintException(e); + } catch (const char *s) { + fprintf(stderr, "%s\n", s); + } catch (...) { + fprintf(stderr, "Unrecognized exception\n"); + } +}
View file
ncmpc-0.36.tar.xz/src/util/PrintException.hxx
Added
@@ -0,0 +1,47 @@ +/* + * Copyright 2007-2019 Content Management AG + * All rights reserved. + * + * author: Max Kellermann <mk@cm4all.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PRINT_EXCEPTION_HXX +#define PRINT_EXCEPTION_HXX + +#include <exception> + +/** + * Print this exception (and its nested exceptions, if any) to stderr. + */ +void +PrintException(const std::exception &e) noexcept; + +void +PrintException(const std::exception_ptr &ep) noexcept; + +#endif
View file
ncmpc-0.36.tar.xz/src/util/RuntimeError.hxx
Added
@@ -0,0 +1,56 @@ +/* + * Copyright 2013-2017 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RUNTIME_ERROR_HXX +#define RUNTIME_ERROR_HXX + +#include <stdexcept> +#include <utility> + +#include <stdio.h> + +template<typename... Args> +static inline std::runtime_error +FormatRuntimeError(const char *fmt, Args&&... args) noexcept +{ + char buffer[1024]; + snprintf(buffer, sizeof(buffer), fmt, std::forward<Args>(args)...); + return std::runtime_error(buffer); +} + +template<typename... Args> +inline std::invalid_argument +FormatInvalidArgument(const char *fmt, Args&&... args) noexcept +{ + char buffer[1024]; + snprintf(buffer, sizeof(buffer), fmt, std::forward<Args>(args)...); + return std::invalid_argument(buffer); +} + +#endif
View file
ncmpc-0.36.tar.xz/src/util/StringAPI.hxx
Added
@@ -0,0 +1,217 @@ +/* + * Copyright 2010-2019 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef STRING_API_HXX +#define STRING_API_HXX + +#include "Compiler.h" + +#include <string.h> + +#ifdef _UNICODE +#include "WStringAPI.hxx" +#endif + +gcc_pure gcc_nonnull_all +static inline size_t +StringLength(const char *p) noexcept +{ + return strlen(p); +} + +gcc_pure gcc_nonnull_all +static inline const char * +StringFind(const char *haystack, const char *needle) noexcept +{ + return strstr(haystack, needle); +} + +gcc_pure gcc_nonnull_all +static inline char * +StringFind(char *haystack, char needle, size_t size) noexcept +{ + return (char *)memchr(haystack, needle, size); +} + +gcc_pure gcc_nonnull_all +static inline const char * +StringFind(const char *haystack, char needle, size_t size) noexcept +{ + return (const char *)memchr(haystack, needle, size); +} + +gcc_pure gcc_nonnull_all +static inline const char * +StringFind(const char *haystack, char needle) noexcept +{ + return strchr(haystack, needle); +} + +gcc_pure gcc_nonnull_all +static inline char * +StringFind(char *haystack, char needle) noexcept +{ + return strchr(haystack, needle); +} + +gcc_pure gcc_nonnull_all +static inline const char * +StringFindLast(const char *haystack, char needle) noexcept +{ + return strrchr(haystack, needle); +} + +gcc_pure gcc_nonnull_all +static inline char * +StringFindLast(char *haystack, char needle) noexcept +{ + return strrchr(haystack, needle); +} + +gcc_pure gcc_nonnull_all +static inline const char * +StringFindLast(const char *haystack, char needle, size_t size) noexcept +{ +#if defined(__GLIBC__) || defined(__BIONIC__) + /* memrchr() is a GNU extension (and also available on + Android) */ + return (const char *)memrchr(haystack, needle, size); +#else + /* emulate for everybody else */ + const auto *p = haystack + size; + while (p > haystack) { + --p; + if (*p == needle) + return p; + } + + return nullptr; +#endif +} + +gcc_pure gcc_nonnull_all +static inline const char * +StringFindAny(const char *haystack, const char *accept) noexcept +{ + return strpbrk(haystack, accept); +} + +static inline char * +StringToken(char *str, const char *delim) noexcept +{ + return strtok(str, delim); +} + +gcc_nonnull_all +static inline void +UnsafeCopyString(char *dest, const char *src) noexcept +{ + strcpy(dest, src); +} + +gcc_returns_nonnull gcc_nonnull_all +static inline char * +UnsafeCopyStringP(char *dest, const char *src) noexcept +{ +#if defined(_WIN32) + /* emulate stpcpy() */ + UnsafeCopyString(dest, src); + return dest + StringLength(dest); +#else + return stpcpy(dest, src); +#endif +} + +gcc_pure gcc_nonnull_all +static inline int +StringCompare(const char *a, const char *b) noexcept +{ + return strcmp(a, b); +} + +gcc_pure gcc_nonnull_all +static inline int +StringCompare(const char *a, const char *b, size_t n) noexcept +{ + return strncmp(a, b, n); +} + +/** + * Checks whether #a and #b are equal. + */ +gcc_pure gcc_nonnull_all +static inline bool +StringIsEqual(const char *a, const char *b) noexcept +{ + return StringCompare(a, b) == 0; +} + +/** + * Checks whether #a and #b are equal. + */ +gcc_pure gcc_nonnull_all +static inline bool +StringIsEqual(const char *a, const char *b, size_t length) noexcept +{ + return strncmp(a, b, length) == 0; +} + +gcc_pure gcc_nonnull_all +static inline bool +StringIsEqualIgnoreCase(const char *a, const char *b) noexcept +{ + return strcasecmp(a, b) == 0; +} + +gcc_pure gcc_nonnull_all +static inline bool +StringIsEqualIgnoreCase(const char *a, const char *b, size_t size) noexcept +{ + return strncasecmp(a, b, size) == 0; +} + +gcc_pure gcc_nonnull_all
View file
ncmpc-0.36.tar.xz/src/util/StringCompare.cxx
Added
@@ -0,0 +1,67 @@ +/* + * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "StringCompare.hxx" + +bool +StringEndsWith(const char *haystack, const char *needle) noexcept +{ + const size_t haystack_length = StringLength(haystack); + const size_t needle_length = StringLength(needle); + + return haystack_length >= needle_length && + memcmp(haystack + haystack_length - needle_length, + needle, needle_length) == 0; +} + +bool +StringEndsWithIgnoreCase(const char *haystack, const char *needle) noexcept +{ + const size_t haystack_length = StringLength(haystack); + const size_t needle_length = StringLength(needle); + + return haystack_length >= needle_length && + StringIsEqualIgnoreCase(haystack + haystack_length - needle_length, + needle); +} + +const char * +FindStringSuffix(const char *p, const char *suffix) noexcept +{ + const size_t p_length = StringLength(p); + const size_t suffix_length = StringLength(suffix); + + if (p_length < suffix_length) + return nullptr; + + const char *q = p + p_length - suffix_length; + return memcmp(q, suffix, suffix_length) == 0 + ? q + : nullptr; +}
View file
ncmpc-0.36.tar.xz/src/util/StringCompare.hxx
Added
@@ -0,0 +1,101 @@ +/* + * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef STRING_COMPARE_HXX +#define STRING_COMPARE_HXX + +#include "StringView.hxx" +#include "StringAPI.hxx" +#include "Compiler.h" + +#ifdef _UNICODE +#include "WStringCompare.hxx" +#endif + +gcc_pure gcc_nonnull_all +static inline bool +StringIsEmpty(const char *string) noexcept +{ + return *string == 0; +} + +gcc_pure gcc_nonnull_all +static inline bool +StringStartsWith(const char *haystack, StringView needle) noexcept +{ + return StringIsEqual(haystack, needle.data, needle.size); +} + +gcc_pure gcc_nonnull_all +bool +StringEndsWith(const char *haystack, const char *needle) noexcept; + +gcc_pure gcc_nonnull_all +bool +StringEndsWithIgnoreCase(const char *haystack, const char *needle) noexcept; + +/** + * Returns the portion of the string after a prefix. If the string + * does not begin with the specified prefix, this function returns + * nullptr. + */ +gcc_pure gcc_nonnull_all +static inline const char * +StringAfterPrefix(const char *haystack, StringView needle) noexcept +{ + return StringStartsWith(haystack, needle) + ? haystack + needle.size + : nullptr; +} + +gcc_pure gcc_nonnull_all +static inline bool +StringStartsWithIgnoreCase(const char *haystack, StringView needle) noexcept +{ + return StringIsEqualIgnoreCase(haystack, needle.data, needle.size); +} + +gcc_pure gcc_nonnull_all +static inline const char * +StringAfterPrefixIgnoreCase(const char *haystack, StringView needle) noexcept +{ + return StringStartsWithIgnoreCase(haystack, needle) + ? haystack + needle.size + : nullptr; +} + +/** + * Check if the given string ends with the specified suffix. If yes, + * returns the position of the suffix, and nullptr otherwise. + */ +gcc_pure gcc_nonnull_all +const char * +FindStringSuffix(const char *p, const char *suffix) noexcept; + +#endif
View file
ncmpc-0.32.tar.xz/src/util/StringUTF8.cxx -> ncmpc-0.36.tar.xz/src/util/StringUTF8.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/util/StringUTF8.hxx -> ncmpc-0.36.tar.xz/src/util/StringUTF8.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.36.tar.xz/src/util/StringView.cxx
Added
@@ -0,0 +1,53 @@ +/* + * Copyright (C) 2013-2015 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "StringView.hxx" +#include "CharUtil.hxx" + +template<typename T> +void +BasicStringView<T>::StripLeft() noexcept +{ + while (!empty() && IsWhitespaceOrNull(front())) + pop_front(); +} + +template<typename T> +void +BasicStringView<T>::StripRight() noexcept +{ + while (!empty() && IsWhitespaceOrNull(back())) + pop_back(); +} + +template struct BasicStringView<char>; + +#ifdef _UNICODE +template struct BasicStringView<wchar_t>; +#endif
View file
ncmpc-0.36.tar.xz/src/util/StringView.hxx
Added
@@ -0,0 +1,209 @@ +/* + * Copyright 2013-2019 Max Kellermann <max.kellermann@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef STRING_VIEW_HXX +#define STRING_VIEW_HXX + +#include "ConstBuffer.hxx" +#include "StringAPI.hxx" +#include "Compiler.h" + +#include <utility> + +#if __cplusplus >= 201703L && !GCC_OLDER_THAN(7,0) +#include <string_view> +#endif + +template<typename T> +struct BasicStringView : ConstBuffer<T> { + typedef typename ConstBuffer<T>::size_type size_type; + typedef typename ConstBuffer<T>::value_type value_type; + typedef typename ConstBuffer<T>::pointer_type pointer_type; + + using ConstBuffer<T>::data; + using ConstBuffer<T>::size; + + BasicStringView() = default; + + explicit constexpr BasicStringView(ConstBuffer<T> src) + :ConstBuffer<T>(src) {} + + explicit constexpr BasicStringView(ConstBuffer<void> src) + :ConstBuffer<T>(ConstBuffer<T>::FromVoid(src)) {} + + constexpr BasicStringView(pointer_type _data, size_type _size) noexcept + :ConstBuffer<T>(_data, _size) {} + + constexpr BasicStringView(pointer_type _begin, + pointer_type _end) noexcept + :ConstBuffer<T>(_begin, _end - _begin) {} + + BasicStringView(pointer_type _data) noexcept + :ConstBuffer<T>(_data, + _data != nullptr ? StringLength(_data) : 0) {} + + constexpr BasicStringView(std::nullptr_t n) noexcept + :ConstBuffer<T>(n) {} + +#if __cplusplus >= 201703L && !GCC_OLDER_THAN(7,0) + constexpr BasicStringView(std::basic_string_view<T> src) noexcept + :ConstBuffer<T>(src.data(), src.size()) {} + + constexpr operator std::basic_string_view<T>() const noexcept { + return {data, size}; + } +#endif + + using ConstBuffer<T>::empty; + using ConstBuffer<T>::begin; + using ConstBuffer<T>::end; + using ConstBuffer<T>::front; + using ConstBuffer<T>::back; + using ConstBuffer<T>::pop_front; + using ConstBuffer<T>::pop_back; + using ConstBuffer<T>::skip_front; + + gcc_pure + pointer_type Find(value_type ch) const noexcept { + return StringFind(data, ch, this->size); + } + + gcc_pure + pointer_type FindLast(value_type ch) const noexcept { + return StringFindLast(data, ch, size); + } + + /** + * Split the string at the first occurrence of the given + * character. If the character is not found, then the first + * value is the whole string and the second value is nullptr. + */ + gcc_pure + std::pair<BasicStringView<T>, BasicStringView<T>> Split(value_type ch) const noexcept { + const auto separator = Find(ch); + if (separator == nullptr) + return {*this, nullptr}; + + return {{begin(), separator}, {separator + 1, end()}}; + } + + gcc_pure + bool StartsWith(BasicStringView<T> needle) const noexcept { + return this->size >= needle.size && + StringIsEqual(data, needle.data, needle.size); + } + + gcc_pure + bool EndsWith(BasicStringView<T> needle) const noexcept { + return this->size >= needle.size && + StringIsEqual(data + this->size - needle.size, + needle.data, needle.size); + } + + gcc_pure + int Compare(BasicStringView<T> other) const noexcept { + if (size < other.size) { + int result = StringCompare(data, other.data, size); + if (result == 0) + result = -1; + return result; + } else if (size > other.size) { + int result = StringCompare(data, other.data, + other.size); + if (result == 0) + result = 1; + return result; + } else + return StringCompare(data, other.data, size); + } + + gcc_pure + bool Equals(BasicStringView<T> other) const noexcept { + return this->size == other.size && + StringIsEqual(data, other.data, this->size); + } + + gcc_pure + bool StartsWithIgnoreCase(BasicStringView<T> needle) const noexcept { + return this->size >= needle.size && + StringIsEqualIgnoreCase(data, needle.data, needle.size); + } + + gcc_pure + bool EndsWithIgnoreCase(BasicStringView<T> needle) const noexcept { + return this->size >= needle.size && + StringIsEqualIgnoreCase(data + this->size - needle.size, + needle.data, needle.size); + } + + gcc_pure + bool EqualsIgnoreCase(BasicStringView<T> other) const noexcept { + return this->size == other.size && + StringIsEqualIgnoreCase(data, other.data, this->size); + } + + /** + * Skip all whitespace at the beginning. + */ + void StripLeft() noexcept; + + /** + * Skip all whitespace at the end. + */ + void StripRight() noexcept; + + void Strip() noexcept { + StripLeft(); + StripRight(); + } + + bool SkipPrefix(BasicStringView<T> needle) noexcept { + bool match = StartsWith(needle); + if (match) + skip_front(needle.size); + return match; + } + + bool RemoveSuffix(BasicStringView<T> needle) noexcept { + bool match = EndsWith(needle); + if (match) + size -= needle.size; + return match; + } +};
View file
ncmpc-0.32.tar.xz/src/util/UriUtil.cxx -> ncmpc-0.36.tar.xz/src/util/UriUtil.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/util/UriUtil.hxx -> ncmpc-0.36.tar.xz/src/util/UriUtil.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/wreadln.cxx -> ncmpc-0.36.tar.xz/src/wreadln.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,6 @@ #include "wreadln.hxx" #include "Completion.hxx" -#include "charset.hxx" #include "screen_utils.hxx" #include "Point.hxx" #include "config.h" @@ -31,8 +30,9 @@ #include <stdlib.h> #include <string.h> -#if (defined(HAVE_CURSES_ENHANCED) || defined(ENABLE_MULTIBYTE)) && !defined(_WIN32) -#include <sys/poll.h> +#ifndef _WIN32 +#include "WaitUserInput.hxx" +#include <errno.h> #endif #define KEY_CTRL_A 1 @@ -229,11 +229,7 @@ size_t length = 1; #if (defined(HAVE_CURSES_ENHANCED) || defined(ENABLE_MULTIBYTE)) && !defined(_WIN32) char buffer[32] = { (char)key }; - struct pollfd pfd = { - .fd = 0, - .events = POLLIN, - .revents = 0, - }; + WaitUserInput wui; /* wide version: try to complete the multibyte sequence */ @@ -244,7 +240,7 @@ /* poll for more bytes on stdin, without timeout */ - if (poll(&pfd, 1, 0) <= 0) + if (!wui.IsReady()) /* no more input from keyboard */ break; @@ -322,10 +318,23 @@ wr.Paint(); } +#ifndef _WIN32 + WaitUserInput wui; +#endif + int key = 0; while (key != 13 && key != '\n') { key = wgetch(w); +#ifndef _WIN32 + if (key == ERR && errno == EAGAIN) { + if (wui.Wait()) + continue; + else + break; + } +#endif + /* check if key is a function key */ for (size_t i = 0; i < 63; i++) if (key == (int)KEY_F(i)) {
View file
ncmpc-0.32.tar.xz/src/wreadln.hxx -> ncmpc-0.36.tar.xz/src/wreadln.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify
View file
ncmpc-0.32.tar.xz/src/xterm_title.cxx -> ncmpc-0.36.tar.xz/src/xterm_title.cxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -24,7 +24,7 @@ #include <stdlib.h> void -set_xterm_title(const char *title) +set_xterm_title(const char *title) noexcept { /* the current xterm title exists under the WM_NAME property */ /* and can be retrieved with xprop -id $WINDOWID */
View file
ncmpc-0.32.tar.xz/src/xterm_title.hxx -> ncmpc-0.36.tar.xz/src/xterm_title.hxx
Changed
@@ -1,5 +1,5 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2018 The Music Player Daemon Project + * (c) 2004-2019 The Music Player Daemon Project * Project homepage: http://musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,6 +21,6 @@ #define XTERM_TITLE_H void -set_xterm_title(const char *title); +set_xterm_title(const char *title) noexcept; #endif
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.