diff --git a/docs/infomessage-id-desc.txt b/docs/infomessage-id-desc.txt
index 6cb09731..8a7d0d70 100644
--- a/docs/infomessage-id-desc.txt
+++ b/docs/infomessage-id-desc.txt
@@ -1,2 +1,4 @@
1: leave lobby during online game: Question(Do you really wanna leave?)
2: join invite only game: Info(You can invite people with right click ...)
+3: reciev invite to game: Question(You've been invited to the game %1 by %2.
Do you want to join this game?)
+4: click ignore player: Question(Do you really want to put this player on ignore List?)
diff --git a/src/gui/qt/chattools/chattools.cpp b/src/gui/qt/chattools/chattools.cpp
index 54b67254..1804b3a2 100644
--- a/src/gui/qt/chattools/chattools.cpp
+++ b/src/gui/qt/chattools/chattools.cpp
@@ -31,6 +31,7 @@ using namespace std;
ChatTools::ChatTools(QLineEdit* l, ConfigFile *c, ChatType ct, QTextBrowser *b, QTreeWidget *t, gameLobbyDialogImpl *lo) : nickAutoCompletitionCounter(0), myLineEdit(l), myNickTreeWidget(t), myNickStringList(NULL), myTextBrowser(b), myChatType(ct), myConfig(c), myNick(""), myLobby(lo)
{
myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str());
+ ignoreList = myConfig->readConfigStringList("PlayerIgnoreList");
}
ChatTools::~ChatTools()
@@ -95,8 +96,18 @@ void ChatTools::receiveMessage(QString playerName, QString message) {
}
+ bool nickFoundOnIgnoreList = false;
+ list::iterator it1;
+ for(it1=ignoreList.begin(); it1 != ignoreList.end(); it1++) {
- myTextBrowser->append(playerName + ": " + tempMsg);
+ if(playerName == QString::fromUtf8(it1->c_str())) {
+ nickFoundOnIgnoreList = true;
+ }
+ }
+
+ if(!nickFoundOnIgnoreList) {
+ myTextBrowser->append(playerName + ": " + tempMsg);
+ }
}
}
@@ -192,6 +203,5 @@ void ChatTools::setChatTextEdited() {
void ChatTools::refreshIgnoreList()
{
-
-
+ ignoreList = myConfig->readConfigStringList("PlayerIgnoreList");
}
diff --git a/src/gui/qt/chattools/chattools.h b/src/gui/qt/chattools/chattools.h
index 148a217f..a4869aea 100644
--- a/src/gui/qt/chattools/chattools.h
+++ b/src/gui/qt/chattools/chattools.h
@@ -84,6 +84,8 @@ private:
GameTableStyleReader *myStyle;
gameLobbyDialogImpl *myLobby;
+
+ std::list ignoreList;
};
#endif
diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp
index e928fd58..f090dfff 100644
--- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp
+++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp
@@ -24,7 +24,7 @@
using namespace std;
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
- : QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false)
+ : QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false)
{
#ifdef __APPLE__
@@ -234,7 +234,7 @@ void gameLobbyDialogImpl::createGame()
break;
}
- hideShowGameDescription(TRUE);
+ showGameDescription(TRUE);
label_SmallBlind->setText(QString("%L1").arg(gameData.firstSmallBlind));
label_StartCash->setText(QString("%L1").arg(gameData.startMoney));
@@ -259,7 +259,6 @@ void gameLobbyDialogImpl::joinGame()
if (!inGame && selection->hasSelection())
{
unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt();
- myCurrentGameId = gameId;
GameInfo info(mySession->getClientGameInfo(gameId));
bool ok = true;
QString password;
@@ -337,10 +336,10 @@ void gameLobbyDialogImpl::removedFromGame(int /*reason*/)
leftGameDialogUpdate();
}
-void gameLobbyDialogImpl::gameSelected(const QModelIndex &index, bool invitedRefreshHack)
+void gameLobbyDialogImpl::gameSelected(const QModelIndex &index)
{
- if ((!inGame && index.isValid()) || (inGame && index.isValid() && invitedRefreshHack) )
+ if (!inGame && index.isValid() )
{
pushButton_JoinGame->setEnabled(true);
@@ -375,7 +374,7 @@ void gameLobbyDialogImpl::gameSelected(const QModelIndex &index, bool invitedRef
break;
}
- hideShowGameDescription(TRUE);
+ showGameDescription(TRUE);
label_SmallBlind->setText(QString("%L1").arg(info.data.firstSmallBlind));
label_StartCash->setText(QString("%L1").arg(info.data.startMoney));
// label_MaximumNumberOfPlayers->setText(QString::number(info.data.maxNumberOfPlayers));s
@@ -644,7 +643,7 @@ void gameLobbyDialogImpl::clearDialog()
header->setText(0, tr("Connected players"));
header->setData(0, Qt::UserRole, 0);
- hideShowGameDescription(FALSE);
+ showGameDescription(FALSE);
label_typeIcon->setText(" ");
label_typeText->setText(" ");
label_SmallBlind->setText("");
@@ -689,7 +688,7 @@ void gameLobbyDialogImpl::clearDialog()
isGameAdministrator = false;
myPlayerId = 0;
- hideShowGameDescription(FALSE);
+ showGameDescription(FALSE);
label_nickListCounter->setText("| "+tr("players in chat: %1").arg(0));
label_connectedPlayersCounter->setText(tr("connected players: %1").arg(0));
@@ -772,16 +771,16 @@ void gameLobbyDialogImpl::joinedNetworkGame(unsigned playerId, QString playerNam
showInfoMsgBoxTimer->start(1000);
}
- if(!myGameListSelectionModel->hasSelection() && mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY) {
- int it = 0;
- while (myGameListModel->item(it)) {
- if (myGameListModel->item(it, 0)->data(Qt::UserRole) == mySession->getClientCurrentGameId()) {
- gameSelected(treeView_GameList->model()->index(it,0), true);
- break;
- }
- it++;
- }
- }
+// if(!myGameListSelectionModel->hasSelection() && mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY) {
+// int it = 0;
+// while (myGameListModel->item(it)) {
+// if (myGameListModel->item(it, 0)->data(Qt::UserRole) == mySession->getClientCurrentGameId()) {
+// gameSelected(treeView_GameList->model()->index(it,0), true);
+// break;
+// }
+// it++;
+// }
+// }
}
@@ -888,6 +887,7 @@ void gameLobbyDialogImpl::playerJoinedLobby(unsigned playerId, QString /*playerN
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_NickList, 0);
item->setData(0, Qt::DisplayRole, QString::fromUtf8(playerInfo.playerName.c_str()));
item->setData(0, Qt::UserRole, playerId);
+ item->setIcon(0, QIcon(QString(":/cflags/cflags/%1.png").arg("de")));
treeWidget_NickList->sortItems(0, Qt::AscendingOrder);
refreshPlayerStats();
@@ -944,6 +944,41 @@ void gameLobbyDialogImpl::joinedGameDialogUpdate() {
pushButton_JoinGame->hide();
pushButton_joinAnyGame->hide();
pushButton_Leave->show();
+
+ //this was added to show game infos even if no game was selected (e.g. invite only game)
+ assert(mySession);
+ GameInfo info(mySession->getClientGameInfo(mySession->getClientCurrentGameId()));
+
+ groupBox_GameInfo->setTitle(tr("Game Info") + " - " + QString::fromUtf8(info.name.c_str()));
+
+ switch (info.data.gameType) {
+ case GAME_TYPE_NORMAL: {
+ label_typeIcon->setPixmap(QPixmap(":/gfx/player_play.png"));
+ label_typeText->setText(tr("Standard"));
+ }
+ break;
+ case GAME_TYPE_REGISTERED_ONLY: {
+ label_typeIcon->setPixmap(QPixmap(":/gfx/registered.png"));
+ label_typeText->setText(tr("Registered players only"));
+ }
+ break;
+ case GAME_TYPE_INVITE_ONLY: {
+ label_typeIcon->setPixmap(QPixmap(":/gfx/list_add_user.png"));
+ label_typeText->setText(tr("Invited players only"));
+ }
+ break;
+ case GAME_TYPE_RANKING: {
+ label_typeIcon->setPixmap(QPixmap(":/gfx/cup.png"));
+ label_typeText->setText(tr("Ranking game"));
+ }
+ break;
+ }
+
+ showGameDescription(TRUE);
+ label_SmallBlind->setText(QString("%L1").arg(info.data.firstSmallBlind));
+ label_StartCash->setText(QString("%L1").arg(info.data.startMoney));
+ updateDialogBlinds(info.data);
+ label_TimeoutForPlayerAction->setText(QString::number(info.data.playerActionTimeoutSec));
}
void gameLobbyDialogImpl::leftGameDialogUpdate() {
@@ -959,7 +994,7 @@ void gameLobbyDialogImpl::leftGameDialogUpdate() {
header->setText(0, tr("Connected players"));
header->setData(0, Qt::UserRole, 0);
- hideShowGameDescription(FALSE);
+ showGameDescription(FALSE);
label_typeIcon->setText(" ");
label_typeText->setText(" ");
label_SmallBlind->setText("");
@@ -1090,7 +1125,7 @@ bool gameLobbyDialogImpl::event ( QEvent * event ) {
return QDialog::event(event);
}
-void gameLobbyDialogImpl::hideShowGameDescription(bool show) {
+void gameLobbyDialogImpl::showGameDescription(bool show) {
if(show) {
label_gameType->show();
@@ -1382,7 +1417,11 @@ void gameLobbyDialogImpl::showInfoMsgBox()
void gameLobbyDialogImpl::showInvitationDialog(unsigned gameId, unsigned playerIdFrom)
{
- if(!inviteDialogIsCurrentlyShown) {
+ if(inviteDialogIsCurrentlyShown || playerIsOnIgnoreList(playerIdFrom)) {
+
+ mySession->rejectGameInvitation(gameId, DENY_GAME_INVITATION_BUSY);
+ }
+ else {
inviteDialogIsCurrentlyShown = true;
@@ -1397,9 +1436,6 @@ void gameLobbyDialogImpl::showInvitationDialog(unsigned gameId, unsigned playerI
inviteDialogIsCurrentlyShown = false;
}
}
- else {
- mySession->rejectGameInvitation(gameId, DENY_GAME_INVITATION_BUSY);
- }
}
@@ -1426,13 +1462,10 @@ bool gameLobbyDialogImpl::playerIsOnIgnoreList(unsigned playerId) {
list::iterator it1;
for(it1= playerIgnoreList.begin(); it1 != playerIgnoreList.end(); it1++) {
- QString tmpString = QString::fromUtf8(it1->c_str());
- if(QString("%1").arg(playerId) == tmpString.split(",").at(0)) {
-
+ if(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str()) == QString::fromUtf8(it1->c_str())) {
return true;
}
}
-
return false;
}
@@ -1445,12 +1478,16 @@ void gameLobbyDialogImpl::putPlayerOnIgnoreList() {
if(!playerIsOnIgnoreList(playerId)) {
- list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList");
- playerIgnoreList.push_back(QString("%1,%2").arg(playerId).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())).toUtf8().constData());
- myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
- myConfig->writeBuffer();
+ myMessageDialogImpl dialog(myConfig, this);
+ if(dialog.exec(4, tr("You will no longer recieve chat messages or game invitations from this user.
Do you really want to put player %1 on ignore list?").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())), tr("PokerTH - Question"), QPixmap(":/gfx/im-ban-user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false ) == QDialog::Accepted) {
- myChat->refreshIgnoreList();
+ list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList");
+ playerIgnoreList.push_back(QString("%1").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())).toUtf8().constData());
+ myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
+ myConfig->writeBuffer();
+
+ myChat->refreshIgnoreList();
+ }
}
}
}
diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h
index 702cb781..1815da9a 100644
--- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h
+++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h
@@ -55,7 +55,7 @@ public slots:
void createGame();
void joinGame();
void joinAnyGame();
- void gameSelected(const QModelIndex &, bool invitedRefreshHack = false);
+ void gameSelected(const QModelIndex &);
void updateGameItem(QList , unsigned gameId);
void addGame(unsigned gameId);
void updateGameMode(unsigned gameId, int newMode);
@@ -91,7 +91,7 @@ public slots:
void clearDialog();
void keyPressEvent(QKeyEvent * keyEvent);
bool event(QEvent * event);
- void hideShowGameDescription(bool show);
+ void showGameDescription(bool show);
void showWaitStartGameMsgBox();
void joinAnyGameButtonRefresh();
void reject();
@@ -120,7 +120,6 @@ private:
createInternetGameDialogImpl *myCreateInternetGameDialog;
QString currentGameName;
unsigned myPlayerId;
- unsigned myCurrentGameId;
bool isGameAdministrator;
bool inGame;
bool guestMode;
diff --git a/src/gui/qt/resources/im-ban-user_64.png b/src/gui/qt/resources/im-ban-user_64.png
new file mode 100644
index 00000000..c3072efb
Binary files /dev/null and b/src/gui/qt/resources/im-ban-user_64.png differ
diff --git a/src/gui/qt/resources/pokerth.qrc b/src/gui/qt/resources/pokerth.qrc
index 66027220..d3120995 100644
--- a/src/gui/qt/resources/pokerth.qrc
+++ b/src/gui/qt/resources/pokerth.qrc
@@ -45,6 +45,7 @@
system_help_64.png
list_add_user_64.png
im-ban-user.png
+ im-ban-user_64.png
cflags/ad.png
diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui
index f049697e..6c505176 100644
--- a/src/gui/qt/settingsdialog.ui
+++ b/src/gui/qt/settingsdialog.ui
@@ -1805,21 +1805,8 @@ p, li { white-space: pre-wrap; }
- -
-
-
- Qt::Horizontal
-
-
-
- 256
- 218
-
-
-
-
-
-
+
Remove Player
diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp
index 81d3a47c..98d7478d 100644
--- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp
+++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp
@@ -116,6 +116,8 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
connect( listWidget_cardDeckStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentCardDeckStylePreview() ));
connect( pushButton_addCardDeckStyle, SIGNAL( clicked() ), this, SLOT( addCardDeckStyle()) );
connect( pushButton_removeCardDeckStyle, SIGNAL( clicked() ), this, SLOT( removeCardDeckStyle()) );
+ connect( pushButton_internetGameRemoveIgnoredPlayer, SIGNAL( clicked()), this, SLOT( removePlayerFromIgnoredPlayersList()));
+
}
void settingsDialogImpl::exec() {
@@ -215,8 +217,7 @@ void settingsDialogImpl::exec() {
std::list::iterator it5;
for(it5= playerIgnoreList.begin(); it5 != playerIgnoreList.end(); it5++) {
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_internetGameIgnoredPlayers);
- item->setText(0, QString::fromUtf8(it5->c_str()).split(",").at(1) );
- item->setData(0, Qt::UserRole, QString::fromUtf8(it5->c_str()).split(",").at(0) );
+ item->setText(0, QString::fromUtf8(it5->c_str()));
}
//Interface
@@ -543,7 +544,7 @@ void settingsDialogImpl::isAccepted() {
int k;
std::list playerIgnoreList;
for(k=0; ktopLevelItemCount(); k++) {
- playerIgnoreList.push_back(QString("%1,%2").arg(treeWidget_internetGameIgnoredPlayers->topLevelItem(k)->data(0,Qt::UserRole).toUInt()).arg(treeWidget_internetGameIgnoredPlayers->topLevelItem(k)->text(0)).toUtf8().constData());
+ playerIgnoreList.push_back(QString("%1").arg(treeWidget_internetGameIgnoredPlayers->topLevelItem(k)->text(0)).toUtf8().constData());
}
myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
@@ -1141,3 +1142,10 @@ void settingsDialogImpl::removeCardDeckStyle()
listWidget_cardDeckStyles->takeItem(listWidget_cardDeckStyles->currentRow());
}
}
+
+void settingsDialogImpl::removePlayerFromIgnoredPlayersList()
+{
+ if(treeWidget_internetGameIgnoredPlayers->selectedItems().count()) {
+ treeWidget_internetGameIgnoredPlayers->takeTopLevelItem(treeWidget_internetGameIgnoredPlayers->currentIndex().row());
+ }
+}
diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.h b/src/gui/qt/settingsdialog/settingsdialogimpl.h
index c36b0b57..732f1fcc 100644
--- a/src/gui/qt/settingsdialog/settingsdialogimpl.h
+++ b/src/gui/qt/settingsdialog/settingsdialogimpl.h
@@ -90,6 +90,7 @@ public slots:
void showCurrentCardDeckStylePreview();
void addCardDeckStyle();
void removeCardDeckStyle();
+ void removePlayerFromIgnoredPlayersList();
private:
diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp
index f71f0c5c..fb65a0fe 100644
--- a/src/gui/qt/startwindow/startwindowimpl.cpp
+++ b/src/gui/qt/startwindow/startwindowimpl.cpp
@@ -150,7 +150,6 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
connect(this, SIGNAL(signalNetClientShowTimeoutDialog(int, unsigned)), this, SLOT(showTimeoutDialog(int, unsigned)));
connect(this, SIGNAL(signalLobbyPlayerJoined(unsigned, QString)), myGameLobbyDialog, SLOT(playerJoinedLobby(unsigned, QString)));
-// connect(this, SIGNAL(signalLobbyPlayerKicked(QString, QString, QString)), myGameLobbyDialog, SLOT(playerKicked(QString, QString, QString)));
connect(this, SIGNAL(signalLobbyPlayerLeft(unsigned)), myGameLobbyDialog, SLOT(playerLeftLobby(unsigned)));