mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added natural sorting to ip sorting in server config dialog, the heuristic should be fine now
This commit is contained in:
parent
1fe860e401
commit
d798c62fa3
@ -13,12 +13,16 @@
|
|||||||
#include "startup.h"
|
#include "startup.h"
|
||||||
#include "yacreader_global.h"
|
#include "yacreader_global.h"
|
||||||
|
|
||||||
|
#include "qnaturalsorting.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
//192.168 (most comon local subnet for ips are always put first)
|
||||||
|
//IPs are sorted using natoral sorting
|
||||||
bool ipComparator(const QString & ip1, const QString & ip2)
|
bool ipComparator(const QString & ip1, const QString & ip2)
|
||||||
{
|
{
|
||||||
if(ip1.startsWith("192.168") && ip2.startsWith("192.168"))
|
if(ip1.startsWith("192.168") && ip2.startsWith("192.168"))
|
||||||
return ip1 < ip2;
|
return naturalSortLessThanCI(ip1, ip2);
|
||||||
|
|
||||||
if(ip1.startsWith("192.168"))
|
if(ip1.startsWith("192.168"))
|
||||||
return true;
|
return true;
|
||||||
@ -26,7 +30,7 @@ bool ipComparator(const QString & ip1, const QString & ip2)
|
|||||||
if(ip2.startsWith("192.168"))
|
if(ip2.startsWith("192.168"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ip1 < ip2;
|
return naturalSortLessThanCI(ip1, ip2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_WIN32
|
#ifndef Q_OS_WIN32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user