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