add changeHumanPlayerNameDialog

This commit is contained in:
doitux
2007-05-28 19:56:57 +00:00
parent 0e1abc3656
commit 61e2131470
9 changed files with 235 additions and 10 deletions
+8 -3
View File
@@ -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 \
+8 -4
View File
@@ -5,12 +5,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>374</width>
<height>134</height>
<width>343</width>
<height>113</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
<string>Network Error</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
@@ -20,7 +20,11 @@
<number>6</number>
</property>
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="label_Message" />
<widget class="QLabel" name="label_Message" >
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="lineEdit" />
@@ -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());
}
@@ -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 <QtCore>
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
+108
View File
@@ -620,6 +620,33 @@
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>160</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
@@ -638,6 +665,15 @@
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>160</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
@@ -658,6 +694,33 @@
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>160</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
@@ -676,6 +739,15 @@
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>160</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
@@ -696,6 +768,33 @@
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>139</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>139</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>139</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
@@ -714,6 +813,15 @@
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>111</red>
<green>139</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
+13
View File
@@ -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);
}
+1
View File
@@ -48,6 +48,7 @@ public slots:
void receiveMessage(QString playerName, QString msg);
void checkInvisible();
void checkInputLength(QString);
void clearNewGame();
private:
+12 -3
View File
@@ -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();
}
+2
View File
@@ -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;