aboutsummaryrefslogtreecommitdiff
path: root/src/ImageViewer.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-04-14 19:52:21 +0200
committerdec05eba <dec05eba@protonmail.com>2021-04-14 23:45:11 +0200
commitab36fbffef977b99cc03d0b77ac37bdc1b5705dc (patch)
tree17207a364eecee330a26ac117a1384ad0b4a1e97 /src/ImageViewer.cpp
parent4db0876f45533d3b55ee79df2d2bc78b789b5a28 (diff)
Rework manga plugins downloading.. preparing for parallel downloads
Diffstat (limited to 'src/ImageViewer.cpp')
-rw-r--r--src/ImageViewer.cpp10
1 files changed, 3 insertions, 7 deletions
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 <cmath>
#include <malloc.h>
#include <SFML/Window/Event.hpp>
@@ -11,10 +10,10 @@
#include <SFML/Graphics/RectangleShape.hpp>
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);