From 7cf3b5bdb58d279d2cc2aa7770c09afeeeebb5b7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 8 Feb 2021 22:50:21 +0100 Subject: Matrix: add room list on the left side when in a room --- include/QuickMedia.hpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'include/QuickMedia.hpp') diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index 90e24bc..665c7e9 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -16,6 +16,7 @@ #include #include #include +#include "../plugins/Plugin.hpp" #include #include @@ -43,6 +44,30 @@ namespace QuickMedia { FALSE, CANCEL }; + + enum class FetchType { + SEARCH, + LAZY + }; + + struct FetchResult { + BodyItems body_items; + PluginResult result; + }; + + struct TabAssociatedData { + std::string update_search_text; + bool search_text_updated = false; + FetchStatus fetch_status = FetchStatus::NONE; + bool lazy_fetch_finished = false; + FetchType fetch_type; + bool typing = false; + bool fetching_next_page_running = false; + int fetched_page = 0; + sf::Text search_result_text; + std::future fetch_future; + std::future next_page_future; + }; class Program { public: @@ -70,6 +95,7 @@ namespace QuickMedia { void youtube_get_watch_history(BodyItems &history_items); private: void base_event_handler(sf::Event &event, PageType previous_page, Body *body, SearchBar *search_bar, bool handle_key_press = true, bool handle_searchbar = true); + void page_loop_render(sf::RenderWindow &window, std::vector &tabs, int selected_tab, TabAssociatedData &tab_associated_data, const Json::Value *json_chapters); void page_loop(std::vector &tabs, int start_tab_index = 0, std::function after_submit_handler = nullptr); void video_content_page(VideoPage *video_page, std::string video_url, std::string video_title, bool download_if_streaming_fails); // Returns -1 to go to previous chapter, 0 to stay on same chapter and 1 to go to next chapter @@ -77,7 +103,7 @@ namespace QuickMedia { void image_continuous_page(MangaImagesPage *images_page); void image_board_thread_page(ImageBoardThreadPage *thread_page, Body *thread_body); void chat_login_page(); - void chat_page(MatrixChatPage *matrix_chat_page, RoomData *current_room); + bool chat_page(MatrixChatPage *matrix_chat_page, RoomData *current_room, std::vector &room_tabs, int room_selected_tab, TabAssociatedData &room_tab_associated_data); void after_matrix_login_page(); enum class LoadImageResult { @@ -144,6 +170,12 @@ namespace QuickMedia { bool fit_image_to_window = false; RoomData *current_chat_room = nullptr; bool go_to_previous_page = false; + sf::RoundedRectangleShape tab_background; + sf::RectangleShape tab_shade; + sf::Text tab_text; + sf::Vertex gradient_points[4]; + sf::Vector2f body_pos; + sf::Vector2f body_size; std::thread::id main_thread_id; }; } \ No newline at end of file -- cgit v1.2.3