QTfrontend/model/playerslistmodel.cpp
changeset 7744 75e1d0c0ba72
parent 7737 ff63da8a3202
child 7764 28613382e3f3
--- a/QTfrontend/model/playerslistmodel.cpp	Wed Oct 10 23:58:23 2012 +0400
+++ b/QTfrontend/model/playerslistmodel.cpp	Thu Oct 11 21:17:56 2012 +0400
@@ -91,7 +91,6 @@
     QModelIndex mi = index(rowCount() - 1);
     setData(mi, nickname);
 
-    updateSortData(mi);
     checkFriendIgnore(mi);
 }
 
@@ -268,11 +267,17 @@
 
 void PlayersListModel::updateSortData(const QModelIndex & index)
 {
-    QString result = QString("%1%2%3%4%5")
+    QString result = QString("%1%2%3%4%5%6")
+            // room admins go first, then server admins, then friends
             .arg(1 - index.data(RoomAdmin).toInt())
             .arg(1 - index.data(ServerAdmin).toInt())
             .arg(1 - index.data(Friend).toInt())
+            // ignored at bottom
             .arg(index.data(Ignore).toInt())
+            // keep nicknames starting from non-letter character at bottom within group
+            // assume there are no empty nicks in list
+            .arg(index.data(Qt::DisplayRole).toString().at(0).isLetter() ? 0 : 1)
+            // sort ignoring case
             .arg(index.data(Qt::DisplayRole).toString().toLower())
             ;
 
@@ -298,6 +303,7 @@
     setData(mi, m_ignoredSet.contains(mi.data().toString().toLower()), Ignore);
 
     updateIcon(mi);
+    updateSortData(mi);
 }
 
 void PlayersListModel::loadSet(QSet<QString> & set, const QString & suffix)