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( treeWidget_connectedPlayers, SIGNAL( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*) ), this, SLOT( playerSelected(QTreeWidgetItem*, QTreeWidgetItem*) ) );
connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) ); connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) );
connect( lineEdit_ChatInput, SIGNAL( textChanged (QString) ), this, SLOT( checkChatInputLength(QString) ) ); connect( lineEdit_ChatInput, SIGNAL( textChanged (QString) ), this, SLOT( checkChatInputLength(QString) ) );
connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) );
lineEdit_ChatInput->installEventFilter(this); lineEdit_ChatInput->installEventFilter(this);
@@ -80,13 +81,11 @@ void gameLobbyDialogImpl::createGame()
// Set Game Data // Set Game Data
gameData.maxNumberOfPlayers = myCreateInternetGameDialog->spinBox_quantityPlayers->value(); gameData.maxNumberOfPlayers = myCreateInternetGameDialog->spinBox_quantityPlayers->value();
gameData.startMoney = myCreateInternetGameDialog->spinBox_startCash->value(); gameData.startMoney = myCreateInternetGameDialog->spinBox_startCash->value();
gameData.smallBlind = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();//TODO remove
gameData.firstSmallBlind = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value(); gameData.firstSmallBlind = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) { if(myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER; gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
gameData.raiseSmallBlindEveryHandsValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); gameData.raiseSmallBlindEveryHandsValue = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
gameData.handsBeforeRaise = myCreateInternetGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); //TODO remove
} }
else { else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES; gameData.raiseIntervalMode = RAISE_ON_MINUTES;
@@ -29,13 +29,13 @@
using namespace std; 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 = new QCompleter(myLobby->treeWidget_NickList->model());
// chatInputCompleter->setCaseSensitivity(Qt::CaseInsensitive); // // chatInputCompleter->setCaseSensitivity(Qt::CaseInsensitive);
// chatInputCompleter->setCompletionMode(QCompleter::PopupCompletion); // // chatInputCompleter->setCompletionMode(QCompleter::PopupCompletion);
// myLobby->lineEdit_ChatInput->setCompleter(chatInputCompleter); // // myLobby->lineEdit_ChatInput->setCompleter(chatInputCompleter);
} }
@@ -146,14 +146,6 @@ void LobbyChat::clearChat() {
myLobby->textBrowser_ChatDisplay->clear(); myLobby->textBrowser_ChatDisplay->clear();
myLobby->textBrowser_ChatDisplay->append(tr("Connecting to Chat server...")); myLobby->textBrowser_ChatDisplay->append(tr("Connecting to Chat server..."));
myLobby->lineEdit_ChatInput->setEnabled(false); 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) void LobbyChat::chatError(int errorCode)
@@ -271,25 +263,47 @@ void LobbyChat::nickAutoCompletition() {
// QList<QTreeWidgetItem*> matchItemsList = myLobby->treeWidget_NickList->findItems(myChatStringList.last(),Qt::MatchStartsWith); // QList<QTreeWidgetItem*> matchItemsList = myLobby->treeWidget_NickList->findItems(myChatStringList.last(),Qt::MatchStartsWith);
// QListIterator<QTreeWidgetItem*> it(matchItemsList); // QListIterator<QTreeWidgetItem*> it(matchItemsList);
if(nickAutoCompletitionCounter == 0) {
QTreeWidgetItemIterator it(myLobby->treeWidget_NickList); QTreeWidgetItemIterator it(myLobby->treeWidget_NickList);
while (*it) { while (*it) {
if ((*it)->text(0).startsWith(myChatStringList.last()) && myChatStringList.last() != "") if ((*it)->text(0).startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "")
matchStringList << (*it)->text(0); matchStringList << (*it)->text(0);
++it; ++it;
} }
}
// QStringList::const_iterator constIterator; // QStringList::const_iterator constIterator;
// for (constIterator = matchStringList.constBegin(); constIterator != matchStringList.constEnd(); ++constIterator) { // for (constIterator = matchStringList.constBegin(); constIterator != matchStringList.constEnd(); ++constIterator) {
// cout << (*constIterator).toLocal8Bit().constData() << endl; // cout << (*constIterator).toLocal8Bit().constData() << endl;
// } // }
if(!matchStringList.isEmpty()) { if(!matchStringList.isEmpty() || nickAutoCompletitionCounter > 0) {
myChatStringList.removeLast(); 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 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(); } int getChatLinesHistorySize() { return chatLinesHistory.size(); }
void nickAutoCompletition(); void nickAutoCompletition();
void setChatTextEdited();
private: private:
gameLobbyDialogImpl *myLobby; gameLobbyDialogImpl *myLobby;
ConfigFile *myConfig; ConfigFile *myConfig;
@@ -68,6 +70,11 @@ private:
QStringList chatLinesHistory; QStringList chatLinesHistory;
QCompleter *chatInputCompleter; QCompleter *chatInputCompleter;
QString lastChatString;
QStringList lastMatchStringList;
int nickAutoCompletitionCounter;
bool chatTextEdited;
// friend class GuiWrapper; // friend class GuiWrapper;
}; };
-8
View File
@@ -729,13 +729,11 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
// Set Game Data // Set Game Data
gameData.maxNumberOfPlayers = v->spinBox_quantityPlayers->value(); gameData.maxNumberOfPlayers = v->spinBox_quantityPlayers->value();
gameData.startMoney = v->spinBox_startCash->value(); gameData.startMoney = v->spinBox_startCash->value();
gameData.smallBlind = v->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value(); //TODO remove
gameData.firstSmallBlind = v->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value(); gameData.firstSmallBlind = v->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
if(v->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) { if(v->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER; gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
gameData.raiseSmallBlindEveryHandsValue = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); gameData.raiseSmallBlindEveryHandsValue = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
gameData.handsBeforeRaise = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); //TODO remove
} }
else { else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES; gameData.raiseIntervalMode = RAISE_ON_MINUTES;
@@ -773,15 +771,11 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
// Set Game Data // Set Game Data
gameData.maxNumberOfPlayers = myConfig->readConfigInt("NumberOfPlayers"); gameData.maxNumberOfPlayers = myConfig->readConfigInt("NumberOfPlayers");
gameData.startMoney = myConfig->readConfigInt("StartCash"); gameData.startMoney = myConfig->readConfigInt("StartCash");
gameData.smallBlind = myConfig->readConfigInt("FirstSmallBlind"); //TODO remove
gameData.handsBeforeRaise = myConfig->readConfigInt("RaiseSmallBlindEveryHands"); //TODO remove
gameData.firstSmallBlind = myConfig->readConfigInt("FirstSmallBlind"); gameData.firstSmallBlind = myConfig->readConfigInt("FirstSmallBlind");
if(myConfig->readConfigInt("RaiseBlindsAtHands")) { if(myConfig->readConfigInt("RaiseBlindsAtHands")) {
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER; gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
gameData.raiseSmallBlindEveryHandsValue = myConfig->readConfigInt("RaiseSmallBlindEveryHands"); gameData.raiseSmallBlindEveryHandsValue = myConfig->readConfigInt("RaiseSmallBlindEveryHands");
gameData.handsBeforeRaise = myConfig->readConfigInt("RaiseSmallBlindEveryHands"); //TODO remove
} }
else { else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES; gameData.raiseIntervalMode = RAISE_ON_MINUTES;
@@ -853,13 +847,11 @@ void mainWindowImpl::callCreateNetworkGameDialog() {
GameData gameData; GameData gameData;
gameData.maxNumberOfPlayers = myCreateNetworkGameDialog->spinBox_quantityPlayers->value(); gameData.maxNumberOfPlayers = myCreateNetworkGameDialog->spinBox_quantityPlayers->value();
gameData.startMoney = myCreateNetworkGameDialog->spinBox_startCash->value(); gameData.startMoney = myCreateNetworkGameDialog->spinBox_startCash->value();
gameData.smallBlind = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();//TODO remove
gameData.firstSmallBlind = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value(); gameData.firstSmallBlind = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
if(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) { if(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER; gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
gameData.raiseSmallBlindEveryHandsValue = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); gameData.raiseSmallBlindEveryHandsValue = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
gameData.handsBeforeRaise = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value(); //TODO remove
} }
else { else {
gameData.raiseIntervalMode = RAISE_ON_MINUTES; 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.guiSpeed = ntohs(inData->proposedGuiSpeed);
outData.playerActionTimeoutSec = ntohs(inData->playerActionTimeout); outData.playerActionTimeoutSec = ntohs(inData->playerActionTimeout);
outData.firstSmallBlind = ntohl(inData->firstSmallBlind); outData.firstSmallBlind = ntohl(inData->firstSmallBlind);
/*remove me*/ outData.smallBlind = ntohs(inData->firstSmallBlind); // TODO remove
outData.afterMBAlwaysRaiseValue = ntohl(inData->endRaiseSmallBlindValue); outData.afterMBAlwaysRaiseValue = ntohl(inData->endRaiseSmallBlindValue);
outData.startMoney = ntohl(inData->startMoney); outData.startMoney = ntohl(inData->startMoney);