aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-03 02:18:04 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-03 02:18:04 +0100
commitb3fbbd12c1c623e108103c5be20febbecc730777 (patch)
treeaddfd449f611daa3b58243f37dbe74ac0050a86e /src
parent45740fa881c495bc91ff05c14dab6d80000cddb5 (diff)
Matrix: update body item filter when switching tab
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp9
-rw-r--r--src/plugins/Manga.cpp4
-rw-r--r--src/plugins/Matrix.cpp12
3 files changed, 16 insertions, 9 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 61e59a3..fe2e7b0 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -898,7 +898,7 @@ namespace QuickMedia {
for(Tab &tab : tabs) {
tab.body->thumbnail_max_size = tab.page->get_thumbnail_max_size();
- tab.page->on_navigate_to_page(tab.body->items);
+ tab.page->on_navigate_to_page(tab.body.get());
}
const Json::Value *json_chapters = &Json::Value::nullSingleton();
@@ -1026,7 +1026,7 @@ namespace QuickMedia {
} else {
page_loop(new_tabs);
}
- tabs[selected_tab].page->on_navigate_to_page(tabs[selected_tab].body->items);
+ tabs[selected_tab].page->on_navigate_to_page(tabs[selected_tab].body.get());
if(content_storage_json.isObject()) {
const Json::Value &chapters_json = content_storage_json["chapters"];
if(chapters_json.isObject())
@@ -4238,7 +4238,8 @@ namespace QuickMedia {
auto rooms_body = create_body();
rooms_body->thumbnail_mask_shader = &circle_mask_shader;
- auto matrix_rooms_page = std::make_unique<MatrixRoomsPage>(this, rooms_body.get(), "All rooms");
+ auto matrix_rooms_page_search_bar = create_search_bar("Search...", SEARCH_DELAY_FILTER);
+ auto matrix_rooms_page = std::make_unique<MatrixRoomsPage>(this, rooms_body.get(), "All rooms", nullptr, matrix_rooms_page_search_bar.get());
auto rooms_tags_body = create_body();
rooms_tags_body->thumbnail_mask_shader = &circle_mask_shader;
@@ -4252,7 +4253,7 @@ namespace QuickMedia {
matrix->start_sync(&matrix_handler);
std::vector<Tab> tabs;
- tabs.push_back(Tab{std::move(rooms_body), std::move(matrix_rooms_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
+ tabs.push_back(Tab{std::move(rooms_body), std::move(matrix_rooms_page), std::move(matrix_rooms_page_search_bar)});
tabs.push_back(Tab{std::move(rooms_tags_body), std::move(matrix_rooms_tag_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
tabs.push_back(Tab{std::move(invites_body), std::move(matrix_invites_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
diff --git a/src/plugins/Manga.cpp b/src/plugins/Manga.cpp
index 4685cec..f3c6814 100644
--- a/src/plugins/Manga.cpp
+++ b/src/plugins/Manga.cpp
@@ -10,8 +10,8 @@ namespace QuickMedia {
return TrackResult::ERR;
}
- void MangaChaptersPage::on_navigate_to_page(BodyItems &body_items) {
- (void)body_items;
+ void MangaChaptersPage::on_navigate_to_page(Body *body) {
+ (void)body;
std::string manga_id;
if(extract_id_from_url(content_url, manga_id))
load_manga_content_storage(get_service_name(), content_title, manga_id);
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index fd05399..2e96cd0 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -442,7 +442,7 @@ namespace QuickMedia {
pending_room_messages.clear();
}
- MatrixRoomsPage::MatrixRoomsPage(Program *program, Body *body, std::string title, MatrixRoomTagsPage *room_tags_page) : Page(program), body(body), title(std::move(title)), room_tags_page(room_tags_page) {
+ MatrixRoomsPage::MatrixRoomsPage(Program *program, Body *body, std::string title, MatrixRoomTagsPage *room_tags_page, SearchBar *search_bar) : Page(program), body(body), title(std::move(title)), room_tags_page(room_tags_page), search_bar(search_bar) {
if(room_tags_page)
room_tags_page->set_current_rooms_page(this);
}
@@ -460,6 +460,11 @@ namespace QuickMedia {
return PluginResult::OK;
}
+ void MatrixRoomsPage::on_navigate_to_page(Body *body) {
+ if(search_bar)
+ body->filter_search_fuzzy(search_bar->get_text());
+ }
+
void MatrixRoomsPage::update() {
{
std::lock_guard<std::mutex> lock(mutex);
@@ -548,9 +553,10 @@ namespace QuickMedia {
TagData &tag_data = tag_body_items_by_name[url];
body->items = tag_data.room_body_items;
sort_room_body_items(body->items);
- auto rooms_page = std::make_unique<MatrixRoomsPage>(program, body_ptr, tag_data.tag_item->get_title(), this);
+ auto search_bar = create_search_bar("Search...", SEARCH_DELAY_FILTER);
+ auto rooms_page = std::make_unique<MatrixRoomsPage>(program, body_ptr, tag_data.tag_item->get_title(), this, search_bar.get());
rooms_page->matrix_delegate = matrix_delegate;
- result_tabs.push_back(Tab{std::move(body), std::move(rooms_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
+ result_tabs.push_back(Tab{std::move(body), std::move(rooms_page), std::move(search_bar)});
return PluginResult::OK;
}