aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp1
-rw-r--r--include/QuickMedia.hpp34
2 files changed, 34 insertions, 1 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 676eef8..ee83dae 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -252,6 +252,7 @@ namespace QuickMedia {
BodyItemRenderCallback body_item_render_callback;
sf::Shader *thumbnail_mask_shader;
AttachSide attach_side = AttachSide::TOP;
+ bool render_selection = true;
private:
void draw_item(sf::RenderWindow &window, BodyItem *item, const sf::Vector2f &pos, const sf::Vector2f &size, const float item_height, const int item_index, const Json::Value &content_progress, bool include_embedded_item = true);
void update_dirty_state(BodyItem *body_item, float width);
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