Merge branch '0.7.x'

This commit is contained in:
Andrzej Rybczak
2016-08-17 17:39:49 +02:00
7 changed files with 47 additions and 11 deletions

View File

@@ -2830,9 +2830,34 @@ void seek()
int old_timeout = wFooter->getTimeout();
wFooter->setTimeout(BaseScreen::defaultWindowTimeout);
auto seekForward = &Actions::get(Actions::Type::SeekForward);
auto seekBackward = &Actions::get(Actions::Type::SeekBackward);
// Accept single action of a given type or action chain for which all actions
// can be run and one of them is of the given type. This will still not work
// in some contrived cases, but allows for more flexibility than accepting
// single actions only.
auto hasRunnableAction = [](BindingsConfiguration::BindingIteratorPair &bindings, Actions::Type type) {
bool success = false;
for (auto binding = bindings.first; binding != bindings.second; ++binding)
{
auto &actions = binding->actions();
for (const auto &action : actions)
{
if (action->canBeRun())
{
if (action->type() == type)
success = true;
}
else
{
success = false;
break;
}
}
if (success)
break;
}
return success;
};
SeekingInProgress = true;
while (true)
{
@@ -2843,16 +2868,14 @@ void seek()
: Config.seek_time;
NC::Key::Type input = readKey(*wFooter);
auto k = Bindings.get(input);
if (k.first == k.second || !k.first->isSingle()) // no single action?
break;
auto a = k.first->action();
if (a == seekForward)
if (hasRunnableAction(k, Actions::Type::SeekForward))
{
if (songpos < Status::State::totalTime())
songpos = std::min(songpos + howmuch, Status::State::totalTime());
}
else if (a == seekBackward)
else if (hasRunnableAction(k, Actions::Type::SeekBackward))
{
if (songpos > 0)
{

View File

@@ -196,8 +196,8 @@ bool configure(int argc, char **argv)
{
auto format = Format::parse(vm["current-song"].as<std::string>(), Format::Flags::Tag);
std::cout << Format::stringify<char>(format, &s);
return false;
}
return false;
}
// custom startup screen

View File

@@ -44,6 +44,8 @@ CURLcode Curl::perform(std::string &data, const std::string &URL, const std::str
curl_easy_setopt(c, CURLOPT_WRITEDATA, &data);
curl_easy_setopt(c, CURLOPT_CONNECTTIMEOUT, timeout);
curl_easy_setopt(c, CURLOPT_NOSIGNAL, 1);
// Workaround last.fm SSL certificate problems.
curl_easy_setopt(c, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(c, CURLOPT_USERAGENT, "ncmpcpp " VERSION);
if (follow_redirect)
curl_easy_setopt(c, CURLOPT_FOLLOWLOCATION, 1L);

View File

@@ -35,6 +35,11 @@ template <typename Iterator, typename PredicateT>
Iterator wrappedSearch(Iterator begin, Iterator current, Iterator end,
const PredicateT &pred, bool wrap, bool skip_current)
{
if (begin == end)
{
assert(current == end);
return begin;
}
if (skip_current)
++current;
auto it = std::find_if(current, end, pred);

View File

@@ -596,7 +596,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
else
throw std::runtime_error("invalid argument: " + v);
regex_type |= boost::regex::icase;
}, defaults_to(regex_type, boost::regex::basic | boost::regex::icase)
}, defaults_to(regex_type, boost::regex::perl | boost::regex::icase)
));
p.add("ignore_leading_the", yes_no(
ignore_leading_the, false