--- a/QTfrontend/hwform.cpp Sun Apr 07 19:43:18 2013 -0400
+++ b/QTfrontend/hwform.cpp Mon Apr 08 23:34:12 2013 +0400
@@ -45,6 +45,7 @@
#include <QInputDialog>
#include <QPropertyAnimation>
#include <QSettings>
+#include <QSortFilterProxyModel>
#if (QT_VERSION >= 0x040600)
#include <QGraphicsEffect>
@@ -1301,16 +1302,23 @@
ui.pageRoomsList->chatWidget, SLOT(onChatMessage(const QString&, const QString&)), Qt::QueuedConnection);
// nick list stuff
- connect(hwnet, SIGNAL(nickAdded(const QString&, bool)),
- ui.pageNetGame->chatWidget, SLOT(nickAdded(const QString&, bool)), Qt::QueuedConnection);
- connect(hwnet, SIGNAL(nickRemoved(const QString&)),
- ui.pageNetGame->chatWidget, SLOT(nickRemoved(const QString&)), Qt::QueuedConnection);
- connect(hwnet, SIGNAL(nickAddedLobby(const QString&, bool)),
- ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&, bool)), Qt::QueuedConnection);
- connect(hwnet, SIGNAL(nickRemovedLobby(const QString&)),
- ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&)), Qt::QueuedConnection);
- connect(hwnet, SIGNAL(nickRemovedLobby(const QString&, const QString&)),
- ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&, const QString&)), Qt::QueuedConnection);
+ {
+ QSortFilterProxyModel * playersSortFilterModel = qobject_cast<QSortFilterProxyModel *>(hwnet->lobbyPlayersModel());
+ if(playersSortFilterModel)
+ {
+ PlayersListModel * players = qobject_cast<PlayersListModel *>(playersSortFilterModel->sourceModel());
+ connect(players, SIGNAL(nickAdded(const QString&, bool)),
+ ui.pageNetGame->chatWidget, SLOT(nickAdded(const QString&, bool)));
+ connect(players, SIGNAL(nickRemoved(const QString&)),
+ ui.pageNetGame->chatWidget, SLOT(nickRemoved(const QString&)));
+ connect(players, SIGNAL(nickAddedLobby(const QString&, bool)),
+ ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&, bool)));
+ connect(players, SIGNAL(nickRemovedLobby(const QString&)),
+ ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&)));
+ connect(players, SIGNAL(nickRemovedLobby(const QString&, const QString&)),
+ ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&, const QString&)));
+ }
+ }
// teams selecting stuff
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(hhogsNumChanged(const HWTeam&)),
--- a/QTfrontend/model/playerslistmodel.cpp Sun Apr 07 19:43:18 2013 -0400
+++ b/QTfrontend/model/playerslistmodel.cpp Mon Apr 08 23:34:12 2013 +0400
@@ -84,7 +84,7 @@
}
-void PlayersListModel::addPlayer(const QString & nickname)
+void PlayersListModel::addPlayer(const QString & nickname, bool notify)
{
insertRow(rowCount());
@@ -92,11 +92,18 @@
setData(mi, nickname);
checkFriendIgnore(mi);
+
+ emit nickAddedLobby(nickname, notify);
}
-void PlayersListModel::removePlayer(const QString & nickname)
+void PlayersListModel::removePlayer(const QString & nickname, const QString &msg)
{
+ if(msg.isEmpty())
+ emit nickRemovedLobby(nickname);
+ else
+ emit nickRemovedLobby(nickname, msg);
+
QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
if(mil.size())
@@ -104,7 +111,7 @@
}
-void PlayersListModel::playerJoinedRoom(const QString & nickname)
+void PlayersListModel::playerJoinedRoom(const QString & nickname, bool notify)
{
QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
@@ -114,11 +121,15 @@
updateIcon(mil[0]);
updateSortData(mil[0]);
}
+
+ emit nickAdded(nickname, notify);
}
void PlayersListModel::playerLeftRoom(const QString & nickname)
{
+ emit nickRemoved(nickname);
+
QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname, 1, Qt::MatchExactly);
if(mil.size())
--- a/QTfrontend/model/playerslistmodel.h Sun Apr 07 19:43:18 2013 -0400
+++ b/QTfrontend/model/playerslistmodel.h Mon Apr 08 23:34:12 2013 +0400
@@ -41,13 +41,20 @@
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
public slots:
- void addPlayer(const QString & nickname);
- void removePlayer(const QString & nickname);
- void playerJoinedRoom(const QString & nickname);
+ void addPlayer(const QString & nickname, bool notify);
+ void removePlayer(const QString & nickname, const QString & msg = QString());
+ void playerJoinedRoom(const QString & nickname, bool notify);
void playerLeftRoom(const QString & nickname);
void resetRoomFlags();
void setNickname(const QString & nickname);
+signals:
+ void nickAdded(const QString& nick, bool notifyNick);
+ void nickRemoved(const QString& nick);
+ void nickAddedLobby(const QString& nick, bool notifyNick);
+ void nickRemovedLobby(const QString& nick);
+ void nickRemovedLobby(const QString& nick, const QString& message);
+
private:
QHash<quint32, QIcon> & m_icons();
typedef QHash<int, QVariant> DataEntry;
--- a/QTfrontend/net/newnetclient.cpp Sun Apr 07 19:43:18 2013 -0400
+++ b/QTfrontend/net/newnetclient.cpp Mon Apr 08 23:34:12 2013 +0400
@@ -505,8 +505,7 @@
emit connected();
}
- m_playersModel->addPlayer(lst[i]);
- emit nickAddedLobby(lst[i], false);
+ m_playersModel->addPlayer(lst[i], false);
}
return;
}
@@ -555,11 +554,9 @@
}
if (lst.size() < 3)
- emit nickRemovedLobby(lst[1]);
+ m_playersModel->removePlayer(lst[1]);
else
- emit nickRemovedLobby(lst[1], lst[2]);
-
- m_playersModel->removePlayer(lst[1]);
+ m_playersModel->removePlayer(lst[1], lst[2]);
return;
}
@@ -650,8 +647,8 @@
emit configAsked();
}
- m_playersModel->playerJoinedRoom(lst[i]);
- emit nickAdded(lst[i], isChief && (lst[i] != mynick));
+ m_playersModel->playerJoinedRoom(lst[i], isChief && (lst[i] != mynick));
+
emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i]));
}
return;
@@ -783,9 +780,8 @@
for(int i = 1; i < lst.size(); ++i)
{
- emit nickAdded(lst[i], isChief && (lst[i] != mynick));
emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i]));
- m_playersModel->playerJoinedRoom(lst[i]);
+ m_playersModel->playerJoinedRoom(lst[i], isChief && (lst[i] != mynick));
}
return;
}
@@ -797,7 +793,7 @@
qWarning("Net: Bad LEFT message");
return;
}
- emit nickRemoved(lst[1]);
+
if (lst.size() < 3)
emit chatStringFromNet(tr("%1 *** %2 has left").arg('\x03').arg(lst[1]));
else
--- a/QTfrontend/net/newnetclient.h Sun Apr 07 19:43:18 2013 -0400
+++ b/QTfrontend/net/newnetclient.h Mon Apr 08 23:34:12 2013 +0400
@@ -99,11 +99,6 @@
void AuthFailed();
void EnteredGame();
void LeftRoom(const QString & reason);
- void nickAdded(const QString& nick, bool notifyNick);
- void nickRemoved(const QString& nick);
- void nickAddedLobby(const QString& nick, bool notifyNick);
- void nickRemovedLobby(const QString& nick);
- void nickRemovedLobby(const QString& nick, const QString& message);
void FromNet(const QByteArray & buf);
void adminAccess(bool);
void roomMaster(bool);
--- a/project_files/hedgewars.pro Sun Apr 07 19:43:18 2013 -0400
+++ b/project_files/hedgewars.pro Mon Apr 08 23:34:12 2013 +0400
@@ -250,7 +250,7 @@
RESOURCES += ../QTfrontend/hedgewars.qrc
-LIBS += -L../bin -lphysfs
+LIBS += -L../bin -lhw_physfs -lphyslayer
macx {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6