Ignore case when sorting file names.

This commit is contained in:
LoRd_MuldeR 2013-08-23 19:16:40 +02:00
parent 11268cd5b1
commit 8f77ee3b5f
4 changed files with 13 additions and 5 deletions

View File

@ -34,7 +34,7 @@
#define VER_LAMEXP_MINOR_LO 8
#define VER_LAMEXP_TYPE RC
#define VER_LAMEXP_PATCH 2
#define VER_LAMEXP_BUILD 1332
#define VER_LAMEXP_BUILD 1333
#define VER_LAMEXP_CONFG 1288
///////////////////////////////////////////////////////////////////////////////

View File

@ -2436,12 +2436,20 @@ static bool lamexp_natural_string_sort_helper(const QString &str1, const QString
return (strnatcmp(QWCHAR(str1), QWCHAR(str2)) < 0);
}
/*
* Natural Order String Comparison - the 'lessThan' helper function *with* case folding
*/
static bool lamexp_natural_string_sort_helper_fold_case(const QString &str1, const QString &str2)
{
return (strnatcasecmp(QWCHAR(str1), QWCHAR(str2)) < 0);
}
/*
* Natural Order String Comparison - the main sorting function
*/
void lamexp_natural_string_sort(QStringList &list)
void lamexp_natural_string_sort(QStringList &list, const bool bIgnoreCase)
{
qSort(list.begin(), list.end(), lamexp_natural_string_sort_helper);
qSort(list.begin(), list.end(), bIgnoreCase ? lamexp_natural_string_sort_helper_fold_case : lamexp_natural_string_sort_helper);
}
/*

View File

@ -162,7 +162,7 @@ const QString lamexp_clean_filepath(const QString &str);
void lamexp_seed_rand(void);
unsigned int lamexp_rand(void);
QDate lamexp_current_date_safe(void);
void lamexp_natural_string_sort(QStringList &list);
void lamexp_natural_string_sort(QStringList &list, const bool bIgnoreCase);
void lamexp_fatal_exit(const wchar_t* exitMessage, const wchar_t* errorBoxMessage = NULL);
//Debug-only functions

View File

@ -119,7 +119,7 @@ void FileAnalyzer::run()
emit progressMaxChanged(nFiles);
emit progressValChanged(0);
lamexp_natural_string_sort(m_inputFiles); //.sort();
lamexp_natural_string_sort(m_inputFiles, true); //.sort();
if(!m_templateFile)
{