aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-07-03 16:55:19 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-03 16:55:19 +0200
commit18467b4cd333ab0b7aa10b1c1acd83942c583e60 (patch)
treebeb77bd217a9530bd2ed057f67a5412ba3f8a1e3 /src/QuickMedia.cpp
parent2d796243ad157f52d33a5b9d4f449e3845cf1649 (diff)
Add tab autocomplete for youtube
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 6ab8c19..0845d43 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -215,7 +215,6 @@ namespace QuickMedia {
case Page::SEARCH_SUGGESTION:
body->draw_thumbnails = current_plugin->search_suggestions_has_thumbnails();
search_suggestion_page();
- search_bar->onTextBeginTypingCallback = nullptr;
break;
#if 0
case Page::SEARCH_RESULT:
@@ -400,6 +399,11 @@ namespace QuickMedia {
typing = true;
};
+ search_bar->autocomplete_search_delay = current_plugin->get_autocomplete_delay();
+ search_bar->onAutocompleteRequestCallback = [this](const sf::String &text) {
+ return current_plugin->autocomplete_search(text);
+ };
+
search_bar->onTextUpdateCallback = [&update_search_text, this, &tabs, &selected_tab, &typing](const std::string &text) {
if(tabs[selected_tab].body == body && !current_plugin->search_is_filter())
update_search_text = text;
@@ -496,6 +500,8 @@ namespace QuickMedia {
} else if(event.key.code == sf::Keyboard::Right) {
selected_tab = std::min((int)tabs.size() - 1, selected_tab + 1);
search_bar->clear();
+ } else if(event.key.code == sf::Keyboard::Tab) {
+ search_bar->set_to_autocomplete();
}
}
}
@@ -575,6 +581,7 @@ namespace QuickMedia {
}
search_bar->onTextBeginTypingCallback = nullptr;
+ search_bar->onAutocompleteRequestCallback = nullptr;
}
void Program::search_result_page() {