diff --git a/data/gfx/gui/table/default_800x480/table.png b/data/gfx/gui/table/default_800x480/table.png old mode 100755 new mode 100644 index 661f24e0..99b32c74 Binary files a/data/gfx/gui/table/default_800x480/table.png and b/data/gfx/gui/table/default_800x480/table.png differ diff --git a/data/gfx/gui/table/default_800x480/table_dark.png b/data/gfx/gui/table/default_800x480/table_dark.png index 783a2ba4..2a8337e4 100644 Binary files a/data/gfx/gui/table/default_800x480/table_dark.png and b/data/gfx/gui/table/default_800x480/table_dark.png differ diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index 31bbb54d..a1c41506 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -33,89 +33,94 @@ using namespace std; gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) - : 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), autoStartTimerCounter(0), lastNickListFilterState(0) + : 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), autoStartTimerCounter(0), lastNickListFilterState(0) { #ifdef __APPLE__ - setWindowModality(Qt::ApplicationModal); - setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); + setWindowModality(Qt::ApplicationModal); + setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); #elif _WIN32 setWindowFlags(Qt::Dialog | Qt::WindowMinimizeButtonHint); #endif setupUi(this); - myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); + myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); - //wait start game message + //wait start game message waitStartGameMsgBox = new MyMessageBox(this); - waitStartGameMsgBox->setText(tr("Starting game. Please wait ...")); + waitStartGameMsgBox->setText(tr("Starting game. Please wait ...")); #ifndef ANDROID waitStartGameMsgBox->setWindowModality(Qt::NonModal); #endif #ifdef __APPLE__ - waitStartGameMsgBox->setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); + waitStartGameMsgBox->setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); #endif - waitStartGameMsgBox->setStandardButtons(QMessageBox::NoButton); + waitStartGameMsgBox->setStandardButtons(QMessageBox::NoButton); - //wait start game message for rejoin + //wait start game message for rejoin waitRejoinStartGameMsgBox = new MyMessageBox(this); - waitRejoinStartGameMsgBox->setText(tr("Waiting for the start of the next hand to rejoin the game ...")); + waitRejoinStartGameMsgBox->setText(tr("Waiting for the start of the next hand to rejoin the game ...")); #ifndef ANDROID waitRejoinStartGameMsgBox->setWindowModality(Qt::NonModal); #endif #ifdef __APPLE__ - waitRejoinStartGameMsgBox->setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); + waitRejoinStartGameMsgBox->setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); #endif - waitRejoinStartGameMsgBox->setStandardButtons(QMessageBox::NoButton); + waitRejoinStartGameMsgBox->setStandardButtons(QMessageBox::NoButton); - inviteOnlyInfoMsgBox = new myMessageDialogImpl(myConfig, this); + inviteOnlyInfoMsgBox = new myMessageDialogImpl(myConfig, this); + + //HTML stuff + QString pokerthDotNet("http://www.pokerth.net"); + QString clickToRanking(QString("%1").arg(tr("Click here to view the online rankings"))); + label_pokerthDotNet->setText(pokerthDotNet); + label_rankings->setText(clickToRanking); + + waitStartGameMsgBoxTimer = new QTimer(this); + waitStartGameMsgBoxTimer->setSingleShot(TRUE); + blinkingButtonAnimationTimer = new QTimer(this); + blinkingButtonAnimationTimer->setInterval(1000); + autoStartTimer = new QTimer(this); + autoStartTimer->setInterval(1000); + showInfoMsgBoxTimer = new QTimer(this); + showInfoMsgBoxTimer->setSingleShot(TRUE); + + //fetch button colors for blinking + groupBox_GameInfo->setEnabled(true); + pushButton_StartGame->setEnabled(true); + defaultStartButtonColor = pushButton_StartGame->palette().button().color(); + defaultStartButtonTextColor = pushButton_StartGame->palette().buttonText().color(); + pushButton_StartGame->setEnabled(false); + groupBox_GameInfo->setEnabled(false); + disabledStartButtonColor = pushButton_StartGame->palette().button().color(); + disabledStartButtonTextColor = pushButton_StartGame->palette().buttonText().color(); + + //prepare overlay + autoStartTimerOverlay = new QLabel(scrollArea_gameInfos); + autoStartTimerOverlay->hide(); + autoStartTimerOverlay->setWordWrap(TRUE); + autoStartTimerOverlay->setMaximumWidth(190); + autoStartTimerOverlay->setMinimumWidth(190); + autoStartTimerOverlay->setTextFormat(Qt::RichText); + autoStartTimerOverlay->setAlignment(Qt::AlignCenter); + autoStartTimerOverlay->setAutoFillBackground(TRUE); + autoStartTimerOverlay->setFrameStyle(QFrame::StyledPanel); + QPalette p; + p.setColor(QPalette::Background, QColor(255, 255, 255, 210)); + autoStartTimerOverlay->setPalette(p); - waitStartGameMsgBoxTimer = new QTimer(this); - waitStartGameMsgBoxTimer->setSingleShot(TRUE); - blinkingButtonAnimationTimer = new QTimer(this); - blinkingButtonAnimationTimer->setInterval(1000); - autoStartTimer = new QTimer(this); - autoStartTimer->setInterval(1000); - showInfoMsgBoxTimer = new QTimer(this); - showInfoMsgBoxTimer->setSingleShot(TRUE); + myGameListModel = new QStandardItemModel(this); + myGameListSortFilterProxyModel = new MyGameListSortFilterProxyModel(this); + myGameListSortFilterProxyModel->setSourceModel(myGameListModel); + myGameListSortFilterProxyModel->setDynamicSortFilter(TRUE); + treeView_GameList->setModel(myGameListSortFilterProxyModel); - //fetch button colors for blinking - groupBox_GameInfo->setEnabled(true); - pushButton_StartGame->setEnabled(true); - defaultStartButtonColor = pushButton_StartGame->palette().button().color(); - defaultStartButtonTextColor = pushButton_StartGame->palette().buttonText().color(); - pushButton_StartGame->setEnabled(false); - groupBox_GameInfo->setEnabled(false); - disabledStartButtonColor = pushButton_StartGame->palette().button().color(); - disabledStartButtonTextColor = pushButton_StartGame->palette().buttonText().color(); + myGameListSelectionModel = treeView_GameList->selectionModel(); - //prepare overlay - autoStartTimerOverlay = new QLabel(scrollArea_gameInfos); - autoStartTimerOverlay->hide(); - autoStartTimerOverlay->setWordWrap(TRUE); - autoStartTimerOverlay->setMaximumWidth(190); - autoStartTimerOverlay->setMinimumWidth(190); - autoStartTimerOverlay->setTextFormat(Qt::RichText); - autoStartTimerOverlay->setAlignment(Qt::AlignCenter); - autoStartTimerOverlay->setAutoFillBackground(TRUE); - autoStartTimerOverlay->setFrameStyle(QFrame::StyledPanel); - QPalette p; - p.setColor(QPalette::Background, QColor(255, 255, 255, 210)); - autoStartTimerOverlay->setPalette(p); - - - myGameListModel = new QStandardItemModel(this); - myGameListSortFilterProxyModel = new MyGameListSortFilterProxyModel(this); - myGameListSortFilterProxyModel->setSourceModel(myGameListModel); - myGameListSortFilterProxyModel->setDynamicSortFilter(TRUE); - treeView_GameList->setModel(myGameListSortFilterProxyModel); - - myGameListSelectionModel = treeView_GameList->selectionModel(); - - QStringList headerList; + QStringList headerList; headerList << tr("Game") << tr("Players") << tr("State") << tr("T") << tr("P") << tr("Time"); - myGameListModel->setHorizontalHeaderLabels(headerList); + myGameListModel->setHorizontalHeaderLabels(headerList); #ifdef GUI_800x480 treeView_GameList->setColumnWidth(0,220); @@ -135,6 +140,17 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) label_gameType->hide(); label_typeIcon->hide(); label_typeText->hide(); + + //set colors + QPalette p1; + p1.setColor(QPalette::WindowText, this->palette().color(QPalette::Link)); + label_StartCash->setPalette(p1); + label_blindsList->setPalette(p1); + label_blindsRaiseIntervall->setPalette(p1); + label_blindsRaiseMode->setPalette(p1); + label_GameTiming->setPalette(p1); + label_SmallBlind->setPalette(p1); + #else treeView_GameList->setColumnWidth(0,190); treeView_GameList->setColumnWidth(1,55); @@ -145,284 +161,284 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) 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 - treeView_GameList->setAutoFillBackground(TRUE); + treeView_GameList->setAutoFillBackground(TRUE); - myNickListModel = new QStandardItemModel(this); - myNickListSortFilterProxyModel = new MyNickListSortFilterProxyModel(this); - myNickListSortFilterProxyModel->setSourceModel(myNickListModel); - myNickListSortFilterProxyModel->setDynamicSortFilter(TRUE); - myNickListSortFilterProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); + myNickListModel = new QStandardItemModel(this); + myNickListSortFilterProxyModel = new MyNickListSortFilterProxyModel(this); + myNickListSortFilterProxyModel->setSourceModel(myNickListModel); + myNickListSortFilterProxyModel->setDynamicSortFilter(TRUE); + myNickListSortFilterProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); - treeView_NickList->setModel(myNickListSortFilterProxyModel); - myNickListSelectionModel = treeView_NickList->selectionModel(); + treeView_NickList->setModel(myNickListSortFilterProxyModel); + myNickListSelectionModel = treeView_NickList->selectionModel(); - QStringList headerList2; - headerList2 << tr("Available Players"); - myNickListModel->setHorizontalHeaderLabels(headerList2); - treeView_NickList->sortByColumn(0, Qt::AscendingOrder); + 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); + 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); - nickListIgnorePlayerAction = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore player"), nickListContextMenu); - nickListContextMenu->addAction(nickListIgnorePlayerAction); - nickListPlayerInfoSubMenu = nickListContextMenu->addMenu(QIcon(":/gfx/dialog-information.png"), tr("Player infos ...")); - nickListPlayerInGameInfo = new QAction(nickListContextMenu); - nickListPlayerInfoSubMenu->addAction(nickListPlayerInGameInfo); - nickListOpenPlayerStats1 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu); - nickListContextMenu->addAction(nickListOpenPlayerStats1); + nickListContextMenu = new QMenu(); + nickListInviteAction = new QAction(QIcon(":/gfx/list_add_user.png"), tr("Invite player"), nickListContextMenu); + nickListContextMenu->addAction(nickListInviteAction); + nickListIgnorePlayerAction = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore player"), nickListContextMenu); + nickListContextMenu->addAction(nickListIgnorePlayerAction); + nickListPlayerInfoSubMenu = nickListContextMenu->addMenu(QIcon(":/gfx/dialog-information.png"), tr("Player infos ...")); + nickListPlayerInGameInfo = new QAction(nickListContextMenu); + nickListPlayerInfoSubMenu->addAction(nickListPlayerInGameInfo); + nickListOpenPlayerStats1 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu); + nickListContextMenu->addAction(nickListOpenPlayerStats1); - connectedPlayersListPlayerInfoSubMenu = new QMenu(); - nickListOpenPlayerStats2 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu); - connectedPlayersListPlayerInfoSubMenu->addAction(nickListOpenPlayerStats2); + connectedPlayersListPlayerInfoSubMenu = new QMenu(); + nickListOpenPlayerStats2 = new QAction(QIcon(":/gfx/view-statistics.png"), tr("Show player stats"), nickListContextMenu); + connectedPlayersListPlayerInfoSubMenu->addAction(nickListOpenPlayerStats2); - gameListContextMenu = new QMenu(); - gameListReportBadGameNameAction = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report inappropriate game name"), gameListContextMenu); - gameListContextMenu->addAction(gameListReportBadGameNameAction); + gameListContextMenu = new QMenu(); + gameListReportBadGameNameAction = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report inappropriate game name"), gameListContextMenu); + gameListContextMenu->addAction(gameListReportBadGameNameAction); - connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) ); - connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) ); - connect( pushButton_joinAnyGame, SIGNAL( clicked() ), this, SLOT( joinAnyGame() ) ); - connect( pushButton_StartGame, SIGNAL( clicked() ), this, SLOT( startGame() ) ); - connect( pushButton_Kick, SIGNAL( clicked() ), this, SLOT( kickPlayer() ) ); - connect( pushButton_Leave, SIGNAL( clicked() ), this, SLOT( leaveGame() ) ); - connect( myGameListSelectionModel, SIGNAL( currentChanged (const QModelIndex &, const QModelIndex &) ), this, SLOT( gameSelected(const QModelIndex &) ) ); - connect( treeView_GameList, SIGNAL( doubleClicked (const QModelIndex &) ), this, SLOT( joinGame() ) ); - connect( treeView_GameList->header(), SIGNAL( sortIndicatorChanged ( int , Qt::SortOrder )), this, SLOT( changeGameListSorting() ) ); - connect( treeWidget_connectedPlayers, SIGNAL( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT( playerSelected(QTreeWidgetItem*, QTreeWidgetItem*) ) ); - connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), myChat, SLOT( sendMessage() ) ); - connect( lineEdit_ChatInput, SIGNAL( textChanged (QString) ), myChat, SLOT( checkInputLength(QString) ) ); - connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) ); - connect( waitStartGameMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showWaitStartGameMsgBox() )); - connect( blinkingButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimation() )); - connect( autoStartTimer, SIGNAL(timeout()), this, SLOT( updateAutoStartTimer() )); - 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( treeWidget_connectedPlayers, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showConnectedPlayersContextMenu(QPoint) ) ); - connect( treeView_GameList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showGameListContextMenu(QPoint) ) ); - connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() )); - connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() )); - connect( nickListOpenPlayerStats1, SIGNAL(triggered()), this, SLOT( openPlayerStats1() )); - connect( nickListOpenPlayerStats2, SIGNAL(triggered()), this, SLOT( openPlayerStats2() )); - connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged())); - connect( gameListReportBadGameNameAction, SIGNAL(triggered()), this, SLOT( reportBadGameName())); + connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) ); + connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) ); + connect( pushButton_joinAnyGame, SIGNAL( clicked() ), this, SLOT( joinAnyGame() ) ); + connect( pushButton_StartGame, SIGNAL( clicked() ), this, SLOT( startGame() ) ); + connect( pushButton_Kick, SIGNAL( clicked() ), this, SLOT( kickPlayer() ) ); + connect( pushButton_Leave, SIGNAL( clicked() ), this, SLOT( leaveGame() ) ); + connect( myGameListSelectionModel, SIGNAL( currentChanged (const QModelIndex &, const QModelIndex &) ), this, SLOT( gameSelected(const QModelIndex &) ) ); + connect( treeView_GameList, SIGNAL( doubleClicked (const QModelIndex &) ), this, SLOT( joinGame() ) ); + connect( treeView_GameList->header(), SIGNAL( sortIndicatorChanged ( int , Qt::SortOrder )), this, SLOT( changeGameListSorting() ) ); + connect( treeWidget_connectedPlayers, SIGNAL( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT( playerSelected(QTreeWidgetItem*, QTreeWidgetItem*) ) ); + connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), myChat, SLOT( sendMessage() ) ); + connect( lineEdit_ChatInput, SIGNAL( textChanged (QString) ), myChat, SLOT( checkInputLength(QString) ) ); + connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) ); + connect( waitStartGameMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showWaitStartGameMsgBox() )); + connect( blinkingButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimation() )); + connect( autoStartTimer, SIGNAL(timeout()), this, SLOT( updateAutoStartTimer() )); + 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( treeWidget_connectedPlayers, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showConnectedPlayersContextMenu(QPoint) ) ); + connect( treeView_GameList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showGameListContextMenu(QPoint) ) ); + connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() )); + connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() )); + connect( nickListOpenPlayerStats1, SIGNAL(triggered()), this, SLOT( openPlayerStats1() )); + connect( nickListOpenPlayerStats2, SIGNAL(triggered()), this, SLOT( openPlayerStats2() )); + connect( lineEdit_searchForPlayers, SIGNAL(textChanged(QString)),this, SLOT(searchForPlayerRegExpChanged())); + connect( gameListReportBadGameNameAction, SIGNAL(triggered()), this, SLOT( reportBadGameName())); - lineEdit_searchForPlayers->installEventFilter(this); - lineEdit_ChatInput->installEventFilter(this); + lineEdit_searchForPlayers->installEventFilter(this); + lineEdit_ChatInput->installEventFilter(this); - clearDialog(); + clearDialog(); } void gameLobbyDialogImpl::exec() { - if(myConfig->readConfigInt("UseLobbyChat")) { - groupBox_lobbyChat->show(); - } else { - groupBox_lobbyChat->hide(); - } - readDialogSettings(); + if(myConfig->readConfigInt("UseLobbyChat")) { + groupBox_lobbyChat->show(); + } else { + groupBox_lobbyChat->hide(); + } + readDialogSettings(); - PlayerInfo playerInfo(mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId())); - if(playerInfo.isGuest) { - guestUserMode(); - } else { - registeredUserMode(); - } + PlayerInfo playerInfo(mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId())); + if(playerInfo.isGuest) { + guestUserMode(); + } else { + registeredUserMode(); + } #ifdef ANDROID - this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); #endif - QDialog::exec(); + QDialog::exec(); - waitStartGameMsgBoxTimer->stop(); - closeAllChildDialogs(); + waitStartGameMsgBoxTimer->stop(); + closeAllChildDialogs(); } gameLobbyDialogImpl::~gameLobbyDialogImpl() { - delete myChat; - myChat = NULL; + delete myChat; + myChat = NULL; - delete inviteOnlyInfoMsgBox; - inviteOnlyInfoMsgBox = NULL; + delete inviteOnlyInfoMsgBox; + inviteOnlyInfoMsgBox = NULL; } void gameLobbyDialogImpl::setSession(boost::shared_ptr session) { - mySession = session; - myChat->setSession(mySession); + mySession = session; + myChat->setSession(mySession); } void gameLobbyDialogImpl::createGame() { - assert(mySession); + assert(mySession); - myCreateInternetGameDialog = new createInternetGameDialogImpl(this, myConfig); - PlayerInfo playerInfo(mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId())); - myCreateInternetGameDialog->exec(guestMode, QString::fromUtf8(playerInfo.playerName.c_str())); + myCreateInternetGameDialog = new createInternetGameDialogImpl(this, myConfig); + PlayerInfo playerInfo(mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId())); + myCreateInternetGameDialog->exec(guestMode, QString::fromUtf8(playerInfo.playerName.c_str())); - if (myCreateInternetGameDialog->result() == QDialog::Accepted ) { + if (myCreateInternetGameDialog->result() == QDialog::Accepted ) { - GameData gameData; - // Set Game Data - gameData.maxNumberOfPlayers = myCreateInternetGameDialog->spinBox_quantityPlayers->value(); - gameData.startMoney = myCreateInternetGameDialog->spinBox_startCash->value(); - gameData.firstSmallBlind = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value(); + GameData gameData; + // Set Game Data + gameData.maxNumberOfPlayers = myCreateInternetGameDialog->spinBox_quantityPlayers->value(); + gameData.startMoney = myCreateInternetGameDialog->spinBox_startCash->value(); + gameData.firstSmallBlind = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value(); - if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) { - gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER; - gameData.raiseSmallBlindEveryHandsValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); - } else { - gameData.raiseIntervalMode = RAISE_ON_MINUTES; - gameData.raiseSmallBlindEveryMinutesValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryMinutes->value(); - } + if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) { + gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER; + gameData.raiseSmallBlindEveryHandsValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); + } else { + gameData.raiseIntervalMode = RAISE_ON_MINUTES; + gameData.raiseSmallBlindEveryMinutesValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryMinutes->value(); + } - if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_alwaysDoubleBlinds->isChecked()) { - gameData.raiseMode = DOUBLE_BLINDS; - } else { - gameData.raiseMode = MANUAL_BLINDS_ORDER; - std::list tempBlindList; - int i; - bool ok = TRUE; - for(i=0; igetChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) { - tempBlindList.push_back(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10)); - } - gameData.manualBlindsList = tempBlindList; + if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_alwaysDoubleBlinds->isChecked()) { + gameData.raiseMode = DOUBLE_BLINDS; + } else { + gameData.raiseMode = MANUAL_BLINDS_ORDER; + std::list tempBlindList; + int i; + bool ok = TRUE; + for(i=0; igetChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) { + tempBlindList.push_back(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10)); + } + gameData.manualBlindsList = tempBlindList; - if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysDoubleBlinds->isChecked()) { - gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS; - } else { - if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysRaiseAbout->isChecked()) { - gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT; - gameData.afterMBAlwaysRaiseValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_afterThisAlwaysRaiseValue->value(); - } else { - gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND; - } - } - } + if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysDoubleBlinds->isChecked()) { + gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS; + } else { + if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysRaiseAbout->isChecked()) { + gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT; + gameData.afterMBAlwaysRaiseValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_afterThisAlwaysRaiseValue->value(); + } else { + gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND; + } + } + } - gameData.guiSpeed = myConfig->readConfigInt("GameSpeed"); - gameData.delayBetweenHandsSec = myCreateInternetGameDialog->spinBox_netDelayBetweenHands->value(); - gameData.playerActionTimeoutSec = myCreateInternetGameDialog->spinBox_netTimeOutPlayerAction->value(); - gameData.gameType = GameType(myCreateInternetGameDialog->comboBox_gameType->itemData(myCreateInternetGameDialog->comboBox_gameType->currentIndex(), Qt::UserRole).toInt()); + gameData.guiSpeed = myConfig->readConfigInt("GameSpeed"); + gameData.delayBetweenHandsSec = myCreateInternetGameDialog->spinBox_netDelayBetweenHands->value(); + gameData.playerActionTimeoutSec = myCreateInternetGameDialog->spinBox_netTimeOutPlayerAction->value(); + gameData.gameType = GameType(myCreateInternetGameDialog->comboBox_gameType->itemData(myCreateInternetGameDialog->comboBox_gameType->currentIndex(), Qt::UserRole).toInt()); - currentGameName = myCreateInternetGameDialog->lineEdit_gameName->text().simplified(); + currentGameName = myCreateInternetGameDialog->lineEdit_gameName->text().simplified(); - switch (gameData.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; - } + switch (gameData.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); + showGameDescription(TRUE); - label_SmallBlind->setText(QString("%L1").arg(gameData.firstSmallBlind)); - label_StartCash->setText(QString("%L1").arg(gameData.startMoney)); + label_SmallBlind->setText(QString("%L1").arg(gameData.firstSmallBlind)); + label_StartCash->setText(QString("%L1").arg(gameData.startMoney)); - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players - max. %1").arg(gameData.maxNumberOfPlayers)); - header->setData(0, Qt::UserRole, gameData.maxNumberOfPlayers); + QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); + header->setText(0, tr("Connected players - max. %1").arg(gameData.maxNumberOfPlayers)); + header->setData(0, Qt::UserRole, gameData.maxNumberOfPlayers); - updateDialogBlinds(gameData); + updateDialogBlinds(gameData); - label_GameTiming->setText(QString::number(gameData.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(gameData.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); + label_GameTiming->setText(QString::number(gameData.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(gameData.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); - mySession->clientCreateGame(gameData, currentGameName.toUtf8().constData(), myCreateInternetGameDialog->lineEdit_Password->text().toUtf8().constData()); + mySession->clientCreateGame(gameData, currentGameName.toUtf8().constData(), myCreateInternetGameDialog->lineEdit_Password->text().toUtf8().constData()); - } + } } void gameLobbyDialogImpl::joinGame() { - assert(mySession); - QItemSelectionModel *selection = treeView_GameList->selectionModel(); - if (!inGame && selection->hasSelection()) { - unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt(); - GameInfo info(mySession->getClientGameInfo(gameId)); - bool ok = true; - QString password; - //if private ask for password - if (info.isPasswordProtected) { - password = QInputDialog::getText(this, tr("Joining a private Game"), - tr("You are about to join a private game. Please enter the password!"), QLineEdit::Password, (""), &ok); - } + assert(mySession); + QItemSelectionModel *selection = treeView_GameList->selectionModel(); + if (!inGame && selection->hasSelection()) { + unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt(); + GameInfo info(mySession->getClientGameInfo(gameId)); + bool ok = true; + QString password; + //if private ask for password + if (info.isPasswordProtected) { + password = QInputDialog::getText(this, tr("Joining a private Game"), + tr("You are about to join a private game. Please enter the password!"), QLineEdit::Password, (""), &ok); + } - if (ok) - mySession->clientJoinGame(gameId, password.toUtf8().constData()); - } + if (ok) + mySession->clientJoinGame(gameId, password.toUtf8().constData()); + } } void gameLobbyDialogImpl::joinAnyGame() { - if(comboBox_gameListFilter->currentIndex() != 3 && comboBox_gameListFilter->currentIndex() != 0 && comboBox_gameListFilter->currentIndex() != 5) comboBox_gameListFilter->setCurrentIndex(0); + if(comboBox_gameListFilter->currentIndex() != 3 && comboBox_gameListFilter->currentIndex() != 0 && comboBox_gameListFilter->currentIndex() != 5) comboBox_gameListFilter->setCurrentIndex(0); - bool found = FALSE; + bool found = FALSE; - int it = 0; - int gameToJoinId = 0; - int mostConnectedPlayers = 0; + int it = 0; + int gameToJoinId = 0; + int mostConnectedPlayers = 0; - while (myGameListModel->item(it)) { + while (myGameListModel->item(it)) { - int players = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",0,0).toInt(); - int maxPlayers = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",1,1).toInt(); - if (myGameListModel->item(it, 2)->data(16) == "open" && myGameListModel->item(it, 4)->data(16) == "nonpriv" && players < maxPlayers) { - if(players > mostConnectedPlayers) { - mostConnectedPlayers = players; - gameToJoinId = it; - } - found = TRUE; - } - it++; - } + int players = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",0,0).toInt(); + int maxPlayers = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",1,1).toInt(); + if (myGameListModel->item(it, 2)->data(16) == "open" && myGameListModel->item(it, 4)->data(16) == "nonpriv" && players < maxPlayers) { + if(players > mostConnectedPlayers) { + mostConnectedPlayers = players; + gameToJoinId = it; + } + found = TRUE; + } + it++; + } - if(found) { - treeView_GameList->setCurrentIndex(myGameListSortFilterProxyModel->mapFromSource(myGameListModel->item(gameToJoinId)->index())); - joinGame(); - } + if(found) { + treeView_GameList->setCurrentIndex(myGameListSortFilterProxyModel->mapFromSource(myGameListModel->item(gameToJoinId)->index())); + joinGame(); + } } void gameLobbyDialogImpl::refresh(int actionID) { - if (actionID == MSG_NET_GAME_CLIENT_START) { - myGameListModel->clear(); - myGameListSelectionModel->clear(); - myGameListSelectionModel->clearSelection(); - myGameListSortFilterProxyModel->clear(); - myNickListModel->clear(); - myNickListSelectionModel->clear(); - myNickListSelectionModel->clearSelection();; + if (actionID == MSG_NET_GAME_CLIENT_START) { + myGameListModel->clear(); + myGameListSelectionModel->clear(); + myGameListSelectionModel->clearSelection(); + myGameListSortFilterProxyModel->clear(); + myNickListModel->clear(); + myNickListSelectionModel->clear(); + myNickListSelectionModel->clearSelection();; - QStringList headerList; + QStringList headerList; headerList << tr("Game") << tr("Players") << tr("State") << tr("T") << tr("P") << tr("Time");; - myGameListModel->setHorizontalHeaderLabels(headerList); + myGameListModel->setHorizontalHeaderLabels(headerList); #ifdef GUI_800x480 treeView_GameList->setColumnWidth(0,220); @@ -432,405 +448,405 @@ void gameLobbyDialogImpl::refresh(int actionID) treeView_GameList->setColumnWidth(4,30); #else treeView_GameList->setColumnWidth(0,190); - treeView_GameList->setColumnWidth(1,65); - treeView_GameList->setColumnWidth(2,65); - treeView_GameList->setColumnWidth(3,40); - treeView_GameList->setColumnWidth(4,40); + treeView_GameList->setColumnWidth(1,65); + treeView_GameList->setColumnWidth(2,65); + treeView_GameList->setColumnWidth(3,40); + treeView_GameList->setColumnWidth(4,40); #endif - QStringList headerList2; - headerList2 << tr("Available Players"); - myNickListModel->setHorizontalHeaderLabels(headerList2); + QStringList headerList2; + headerList2 << tr("Available Players"); + myNickListModel->setHorizontalHeaderLabels(headerList2); - //stop waitStartGameMsgBoxes - waitStartGameMsgBoxTimer->stop(); - closeAllChildDialogs(); - this->accept(); - myW->show(); - } else if(actionID == MSG_NET_GAME_CLIENT_SYNCSTART) { - waitStartGameMsgBoxTimer->start(2000); - } else if(actionID == MSG_NET_GAME_CLIENT_SYNCREJOIN) { -// if(this->isVisible()) { //TODO <-- does it work without isVisible??? - //break the autoStartTimer animation - autoStartTimer->stop(); - autoStartTimerOverlay->hide(); - //show msg dialog - waitRejoinStartGameMsgBox->show(); - waitRejoinStartGameMsgBox->raise(); - waitRejoinStartGameMsgBox->activateWindow(); - pushButton_Leave->setDisabled(true); -// } - } + //stop waitStartGameMsgBoxes + waitStartGameMsgBoxTimer->stop(); + closeAllChildDialogs(); + this->accept(); + myW->show(); + } else if(actionID == MSG_NET_GAME_CLIENT_SYNCSTART) { + waitStartGameMsgBoxTimer->start(2000); + } else if(actionID == MSG_NET_GAME_CLIENT_SYNCREJOIN) { + // if(this->isVisible()) { //TODO <-- does it work without isVisible??? + //break the autoStartTimer animation + autoStartTimer->stop(); + autoStartTimerOverlay->hide(); + //show msg dialog + waitRejoinStartGameMsgBox->show(); + waitRejoinStartGameMsgBox->raise(); + waitRejoinStartGameMsgBox->activateWindow(); + pushButton_Leave->setDisabled(true); + // } + } } void gameLobbyDialogImpl::removedFromGame(int /*reason*/) { - inGame = false; - isGameAdministrator = false; - leftGameDialogUpdate(); + inGame = false; + isGameAdministrator = false; + leftGameDialogUpdate(); } void gameLobbyDialogImpl::gameSelected(const QModelIndex &index) { - if (!inGame && index.isValid() ) { - pushButton_JoinGame->setEnabled(true); + if (!inGame && index.isValid() ) { + pushButton_JoinGame->setEnabled(true); - currentGameName = myGameListModel->item(myGameListSortFilterProxyModel->mapToSource(index).row(), 0)->text(); + currentGameName = myGameListModel->item(myGameListSortFilterProxyModel->mapToSource(index).row(), 0)->text(); - groupBox_GameInfo->setEnabled(true); - groupBox_GameInfo->setTitle(tr("Game Info") + " - " + currentGameName); + groupBox_GameInfo->setEnabled(true); + groupBox_GameInfo->setTitle(tr("Game Info") + " - " + currentGameName); - assert(mySession); - GameInfo info(mySession->getClientGameInfo(myGameListModel->item(myGameListSortFilterProxyModel->mapToSource(index).row(), 0)->data(Qt::UserRole).toUInt())); + assert(mySession); + GameInfo info(mySession->getClientGameInfo(myGameListModel->item(myGameListSortFilterProxyModel->mapToSource(index).row(), 0)->data(Qt::UserRole).toUInt())); - 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; - } + 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)); - // label_MaximumNumberOfPlayers->setText(QString::number(info.data.maxNumberOfPlayers));s - updateDialogBlinds(info.data); + 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 + updateDialogBlinds(info.data); - label_GameTiming->setText(QString::number(info.data.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(info.data.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); + label_GameTiming->setText(QString::number(info.data.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(info.data.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); - treeWidget_connectedPlayers->clear(); - PlayerIdList::const_iterator i = info.players.begin(); - PlayerIdList::const_iterator end = info.players.end(); - while (i != end) { - bool admin = info.adminPlayerId == *i; - PlayerInfo playerInfo(mySession->getClientPlayerInfo(*i)); - addConnectedPlayer(*i, QString::fromUtf8(playerInfo.playerName.c_str()), admin); - ++i; - } + treeWidget_connectedPlayers->clear(); + PlayerIdList::const_iterator i = info.players.begin(); + PlayerIdList::const_iterator end = info.players.end(); + while (i != end) { + bool admin = info.adminPlayerId == *i; + PlayerInfo playerInfo(mySession->getClientPlayerInfo(*i)); + addConnectedPlayer(*i, QString::fromUtf8(playerInfo.playerName.c_str()), admin); + ++i; + } - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players - Max. %1").arg(info.data.maxNumberOfPlayers)); - header->setData(0, Qt::UserRole, info.data.maxNumberOfPlayers); + QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); + header->setText(0, tr("Connected players - Max. %1").arg(info.data.maxNumberOfPlayers)); + header->setData(0, Qt::UserRole, info.data.maxNumberOfPlayers); #ifdef __APPLE__ - // Dirty workaround for a Qt redraw bug on Mac OS. - treeWidget_connectedPlayers->setFocus(); - treeView_GameList->setFocus(); + // Dirty workaround for a Qt redraw bug on Mac OS. + treeWidget_connectedPlayers->setFocus(); + treeView_GameList->setFocus(); #endif - } + } } void gameLobbyDialogImpl::updateGameItem(QList itemList, unsigned gameId) { - assert(mySession); - GameInfo info(mySession->getClientGameInfo(gameId)); + assert(mySession); + GameInfo info(mySession->getClientGameInfo(gameId)); - itemList.at(0)->setData(gameId, Qt::UserRole); - itemList.at(0)->setData(QString::fromUtf8(info.name.c_str()), Qt::DisplayRole); + itemList.at(0)->setData(gameId, Qt::UserRole); + itemList.at(0)->setData(QString::fromUtf8(info.name.c_str()), Qt::DisplayRole); - PlayerIdList::const_iterator i = info.players.begin(); - PlayerIdList::const_iterator end = info.players.end(); + PlayerIdList::const_iterator i = info.players.begin(); + PlayerIdList::const_iterator end = info.players.end(); - while (i != end) { - if(myPlayerId == *i) { - itemList.at(0)->setData( "MeInThisGame", 16); - itemList.at(0)->setBackground(QBrush(QColor(0, 255, 0, 127))); - itemList.at(1)->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(4)->setBackground(QBrush(QColor(0, 255, 0, 127))); + while (i != end) { + if(myPlayerId == *i) { + itemList.at(0)->setData( "MeInThisGame", 16); + itemList.at(0)->setBackground(QBrush(QColor(0, 255, 0, 127))); + itemList.at(1)->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(4)->setBackground(QBrush(QColor(0, 255, 0, 127))); itemList.at(5)->setBackground(QBrush(QColor(0, 255, 0, 127))); - break; - } else { - itemList.at(0)->setData( "", 16); - itemList.at(0)->setBackground(QBrush()); - itemList.at(1)->setBackground(QBrush()); - itemList.at(2)->setBackground(QBrush()); - itemList.at(3)->setBackground(QBrush()); - itemList.at(4)->setBackground(QBrush()); + break; + } else { + itemList.at(0)->setData( "", 16); + itemList.at(0)->setBackground(QBrush()); + itemList.at(1)->setBackground(QBrush()); + itemList.at(2)->setBackground(QBrush()); + itemList.at(3)->setBackground(QBrush()); + itemList.at(4)->setBackground(QBrush()); itemList.at(5)->setBackground(QBrush()); - } - ++i; - } + } + ++i; + } - QString playerStr; - playerStr.sprintf("%u/%u", (unsigned)info.players.size(), (unsigned)info.data.maxNumberOfPlayers); - itemList.at(1)->setData(playerStr, Qt::DisplayRole); - if((unsigned)info.players.size() == (unsigned)info.data.maxNumberOfPlayers) { - itemList.at(1)->setData("totalfull", 16); - } else { - itemList.at(1)->setData("nonfull", 16); - }\ + QString playerStr; + playerStr.sprintf("%u/%u", (unsigned)info.players.size(), (unsigned)info.data.maxNumberOfPlayers); + itemList.at(1)->setData(playerStr, Qt::DisplayRole); + if((unsigned)info.players.size() == (unsigned)info.data.maxNumberOfPlayers) { + itemList.at(1)->setData("totalfull", 16); + } else { + itemList.at(1)->setData("nonfull", 16); + }\ - if (info.mode == GAME_MODE_STARTED) { - itemList.at(2)->setData(tr("running"), Qt::DisplayRole); - itemList.at(2)->setData("running", 16); - } else { - itemList.at(2)->setData(tr("open"), Qt::DisplayRole); - itemList.at(2)->setData("open", 16); - } + if (info.mode == GAME_MODE_STARTED) { + itemList.at(2)->setData(tr("running"), Qt::DisplayRole); + itemList.at(2)->setData("running", 16); + } else { + itemList.at(2)->setData(tr("open"), Qt::DisplayRole); + itemList.at(2)->setData("open", 16); + } - switch (info.data.gameType) { - case GAME_TYPE_NORMAL: { - itemList.at(3)->setIcon(QIcon(":/gfx/player_play.png")); - itemList.at(3)->setData("", Qt::DisplayRole); - itemList.at(3)->setData("standard", 16); - } - break; - case GAME_TYPE_REGISTERED_ONLY: { - itemList.at(3)->setIcon(QIcon(":/gfx/registered.png")); - itemList.at(3)->setData(" ", Qt::DisplayRole); - itemList.at(3)->setData("registered", 16); - } - break; - case GAME_TYPE_INVITE_ONLY: { - itemList.at(3)->setIcon(QIcon(":/gfx/list_add_user.png")); - itemList.at(3)->setData(" ", Qt::DisplayRole); + switch (info.data.gameType) { + case GAME_TYPE_NORMAL: { + itemList.at(3)->setIcon(QIcon(":/gfx/player_play.png")); + itemList.at(3)->setData("", Qt::DisplayRole); + itemList.at(3)->setData("standard", 16); + } + break; + case GAME_TYPE_REGISTERED_ONLY: { + itemList.at(3)->setIcon(QIcon(":/gfx/registered.png")); + itemList.at(3)->setData(" ", Qt::DisplayRole); + itemList.at(3)->setData("registered", 16); + } + break; + case GAME_TYPE_INVITE_ONLY: { + itemList.at(3)->setIcon(QIcon(":/gfx/list_add_user.png")); + itemList.at(3)->setData(" ", Qt::DisplayRole); itemList.at(3)->setData("invited", 16); - } - break; - case GAME_TYPE_RANKING: { - itemList.at(3)->setIcon(QIcon(":/gfx/cup.png")); - itemList.at(3)->setData(" ", Qt::DisplayRole); - itemList.at(3)->setData("ranking", 16); - } - break; - } + } + break; + case GAME_TYPE_RANKING: { + itemList.at(3)->setIcon(QIcon(":/gfx/cup.png")); + itemList.at(3)->setData(" ", Qt::DisplayRole); + itemList.at(3)->setData("ranking", 16); + } + break; + } - if (info.isPasswordProtected) { - itemList.at(4)->setIcon(QIcon(":/gfx/lock.png")); - itemList.at(4)->setData(" ", Qt::DisplayRole); - itemList.at(4)->setData("private", 16); - } else { - itemList.at(4)->setData("", Qt::DisplayRole); - itemList.at(4)->setData("nonpriv", 16); - } + if (info.isPasswordProtected) { + itemList.at(4)->setIcon(QIcon(":/gfx/lock.png")); + itemList.at(4)->setData(" ", Qt::DisplayRole); + itemList.at(4)->setData("private", 16); + } else { + itemList.at(4)->setData("", Qt::DisplayRole); + 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") ); - refreshGameStats(); + // treeView_GameList->sortByColumn(myConfig->readConfigInt("DlgGameLobbyGameListSortingSection"), (Qt::SortOrder)myConfig->readConfigInt("DlgGameLobbyGameListSortingOrder") ); + refreshGameStats(); } void gameLobbyDialogImpl::addGame(unsigned gameId) { - QList itemList; - QStandardItem *item1 = new QStandardItem(); - QStandardItem *item2 = new QStandardItem(); - QStandardItem *item3 = new QStandardItem(); - QStandardItem *item4 = new QStandardItem(); - QStandardItem *item5 = new QStandardItem(); + QList itemList; + QStandardItem *item1 = new QStandardItem(); + QStandardItem *item2 = new QStandardItem(); + QStandardItem *item3 = new QStandardItem(); + QStandardItem *item4 = new QStandardItem(); + QStandardItem *item5 = new QStandardItem(); QStandardItem *item6 = new QStandardItem(); itemList << item1 << item2 << item3 << item4 << item5 << item6; - myGameListModel->appendRow(itemList); + myGameListModel->appendRow(itemList); - updateGameItem(itemList, gameId); + updateGameItem(itemList, gameId); } void gameLobbyDialogImpl::updateGameMode(unsigned gameId, int /*newMode*/) { - int it = 0; - while (myGameListModel->item(it)) { - if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { - QList itemList; + int it = 0; + while (myGameListModel->item(it)) { + if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { + QList itemList; 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); - break; - } - it++; - } + updateGameItem(itemList, gameId); + break; + } + it++; + } } void gameLobbyDialogImpl::updateGameAdmin(unsigned /*gameId*/, unsigned adminPlayerId) { - newGameAdmin(adminPlayerId, ""); + newGameAdmin(adminPlayerId, ""); } void gameLobbyDialogImpl::removeGame(unsigned gameId) { - int it = 0; - while (myGameListModel->item(it)) { - if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { - myGameListModel->removeRow(it); - break; - } - it++; - } + int it = 0; + while (myGameListModel->item(it)) { + if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { + myGameListModel->removeRow(it); + break; + } + it++; + } - refreshGameStats(); + refreshGameStats(); } void gameLobbyDialogImpl::refreshGameStats() { - int runningGamesCounter = 0; - int openGamesCounter = 0; + int runningGamesCounter = 0; + int openGamesCounter = 0; - int it = 0; - while (myGameListModel->item(it)) { - if (myGameListModel->item(it, 2)->data(16) == "running") { - runningGamesCounter++; - } - if (myGameListModel->item(it, 2)->data(16) == "open") { - openGamesCounter++; - } - ++it; - } + int it = 0; + while (myGameListModel->item(it)) { + if (myGameListModel->item(it, 2)->data(16) == "running") { + runningGamesCounter++; + } + if (myGameListModel->item(it, 2)->data(16) == "open") { + openGamesCounter++; + } + ++it; + } - label_openGamesCounter->setText("| "+tr("running games: %1").arg(runningGamesCounter)); - label_runningGamesCounter->setText("| "+tr("open games: %1").arg(openGamesCounter)); + label_openGamesCounter->setText("| "+tr("running games: %1").arg(runningGamesCounter)); + label_runningGamesCounter->setText("| "+tr("open games: %1").arg(openGamesCounter)); - //refresh joinAnyGameButton state - joinAnyGameButtonRefresh(); + //refresh joinAnyGameButton state + joinAnyGameButtonRefresh(); } void gameLobbyDialogImpl::refreshPlayerStats() { - //ServerStats stats = mySession->getClientStats(); - label_connectedPlayersCounter->setText(tr("connected players: %1").arg(myNickListModel->rowCount())); + //ServerStats stats = mySession->getClientStats(); + label_connectedPlayersCounter->setText(tr("connected players: %1").arg(myNickListModel->rowCount())); } void gameLobbyDialogImpl::gameAddPlayer(unsigned gameId, unsigned playerId) { - if (!inGame) { - QItemSelectionModel *selection = treeView_GameList->selectionModel(); - if (selection->hasSelection()) { - if(selection->selectedRows().at(0).data(Qt::UserRole).toUInt() == gameId) { - assert(mySession); - GameInfo info(mySession->getClientGameInfo(gameId)); - bool admin = info.adminPlayerId == playerId; - PlayerInfo playerInfo(mySession->getClientPlayerInfo(playerId)); + if (!inGame) { + QItemSelectionModel *selection = treeView_GameList->selectionModel(); + if (selection->hasSelection()) { + if(selection->selectedRows().at(0).data(Qt::UserRole).toUInt() == gameId) { + assert(mySession); + GameInfo info(mySession->getClientGameInfo(gameId)); + bool admin = info.adminPlayerId == playerId; + PlayerInfo playerInfo(mySession->getClientPlayerInfo(playerId)); - addConnectedPlayer(playerId, QString::fromUtf8(playerInfo.playerName.c_str()), admin); - } - } - } + addConnectedPlayer(playerId, QString::fromUtf8(playerInfo.playerName.c_str()), admin); + } + } + } - int it = 0; - while (myGameListModel->item(it)) { - if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { - QList itemList; + int it = 0; + while (myGameListModel->item(it)) { + if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { + QList itemList; 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); - break; - } - it++; - } + updateGameItem(itemList, gameId); + break; + } + it++; + } - //mark player as active - int it1 = 0; - while (myNickListModel->item(it1)) { - if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) { - myNickListModel->item(it1, 0)->setData("active", 34); - break; - } - ++it1; - } + //mark player as active + int it1 = 0; + while (myNickListModel->item(it1)) { + if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) { + myNickListModel->item(it1, 0)->setData("active", 34); + break; + } + ++it1; + } } void gameLobbyDialogImpl::gameRemovePlayer(unsigned gameId, unsigned playerId) { - if (!inGame) { - QItemSelectionModel *selection = treeView_GameList->selectionModel(); - if (selection->hasSelection()) { - if(selection->selectedRows().at(0).data(Qt::UserRole).toUInt() == gameId) { - assert(mySession); - PlayerInfo info(mySession->getClientPlayerInfo(playerId)); - removePlayer(playerId, QString::fromUtf8(info.playerName.c_str())); - } - } - } + if (!inGame) { + QItemSelectionModel *selection = treeView_GameList->selectionModel(); + if (selection->hasSelection()) { + if(selection->selectedRows().at(0).data(Qt::UserRole).toUInt() == gameId) { + assert(mySession); + PlayerInfo info(mySession->getClientPlayerInfo(playerId)); + removePlayer(playerId, QString::fromUtf8(info.playerName.c_str())); + } + } + } - int it = 0; - while (myGameListModel->item(it)) { - if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { - QList itemList; + int it = 0; + while (myGameListModel->item(it)) { + if (myGameListModel->item(it, 0)->data(Qt::UserRole) == gameId) { + QList itemList; 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); - break; - } - ++it; - } + updateGameItem(itemList, gameId); + break; + } + ++it; + } - //mark player as idle again - int it1 = 0; - while (myNickListModel->item(it1)) { - if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) { - myNickListModel->item(it1, 0)->setData("idle", 34); - break; - } - ++it1; - } + //mark player as idle again + int it1 = 0; + while (myNickListModel->item(it1)) { + if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) { + myNickListModel->item(it1, 0)->setData("idle", 34); + break; + } + ++it1; + } } void gameLobbyDialogImpl::updateStats(ServerStats /*stats*/) { - refreshPlayerStats(); + refreshPlayerStats(); } void gameLobbyDialogImpl::clearDialog() { - groupBox_GameInfo->setTitle(tr("Game Info")); - groupBox_GameInfo->setEnabled(false); - currentGameName = ""; + groupBox_GameInfo->setTitle(tr("Game Info")); + groupBox_GameInfo->setEnabled(false); + currentGameName = ""; - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players")); - header->setData(0, Qt::UserRole, 0); + QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); + header->setText(0, tr("Connected players")); + header->setData(0, Qt::UserRole, 0); - showGameDescription(FALSE); - label_typeIcon->setText(" "); - label_typeText->setText(" "); - label_SmallBlind->setText(""); - label_StartCash->setText(""); - label_blindsRaiseIntervall->setText(""); - label_blindsRaiseMode->setText(""); - label_blindsList->setText(""); - label_GameTiming->setText(""); + showGameDescription(FALSE); + label_typeIcon->setText(" "); + label_typeText->setText(" "); + label_SmallBlind->setText(""); + label_StartCash->setText(""); + label_blindsRaiseIntervall->setText(""); + label_blindsRaiseMode->setText(""); + label_blindsList->setText(""); + label_GameTiming->setText(""); - myGameListModel->clear(); - myGameListSelectionModel->clear(); - myGameListSelectionModel->clearSelection(); - myGameListSortFilterProxyModel->clear(); - treeView_GameList->show(); - treeWidget_connectedPlayers->clear(); + myGameListModel->clear(); + myGameListSelectionModel->clear(); + myGameListSelectionModel->clearSelection(); + myGameListSortFilterProxyModel->clear(); + treeView_GameList->show(); + treeWidget_connectedPlayers->clear(); - pushButton_Leave->hide(); - pushButton_Kick->hide(); - pushButton_Kick->setEnabled(false); - pushButton_StartGame->hide(); - checkBox_fillUpWithComputerOpponents->hide(); - pushButton_CreateGame->show(); - pushButton_JoinGame->show(); - pushButton_JoinGame->setEnabled(false); - pushButton_joinAnyGame->show(); - pushButton_joinAnyGame->setEnabled(false); + pushButton_Leave->hide(); + pushButton_Kick->hide(); + pushButton_Kick->setEnabled(false); + pushButton_StartGame->hide(); + checkBox_fillUpWithComputerOpponents->hide(); + pushButton_CreateGame->show(); + pushButton_JoinGame->show(); + pushButton_JoinGame->setEnabled(false); + pushButton_joinAnyGame->show(); + pushButton_joinAnyGame->setEnabled(false); - QStringList headerList; + QStringList headerList; headerList << tr("Game") << tr("Players") << tr("State") << tr("T") << tr("P") << tr("Time"); - myGameListModel->setHorizontalHeaderLabels(headerList); + myGameListModel->setHorizontalHeaderLabels(headerList); #ifdef GUI_800x480 treeView_GameList->setColumnWidth(0,220); @@ -848,927 +864,944 @@ void gameLobbyDialogImpl::clearDialog() treeView_GameList->setColumnWidth(5,20); #endif - pushButton_CreateGame->clearFocus(); - lineEdit_ChatInput->setFocus(); - myChat->clearChat(); + pushButton_CreateGame->clearFocus(); + lineEdit_ChatInput->setFocus(); + myChat->clearChat(); - myNickListModel->clear(); - myNickListSelectionModel->clear(); - myNickListSelectionModel->clearSelection();; - QStringList headerList2; - headerList2 << tr("Available Players"); - myNickListModel->setHorizontalHeaderLabels(headerList2); - myNickListModel->sort(0, treeView_NickList->header()->sortIndicatorOrder()); + 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; + inGame = false; + isGameAdministrator = false; + myPlayerId = 0; - showGameDescription(FALSE); + showGameDescription(FALSE); - label_connectedPlayersCounter->setText(tr("connected players: %1").arg(0)); - label_openGamesCounter->setText("| "+tr("running games: %1").arg(0)); - label_runningGamesCounter->setText("| "+tr("open games: %1").arg(0)); + label_connectedPlayersCounter->setText(tr("connected players: %1").arg(0)); + label_openGamesCounter->setText("| "+tr("running games: %1").arg(0)); + label_runningGamesCounter->setText("| "+tr("open games: %1").arg(0)); - readDialogSettings(); + readDialogSettings(); } void gameLobbyDialogImpl::checkPlayerQuantity() { - assert(mySession); - GameInfo info(mySession->getClientGameInfo(mySession->getClientCurrentGameId())); + assert(mySession); + GameInfo info(mySession->getClientGameInfo(mySession->getClientCurrentGameId())); - if(isGameAdministrator && info.data.gameType != GAME_TYPE_RANKING) { + if(isGameAdministrator && info.data.gameType != GAME_TYPE_RANKING) { - pushButton_Kick->show(); - pushButton_StartGame->show(); - checkBox_fillUpWithComputerOpponents->show(); + pushButton_Kick->show(); + pushButton_StartGame->show(); + checkBox_fillUpWithComputerOpponents->show(); - if (treeWidget_connectedPlayers->topLevelItemCount() >= 2) { - pushButton_StartGame->setEnabled(true); + if (treeWidget_connectedPlayers->topLevelItemCount() >= 2) { + pushButton_StartGame->setEnabled(true); - if(treeWidget_connectedPlayers->topLevelItemCount() == treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { - blinkingButtonAnimationTimer->start(); - } else { - blinkingButtonAnimationTimer->stop(); - blinkingButtonAnimationState = false; - blinkingStartButtonAnimation(); - } - } else { - pushButton_StartGame->setEnabled(false); - blinkingButtonAnimationTimer->stop(); - blinkingButtonAnimationState = false; - blinkingStartButtonAnimation(); - } - } + if(treeWidget_connectedPlayers->topLevelItemCount() == treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { + blinkingButtonAnimationTimer->start(); + } else { + blinkingButtonAnimationTimer->stop(); + blinkingButtonAnimationState = false; + blinkingStartButtonAnimation(); + } + } else { + pushButton_StartGame->setEnabled(false); + blinkingButtonAnimationTimer->stop(); + blinkingButtonAnimationState = false; + blinkingStartButtonAnimation(); + } + } - //general actions - if(treeWidget_connectedPlayers->topLevelItemCount() < treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { - autoStartTimerOverlay->hide(); - autoStartTimer->stop(); - } + //general actions + if(treeWidget_connectedPlayers->topLevelItemCount() < treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { + autoStartTimerOverlay->hide(); + autoStartTimer->stop(); + } } void gameLobbyDialogImpl::blinkingStartButtonAnimation() { - if(blinkingButtonAnimationState) { - QPalette p = pushButton_StartGame->palette(); - p.setColor(QPalette::Button, QColor(Qt::red)); - p.setColor(QPalette::ButtonText, QColor(Qt::white)); - pushButton_StartGame->setPalette(p); - blinkingButtonAnimationState = false; - } else { - if(pushButton_StartGame->isEnabled()) { - QPalette p = pushButton_StartGame->palette(); - p.setColor(QPalette::Button, defaultStartButtonColor); - p.setColor(QPalette::ButtonText, defaultStartButtonTextColor); - pushButton_StartGame->setPalette(p); - blinkingButtonAnimationState = true; - } else { - QPalette p = pushButton_StartGame->palette(); - p.setColor(QPalette::Button, disabledStartButtonColor); - p.setColor(QPalette::ButtonText, disabledStartButtonTextColor); - pushButton_StartGame->setPalette(p); - blinkingButtonAnimationState = true; - } - } + if(blinkingButtonAnimationState) { + QPalette p = pushButton_StartGame->palette(); + p.setColor(QPalette::Button, QColor(Qt::red)); + p.setColor(QPalette::ButtonText, QColor(Qt::white)); + pushButton_StartGame->setPalette(p); + blinkingButtonAnimationState = false; + } else { + if(pushButton_StartGame->isEnabled()) { + QPalette p = pushButton_StartGame->palette(); + p.setColor(QPalette::Button, defaultStartButtonColor); + p.setColor(QPalette::ButtonText, defaultStartButtonTextColor); + pushButton_StartGame->setPalette(p); + blinkingButtonAnimationState = true; + } else { + QPalette p = pushButton_StartGame->palette(); + p.setColor(QPalette::Button, disabledStartButtonColor); + p.setColor(QPalette::ButtonText, disabledStartButtonTextColor); + pushButton_StartGame->setPalette(p); + blinkingButtonAnimationState = true; + } + } } void gameLobbyDialogImpl::joinedNetworkGame(unsigned playerId, QString playerName, bool isGameAdmin) { - // Update dialog - inGame = true; - joinedGameDialogUpdate(); + // Update dialog + inGame = true; + joinedGameDialogUpdate(); - myPlayerId = playerId; - isGameAdministrator = isGameAdmin; - addConnectedPlayer(playerId, playerName, isGameAdmin); + myPlayerId = playerId; + isGameAdministrator = isGameAdmin; + addConnectedPlayer(playerId, playerName, isGameAdmin); - //show msgBox about invite only game - assert(mySession); - if(mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY) { - infoMsgToShowId = 2; - showInfoMsgBoxTimer->start(1000); - } + //show msgBox about invite only game + assert(mySession); + if(mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY) { + infoMsgToShowId = 2; + 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++; + // } + // } } void gameLobbyDialogImpl::addConnectedPlayer(unsigned playerId, QString playerName, bool isGameAdmin) { - QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedPlayers, 0); - item->setData(0, Qt::UserRole, playerId); - item->setData(0, Qt::DisplayRole, playerName); + QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_connectedPlayers, 0); + item->setData(0, Qt::UserRole, playerId); + item->setData(0, Qt::DisplayRole, playerName); - if(isGameAdmin) item->setBackground(0, QBrush(QColor(0, 255, 0, 127))); + if(isGameAdmin) item->setBackground(0, QBrush(QColor(0, 255, 0, 127))); - if(this->isVisible() && inGame && myConfig->readConfigInt("PlayNetworkGameNotification")) { - if(treeWidget_connectedPlayers->topLevelItemCount() < treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { + if(this->isVisible() && inGame && myConfig->readConfigInt("PlayNetworkGameNotification")) { + if(treeWidget_connectedPlayers->topLevelItemCount() < treeWidget_connectedPlayers->headerItem()->data(0, Qt::UserRole).toInt()) { myW->getMySoundEventHandler()->playSound("playerconnected", 0); - } else { + } else { myW->getMySoundEventHandler()->playSound("onlinegameready", 0); - showAutoStartTimer(); - } - } + showAutoStartTimer(); + } + } - checkPlayerQuantity(); + checkPlayerQuantity(); - if (inGame) - refreshConnectedPlayerAvatars(); + if (inGame) + refreshConnectedPlayerAvatars(); } void gameLobbyDialogImpl::updatePlayer(unsigned playerId, QString newPlayerName) { - //rename player in connected players list - QTreeWidgetItemIterator it(treeWidget_connectedPlayers); - while (*it) { - if ((*it)->data(0, Qt::UserRole) == playerId) { - (*it)->setData(0, Qt::DisplayRole, newPlayerName); - break; - } - ++it; - } + //rename player in connected players list + QTreeWidgetItemIterator it(treeWidget_connectedPlayers); + while (*it) { + if ((*it)->data(0, Qt::UserRole) == playerId) { + (*it)->setData(0, Qt::DisplayRole, newPlayerName); + break; + } + ++it; + } - if (inGame) - refreshConnectedPlayerAvatars(); + if (inGame) + refreshConnectedPlayerAvatars(); - //also rename player in nick-list - QString oldNick; - 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); + //also rename player in nick-list + QString oldNick; + 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)); - 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")); - myNickListModel->item(it1, 0)->setToolTip(""); - } else { - myNickListModel->item(it1, 0)->setIcon(QIcon(QString(":/cflags/cflags/%1.png").arg(countryString))); - myNickListModel->item(it1, 0)->setToolTip(getFullCountryString(countryString.toUpper())); - } + PlayerInfo playerInfo(mySession->getClientPlayerInfo(playerId)); + 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")); + myNickListModel->item(it1, 0)->setToolTip(""); + } else { + myNickListModel->item(it1, 0)->setIcon(QIcon(QString(":/cflags/cflags/%1.png").arg(countryString))); + myNickListModel->item(it1, 0)->setToolTip(getFullCountryString(countryString.toUpper())); + } - unsigned gameIdOfPlayer = mySession->getGameIdOfPlayer(playerId); - if(gameIdOfPlayer) { - myNickListModel->item(it1, 0)->setData("active", 34); - } else { - myNickListModel->item(it1, 0)->setData("idle", 34); - } + unsigned gameIdOfPlayer = mySession->getGameIdOfPlayer(playerId); + if(gameIdOfPlayer) { + myNickListModel->item(it1, 0)->setData("active", 34); + } else { + myNickListModel->item(it1, 0)->setData("idle", 34); + } - break; - } + break; + } - ++it1; - } + ++it1; + } - if (myChat->getMyNick() == oldNick) { - myChat->setMyNick(newPlayerName); - } + if (myChat->getMyNick() == oldNick) { + myChat->setMyNick(newPlayerName); + } } void gameLobbyDialogImpl::removePlayer(unsigned playerId, QString) { - QTreeWidgetItemIterator it(treeWidget_connectedPlayers); - while (*it) { - if ((*it)->data(0, Qt::UserRole) == playerId) { - treeWidget_connectedPlayers->takeTopLevelItem(treeWidget_connectedPlayers->indexOfTopLevelItem(*it)); - break; - } - ++it; - } + QTreeWidgetItemIterator it(treeWidget_connectedPlayers); + while (*it) { + if ((*it)->data(0, Qt::UserRole) == playerId) { + treeWidget_connectedPlayers->takeTopLevelItem(treeWidget_connectedPlayers->indexOfTopLevelItem(*it)); + break; + } + ++it; + } - checkPlayerQuantity(); + checkPlayerQuantity(); } void gameLobbyDialogImpl::playerLeftLobby(unsigned playerId) { - int it1 = 0; - while (myNickListModel->item(it1)) { - if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) { - myNickListModel->removeRow(it1);; - break; - } - ++it1; - } + int it1 = 0; + while (myNickListModel->item(it1)) { + if (myNickListModel->item(it1, 0)->data(Qt::UserRole) == playerId) { + myNickListModel->removeRow(it1);; + break; + } + ++it1; + } - refreshPlayerStats(); + refreshPlayerStats(); } void gameLobbyDialogImpl::playerJoinedLobby(unsigned playerId, QString /*playerName TODO remove*/) { - PlayerInfo playerInfo(mySession->getClientPlayerInfo(playerId)); - QString countryString = QString::fromUtf8(playerInfo.countryCode.c_str()).toLower(); + 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->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))); - item->setToolTip(getFullCountryString(countryString.toUpper())); - } + QStandardItem *item = new QStandardItem; + item->setText(QString::fromUtf8(playerInfo.playerName.c_str())); + item->setData(playerId, Qt::UserRole); + 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))); + item->setToolTip(getFullCountryString(countryString.toUpper())); + } - unsigned gameIdOfPlayer = mySession->getGameIdOfPlayer(playerId); - if(gameIdOfPlayer) { - item->setData("active", 34); - } else { - item->setData("idle", 34); - } + unsigned gameIdOfPlayer = mySession->getGameIdOfPlayer(playerId); + if(gameIdOfPlayer) { + item->setData("active", 34); + } else { + item->setData("idle", 34); + } - myNickListModel->appendRow(item); + myNickListModel->appendRow(item); - refreshPlayerStats(); + refreshPlayerStats(); } void gameLobbyDialogImpl::newGameAdmin(unsigned playerId, QString) { - QTreeWidgetItemIterator it(treeWidget_connectedPlayers); - while (*it) { - if ((*it)->data(0, Qt::UserRole) == playerId) { - (*it)->setBackground(0, QBrush(QColor(0, 255, 0, 127))); - } - ++it; - } + QTreeWidgetItemIterator it(treeWidget_connectedPlayers); + while (*it) { + if ((*it)->data(0, Qt::UserRole) == playerId) { + (*it)->setBackground(0, QBrush(QColor(0, 255, 0, 127))); + } + ++it; + } - if (inGame && myPlayerId == playerId) { - isGameAdministrator = true; - checkPlayerQuantity(); - } + if (inGame && myPlayerId == playerId) { + isGameAdministrator = true; + checkPlayerQuantity(); + } } void gameLobbyDialogImpl::refreshConnectedPlayerAvatars() { - QTreeWidgetItemIterator it(treeWidget_connectedPlayers); - while (*it) { + QTreeWidgetItemIterator it(treeWidget_connectedPlayers); + while (*it) { - std::string myAvatarFileName; - PlayerInfo playerInfo(mySession->getClientPlayerInfo((*it)->data(0, Qt::UserRole).toUInt())); + std::string myAvatarFileName; + PlayerInfo playerInfo(mySession->getClientPlayerInfo((*it)->data(0, Qt::UserRole).toUInt())); - if(mySession->getAvatarFile(playerInfo.avatar, myAvatarFileName)) { + if(mySession->getAvatarFile(playerInfo.avatar, myAvatarFileName)) { - QString myAvatarString(QString::fromUtf8(myAvatarFileName.c_str())); - QFile myAvatarFile(myAvatarString); - if(myAvatarFile.exists()) { + QString myAvatarString(QString::fromUtf8(myAvatarFileName.c_str())); + QFile myAvatarFile(myAvatarString); + if(myAvatarFile.exists()) { - QPixmap tempAvatar(myAvatarString); - QPixmap myAvatarPixmap(25,26); - myAvatarPixmap.fill(Qt::transparent); - QPainter p(&myAvatarPixmap); - p.drawPixmap (0,0,25,25, tempAvatar.scaled(25,25,Qt::KeepAspectRatio,Qt::SmoothTransformation)); + QPixmap tempAvatar(myAvatarString); + QPixmap myAvatarPixmap(25,26); + myAvatarPixmap.fill(Qt::transparent); + QPainter p(&myAvatarPixmap); + p.drawPixmap (0,0,25,25, tempAvatar.scaled(25,25,Qt::KeepAspectRatio,Qt::SmoothTransformation)); - (*it)->setIcon(0, QIcon(myAvatarPixmap)); - } - } - ++it; - } + (*it)->setIcon(0, QIcon(myAvatarPixmap)); + } + } + ++it; + } } void gameLobbyDialogImpl::joinedGameDialogUpdate() { - groupBox_GameInfo->setEnabled(true); - groupBox_GameInfo->setTitle(currentGameName); - treeWidget_connectedPlayers->clear(); - pushButton_CreateGame->hide(); - pushButton_JoinGame->hide(); - pushButton_joinAnyGame->hide(); - pushButton_Leave->show(); - pushButton_Leave->setEnabled(true); + groupBox_GameInfo->setEnabled(true); + groupBox_GameInfo->setTitle(currentGameName); + treeWidget_connectedPlayers->clear(); + pushButton_CreateGame->hide(); + pushButton_JoinGame->hide(); + pushButton_joinAnyGame->hide(); + pushButton_Leave->show(); + pushButton_Leave->setEnabled(true); - //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())); + //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())); + 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; - } + 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_GameTiming->setText(QString::number(info.data.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(info.data.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); + showGameDescription(TRUE); + label_SmallBlind->setText(QString("%L1").arg(info.data.firstSmallBlind)); + label_StartCash->setText(QString("%L1").arg(info.data.startMoney)); + updateDialogBlinds(info.data); + label_GameTiming->setText(QString::number(info.data.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(info.data.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players - Max. %1").arg(info.data.maxNumberOfPlayers)); - header->setData(0, Qt::UserRole, info.data.maxNumberOfPlayers); + QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); + header->setText(0, tr("Connected players - Max. %1").arg(info.data.maxNumberOfPlayers)); + header->setData(0, Qt::UserRole, info.data.maxNumberOfPlayers); } void gameLobbyDialogImpl::leftGameDialogUpdate() { - // un-select current game. - treeView_GameList->clearSelection(); + // un-select current game. + treeView_GameList->clearSelection(); - groupBox_GameInfo->setTitle(tr("Game Info")); - groupBox_GameInfo->setEnabled(false); - currentGameName = ""; + groupBox_GameInfo->setTitle(tr("Game Info")); + groupBox_GameInfo->setEnabled(false); + currentGameName = ""; - QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); - header->setText(0, tr("Connected players")); - header->setData(0, Qt::UserRole, 0); + QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem(); + header->setText(0, tr("Connected players")); + header->setData(0, Qt::UserRole, 0); - showGameDescription(FALSE); - label_typeIcon->setText(" "); - label_typeText->setText(" "); - label_SmallBlind->setText(""); - label_StartCash->setText(""); - label_blindsRaiseIntervall->setText(""); - label_blindsRaiseMode->setText(""); - label_blindsList->setText(""); - label_GameTiming->setText(""); + showGameDescription(FALSE); + label_typeIcon->setText(" "); + label_typeText->setText(" "); + label_SmallBlind->setText(""); + label_StartCash->setText(""); + label_blindsRaiseIntervall->setText(""); + label_blindsRaiseMode->setText(""); + label_blindsList->setText(""); + label_GameTiming->setText(""); - treeWidget_connectedPlayers->clear(); - pushButton_StartGame->hide(); - pushButton_Leave->hide(); - pushButton_Kick->hide(); - pushButton_Kick->setEnabled(false); - checkBox_fillUpWithComputerOpponents->hide(); - pushButton_CreateGame->show(); - pushButton_JoinGame->show(); - pushButton_JoinGame->setEnabled(false); - pushButton_joinAnyGame->show(); - joinAnyGameButtonRefresh(); + treeWidget_connectedPlayers->clear(); + pushButton_StartGame->hide(); + pushButton_Leave->hide(); + pushButton_Kick->hide(); + pushButton_Kick->setEnabled(false); + checkBox_fillUpWithComputerOpponents->hide(); + pushButton_CreateGame->show(); + pushButton_JoinGame->show(); + pushButton_JoinGame->setEnabled(false); + pushButton_joinAnyGame->show(); + joinAnyGameButtonRefresh(); - lineEdit_ChatInput->setFocus(); + lineEdit_ChatInput->setFocus(); } void gameLobbyDialogImpl::updateDialogBlinds(const GameData &gameData) { - if(gameData.raiseIntervalMode == RAISE_ON_HANDNUMBER) { - label_blindsRaiseIntervall->setText(QString::number(gameData.raiseSmallBlindEveryHandsValue)+" "+tr("hands")); - } else { - label_blindsRaiseIntervall->setText(QString::number(gameData.raiseSmallBlindEveryMinutesValue)+" "+tr("minutes")); - } - if(gameData.raiseMode == DOUBLE_BLINDS) { - label_blindsRaiseMode->setText(tr("double blinds")); - label_blindsList->hide(); - label_gameDesc6->hide(); - } else { - label_blindsRaiseMode->setText(tr("manual blinds order")); - label_blindsList->show(); - label_gameDesc6->show(); + if(gameData.raiseIntervalMode == RAISE_ON_HANDNUMBER) { + label_blindsRaiseIntervall->setText(QString::number(gameData.raiseSmallBlindEveryHandsValue)+" "+tr("hands")); + } else { + label_blindsRaiseIntervall->setText(QString::number(gameData.raiseSmallBlindEveryMinutesValue)+" "+tr("minutes")); + } + if(gameData.raiseMode == DOUBLE_BLINDS) { + label_blindsRaiseMode->setText(tr("double blinds")); + label_blindsList->hide(); + label_gameDesc6->hide(); + } else { + label_blindsRaiseMode->setText(tr("manual blinds order")); + label_blindsList->show(); + label_gameDesc6->show(); - QString blindsListString; - std::list::const_iterator it1; - for(it1= gameData.manualBlindsList.begin(); it1 != gameData.manualBlindsList.end(); ++it1) { - blindsListString.append(QString("%L1").arg(*it1)).append(", "); - } - blindsListString.remove(blindsListString.length()-2,2); - label_blindsList->setText(blindsListString); - } + QString blindsListString; + std::list::const_iterator it1; + for(it1= gameData.manualBlindsList.begin(); it1 != gameData.manualBlindsList.end(); ++it1) { + blindsListString.append(QString("%L1").arg(*it1)).append(", "); + } + blindsListString.remove(blindsListString.length()-2,2); + label_blindsList->setText(blindsListString); + } } void gameLobbyDialogImpl::playerSelected(QTreeWidgetItem* item, QTreeWidgetItem*) { - if (item) - pushButton_Kick->setEnabled(isGameAdministrator); + if (item) + pushButton_Kick->setEnabled(isGameAdministrator); } void gameLobbyDialogImpl::startGame() { - assert(mySession); - mySession->sendStartEvent(checkBox_fillUpWithComputerOpponents->isChecked()); + assert(mySession); + mySession->sendStartEvent(checkBox_fillUpWithComputerOpponents->isChecked()); } void gameLobbyDialogImpl::leaveGame() { - assert(mySession); - mySession->sendLeaveCurrentGame(); + assert(mySession); + mySession->sendLeaveCurrentGame(); - //stop autoStartTimerOverlay - autoStartTimerOverlay->hide(); - autoStartTimer->stop(); + //stop autoStartTimerOverlay + autoStartTimerOverlay->hide(); + autoStartTimer->stop(); - //stop waitStartGameMsgBoxes - waitStartGameMsgBoxTimer->stop(); - waitStartGameMsgBox->hide(); - waitRejoinStartGameMsgBox->hide(); + //stop waitStartGameMsgBoxes + waitStartGameMsgBoxTimer->stop(); + waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); } void gameLobbyDialogImpl::kickPlayer() { - QTreeWidgetItem *item = treeWidget_connectedPlayers->currentItem(); - if (item) { - QString playerName = item->text(0); - if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) { - { - MyMessageBox::warning(this, tr("Server Error"), - tr("You should not kick yourself from this game!"), - QMessageBox::Close); - } - } else { - assert(mySession); - mySession->kickPlayer(item->data(0, Qt::UserRole).toUInt()); - } - } - pushButton_Kick->setEnabled(false); + QTreeWidgetItem *item = treeWidget_connectedPlayers->currentItem(); + if (item) { + QString playerName = item->text(0); + if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) { + { + MyMessageBox::warning(this, tr("Server Error"), + tr("You should not kick yourself from this game!"), + QMessageBox::Close); + } + } else { + assert(mySession); + mySession->kickPlayer(item->data(0, Qt::UserRole).toUInt()); + } + } + pushButton_Kick->setEnabled(false); } void gameLobbyDialogImpl::keyPressEvent ( QKeyEvent * event ) { - // qDebug() << event->key() << "\n"; + // qDebug() << event->key() << "\n"; - if (event->key() == Qt::Key_Enter && lineEdit_ChatInput->hasFocus()) { - myChat->sendMessage(); - } + if (event->key() == Qt::Key_Enter && lineEdit_ChatInput->hasFocus()) { + myChat->sendMessage(); + } - if (event->key() == Qt::Key_Up && lineEdit_ChatInput->hasFocus()) { - if((keyUpCounter + 1) <= myChat->getChatLinesHistorySize()) { - keyUpCounter++; - } - // std::cout << "Up keyUpCounter: " << keyUpCounter << "\n"; - myChat->showChatHistoryIndex(keyUpCounter); - } else if(event->key() == Qt::Key_Down && lineEdit_ChatInput->hasFocus()) { - if((keyUpCounter - 1) >= 0) { - keyUpCounter--; - } - // std::cout << "Down keyUpCounter: " << keyUpCounter << "\n"; - myChat->showChatHistoryIndex(keyUpCounter); - } else { - keyUpCounter = 0; - } + if (event->key() == Qt::Key_Up && lineEdit_ChatInput->hasFocus()) { + if((keyUpCounter + 1) <= myChat->getChatLinesHistorySize()) { + keyUpCounter++; + } + // std::cout << "Up keyUpCounter: " << keyUpCounter << "\n"; + myChat->showChatHistoryIndex(keyUpCounter); + } else if(event->key() == Qt::Key_Down && lineEdit_ChatInput->hasFocus()) { + if((keyUpCounter - 1) >= 0) { + keyUpCounter--; + } + // std::cout << "Down keyUpCounter: " << keyUpCounter << "\n"; + myChat->showChatHistoryIndex(keyUpCounter); + } else { + keyUpCounter = 0; + } - // if (event->key() == Qt::Key_Tab) event->ignore(); else { /*blah*/ } + // if (event->key() == Qt::Key_Tab) event->ignore(); else { /*blah*/ } - // if (event->key() == Qt::Key_N) showInvitationDialog(); - // if (event->key() == Qt::Key_M) guestUserMode(); + // if (event->key() == Qt::Key_N) showInvitationDialog(); + // if (event->key() == Qt::Key_M) guestUserMode(); } bool gameLobbyDialogImpl::eventFilter(QObject *obj, QEvent *event) { - QKeyEvent *keyEvent = static_cast(event); - QFocusEvent *focusEvent = static_cast(event); + QKeyEvent *keyEvent = static_cast(event); + QFocusEvent *focusEvent = static_cast(event); - if (obj == lineEdit_ChatInput && lineEdit_ChatInput->text() != "" && event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Tab) { - myChat->nickAutoCompletition(); - return true; - } 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); - } + if (obj == lineEdit_ChatInput && lineEdit_ChatInput->text() != "" && event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Tab) { + myChat->nickAutoCompletition(); + return true; + } 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); + } } bool gameLobbyDialogImpl::event ( QEvent * event ) { - return QDialog::event(event); + return QDialog::event(event); } void gameLobbyDialogImpl::showGameDescription(bool show) { - if(show) { + if(show) { #ifndef GUI_800x480 - label_gameType->show(); + label_gameType->show(); #endif - label_gameDesc2->show(); - label_gameDesc3->show(); - label_gameDesc4->show(); - label_gameDesc5->show(); - label_gameDesc6->show(); - label_gameDesc7->show(); - } else { - label_gameType->hide(); - label_gameDesc2->hide(); - label_gameDesc3->hide(); - label_gameDesc4->hide(); - label_gameDesc5->hide(); - label_gameDesc6->hide(); - label_gameDesc7->hide(); - } + label_gameDesc2->show(); + label_gameDesc3->show(); + label_gameDesc4->show(); + label_gameDesc5->show(); + label_gameDesc6->show(); + label_gameDesc7->show(); + } else { + label_gameType->hide(); + label_gameDesc2->hide(); + label_gameDesc3->hide(); + label_gameDesc4->hide(); + label_gameDesc5->hide(); + label_gameDesc6->hide(); + label_gameDesc7->hide(); + } } void gameLobbyDialogImpl::showWaitStartGameMsgBox() { - if(this->isVisible()) { - waitStartGameMsgBox->show(); - waitStartGameMsgBox->raise(); - waitStartGameMsgBox->activateWindow(); - pushButton_Leave->setDisabled(true); - } + if(this->isVisible()) { + waitStartGameMsgBox->show(); + waitStartGameMsgBox->raise(); + waitStartGameMsgBox->activateWindow(); + pushButton_Leave->setDisabled(true); + } } void gameLobbyDialogImpl::hideWaitStartGameMsgBox() { - waitStartGameMsgBox->hide(); - waitRejoinStartGameMsgBox->hide(); + waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); } void gameLobbyDialogImpl::joinAnyGameButtonRefresh() { - int openNonPrivateNonFullGamesCounter = 0; + int openNonPrivateNonFullGamesCounter = 0; - int it = 0; - while (myGameListModel->item(it)) { + int it = 0; + while (myGameListModel->item(it)) { - int players = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",0,0).toInt(); - int maxPlayers = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",1,1).toInt(); - if (myGameListModel->item(it, 2)->data(16) == "open" && myGameListModel->item(it, 4)->data(16) == "nonpriv" && players < maxPlayers) { - openNonPrivateNonFullGamesCounter++; - } - ++it; - } + int players = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",0,0).toInt(); + int maxPlayers = myGameListModel->item(it, 1)->data(Qt::DisplayRole).toString().section("/",1,1).toInt(); + if (myGameListModel->item(it, 2)->data(16) == "open" && myGameListModel->item(it, 4)->data(16) == "nonpriv" && players < maxPlayers) { + openNonPrivateNonFullGamesCounter++; + } + ++it; + } - if(openNonPrivateNonFullGamesCounter) pushButton_joinAnyGame->setEnabled(TRUE); - else pushButton_joinAnyGame->setEnabled(FALSE); + if(openNonPrivateNonFullGamesCounter) pushButton_joinAnyGame->setEnabled(TRUE); + else pushButton_joinAnyGame->setEnabled(FALSE); } void gameLobbyDialogImpl::reject() { - myStartWindow->show(); - QDialog::reject(); + myStartWindow->show(); + QDialog::reject(); } void gameLobbyDialogImpl::closeEvent(QCloseEvent *event) { - //stop waitStartGameMsgBoxes - waitStartGameMsgBoxTimer->stop(); - waitStartGameMsgBox->hide(); - waitRejoinStartGameMsgBox->hide(); - //enable leave button again - it was disabled during waitxyzMsgBoxes - pushButton_Leave->setEnabled(true); - event->accept(); + //stop waitStartGameMsgBoxes + waitStartGameMsgBoxTimer->stop(); + waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); + //enable leave button again - it was disabled during waitxyzMsgBoxes + pushButton_Leave->setEnabled(true); + event->accept(); } void gameLobbyDialogImpl::accept() { - //stop waitStartGameMsgBoxes - waitStartGameMsgBoxTimer->stop(); - closeAllChildDialogs(); - //enable leave button again - it was disabled during waitxyzMsgBoxes - pushButton_Leave->setEnabled(true); - QDialog::accept(); + //stop waitStartGameMsgBoxes + waitStartGameMsgBoxTimer->stop(); + closeAllChildDialogs(); + //enable leave button again - it was disabled during waitxyzMsgBoxes + pushButton_Leave->setEnabled(true); + QDialog::accept(); } void gameLobbyDialogImpl::writeDialogSettings(int saveMode) { - switch(saveMode) { - case 0: { - QHeaderView *header = treeView_GameList->header(); - myConfig->writeConfigInt("DlgGameLobbyGameListSortingSection", header->sortIndicatorSection()); - myConfig->writeConfigInt("DlgGameLobbyGameListSortingOrder", header->sortIndicatorOrder()); - } - break; - case 1: { - myConfig->writeConfigInt("DlgGameLobbyGameListFilterIndex", comboBox_gameListFilter->currentIndex()); - } - break; - case 2: { - myConfig->writeConfigInt("DlgGameLobbyNickListSortFilterIndex", comboBox_nickListFilter->currentIndex()); - } - break; - default: - ; - } + switch(saveMode) { + case 0: { + QHeaderView *header = treeView_GameList->header(); + myConfig->writeConfigInt("DlgGameLobbyGameListSortingSection", header->sortIndicatorSection()); + myConfig->writeConfigInt("DlgGameLobbyGameListSortingOrder", header->sortIndicatorOrder()); + } + break; + case 1: { + myConfig->writeConfigInt("DlgGameLobbyGameListFilterIndex", comboBox_gameListFilter->currentIndex()); + } + break; + case 2: { + myConfig->writeConfigInt("DlgGameLobbyNickListSortFilterIndex", comboBox_nickListFilter->currentIndex()); + } + break; + default: + ; + } - myConfig->writeBuffer(); + myConfig->writeBuffer(); } void gameLobbyDialogImpl::readDialogSettings() { - comboBox_gameListFilter->setCurrentIndex(myConfig->readConfigInt("DlgGameLobbyGameListFilterIndex")); - treeView_GameList->sortByColumn(myConfig->readConfigInt("DlgGameLobbyGameListSortingSection"), (Qt::SortOrder)myConfig->readConfigInt("DlgGameLobbyGameListSortingOrder") ); - comboBox_nickListFilter->setCurrentIndex(myConfig->readConfigInt("DlgGameLobbyNickListSortFilterIndex")); + comboBox_gameListFilter->setCurrentIndex(myConfig->readConfigInt("DlgGameLobbyGameListFilterIndex")); + treeView_GameList->sortByColumn(myConfig->readConfigInt("DlgGameLobbyGameListSortingSection"), (Qt::SortOrder)myConfig->readConfigInt("DlgGameLobbyGameListSortingOrder") ); + comboBox_nickListFilter->setCurrentIndex(myConfig->readConfigInt("DlgGameLobbyNickListSortFilterIndex")); } void gameLobbyDialogImpl::changeGameListFilter(int index) { - switch(index) { - case 0: { - myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); + switch(index) { + case 0: { + myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp()); - } - break; - case 1: { - myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); + } + break; + case 1: { + myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp()); - } - break; - case 2: { - myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); + } + break; + case 2: { + myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp()); - } - break; - case 3: { - myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("nonpriv", Qt::CaseInsensitive, QRegExp::FixedString)); + } + break; + case 3: { + myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("nonpriv", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp()); - } - break; - case 4: { - myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); - myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("private", Qt::CaseInsensitive, QRegExp::FixedString)); + } + break; + case 4: { + myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp()); + myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp("private", Qt::CaseInsensitive, QRegExp::FixedString)); myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp()); - } - break; - case 5: { - myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp("ranking", Qt::CaseInsensitive, QRegExp::FixedString)); - myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); + } + break; + case 5: { + myGameListSortFilterProxyModel->setColumn1RegExp(QRegExp("nonfull", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn2RegExp(QRegExp("open", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn3RegExp(QRegExp("ranking", Qt::CaseInsensitive, QRegExp::FixedString)); + myGameListSortFilterProxyModel->setColumn4RegExp(QRegExp()); myGameListSortFilterProxyModel->setColumn5RegExp(QRegExp()); - } - break; - default: - ; - } - myGameListSortFilterProxyModel->setFilterRegExp(QString()); - myGameListSortFilterProxyModel->setFilterKeyColumn(0); + } + break; + default: + ; + } + myGameListSortFilterProxyModel->setFilterRegExp(QString()); + myGameListSortFilterProxyModel->setFilterKeyColumn(0); - writeDialogSettings(1); + writeDialogSettings(1); #ifdef GUI_800x480 - if(index) treeView_GameList->setStyleSheet("QTreeView { border-radius: 4px; border: 2px solid blue; 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: 20px}"); - else 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: 20px}"); + if(index) treeView_GameList->setStyleSheet("QTreeView { border-radius: 4px; border: 2px solid blue; 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: 20px}"); + else 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: 20px}"); - treeView_GameList->header()->setStyleSheet("QObject {font: bold 18px}"); + treeView_GameList->header()->setStyleSheet("QObject {font: bold 18px}"); #else - if(index) treeView_GameList->setStyleSheet("QTreeView { border-radius: 4px; border: 2px solid blue; background-color: white; background-image: url(\""+myAppDataPath +"gfx/gui/misc/background_gamelist.png\"); background-attachment: fixed; background-position: top center ; background-repeat: no-repeat;}"); - else 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;}"); + if(index) treeView_GameList->setStyleSheet("QTreeView { border-radius: 4px; border: 2px solid blue; background-color: white; background-image: url(\""+myAppDataPath +"gfx/gui/misc/background_gamelist.png\"); background-attachment: fixed; background-position: top center ; background-repeat: no-repeat;}"); + else 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 } void gameLobbyDialogImpl::changeNickListFilter(int state) { - if(lastNickListFilterState == 0) { - myNickListSortFilterProxyModel->setLastFilterStateCountry(false); - myNickListSortFilterProxyModel->setLastFilterStateAlpha(true); - } else if(lastNickListFilterState == 1) { - myNickListSortFilterProxyModel->setLastFilterStateCountry(true); - myNickListSortFilterProxyModel->setLastFilterStateAlpha(false); - } + if(lastNickListFilterState == 0) { + myNickListSortFilterProxyModel->setLastFilterStateCountry(false); + myNickListSortFilterProxyModel->setLastFilterStateAlpha(true); + } else if(lastNickListFilterState == 1) { + myNickListSortFilterProxyModel->setLastFilterStateCountry(true); + myNickListSortFilterProxyModel->setLastFilterStateAlpha(false); + } - myNickListSortFilterProxyModel->setFilterState(state); - myNickListModel->sort(0, Qt::DescendingOrder); + myNickListSortFilterProxyModel->setFilterState(state); + myNickListModel->sort(0, Qt::DescendingOrder); - myNickListSortFilterProxyModel->setFilterRegExp(QString()); - myNickListSortFilterProxyModel->setFilterKeyColumn(0); + myNickListSortFilterProxyModel->setFilterRegExp(QString()); + myNickListSortFilterProxyModel->setFilterKeyColumn(0); - lastNickListFilterState = state; - writeDialogSettings(2); + lastNickListFilterState = state; + writeDialogSettings(2); } void gameLobbyDialogImpl::changeGameListSorting() { - writeDialogSettings(0); + writeDialogSettings(0); } void gameLobbyDialogImpl::registeredUserMode() { - lineEdit_ChatInput->clear(); - lineEdit_ChatInput->setEnabled(true); - guestMode = false; + lineEdit_ChatInput->clear(); + lineEdit_ChatInput->setEnabled(true); + guestMode = false; } void gameLobbyDialogImpl::guestUserMode() { - lineEdit_ChatInput->setText(tr("Chat is only available to registered players.")); - lineEdit_ChatInput->setDisabled(true); - guestMode = true; + lineEdit_ChatInput->setText(tr("Chat is only available to registered players.")); + lineEdit_ChatInput->setDisabled(true); + guestMode = true; } void gameLobbyDialogImpl::showNickListContextMenu(QPoint p) { - if(myNickListModel->rowCount() && myNickListSelectionModel->currentIndex().isValid()) { + if(myNickListModel->rowCount() && myNickListSelectionModel->currentIndex().isValid()) { - assert(mySession); - unsigned playerUid = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt(); + assert(mySession); + unsigned 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) { + if(inGame && mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY && playerUid != mySession->getClientUniquePlayerId() && !mySession->getClientPlayerInfo(playerUid).isGuest) { - nickListInviteAction->setEnabled(true); - nickListInviteAction->setText(tr("Invite %1").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str()))); + nickListInviteAction->setEnabled(true); + nickListInviteAction->setText(tr("Invite %1").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str()))); - } else { - nickListInviteAction->setText(tr("Invite player ...")); - nickListInviteAction->setEnabled(false); - } + } else { + nickListInviteAction->setText(tr("Invite player ...")); + nickListInviteAction->setEnabled(false); + } - if(playerUid != mySession->getClientUniquePlayerId() && !mySession->getClientPlayerInfo(playerUid).isGuest) { + if(playerUid != mySession->getClientUniquePlayerId() && !mySession->getClientPlayerInfo(playerUid).isGuest) { - nickListIgnorePlayerAction->setEnabled(true); - nickListIgnorePlayerAction->setText(tr("Ignore %1").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str()))); - } else { + nickListIgnorePlayerAction->setEnabled(true); + nickListIgnorePlayerAction->setText(tr("Ignore %1").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str()))); + } else { - nickListIgnorePlayerAction->setEnabled(false); - nickListIgnorePlayerAction->setText(tr("Ignore player ...")); - } + nickListIgnorePlayerAction->setEnabled(false); + nickListIgnorePlayerAction->setText(tr("Ignore player ...")); + } - unsigned gameIdOfPlayer = mySession->getGameIdOfPlayer(playerUid); - QString playerInGameInfoString; - if(gameIdOfPlayer) { - playerInGameInfoString = tr("%1 is playing in \"%2\".").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameIdOfPlayer).name.c_str())); - } else { - playerInGameInfoString = tr("%1 is not playing at the moment.").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str())); - } - nickListPlayerInGameInfo->setText(playerInGameInfoString); + unsigned gameIdOfPlayer = mySession->getGameIdOfPlayer(playerUid); + QString playerInGameInfoString; + if(gameIdOfPlayer) { + playerInGameInfoString = tr("%1 is playing in \"%2\".").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameIdOfPlayer).name.c_str())); + } else { + playerInGameInfoString = tr("%1 is not playing at the moment.").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerUid).playerName.c_str())); + } + nickListPlayerInGameInfo->setText(playerInGameInfoString); - //popup a little more to the right to avaoid double click action - QPoint tempPoint = p; - tempPoint.setX(p.x()+5); - nickListContextMenu->popup(treeView_NickList->mapToGlobal(tempPoint)); - } + //popup a little more to the right to avaoid double click action + QPoint tempPoint = p; + tempPoint.setX(p.x()+5); + nickListContextMenu->popup(treeView_NickList->mapToGlobal(tempPoint)); + } } void gameLobbyDialogImpl::showGameListContextMenu(QPoint p) { - if(myGameListModel->rowCount() && myGameListSelectionModel->currentIndex().isValid()) { - //popup a little more to the right to avaoid double click action - QPoint tempPoint = p; - tempPoint.setX(p.x()+5); - gameListContextMenu->popup(treeView_GameList->mapToGlobal(tempPoint)); - } + if(myGameListModel->rowCount() && myGameListSelectionModel->currentIndex().isValid()) { + //popup a little more to the right to avaoid double click action + QPoint tempPoint = p; + tempPoint.setX(p.x()+5); + gameListContextMenu->popup(treeView_GameList->mapToGlobal(tempPoint)); + } } void gameLobbyDialogImpl::invitePlayerToCurrentGame() { - if(myNickListSelectionModel->currentIndex().isValid()) { - mySession->invitePlayerToCurrentGame(myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt()); - } + if(myNickListSelectionModel->currentIndex().isValid()) { + mySession->invitePlayerToCurrentGame(myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt()); + } } void gameLobbyDialogImpl::showInfoMsgBox() { - switch(infoMsgToShowId) { - case 2: { - inviteOnlyInfoMsgBox->setModal(false); + switch(infoMsgToShowId) { + case 2: { + inviteOnlyInfoMsgBox->setModal(false); inviteOnlyInfoMsgBox->show(INFO_AFTER_JOIN_INVITE_GAME, tr("You have entered a game with type \"invite-only\".\nFeel free to invite other players by right-clicking on their nick in the available players list."), tr("PokerTH - Info Message"), QPixmap(":/gfx/ktip.png"), QDialogButtonBox::Ok, true); - } - break; - default: - ; - break; - } + } + break; + default: + ; + break; + } } void gameLobbyDialogImpl::showInvitationDialog(unsigned gameId, unsigned playerIdFrom) { - if(inviteDialogIsCurrentlyShown || playerIsOnIgnoreList(playerIdFrom)) { + if(inviteDialogIsCurrentlyShown || playerIsOnIgnoreList(playerIdFrom)) { - mySession->rejectGameInvitation(gameId, DENY_GAME_INVITATION_BUSY); - } else { + mySession->rejectGameInvitation(gameId, DENY_GAME_INVITATION_BUSY); + } else { - inviteDialogIsCurrentlyShown = true; + inviteDialogIsCurrentlyShown = true; - myMessageDialogImpl dialog(myConfig, this); + myMessageDialogImpl dialog(myConfig, this); if(dialog.exec(JOIN_INVITE_GAME_QUESTION, tr("You have been invited to the game %1 by %2.
Would you like to join this game?").arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str())), tr("PokerTH - Info Message"), QPixmap(":/gfx/list_add_user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false)) { - mySession->acceptGameInvitation(gameId); - inviteDialogIsCurrentlyShown = false; - } else { - mySession->rejectGameInvitation(gameId, DENY_GAME_INVITATION_NO); - inviteDialogIsCurrentlyShown = false; - } - } + mySession->acceptGameInvitation(gameId); + inviteDialogIsCurrentlyShown = false; + } else { + mySession->rejectGameInvitation(gameId, DENY_GAME_INVITATION_NO); + inviteDialogIsCurrentlyShown = false; + } + } } void gameLobbyDialogImpl::chatInfoPlayerInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom) { - textBrowser_ChatDisplay->append(tr("%1 has been invited to %2 by %3.").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdWho).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str()))); + textBrowser_ChatDisplay->append(tr("%1 has been invited to %2 by %3.").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdWho).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str()))); } void gameLobbyDialogImpl::chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason) { - QString string; - if(reason == DENY_GAME_INVITATION_NO) string = tr("%1 has rejected the invitation to %2."); + QString string; + if(reason == DENY_GAME_INVITATION_NO) string = tr("%1 has rejected the invitation to %2."); - if(reason == DENY_GAME_INVITATION_BUSY) string = tr("%1 cannot join %2 because he is busy."); + if(reason == DENY_GAME_INVITATION_BUSY) string = tr("%1 cannot join %2 because he is busy."); - textBrowser_ChatDisplay->append(string.arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdWho).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str()))); + textBrowser_ChatDisplay->append(string.arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdWho).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str()))); } bool gameLobbyDialogImpl::playerIsOnIgnoreList(unsigned playerId) { - list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); - list::iterator it1; - for(it1= playerIgnoreList.begin(); it1 != playerIgnoreList.end(); ++it1) { + list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); + list::iterator it1; + for(it1= playerIgnoreList.begin(); it1 != playerIgnoreList.end(); ++it1) { - if(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str()) == QString::fromUtf8(it1->c_str())) { - return true; - } - } - return false; + if(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str()) == QString::fromUtf8(it1->c_str())) { + return true; + } + } + return false; } void gameLobbyDialogImpl::putPlayerOnIgnoreList() { - if(myNickListSelectionModel->currentIndex().isValid()) { + if(myNickListSelectionModel->currentIndex().isValid()) { - unsigned playerId = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt(); + unsigned playerId = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt(); - if(!playerIsOnIgnoreList(playerId)) { + if(!playerIsOnIgnoreList(playerId)) { - myMessageDialogImpl dialog(myConfig, this); + myMessageDialogImpl dialog(myConfig, this); if(dialog.exec(INGNORE_PLAYER_QUESTION, tr("You will no longer receive chat messages or game invitations from this user.
Do you really want to put player %1 on your 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) { - 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(); + 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(); - } - } - } + myChat->refreshIgnoreList(); + } + } + } } void gameLobbyDialogImpl::searchForPlayerRegExpChanged() { - QRegExp regExp(lineEdit_searchForPlayers->text(), Qt::CaseInsensitive); - myNickListSortFilterProxyModel->setFilterRegExp(regExp); + QRegExp regExp(lineEdit_searchForPlayers->text(), Qt::CaseInsensitive); + myNickListSortFilterProxyModel->setFilterRegExp(regExp); } void gameLobbyDialogImpl::showAutoStartTimer() { - autoStartTimerOverlay->show(); - autoStartTimerOverlay->setGeometry(((scrollArea_gameInfos->geometry().width()-190)/2), ((scrollArea_gameInfos->geometry().height()-50)/2), 190, 50); + autoStartTimerOverlay->show(); + autoStartTimerOverlay->setGeometry(((scrollArea_gameInfos->geometry().width()-190)/2), ((scrollArea_gameInfos->geometry().height()-50)/2), 190, 50); - QString string(tr("The game will start in
%1 seconds.").arg(6)); + QString string(tr("The game will start in
%1 seconds.").arg(6)); + QString fontsize; +#ifdef ANDROID + fontsize="16px"; +#else + fontsize="10px"; +#endif + autoStartTimerOverlay->setText(""+string+""); + autoStartTimerCounter = 6; + autoStartTimer->start(1000); + +} + +void gameLobbyDialogImpl::updateAutoStartTimer() +{ + --autoStartTimerCounter; + if(autoStartTimerCounter) { + QString string(tr("The game will start in
%1 seconds.").arg(autoStartTimerCounter)); QString fontsize; #ifdef ANDROID fontsize="16px"; @@ -1776,354 +1809,337 @@ void gameLobbyDialogImpl::showAutoStartTimer() fontsize="10px"; #endif autoStartTimerOverlay->setText(""+string+""); - autoStartTimerCounter = 6; - autoStartTimer->start(1000); - -} - -void gameLobbyDialogImpl::updateAutoStartTimer() -{ - --autoStartTimerCounter; - if(autoStartTimerCounter) { - QString string(tr("The game will start in
%1 seconds.").arg(autoStartTimerCounter)); - QString fontsize; -#ifdef ANDROID - fontsize="16px"; -#else - fontsize="10px"; -#endif - autoStartTimerOverlay->setText(""+string+""); - } else { - autoStartTimer->stop(); - autoStartTimerOverlay->hide(); - } + } else { + autoStartTimer->stop(); + autoStartTimerOverlay->hide(); + } } void gameLobbyDialogImpl::openPlayerStats1() { - if(myNickListSelectionModel->currentIndex().isValid()) { + if(myNickListSelectionModel->currentIndex().isValid()) { - unsigned playerId = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt(); - if(!mySession->getClientPlayerInfo(playerId).isGuest) { - QUrl url("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(myNickListSelectionModel->currentIndex().data(Qt::DisplayRole).toString())); - QDesktopServices::openUrl(url); - } - } + unsigned playerId = myNickListSelectionModel->currentIndex().data(Qt::UserRole).toUInt(); + if(!mySession->getClientPlayerInfo(playerId).isGuest) { + QUrl url("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(myNickListSelectionModel->currentIndex().data(Qt::DisplayRole).toString())); + QDesktopServices::openUrl(url); + } + } } void gameLobbyDialogImpl::openPlayerStats2() { - if(treeWidget_connectedPlayers->currentItem()) { + if(treeWidget_connectedPlayers->currentItem()) { - unsigned playerId = treeWidget_connectedPlayers->currentItem()->data(0, Qt::UserRole).toUInt(); - if(!mySession->getClientPlayerInfo(playerId).isGuest) { - QUrl url("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(treeWidget_connectedPlayers->currentItem()->data(0, Qt::DisplayRole).toString())); - QDesktopServices::openUrl(url); - } - } + unsigned playerId = treeWidget_connectedPlayers->currentItem()->data(0, Qt::UserRole).toUInt(); + if(!mySession->getClientPlayerInfo(playerId).isGuest) { + QUrl url("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(treeWidget_connectedPlayers->currentItem()->data(0, Qt::DisplayRole).toString())); + QDesktopServices::openUrl(url); + } + } } void gameLobbyDialogImpl::showConnectedPlayersContextMenu(QPoint p) { - if(treeWidget_connectedPlayers->currentItem()) { + if(treeWidget_connectedPlayers->currentItem()) { - assert(mySession); - unsigned playerUid = treeWidget_connectedPlayers->currentItem()->data(0, Qt::UserRole).toUInt(); + assert(mySession); + unsigned playerUid = treeWidget_connectedPlayers->currentItem()->data(0, Qt::UserRole).toUInt(); - if(!mySession->getClientPlayerInfo(playerUid).isGuest) { + if(!mySession->getClientPlayerInfo(playerUid).isGuest) { - //popup a little more to the right to avaoid double click action - QPoint tempPoint = p; - tempPoint.setX(p.x()+5); - connectedPlayersListPlayerInfoSubMenu->popup(treeWidget_connectedPlayers->mapToGlobal(tempPoint)); - } - } + //popup a little more to the right to avaoid double click action + QPoint tempPoint = p; + tempPoint.setX(p.x()+5); + connectedPlayersListPlayerInfoSubMenu->popup(treeWidget_connectedPlayers->mapToGlobal(tempPoint)); + } + } } QString gameLobbyDialogImpl::getFullCountryString(QString cs) { - // Initialise map of country strings, if needed. - if (countryStringMap.empty()) { - countryStringMap.insert(CountryStringMap::value_type("AF", tr("Afghanistan"))); - countryStringMap.insert(CountryStringMap::value_type("AX", tr("ALand Islands"))); - countryStringMap.insert(CountryStringMap::value_type("AL", tr("Albania"))); - countryStringMap.insert(CountryStringMap::value_type("DZ", tr("Algeria"))); - countryStringMap.insert(CountryStringMap::value_type("AS", tr("American Samoa"))); - countryStringMap.insert(CountryStringMap::value_type("AD", tr("Andorra"))); - countryStringMap.insert(CountryStringMap::value_type("AO", tr("Angola"))); - countryStringMap.insert(CountryStringMap::value_type("AI", tr("Anguilla"))); - countryStringMap.insert(CountryStringMap::value_type("AQ", tr("Antarctica"))); - countryStringMap.insert(CountryStringMap::value_type("AG", tr("Antigua And Barbuda"))); - countryStringMap.insert(CountryStringMap::value_type("AR", tr("Argentina"))); - countryStringMap.insert(CountryStringMap::value_type("AM", tr("Armenia"))); - countryStringMap.insert(CountryStringMap::value_type("AW", tr("Aruba"))); - countryStringMap.insert(CountryStringMap::value_type("AU", tr("Australia"))); - countryStringMap.insert(CountryStringMap::value_type("AT", tr("Austria"))); - countryStringMap.insert(CountryStringMap::value_type("AZ", tr("Azerbaijan"))); - countryStringMap.insert(CountryStringMap::value_type("BS", tr("Bahamas"))); - countryStringMap.insert(CountryStringMap::value_type("BH", tr("Bahrain"))); - countryStringMap.insert(CountryStringMap::value_type("BD", tr("Bangladesh"))); - countryStringMap.insert(CountryStringMap::value_type("BB", tr("Barbados"))); - countryStringMap.insert(CountryStringMap::value_type("BY", tr("Belarus"))); - countryStringMap.insert(CountryStringMap::value_type("BE", tr("Belgium"))); - countryStringMap.insert(CountryStringMap::value_type("BZ", tr("Belize"))); - countryStringMap.insert(CountryStringMap::value_type("BJ", tr("Benin"))); - countryStringMap.insert(CountryStringMap::value_type("BM", tr("Bermuda"))); - countryStringMap.insert(CountryStringMap::value_type("BT", tr("Bhutan"))); - countryStringMap.insert(CountryStringMap::value_type("BO", tr("Bolivia"))); - countryStringMap.insert(CountryStringMap::value_type("BA", tr("Bosnia And Herzegovina"))); - countryStringMap.insert(CountryStringMap::value_type("BW", tr("Botswana"))); - countryStringMap.insert(CountryStringMap::value_type("BV", tr("Bouvet Island"))); - countryStringMap.insert(CountryStringMap::value_type("BR", tr("Brazil"))); - countryStringMap.insert(CountryStringMap::value_type("IO", tr("British Indian Ocean Territory"))); - countryStringMap.insert(CountryStringMap::value_type("BN", tr("Brunei Darussalam"))); - countryStringMap.insert(CountryStringMap::value_type("BG", tr("Bulgaria"))); - countryStringMap.insert(CountryStringMap::value_type("BF", tr("Burkina Faso"))); - countryStringMap.insert(CountryStringMap::value_type("BI", tr("Burundi"))); - countryStringMap.insert(CountryStringMap::value_type("KH", tr("Cambodia"))); - countryStringMap.insert(CountryStringMap::value_type("CM", tr("Cameroon"))); - countryStringMap.insert(CountryStringMap::value_type("CA", tr("Canada"))); - countryStringMap.insert(CountryStringMap::value_type("CV", tr("Cape Verde"))); - countryStringMap.insert(CountryStringMap::value_type("KY", tr("Cayman Islands"))); - countryStringMap.insert(CountryStringMap::value_type("CF", tr("Central African Republic"))); - countryStringMap.insert(CountryStringMap::value_type("TD", tr("Chad"))); - countryStringMap.insert(CountryStringMap::value_type("CL", tr("Chile"))); - countryStringMap.insert(CountryStringMap::value_type("CN", tr("China"))); - countryStringMap.insert(CountryStringMap::value_type("CX", tr("Christmas Island"))); - countryStringMap.insert(CountryStringMap::value_type("CC", tr("Cocos (Keeling) Islands"))); - countryStringMap.insert(CountryStringMap::value_type("CO", tr("Colombia"))); - countryStringMap.insert(CountryStringMap::value_type("KM", tr("Comoros"))); - countryStringMap.insert(CountryStringMap::value_type("CG", tr("Congo"))); - countryStringMap.insert(CountryStringMap::value_type("CD", tr("Congo, The Democratic Republic Of The"))); - countryStringMap.insert(CountryStringMap::value_type("CK", tr("Cook Islands"))); - countryStringMap.insert(CountryStringMap::value_type("CR", tr("Costa Rica"))); - countryStringMap.insert(CountryStringMap::value_type("CI", tr("Cote D'Ivoire"))); - countryStringMap.insert(CountryStringMap::value_type("HR", tr("Croatia"))); - countryStringMap.insert(CountryStringMap::value_type("CU", tr("Cuba"))); - countryStringMap.insert(CountryStringMap::value_type("CY", tr("Cyprus"))); - countryStringMap.insert(CountryStringMap::value_type("CZ", tr("Czech Republic"))); - countryStringMap.insert(CountryStringMap::value_type("DK", tr("Denmark"))); - countryStringMap.insert(CountryStringMap::value_type("DJ", tr("Djibouti"))); - countryStringMap.insert(CountryStringMap::value_type("DM", tr("Dominica"))); - countryStringMap.insert(CountryStringMap::value_type("DO", tr("Dominican Republic"))); - countryStringMap.insert(CountryStringMap::value_type("EC", tr("Ecuador"))); - countryStringMap.insert(CountryStringMap::value_type("EG", tr("Egypt"))); - countryStringMap.insert(CountryStringMap::value_type("SV", tr("El Salvador"))); - countryStringMap.insert(CountryStringMap::value_type("GQ", tr("Equatorial Guinea"))); - countryStringMap.insert(CountryStringMap::value_type("ER", tr("Eritrea"))); - countryStringMap.insert(CountryStringMap::value_type("EE", tr("Estonia"))); - countryStringMap.insert(CountryStringMap::value_type("ET", tr("Ethiopia"))); - countryStringMap.insert(CountryStringMap::value_type("FK", tr("Falkland Islands (Malvinas)"))); - countryStringMap.insert(CountryStringMap::value_type("FO", tr("Faroe Islands"))); - countryStringMap.insert(CountryStringMap::value_type("FJ", tr("Fiji"))); - countryStringMap.insert(CountryStringMap::value_type("FI", tr("Finland"))); - countryStringMap.insert(CountryStringMap::value_type("FR", tr("France"))); - countryStringMap.insert(CountryStringMap::value_type("GF", tr("French Guiana"))); - countryStringMap.insert(CountryStringMap::value_type("PF", tr("French Polynesia"))); - countryStringMap.insert(CountryStringMap::value_type("TF", tr("French Southern Territories"))); - countryStringMap.insert(CountryStringMap::value_type("GA", tr("Gabon"))); - countryStringMap.insert(CountryStringMap::value_type("GM", tr("Gambia"))); - countryStringMap.insert(CountryStringMap::value_type("GE", tr("Georgia"))); - countryStringMap.insert(CountryStringMap::value_type("DE", tr("Germany"))); - countryStringMap.insert(CountryStringMap::value_type("GH", tr("Ghana"))); - countryStringMap.insert(CountryStringMap::value_type("GI", tr("Gibraltar"))); - countryStringMap.insert(CountryStringMap::value_type("GR", tr("Greece"))); - countryStringMap.insert(CountryStringMap::value_type("GL", tr("Greenland"))); - countryStringMap.insert(CountryStringMap::value_type("GD", tr("Grenada"))); - countryStringMap.insert(CountryStringMap::value_type("GP", tr("Guadeloupe"))); - countryStringMap.insert(CountryStringMap::value_type("GU", tr("Guam"))); - countryStringMap.insert(CountryStringMap::value_type("GT", tr("Guatemala"))); - countryStringMap.insert(CountryStringMap::value_type("GG", tr("Guernsey"))); - countryStringMap.insert(CountryStringMap::value_type("GN", tr("Guinea"))); - countryStringMap.insert(CountryStringMap::value_type("GW", tr("Guinea-Bissau"))); - countryStringMap.insert(CountryStringMap::value_type("GY", tr("Guyana"))); - countryStringMap.insert(CountryStringMap::value_type("HT", tr("Haiti"))); - countryStringMap.insert(CountryStringMap::value_type("HM", tr("Heard Island And Mcdonald Islands"))); - countryStringMap.insert(CountryStringMap::value_type("VA", tr("Holy See (Vatican City State)"))); - countryStringMap.insert(CountryStringMap::value_type("HN", tr("Honduras"))); - countryStringMap.insert(CountryStringMap::value_type("HK", tr("Hong Kong"))); - countryStringMap.insert(CountryStringMap::value_type("HU", tr("Hungary"))); - countryStringMap.insert(CountryStringMap::value_type("IS", tr("Iceland"))); - countryStringMap.insert(CountryStringMap::value_type("IN", tr("India"))); - countryStringMap.insert(CountryStringMap::value_type("ID", tr("Indonesia"))); - countryStringMap.insert(CountryStringMap::value_type("IR", tr("Iran, Islamic Republic Of"))); - countryStringMap.insert(CountryStringMap::value_type("IQ", tr("Iraq"))); - countryStringMap.insert(CountryStringMap::value_type("IE", tr("Ireland"))); - countryStringMap.insert(CountryStringMap::value_type("IM", tr("Isle Of Man"))); - countryStringMap.insert(CountryStringMap::value_type("IL", tr("Israel"))); - countryStringMap.insert(CountryStringMap::value_type("IT", tr("Italy"))); - countryStringMap.insert(CountryStringMap::value_type("JM", tr("Jamaica"))); - countryStringMap.insert(CountryStringMap::value_type("JP", tr("Japan"))); - countryStringMap.insert(CountryStringMap::value_type("JE", tr("Jersey"))); - countryStringMap.insert(CountryStringMap::value_type("JO", tr("Jordan"))); - countryStringMap.insert(CountryStringMap::value_type("KZ", tr("Kazakhstan"))); - countryStringMap.insert(CountryStringMap::value_type("KE", tr("Kenya"))); - countryStringMap.insert(CountryStringMap::value_type("KI", tr("Kiribati"))); - countryStringMap.insert(CountryStringMap::value_type("KP", tr("Korea, Democratic People'S Republic Of"))); - countryStringMap.insert(CountryStringMap::value_type("KR", tr("Korea, Republic Of"))); - countryStringMap.insert(CountryStringMap::value_type("KW", tr("Kuwait"))); - countryStringMap.insert(CountryStringMap::value_type("KG", tr("Kyrgyzstan"))); - countryStringMap.insert(CountryStringMap::value_type("LA", tr("Lao People'S Democratic Republic"))); - countryStringMap.insert(CountryStringMap::value_type("LV", tr("Latvia"))); - countryStringMap.insert(CountryStringMap::value_type("LB", tr("Lebanon"))); - countryStringMap.insert(CountryStringMap::value_type("LS", tr("Lesotho"))); - countryStringMap.insert(CountryStringMap::value_type("LR", tr("Liberia"))); - countryStringMap.insert(CountryStringMap::value_type("LY", tr("Libyan Arab Jamahiriya"))); - countryStringMap.insert(CountryStringMap::value_type("LI", tr("Liechtenstein"))); - countryStringMap.insert(CountryStringMap::value_type("LT", tr("Lithuania"))); - countryStringMap.insert(CountryStringMap::value_type("LU", tr("Luxembourg"))); - countryStringMap.insert(CountryStringMap::value_type("MO", tr("Macao"))); - countryStringMap.insert(CountryStringMap::value_type("MK", tr("Macedonia, The Former Yugoslav Republic Of"))); - countryStringMap.insert(CountryStringMap::value_type("MG", tr("Madagascar"))); - countryStringMap.insert(CountryStringMap::value_type("MW", tr("Malawi"))); - countryStringMap.insert(CountryStringMap::value_type("MY", tr("Malaysia"))); - countryStringMap.insert(CountryStringMap::value_type("MV", tr("Maldives"))); - countryStringMap.insert(CountryStringMap::value_type("ML", tr("Mali"))); - countryStringMap.insert(CountryStringMap::value_type("MT", tr("Malta"))); - countryStringMap.insert(CountryStringMap::value_type("MH", tr("Marshall Islands"))); - countryStringMap.insert(CountryStringMap::value_type("MQ", tr("Martinique"))); - countryStringMap.insert(CountryStringMap::value_type("MR", tr("Mauritania"))); - countryStringMap.insert(CountryStringMap::value_type("MU", tr("Mauritius"))); - countryStringMap.insert(CountryStringMap::value_type("YT", tr("Mayotte"))); - countryStringMap.insert(CountryStringMap::value_type("MX", tr("Mexico"))); - countryStringMap.insert(CountryStringMap::value_type("FM", tr("Micronesia, Federated States Of"))); - countryStringMap.insert(CountryStringMap::value_type("MD", tr("Moldova, Republic Of"))); - countryStringMap.insert(CountryStringMap::value_type("MC", tr("Monaco"))); - countryStringMap.insert(CountryStringMap::value_type("MN", tr("Mongolia"))); - countryStringMap.insert(CountryStringMap::value_type("MS", tr("Montserrat"))); - countryStringMap.insert(CountryStringMap::value_type("MA", tr("Morocco"))); - countryStringMap.insert(CountryStringMap::value_type("MZ", tr("Mozambique"))); - countryStringMap.insert(CountryStringMap::value_type("MM", tr("Myanmar"))); - countryStringMap.insert(CountryStringMap::value_type("NA", tr("Namibia"))); - countryStringMap.insert(CountryStringMap::value_type("NR", tr("Nauru"))); - countryStringMap.insert(CountryStringMap::value_type("NP", tr("Nepal"))); - countryStringMap.insert(CountryStringMap::value_type("NL", tr("Netherlands"))); - countryStringMap.insert(CountryStringMap::value_type("AN", tr("Netherlands Antilles"))); - countryStringMap.insert(CountryStringMap::value_type("NC", tr("New Caledonia"))); - countryStringMap.insert(CountryStringMap::value_type("NZ", tr("New Zealand"))); - countryStringMap.insert(CountryStringMap::value_type("NI", tr("Nicaragua"))); - countryStringMap.insert(CountryStringMap::value_type("NE", tr("Niger"))); - countryStringMap.insert(CountryStringMap::value_type("NG", tr("Nigeria"))); - countryStringMap.insert(CountryStringMap::value_type("NU", tr("Niue"))); - countryStringMap.insert(CountryStringMap::value_type("NF", tr("Norfolk Island"))); - countryStringMap.insert(CountryStringMap::value_type("MP", tr("Northern Mariana Islands"))); - countryStringMap.insert(CountryStringMap::value_type("NO", tr("Norway"))); - countryStringMap.insert(CountryStringMap::value_type("OM", tr("Oman"))); - countryStringMap.insert(CountryStringMap::value_type("PK", tr("Pakistan"))); - countryStringMap.insert(CountryStringMap::value_type("PW", tr("Palau"))); - countryStringMap.insert(CountryStringMap::value_type("PS", tr("Palestinian Territory, Occupied"))); - countryStringMap.insert(CountryStringMap::value_type("PA", tr("Panama"))); - countryStringMap.insert(CountryStringMap::value_type("PG", tr("Papua New Guinea"))); - countryStringMap.insert(CountryStringMap::value_type("PY", tr("Paraguay"))); - countryStringMap.insert(CountryStringMap::value_type("PE", tr("Peru"))); - countryStringMap.insert(CountryStringMap::value_type("PH", tr("Philippines"))); - countryStringMap.insert(CountryStringMap::value_type("PN", tr("Pitcairn"))); - countryStringMap.insert(CountryStringMap::value_type("PL", tr("Poland"))); - countryStringMap.insert(CountryStringMap::value_type("PT", tr("Portugal"))); - countryStringMap.insert(CountryStringMap::value_type("PR", tr("Puerto Rico"))); - countryStringMap.insert(CountryStringMap::value_type("QA", tr("Qatar"))); - countryStringMap.insert(CountryStringMap::value_type("RE", tr("Reunion"))); - countryStringMap.insert(CountryStringMap::value_type("RO", tr("Romania"))); - countryStringMap.insert(CountryStringMap::value_type("RU", tr("Russian Federation"))); - countryStringMap.insert(CountryStringMap::value_type("RW", tr("Rwanda"))); - countryStringMap.insert(CountryStringMap::value_type("SH", tr("Saint Helena"))); - countryStringMap.insert(CountryStringMap::value_type("KN", tr("Saint Kitts And Nevis"))); - countryStringMap.insert(CountryStringMap::value_type("LC", tr("Saint Lucia"))); - countryStringMap.insert(CountryStringMap::value_type("PM", tr("Saint Pierre And Miquelon"))); - countryStringMap.insert(CountryStringMap::value_type("VC", tr("Saint Vincent And The Grenadines"))); - countryStringMap.insert(CountryStringMap::value_type("WS", tr("Samoa"))); - countryStringMap.insert(CountryStringMap::value_type("SM", tr("San Marino"))); - countryStringMap.insert(CountryStringMap::value_type("ST", tr("Sao Tome And Principe"))); - countryStringMap.insert(CountryStringMap::value_type("SA", tr("Saudi Arabia"))); - countryStringMap.insert(CountryStringMap::value_type("SN", tr("Senegal"))); - countryStringMap.insert(CountryStringMap::value_type("CS", tr("Serbia And Montenegro"))); - countryStringMap.insert(CountryStringMap::value_type("SC", tr("Seychelles"))); - countryStringMap.insert(CountryStringMap::value_type("SL", tr("Sierra Leone"))); - countryStringMap.insert(CountryStringMap::value_type("SG", tr("Singapore"))); - countryStringMap.insert(CountryStringMap::value_type("SK", tr("Slovakia"))); - countryStringMap.insert(CountryStringMap::value_type("SI", tr("Slovenia"))); - countryStringMap.insert(CountryStringMap::value_type("SB", tr("Solomon Islands"))); - countryStringMap.insert(CountryStringMap::value_type("SO", tr("Somalia"))); - countryStringMap.insert(CountryStringMap::value_type("ZA", tr("South Africa"))); - countryStringMap.insert(CountryStringMap::value_type("GS", tr("South Georgia And The South Sandwich Islands"))); - countryStringMap.insert(CountryStringMap::value_type("ES", tr("Spain"))); - countryStringMap.insert(CountryStringMap::value_type("LK", tr("Sri Lanka"))); - countryStringMap.insert(CountryStringMap::value_type("SD", tr("Sudan"))); - countryStringMap.insert(CountryStringMap::value_type("SR", tr("Suriname"))); - countryStringMap.insert(CountryStringMap::value_type("SJ", tr("Svalbard And Jan Mayen"))); - countryStringMap.insert(CountryStringMap::value_type("SZ", tr("Swaziland"))); - countryStringMap.insert(CountryStringMap::value_type("SE", tr("Sweden"))); - countryStringMap.insert(CountryStringMap::value_type("CH", tr("Switzerland"))); - countryStringMap.insert(CountryStringMap::value_type("SY", tr("Syrian Arab Republic"))); - countryStringMap.insert(CountryStringMap::value_type("TW", tr("Taiwan, Province Of China"))); - countryStringMap.insert(CountryStringMap::value_type("TJ", tr("Tajikistan"))); - countryStringMap.insert(CountryStringMap::value_type("TZ", tr("Tanzania, United Republic Of"))); - countryStringMap.insert(CountryStringMap::value_type("TH", tr("Thailand"))); - countryStringMap.insert(CountryStringMap::value_type("TL", tr("Timor-Leste"))); - countryStringMap.insert(CountryStringMap::value_type("TG", tr("Togo"))); - countryStringMap.insert(CountryStringMap::value_type("TK", tr("Tokelau"))); - countryStringMap.insert(CountryStringMap::value_type("TO", tr("Tonga"))); - countryStringMap.insert(CountryStringMap::value_type("TT", tr("Trinidad And Tobago"))); - countryStringMap.insert(CountryStringMap::value_type("TN", tr("Tunisia"))); - countryStringMap.insert(CountryStringMap::value_type("TR", tr("Turkey"))); - countryStringMap.insert(CountryStringMap::value_type("TM", tr("Turkmenistan"))); - countryStringMap.insert(CountryStringMap::value_type("TC", tr("Turks And Caicos Islands"))); - countryStringMap.insert(CountryStringMap::value_type("TV", tr("Tuvalu"))); - countryStringMap.insert(CountryStringMap::value_type("UG", tr("Uganda"))); - countryStringMap.insert(CountryStringMap::value_type("UA", tr("Ukraine"))); - countryStringMap.insert(CountryStringMap::value_type("AE", tr("United Arab Emirates"))); - countryStringMap.insert(CountryStringMap::value_type("GB", tr("United Kingdom"))); - countryStringMap.insert(CountryStringMap::value_type("US", tr("United States"))); - countryStringMap.insert(CountryStringMap::value_type("UM", tr("United States Minor Outlying Islands"))); - countryStringMap.insert(CountryStringMap::value_type("UY", tr("Uruguay"))); - countryStringMap.insert(CountryStringMap::value_type("UZ", tr("Uzbekistan"))); - countryStringMap.insert(CountryStringMap::value_type("VU", tr("Vanuatu"))); - countryStringMap.insert(CountryStringMap::value_type("VE", tr("Venezuela"))); - countryStringMap.insert(CountryStringMap::value_type("VN", tr("Viet Nam"))); - countryStringMap.insert(CountryStringMap::value_type("VG", tr("Virgin Islands, British"))); - countryStringMap.insert(CountryStringMap::value_type("VI", tr("Virgin Islands, U.S."))); - countryStringMap.insert(CountryStringMap::value_type("WF", tr("Wallis And Futuna"))); - countryStringMap.insert(CountryStringMap::value_type("EH", tr("Western Sahara"))); - countryStringMap.insert(CountryStringMap::value_type("YE", tr("Yemen"))); - countryStringMap.insert(CountryStringMap::value_type("ZM", tr("Zambia"))); - countryStringMap.insert(CountryStringMap::value_type("ZW", tr("Zimbabwe"))); - } + // Initialise map of country strings, if needed. + if (countryStringMap.empty()) { + countryStringMap.insert(CountryStringMap::value_type("AF", tr("Afghanistan"))); + countryStringMap.insert(CountryStringMap::value_type("AX", tr("ALand Islands"))); + countryStringMap.insert(CountryStringMap::value_type("AL", tr("Albania"))); + countryStringMap.insert(CountryStringMap::value_type("DZ", tr("Algeria"))); + countryStringMap.insert(CountryStringMap::value_type("AS", tr("American Samoa"))); + countryStringMap.insert(CountryStringMap::value_type("AD", tr("Andorra"))); + countryStringMap.insert(CountryStringMap::value_type("AO", tr("Angola"))); + countryStringMap.insert(CountryStringMap::value_type("AI", tr("Anguilla"))); + countryStringMap.insert(CountryStringMap::value_type("AQ", tr("Antarctica"))); + countryStringMap.insert(CountryStringMap::value_type("AG", tr("Antigua And Barbuda"))); + countryStringMap.insert(CountryStringMap::value_type("AR", tr("Argentina"))); + countryStringMap.insert(CountryStringMap::value_type("AM", tr("Armenia"))); + countryStringMap.insert(CountryStringMap::value_type("AW", tr("Aruba"))); + countryStringMap.insert(CountryStringMap::value_type("AU", tr("Australia"))); + countryStringMap.insert(CountryStringMap::value_type("AT", tr("Austria"))); + countryStringMap.insert(CountryStringMap::value_type("AZ", tr("Azerbaijan"))); + countryStringMap.insert(CountryStringMap::value_type("BS", tr("Bahamas"))); + countryStringMap.insert(CountryStringMap::value_type("BH", tr("Bahrain"))); + countryStringMap.insert(CountryStringMap::value_type("BD", tr("Bangladesh"))); + countryStringMap.insert(CountryStringMap::value_type("BB", tr("Barbados"))); + countryStringMap.insert(CountryStringMap::value_type("BY", tr("Belarus"))); + countryStringMap.insert(CountryStringMap::value_type("BE", tr("Belgium"))); + countryStringMap.insert(CountryStringMap::value_type("BZ", tr("Belize"))); + countryStringMap.insert(CountryStringMap::value_type("BJ", tr("Benin"))); + countryStringMap.insert(CountryStringMap::value_type("BM", tr("Bermuda"))); + countryStringMap.insert(CountryStringMap::value_type("BT", tr("Bhutan"))); + countryStringMap.insert(CountryStringMap::value_type("BO", tr("Bolivia"))); + countryStringMap.insert(CountryStringMap::value_type("BA", tr("Bosnia And Herzegovina"))); + countryStringMap.insert(CountryStringMap::value_type("BW", tr("Botswana"))); + countryStringMap.insert(CountryStringMap::value_type("BV", tr("Bouvet Island"))); + countryStringMap.insert(CountryStringMap::value_type("BR", tr("Brazil"))); + countryStringMap.insert(CountryStringMap::value_type("IO", tr("British Indian Ocean Territory"))); + countryStringMap.insert(CountryStringMap::value_type("BN", tr("Brunei Darussalam"))); + countryStringMap.insert(CountryStringMap::value_type("BG", tr("Bulgaria"))); + countryStringMap.insert(CountryStringMap::value_type("BF", tr("Burkina Faso"))); + countryStringMap.insert(CountryStringMap::value_type("BI", tr("Burundi"))); + countryStringMap.insert(CountryStringMap::value_type("KH", tr("Cambodia"))); + countryStringMap.insert(CountryStringMap::value_type("CM", tr("Cameroon"))); + countryStringMap.insert(CountryStringMap::value_type("CA", tr("Canada"))); + countryStringMap.insert(CountryStringMap::value_type("CV", tr("Cape Verde"))); + countryStringMap.insert(CountryStringMap::value_type("KY", tr("Cayman Islands"))); + countryStringMap.insert(CountryStringMap::value_type("CF", tr("Central African Republic"))); + countryStringMap.insert(CountryStringMap::value_type("TD", tr("Chad"))); + countryStringMap.insert(CountryStringMap::value_type("CL", tr("Chile"))); + countryStringMap.insert(CountryStringMap::value_type("CN", tr("China"))); + countryStringMap.insert(CountryStringMap::value_type("CX", tr("Christmas Island"))); + countryStringMap.insert(CountryStringMap::value_type("CC", tr("Cocos (Keeling) Islands"))); + countryStringMap.insert(CountryStringMap::value_type("CO", tr("Colombia"))); + countryStringMap.insert(CountryStringMap::value_type("KM", tr("Comoros"))); + countryStringMap.insert(CountryStringMap::value_type("CG", tr("Congo"))); + countryStringMap.insert(CountryStringMap::value_type("CD", tr("Congo, The Democratic Republic Of The"))); + countryStringMap.insert(CountryStringMap::value_type("CK", tr("Cook Islands"))); + countryStringMap.insert(CountryStringMap::value_type("CR", tr("Costa Rica"))); + countryStringMap.insert(CountryStringMap::value_type("CI", tr("Cote D'Ivoire"))); + countryStringMap.insert(CountryStringMap::value_type("HR", tr("Croatia"))); + countryStringMap.insert(CountryStringMap::value_type("CU", tr("Cuba"))); + countryStringMap.insert(CountryStringMap::value_type("CY", tr("Cyprus"))); + countryStringMap.insert(CountryStringMap::value_type("CZ", tr("Czech Republic"))); + countryStringMap.insert(CountryStringMap::value_type("DK", tr("Denmark"))); + countryStringMap.insert(CountryStringMap::value_type("DJ", tr("Djibouti"))); + countryStringMap.insert(CountryStringMap::value_type("DM", tr("Dominica"))); + countryStringMap.insert(CountryStringMap::value_type("DO", tr("Dominican Republic"))); + countryStringMap.insert(CountryStringMap::value_type("EC", tr("Ecuador"))); + countryStringMap.insert(CountryStringMap::value_type("EG", tr("Egypt"))); + countryStringMap.insert(CountryStringMap::value_type("SV", tr("El Salvador"))); + countryStringMap.insert(CountryStringMap::value_type("GQ", tr("Equatorial Guinea"))); + countryStringMap.insert(CountryStringMap::value_type("ER", tr("Eritrea"))); + countryStringMap.insert(CountryStringMap::value_type("EE", tr("Estonia"))); + countryStringMap.insert(CountryStringMap::value_type("ET", tr("Ethiopia"))); + countryStringMap.insert(CountryStringMap::value_type("FK", tr("Falkland Islands (Malvinas)"))); + countryStringMap.insert(CountryStringMap::value_type("FO", tr("Faroe Islands"))); + countryStringMap.insert(CountryStringMap::value_type("FJ", tr("Fiji"))); + countryStringMap.insert(CountryStringMap::value_type("FI", tr("Finland"))); + countryStringMap.insert(CountryStringMap::value_type("FR", tr("France"))); + countryStringMap.insert(CountryStringMap::value_type("GF", tr("French Guiana"))); + countryStringMap.insert(CountryStringMap::value_type("PF", tr("French Polynesia"))); + countryStringMap.insert(CountryStringMap::value_type("TF", tr("French Southern Territories"))); + countryStringMap.insert(CountryStringMap::value_type("GA", tr("Gabon"))); + countryStringMap.insert(CountryStringMap::value_type("GM", tr("Gambia"))); + countryStringMap.insert(CountryStringMap::value_type("GE", tr("Georgia"))); + countryStringMap.insert(CountryStringMap::value_type("DE", tr("Germany"))); + countryStringMap.insert(CountryStringMap::value_type("GH", tr("Ghana"))); + countryStringMap.insert(CountryStringMap::value_type("GI", tr("Gibraltar"))); + countryStringMap.insert(CountryStringMap::value_type("GR", tr("Greece"))); + countryStringMap.insert(CountryStringMap::value_type("GL", tr("Greenland"))); + countryStringMap.insert(CountryStringMap::value_type("GD", tr("Grenada"))); + countryStringMap.insert(CountryStringMap::value_type("GP", tr("Guadeloupe"))); + countryStringMap.insert(CountryStringMap::value_type("GU", tr("Guam"))); + countryStringMap.insert(CountryStringMap::value_type("GT", tr("Guatemala"))); + countryStringMap.insert(CountryStringMap::value_type("GG", tr("Guernsey"))); + countryStringMap.insert(CountryStringMap::value_type("GN", tr("Guinea"))); + countryStringMap.insert(CountryStringMap::value_type("GW", tr("Guinea-Bissau"))); + countryStringMap.insert(CountryStringMap::value_type("GY", tr("Guyana"))); + countryStringMap.insert(CountryStringMap::value_type("HT", tr("Haiti"))); + countryStringMap.insert(CountryStringMap::value_type("HM", tr("Heard Island And Mcdonald Islands"))); + countryStringMap.insert(CountryStringMap::value_type("VA", tr("Holy See (Vatican City State)"))); + countryStringMap.insert(CountryStringMap::value_type("HN", tr("Honduras"))); + countryStringMap.insert(CountryStringMap::value_type("HK", tr("Hong Kong"))); + countryStringMap.insert(CountryStringMap::value_type("HU", tr("Hungary"))); + countryStringMap.insert(CountryStringMap::value_type("IS", tr("Iceland"))); + countryStringMap.insert(CountryStringMap::value_type("IN", tr("India"))); + countryStringMap.insert(CountryStringMap::value_type("ID", tr("Indonesia"))); + countryStringMap.insert(CountryStringMap::value_type("IR", tr("Iran, Islamic Republic Of"))); + countryStringMap.insert(CountryStringMap::value_type("IQ", tr("Iraq"))); + countryStringMap.insert(CountryStringMap::value_type("IE", tr("Ireland"))); + countryStringMap.insert(CountryStringMap::value_type("IM", tr("Isle Of Man"))); + countryStringMap.insert(CountryStringMap::value_type("IL", tr("Israel"))); + countryStringMap.insert(CountryStringMap::value_type("IT", tr("Italy"))); + countryStringMap.insert(CountryStringMap::value_type("JM", tr("Jamaica"))); + countryStringMap.insert(CountryStringMap::value_type("JP", tr("Japan"))); + countryStringMap.insert(CountryStringMap::value_type("JE", tr("Jersey"))); + countryStringMap.insert(CountryStringMap::value_type("JO", tr("Jordan"))); + countryStringMap.insert(CountryStringMap::value_type("KZ", tr("Kazakhstan"))); + countryStringMap.insert(CountryStringMap::value_type("KE", tr("Kenya"))); + countryStringMap.insert(CountryStringMap::value_type("KI", tr("Kiribati"))); + countryStringMap.insert(CountryStringMap::value_type("KP", tr("Korea, Democratic People'S Republic Of"))); + countryStringMap.insert(CountryStringMap::value_type("KR", tr("Korea, Republic Of"))); + countryStringMap.insert(CountryStringMap::value_type("KW", tr("Kuwait"))); + countryStringMap.insert(CountryStringMap::value_type("KG", tr("Kyrgyzstan"))); + countryStringMap.insert(CountryStringMap::value_type("LA", tr("Lao People'S Democratic Republic"))); + countryStringMap.insert(CountryStringMap::value_type("LV", tr("Latvia"))); + countryStringMap.insert(CountryStringMap::value_type("LB", tr("Lebanon"))); + countryStringMap.insert(CountryStringMap::value_type("LS", tr("Lesotho"))); + countryStringMap.insert(CountryStringMap::value_type("LR", tr("Liberia"))); + countryStringMap.insert(CountryStringMap::value_type("LY", tr("Libyan Arab Jamahiriya"))); + countryStringMap.insert(CountryStringMap::value_type("LI", tr("Liechtenstein"))); + countryStringMap.insert(CountryStringMap::value_type("LT", tr("Lithuania"))); + countryStringMap.insert(CountryStringMap::value_type("LU", tr("Luxembourg"))); + countryStringMap.insert(CountryStringMap::value_type("MO", tr("Macao"))); + countryStringMap.insert(CountryStringMap::value_type("MK", tr("Macedonia, The Former Yugoslav Republic Of"))); + countryStringMap.insert(CountryStringMap::value_type("MG", tr("Madagascar"))); + countryStringMap.insert(CountryStringMap::value_type("MW", tr("Malawi"))); + countryStringMap.insert(CountryStringMap::value_type("MY", tr("Malaysia"))); + countryStringMap.insert(CountryStringMap::value_type("MV", tr("Maldives"))); + countryStringMap.insert(CountryStringMap::value_type("ML", tr("Mali"))); + countryStringMap.insert(CountryStringMap::value_type("MT", tr("Malta"))); + countryStringMap.insert(CountryStringMap::value_type("MH", tr("Marshall Islands"))); + countryStringMap.insert(CountryStringMap::value_type("MQ", tr("Martinique"))); + countryStringMap.insert(CountryStringMap::value_type("MR", tr("Mauritania"))); + countryStringMap.insert(CountryStringMap::value_type("MU", tr("Mauritius"))); + countryStringMap.insert(CountryStringMap::value_type("YT", tr("Mayotte"))); + countryStringMap.insert(CountryStringMap::value_type("MX", tr("Mexico"))); + countryStringMap.insert(CountryStringMap::value_type("FM", tr("Micronesia, Federated States Of"))); + countryStringMap.insert(CountryStringMap::value_type("MD", tr("Moldova, Republic Of"))); + countryStringMap.insert(CountryStringMap::value_type("MC", tr("Monaco"))); + countryStringMap.insert(CountryStringMap::value_type("MN", tr("Mongolia"))); + countryStringMap.insert(CountryStringMap::value_type("MS", tr("Montserrat"))); + countryStringMap.insert(CountryStringMap::value_type("MA", tr("Morocco"))); + countryStringMap.insert(CountryStringMap::value_type("MZ", tr("Mozambique"))); + countryStringMap.insert(CountryStringMap::value_type("MM", tr("Myanmar"))); + countryStringMap.insert(CountryStringMap::value_type("NA", tr("Namibia"))); + countryStringMap.insert(CountryStringMap::value_type("NR", tr("Nauru"))); + countryStringMap.insert(CountryStringMap::value_type("NP", tr("Nepal"))); + countryStringMap.insert(CountryStringMap::value_type("NL", tr("Netherlands"))); + countryStringMap.insert(CountryStringMap::value_type("AN", tr("Netherlands Antilles"))); + countryStringMap.insert(CountryStringMap::value_type("NC", tr("New Caledonia"))); + countryStringMap.insert(CountryStringMap::value_type("NZ", tr("New Zealand"))); + countryStringMap.insert(CountryStringMap::value_type("NI", tr("Nicaragua"))); + countryStringMap.insert(CountryStringMap::value_type("NE", tr("Niger"))); + countryStringMap.insert(CountryStringMap::value_type("NG", tr("Nigeria"))); + countryStringMap.insert(CountryStringMap::value_type("NU", tr("Niue"))); + countryStringMap.insert(CountryStringMap::value_type("NF", tr("Norfolk Island"))); + countryStringMap.insert(CountryStringMap::value_type("MP", tr("Northern Mariana Islands"))); + countryStringMap.insert(CountryStringMap::value_type("NO", tr("Norway"))); + countryStringMap.insert(CountryStringMap::value_type("OM", tr("Oman"))); + countryStringMap.insert(CountryStringMap::value_type("PK", tr("Pakistan"))); + countryStringMap.insert(CountryStringMap::value_type("PW", tr("Palau"))); + countryStringMap.insert(CountryStringMap::value_type("PS", tr("Palestinian Territory, Occupied"))); + countryStringMap.insert(CountryStringMap::value_type("PA", tr("Panama"))); + countryStringMap.insert(CountryStringMap::value_type("PG", tr("Papua New Guinea"))); + countryStringMap.insert(CountryStringMap::value_type("PY", tr("Paraguay"))); + countryStringMap.insert(CountryStringMap::value_type("PE", tr("Peru"))); + countryStringMap.insert(CountryStringMap::value_type("PH", tr("Philippines"))); + countryStringMap.insert(CountryStringMap::value_type("PN", tr("Pitcairn"))); + countryStringMap.insert(CountryStringMap::value_type("PL", tr("Poland"))); + countryStringMap.insert(CountryStringMap::value_type("PT", tr("Portugal"))); + countryStringMap.insert(CountryStringMap::value_type("PR", tr("Puerto Rico"))); + countryStringMap.insert(CountryStringMap::value_type("QA", tr("Qatar"))); + countryStringMap.insert(CountryStringMap::value_type("RE", tr("Reunion"))); + countryStringMap.insert(CountryStringMap::value_type("RO", tr("Romania"))); + countryStringMap.insert(CountryStringMap::value_type("RU", tr("Russian Federation"))); + countryStringMap.insert(CountryStringMap::value_type("RW", tr("Rwanda"))); + countryStringMap.insert(CountryStringMap::value_type("SH", tr("Saint Helena"))); + countryStringMap.insert(CountryStringMap::value_type("KN", tr("Saint Kitts And Nevis"))); + countryStringMap.insert(CountryStringMap::value_type("LC", tr("Saint Lucia"))); + countryStringMap.insert(CountryStringMap::value_type("PM", tr("Saint Pierre And Miquelon"))); + countryStringMap.insert(CountryStringMap::value_type("VC", tr("Saint Vincent And The Grenadines"))); + countryStringMap.insert(CountryStringMap::value_type("WS", tr("Samoa"))); + countryStringMap.insert(CountryStringMap::value_type("SM", tr("San Marino"))); + countryStringMap.insert(CountryStringMap::value_type("ST", tr("Sao Tome And Principe"))); + countryStringMap.insert(CountryStringMap::value_type("SA", tr("Saudi Arabia"))); + countryStringMap.insert(CountryStringMap::value_type("SN", tr("Senegal"))); + countryStringMap.insert(CountryStringMap::value_type("CS", tr("Serbia And Montenegro"))); + countryStringMap.insert(CountryStringMap::value_type("SC", tr("Seychelles"))); + countryStringMap.insert(CountryStringMap::value_type("SL", tr("Sierra Leone"))); + countryStringMap.insert(CountryStringMap::value_type("SG", tr("Singapore"))); + countryStringMap.insert(CountryStringMap::value_type("SK", tr("Slovakia"))); + countryStringMap.insert(CountryStringMap::value_type("SI", tr("Slovenia"))); + countryStringMap.insert(CountryStringMap::value_type("SB", tr("Solomon Islands"))); + countryStringMap.insert(CountryStringMap::value_type("SO", tr("Somalia"))); + countryStringMap.insert(CountryStringMap::value_type("ZA", tr("South Africa"))); + countryStringMap.insert(CountryStringMap::value_type("GS", tr("South Georgia And The South Sandwich Islands"))); + countryStringMap.insert(CountryStringMap::value_type("ES", tr("Spain"))); + countryStringMap.insert(CountryStringMap::value_type("LK", tr("Sri Lanka"))); + countryStringMap.insert(CountryStringMap::value_type("SD", tr("Sudan"))); + countryStringMap.insert(CountryStringMap::value_type("SR", tr("Suriname"))); + countryStringMap.insert(CountryStringMap::value_type("SJ", tr("Svalbard And Jan Mayen"))); + countryStringMap.insert(CountryStringMap::value_type("SZ", tr("Swaziland"))); + countryStringMap.insert(CountryStringMap::value_type("SE", tr("Sweden"))); + countryStringMap.insert(CountryStringMap::value_type("CH", tr("Switzerland"))); + countryStringMap.insert(CountryStringMap::value_type("SY", tr("Syrian Arab Republic"))); + countryStringMap.insert(CountryStringMap::value_type("TW", tr("Taiwan, Province Of China"))); + countryStringMap.insert(CountryStringMap::value_type("TJ", tr("Tajikistan"))); + countryStringMap.insert(CountryStringMap::value_type("TZ", tr("Tanzania, United Republic Of"))); + countryStringMap.insert(CountryStringMap::value_type("TH", tr("Thailand"))); + countryStringMap.insert(CountryStringMap::value_type("TL", tr("Timor-Leste"))); + countryStringMap.insert(CountryStringMap::value_type("TG", tr("Togo"))); + countryStringMap.insert(CountryStringMap::value_type("TK", tr("Tokelau"))); + countryStringMap.insert(CountryStringMap::value_type("TO", tr("Tonga"))); + countryStringMap.insert(CountryStringMap::value_type("TT", tr("Trinidad And Tobago"))); + countryStringMap.insert(CountryStringMap::value_type("TN", tr("Tunisia"))); + countryStringMap.insert(CountryStringMap::value_type("TR", tr("Turkey"))); + countryStringMap.insert(CountryStringMap::value_type("TM", tr("Turkmenistan"))); + countryStringMap.insert(CountryStringMap::value_type("TC", tr("Turks And Caicos Islands"))); + countryStringMap.insert(CountryStringMap::value_type("TV", tr("Tuvalu"))); + countryStringMap.insert(CountryStringMap::value_type("UG", tr("Uganda"))); + countryStringMap.insert(CountryStringMap::value_type("UA", tr("Ukraine"))); + countryStringMap.insert(CountryStringMap::value_type("AE", tr("United Arab Emirates"))); + countryStringMap.insert(CountryStringMap::value_type("GB", tr("United Kingdom"))); + countryStringMap.insert(CountryStringMap::value_type("US", tr("United States"))); + countryStringMap.insert(CountryStringMap::value_type("UM", tr("United States Minor Outlying Islands"))); + countryStringMap.insert(CountryStringMap::value_type("UY", tr("Uruguay"))); + countryStringMap.insert(CountryStringMap::value_type("UZ", tr("Uzbekistan"))); + countryStringMap.insert(CountryStringMap::value_type("VU", tr("Vanuatu"))); + countryStringMap.insert(CountryStringMap::value_type("VE", tr("Venezuela"))); + countryStringMap.insert(CountryStringMap::value_type("VN", tr("Viet Nam"))); + countryStringMap.insert(CountryStringMap::value_type("VG", tr("Virgin Islands, British"))); + countryStringMap.insert(CountryStringMap::value_type("VI", tr("Virgin Islands, U.S."))); + countryStringMap.insert(CountryStringMap::value_type("WF", tr("Wallis And Futuna"))); + countryStringMap.insert(CountryStringMap::value_type("EH", tr("Western Sahara"))); + countryStringMap.insert(CountryStringMap::value_type("YE", tr("Yemen"))); + countryStringMap.insert(CountryStringMap::value_type("ZM", tr("Zambia"))); + countryStringMap.insert(CountryStringMap::value_type("ZW", tr("Zimbabwe"))); + } - QString fullString(""); - if(!cs.isEmpty()) { - CountryStringMap::const_iterator pos = countryStringMap.find(cs); - if (pos != countryStringMap.end()) { - fullString = pos->second; - } - } - return fullString; + QString fullString(""); + if(!cs.isEmpty()) { + CountryStringMap::const_iterator pos = countryStringMap.find(cs); + if (pos != countryStringMap.end()) { + fullString = pos->second; + } + } + return fullString; } void gameLobbyDialogImpl::stopWaitStartGameMsgBoxTimer() { - waitStartGameMsgBoxTimer->stop(); + waitStartGameMsgBoxTimer->stop(); } void gameLobbyDialogImpl::closeAllChildDialogs() { - inviteOnlyInfoMsgBox->hide(); - waitStartGameMsgBox->hide(); - waitRejoinStartGameMsgBox->hide(); + inviteOnlyInfoMsgBox->hide(); + waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); } void gameLobbyDialogImpl::reportBadGameName() { - assert(mySession); - QItemSelectionModel *selection = treeView_GameList->selectionModel(); - if (selection->hasSelection()) { - unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt(); - GameInfo info(mySession->getClientGameInfo(gameId)); + assert(mySession); + QItemSelectionModel *selection = treeView_GameList->selectionModel(); + if (selection->hasSelection()) { + unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt(); + GameInfo info(mySession->getClientGameInfo(gameId)); - int ret = MyMessageBox::question(this, tr("PokerTH - Question"), - tr("Are you sure you want to report the game name:\n\"%1\" as inappropriate?").arg(QString::fromUtf8(info.name.c_str())), QMessageBox::Yes | QMessageBox::No); + int ret = MyMessageBox::question(this, tr("PokerTH - Question"), + tr("Are you sure you want to report the game name:\n\"%1\" as inappropriate?").arg(QString::fromUtf8(info.name.c_str())), QMessageBox::Yes | QMessageBox::No); - if(ret == QMessageBox::Yes) { - mySession->reportBadGameName(gameId); - } - } + if(ret == QMessageBox::Yes) { + mySession->reportBadGameName(gameId); + } + } } diff --git a/src/gui/qt/gui_800x480/aboutpokerth_800x480.ui b/src/gui/qt/gui_800x480/aboutpokerth_800x480.ui index 263e43f4..d54ae3eb 100755 --- a/src/gui/qt/gui_800x480/aboutpokerth_800x480.ui +++ b/src/gui/qt/gui_800x480/aboutpokerth_800x480.ui @@ -61,7 +61,7 @@ - :/gfx/logoChip3D.png + :/gfx/logoChip3D.png @@ -274,7 +274,7 @@ p, li { white-space: pre-wrap; } - + diff --git a/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui b/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui index 202eeea5..b1a6800a 100644 --- a/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui +++ b/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui @@ -150,7 +150,7 @@ Standard - + :/gfx/player_play.png:/gfx/player_play.png @@ -204,9 +204,11 @@ Password: - - - :/gfx/lock.png:/gfx/lock.png + + + 32 + 32 + diff --git a/src/gui/qt/gui_800x480/gamelobbydialog_800x480.ui b/src/gui/qt/gui_800x480/gamelobbydialog_800x480.ui index 853cc9e2..755ea40c 100644 --- a/src/gui/qt/gui_800x480/gamelobbydialog_800x480.ui +++ b/src/gui/qt/gui_800x480/gamelobbydialog_800x480.ui @@ -134,7 +134,7 @@ &Leave Game - + :/gfx/go-previous-view.png:/gfx/go-previous-view.png @@ -196,7 +196,7 @@ &Start Game - + :/gfx/dialog_ok_apply.png:/gfx/dialog_ok_apply.png @@ -232,7 +232,7 @@ &Kick Player - + :/gfx/list-remove.png:/gfx/list-remove.png @@ -330,7 +330,7 @@ Join &any game - + :/gfx/transform-rotate.png:/gfx/transform-rotate.png @@ -369,7 +369,7 @@ &Create Game - + :/gfx/list_add.png:/gfx/list_add.png @@ -395,7 +395,7 @@ &Join Game - + :/gfx/go-next-view.png:/gfx/go-next-view.png @@ -535,8 +535,8 @@ 0 0 - 292 - 197 + 288 + 195 @@ -619,9 +619,6 @@ - - QLabel { color:rgb(0, 0, 255); } - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -648,9 +645,6 @@ - - QLabel { color:rgb(0, 0, 255); } - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -677,9 +671,6 @@ - - QLabel { color:rgb(0, 0, 255); } - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -706,9 +697,6 @@ - - QLabel { color:rgb(0, 0, 255); } - @@ -738,9 +726,6 @@ - - QLabel { color:rgb(0, 0, 255); } - @@ -770,9 +755,6 @@ - - QLabel { color:rgb(0, 0, 255); } - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -815,7 +797,7 @@ Fill up with computer opponents - + :/gfx/swbuttonlocalgame.png:/gfx/swbuttonlocalgame.png @@ -1002,8 +984,8 @@ <!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 style=" font-family:'Nimbus Sans L'; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> +</style></head><body style=" font-family:'Liberation Sans'; font-size:18px; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Nimbus Sans L';"><br /></p></body></html> @@ -1098,20 +1080,10 @@ p, li { white-space: pre-wrap; } - + QObject {font: 14px} - - <!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> - true @@ -1135,13 +1107,6 @@ p, li { white-space: pre-wrap; } QObject {font: 14px} - - <!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> - true @@ -1164,7 +1129,7 @@ p, li { white-space: pre-wrap; } pushButton_Leave - + diff --git a/src/gui/qt/gui_800x480/gametable_800x480.ui b/src/gui/qt/gui_800x480/gametable_800x480.ui index b00024d3..653b09ee 100644 --- a/src/gui/qt/gui_800x480/gametable_800x480.ui +++ b/src/gui/qt/gui_800x480/gametable_800x480.ui @@ -18,16 +18,13 @@ - 1024 - 600 + 1980 + 1200 false - - PokerTH 0.6-beta - The Open-Source Texas Holdem Engine - QStatusbar { height:0px; } @@ -40,8 +37,8 @@ - 1024 - 600 + 1980 + 1200 @@ -4441,7 +4438,7 @@ p, li { white-space: pre-wrap; } - + :/gfx/view-fullscreen_50x50.png:/gfx/view-fullscreen_50x50.png @@ -4618,7 +4615,7 @@ p, li { white-space: pre-wrap; } 0 0 800 - 26 + 20 @@ -4685,7 +4682,7 @@ p, li { white-space: pre-wrap; } - + :/gfx/view-fullscreen.png:/gfx/view-fullscreen.png @@ -4743,7 +4740,7 @@ p, li { white-space: pre-wrap; } - + :/gfx/systemsettings.png:/gfx/systemsettings.png @@ -4752,7 +4749,7 @@ p, li { white-space: pre-wrap; } - + :/gfx/application_exit.png:/gfx/application_exit.png @@ -4824,7 +4821,7 @@ p, li { white-space: pre-wrap; } - + diff --git a/src/gui/qt/gui_800x480/internetgamelogindialog_800x480.ui b/src/gui/qt/gui_800x480/internetgamelogindialog_800x480.ui index 40bf2130..88206036 100644 --- a/src/gui/qt/gui_800x480/internetgamelogindialog_800x480.ui +++ b/src/gui/qt/gui_800x480/internetgamelogindialog_800x480.ui @@ -101,20 +101,10 @@ - + font: bold 30px - - <!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 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://create-gaming-account.pokerth.net"><span style=" text-decoration: underline; color:#0000ff;">Create new user account</span></a></p></td></tr></table></body></html> - true diff --git a/src/gui/qt/gui_800x480/logfiledialog_800x480.ui b/src/gui/qt/gui_800x480/logfiledialog_800x480.ui index 31452b7a..763bb27c 100644 --- a/src/gui/qt/gui_800x480/logfiledialog_800x480.ui +++ b/src/gui/qt/gui_800x480/logfiledialog_800x480.ui @@ -6,10 +6,16 @@ 0 0 - 618 - 392 + 800 + 424 + + + 800 + 424 + + Dialog @@ -22,9 +28,15 @@ Export as HTML - + :/gfx/text-html.png:/gfx/text-html.png + + + 32 + 32 + + @@ -33,9 +45,15 @@ Export as txt - + :/gfx/text-plain.png:/gfx/text-plain.png + + + 32 + 32 + + @@ -44,9 +62,15 @@ Save as ... - + :/gfx/filesave.png:/gfx/filesave.png + + + 32 + 32 + + @@ -55,9 +79,15 @@ Delete - + :/gfx/editdelete.png:/gfx/editdelete.png + + + 32 + 32 + + @@ -85,6 +115,12 @@ + + + 0 + 32 + + Qt::Horizontal @@ -132,7 +168,7 @@ - 200 + 250 16777215 @@ -173,15 +209,21 @@ Analyse Logfile ... - + :/gfx/view-statistics.png:/gfx/view-statistics.png + + + 32 + 32 + + - + diff --git a/src/gui/qt/gui_800x480/selectavatardialog_800x480.ui b/src/gui/qt/gui_800x480/selectavatardialog_800x480.ui index e0329054..2c6edf76 100644 --- a/src/gui/qt/gui_800x480/selectavatardialog_800x480.ui +++ b/src/gui/qt/gui_800x480/selectavatardialog_800x480.ui @@ -98,7 +98,7 @@ - + :/gfx/document-open-folder.png:/gfx/document-open-folder.png @@ -136,7 +136,7 @@ buttonBox - + diff --git a/src/gui/qt/gui_800x480/settingsdialog_800x480.ui b/src/gui/qt/gui_800x480/settingsdialog_800x480.ui index 8faaeb8b..128a614e 100644 --- a/src/gui/qt/gui_800x480/settingsdialog_800x480.ui +++ b/src/gui/qt/gui_800x480/settingsdialog_800x480.ui @@ -68,7 +68,7 @@ Interface - + :/gfx/preferences-desktop.png:/gfx/preferences-desktop.png @@ -77,7 +77,7 @@ Style - + :/gfx/fill-color.png:/gfx/fill-color.png @@ -86,7 +86,7 @@ Sound - + :/gfx/speaker.png:/gfx/speaker.png @@ -95,7 +95,7 @@ Local Game - + :/gfx/swbuttonlocalgame.png:/gfx/swbuttonlocalgame.png @@ -104,7 +104,7 @@ Network Game - + :/gfx/swbuttonjoinnetworkgame.png:/gfx/swbuttonjoinnetworkgame.png @@ -113,7 +113,7 @@ Internet Game - + :/gfx/swbuttoninternetgame.png:/gfx/swbuttoninternetgame.png @@ -122,7 +122,7 @@ Nicks/Avatars - + :/gfx/system_users.png:/gfx/system_users.png @@ -131,7 +131,7 @@ Log Messages - + :/gfx/utilities-log-viewer.png:/gfx/utilities-log-viewer.png @@ -140,15 +140,10 @@ Factory Settings - + :/gfx/document-revert.png:/gfx/document-revert.png - - - New Item - - @@ -755,7 +750,7 @@ p, li { white-space: pre-wrap; } - + :/gfx/document-open-folder.png:/gfx/document-open-folder.png @@ -2004,7 +1999,7 @@ p, li { white-space: pre-wrap; } Standard - + :/gfx/player_play.png:/gfx/player_play.png @@ -2013,7 +2008,7 @@ p, li { white-space: pre-wrap; } Registered players only - + :/gfx/registered.png:/gfx/registered.png @@ -2022,7 +2017,7 @@ p, li { white-space: pre-wrap; } Invited players only - + :/gfx/list_add_user.png:/gfx/list_add_user.png @@ -2031,7 +2026,7 @@ p, li { white-space: pre-wrap; } Ranking game - + :/gfx/cup.png:/gfx/cup.png @@ -2050,7 +2045,7 @@ p, li { white-space: pre-wrap; } Use password for private game: - + :/gfx/lock.png:/gfx/lock.png @@ -2115,7 +2110,7 @@ p, li { white-space: pre-wrap; } Remove Player - + :/gfx/list-remove.png:/gfx/list-remove.png @@ -3625,7 +3620,7 @@ p, li { white-space: pre-wrap; } - + :/gfx/document-open-folder.png:/gfx/document-open-folder.png @@ -3717,7 +3712,7 @@ p, li { white-space: pre-wrap; } Export as HTML - + :/gfx/text-html.png:/gfx/text-html.png @@ -3728,7 +3723,7 @@ p, li { white-space: pre-wrap; } Export as txt - + :/gfx/text-plain.png:/gfx/text-plain.png @@ -3739,7 +3734,7 @@ p, li { white-space: pre-wrap; } Save as ... - + :/gfx/filesave.png:/gfx/filesave.png @@ -3750,7 +3745,7 @@ p, li { white-space: pre-wrap; } Delete - + :/gfx/editdelete.png:/gfx/editdelete.png @@ -3876,276 +3871,6 @@ p, li { white-space: pre-wrap; } - - - - - - true - - - - - 0 - 0 - 580 - 371 - - - - - - 80 - 20 - 82 - 21 - - - - CheckBox - - - - - - 20 - 10 - 829 - 798 - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - aasdasd asdasdj asklasjda lkjasdl asd asd asd asd - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - asd asd asdasdakdja sasljf asd ajsdklja askljd asdjlka sdjasdj alskjd asdjasd jaslkdj asld as da a sd a - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - CheckBox - - - - - - - - - - @@ -4315,7 +4040,7 @@ p, li { white-space: pre-wrap; } buttonBox - + diff --git a/src/gui/qt/gui_800x480/startwindow_800x480.ui b/src/gui/qt/gui_800x480/startwindow_800x480.ui index 18ecd5f9..f27526b2 100755 --- a/src/gui/qt/gui_800x480/startwindow_800x480.ui +++ b/src/gui/qt/gui_800x480/startwindow_800x480.ui @@ -16,12 +16,6 @@ 480 - - - 1024 - 600 - - PokerTH - The Open-Source Texas Holdem Engine @@ -32,12 +26,6 @@ 424 - - - 1024 - 600 - - @@ -52,7 +40,7 @@ - + Qt::Horizontal @@ -67,6 +55,70 @@ + + + + + 0 + 0 + + + + + 350 + 80 + + + + + 350 + 80 + + + + Qt::NoFocus + + + &3 Create Network Game + + + + :/gfx/swbuttoncreatenetworkgame.png:/gfx/swbuttoncreatenetworkgame.png + + + + 48 + 48 + + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + &4 Join Network Game + + + + :/gfx/swbuttonjoinnetworkgame.png:/gfx/swbuttonjoinnetworkgame.png + + + + 48 + 48 + + + + @@ -98,12 +150,6 @@ Qt::NoFocus - - false - - - - &1 Start Local Game @@ -113,110 +159,8 @@ - 37 - 32 - - - - - - - - - 0 - 0 - - - - - 350 - 80 - - - - - 350 - 80 - - - - Qt::NoFocus - - - - - - &3 Create Network Game - - - - :/gfx/swbuttoncreatenetworkgame.png:/gfx/swbuttoncreatenetworkgame.png - - - - 37 - 32 - - - - - - - - - 0 - 0 - - - - - 350 - 80 - - - - - 350 - 80 - - - - Qt::NoFocus - - - - - - &2 Internet Game - - - - :/gfx/swbuttoninternetgame.png:/gfx/swbuttoninternetgame.png - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - &4 Join Network Game - - - - :/gfx/swbuttonjoinnetworkgame.png:/gfx/swbuttonjoinnetworkgame.png - - - - 37 - 32 + 48 + 48 @@ -247,8 +191,49 @@ - 37 - 32 + 48 + 48 + + + + Return + + + + + + + + 0 + 0 + + + + + 350 + 80 + + + + + 350 + 80 + + + + Qt::NoFocus + + + &2 Internet Game + + + + :/gfx/swbuttoninternetgame.png:/gfx/swbuttoninternetgame.png + + + + 48 + 48 @@ -273,15 +258,15 @@ - 37 - 32 + 48 + 48 - + Qt::Horizontal @@ -295,6 +280,65 @@ + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 350 + 80 + + + + Qt::NoFocus + + + Logs + + + + :/gfx/text-x-log.png:/gfx/text-x-log.png + + + + 48 + 48 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + Qt::Vertical @@ -428,6 +472,7 @@ + diff --git a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp index ba98a8d8..1221b444 100644 --- a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp +++ b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp @@ -25,6 +25,11 @@ internetGameLoginDialogImpl::internetGameLoginDialogImpl(QWidget *parent, Config { setupUi(this); + //html stuff + QString createAccount(QString("%1").arg(tr("Create new user account"))); + label_createAnAccount->setText(createAccount); + + connect(groupBox_reguser, SIGNAL(toggled(bool)), this, SLOT(regUserToggled(bool))); connect(checkBox_guest, SIGNAL(toggled(bool)), this, SLOT(guestUserToggled(bool))); connect(lineEdit_password, SIGNAL(textEdited(QString)), this, SLOT(okButtonCheck())); diff --git a/src/gui/qt/logfiledialog/logfiledialog.cpp b/src/gui/qt/logfiledialog/logfiledialog.cpp index b3947a08..a35d2935 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.cpp +++ b/src/gui/qt/logfiledialog/logfiledialog.cpp @@ -72,7 +72,11 @@ void LogFileDialog::refreshLogFileList() for (i=0; i < dbFilesList.size(); i++) { QTreeWidgetItem *item = new QTreeWidgetItem; - item->setText(0, dbFilesList.at(i).fileName()); +#ifdef GUI_800x480 + item->setText(0, dbFilesList.at(i).fileName().remove("pokerth-log-")); +#else + item->setText(0, dbFilesList.at(i).fileName()); +#endif item->setData(0, Qt::UserRole, dbFilesList.at(i).absoluteFilePath()); if(currentSqliteLogFile.fileName() == dbFilesList.at(i).fileName()) { item->setData(0, Qt::BackgroundColorRole, QColor(Qt::red)); @@ -113,7 +117,7 @@ void LogFileDialog::exportLogToHtml() QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); if(selectedItem) { - QFileInfo fi(selectedItem->text(0)); + QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString()); QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"), QDir::homePath()+"/"+fi.baseName()+".html", tr("PokerTH HTML log (*.html)")); @@ -129,7 +133,7 @@ void LogFileDialog::exportLogToTxt() QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); if(selectedItem) { - QFileInfo fi(selectedItem->text(0)); + QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString()); QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"), QDir::homePath()+"/"+fi.baseName()+".txt", tr("PokerTH plain text log (*.txt)")); @@ -145,7 +149,7 @@ void LogFileDialog::saveLogFileAs() QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); if(selectedItem) { - QFileInfo fi(selectedItem->text(0)); + QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString()); QString fileName = QFileDialog::getSaveFileName(this, tr("Save PokerTH log file"), QDir::homePath()+"/"+fi.baseName()+".pdb", tr("PokerTH SQL log (*.pdb)")); diff --git a/src/gui/qt/resources/application_exit.png b/src/gui/qt/resources/application_exit.png old mode 100644 new mode 100755 index feb5b646..c1549f49 Binary files a/src/gui/qt/resources/application_exit.png and b/src/gui/qt/resources/application_exit.png differ diff --git a/src/gui/qt/resources/dialog_close.png b/src/gui/qt/resources/dialog_close.png index 80495b4a..913d3c6e 100644 Binary files a/src/gui/qt/resources/dialog_close.png and b/src/gui/qt/resources/dialog_close.png differ diff --git a/src/gui/qt/resources/dialog_ok_apply.png b/src/gui/qt/resources/dialog_ok_apply.png old mode 100644 new mode 100755 index a9d162d5..01334d03 Binary files a/src/gui/qt/resources/dialog_ok_apply.png and b/src/gui/qt/resources/dialog_ok_apply.png differ diff --git a/src/gui/qt/resources/editdelete.png b/src/gui/qt/resources/editdelete.png index 1ac55fcb..c3ad8d9d 100644 Binary files a/src/gui/qt/resources/editdelete.png and b/src/gui/qt/resources/editdelete.png differ diff --git a/src/gui/qt/resources/filesave.png b/src/gui/qt/resources/filesave.png index 792e84bc..04d90070 100644 Binary files a/src/gui/qt/resources/filesave.png and b/src/gui/qt/resources/filesave.png differ diff --git a/src/gui/qt/resources/logoChip3D.png b/src/gui/qt/resources/logoChip3D.png index 66161506..798fbe40 100644 Binary files a/src/gui/qt/resources/logoChip3D.png and b/src/gui/qt/resources/logoChip3D.png differ diff --git a/src/gui/qt/resources/pokerth_android.qrc b/src/gui/qt/resources/pokerth_android.qrc index 6a96fd9b..1c41efc2 100644 --- a/src/gui/qt/resources/pokerth_android.qrc +++ b/src/gui/qt/resources/pokerth_android.qrc @@ -58,6 +58,7 @@ preferences-desktop_50x50.png tab-new-background.png tab-close.png + text-x-log.png cflags/ad.png @@ -543,4 +544,31 @@ android-data/gfx/cards/default_800x480/defaultdeckstyle_800x480.xml android-data/gfx/cards/default_800x480/flipside.png + + emotes/face-angel.png + emotes/face-angry.png + emotes/face-confused.png + emotes/face-cool.png + emotes/face-crying.png + emotes/face-devilish.png + emotes/face-embarrassed.png + emotes/face-in-love.png + emotes/face-kiss.png + emotes/face-laugh.png + emotes/face-plain.png + emotes/face-quiet.png + emotes/face-raspberry.png + emotes/face-sad.png + emotes/face-sick.png + emotes/face-sleep.png + emotes/face-smile-big.png + emotes/face-smile-grin.png + emotes/face-smile.png + emotes/face-smirk.png + emotes/face-surprise.png + emotes/face-uncertain.png + emotes/face-wink.png + emotes/face-worried.png + emotes/face-yawn.png + diff --git a/src/gui/qt/resources/preferences-desktop.png b/src/gui/qt/resources/preferences-desktop.png old mode 100644 new mode 100755 index c60cfd3c..2e8c7203 Binary files a/src/gui/qt/resources/preferences-desktop.png and b/src/gui/qt/resources/preferences-desktop.png differ diff --git a/src/gui/qt/resources/text-html.png b/src/gui/qt/resources/text-html.png old mode 100644 new mode 100755 index d2466e09..5e1777aa Binary files a/src/gui/qt/resources/text-html.png and b/src/gui/qt/resources/text-html.png differ diff --git a/src/gui/qt/resources/text-plain.png b/src/gui/qt/resources/text-plain.png old mode 100644 new mode 100755 index 51386922..e5a57ed4 Binary files a/src/gui/qt/resources/text-plain.png and b/src/gui/qt/resources/text-plain.png differ diff --git a/src/gui/qt/resources/text-x-log.png b/src/gui/qt/resources/text-x-log.png new file mode 100755 index 00000000..82468db0 Binary files /dev/null and b/src/gui/qt/resources/text-x-log.png differ diff --git a/src/gui/qt/resources/view-statistics.png b/src/gui/qt/resources/view-statistics.png index 5a05fa48..8326b2f2 100644 Binary files a/src/gui/qt/resources/view-statistics.png and b/src/gui/qt/resources/view-statistics.png differ diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index ff1aebe0..872582b7 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -20,11 +20,9 @@ #include "mystylelistitem.h" #include "gametablestylereader.h" #include "carddeckstylereader.h" - #include "configfile.h" #include #include - enum StyleType { POKERTH_DISTRIBUTED_STYLE, ADDITIONAL_STYLE }; using namespace std; diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.h b/src/gui/qt/settingsdialog/settingsdialogimpl.h index 6d08af52..bdd5c261 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.h +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.h @@ -38,6 +38,7 @@ class selectAvatarDialogImpl; class manualBlindsOrderDialogImpl; class MyStyleListItem; class guiLog; +class FlickCharm; class settingsDialogImpl: public QDialog, public Ui::settingsDialog { @@ -142,6 +143,7 @@ private: bool calledIngame; int changedLanguageIndex; guiLog *myGuiLog; + FlickCharm *fc; }; #endif diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 63caa30a..82a3084d 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -80,21 +80,22 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l) this->menubar->hide(); centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg_800x480.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}"); this->showFullScreen(); - this->setStyle(new QPlastiqueStyle); #else // this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:20px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }"); this->menubar->hide(); centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg_800x480.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}"); #endif -// pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); -// pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); -// pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); -// pushButton_Join_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); -// pushButton_about->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); -// pushButton_configure->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); + pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); + pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); + pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); + pushButton_Join_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); + pushButton_about->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); + pushButton_configure->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); + pushButton_Logs->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); connect( pushButton_about, SIGNAL( clicked() ), this, SLOT( callAboutPokerthDialog() ) ); connect( pushButton_configure, SIGNAL( clicked() ), this, SLOT( callSettingsDialogFromStartwindow() ) ); + connect( pushButton_Logs, SIGNAL( clicked() ), this, SLOT( callLogFileDialog() ) ); #else this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:12px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }"); diff --git a/src/pokerth.cpp b/src/pokerth.cpp index 5b769745..cf75a50c 100755 --- a/src/pokerth.cpp +++ b/src/pokerth.cpp @@ -44,11 +44,11 @@ #include #define ENABLE_LEAK_CHECK() \ - { \ - int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); \ - tmpFlag |= _CRTDBG_LEAK_CHECK_DF; \ - _CrtSetDbgFlag(tmpFlag); \ - } +{ \ + int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); \ + tmpFlag |= _CRTDBG_LEAK_CHECK_DF; \ + _CrtSetDbgFlag(tmpFlag); \ + } #endif #endif @@ -64,89 +64,100 @@ class Game; int main( int argc, char **argv ) { - //ENABLE_LEAK_CHECK(); + //ENABLE_LEAK_CHECK(); - //_CrtSetBreakAlloc(49937); - socket_startup(); - curl_global_init(CURL_GLOBAL_NOTHING); + //_CrtSetBreakAlloc(49937); + socket_startup(); + curl_global_init(CURL_GLOBAL_NOTHING); - /////// can be removed for non-qt-guis //////////// - QtSingleApplication a( argc, argv ); + /////// can be removed for non-qt-guis //////////// + QtSingleApplication a( argc, argv ); if (a.sendMessage("Wake up!")) { - return 0; - } + return 0; + } #ifdef __APPLE__ - // The following needs to be done directly after the application is created. - QDir dir(QApplication::applicationDirPath()); - dir.cdUp(); - dir.cd("plugins"); - QApplication::setLibraryPaths(QStringList(dir.absolutePath())); + // The following needs to be done directly after the application is created. + QDir dir(QApplication::applicationDirPath()); + dir.cdUp(); + dir.cd("plugins"); + QApplication::setLibraryPaths(QStringList(dir.absolutePath())); #endif - //create defaultconfig - ConfigFile *myConfig = new ConfigFile(argv[0], false); - Log *myLog = new Log(myConfig); + //create defaultconfig + ConfigFile *myConfig = new ConfigFile(argv[0], false); + Log *myLog = new Log(myConfig); - // set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets - a.setStyle(new QPlastiqueStyle); + // set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets + a.setStyle(new QPlastiqueStyle); + + QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); + //set QApplication default font - QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); - //set QApplication default font - - QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb"); - QFontDatabase::addApplicationFont (myAppDataPath +"fonts/VeraBd.ttf"); - QFontDatabase::addApplicationFont (myAppDataPath +"fonts/c059013l.pfb"); - QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf"); + QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb"); + QFontDatabase::addApplicationFont (myAppDataPath +"fonts/VeraBd.ttf"); + QFontDatabase::addApplicationFont (myAppDataPath +"fonts/c059013l.pfb"); + QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf"); #ifdef _WIN32 - QString font1String("QApplication, QWidget, QDialog { font-size: 12px; }"); + QString font1String("QApplication, QWidget, QDialog { font-size: 12px; }"); #elif __APPLE__ -// QString font1String("font-family: \"Lucida Grande\";"); - QString font1String("QApplication, QWidget, QDialog { font-size: 11px; }"); + // QString font1String("font-family: \"Lucida Grande\";"); + QString font1String("QApplication, QWidget, QDialog { font-size: 11px; }"); #elif ANDROID - QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 26px; }"); + QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 26px; }"); + QPalette p = a.palette(); + p.setColor(QPalette::Button, QColor::fromRgb(80,80,80)); + p.setColor(QPalette::Base, QColor::fromRgb(80,80,80)); + p.setColor(QPalette::Window, QColor::fromRgb(50,50,50)); + p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255)); + p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(100,100,100)); + p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255)); + p.setColor(QPalette::Text, QColor::fromRgb(255,255,255)); + p.setColor(QPalette::Link, QColor::fromRgb(192,192,255)); + p.setColor(QPalette::LinkVisited, QColor::fromRgb(192,192,255)); + a.setPalette(p); #else - QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 12px; }"); + QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 12px; }"); #endif - a.setStyleSheet(font1String + " QDialogButtonBox, QMessageBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/gfx/dialog_ok_apply.png); dialog-cancel-icon: url(:/gfx/dialog_close.png); dialog-close-icon: url(:/gfx/dialog_close.png); dialog-yes-icon: url(:/gfx/dialog_ok_apply.png); dialog-no-icon: url(:/gfx/dialog_close.png) }"); + a.setStyleSheet(font1String + " QDialogButtonBox, QMessageBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/gfx/dialog_ok_apply.png); dialog-cancel-icon: url(:/gfx/dialog_close.png); dialog-close-icon: url(:/gfx/dialog_close.png); dialog-yes-icon: url(:/gfx/dialog_ok_apply.png); dialog-no-icon: url(:/gfx/dialog_close.png) }"); - QPixmap pixmap(myAppDataPath + "gfx/gui/misc/welcomepokerth.png"); + QPixmap pixmap(myAppDataPath + "gfx/gui/misc/welcomepokerth.png"); #ifdef ANDROID - QDesktopWidget dw; - pixmap = pixmap.scaled(dw.screenGeometry().width(), dw.screenGeometry().height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + QDesktopWidget dw; + pixmap = pixmap.scaled(dw.screenGeometry().width(), dw.screenGeometry().height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); #endif - StartSplash splash(pixmap); - if(!myConfig->readConfigInt("DisableSplashScreenOnStartup")) { - splash.show(); - splash.showMessage(QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING), 0x0042, QColor(240,240,240)); - } + StartSplash splash(pixmap); + if(!myConfig->readConfigInt("DisableSplashScreenOnStartup")) { + splash.show(); + splash.showMessage(QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING), 0x0042, QColor(255,255,255)); + } - //Set translations - QTranslator qtTranslator; - qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language"))); - a.installTranslator(&qtTranslator); + //Set translations + QTranslator qtTranslator; + qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language"))); + a.installTranslator(&qtTranslator); - QTranslator translator; - translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language"))); - a.installTranslator(&translator); + QTranslator translator; + translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language"))); + a.installTranslator(&translator); - qRegisterMetaType("unsigned"); - qRegisterMetaType >("boost::shared_ptr"); - qRegisterMetaType("ServerStats"); - qRegisterMetaType("DenyGameInvitationReason"); - /////////////////////////////////////////////////// + qRegisterMetaType("unsigned"); + qRegisterMetaType >("boost::shared_ptr"); + qRegisterMetaType("ServerStats"); + qRegisterMetaType("DenyGameInvitationReason"); + /////////////////////////////////////////////////// startWindowImpl mainWin(myConfig,myLog); a.setActivationWindow(&mainWin, true); - int retVal = a.exec(); + int retVal = a.exec(); - curl_global_cleanup(); - socket_cleanup(); + curl_global_cleanup(); + socket_cleanup(); - return retVal; + return retVal; }