add config option for default place to search in (database/playlist)
This commit is contained in:
@@ -153,7 +153,6 @@ bool redraw_header = 1;
|
||||
bool reload_lyrics = 0;
|
||||
|
||||
extern bool header_update_status;
|
||||
extern bool search_place;
|
||||
extern bool search_case_sensitive;
|
||||
extern bool search_match_to_pattern;
|
||||
|
||||
@@ -1287,8 +1286,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
search_place = !search_place;
|
||||
mSearcher->Current().first = "[.b]Search in:[/b] " + string(search_place ? "Database" : "Current playlist");
|
||||
Config.search_in_db = !Config.search_in_db;
|
||||
mSearcher->Current().first = "[.b]Search in:[/b] " + string(Config.search_in_db ? "Database" : "Current playlist");
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
|
||||
@@ -26,7 +26,6 @@ extern Menu<Song> *mPlaylist;
|
||||
extern Menu< std::pair<string, Song> > *mSearcher;
|
||||
|
||||
bool search_match_to_pattern = 1;
|
||||
bool search_place = 1;
|
||||
bool search_case_sensitive = 0;
|
||||
|
||||
string SearchEngineDisplayer(const std::pair<string, Song> &pair, void *, const Menu< std::pair<string, Song> > *menu)
|
||||
@@ -68,7 +67,7 @@ void PrepareSearchEngine(Song &s)
|
||||
mSearcher->AddOption(make_pair("[.b]Genre:[/b] " + s.GetGenre(), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Comment:[/b] " + s.GetComment(), Song()));
|
||||
mSearcher->AddSeparator();
|
||||
mSearcher->AddOption(make_pair("[.b]Search in:[/b] " + string(search_place ? "Database" : "Current playlist"), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Search in:[/b] " + string(Config.search_in_db ? "Database" : "Current playlist"), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Search mode:[/b] " + (search_match_to_pattern ? search_mode_normal : search_mode_strict), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Case sensitive:[/b] " + string(search_case_sensitive ? "Yes" : "No"), Song()));
|
||||
mSearcher->AddSeparator();
|
||||
@@ -82,7 +81,7 @@ void Search(Song &s)
|
||||
return;
|
||||
|
||||
SongList list;
|
||||
if (search_place)
|
||||
if (Config.search_in_db)
|
||||
Mpd->GetDirectoryRecursive("/", list);
|
||||
else
|
||||
{
|
||||
@@ -200,7 +199,7 @@ void Search(Song &s)
|
||||
mSearcher->AddOption(make_pair(".", **it));
|
||||
found = 1;
|
||||
}
|
||||
if (search_place) // free song list only if it's database
|
||||
if (Config.search_in_db) // free song list only if it's database
|
||||
FreeSongList(list);
|
||||
s.GetEmptyFields(0);
|
||||
}
|
||||
|
||||
@@ -259,6 +259,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
||||
conf.incremental_seeking = true;
|
||||
conf.now_playing_lyrics = false;
|
||||
conf.local_browser = false;
|
||||
conf.search_in_db = true;
|
||||
conf.set_window_title = true;
|
||||
conf.mpd_port = 6600;
|
||||
conf.mpd_connection_timeout = 15;
|
||||
@@ -653,6 +654,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
||||
{
|
||||
conf.ncmpc_like_songs_adding = v == "yes";
|
||||
}
|
||||
else if (it->find("default_place_to_search_in") != string::npos)
|
||||
{
|
||||
conf.search_in_db = v == "database";
|
||||
}
|
||||
else if (it->find("enable_window_title") != string::npos)
|
||||
{
|
||||
conf.set_window_title = v == "yes";
|
||||
|
||||
@@ -145,6 +145,7 @@ struct ncmpcpp_config
|
||||
bool incremental_seeking;
|
||||
bool now_playing_lyrics;
|
||||
bool local_browser;
|
||||
bool search_in_db;
|
||||
|
||||
int mpd_port;
|
||||
int mpd_connection_timeout;
|
||||
|
||||
Reference in New Issue
Block a user