--- a/QTfrontend/model/playerslistmodel.cpp Sun Oct 07 11:59:42 2012 -0400
+++ b/QTfrontend/model/playerslistmodel.cpp Sun Oct 07 23:33:09 2012 +0400
@@ -1,6 +1,7 @@
#include <QModelIndexList>
#include <QModelIndex>
#include <QPainter>
+#include <QDebug>
#include "playerslistmodel.h"
@@ -22,7 +23,7 @@
QVariant PlayersListModel::data(const QModelIndex &index, int role) const
{
- if(!index.isValid())
+ if(!index.isValid() || index.row() < 0 || index.row() >= rowCount() || index.column() != 0)
return QVariant(QVariant::Invalid);
return m_data.at(index.row()).value(role);
@@ -92,7 +93,7 @@
void PlayersListModel::removePlayer(const QString & nickname)
{
- QModelIndexList mil = match(index(0, 0), Qt::DisplayRole, nickname);
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
if(mil.size())
removeRow(mil[0].row());
@@ -105,7 +106,7 @@
if(mil.size())
{
- setData(mil[0], flagType, isSet);
+ setData(mil[0], isSet, flagType);
updateIcon(mil[0]);
}
}
@@ -132,7 +133,6 @@
if(m_icons().contains(iconNum))
{
setData(index, m_icons().value(iconNum), Qt::DecorationRole);
- qDebug("cached");
}
else
{
--- a/QTfrontend/net/newnetclient.cpp Sun Oct 07 11:59:42 2012 -0400
+++ b/QTfrontend/net/newnetclient.cpp Sun Oct 07 23:33:09 2012 +0400
@@ -379,12 +379,15 @@
else emit setMyReadyStatus(setFlag);
}
emit setReadyStatus(nick, setFlag);
+ m_lobbyPlayersModel->setFlag(nick, PlayersListModel::Ready, setFlag);
}
break;
// flag indicating if a player is a registered user
case 'u':
emit setRegisteredStatus(nicks, setFlag);
+ foreach(const QString & nick, nicks)
+ m_lobbyPlayersModel->setFlag(nick, PlayersListModel::Registered, setFlag);
break;
// flag indicating if a player is the host/master of the room
@@ -398,6 +401,7 @@
}
emit setRoomMasterStatus(nick, setFlag);
+ m_lobbyPlayersModel->setFlag(nick, PlayersListModel::RoomAdmin, setFlag);
}
break;
@@ -409,6 +413,7 @@
emit adminAccess(setFlag);
emit setAdminStatus(nick, setFlag);
+ m_lobbyPlayersModel->setFlag(nick, PlayersListModel::ServerAdmin, setFlag);
}
break;