actions: split ShowSearchEngine into ShowSearchEngine and ResetSearchEngine
This commit is contained in:
@@ -184,6 +184,9 @@
|
||||
#def_key "3"
|
||||
# show_search_engine
|
||||
#
|
||||
#def_key "3"
|
||||
# reset_search_engine
|
||||
#
|
||||
#def_key "4"
|
||||
# show_media_library
|
||||
#
|
||||
|
||||
@@ -2032,16 +2032,6 @@ void ToggleBitrateVisibility::Run()
|
||||
Statusbar::msg("Bitrate visibility %s", Config.display_bitrate ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
bool ChangeBrowseMode::canBeRun() const
|
||||
{
|
||||
return myScreen == myBrowser;
|
||||
}
|
||||
|
||||
void ChangeBrowseMode::Run()
|
||||
{
|
||||
myBrowser->ChangeBrowseMode();
|
||||
}
|
||||
|
||||
void AddRandomItems::Run()
|
||||
{
|
||||
using Global::wFooter;
|
||||
@@ -2368,18 +2358,40 @@ void ShowBrowser::Run()
|
||||
myBrowser->switchTo();
|
||||
}
|
||||
|
||||
#ifdef HAVE_TAGLIB_H
|
||||
bool ChangeBrowseMode::canBeRun() const
|
||||
{
|
||||
return myScreen == myBrowser;
|
||||
}
|
||||
|
||||
void ChangeBrowseMode::Run()
|
||||
{
|
||||
myBrowser->ChangeBrowseMode();
|
||||
}
|
||||
|
||||
bool ShowSearchEngine::canBeRun() const
|
||||
{
|
||||
return myScreen != myTinyTagEditor;
|
||||
}
|
||||
return myScreen != mySearcher
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
&& myScreen != myTinyTagEditor
|
||||
# endif // HAVE_TAGLIB_H
|
||||
;
|
||||
}
|
||||
|
||||
void ShowSearchEngine::Run()
|
||||
{
|
||||
mySearcher->switchTo();
|
||||
}
|
||||
|
||||
bool ResetSearchEngine::canBeRun() const
|
||||
{
|
||||
return myScreen == mySearcher;
|
||||
}
|
||||
|
||||
void ResetSearchEngine::Run()
|
||||
{
|
||||
mySearcher->reset();
|
||||
}
|
||||
|
||||
#ifdef HAVE_TAGLIB_H
|
||||
bool ShowMediaLibrary::canBeRun() const
|
||||
{
|
||||
@@ -2592,7 +2604,6 @@ void populateActions()
|
||||
insertAction(new ToggleAddMode());
|
||||
insertAction(new ToggleMouse());
|
||||
insertAction(new ToggleBitrateVisibility());
|
||||
insertAction(new ChangeBrowseMode());
|
||||
insertAction(new AddRandomItems());
|
||||
insertAction(new ToggleBrowserSortMode());
|
||||
insertAction(new ToggleLibraryTagType());
|
||||
@@ -2609,7 +2620,9 @@ void populateActions()
|
||||
insertAction(new ShowHelp());
|
||||
insertAction(new ShowPlaylist());
|
||||
insertAction(new ShowBrowser());
|
||||
insertAction(new ChangeBrowseMode());
|
||||
insertAction(new ShowSearchEngine());
|
||||
insertAction(new ResetSearchEngine());
|
||||
insertAction(new ShowMediaLibrary());
|
||||
insertAction(new ShowPlaylistEditor());
|
||||
insertAction(new ShowTagEditor());
|
||||
|
||||
@@ -47,7 +47,7 @@ enum ActionType
|
||||
aRefetchLyrics, aRefetchArtistInfo, aSetSelectedItemsPriority, aFilterPlaylistOnPriorities,
|
||||
aShowSongInfo, aShowArtistInfo,
|
||||
aShowLyrics, aQuit, aNextScreen, aPreviousScreen, aShowHelp, aShowPlaylist, aShowBrowser, aChangeBrowseMode,
|
||||
aShowSearchEngine, aShowMediaLibrary, aShowPlaylistEditor, aShowTagEditor, aShowOutputs,
|
||||
aShowSearchEngine, aResetSearchEngine, aShowMediaLibrary, aShowPlaylistEditor, aShowTagEditor, aShowOutputs,
|
||||
aShowVisualizer, aShowClock, aShowServerInfo
|
||||
};
|
||||
|
||||
@@ -1015,9 +1015,16 @@ struct ShowSearchEngine : public Action
|
||||
ShowSearchEngine() : Action(aShowSearchEngine, "show_search_engine") { }
|
||||
|
||||
protected:
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
virtual bool canBeRun() const;
|
||||
# endif // HAVE_TAGLIB_H
|
||||
virtual void Run();
|
||||
};
|
||||
|
||||
struct ResetSearchEngine : public Action
|
||||
{
|
||||
ResetSearchEngine() : Action(aResetSearchEngine, "reset_search_engine") { }
|
||||
|
||||
protected:
|
||||
virtual bool canBeRun() const;
|
||||
virtual void Run();
|
||||
};
|
||||
|
||||
|
||||
@@ -314,7 +314,10 @@ void BindingsConfiguration::generateDefaults()
|
||||
bind(k, aChangeBrowseMode);
|
||||
}
|
||||
if (notBound(k = stringToKey("3")))
|
||||
{
|
||||
bind(k, aShowSearchEngine);
|
||||
bind(k, aResetSearchEngine);
|
||||
}
|
||||
if (notBound(k = stringToKey("4")))
|
||||
bind(k, aShowMediaLibrary);
|
||||
if (notBound(k = stringToKey("5")))
|
||||
|
||||
@@ -308,7 +308,7 @@ void Help::GetKeybindings()
|
||||
KeyDesc(aEditSong, "Edit song");
|
||||
# endif // HAVE_TAGLIB_H
|
||||
KeyDesc(aStartSearching, "Start searching");
|
||||
KeyDesc(aShowSearchEngine, "Reset search constraints and clear results");
|
||||
KeyDesc(aResetSearchEngine, "Reset search constraints and clear results");
|
||||
|
||||
KeysSection("Media library");
|
||||
if (!Config.media_library_disable_two_column_mode)
|
||||
|
||||
@@ -125,8 +125,6 @@ void SearchEngine::resize()
|
||||
}
|
||||
|
||||
void SearchEngine::switchTo()
|
||||
{
|
||||
if (Global::myScreen != this)
|
||||
{
|
||||
SwitchTo::execute(this);
|
||||
if (w.empty())
|
||||
@@ -134,9 +132,6 @@ void SearchEngine::switchTo()
|
||||
markSongsInPlaylist(getProxySongList());
|
||||
drawHeader();
|
||||
}
|
||||
else
|
||||
reset();
|
||||
}
|
||||
|
||||
std::wstring SearchEngine::title()
|
||||
{
|
||||
|
||||
@@ -110,6 +110,8 @@ struct SearchEngine: Screen<NC::Menu<SEItem>>, Filterable, HasSongs, Searchable,
|
||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
||||
|
||||
// private members
|
||||
void reset();
|
||||
|
||||
static size_t StaticOptions;
|
||||
static size_t SearchButton;
|
||||
static size_t ResetButton;
|
||||
@@ -120,7 +122,6 @@ protected:
|
||||
private:
|
||||
void Prepare();
|
||||
void Search();
|
||||
void reset();
|
||||
|
||||
const char **SearchMode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user