mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-05 21:55:24 +00:00
A couple small tweaks to SearchLayout to ensure it requeries only when required.
This commit is contained in:
parent
14b516060d
commit
be5ef75fad
@ -88,8 +88,7 @@ void SearchLayout::Layout() {
|
||||
#define CREATE_CATEGORY(view, type, order) \
|
||||
view.reset(new CategoryListView(this->library, type)); \
|
||||
this->AddWindow(view); \
|
||||
view->SetFocusOrder(order); \
|
||||
view->Requery();
|
||||
view->SetFocusOrder(order);
|
||||
|
||||
void SearchLayout::InitializeWindows() {
|
||||
this->input.reset(new cursespp::TextInput());
|
||||
@ -105,22 +104,28 @@ void SearchLayout::InitializeWindows() {
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
void SearchLayout::OnInputChanged(cursespp::TextInput* sender, std::string value) {
|
||||
void SearchLayout::Requery(const std::string& value) {
|
||||
this->albums->Requery(value);
|
||||
this->artists->Requery(value);
|
||||
this->genres->Requery(value);
|
||||
}
|
||||
|
||||
void SearchLayout::OnInputChanged(cursespp::TextInput* sender, std::string value) {
|
||||
this->Requery(value);
|
||||
}
|
||||
|
||||
void SearchLayout::OnVisibilityChanged(bool visible) {
|
||||
LayoutBase::OnVisibilityChanged(visible);
|
||||
|
||||
if (visible) {
|
||||
this->SetFocus(this->input);
|
||||
if (this->input->Length()) {
|
||||
/* clear, which will trigger a requery */
|
||||
this->input->SetText("");
|
||||
}
|
||||
|
||||
this->SetFocus(this->input);
|
||||
else {
|
||||
this->Requery();
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->albums->Reset();
|
||||
|
@ -68,6 +68,7 @@ namespace musik {
|
||||
|
||||
private:
|
||||
void InitializeWindows();
|
||||
void Requery(const std::string& value = "");
|
||||
|
||||
void OnInputChanged(
|
||||
cursespp::TextInput* sender,
|
||||
|
Loading…
Reference in New Issue
Block a user