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