[atlantik-cvs] CVS: kdegames/atlantik/client monopigator.cpp,1.13,1.14 monopigator.h,1.12,1.13 selectserver_widget.cpp,1.29,1.30
[email protected] Sun, 13 Jul 2003 00:58:48 +0200 (CEST)
Newsgroups
gmane.comp.kde.devel.atlantik
Message-ID
<[email protected] >
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv11496/client
Modified Files:
monopigator.cpp monopigator.h selectserver_widget.cpp
Log Message:
fix #61152: sort by user doesn't work in the right way
Index: monopigator.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/monopigator.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- monopigator.cpp 2 Jun 2003 18:38:26 -0000 1.13
+++ monopigator.cpp 12 Jul 2003 22:58:46 -0000 1.14
@@ -102,3 +102,22 @@
}
}
}
+
+MonopigatorEntry::MonopigatorEntry(QListView *parent, QString host, QString version, QString users, QString port) : QListViewItem(parent, host, version, users, port)
+{
+}
+
+int MonopigatorEntry::compare(QListViewItem *i, int col, bool ascending) const
+{
+ if (col == 2)
+ {
+ int myVal = text(col).toInt(), iVal = i->text(col).toInt();
+ if (myVal == iVal)
+ return 0;
+ else if (myVal > iVal)
+ return 1;
+ else
+ return -1;
+ }
+ return key( col, ascending ).compare( i->key( col, ascending) );
+}
Index: monopigator.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/monopigator.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- monopigator.h 2 Jun 2003 18:38:26 -0000 1.12
+++ monopigator.h 12 Jul 2003 22:58:46 -0000 1.13
@@ -19,6 +19,7 @@
#include <qobject.h>
#include <qbuffer.h>
+#include <qlistview.h>
#include <qtimer.h>
#include <kio/job.h>
@@ -49,6 +50,13 @@
QBuffer *m_downloadData;
QTimer *m_timer;
KIO::Job *m_job;
+};
+
+class MonopigatorEntry : public QListViewItem
+{
+public:
+ MonopigatorEntry(QListView *parent, QString host, QString version, QString users, QString port);
+ int compare(QListViewItem *i, int col, bool ascending) const;
};
#endif
Index: selectserver_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectserver_widget.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- selectserver_widget.cpp 29 Jun 2003 03:54:10 -0000 1.29
+++ selectserver_widget.cpp 12 Jul 2003 22:58:46 -0000 1.30
@@ -124,7 +124,7 @@
if (m_hideDevelopmentServers && version.contains("CVS"))
return;
- QListViewItem *item = new QListViewItem(m_serverList, host, version, (users == -1) ? i18n("unknown") : QString::number(users), port);
+ MonopigatorEntry *item = new MonopigatorEntry(m_serverList, host, version, (users == -1) ? i18n("unknown") : QString::number(users), port);
item->setPixmap(0, BarIcon("atlantik", KIcon::SizeSmall));
validateConnectButton();
}
@@ -133,9 +133,8 @@
{
m_localServerAvailable = true;
- QListViewItem *item = new QListViewItem(m_serverList, m_localSocket->host(), i18n("unknown"), i18n("unknown"), m_localSocket->port());
+ MonopigatorEntry *item = new MonopigatorEntry(m_serverList, m_localSocket->host(), i18n("unknown"), i18n("unknown"), m_localSocket->port());
item->setPixmap(0, BarIcon("atlantik", KIcon::SizeSmall));
-
validateConnectButton();
}