From 8c5253f85d5f0071cf1969c417046f5fbb3d2edf Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 22 Jun 2021 07:05:48 +0200 Subject: Create manga progress directory --- src/QuickMedia.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index e2d1d8c..e9aa7e9 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1760,25 +1760,31 @@ namespace QuickMedia { window.setKeyRepeatEnabled(false); downloading_chapter_url.clear(); - while(window.isOpen() && (current_page == PageType::IMAGES || current_page == PageType::IMAGES_CONTINUOUS)) { - if(current_page == PageType::IMAGES) { - while(current_page == PageType::IMAGES) { - int page_navigation = image_page(manga_images_page, chapters_body); - if(page_navigation == -1) { - // TODO: Make this work if the list is sorted differently than from newest to oldest. - chapters_body->select_next_item(); - select_episode(chapters_body->get_selected(), true); - image_index = 99999; // Start at the page that shows we are at the end of the chapter - manga_images_page->change_chapter(chapters_body->get_selected()->get_title(), chapters_body->get_selected()->url); - } else if(page_navigation == 1) { - // TODO: Make this work if the list is sorted differently than from newest to oldest. - chapters_body->select_previous_item(); - select_episode(chapters_body->get_selected(), true); - manga_images_page->change_chapter(chapters_body->get_selected()->get_title(), chapters_body->get_selected()->url); + Path manga_progress_dir = get_storage_dir().join(manga_images_page->get_service_name()).join(manga_id_base64); + if(create_directory_recursive(manga_progress_dir) != 0) { + show_notification("QuickMedia", "Failed to create directory: " + manga_progress_dir.data, Urgency::CRITICAL); + current_page = pop_page_stack(); + } else { + while(window.isOpen() && (current_page == PageType::IMAGES || current_page == PageType::IMAGES_CONTINUOUS)) { + if(current_page == PageType::IMAGES) { + while(current_page == PageType::IMAGES) { + int page_navigation = image_page(manga_images_page, chapters_body); + if(page_navigation == -1) { + // TODO: Make this work if the list is sorted differently than from newest to oldest. + chapters_body->select_next_item(); + select_episode(chapters_body->get_selected(), true); + image_index = 99999; // Start at the page that shows we are at the end of the chapter + manga_images_page->change_chapter(chapters_body->get_selected()->get_title(), chapters_body->get_selected()->url); + } else if(page_navigation == 1) { + // TODO: Make this work if the list is sorted differently than from newest to oldest. + chapters_body->select_previous_item(); + select_episode(chapters_body->get_selected(), true); + manga_images_page->change_chapter(chapters_body->get_selected()->get_title(), chapters_body->get_selected()->url); + } } + } else if(current_page == PageType::IMAGES_CONTINUOUS) { + image_continuous_page(manga_images_page); } - } else if(current_page == PageType::IMAGES_CONTINUOUS) { - image_continuous_page(manga_images_page); } } -- cgit v1.2.3