aboutsummaryrefslogtreecommitdiff
path: root/include/QuickMedia.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/QuickMedia.hpp')
-rw-r--r--include/QuickMedia.hpp34
1 files changed, 33 insertions, 1 deletions
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 <future>
#include <thread>
#include <stack>
+#include "../plugins/Plugin.hpp"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@@ -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<FetchResult> fetch_future;
+ std::future<BodyItems> 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<Tab> &tabs, int selected_tab, TabAssociatedData &tab_associated_data, const Json::Value *json_chapters);
void page_loop(std::vector<Tab> &tabs, int start_tab_index = 0, std::function<void()> 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<Tab> &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