mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-07 09:54:55 +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) \
|
#define CREATE_CATEGORY(view, type, order) \
|
||||||
view.reset(new CategoryListView(this->library, type)); \
|
view.reset(new CategoryListView(this->library, type)); \
|
||||||
this->AddWindow(view); \
|
this->AddWindow(view); \
|
||||||
view->SetFocusOrder(order); \
|
view->SetFocusOrder(order);
|
||||||
view->Requery();
|
|
||||||
|
|
||||||
void SearchLayout::InitializeWindows() {
|
void SearchLayout::InitializeWindows() {
|
||||||
this->input.reset(new cursespp::TextInput());
|
this->input.reset(new cursespp::TextInput());
|
||||||
@ -105,22 +104,28 @@ void SearchLayout::InitializeWindows() {
|
|||||||
this->Layout();
|
this->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchLayout::OnInputChanged(cursespp::TextInput* sender, std::string value) {
|
void SearchLayout::Requery(const std::string& value) {
|
||||||
this->albums->Requery(value);
|
this->albums->Requery(value);
|
||||||
this->artists->Requery(value);
|
this->artists->Requery(value);
|
||||||
this->genres->Requery(value);
|
this->genres->Requery(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchLayout::OnInputChanged(cursespp::TextInput* sender, std::string value) {
|
||||||
|
this->Requery(value);
|
||||||
|
}
|
||||||
|
|
||||||
void SearchLayout::OnVisibilityChanged(bool visible) {
|
void SearchLayout::OnVisibilityChanged(bool visible) {
|
||||||
LayoutBase::OnVisibilityChanged(visible);
|
LayoutBase::OnVisibilityChanged(visible);
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
this->SetFocus(this->input);
|
||||||
if (this->input->Length()) {
|
if (this->input->Length()) {
|
||||||
/* clear, which will trigger a requery */
|
/* clear, which will trigger a requery */
|
||||||
this->input->SetText("");
|
this->input->SetText("");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
this->SetFocus(this->input);
|
this->Requery();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->albums->Reset();
|
this->albums->Reset();
|
||||||
|
@ -68,6 +68,7 @@ namespace musik {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeWindows();
|
void InitializeWindows();
|
||||||
|
void Requery(const std::string& value = "");
|
||||||
|
|
||||||
void OnInputChanged(
|
void OnInputChanged(
|
||||||
cursespp::TextInput* sender,
|
cursespp::TextInput* sender,
|
||||||
|
Loading…
Reference in New Issue
Block a user