use key (F)4 to reset search engine state while being in this screen

This commit is contained in:
Andrzej Rybczak
2010-01-23 21:49:43 +01:00
parent 0dfa5f77fa
commit af12b75b93
3 changed files with 15 additions and 5 deletions

View File

@@ -254,6 +254,7 @@ void Help::GetKeybindings()
*w << DisplayKeys(Key.EditTags) << "Edit song's tags\n";
# endif // HAVE_TAGLIB_H
*w << DisplayKeys(Key.ToggleSingle) << "Start searching immediately\n";
*w << DisplayKeys(Key.SearchEngine) << "Reset search engine\n";
*w << "\n\n " << fmtBold << "Keys - Media library\n -----------------------------------------\n" << fmtBoldEnd;

View File

@@ -84,7 +84,10 @@ void SearchEngine::SwitchTo()
using Global::myScreen;
if (myScreen == this)
{
Reset();
return;
}
if (!isInitialized)
Init();
@@ -169,11 +172,7 @@ void SearchEngine::EnterPressed()
}
else if (option == ResetButton)
{
for (size_t i = 0; i < ConstraintsNumber; ++i)
itsConstraints[i].clear();
w->Reset();
Prepare();
ShowMessage("Search state reset");
Reset();
}
else
w->Bold(w->Choice(), myPlaylist->Add(*w->Current().second, w->isBold(), 1));
@@ -301,6 +300,15 @@ void SearchEngine::Prepare()
*w->at(ResetButton).first << "Reset";
}
void SearchEngine::Reset()
{
for (size_t i = 0; i < ConstraintsNumber; ++i)
itsConstraints[i].clear();
w->Reset();
Prepare();
ShowMessage("Search state reset");
}
void SearchEngine::Search()
{
bool constraints_empty = 1;

View File

@@ -59,6 +59,7 @@ class SearchEngine : public Screen< Menu< std::pair<Buffer *, MPD::Song *> > >
private:
void Prepare();
void Search();
void Reset();
const char **SearchMode;