- Nicks starting from not-letter char go to bottom of the list
authorunc0rr
Thu, 11 Oct 2012 21:17:56 +0400
changeset 7744 75e1d0c0ba72
parent 7743 dc41e9222d2c
child 7745 0326e1bf674d
- Nicks starting from not-letter char go to bottom of the list - Small fixes
QTfrontend/model/playerslistmodel.cpp
QTfrontend/net/newnetclient.cpp
--- 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)
--- a/QTfrontend/net/newnetclient.cpp	Wed Oct 10 23:58:23 2012 +0400
+++ b/QTfrontend/net/newnetclient.cpp	Thu Oct 11 21:17:56 2012 +0400
@@ -465,7 +465,7 @@
             if (lst[i] == mynick)
             {
                 netClientState = InLobby;
-                m_playersModel->resetRoomFlags();
+                RawSendNet(QString("LIST"));
                 emit connected();
             }