From 3ac82fad6bc883d979090e8cd56f3611703d6e14 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 1 Mar 2022 15:13:35 +0100 Subject: Make login a bit generalized, readd 4chan login (not tested) --- include/QuickMedia.hpp | 7 +++++++ include/Tab.hpp | 11 +++++++++++ 2 files changed, 18 insertions(+) (limited to 'include') diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index 6856f05..f93b47c 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -74,6 +74,11 @@ namespace QuickMedia { AsyncTask next_page_future; std::string body_item_url_before_refresh; }; + + struct LoginInput { + std::string placeholder; + SearchBarType type; + }; class Program { public: @@ -83,6 +88,7 @@ namespace QuickMedia { std::unique_ptr create_body(bool plain_text_list = false, bool prefer_card_view = false); std::unique_ptr create_search_bar(const std::string &placeholder, int search_delay); + void add_login_inputs(Tab *tab, std::vector login_inputs); bool load_manga_content_storage(const char *service_name, const std::string &manga_title, const std::string &manga_url, const std::string &manga_id); @@ -215,5 +221,6 @@ namespace QuickMedia { std::unique_ptr video_player; bool use_youtube_dl = false; int video_max_height = 0; + std::mutex login_inputs_mutex; }; } diff --git a/include/Tab.hpp b/include/Tab.hpp index ccb8c85..b277f88 100644 --- a/include/Tab.hpp +++ b/include/Tab.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include namespace QuickMedia { @@ -7,9 +8,19 @@ namespace QuickMedia { class Page; class SearchBar; + struct LoginInputs { + std::vector> inputs; + int focused_input = 0; + bool needs_refresh = false; + }; + struct Tab { + Tab(std::unique_ptr body, std::unique_ptr page, std::unique_ptr search_bar, LoginInputs login_inputs = {}) : + body(std::move(body)), page(std::move(page)), search_bar(std::move(search_bar)), login_inputs(std::move(login_inputs)) {} + std::unique_ptr body; std::unique_ptr page; // Only null when current page has |is_single_page()| set to true std::unique_ptr search_bar; // Nullable + LoginInputs login_inputs; }; } \ No newline at end of file -- cgit v1.2.3-70-g09d2