aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/LocalManga.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/LocalManga.cpp')
-rw-r--r--src/plugins/LocalManga.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/LocalManga.cpp b/src/plugins/LocalManga.cpp
index 06b5cf0..4deb229 100644
--- a/src/plugins/LocalManga.cpp
+++ b/src/plugins/LocalManga.cpp
@@ -33,7 +33,7 @@ namespace QuickMedia {
static std::vector<LocalMangaChapter> get_chapters_in_manga(const Path &directory) {
std::vector<LocalMangaChapter> chapter_list;
- for_files_in_dir_sort_last_modified(directory, [&chapter_list](const Path &filepath) -> bool {
+ auto callback = [&chapter_list](const Path &filepath) -> bool {
if(get_file_type(filepath) != FileType::DIRECTORY)
return true;
@@ -45,13 +45,19 @@ namespace QuickMedia {
chapter_list.push_back(std::move(local_manga_chapter));
return true;
- });
+ };
+
+ if(get_config().local_manga_sort_chapters_by_name)
+ for_files_in_dir_sort_name(directory, std::move(callback), FileSortDirection::DESC);
+ else
+ for_files_in_dir_sort_last_modified(directory, std::move(callback));
+
return chapter_list;
}
static std::vector<LocalManga> get_manga_in_directory(const Path &directory) {
std::vector<LocalManga> manga_list;
- for_files_in_dir_sort_last_modified(directory, [&manga_list](const Path &filepath) -> bool {
+ auto callback = [&manga_list](const Path &filepath) -> bool {
if(get_file_type(filepath) != FileType::DIRECTORY)
return true;
@@ -63,7 +69,13 @@ namespace QuickMedia {
manga_list.push_back(std::move(local_manga));
return true;
- });
+ };
+
+ if(get_config().local_manga_sort_by_name)
+ for_files_in_dir_sort_name(directory, std::move(callback), FileSortDirection::ASC);
+ else
+ for_files_in_dir_sort_last_modified(directory, std::move(callback));
+
return manga_list;
}