media library: fix filter issues
This commit is contained in:
@@ -182,7 +182,7 @@ std::basic_string<my_char_t> MediaLibrary::Title()
|
|||||||
|
|
||||||
void MediaLibrary::Update()
|
void MediaLibrary::Update()
|
||||||
{
|
{
|
||||||
if (!hasTwoColumns && Artists->Empty())
|
if (!hasTwoColumns && Artists->ReallyEmpty())
|
||||||
{
|
{
|
||||||
MPD::TagList list;
|
MPD::TagList list;
|
||||||
Albums->Clear();
|
Albums->Clear();
|
||||||
@@ -201,7 +201,7 @@ void MediaLibrary::Update()
|
|||||||
Artists->Refresh();
|
Artists->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasTwoColumns && !Artists->Empty() && Albums->Empty() && Songs->Empty())
|
if (!hasTwoColumns && !Artists->ReallyEmpty() && Albums->ReallyEmpty() && Songs->ReallyEmpty())
|
||||||
{
|
{
|
||||||
// idle has to be blocked for now since it would be enabled and
|
// idle has to be blocked for now since it would be enabled and
|
||||||
// disabled a few times by each mpd command, which makes no sense
|
// disabled a few times by each mpd command, which makes no sense
|
||||||
@@ -247,7 +247,7 @@ void MediaLibrary::Update()
|
|||||||
Albums->Refresh();
|
Albums->Refresh();
|
||||||
Mpd.BlockIdle(0);
|
Mpd.BlockIdle(0);
|
||||||
}
|
}
|
||||||
else if (hasTwoColumns && Albums->Empty())
|
else if (hasTwoColumns && Albums->ReallyEmpty())
|
||||||
{
|
{
|
||||||
Songs->Clear();
|
Songs->Clear();
|
||||||
MPD::TagList artists;
|
MPD::TagList artists;
|
||||||
@@ -303,14 +303,14 @@ void MediaLibrary::Update()
|
|||||||
Albums->Refresh();
|
Albums->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasTwoColumns && !Artists->Empty() && w == Albums && Albums->Empty())
|
if (!hasTwoColumns && !Artists->ReallyEmpty() && w == Albums && Albums->ReallyEmpty())
|
||||||
{
|
{
|
||||||
Albums->HighlightColor(Config.main_highlight_color);
|
Albums->HighlightColor(Config.main_highlight_color);
|
||||||
Artists->HighlightColor(Config.active_column_color);
|
Artists->HighlightColor(Config.active_column_color);
|
||||||
w = Artists;
|
w = Artists;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(hasTwoColumns ? Albums->Empty() : Artists->Empty()) && Songs->Empty())
|
if (!(hasTwoColumns ? Albums->ReallyEmpty() : Artists->ReallyEmpty()) && Songs->ReallyEmpty())
|
||||||
{
|
{
|
||||||
Songs->Reset();
|
Songs->Reset();
|
||||||
MPD::SongList list;
|
MPD::SongList list;
|
||||||
@@ -545,16 +545,16 @@ void MediaLibrary::NextColumn()
|
|||||||
{
|
{
|
||||||
if (w == Artists)
|
if (w == Artists)
|
||||||
{
|
{
|
||||||
if (!hasTwoColumns && Songs->Empty())
|
if (!hasTwoColumns && Songs->ReallyEmpty())
|
||||||
return;
|
return;
|
||||||
Artists->HighlightColor(Config.main_highlight_color);
|
Artists->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
w = Albums;
|
w = Albums;
|
||||||
Albums->HighlightColor(Config.active_column_color);
|
Albums->HighlightColor(Config.active_column_color);
|
||||||
if (!Albums->Empty())
|
if (!Albums->ReallyEmpty())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (w == Albums && !Songs->Empty())
|
if (w == Albums && !Songs->ReallyEmpty())
|
||||||
{
|
{
|
||||||
Albums->HighlightColor(Config.main_highlight_color);
|
Albums->HighlightColor(Config.main_highlight_color);
|
||||||
w->Refresh();
|
w->Refresh();
|
||||||
@@ -571,7 +571,7 @@ void MediaLibrary::PrevColumn()
|
|||||||
w->Refresh();
|
w->Refresh();
|
||||||
w = Albums;
|
w = Albums;
|
||||||
Albums->HighlightColor(Config.active_column_color);
|
Albums->HighlightColor(Config.active_column_color);
|
||||||
if (!Albums->Empty())
|
if (!Albums->ReallyEmpty())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (w == Albums && !hasTwoColumns)
|
if (w == Albums && !hasTwoColumns)
|
||||||
|
|||||||
@@ -448,9 +448,17 @@ namespace NCurses
|
|||||||
|
|
||||||
/// Checks if list is empty
|
/// Checks if list is empty
|
||||||
/// @return true if list is empty, false otherwise
|
/// @return true if list is empty, false otherwise
|
||||||
|
/// @see ReallyEmpty()
|
||||||
///
|
///
|
||||||
virtual bool Empty() const { return itsOptionsPtr->empty(); }
|
virtual bool Empty() const { return itsOptionsPtr->empty(); }
|
||||||
|
|
||||||
|
/// Checks if list is really empty since Empty() may not
|
||||||
|
/// be accurate if filter is set)
|
||||||
|
/// @return true if list is empty, false otherwise
|
||||||
|
/// @see Empty()
|
||||||
|
///
|
||||||
|
virtual bool ReallyEmpty() const { return itsOptions.empty(); }
|
||||||
|
|
||||||
/// @return size of the list
|
/// @return size of the list
|
||||||
///
|
///
|
||||||
virtual size_t Size() const;
|
virtual size_t Size() const;
|
||||||
|
|||||||
@@ -1461,7 +1461,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
myTinyTagEditor->SwitchTo();
|
myTinyTagEditor->SwitchTo();
|
||||||
}
|
}
|
||||||
else if (myScreen->ActiveWindow() == myLibrary->Artists)
|
else if (myScreen->ActiveWindow() == myLibrary->Artists && !myLibrary->Artists->Empty())
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << IntoStr(Config.media_lib_primary_tag) << fmtBoldEnd << ": ";
|
Statusbar() << fmtBold << IntoStr(Config.media_lib_primary_tag) << fmtBoldEnd << ": ";
|
||||||
@@ -1500,7 +1500,7 @@ int main(int argc, char *argv[])
|
|||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (myScreen->ActiveWindow() == myLibrary->Albums)
|
else if (myScreen->ActiveWindow() == myLibrary->Albums && !myLibrary->Albums->Empty())
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << "Album: " << fmtBoldEnd;
|
Statusbar() << fmtBold << "Album: " << fmtBoldEnd;
|
||||||
|
|||||||
Reference in New Issue
Block a user