first steps on #140 - needs testing. switch to hardcoded testing server for 1.0 beta

This commit is contained in:
doitux
2012-12-07 11:17:07 +01:00
parent cebbc667e1
commit 79d449c65f
4 changed files with 37 additions and 16 deletions
@@ -114,15 +114,16 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
myGameListSelectionModel = treeView_GameList->selectionModel(); myGameListSelectionModel = treeView_GameList->selectionModel();
QStringList headerList; QStringList headerList;
headerList << tr("Game") << tr("Players") << tr("State") << tr("T") << tr("P"); headerList << tr("Game") << tr("Players") << tr("State") << tr("T") << tr("P") << tr("Time");
myGameListModel->setHorizontalHeaderLabels(headerList); myGameListModel->setHorizontalHeaderLabels(headerList);
#ifdef GUI_800x480 #ifdef GUI_800x480
treeView_GameList->setColumnWidth(0,220); treeView_GameList->setColumnWidth(0,220);
treeView_GameList->setColumnWidth(1,65); treeView_GameList->setColumnWidth(1,55);
treeView_GameList->setColumnWidth(2,90); treeView_GameList->setColumnWidth(2,90);
treeView_GameList->setColumnWidth(3,30); treeView_GameList->setColumnWidth(3,20);
treeView_GameList->setColumnWidth(4,30); treeView_GameList->setColumnWidth(4,20);
treeView_GameList->setColumnWidth(5,20);
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; color:rgb(0, 0, 0); font: 22px}"); 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; color:rgb(0, 0, 0); font: 22px}");
treeView_GameList->header()->setStyleSheet("QObject {font: bold 18px}"); treeView_GameList->header()->setStyleSheet("QObject {font: bold 18px}");
@@ -136,10 +137,11 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
label_typeText->hide(); label_typeText->hide();
#else #else
treeView_GameList->setColumnWidth(0,190); treeView_GameList->setColumnWidth(0,190);
treeView_GameList->setColumnWidth(1,65); treeView_GameList->setColumnWidth(1,55);
treeView_GameList->setColumnWidth(2,65); treeView_GameList->setColumnWidth(2,65);
treeView_GameList->setColumnWidth(3,40); treeView_GameList->setColumnWidth(3,30);
treeView_GameList->setColumnWidth(4,40); treeView_GameList->setColumnWidth(4,30);
treeView_GameList->setColumnWidth(5,20);
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->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;}");
#endif #endif
@@ -553,6 +555,7 @@ void gameLobbyDialogImpl::updateGameItem(QList <QStandardItem*> itemList, unsign
itemList.at(2)->setBackground(QBrush(QColor(0, 255, 0, 127))); itemList.at(2)->setBackground(QBrush(QColor(0, 255, 0, 127)));
itemList.at(3)->setBackground(QBrush(QColor(0, 255, 0, 127))); itemList.at(3)->setBackground(QBrush(QColor(0, 255, 0, 127)));
itemList.at(4)->setBackground(QBrush(QColor(0, 255, 0, 127))); itemList.at(4)->setBackground(QBrush(QColor(0, 255, 0, 127)));
itemList.at(5)->setBackground(QBrush(QColor(0, 255, 0, 127)));
break; break;
} else { } else {
itemList.at(0)->setData( "", 16); itemList.at(0)->setData( "", 16);
@@ -561,6 +564,7 @@ void gameLobbyDialogImpl::updateGameItem(QList <QStandardItem*> itemList, unsign
itemList.at(2)->setBackground(QBrush()); itemList.at(2)->setBackground(QBrush());
itemList.at(3)->setBackground(QBrush()); itemList.at(3)->setBackground(QBrush());
itemList.at(4)->setBackground(QBrush()); itemList.at(4)->setBackground(QBrush());
itemList.at(5)->setBackground(QBrush());
} }
++i; ++i;
} }
@@ -598,7 +602,7 @@ void gameLobbyDialogImpl::updateGameItem(QList <QStandardItem*> itemList, unsign
case GAME_TYPE_INVITE_ONLY: { case GAME_TYPE_INVITE_ONLY: {
itemList.at(3)->setIcon(QIcon(":/gfx/list_add_user.png")); itemList.at(3)->setIcon(QIcon(":/gfx/list_add_user.png"));
itemList.at(3)->setData(" ", Qt::DisplayRole); itemList.at(3)->setData(" ", Qt::DisplayRole);
itemList.at(3)->setData("invited", 16); itemList.at(3)->setData("invited", 16);
} }
break; break;
case GAME_TYPE_RANKING: { case GAME_TYPE_RANKING: {
@@ -618,6 +622,9 @@ void gameLobbyDialogImpl::updateGameItem(QList <QStandardItem*> itemList, unsign
itemList.at(4)->setData("nonpriv", 16); itemList.at(4)->setData("nonpriv", 16);
} }
itemList.at(5)->setData(QString::number(info.data.playerActionTimeoutSec)+"s/"+QString::number(info.data.delayBetweenHandsSec)+"s", Qt::DisplayRole);
itemList.at(5)->setData(QString::number(info.data.playerActionTimeoutSec), 16);
// treeView_GameList->sortByColumn(myConfig->readConfigInt("DlgGameLobbyGameListSortingSection"), (Qt::SortOrder)myConfig->readConfigInt("DlgGameLobbyGameListSortingOrder") ); // treeView_GameList->sortByColumn(myConfig->readConfigInt("DlgGameLobbyGameListSortingSection"), (Qt::SortOrder)myConfig->readConfigInt("DlgGameLobbyGameListSortingOrder") );
refreshGameStats(); refreshGameStats();
} }
@@ -630,7 +637,8 @@ void gameLobbyDialogImpl::addGame(unsigned gameId)
QStandardItem *item3 = new QStandardItem(); QStandardItem *item3 = new QStandardItem();
QStandardItem *item4 = new QStandardItem(); QStandardItem *item4 = new QStandardItem();
QStandardItem *item5 = new QStandardItem(); QStandardItem *item5 = new QStandardItem();
itemList << item1 << item2 << item3 << item4 << item5; QStandardItem *item6 = new QStandardItem();
itemList << item1 << item2 << item3 << item4 << item5 << item6;
myGameListModel->appendRow(itemList); myGameListModel->appendRow(itemList);
@@ -644,7 +652,7 @@ void gameLobbyDialogImpl::updateGameMode(unsigned gameId, int /*newMode*/)
while (myGameListModel->item(it)) { while (myGameListModel->item(it)) {
if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) {
QList <QStandardItem*> itemList; QList <QStandardItem*> itemList;
itemList << myGameListModel->item(it, 0) << myGameListModel->item(it, 1) << myGameListModel->item(it, 2) << myGameListModel->item(it, 3) << myGameListModel->item(it, 4); itemList << myGameListModel->item(it, 0) << myGameListModel->item(it, 1) << myGameListModel->item(it, 2) << myGameListModel->item(it, 3) << myGameListModel->item(it, 4) << myGameListModel->item(it, 5);;
updateGameItem(itemList, gameId); updateGameItem(itemList, gameId);
break; break;
} }
@@ -1490,6 +1498,7 @@ void gameLobbyDialogImpl::changeGameListFilter(int index)
myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp());
} }
break; break;
case 1: { case 1: {
@@ -1497,6 +1506,7 @@ void gameLobbyDialogImpl::changeGameListFilter(int index)
myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp());
} }
break; break;
case 2: { case 2: {
@@ -1504,6 +1514,7 @@ void gameLobbyDialogImpl::changeGameListFilter(int index)
myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp());
} }
break; break;
case 3: { case 3: {
@@ -1511,6 +1522,7 @@ void gameLobbyDialogImpl::changeGameListFilter(int index)
myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("nonpriv", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("nonpriv", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp());
} }
break; break;
case 4: { case 4: {
@@ -1518,6 +1530,7 @@ void gameLobbyDialogImpl::changeGameListFilter(int index)
myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("private", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("private", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp());
} }
break; break;
case 5: { case 5: {
@@ -1525,6 +1538,7 @@ void gameLobbyDialogImpl::changeGameListFilter(int index)
myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp("ranking", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp("ranking", Qt::CaseInsensitive, QRegExp::FixedString));
myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp());
myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp());
} }
break; break;
default: default:
@@ -32,10 +32,12 @@ bool MyGameListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QMode
QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent); QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent); QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);
QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent); QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent);
QModelIndex index5 = sourceModel()->index(sourceRow, 5, sourceParent);
return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp) return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp)
&& sourceModel()->data(index2, 16).toString().contains(column2RegExp) && sourceModel()->data(index2, 16).toString().contains(column2RegExp)
&& sourceModel()->data(index3, 16).toString().contains(column3RegExp) && sourceModel()->data(index3, 16).toString().contains(column3RegExp)
&& sourceModel()->data(index4, 16).toString().contains(column4RegExp)) || sourceModel()->data(index0, 16) == "MeInThisGame"); && sourceModel()->data(index4, 16).toString().contains(column4RegExp)
&& sourceModel()->data(index5, 16).toString().contains(column5RegExp)) || sourceModel()->data(index0, 16) == "MeInThisGame");
} }
@@ -38,6 +38,9 @@ public:
void setColumn4RegExp(QRegExp column4) { void setColumn4RegExp(QRegExp column4) {
column4RegExp = column4; column4RegExp = column4;
} }
void setColumn5RegExp(QRegExp column5) {
column5RegExp = column5;
}
protected: protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
@@ -47,6 +50,7 @@ private:
QRegExp column2RegExp; QRegExp column2RegExp;
QRegExp column3RegExp; QRegExp column3RegExp;
QRegExp column4RegExp; QRegExp column4RegExp;
QRegExp column5RegExp;
}; };
+6 -5
View File
@@ -90,7 +90,8 @@ void Session::startLocalGame(const GameData &gameData, const StartData &startDat
myGameType = GAME_TYPE_LOCAL; myGameType = GAME_TYPE_LOCAL;
currentGame.reset(); currentGame.reset();
currentGameNum++;
currentGameNum++;
myGui->initGui(gameData.guiSpeed); myGui->initGui(gameData.guiSpeed);
@@ -175,11 +176,11 @@ void Session::startInternetClient()
myNetClient->Init( myNetClient->Init(
myConfig->readConfigString("InternetServerAddress"), myConfig->readConfigString("InternetServerAddress"),
myConfig->readConfigString("InternetServerListAddress"), // myConfig->readConfigString("InternetServerListAddress"),
// "pokerth.net/serverlist_testing.xml.z", "pokerth.net/serverlist_testing.xml.z",
myConfig->readConfigString("ServerPassword"), myConfig->readConfigString("ServerPassword"),
myConfig->readConfigInt("InternetServerConfigMode") == 0, // myConfig->readConfigInt("InternetServerConfigMode") == 0,
// true, true,
myConfig->readConfigInt("InternetServerPort"), myConfig->readConfigInt("InternetServerPort"),
myConfig->readConfigInt("InternetServerUseIpv6") == 1, myConfig->readConfigInt("InternetServerUseIpv6") == 1,
myConfig->readConfigInt("InternetServerUseSctp") == 1, myConfig->readConfigInt("InternetServerUseSctp") == 1,