[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/extragear/kde3/network/ktorrent/plugins/infowidget
From: Joris Guisson <joris.guisson () gmail ! com>
Date: 2007-10-21 8:08:01
Message-ID: 1192954081.811739.6453.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 727609 by guisson:
Sort IP addresses by their actual value and not by their string representation
BUG: 150328
M +11 -6 peerview.cpp
M +1 -0 peerview.h
--- branches/extragear/kde3/network/ktorrent/plugins/infowidget/peerview.cpp #727608:727609
@@ -17,6 +17,9 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include <klocale.h>
#include <kglobal.h>
#include <kiconloader.h>
@@ -29,6 +32,7 @@
#include <interfaces/peerinterface.h>
#include <interfaces/functions.h>
#include <torrent/ipblocklist.h>
+#include <util/log.h>
#include "config.h"
#ifdef USE_SYSTEM_GEOIP
@@ -118,6 +122,10 @@
else*/
setText(0,s.ip_address);
+ struct in_addr addr = {0};
+ inet_aton(s.ip_address.ascii(),&addr);
+ ip = ntohl(addr.s_addr);
+
setText(2,s.client);
if (country_code)
@@ -178,12 +186,9 @@
const PeerInterface::Stats & os = op->getStats();
switch (col)
{
- case 0: return QString::compare(s.ip_address,os.ip_address);
- case 1:
- {
- int ret = QString::compare(m_country, pvi->m_country);
- return ret;
- }
+ case 0: return CompareVal(ip,pvi->ip); // use numeric representation to sort
+ //return QString::compare(s.ip_address,os.ip_address);
+ case 1: return QString::compare(m_country, pvi->m_country);
case 2: return QString::compare(s.client,os.client);
case 3: return CompareVal(s.download_rate,os.download_rate);
case 4: return CompareVal(s.upload_rate,os.upload_rate);
--- branches/extragear/kde3/network/ktorrent/plugins/infowidget/peerview.h #727608:727609
@@ -36,6 +36,7 @@
{
kt::PeerInterface* peer;
QString m_country;
+ bt::Uint32 ip;
// counter to keep track of how many PeerViewItem objects are in existence
static bt::Uint32 pvi_count;
public:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic