From ab36fbffef977b99cc03d0b77ac37bdc1b5705dc Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 14 Apr 2021 19:52:21 +0200 Subject: Rework manga plugins downloading.. preparing for parallel downloads --- src/ImageViewer.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/ImageViewer.cpp') diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp index 85db360..271d69f 100644 --- a/src/ImageViewer.cpp +++ b/src/ImageViewer.cpp @@ -3,7 +3,6 @@ #include "../include/Storage.hpp" #include "../include/SfmlFixes.hpp" #include "../include/ResourceLoader.hpp" -#include "../plugins/Manga.hpp" #include #include #include @@ -11,10 +10,10 @@ #include namespace QuickMedia { - ImageViewer::ImageViewer(sf::RenderWindow *window, MangaImagesPage *manga_images_page, const std::string &content_title, const std::string &chapter_title, int current_page, const Path &chapter_cache_dir) : + ImageViewer::ImageViewer(sf::RenderWindow *window, int num_pages, const std::string &content_title, const std::string &chapter_title, int current_page, const Path &chapter_cache_dir) : window(window), current_page(current_page), - num_pages(0), + num_pages(num_pages), content_title(content_title), chapter_title(chapter_title), chapter_cache_dir(chapter_cache_dir), @@ -22,10 +21,6 @@ namespace QuickMedia { font(FontLoader::get_font(FontLoader::FontType::LATIN)), page_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), 14) { - if(manga_images_page->get_number_of_images(num_pages) != ImageResult::OK) { - show_notification("QuickMedia", "Failed to get number of images", Urgency::CRITICAL); - return; - } current_page = std::min(current_page, num_pages); image_data.resize(num_pages); page_size.resize(num_pages); @@ -148,6 +143,7 @@ namespace QuickMedia { Path image_path = chapter_cache_dir; image_path.join(page_str); + // TODO: Add delay before checking again? if(get_file_type(image_path) == FileType::REGULAR) { fprintf(stderr, "ImageViewer: Loaded page %d\n", 1 + page); -- cgit v1.2.3