lobby nick list refactoring done. search function for nick list added. sorting is caseinsensitive now
This commit is contained in:
+6
-6
@@ -328,12 +328,12 @@ win32 {
|
||||
-lidn
|
||||
LIBS += -lcurl
|
||||
LIBS += -lz
|
||||
LIBS += -lboost_thread-mgw45-mt-1_43
|
||||
LIBS += -lboost_filesystem-mgw45-mt-1_43
|
||||
LIBS += -lboost_regex-mgw45-mt-1_43
|
||||
LIBS += -lboost_system-mgw45-mt-1_43
|
||||
LIBS += -lboost_iostreams-mgw45-mt-1_43
|
||||
LIBS += -lboost_zlib-mgw45-mt-1_43
|
||||
LIBS += -lboost_thread-mgw45-mt-1_43
|
||||
LIBS += -lboost_filesystem-mgw45-mt-1_43
|
||||
LIBS += -lboost_regex-mgw45-mt-1_43
|
||||
LIBS += -lboost_system-mgw45-mt-1_43
|
||||
LIBS += -lboost_iostreams-mgw45-mt-1_43
|
||||
LIBS += -lboost_zlib-mgw45-mt-1_43
|
||||
}
|
||||
LIBS += -lgdi32 \
|
||||
-lcomdlg32 \
|
||||
|
||||
@@ -28,7 +28,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)
|
||||
ChatTools::ChatTools(QLineEdit* l, ConfigFile *c, ChatType ct, QTextBrowser *b, QStandardItemModel *m, gameLobbyDialogImpl *lo) : nickAutoCompletitionCounter(0), myLineEdit(l), myNickListModel(m), myNickStringList(NULL), myTextBrowser(b), myChatType(ct), myConfig(c), myNick(""), myLobby(lo)
|
||||
{
|
||||
myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str());
|
||||
ignoreList = myConfig->readConfigStringList("PlayerIgnoreList");
|
||||
@@ -163,11 +163,13 @@ void ChatTools::nickAutoCompletition() {
|
||||
|
||||
if(nickAutoCompletitionCounter == 0) {
|
||||
|
||||
if(myNickTreeWidget) {
|
||||
QTreeWidgetItemIterator it(myNickTreeWidget);
|
||||
while (*it) {
|
||||
if ((*it)->text(0).startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "")
|
||||
matchStringList << (*it)->text(0);
|
||||
if(myNickListModel) {
|
||||
int it = 0;
|
||||
while (myNickListModel->item(it)) {
|
||||
QString text = myNickListModel->item(it, 0)->data(Qt::DisplayRole).toString();
|
||||
if(text.startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "") {
|
||||
matchStringList << text;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class ChatTools : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChatTools(QLineEdit*, ConfigFile*, ChatType, QTextBrowser *b = NULL, QTreeWidget *t = NULL, gameLobbyDialogImpl *lo = NULL);
|
||||
ChatTools(QLineEdit*, ConfigFile*, ChatType, QTextBrowser *b = NULL, QStandardItemModel *m = NULL, gameLobbyDialogImpl *lo = NULL);
|
||||
|
||||
~ChatTools();
|
||||
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
int nickAutoCompletitionCounter;
|
||||
|
||||
QLineEdit *myLineEdit;
|
||||
QTreeWidget *myNickTreeWidget;
|
||||
QStandardItemModel *myNickListModel;
|
||||
QStringList myNickStringList;
|
||||
QTextBrowser *myTextBrowser;
|
||||
boost::shared_ptr<Session> mySession;
|
||||
|
||||
+269
-259
@@ -25,29 +25,20 @@
|
||||
<property name="windowTitle">
|
||||
<string>Internet Game Lobby</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>9</number>
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="4">
|
||||
<widget class="QTreeWidget" name="treeWidget_NickList">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="lineEdit_searchForPlayers">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -64,245 +55,8 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Available Players</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_joinAnyGame">
|
||||
<property name="text">
|
||||
<string>Join &any game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/transform-rotate.png</normaloff>:/gfx/transform-rotate.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>181</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_CreateGame">
|
||||
<property name="text">
|
||||
<string>&Create Game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/list_add.png</normaloff>:/gfx/list_add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_JoinGame">
|
||||
<property name="text">
|
||||
<string>&Join Game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/go-next-view.png</normaloff>:/gfx/go-next-view.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_lobbyChat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>230</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Lobby-Chat</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser_ChatDisplay"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="lineEdit_ChatInput"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_connectedPlayersCounter">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_runningGamesCounter">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_openGamesCounter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body>
|
||||
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
|
||||
<tr>
|
||||
<td style="border: none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://online-ranking.pokerth.net"><span style=" text-decoration: underline; color:#0000ff;">Click here to view the online rankings</span></a></p></td></tr></table></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_pokerthDotNet">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.pokerth.net"><span style=" text-decoration: underline; color:#0000ff;">http://www.pokerth.net</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTreeView" name="treeView_GameList">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
<property name="text">
|
||||
<string>search for player ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -421,7 +175,7 @@ p, li { white-space: pre-wrap; }
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>248</width>
|
||||
<height>179</height>
|
||||
<height>178</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@@ -831,11 +585,267 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTreeView" name="treeView_GameList">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_joinAnyGame">
|
||||
<property name="text">
|
||||
<string>Join &any game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/transform-rotate.png</normaloff>:/gfx/transform-rotate.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>181</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_CreateGame">
|
||||
<property name="text">
|
||||
<string>&Create Game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/list_add.png</normaloff>:/gfx/list_add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_JoinGame">
|
||||
<property name="text">
|
||||
<string>&Join Game</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/go-next-view.png</normaloff>:/gfx/go-next-view.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_lobbyChat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>230</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Lobby-Chat</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser_ChatDisplay"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="lineEdit_ChatInput"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_connectedPlayersCounter">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_runningGamesCounter">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_openGamesCounter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body>
|
||||
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
|
||||
<tr>
|
||||
<td style="border: none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://online-ranking.pokerth.net"><span style=" text-decoration: underline; color:#0000ff;">Click here to view the online rankings</span></a></p></td></tr></table></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_pokerthDotNet">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.pokerth.net"><span style=" text-decoration: underline; color:#0000ff;">http://www.pokerth.net</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="3">
|
||||
<widget class="QTreeView" name="treeView_NickList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>165</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>165</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>treeWidget_NickList</tabstop>
|
||||
<tabstop>comboBox_gameListFilter</tabstop>
|
||||
<tabstop>treeView_NickList</tabstop>
|
||||
<tabstop>treeView_GameList</tabstop>
|
||||
<tabstop>pushButton_joinAnyGame</tabstop>
|
||||
<tabstop>pushButton_CreateGame</tabstop>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
//
|
||||
// C++ Implementation: gamelobbydialogimpl
|
||||
//
|
||||
@@ -33,8 +34,6 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
#endif
|
||||
setupUi(this);
|
||||
|
||||
myChat = new ChatTools(lineEdit_ChatInput, myConfig, INET_LOBBY_CHAT, textBrowser_ChatDisplay, treeWidget_NickList, this);
|
||||
|
||||
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
|
||||
|
||||
//wait start game message
|
||||
@@ -76,15 +75,31 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
headerList << tr("Game") << tr("Players") << tr("State") << tr("R") << tr("P");
|
||||
myGameListModel->setHorizontalHeaderLabels(headerList);
|
||||
|
||||
treeView_GameList->setColumnWidth(0,220);
|
||||
treeView_GameList->setColumnWidth(0,190);
|
||||
treeView_GameList->setColumnWidth(1,65);
|
||||
treeView_GameList->setColumnWidth(2,65);
|
||||
treeView_GameList->setColumnWidth(3,30);
|
||||
treeView_GameList->setColumnWidth(4,30);
|
||||
treeView_GameList->setColumnWidth(3,40);
|
||||
treeView_GameList->setColumnWidth(4,40);
|
||||
|
||||
treeView_GameList->setStyleSheet("QTreeView {background-color: white; background-image: url(\""+myAppDataPath +"gfx/gui/misc/background_gamelist.png\"); background-attachment: fixed; background-position: top center ; background-repeat: no-repeat;}");
|
||||
treeView_GameList->setAutoFillBackground(TRUE);
|
||||
|
||||
myNickListModel = new QStandardItemModel(this);
|
||||
myNickListSortFilterProxyModel = new QSortFilterProxyModel(this);
|
||||
myNickListSortFilterProxyModel->setSourceModel(myNickListModel);
|
||||
myNickListSortFilterProxyModel->setDynamicSortFilter(TRUE);
|
||||
myNickListSortFilterProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
treeView_NickList->setModel(myNickListSortFilterProxyModel);
|
||||
myNickListSelectionModel = treeView_NickList->selectionModel();
|
||||
|
||||
QStringList headerList2;
|
||||
headerList2 << tr("Available Players");
|
||||
myNickListModel->setHorizontalHeaderLabels(headerList2);
|
||||
treeView_NickList->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
myChat = new ChatTools(lineEdit_ChatInput, myConfig, INET_LOBBY_CHAT, textBrowser_ChatDisplay, myNickListModel, this);
|
||||
|
||||
nickListContextMenu = new QMenu();
|
||||
nickListInviteAction = new QAction(QIcon(":/gfx/list_add_user.png"), tr("Invite player"), nickListContextMenu);
|
||||
nickListContextMenu->addAction(nickListInviteAction);
|
||||
@@ -111,10 +126,12 @@ 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( treeWidget_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) );
|
||||
connect( treeView_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) );
|
||||
connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() ));
|
||||
connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() ));
|
||||
connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged()));
|
||||
|
||||
lineEdit_searchForPlayers->installEventFilter(this);
|
||||
lineEdit_ChatInput->installEventFilter(this);
|
||||
|
||||
clearDialog();
|
||||
@@ -315,17 +332,23 @@ void gameLobbyDialogImpl::refresh(int actionID) {
|
||||
myGameListSelectionModel->clear();
|
||||
myGameListSelectionModel->clearSelection();
|
||||
myGameListSortFilterProxyModel->clear();
|
||||
|
||||
treeWidget_NickList->clear();
|
||||
|
||||
myNickListModel->clear();
|
||||
myNickListSelectionModel->clear();
|
||||
myNickListSelectionModel->clearSelection();;
|
||||
|
||||
QStringList headerList;
|
||||
headerList << tr("Game") << tr("Players") << tr("State") << tr("T") << tr("P");
|
||||
myGameListModel->setHorizontalHeaderLabels(headerList);
|
||||
treeView_GameList->setColumnWidth(0,220);
|
||||
treeView_GameList->setColumnWidth(0,190);
|
||||
treeView_GameList->setColumnWidth(1,65);
|
||||
treeView_GameList->setColumnWidth(2,65);
|
||||
treeView_GameList->setColumnWidth(3,30);
|
||||
treeView_GameList->setColumnWidth(4,30);
|
||||
treeView_GameList->setColumnWidth(3,40);
|
||||
treeView_GameList->setColumnWidth(4,40);
|
||||
|
||||
QStringList headerList2;
|
||||
headerList2 << tr("Available Players");
|
||||
myNickListModel->setHorizontalHeaderLabels(headerList2);
|
||||
|
||||
this->accept();
|
||||
myW->show();
|
||||
@@ -570,7 +593,7 @@ void gameLobbyDialogImpl::refreshGameStats() {
|
||||
void gameLobbyDialogImpl::refreshPlayerStats() {
|
||||
|
||||
ServerStats stats = mySession->getClientStats();
|
||||
label_connectedPlayersCounter->setText(tr("connected players: %1").arg(treeWidget_NickList->topLevelItemCount()));
|
||||
label_connectedPlayersCounter->setText(tr("connected players: %1").arg(myNickListModel->rowCount()));
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::gameAddPlayer(unsigned gameId, unsigned playerId)
|
||||
@@ -676,16 +699,24 @@ void gameLobbyDialogImpl::clearDialog()
|
||||
QStringList headerList;
|
||||
headerList << tr("Game") << tr("Players") << tr("State") << tr("T") << tr("P");
|
||||
myGameListModel->setHorizontalHeaderLabels(headerList);
|
||||
treeView_GameList->setColumnWidth(0,220);
|
||||
treeView_GameList->setColumnWidth(0,190);
|
||||
treeView_GameList->setColumnWidth(1,65);
|
||||
treeView_GameList->setColumnWidth(2,65);
|
||||
treeView_GameList->setColumnWidth(3,30);
|
||||
treeView_GameList->setColumnWidth(4,30);
|
||||
treeView_GameList->setColumnWidth(3,40);
|
||||
treeView_GameList->setColumnWidth(4,40);
|
||||
|
||||
pushButton_CreateGame->clearFocus();
|
||||
lineEdit_ChatInput->setFocus();
|
||||
myChat->clearChat();
|
||||
treeWidget_NickList->clear();
|
||||
|
||||
myNickListModel->clear();
|
||||
myNickListSelectionModel->clear();
|
||||
myNickListSelectionModel->clearSelection();;
|
||||
QStringList headerList2;
|
||||
headerList2 << tr("Available Players");
|
||||
myNickListModel->setHorizontalHeaderLabels(headerList2);
|
||||
myNickListModel->sort(0, treeView_NickList->header()->sortIndicatorOrder());
|
||||
|
||||
inGame = false;
|
||||
isGameAdministrator = false;
|
||||
myPlayerId = 0;
|
||||
@@ -830,22 +861,21 @@ void gameLobbyDialogImpl::updatePlayer(unsigned playerId, QString newPlayerName)
|
||||
|
||||
//also rename player in nick-list
|
||||
QString oldNick;
|
||||
QTreeWidgetItemIterator it1(treeWidget_NickList);
|
||||
while (*it1) {
|
||||
if ((*it1)->data(0, Qt::UserRole) == playerId)
|
||||
{
|
||||
oldNick = (*it1)->data(0, Qt::DisplayRole).toString();
|
||||
(*it1)->setData(0, Qt::DisplayRole, newPlayerName);
|
||||
int it1 = 0;
|
||||
while (myNickListModel->item(it1)) {
|
||||
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) {
|
||||
(*it1)->setIcon(0, QIcon(QString(":/cflags/cflags/%1.png").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).countryCode.c_str()).toLower())));
|
||||
myNickListModel->item(it1, 0)->setIcon(QIcon(QString(":/cflags/cflags/%1.png").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).countryCode.c_str()).toLower())));
|
||||
}
|
||||
else {
|
||||
(*it1)->setIcon(0, QIcon());
|
||||
myNickListModel->item(it1, 0)->setIcon(QIcon());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
++it1;
|
||||
}
|
||||
|
||||
@@ -871,17 +901,15 @@ void gameLobbyDialogImpl::removePlayer(unsigned playerId, QString) {
|
||||
|
||||
void gameLobbyDialogImpl::playerLeftLobby(unsigned playerId)
|
||||
{
|
||||
QTreeWidgetItemIterator it(treeWidget_NickList);
|
||||
while (*it) {
|
||||
if ((*it)->data(0, Qt::UserRole) == playerId)
|
||||
{
|
||||
treeWidget_NickList->takeTopLevelItem(treeWidget_NickList->indexOfTopLevelItem(*it));
|
||||
int it1 = 0;
|
||||
while (myNickListModel->item(it1)) {
|
||||
if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) {
|
||||
myNickListModel->removeRow(it1);;
|
||||
break;
|
||||
}
|
||||
++it;
|
||||
++it1;
|
||||
}
|
||||
|
||||
treeWidget_NickList->sortItems(0, Qt::AscendingOrder);
|
||||
refreshPlayerStats();
|
||||
}
|
||||
|
||||
@@ -889,12 +917,12 @@ void gameLobbyDialogImpl::playerJoinedLobby(unsigned playerId, QString /*playerN
|
||||
{
|
||||
PlayerInfo playerInfo(mySession->getClientPlayerInfo(playerId));
|
||||
|
||||
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(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).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())));
|
||||
myNickListModel->appendRow(item);
|
||||
|
||||
treeWidget_NickList->sortItems(0, Qt::AscendingOrder);
|
||||
refreshPlayerStats();
|
||||
}
|
||||
|
||||
@@ -1115,12 +1143,17 @@ void gameLobbyDialogImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||
bool gameLobbyDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
|
||||
QFocusEvent *focusEvent = static_cast<QFocusEvent*>(event);
|
||||
|
||||
if (obj == lineEdit_ChatInput && lineEdit_ChatInput->text() != "" && event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Tab)
|
||||
{
|
||||
if (obj == lineEdit_ChatInput && lineEdit_ChatInput->text() != "" && event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Tab) {
|
||||
myChat->nickAutoCompletition();
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
else if (obj == lineEdit_searchForPlayers && focusEvent->gotFocus() && lineEdit_searchForPlayers->text() == tr("search for player ...")) {
|
||||
lineEdit_searchForPlayers->clear();
|
||||
return QDialog::eventFilter(obj, event);
|
||||
}
|
||||
else {
|
||||
// pass the event on to the parent class
|
||||
return QDialog::eventFilter(obj, event);
|
||||
}
|
||||
@@ -1368,11 +1401,10 @@ void gameLobbyDialogImpl::guestUserMode()
|
||||
|
||||
void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
||||
{
|
||||
if(treeWidget_NickList->topLevelItemCount() && !treeWidget_NickList->selectedItems().isEmpty()) {
|
||||
|
||||
if(myNickListModel->rowCount() && myNickListSelectionModel->currentIndex().isValid()) {
|
||||
|
||||
assert(mySession);
|
||||
int playerUid = treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt();
|
||||
int playerUid = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt();
|
||||
|
||||
if(inGame && mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY && playerUid != mySession->getClientUniquePlayerId() && !mySession->getClientPlayerInfo(playerUid).isGuest) {
|
||||
|
||||
@@ -1407,14 +1439,14 @@ void gameLobbyDialogImpl::showNickListContextMenu(QPoint p)
|
||||
}
|
||||
nickListPlayerInGameInfo->setText(playerInGameInfoString);
|
||||
|
||||
nickListContextMenu->popup(treeWidget_NickList->mapToGlobal(p));
|
||||
nickListContextMenu->popup(treeView_NickList->mapToGlobal(p));
|
||||
}
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
||||
{
|
||||
if(!treeWidget_NickList->selectedItems().isEmpty()) {
|
||||
mySession->invitePlayerToCurrentGame(treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt());
|
||||
if(myNickListSelectionModel->currentIndex().isValid()) {
|
||||
mySession->invitePlayerToCurrentGame(myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1488,9 +1520,9 @@ bool gameLobbyDialogImpl::playerIsOnIgnoreList(unsigned playerId) {
|
||||
|
||||
void gameLobbyDialogImpl::putPlayerOnIgnoreList() {
|
||||
|
||||
if(!treeWidget_NickList->selectedItems().isEmpty()) {
|
||||
if(myNickListSelectionModel->currentIndex().isValid()) {
|
||||
|
||||
unsigned playerId = treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt();
|
||||
unsigned playerId = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt();
|
||||
|
||||
if(!playerIsOnIgnoreList(playerId)) {
|
||||
|
||||
@@ -1508,3 +1540,9 @@ void gameLobbyDialogImpl::putPlayerOnIgnoreList() {
|
||||
}
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::searchForPlayerRegExpChanged()
|
||||
{
|
||||
QRegExp regExp(lineEdit_searchForPlayers->text(), Qt::CaseInsensitive);
|
||||
myNickListSortFilterProxyModel->setFilterRegExp(regExp);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ public slots:
|
||||
void chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||
void putPlayerOnIgnoreList();
|
||||
bool playerIsOnIgnoreList(unsigned playerid);
|
||||
void searchForPlayerRegExpChanged();
|
||||
|
||||
private:
|
||||
|
||||
@@ -148,6 +149,9 @@ private:
|
||||
int currentInvitationGameId;
|
||||
bool inviteDialogIsCurrentlyShown;
|
||||
|
||||
QStandardItemModel *myNickListModel;
|
||||
QItemSelectionModel *myNickListSelectionModel;
|
||||
QSortFilterProxyModel *myNickListSortFilterProxyModel;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
Reference in New Issue
Block a user