make blocking search constraints change after successful searching optional

it's still enabled by default though.
This commit is contained in:
Andrzej Rybczak
2009-03-03 21:13:02 +01:00
parent 339bbb4925
commit 73f7980019
5 changed files with 17 additions and 6 deletions

View File

@@ -153,6 +153,8 @@
## ##
#ignore_leading_the = "no" #ignore_leading_the = "no"
# #
#block_search_constraints_change_if_items_found = "yes"
#
#enable_window_title = "yes" #enable_window_title = "yes"
# #
##### lyrics support ##### ##### lyrics support #####

View File

@@ -1206,7 +1206,7 @@ int main(int argc, char *argv[])
Config.stop_after_current_song = !Config.stop_after_current_song; Config.stop_after_current_song = !Config.stop_after_current_song;
ShowMessage("Stop playing after current song: %s", Config.stop_after_current_song ? "on" : "off"); ShowMessage("Stop playing after current song: %s", Config.stop_after_current_song ? "on" : "off");
} }
else if (myScreen == mySearcher) else if (myScreen == mySearcher && !mySearcher->Main()->isStatic(0))
{ {
mySearcher->Main()->Highlight(SearchEngine::SearchButton); mySearcher->Main()->Highlight(SearchEngine::SearchButton);
mySearcher->Main()->Highlighting(0); mySearcher->Main()->Highlighting(0);

View File

@@ -186,6 +186,8 @@ void SearchEngine::EnterPressed()
case 15: case 15:
{ {
ShowMessage("Searching..."); ShowMessage("Searching...");
if (w->Size() > StaticOptions)
Prepare();
Search(); Search();
if (!w->Back().first) if (!w->Back().first)
{ {
@@ -200,8 +202,9 @@ void SearchEngine::EnterPressed()
w->InsertSeparator(ResetButton+3); w->InsertSeparator(ResetButton+3);
UpdateFoundList(); UpdateFoundList();
ShowMessage("Searching finished!"); ShowMessage("Searching finished!");
for (size_t i = 0; i < StaticOptions-4; i++) if (Config.block_search_constraints_change)
w->Static(i, 1); for (size_t i = 0; i < StaticOptions-4; i++)
w->Static(i, 1);
w->Scroll(wDown); w->Scroll(wDown);
w->Scroll(wDown); w->Scroll(wDown);
} }
@@ -212,6 +215,8 @@ void SearchEngine::EnterPressed()
case 16: case 16:
{ {
CLEAR_FIND_HISTORY; CLEAR_FIND_HISTORY;
itsPattern.Clear();
w->Reset();
Prepare(); Prepare();
ShowMessage("Search state reset"); ShowMessage("Search state reset");
break; break;
@@ -334,10 +339,8 @@ void SearchEngine::Prepare()
catch (List::InvalidItem) { } catch (List::InvalidItem) { }
} }
itsPattern.Clear();
w->SetTitle(""); w->SetTitle("");
w->Clear(); w->Clear(0);
w->Reset();
w->ResizeBuffer(17); w->ResizeBuffer(17);
w->IntoSeparator(10); w->IntoSeparator(10);

View File

@@ -267,6 +267,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
conf.clock_display_seconds = false; conf.clock_display_seconds = false;
conf.ignore_leading_the = false; conf.ignore_leading_the = false;
conf.stop_after_current_song = false; conf.stop_after_current_song = false;
conf.block_search_constraints_change = 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;
@@ -638,6 +639,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
{ {
conf.ignore_leading_the = v == "yes"; conf.ignore_leading_the = v == "yes";
} }
else if (cl.find("block_search_constraints_change_if_items_found") != string::npos)
{
conf.block_search_constraints_change = v == "yes";
}
else if (cl.find("enable_window_title") != string::npos) else if (cl.find("enable_window_title") != string::npos)
{ {
conf.set_window_title = v == "yes"; conf.set_window_title = v == "yes";

View File

@@ -159,6 +159,7 @@ struct ncmpcpp_config
bool clock_display_seconds; bool clock_display_seconds;
bool ignore_leading_the; bool ignore_leading_the;
bool stop_after_current_song; bool stop_after_current_song;
bool block_search_constraints_change;
int mpd_port; int mpd_port;
int mpd_connection_timeout; int mpd_connection_timeout;