lobby: add sort by flag option, align player names in available players list
This commit is contained in:
+11
-9
@@ -195,7 +195,8 @@ HEADERS += src/game.h \
|
||||
src/gui/qt/settingsdialog/mystylelistitem.h \
|
||||
src/gui/qt/gamelobbydialog/mygamelistsortfilterproxymodel.h \
|
||||
src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.h \
|
||||
src/engine/local_engine/replay.h
|
||||
src/engine/local_engine/replay.h \
|
||||
src/gui/qt/gamelobbydialog/mynicklistsortfilterproxymodel.h
|
||||
FORMS += src/gui/qt/gametable.ui \
|
||||
src/gui/qt/aboutpokerth.ui \
|
||||
src/gui/qt/connecttoserverdialog.ui \
|
||||
@@ -262,8 +263,9 @@ SOURCES += src/pokerth.cpp \
|
||||
src/gui/qt/settingsdialog/mystylelistitem.cpp \
|
||||
src/gui/qt/gamelobbydialog/mygamelistsortfilterproxymodel.cpp \
|
||||
src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp \
|
||||
src/engine/local_engine/replay.cpp
|
||||
TRANSLATIONS = ts/pokerth_af.ts \
|
||||
src/engine/local_engine/replay.cpp \
|
||||
src/gui/qt/gamelobbydialog/mynicklistsortfilterproxymodel.cpp
|
||||
TRANSLATIONS = ts/pokerth_af.ts \
|
||||
ts/pokerth_bg.ts \
|
||||
ts/pokerth_zhcn.ts \
|
||||
ts/pokerth_ca.ts \
|
||||
@@ -330,12 +332,12 @@ win32 {
|
||||
-lidn
|
||||
LIBS += -lcurl
|
||||
LIBS += -lz
|
||||
LIBS += -lboost_thread-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_filesystem-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_regex-mgw45-mt-1_44
|
||||
LIBS += -lboost_system-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_iostreams-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_zlib-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_thread-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_filesystem-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_regex-mgw45-mt-1_44
|
||||
LIBS += -lboost_system-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_iostreams-mgw45-mt-1_44.dll
|
||||
LIBS += -lboost_zlib-mgw45-mt-1_44.dll
|
||||
}
|
||||
LIBS += -lgdi32 \
|
||||
-lcomdlg32 \
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>248</width>
|
||||
<height>178</height>
|
||||
<height>170</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@@ -672,12 +672,12 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="3" column="1" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_lobbyChat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
<height>223</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
@@ -714,7 +714,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<item row="5" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_connectedPlayersCounter">
|
||||
@@ -842,6 +842,25 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QComboBox" name="comboBox_nickListFilter">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>No sorting / filtering</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sort by flag</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Filter idle players</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//
|
||||
#include "gamelobbydialogimpl.h"
|
||||
#include "mygamelistsortfilterproxymodel.h"
|
||||
#include "mynicklistsortfilterproxymodel.h"
|
||||
#include "startwindowimpl.h"
|
||||
#include "chattools.h"
|
||||
#include "changecompleteblindsdialogimpl.h"
|
||||
@@ -85,7 +86,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
treeView_GameList->setAutoFillBackground(TRUE);
|
||||
|
||||
myNickListModel = new QStandardItemModel(this);
|
||||
myNickListSortFilterProxyModel = new QSortFilterProxyModel(this);
|
||||
myNickListSortFilterProxyModel = new MyNickListSortFilterProxyModel(this);
|
||||
myNickListSortFilterProxyModel->setSourceModel(myNickListModel);
|
||||
myNickListSortFilterProxyModel->setDynamicSortFilter(TRUE);
|
||||
myNickListSortFilterProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
@@ -126,6 +127,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
connect( blinkingButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimation() ));
|
||||
connect( showInfoMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showInfoMsgBox() ));
|
||||
connect( comboBox_gameListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeGameListFilter(int)));
|
||||
connect( comboBox_nickListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNickListFilter(int)));
|
||||
connect( treeView_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) );
|
||||
connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() ));
|
||||
connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() ));
|
||||
@@ -866,12 +868,15 @@ void gameLobbyDialogImpl::updatePlayer(unsigned playerId, QString newPlayerName)
|
||||
if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) {
|
||||
oldNick = myNickListModel->item(it1, 0)->text();
|
||||
myNickListModel->item(it1, 0)->setText(newPlayerName);
|
||||
|
||||
PlayerInfo playerInfo(mySession->getClientPlayerInfo(playerId));
|
||||
if(!playerInfo.isGuest) {
|
||||
myNickListModel->item(it1, 0)->setIcon(QIcon(QString(":/cflags/cflags/%1.png").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).countryCode.c_str()).toLower())));
|
||||
QString countryString = QString::fromUtf8(playerInfo.countryCode.c_str()).toLower();
|
||||
myNickListModel->item(it1, 0)->setData(countryString, 33);
|
||||
if(playerInfo.isGuest || countryString.isEmpty()) {
|
||||
myNickListModel->item(it1, 0)->setIcon(QIcon(":/cflags/cflags/undefined.png"));
|
||||
}
|
||||
else {
|
||||
myNickListModel->item(it1, 0)->setIcon(QIcon());
|
||||
myNickListModel->item(it1, 0)->setIcon(QIcon(QString(":/cflags/cflags/%1.png").arg(countryString)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -916,11 +921,19 @@ void gameLobbyDialogImpl::playerLeftLobby(unsigned playerId)
|
||||
void gameLobbyDialogImpl::playerJoinedLobby(unsigned playerId, QString /*playerName TODO remove*/)
|
||||
{
|
||||
PlayerInfo playerInfo(mySession->getClientPlayerInfo(playerId));
|
||||
QString countryString = QString::fromUtf8(playerInfo.countryCode.c_str()).toLower();
|
||||
|
||||
QStandardItem *item = new QStandardItem;
|
||||
item->setText(QString::fromUtf8(playerInfo.playerName.c_str()));
|
||||
item->setData(playerId, Qt::UserRole);
|
||||
item->setIcon(QIcon(QString(":/cflags/cflags/%1.png").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).countryCode.c_str()).toLower())));
|
||||
item->setData(countryString, 33);
|
||||
if(playerInfo.isGuest || countryString.isEmpty()) {
|
||||
item->setIcon(QIcon(":/cflags/cflags/undefined.png"));
|
||||
}
|
||||
else {
|
||||
item->setIcon(QIcon(QString(":/cflags/cflags/%1.png").arg(countryString)));
|
||||
}
|
||||
|
||||
myNickListModel->appendRow(item);
|
||||
|
||||
refreshPlayerStats();
|
||||
@@ -1343,6 +1356,28 @@ void gameLobbyDialogImpl::changeGameListFilter(int index) {
|
||||
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::changeNickListFilter(int state)
|
||||
{
|
||||
myNickListSortFilterProxyModel->setFilterState(state);
|
||||
myNickListModel->sort(0, Qt::DescendingOrder);
|
||||
|
||||
// switch(state) {
|
||||
// case 0: {
|
||||
//
|
||||
// }
|
||||
// break;
|
||||
// case 1: {
|
||||
//
|
||||
// }
|
||||
// break;
|
||||
// case 2: {
|
||||
//
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::changeGameListSorting() {
|
||||
|
||||
writeDialogSettings(0);
|
||||
|
||||
@@ -29,6 +29,7 @@ class ConfigFile;
|
||||
class ChatTools;
|
||||
class startWindowImpl;
|
||||
class MyGameListSortFilterProxyModel;
|
||||
class MyNickListSortFilterProxyModel;
|
||||
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
@@ -99,6 +100,7 @@ public slots:
|
||||
void writeDialogSettings(int);
|
||||
void readDialogSettings();
|
||||
void changeGameListFilter(int);
|
||||
void changeNickListFilter(int);
|
||||
void changeGameListSorting();
|
||||
void registeredUserMode();
|
||||
void guestUserMode();
|
||||
@@ -151,7 +153,7 @@ private:
|
||||
|
||||
QStandardItemModel *myNickListModel;
|
||||
QItemSelectionModel *myNickListSelectionModel;
|
||||
QSortFilterProxyModel *myNickListSortFilterProxyModel;
|
||||
MyNickListSortFilterProxyModel *myNickListSortFilterProxyModel;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#include "mynicklistsortfilterproxymodel.h"
|
||||
#include <QtGui>
|
||||
#include <QtCore>
|
||||
|
||||
MyNickListSortFilterProxyModel::MyNickListSortFilterProxyModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent), filterState(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool MyNickListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
|
||||
switch(filterState) {
|
||||
|
||||
case 0: {
|
||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
|
||||
}
|
||||
break;
|
||||
case 1: {
|
||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
|
||||
}
|
||||
break;
|
||||
case 2: {
|
||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
// QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
|
||||
// QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
|
||||
// QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);
|
||||
// QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent);
|
||||
//
|
||||
// return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp)
|
||||
// && sourceModel()->data(index2, 16).toString().contains(column2RegExp)
|
||||
// && sourceModel()->data(index3, 16).toString().contains(column3RegExp)
|
||||
// && sourceModel()->data(index4, 16).toString().contains(column4RegExp)) || sourceModel()->data(index0, 16) == "MeInThisGame");
|
||||
}
|
||||
|
||||
bool MyNickListSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
switch(filterState) {
|
||||
|
||||
case 0: {
|
||||
return QSortFilterProxyModel::lessThan(left, right);
|
||||
}
|
||||
break;
|
||||
case 1: {
|
||||
QString leftCountryAndName(sourceModel()->data(left, 33).toString().toUpper()+sourceModel()->data(left, Qt::DisplayRole).toString().toLower());
|
||||
QString rightCountryAndName(sourceModel()->data(right, 33).toString().toUpper()+sourceModel()->data(right, Qt::DisplayRole).toString().toLower());
|
||||
return leftCountryAndName < rightCountryAndName;
|
||||
}
|
||||
break;
|
||||
case 2: {
|
||||
return QSortFilterProxyModel::lessThan(left, right);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MyNickListSortFilterProxyModel::setFilterState(int state)
|
||||
{
|
||||
filterState = state;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef MYNICKLISTSORTFILTERPROXYMODEL_H
|
||||
#define MYNICKLISTSORTFILTERPROXYMODEL_H
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
class MyNickListSortFilterProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyNickListSortFilterProxyModel(QObject *parent = 0);
|
||||
|
||||
void setFilterState(int state);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
||||
|
||||
private:
|
||||
|
||||
int filterState;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // MYGAMELISTSORTFILTERPROXYMODEL_H
|
||||
@@ -2051,12 +2051,9 @@ void gameTableImpl::postRiverRunAnimation2() {
|
||||
//Wenn einmal umgedreht dann fertig!!
|
||||
flipHolecardsAllInAlreadyDone = TRUE;
|
||||
}
|
||||
else {
|
||||
int tempCardsIntArray[2];
|
||||
else {
|
||||
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
(*it_c)->getMyCards(tempCardsIntArray);
|
||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
|
||||
//set Player value (logging) for all in already shown cards
|
||||
(*it_c)->setMyCardsFlip(1,3);
|
||||
}
|
||||
@@ -2321,7 +2318,6 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn)
|
||||
}
|
||||
}
|
||||
//set Player value (logging)
|
||||
qDebug() << "currentHand->getCurrentRound()" << currentHand->getCurrentRound();
|
||||
if(currentHand->getCurrentRound() < 3 || allIn) {
|
||||
(*it_c)->setMyCardsFlip(1,2); //for bero before postriver or allin just log the hole cards
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 367 B |
Binary file not shown.
|
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 436 B |
Binary file not shown.
|
After Width: | Height: | Size: 143 B |
@@ -95,7 +95,6 @@
|
||||
<file>cflags/cd.png</file>
|
||||
<file>cflags/cf.png</file>
|
||||
<file>cflags/cg.png</file>
|
||||
<file>cflags/ch.png</file>
|
||||
<file>cflags/ci.png</file>
|
||||
<file>cflags/ck.png</file>
|
||||
<file>cflags/cl.png</file>
|
||||
@@ -219,7 +218,6 @@
|
||||
<file>cflags/ni.png</file>
|
||||
<file>cflags/nl.png</file>
|
||||
<file>cflags/no.png</file>
|
||||
<file>cflags/np.png</file>
|
||||
<file>cflags/nr.png</file>
|
||||
<file>cflags/nu.png</file>
|
||||
<file>cflags/nz.png</file>
|
||||
@@ -301,5 +299,8 @@
|
||||
<file>cflags/za.png</file>
|
||||
<file>cflags/zm.png</file>
|
||||
<file>cflags/zw.png</file>
|
||||
<file>cflags/ch.png</file>
|
||||
<file>cflags/np.png</file>
|
||||
<file>cflags/undefined.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user