# HG changeset patch
# User unc0rr
# Date 1350500956 -14400
# Node ID 28613382e3f3379dce11883439e66604344f2548
# Parent 6ab7307fcec30ff3b771fcd733603a0e1da1542f
- Show unready status in icon
- Fix bug with search for player in model by nick performing "starts with" test
diff -r 6ab7307fcec3 -r 28613382e3f3 QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc Tue Oct 16 22:57:48 2012 -0400
+++ b/QTfrontend/hedgewars.qrc Wed Oct 17 23:09:16 2012 +0400
@@ -143,5 +143,6 @@
res/chat/roomadmin_gray.png
res/chat/serveradmin.png
res/chat/serveradmin_gray.png
+ res/chat/lamp_off.png
diff -r 6ab7307fcec3 -r 28613382e3f3 QTfrontend/model/playerslistmodel.cpp
--- a/QTfrontend/model/playerslistmodel.cpp Tue Oct 16 22:57:48 2012 -0400
+++ b/QTfrontend/model/playerslistmodel.cpp Wed Oct 17 23:09:16 2012 +0400
@@ -97,7 +97,7 @@
void PlayersListModel::removePlayer(const QString & nickname)
{
- QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
if(mil.size())
removeRow(mil[0].row());
@@ -106,25 +106,31 @@
void PlayersListModel::playerJoinedRoom(const QString & nickname)
{
- QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
if(mil.size())
+ {
setData(mil[0], "1", RoomFilterRole);
+ updateIcon(mil[0]);
+ }
}
void PlayersListModel::playerLeftRoom(const QString & nickname)
{
- QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
if(mil.size())
+ {
setData(mil[0], "0", RoomFilterRole);
+ updateIcon(mil[0]);
+ }
}
void PlayersListModel::setFlag(const QString &nickname, StateFlag flagType, bool isSet)
{
- QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
if(mil.size())
{
@@ -161,7 +167,7 @@
bool PlayersListModel::isFlagSet(const QString & nickname, StateFlag flagType)
{
- QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
+ QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
if(mil.size())
return mil[0].data(flagType).toBool();
@@ -199,6 +205,7 @@
<< index.data(Registered).toBool()
<< index.data(Friend).toBool()
<< index.data(Ignore).toBool()
+ << (index.data(RoomFilterRole).toString() == "1")
;
for(int i = flags.size() - 1; i >= 0; --i)
@@ -216,8 +223,11 @@
QPainter painter(&result);
- if(index.data(Ready).toBool())
- painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp.png"));
+ if(index.data(RoomFilterRole).toString() == "1")
+ if(index.data(Ready).toBool())
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp.png"));
+ else
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp_off.png"));
QString mainIconName(":/res/chat/");
diff -r 6ab7307fcec3 -r 28613382e3f3 QTfrontend/res/chat/lamp_off.png
Binary file QTfrontend/res/chat/lamp_off.png has changed