diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-22 07:05:48 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-22 07:05:48 +0200 |
commit | 8c5253f85d5f0071cf1969c417046f5fbb3d2edf (patch) | |
tree | 4e72411a33c34157d2630acf573587177719c645 /src | |
parent | 52ca136fa387f3b838cabf540f957ef916997d2b (diff) |
Create manga progress directory
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
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); } } |