Implemented "natural ordering" for sorting the input files. Code is based on the strnatcmp() by Martin Pool, released under the "zlib" license.

This commit is contained in:
LoRd_MuldeR 2013-08-23 00:19:00 +02:00
parent 19a52ef3ac
commit 409117ec39
13 changed files with 446 additions and 17 deletions

View File

@ -78,7 +78,7 @@
</CustomBuildStep> </CustomBuildStep>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\include;$(SolutionDir)\etc\Prerequisites\keccak\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\include;$(SolutionDir)\etc\Prerequisites\keccak\include;$(SolutionDir)\etc\Prerequisites\strnatcmp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;_DEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;_DEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -127,7 +127,7 @@ copy /Y "$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\bin\Win32\*.manifes
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\include;$(SolutionDir)\etc\Prerequisites\keccak\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\include;$(SolutionDir)\etc\Prerequisites\keccak\include;$(SolutionDir)\etc\Prerequisites\strnatcmp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;NDEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;NDEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>
@ -200,7 +200,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\include;$(SolutionDir)\etc\Prerequisites\keccak\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\include;$(SolutionDir)\etc\Prerequisites\keccak\include;$(SolutionDir)\etc\Prerequisites\strnatcmp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;NDEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_NO_DEBUG;QT_NODLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;NDEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_NO_DEBUG;QT_NODLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>
@ -265,6 +265,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<TreatWChar_tAsBuiltInType Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">false</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">false</TreatWChar_tAsBuiltInType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="etc\Prerequisites\strnatcmp\src\strnatcmp.cpp" />
<ClCompile Include="src\Decoder_AAC.cpp" /> <ClCompile Include="src\Decoder_AAC.cpp" />
<ClCompile Include="src\Decoder_Abstract.cpp" /> <ClCompile Include="src\Decoder_Abstract.cpp" />
<ClCompile Include="src\Decoder_AC3.cpp" /> <ClCompile Include="src\Decoder_AC3.cpp" />

View File

@ -379,6 +379,9 @@
<ClCompile Include="etc\Prerequisites\qtmain\qtmain_win.cpp"> <ClCompile Include="etc\Prerequisites\qtmain\qtmain_win.cpp">
<Filter>Source Files\Misc\3rd Party</Filter> <Filter>Source Files\Misc\3rd Party</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="etc\Prerequisites\strnatcmp\src\strnatcmp.cpp">
<Filter>Source Files\Misc\3rd Party</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\Config.h"> <ClInclude Include="src\Config.h">

View File

@ -30,6 +30,7 @@ a:visited { color: #0000EE; }
<li>Fixed a superfluous "beep" sound that appeared on application startup <li>Fixed a superfluous "beep" sound that appeared on application startup
<li>Fixed the Ogg Vorbis quality modes "-1" and "-2" (those were clipped to "0" before) <li>Fixed the Ogg Vorbis quality modes "-1" and "-2" (those were clipped to "0" before)
<li>Fixed a bug that could cause the output directory to be reset mistakenly <li>Fixed a bug that could cause the output directory to be reset mistakenly
<li>Implemented "natural ordering" for sorting input files, using strnatcmp() by Martin Pool
</ul><br> </ul><br>
<a name="4.07"></a>Changes between v4.06 and v4.07 [2013-04-28]:<br><ul> <a name="4.07"></a>Changes between v4.06 and v4.07 [2013-04-28]:<br><ul>

View File

@ -0,0 +1,31 @@
/* -*- mode: c; c-file-style: "k&r" -*-
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
Copyright (C) 2000, 2004 by Martin Pool <mbp sourcefrog net>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/* CUSTOMIZATION SECTION
*
* You can change this typedef, but must then also change the inline
* functions in strnatcmp.c */
typedef wchar_t nat_char;
int strnatcmp(nat_char const *a, nat_char const *b);
int strnatcasecmp(nat_char const *a, nat_char const *b);

View File

@ -0,0 +1,196 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>Natural Order String Comparison</title>
</head>
<body>
<h1>Natural Order String Comparison</h1>
<p>by <a href="http://sourcefrog.net/">Martin Pool</a>
</p><p>Computer string sorting algorithms generally don't order strings
containing numbers in the same way that a human would do. Consider:
</p><blockquote><pre>rfc1.txt
rfc2086.txt
rfc822.txt
</pre></blockquote>
<p>It would be more friendly if the program listed the files as
</p><blockquote><pre>rfc1.txt
rfc822.txt
rfc2086.txt
</pre></blockquote>
<p>Filenames sort properly if people insert leading zeros, but they
don't always do that.
</p><p>I've written a subroutine that compares strings according to this
natural ordering. You can use this routine in your own software, or
download a patch to add it to your favourite Unix program.
</p><h2>Sorting</h2>
<p>Strings are sorted as usual, except that decimal integer substrings
are compared on their numeric value. For example,
</p><blockquote>
a &lt; a0 &lt; a1 &lt; a1a &lt; a1b &lt; a2 &lt; a10 &lt; a20
</blockquote>
<p>Strings can contain several number parts:
</p><blockquote>
x2-g8 &lt; x2-y7 &lt; x2-y08 &lt; x8-y8
</blockquote>
in which case numeric fields are separated by nonnumeric characters.
Leading spaces are ignored. This works very well for IP addresses
from log files, for example.
<p>
Leading zeros are <u>not</u> ignored, which tends to give more
reasonable results on decimal fractions.
</p>
<blockquote>
1.001 &lt; 1.002 &lt; 1.010 &lt; 1.02 &lt; 1.1 &lt; 1.3
</blockquote>
<p>Some applications may wish to change this by modifying the test
that calls <code>isspace</code>.
</p><p>
Performance is linear: each character of the string is scanned
at most once, and only as many characters as necessary to decide
are considered.
</p>
<p><a href="http://sourcefrog.net/projects/natsort/example-out.txt">Longer example of the results</a>
</p><h2>Licensing</h2>
<p>This software is copyright by Martin Pool, and made available under
the same licence as zlib:
</p><blockquote>
<p> This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
</p><p> Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
</p><p> 1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
</p><p> 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
</p><p> 3. This notice may not be removed or altered from any source distribution.
</p></blockquote>
<p>This licence applies only to the C implementation. You are free to
reimplement the idea fom scratch in any language.
</p><h2>Related Work</h2>
<p>
POSIX sort(1) has the -n option to sort numbers, but this doesn't
work if there is a non-numeric prefix.
</p>
<p>
GNU ls(1) has the <tt>--sort=version</tt> option, which works
the same way.
</p>
<p>
The PHP scripting language now has a
<a href="http://us3.php.net/manual/en/function.strnatcmp.php">strnatcmp</a>
function based on this code.
The PHP wrapper was done by Andrei Zimievsky.
</p>
<p>
<a href="http://www.naturalordersort.org/">Stuart
Cheshire</a> has a Macintosh <q>system extension</q> to do natural ordering.
I indepdendently reinvented the algorithm, but Stuart had it
first. I borrowed the term <q>natural sort</q> from him.
</p>
<p>
<a href="http://search.cpan.org/src/EDAVIS/Sort-Versions-1.4/README"><tt>Sort::Versions</tt></a>
in Perl. "The code has some special magic to deal with common
conventions in program version numbers, like the difference between
'decimal' versions (eg perl 5.005) and the Unix kind (eg perl 5.6.1)."
</p><p><a href="http://www.cpan.org/modules/by-module/Sort/Sort-Naturally-1.01.readme"><tt>Sort::Naturally</tt></a>
is also in Perl, by Sean M. Burke. It uses locale-sensitive character classes to sort words and numeric substrings
in a way similar to natsort.
</p><p>
Ed Avis wrote <a href="http://membled.com/work/apps/todo/numsort">something similar in Haskell</a>.
</p><p>
Pierre-Luc Paour wrote a <a href="http://pierre-luc.paour.9online.fr/NaturalOrderComparator.java"><tt>NaturalOrderComparator</tt>
in Java</a>
</p><p>Kristof Coomans wrote a <a href="http://sourcefrog.net/projects/natsort/natcompare.js">natural sort comparison in Javascript</a></p>
<p>Alan Davies wrote
<a href="http://sourcefrog.net/projects/natsort/natcmp.rb"><tt>natcmp.rb</tt></a>,
an implementation in <a href="http://www.ruby-lang.org/">Ruby</a>.
</p><p><a href="http://sourceforge.net/projects/numacomp">Numacomp</a>
- similar thing in Python.
</p><p><a href="http://code.google.com/p/as3natcompare/">as3natcompare</a>
implementation in Flash ActionScript 3.
</p><h2>Get It!</h2>
<ul>
<li><a href="http://sourcefrog.net/projects/natsort/strnatcmp.c">strnatcmp.c</a>,
<a href="http://sourcefrog.net/projects/natsort/strnatcmp.h">strnatcmp.h</a> - the algorithm itself
</li><li><a href="http://sourcefrog.net/projects/natsort/natsort.c">natsort.c</a> - example driver program.
(Try <tt>ls -F /proc | natsort</tt>)
</li><li><a href="http://sourcefrog.net/projects/natsort/textutils.diff">textutils.diff</a> - patch to add
natural sort to sort(1) from GNU textutils-2.0; use the new
<tt>-N</tt> option.</li>
<li>Natural ordering is now in PHP4rc2, through the <a href="http://php.net/manual/html/function.strnatcasecmp.html">strnatcasecmp</a>
and <a href="http://php.net/manual/html/function.strnatcmp.html">strnatcmp</a>
functions.</li>
</ul>
<h2>To Do</h2>
<p>
Comparison of characters is purely numeric, without taking
character set or locale into account. So it is only correct for
ASCII. This should probably be a separate function because doing
the comparisons will probably introduce a dependency on the OS
mechanism for finding the locale and comparing characters.
</p><p>
It might be good to support multibyte character sets too.
</p><p>
If you fix either of these, please mail me. They should not be
very hard.
</p></body></html>

View File

@ -0,0 +1,177 @@
/* -*- mode: c; c-file-style: "k&r" -*-
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
Copyright (C) 2000, 2004 by Martin Pool <mbp sourcefrog net>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/* partial change history:
*
* 2004-10-10 mbp: Lift out character type dependencies into macros.
*
* Eric Sosman pointed out that ctype functions take a parameter whose
* value must be that of an unsigned int, even on platforms that have
* negative chars in their default char type.
*/
#include <ctype.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include "strnatcmp.h"
/* These are defined as macros to make it easier to adapt this code to
* different characters types or comparison functions. */
static inline int
nat_isdigit(nat_char a)
{
return iswdigit(a);
}
static inline int
nat_isspace(nat_char a)
{
return iswspace(a);
}
static inline nat_char
nat_toupper(nat_char a)
{
return towupper(a);
}
static int
compare_right(nat_char const *a, nat_char const *b)
{
int bias = 0;
/* The longest run of digits wins. That aside, the greatest
value wins, but we can't know that it will until we've scanned
both numbers to know that they have the same magnitude, so we
remember it in BIAS. */
for (;; a++, b++) {
if (!nat_isdigit(*a) && !nat_isdigit(*b))
return bias;
else if (!nat_isdigit(*a))
return -1;
else if (!nat_isdigit(*b))
return +1;
else if (*a < *b) {
if (!bias)
bias = -1;
} else if (*a > *b) {
if (!bias)
bias = +1;
} else if (!*a && !*b)
return bias;
}
return 0;
}
static int
compare_left(nat_char const *a, nat_char const *b)
{
/* Compare two left-aligned numbers: the first to have a
different value wins. */
for (;; a++, b++) {
if (!nat_isdigit(*a) && !nat_isdigit(*b))
return 0;
else if (!nat_isdigit(*a))
return -1;
else if (!nat_isdigit(*b))
return +1;
else if (*a < *b)
return -1;
else if (*a > *b)
return +1;
}
return 0;
}
static int strnatcmp0(nat_char const *a, nat_char const *b, int fold_case)
{
int ai, bi;
nat_char ca, cb;
int fractional, result;
assert(a && b);
ai = bi = 0;
while (1) {
ca = a[ai]; cb = b[bi];
/* skip over leading spaces or zeros */
while (nat_isspace(ca))
ca = a[++ai];
while (nat_isspace(cb))
cb = b[++bi];
/* process run of digits */
if (nat_isdigit(ca) && nat_isdigit(cb)) {
fractional = (ca == '0' || cb == '0');
if (fractional) {
if ((result = compare_left(a+ai, b+bi)) != 0)
return result;
} else {
if ((result = compare_right(a+ai, b+bi)) != 0)
return result;
}
}
if (!ca && !cb) {
/* The strings compare the same. Perhaps the caller
will want to call strcmp to break the tie. */
return 0;
}
if (fold_case) {
ca = nat_toupper(ca);
cb = nat_toupper(cb);
}
if (ca < cb)
return -1;
else if (ca > cb)
return +1;
++ai; ++bi;
}
}
int strnatcmp(nat_char const *a, nat_char const *b) {
return strnatcmp0(a, b, 0);
}
/* Compare, recognizing numeric string and ignoring case. */
int strnatcasecmp(nat_char const *a, nat_char const *b) {
return strnatcmp0(a, b, 1);
}

View File

@ -3312,23 +3312,23 @@
<context> <context>
<name>QApplication</name> <name>QApplication</name>
<message> <message>
<location filename="../../src/Global.cpp" line="890"/> <location filename="../../src/Global.cpp" line="891"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source> <source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Global.cpp" line="1144"/> <location filename="../../src/Global.cpp" line="1145"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source> <source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Global.cpp" line="1149"/> <location filename="../../src/Global.cpp" line="1150"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source> <source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Global.cpp" line="1162"/> <location filename="../../src/Global.cpp" line="1163"/>
<location filename="../../src/Global.cpp" line="1189"/> <location filename="../../src/Global.cpp" line="1190"/>
<source>Executable &apos;%1&apos; requires Windows 2000 or later.</source> <source>Executable &apos;%1&apos; requires Windows 2000 or later.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -3349,23 +3349,23 @@
<context> <context>
<name>QApplication</name> <name>QApplication</name>
<message> <message>
<location filename="../../src/Global.cpp" line="890"/> <location filename="../../src/Global.cpp" line="891"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source> <source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; nie działa w trybie kompatybilności z Windows.</translation> <translation type="unfinished">Plik wykonywalny &apos;%1&apos; nie działa w trybie kompatybilności z Windows.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global.cpp" line="1144"/> <location filename="../../src/Global.cpp" line="1145"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source> <source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga Qt v%2, znaleziono jednak Qt v%3.</translation> <translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global.cpp" line="1149"/> <location filename="../../src/Global.cpp" line="1150"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source> <source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished">Plik wykonywalny &quot;%1&quot; został skompilowany dla Qt &quot;%2&quot;, znaleziono &quot;%3&quot;.</translation> <translation type="unfinished">Plik wykonywalny &quot;%1&quot; został skompilowany dla Qt &quot;%2&quot;, znaleziono &quot;%3&quot;.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global.cpp" line="1162"/> <location filename="../../src/Global.cpp" line="1163"/>
<location filename="../../src/Global.cpp" line="1189"/> <location filename="../../src/Global.cpp" line="1190"/>
<source>Executable &apos;%1&apos; requires Windows 2000 or later.</source> <source>Executable &apos;%1&apos; requires Windows 2000 or later.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga do uruchomienia Windows 2000 lub nowszego.</translation> <translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga do uruchomienia Windows 2000 lub nowszego.</translation>
</message> </message>

View File

@ -33,8 +33,8 @@
#define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 8 #define VER_LAMEXP_MINOR_LO 8
#define VER_LAMEXP_TYPE RC #define VER_LAMEXP_TYPE RC
#define VER_LAMEXP_PATCH 1 #define VER_LAMEXP_PATCH 2
#define VER_LAMEXP_BUILD 1328 #define VER_LAMEXP_BUILD 1329
#define VER_LAMEXP_CONFG 1288 #define VER_LAMEXP_CONFG 1288
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -54,6 +54,7 @@
#include "Resource.h" #include "Resource.h"
#include "Config.h" #include "Config.h"
#include "LockedFile.h" #include "LockedFile.h"
#include "strnatcmp.h"
//CRT includes //CRT includes
#include <iostream> #include <iostream>
@ -2426,6 +2427,23 @@ QDate lamexp_current_date_safe(void)
return (currentDate >= processDate) ? currentDate : processDate; return (currentDate >= processDate) ? currentDate : processDate;
} }
/*
* Natural Order String Comparison - the 'lessThan' helper function
*/
static bool lamexp_natural_string_sort_helper(const QString &str1, const QString &str2)
{
return (strnatcmp(QWCHAR(str1), QWCHAR(str2)) < 0);
}
/*
* Natural Order String Comparison - the main sorting function
*/
void lamexp_natural_string_sort(QStringList &list)
{
qSort(list.begin(), list.end(), lamexp_natural_string_sort_helper);
}
/* /*
* Entry point checks * Entry point checks
*/ */

View File

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

View File

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

View File

@ -136,7 +136,8 @@ void FileAnalyzer_ST::run()
m_filesDummyCDDA = 0; m_filesDummyCDDA = 0;
m_filesCueSheet = 0; m_filesCueSheet = 0;
m_inputFiles.sort(); lamexp_natural_string_sort(m_inputFiles); // .sort()
m_recentlyAdded.clear(); m_recentlyAdded.clear();
m_abortFlag = false; m_abortFlag = false;