diff options
Diffstat (limited to 'include/QuickMedia.hpp')
-rw-r--r-- | include/QuickMedia.hpp | 69 |
1 files changed, 30 insertions, 39 deletions
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index 016202c..0a0b509 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -4,6 +4,7 @@ #include "SearchBar.hpp" #include "Page.hpp" #include "Storage.hpp" +#include "Tab.hpp" #include <vector> #include <memory> #include <SFML/Graphics/Font.hpp> @@ -20,9 +21,10 @@ #include <X11/Xatom.h> namespace QuickMedia { - class Plugin; + class Matrix; class FileManager; - class Manga; + class MangaImagesPage; + class ImageBoardThreadPage; enum class ImageViewMode { SINGLE, @@ -40,24 +42,23 @@ namespace QuickMedia { ~Program(); int run(int argc, char **argv); - Plugin* get_current_plugin() { return current_plugin; } + bool is_tor_enabled(); + std::unique_ptr<Body> create_body(); + std::unique_ptr<SearchBar> create_search_bar(const std::string &placeholder, int search_delay); + + bool load_manga_content_storage(const char *service_name, const std::string &manga_title, const std::string &manga_id); + + void select_file(const std::string &filepath); private: - void base_event_handler(sf::Event &event, Page previous_page, bool handle_key_press = true, bool clear_on_escape = true, bool handle_searchbar = true); - void search_suggestion_page(); - void search_result_page(); - void video_content_page(); - void episode_list_page(); - void image_page(); - void image_continuous_page(); - void content_list_page(); - void content_details_page(); - void image_board_thread_list_page(); - void image_board_thread_page(); + 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(std::vector<Tab> tabs); + void video_content_page(Page *page, std::string video_url, std::string video_title); + // Returns -1 to go to previous chapter, 0 to stay on same chapter and 1 to go to next chapter + int image_page(MangaImagesPage *images_page, Body *chapters_body); + 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(); - void file_manager_page(); - - bool on_search_suggestion_submit_text(Body *input_body, Body *output_body); enum class LoadImageResult { OK, @@ -66,17 +67,18 @@ namespace QuickMedia { }; LoadImageResult load_image_by_index(int image_index, sf::Texture &image_texture, sf::String &error_message); - void download_chapter_images_if_needed(Manga *image_plugin); + void download_chapter_images_if_needed(MangaImagesPage *images_page); void select_episode(BodyItem *item, bool start_from_beginning); - // Returns Page::EXIT if empty - Page pop_page_stack(); + // Returns PageType::EXIT if empty + PageType pop_page_stack(); - void plugin_get_watch_history(Plugin *plugin, BodyItems &history_items); - Json::Value load_video_history_json(Plugin *plugin); - Json::Value load_recommended_json(Plugin *plugin); + void manga_get_watch_history(const char *plugin_name, BodyItems &history_items); + void youtube_get_watch_history(BodyItems &history_items); + Json::Value load_video_history_json(); + Json::Value load_recommended_json(); - void save_recommendations_from_related_videos(); + void save_recommendations_from_related_videos(const std::string &video_url, const std::string &video_title, const Body *related_media_body); private: enum class UpscaleImageAction { NO, @@ -86,25 +88,16 @@ namespace QuickMedia { Display *disp; sf::RenderWindow window; + Matrix *matrix = nullptr; int monitor_hz; sf::Vector2f window_size; std::unique_ptr<sf::Font> font; std::unique_ptr<sf::Font> bold_font; std::unique_ptr<sf::Font> cjk_font; - Body *body; - Plugin *current_plugin; + const char *plugin_name = nullptr; sf::Texture plugin_logo; - std::unique_ptr<SearchBar> search_bar; - Page current_page; - std::stack<Page> page_stack; - // TODO: Combine these - std::string images_url; - std::string content_title; - std::string content_episode; - std::string content_url; - std::string content_list_url; - std::string image_board_thread_list_url; - std::string chapter_title; + PageType current_page; + std::stack<PageType> page_stack; int image_index; Path content_storage_file; Path content_cache_dir; @@ -130,9 +123,7 @@ namespace QuickMedia { bool running = false; // TODO: Save this to config file when switching modes ImageViewMode image_view_mode = ImageViewMode::SINGLE; - Body *related_media_body; std::vector<std::string> selected_files; - FileManager *file_manager = nullptr; bool fit_image_to_window = false; }; }
\ No newline at end of file |