| 1035 | } |
| 1036 | |
| 1037 | QList<QString> merge_pages(QList<QString> &singlePageNames, QList<QString> &doublePageNames) |
| 1038 | { |
| 1039 | // NOTE: this implementation doesn't differ from std::merge using a custom comparator, but it can be easily tweaked if merging requeries an additional heuristic behaviour |
| 1040 | QList<QString> pageNames; |
| 1041 | |
| 1042 | int i = 0; |
| 1043 | int j = 0; |
| 1044 | |
| 1045 | while (i < singlePageNames.length() && j < doublePageNames.length()) { |
| 1046 | if (singlePageNames.at(i).compare(doublePageNames.at(j), Qt::CaseInsensitive) < 0) { |
| 1047 | pageNames.append(singlePageNames.at(i++)); |
| 1048 | } else { |
| 1049 | pageNames.append(doublePageNames.at(j++)); |
| 1050 | } |
| 1051 | } |
| 1052 | |
| 1053 | while (i < singlePageNames.length()) { |
| 1054 | pageNames.append(singlePageNames.at(i++)); |
| 1055 | } |
| 1056 | |
| 1057 | while (j < doublePageNames.length()) { |
| 1058 | pageNames.append(doublePageNames.at(j++)); |
| 1059 | } |
| 1060 | |
| 1061 | return pageNames; |
| 1062 | } |
| 1063 | |
| 1064 | void comic_pages_sort(QList<QString> &pageNames, YACReaderPageSortingMode sortingMode) |
| 1065 | { |