actions: define DisableFilter in terms of ApplyFilter
This commit is contained in:
@@ -1972,14 +1972,18 @@ void ReversePlaylist::Run()
|
||||
myPlaylist->Reverse();
|
||||
}
|
||||
|
||||
bool ApplyFilter::canBeRun() const
|
||||
{
|
||||
return myScreen->GetList();
|
||||
}
|
||||
|
||||
void ApplyFilter::Run()
|
||||
{
|
||||
using Global::RedrawHeader;
|
||||
using Global::wFooter;
|
||||
|
||||
List *mList = myScreen->GetList();
|
||||
if (!mList)
|
||||
return;
|
||||
assert(mList);
|
||||
|
||||
LockStatusbar();
|
||||
Statusbar() << fmtBold << "Apply filter: " << fmtBoldEnd;
|
||||
@@ -2004,24 +2008,16 @@ void ApplyFilter::Run()
|
||||
|
||||
void DisableFilter::Run()
|
||||
{
|
||||
using Global::RedrawHeader;
|
||||
using Global::wFooter;
|
||||
|
||||
List *mList = myScreen->GetList();
|
||||
if (!mList)
|
||||
return;
|
||||
|
||||
mList->ApplyFilter("");
|
||||
|
||||
ShowMessage("Filtering disabled");
|
||||
|
||||
if (myScreen == myPlaylist)
|
||||
ApplyFilter *applyFilter = dynamic_cast<ApplyFilter *>(Get(aApplyFilter));
|
||||
if (applyFilter && applyFilter->canBeRun())
|
||||
{
|
||||
myPlaylist->EnableHighlighting();
|
||||
Playlist::ReloadTotalLength = true;
|
||||
RedrawHeader = true;
|
||||
// delete current filter
|
||||
wFooter->PushChar(KEY_CTRL_U);
|
||||
wFooter->PushChar(KEY_ENTER);
|
||||
applyFilter->Execute();
|
||||
}
|
||||
ListsChangeFinisher();
|
||||
}
|
||||
|
||||
bool Find::canBeRun() const
|
||||
|
||||
@@ -634,6 +634,7 @@ struct ReversePlaylist : public Action
|
||||
struct ApplyFilter : public Action
|
||||
{
|
||||
ApplyFilter() : Action(aApplyFilter, "apply_filter") { }
|
||||
virtual bool canBeRun() const;
|
||||
virtual void Run();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user