improve nick-autocompletition, remove smallblinds //TODO's

This commit is contained in:
doitux
2007-10-10 23:31:53 +00:00
parent 253778bf30
commit 6292029954
5 changed files with 44 additions and 33 deletions
@@ -35,6 +35,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c)
connect( treeWidget_connectedPlayers, SIGNAL( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT( playerSelected(QTreeWidgetItem*, QTreeWidgetItem*) ) );
connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) );
connect( lineEdit_ChatInput, SIGNAL( textChanged (QString) ), this, SLOT( checkChatInputLength(QString) ) );
connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) );
lineEdit_ChatInput->installEventFilter(this);
@@ -80,13 +81,11 @@ void gameLobbyDialogImpl::createGame()
// Set Game Data
gameData.maxNumberOfPlayers = myCreateInternetGameDialog->spinBox_quantityPlayers->value();
gameData.startMoney = myCreateInternetGameDialog->spinBox_startCash->value();
gameData.smallBlind = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();//TODO remove
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();
gameData.handsBeforeRaise = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); //TODO remove
}
else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
@@ -29,13 +29,13 @@
using namespace std;
LobbyChat::LobbyChat(gameLobbyDialogImpl* l, ConfigFile *c) : myLobby(l), myConfig(c)
LobbyChat::LobbyChat(gameLobbyDialogImpl* l, ConfigFile *c) : myLobby(l), myConfig(c), nickAutoCompletitionCounter(0), chatTextEdited(FALSE)
{
chatInputCompleter = new QCompleter(myLobby->treeWidget_NickList->model());
// chatInputCompleter->setCaseSensitivity(Qt::CaseInsensitive);
// chatInputCompleter->setCompletionMode(QCompleter::PopupCompletion);
// myLobby->lineEdit_ChatInput->setCompleter(chatInputCompleter);
// chatInputCompleter = new QCompleter(myLobby->treeWidget_NickList->model());
// // chatInputCompleter->setCaseSensitivity(Qt::CaseInsensitive);
// // chatInputCompleter->setCompletionMode(QCompleter::PopupCompletion);
// // myLobby->lineEdit_ChatInput->setCompleter(chatInputCompleter);
}
@@ -146,14 +146,6 @@ void LobbyChat::clearChat() {
myLobby->textBrowser_ChatDisplay->clear();
myLobby->textBrowser_ChatDisplay->append(tr("Connecting to Chat server..."));
myLobby->lineEdit_ChatInput->setEnabled(false);
/* QStringList wordList;
wordList << "alpha" << "omega" << "omicron" << "zeta";*/
// QCompleter *completer = new QCompleter(wordList, this);
// completer->setCaseSensitivity(Qt::CaseInsensitive);
// completer->setCompletionMode(QCompleter::InlineCompletion);
// // lineEdit_ChatInput->setCompleter(completer);
}
void LobbyChat::chatError(int errorCode)
@@ -271,11 +263,14 @@ void LobbyChat::nickAutoCompletition() {
// QList<QTreeWidgetItem*> matchItemsList = myLobby->treeWidget_NickList->findItems(myChatStringList.last(),Qt::MatchStartsWith);
// QListIterator<QTreeWidgetItem*> it(matchItemsList);
QTreeWidgetItemIterator it(myLobby->treeWidget_NickList);
while (*it) {
if ((*it)->text(0).startsWith(myChatStringList.last()) && myChatStringList.last() != "")
matchStringList << (*it)->text(0);
++it;
if(nickAutoCompletitionCounter == 0) {
QTreeWidgetItemIterator it(myLobby->treeWidget_NickList);
while (*it) {
if ((*it)->text(0).startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "")
matchStringList << (*it)->text(0);
++it;
}
}
// QStringList::const_iterator constIterator;
@@ -283,13 +278,32 @@ void LobbyChat::nickAutoCompletition() {
// cout << (*constIterator).toLocal8Bit().constData() << endl;
// }
if(!matchStringList.isEmpty()) {
if(!matchStringList.isEmpty() || nickAutoCompletitionCounter > 0) {
myChatStringList.removeLast();
if(myChatStringList.isEmpty())
myLobby->lineEdit_ChatInput->setText(myChatStringList.join(" ")+matchStringList.first()+": ");
if(nickAutoCompletitionCounter == 0) {
//first one
lastChatString = myChatStringList.join(" ");
lastMatchStringList = matchStringList;
}
if(nickAutoCompletitionCounter == lastMatchStringList.size()) nickAutoCompletitionCounter = 0;
// cout << nickAutoCompletitionCounter << "\n";
if(lastChatString == "")
myLobby->lineEdit_ChatInput->setText(lastMatchStringList.at(nickAutoCompletitionCounter)+": ");
else
myLobby->lineEdit_ChatInput->setText(myChatStringList.join(" ")+" "+matchStringList.first()+": ");
myLobby->lineEdit_ChatInput->setText(lastChatString+" "+lastMatchStringList.at(nickAutoCompletitionCounter)+" ");
nickAutoCompletitionCounter++;
}
}
void LobbyChat::setChatTextEdited() {
chatTextEdited = TRUE;
nickAutoCompletitionCounter = 0;
}
@@ -59,6 +59,8 @@ public slots:
int getChatLinesHistorySize() { return chatLinesHistory.size(); }
void nickAutoCompletition();
void setChatTextEdited();
private:
gameLobbyDialogImpl *myLobby;
ConfigFile *myConfig;
@@ -67,7 +69,12 @@ private:
QStringList chatLinesHistory;
QCompleter *chatInputCompleter;
QString lastChatString;
QStringList lastMatchStringList;
int nickAutoCompletitionCounter;
bool chatTextEdited;
// friend class GuiWrapper;
};
-8
View File
@@ -729,13 +729,11 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
// Set Game Data
gameData.maxNumberOfPlayers = v->spinBox_quantityPlayers->value();
gameData.startMoney = v->spinBox_startCash->value();
gameData.smallBlind = v->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value(); //TODO remove
gameData.firstSmallBlind = v->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
if(v->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
gameData.raiseSmallBlindEveryHandsValue = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
gameData.handsBeforeRaise = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); //TODO remove
}
else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
@@ -773,15 +771,11 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
// Set Game Data
gameData.maxNumberOfPlayers = myConfig->readConfigInt("NumberOfPlayers");
gameData.startMoney = myConfig->readConfigInt("StartCash");
gameData.smallBlind = myConfig->readConfigInt("FirstSmallBlind"); //TODO remove
gameData.handsBeforeRaise = myConfig->readConfigInt("RaiseSmallBlindEveryHands"); //TODO remove
gameData.firstSmallBlind = myConfig->readConfigInt("FirstSmallBlind");
if(myConfig->readConfigInt("RaiseBlindsAtHands")) {
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
gameData.raiseSmallBlindEveryHandsValue = myConfig->readConfigInt("RaiseSmallBlindEveryHands");
gameData.handsBeforeRaise = myConfig->readConfigInt("RaiseSmallBlindEveryHands"); //TODO remove
}
else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
@@ -853,13 +847,11 @@ void mainWindowImpl::callCreateNetworkGameDialog() {
GameData gameData;
gameData.maxNumberOfPlayers = myCreateNetworkGameDialog->spinBox_quantityPlayers->value();
gameData.startMoney = myCreateNetworkGameDialog->spinBox_startCash->value();
gameData.smallBlind = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();//TODO remove
gameData.firstSmallBlind = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
if(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
gameData.raiseSmallBlindEveryHandsValue = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
gameData.handsBeforeRaise = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); //TODO remove
}
else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
-1
View File
@@ -526,7 +526,6 @@ void GetGameInfoData(const GameInfoData *inData, GameData &outData)
outData.guiSpeed = ntohs(inData->proposedGuiSpeed);
outData.playerActionTimeoutSec = ntohs(inData->playerActionTimeout);
outData.firstSmallBlind = ntohl(inData->firstSmallBlind);
/*remove me*/ outData.smallBlind = ntohs(inData->firstSmallBlind); // TODO remove
outData.afterMBAlwaysRaiseValue = ntohl(inData->endRaiseSmallBlindValue);
outData.startMoney = ntohl(inData->startMoney);