fix: lint

This commit is contained in:
Alex 2023-07-04 22:52:24 +02:00
parent 31e4c9023e
commit fc632f50ec
2 changed files with 10 additions and 11 deletions

View File

@ -83,7 +83,9 @@ Mpris::Mpris(const std::string& id, const Json::Value& config)
// "dynamic-priority" has been kept for backward compatibility // "dynamic-priority" has been kept for backward compatibility
if (config_["dynamic-importance-order"].isArray() || config_["dynamic-priority"].isArray()) { if (config_["dynamic-importance-order"].isArray() || config_["dynamic-priority"].isArray()) {
dynamic_prio_.clear(); dynamic_prio_.clear();
const auto& dynamic_priority = config_["dynamic-importance-order"].isArray() ? config_["dynamic-importance-order"] : config_["dynamic-priority"]; const auto& dynamic_priority = config_["dynamic-importance-order"].isArray()
? config_["dynamic-importance-order"]
: config_["dynamic-priority"];
for (const auto& value : dynamic_priority) { for (const auto& value : dynamic_priority) {
if (value.isString()) { if (value.isString()) {
dynamic_prio_.push_back(value.asString()); dynamic_prio_.push_back(value.asString());
@ -299,9 +301,9 @@ auto Mpris::getDynamicStr(const PlayerInfo& info, bool truncated, bool html) ->
"position") != dynamic_order_.end()); "position") != dynamic_order_.end());
if (truncated && dynamic_len_ >= 0) { if (truncated && dynamic_len_ >= 0) {
//Since the first element doesn't present a separator and we don't know a priori which one // Since the first element doesn't present a separator and we don't know a priori which one
//it will be, we add a "virtual separatorLen" to the dynamicLen, since we are adding the // it will be, we add a "virtual separatorLen" to the dynamicLen, since we are adding the
//separatorLen to all the other lengths. // separatorLen to all the other lengths.
size_t separatorLen = utf8_width(dynamic_separator_); size_t separatorLen = utf8_width(dynamic_separator_);
size_t dynamicLen = dynamic_len_ + separatorLen; size_t dynamicLen = dynamic_len_ + separatorLen;
if (showArtist) artistLen += separatorLen; if (showArtist) artistLen += separatorLen;
@ -361,12 +363,9 @@ auto Mpris::getDynamicStr(const PlayerInfo& info, bool truncated, bool html) ->
std::string previousOrder = ""; std::string previousOrder = "";
for (const std::string& order : dynamic_order_) { for (const std::string& order : dynamic_order_) {
if ((order == "artist" && showArtist) || if ((order == "artist" && showArtist) || (order == "album" && showAlbum) ||
(order == "album" && showAlbum) ||
(order == "title" && showTitle)) { (order == "title" && showTitle)) {
if (previousShown && if (previousShown && previousOrder != "length" && previousOrder != "position") {
previousOrder != "length" &&
previousOrder != "position") {
dynamic << dynamic_separator_; dynamic << dynamic_separator_;
} }