diff --git a/pokerth.pro b/pokerth.pro index ba3279a0..50e8510f 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -29,7 +29,8 @@ INCLUDEPATH += . \ src/gui/qt/settingsdialog \ src/gui/qt/settingsdialog/selectavatardialog \ src/gui/qt/startnetworkgamedialog \ - src/gui/qt/waitforservertostartgamedialog + src/gui/qt/waitforservertostartgamedialog \ + src/gui/qt/changehumanplayernamedialog DEPENDPATH += . \ src \ @@ -58,7 +59,8 @@ DEPENDPATH += . \ src/gui/qt/settingsdialog \ src/gui/qt/settingsdialog/selectavatardialog \ src/gui/qt/startnetworkgamedialog \ - src/gui/qt/waitforservertostartgamedialog + src/gui/qt/waitforservertostartgamedialog \ + src/gui/qt/changehumanplayernamedialog # Input HEADERS += src/game.h \ src/session.h \ @@ -126,6 +128,7 @@ HEADERS += src/game.h \ src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h \ src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h \ src/gui/qt/waitforservertostartgamedialog/waitforservertostartgamedialogimpl.h \ + src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.h \ src/gui/qttoolsinterface.h \ src/gui/qt/qttools/qttoolswrapper.h \ src/gui/qt/qttools/qthelper/qthelper.h \ @@ -139,7 +142,8 @@ FORMS += src/gui/qt/mainwindow.ui \ src/gui/qt/settingsdialog.ui \ src/gui/qt/selectavatardialog.ui \ src/gui/qt/startnetworkgamedialog.ui \ - src/gui/qt/waitforservertostartgamedialog.ui + src/gui/qt/waitforservertostartgamedialog.ui \ + src/gui/qt/changehumanplayernamedialog.ui SOURCES += src/game.cpp \ src/pokerth.cpp \ src/session.cpp \ @@ -215,6 +219,7 @@ SOURCES += src/game.cpp \ src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp \ src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp \ src/gui/qt/waitforservertostartgamedialog/waitforservertostartgamedialogimpl.cpp \ + src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.cpp \ src/gui/qttoolsinterface.cpp \ src/gui/qt/qttools/qttoolswrapper.cpp \ src/gui/qt/qttools/qthelper/qthelper.cpp \ diff --git a/src/gui/qt/changehumanplayernamedialog.ui b/src/gui/qt/changehumanplayernamedialog.ui index c65d2a4b..db42199b 100644 --- a/src/gui/qt/changehumanplayernamedialog.ui +++ b/src/gui/qt/changehumanplayernamedialog.ui @@ -5,12 +5,12 @@ 0 0 - 374 - 134 + 343 + 113 - Dialog + Network Error @@ -20,7 +20,11 @@ 6 - + + + Qt::AlignCenter + + diff --git a/src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.cpp b/src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.cpp new file mode 100644 index 00000000..e98dcc60 --- /dev/null +++ b/src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2006 by FThauer FHammer * + * f.thauer@web.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "changehumanplayernamedialogimpl.h" +// #include "session.h" +#include "configfile.h" + +changeHumanPlayerNameDialogImpl::changeHumanPlayerNameDialogImpl(QWidget *parent, ConfigFile *config) + : QDialog(parent), myConfig(config) +{ + + setupUi(this); + + lineEdit->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str())); + + connect(this, SIGNAL(accepted ()), this, SLOT(savePlayerName())); + +} + +void changeHumanPlayerNameDialogImpl::savePlayerName() { + + myConfig->writeConfigString("MyName", lineEdit->text().toUtf8().constData()); +} \ No newline at end of file diff --git a/src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.h b/src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.h new file mode 100644 index 00000000..b0ee0402 --- /dev/null +++ b/src/gui/qt/changehumanplayernamedialog/changehumanplayernamedialogimpl.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2006 by FThauer FHammer * + * f.thauer@web.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef CHANGEHUMANPLAYERNAMEDIALOGIMPL_H +#define CHANGEHUMANPLAYERNAMEDIALOGIMPL_H + +#include "ui_changehumanplayernamedialog.h" + +#include + +class ConfigFile; + +class changeHumanPlayerNameDialogImpl: public QDialog, public Ui::changeHumanPlayerNameDialog { +Q_OBJECT +public: + changeHumanPlayerNameDialogImpl(QWidget *parent = 0, ConfigFile *config = 0); + +public slots: + + void savePlayerName(); + +private: + + ConfigFile *myConfig; + +}; + +#endif diff --git a/src/gui/qt/mainwindow.ui b/src/gui/qt/mainwindow.ui index 94f79566..4a01216e 100644 --- a/src/gui/qt/mainwindow.ui +++ b/src/gui/qt/mainwindow.ui @@ -620,6 +620,33 @@ + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 111 + 160 + 0 + + + @@ -638,6 +665,15 @@ + + + + 111 + 160 + 0 + + + @@ -658,6 +694,33 @@ + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 111 + 160 + 0 + + + @@ -676,6 +739,15 @@ + + + + 111 + 160 + 0 + + + @@ -696,6 +768,33 @@ + + + + 111 + 139 + 100 + + + + + + + 111 + 139 + 100 + + + + + + + 111 + 139 + 100 + + + @@ -714,6 +813,15 @@ + + + + 111 + 139 + 100 + + + diff --git a/src/gui/qt/mainwindow/chat/chat.cpp b/src/gui/qt/mainwindow/chat/chat.cpp index d0b0fe68..5b00ef4f 100644 --- a/src/gui/qt/mainwindow/chat/chat.cpp +++ b/src/gui/qt/mainwindow/chat/chat.cpp @@ -65,3 +65,16 @@ void Chat::checkInputLength(QString string) { if(string.toUtf8().length() > 120) myW->lineEdit_ChatInput->setMaxLength(string.length()); } + +void Chat::clearNewGame() { + + myW->textBrowser_Chat->clear(); +/* 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); + +} diff --git a/src/gui/qt/mainwindow/chat/chat.h b/src/gui/qt/mainwindow/chat/chat.h index 541e4d9e..8da883a8 100644 --- a/src/gui/qt/mainwindow/chat/chat.h +++ b/src/gui/qt/mainwindow/chat/chat.h @@ -48,6 +48,7 @@ public slots: void receiveMessage(QString playerName, QString msg); void checkInvisible(); void checkInputLength(QString); + void clearNewGame(); private: diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 12a04ec0..ad013e74 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -28,6 +28,7 @@ #include "createnetworkgamedialogimpl.h" #include "startnetworkgamedialogimpl.h" #include "waitforservertostartgamedialogimpl.h" +#include "changehumanplayernamedialogimpl.h" #include "startsplash.h" #include "mycardspixmaplabel.h" @@ -409,6 +410,8 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) #else tmpFont1.setPixelSize(10); textBrowser_Log->setFont(tmpFont1); + textBrowser_Chat->setFont(tmpFont1); + lineEdit_ChatInput->setFont(tmpFont1); #endif QFont tmpFont2; tmpFont2.setFamily("Bitstream Vera Sans"); @@ -501,6 +504,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) myNewGameDialog = new newGameDialogImpl(this, myConfig); mySelectAvatarDialog = new selectAvatarDialogImpl(this, myConfig); mySettingsDialog = new settingsDialogImpl(this, myConfig, mySelectAvatarDialog); + myChangeHumanPlayerNameDialog = new changeHumanPlayerNameDialogImpl(this, myConfig); myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this, myConfig); myConnectToServerDialog = new connectToServerDialogImpl(this); myStartNetworkGameDialog = new startNetworkGameDialogImpl(this); @@ -2430,9 +2434,14 @@ void mainWindowImpl::networkError(int errorID, int osErrorID) { QMessageBox::Close); } break; case ERR_NET_PLAYER_NAME_IN_USE: - { QMessageBox::warning(this, tr("Network Error"), + { /*QMessageBox::warning(this, tr("Network Error"), tr("Your player name is already used by another player.\nPlease choose a different name."), - QMessageBox::Close); } + QMessageBox::Close);*/ + + myChangeHumanPlayerNameDialog->label_Message->setText(tr("Your player name is already used by another player.\nPlease choose a different name.")); + myChangeHumanPlayerNameDialog->exec(); + + } break; case ERR_NET_INVALID_PLAYER_NAME: { QMessageBox::warning(this, tr("Network Error"), @@ -2555,7 +2564,7 @@ void mainWindowImpl::networkGameModification() { tabWidget_Left->disableTab(1, FALSE); tabWidget_Left->setCurrentIndex(1); - textBrowser_Chat->clear(); + myChat->clearNewGame(); } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index f55a0617..094076cd 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -50,6 +50,7 @@ class connectToServerDialogImpl; class createNetworkGameDialogImpl; class startNetworkGameDialogImpl; class waitForServerToStartGameDialogImpl; +class changeHumanPlayerNameDialogImpl; class QColor; @@ -338,6 +339,7 @@ private: newGameDialogImpl *myNewGameDialog; settingsDialogImpl *mySettingsDialog; selectAvatarDialogImpl *mySelectAvatarDialog; + changeHumanPlayerNameDialogImpl *myChangeHumanPlayerNameDialog; joinNetworkGameDialogImpl *myJoinNetworkGameDialog; connectToServerDialogImpl *myConnectToServerDialog; startNetworkGameDialogImpl *myStartNetworkGameDialog;