get rid of nested ternary operators
This commit is contained in:
@@ -39,13 +39,12 @@ std::string Display::Columns()
|
|||||||
|
|
||||||
for (std::vector<Column>::const_iterator it = Config.columns.begin(); it != Config.columns.end(); ++it)
|
for (std::vector<Column>::const_iterator it = Config.columns.begin(); it != Config.columns.end(); ++it)
|
||||||
{
|
{
|
||||||
width = (last_fixed && it == next2last
|
if (last_fixed && it == next2last)
|
||||||
? COLS-where-(++next2last)->width
|
width = COLS-where-(++next2last)->width;
|
||||||
: (it == Config.columns.end()-1
|
else if (it == Config.columns.end()-1)
|
||||||
? COLS-where
|
width = COLS-where;
|
||||||
: (it->width*(it->fixed ? 1 : COLS/100.0))
|
else
|
||||||
)
|
width = it->width*(it->fixed ? 1 : COLS/100.0);
|
||||||
);
|
|
||||||
|
|
||||||
switch (it->type)
|
switch (it->type)
|
||||||
{
|
{
|
||||||
@@ -97,7 +96,11 @@ std::string Display::Columns()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (it->right_alignment)
|
if (it->right_alignment)
|
||||||
for (long i = 0; i < long(width-tag.length()-(it != Config.columns.begin())); ++i, result += ' ') { }
|
{
|
||||||
|
long i = width-tag.length()-(it != Config.columns.begin());
|
||||||
|
if (i > 0)
|
||||||
|
result += std::string(i, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
where += width;
|
where += width;
|
||||||
result += tag;
|
result += tag;
|
||||||
@@ -142,13 +145,12 @@ void Display::SongsInColumns(const MPD::Song &s, void *, Menu<MPD::Song> *menu)
|
|||||||
*menu << clEnd;
|
*menu << clEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = (last_fixed && it == next2last
|
if (last_fixed && it == next2last)
|
||||||
? COLS-where-(++next2last)->width
|
width = COLS-where-(++next2last)->width;
|
||||||
: (it == Config.columns.end()-1
|
else if (it == Config.columns.end()-1)
|
||||||
? menu->GetWidth()-where
|
width = menu->GetWidth()-where;
|
||||||
: (it->width*(it->fixed ? 1 : COLS/100.0))
|
else
|
||||||
)
|
width = it->width*(it->fixed ? 1 : COLS/100.0);
|
||||||
);
|
|
||||||
|
|
||||||
MPD::Song::GetFunction get = 0;
|
MPD::Song::GetFunction get = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user