mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added more options for sorting pages
This commit is contained in:
parent
7b271a1c03
commit
d151ccf9e4
@ -15,9 +15,14 @@
|
|||||||
|
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
|
||||||
|
enum YACReaderPageSortingMode
|
||||||
|
{
|
||||||
|
YACReaderNumericalSorting,
|
||||||
|
YACReaderHeuristicSorting,
|
||||||
|
YACReaderAlphabeticalSorting
|
||||||
|
};
|
||||||
|
|
||||||
|
void comic_pages_sort(QList<QString> & pageNames, YACReaderPageSortingMode sortingMode);
|
||||||
void comic_pages_sort(QList<QString> & pageNames, bool fixDoublePagesSorting);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -518,8 +523,8 @@ void FileComic::process()
|
|||||||
|
|
||||||
_cfi=0;
|
_cfi=0;
|
||||||
|
|
||||||
//TODO, add a setting for fixing bad named double page files, so the user can have control over it.
|
//TODO, add a setting for choosing the type of page sorting used.
|
||||||
comic_pages_sort(_fileNames, true);
|
comic_pages_sort(_fileNames, YACReaderHeuristicSorting);
|
||||||
|
|
||||||
if(_firstPage == -1)
|
if(_firstPage == -1)
|
||||||
_firstPage = bm->getLastPage();
|
_firstPage = bm->getLastPage();
|
||||||
@ -967,12 +972,18 @@ QList<QString> merge_pages(QList<QString> & singlePageNames, QList<QString> & do
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void comic_pages_sort(QList<QString> & pageNames, bool fixDoublePagesSorting)
|
void comic_pages_sort(QList<QString> & pageNames, YACReaderPageSortingMode sortingMode)
|
||||||
{
|
{
|
||||||
|
switch(sortingMode)
|
||||||
|
{
|
||||||
|
case YACReaderNumericalSorting:
|
||||||
|
std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case YACReaderHeuristicSorting:
|
||||||
|
{
|
||||||
std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI);
|
std::sort(pageNames.begin(), pageNames.end(), naturalSortLessThanCI);
|
||||||
|
|
||||||
if(fixDoublePagesSorting)
|
|
||||||
{
|
|
||||||
QList<QString> singlePageNames;
|
QList<QString> singlePageNames;
|
||||||
QList<QString> doublePageNames;
|
QList<QString> doublePageNames;
|
||||||
|
|
||||||
@ -982,6 +993,13 @@ void comic_pages_sort(QList<QString> & pageNames, bool fixDoublePagesSorting)
|
|||||||
{
|
{
|
||||||
pageNames = merge_pages(singlePageNames, doublePageNames);
|
pageNames = merge_pages(singlePageNames, doublePageNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case YACReaderAlphabeticalSorting:
|
||||||
|
std::sort(pageNames.begin(), pageNames.end());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user