aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-01 11:15:53 +0100
committerdec05eba <dec05eba@protonmail.com>2022-03-01 11:20:39 +0100
commit29d3f495e3b3be801cbb8c8dbd3f7250ec22415a (patch)
tree5012ae8a8e8752474128245b6d484c8d263d58a7 /src/QuickMedia.cpp
parentd1ea6b9f9ae63f2715f2e0b8aa6eedb9a334bf7a (diff)
SearchBar refactor. Dont show search icon if searchbar is not used for search
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index affdb93..15a7f50 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1695,7 +1695,7 @@ namespace QuickMedia {
}
std::unique_ptr<SearchBar> Program::create_search_bar(const std::string &placeholder, int search_delay) {
- auto search_bar = std::make_unique<SearchBar>(&plugin_logo, &rounded_rectangle_shader, placeholder);
+ auto search_bar = std::make_unique<SearchBar>(&plugin_logo, &rounded_rectangle_shader, placeholder, SearchBarType::Search);
search_bar->text_autosearch_delay_ms = search_delay;
return search_bar;
}
@@ -4820,9 +4820,9 @@ namespace QuickMedia {
void Program::chat_login_page() {
assert(strcmp(plugin_name, "matrix") == 0);
- SearchBar login_input(nullptr, &rounded_rectangle_shader, "Username");
- SearchBar password_input(nullptr, &rounded_rectangle_shader, "Password", true);
- SearchBar homeserver_input(nullptr, &rounded_rectangle_shader, "Homeserver");
+ SearchBar login_input(nullptr, &rounded_rectangle_shader, "Username", SearchBarType::Text);
+ SearchBar password_input(nullptr, &rounded_rectangle_shader, "Password", SearchBarType::Password);
+ SearchBar homeserver_input(nullptr, &rounded_rectangle_shader, "Homeserver", SearchBarType::Text);
const int num_inputs = 3;
SearchBar *inputs[num_inputs] = { &login_input, &password_input, &homeserver_input };
@@ -4848,7 +4848,11 @@ namespace QuickMedia {
current_page = PageType::CHAT;
return true;
} else {
- show_notification("QuickMedia", "Failed to login, error: " + err_msg + ". Did you perhaps specify an invalid homeserver?", Urgency::CRITICAL);
+ // TODO: Do a proper check for this
+ if(err_msg.find("Failed to parse") != std::string::npos)
+ show_notification("QuickMedia", "Failed to login, error: " + err_msg + ". Did you perhaps specify an invalid homeserver?", Urgency::CRITICAL);
+ else
+ show_notification("QuickMedia", "Failed to login, error: " + err_msg, Urgency::CRITICAL);
return false;
}
});