diff --git a/pokerth.pro b/pokerth.pro index 011ce180..c1678295 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -129,6 +129,8 @@ HEADERS += src/game.h \ src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.h \ src/gui/qt/newlocalgamedialog/newgamedialogimpl.h \ src/gui/qt/settingsdialog/settingsdialogimpl.h \ + src/gui/qt/settingsdialog/myavatarbutton.h \ + src/gui/qt/settingsdialog/myhpavatarbutton.h \ src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h \ src/gui/qt/settingsdialog/selectavatardialog/myavatarlistitem.h \ src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.h \ @@ -223,6 +225,8 @@ SOURCES += src/game.cpp \ src/gui/qt/joinnetworkgamedialog/joinnetworkgamedialogimpl.cpp \ src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp \ src/gui/qt/settingsdialog/settingsdialogimpl.cpp \ + src/gui/qt/settingsdialog/myavatarbutton.cpp \ + src/gui/qt/settingsdialog/myhpavatarbutton.cpp \ src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp \ src/gui/qt/settingsdialog/selectavatardialog/myavatarlistitem.cpp \ src/gui/qt/startnetworkgamedialog/startnetworkgamedialogimpl.cpp \ diff --git a/src/gui/qt/joinnetworkgamedialog.ui b/src/gui/qt/joinnetworkgamedialog.ui index eb2d2b63..83142a2d 100644 --- a/src/gui/qt/joinnetworkgamedialog.ui +++ b/src/gui/qt/joinnetworkgamedialog.ui @@ -5,7 +5,7 @@ 0 0 - 586 + 614 458 @@ -31,13 +31,6 @@ 6 - - - - Use IPv6 - - - @@ -164,6 +157,11 @@ IPv6 + + + SCTP + + @@ -193,6 +191,40 @@ + + + + Use IPv6 + + + + + + + <a href="http://en.wikipedia.org/wiki/Ipv6">What is this?</a> + + + true + + + + + + + Use SCTP + + + + + + + <a href="http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol">What is this?</a> + + + true + + + diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 9474f570..39b6c514 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -798,7 +798,7 @@ void mainWindowImpl::callSettingsDialog() { if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame()) { HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); - currentHand->getPlayerArray()[0]->setMyName(mySettingsDialog->lineEdit_humanPlayerName->text().toUtf8().constData()); + currentHand->getPlayerArray()[0]->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData()); currentHand->getPlayerArray()[1]->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData()); currentHand->getPlayerArray()[2]->setMyName(mySettingsDialog->lineEdit_Opponent2Name->text().toUtf8().constData()); currentHand->getPlayerArray()[3]->setMyName(mySettingsDialog->lineEdit_Opponent3Name->text().toUtf8().constData()); @@ -813,13 +813,13 @@ void mainWindowImpl::callSettingsDialog() { if(mySession->getCurrentGame()) { HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); - currentHand->getPlayerArray()[0]->setMyAvatar(mySettingsDialog->lineEdit_humanPlayerAvatar->text().toUtf8().constData()); - currentHand->getPlayerArray()[1]->setMyAvatar(mySettingsDialog->lineEdit_Opponent1Avatar->text().toUtf8().constData()); - currentHand->getPlayerArray()[2]->setMyAvatar(mySettingsDialog->lineEdit_Opponent2Avatar->text().toUtf8().constData()); - currentHand->getPlayerArray()[3]->setMyAvatar(mySettingsDialog->lineEdit_Opponent3Avatar->text().toUtf8().constData()); - currentHand->getPlayerArray()[4]->setMyAvatar(mySettingsDialog->lineEdit_Opponent4Avatar->text().toUtf8().constData()); - currentHand->getPlayerArray()[5]->setMyAvatar(mySettingsDialog->lineEdit_Opponent5Avatar->text().toUtf8().constData()); - currentHand->getPlayerArray()[6]->setMyAvatar(mySettingsDialog->lineEdit_Opponent6Avatar->text().toUtf8().constData()); + currentHand->getPlayerArray()[0]->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData()); + currentHand->getPlayerArray()[1]->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData()); + currentHand->getPlayerArray()[2]->setMyAvatar(mySettingsDialog->pushButton_Opponent2Avatar->getMyLink().toUtf8().constData()); + currentHand->getPlayerArray()[3]->setMyAvatar(mySettingsDialog->pushButton_Opponent3Avatar->getMyLink().toUtf8().constData()); + currentHand->getPlayerArray()[4]->setMyAvatar(mySettingsDialog->pushButton_Opponent4Avatar->getMyLink().toUtf8().constData()); + currentHand->getPlayerArray()[5]->setMyAvatar(mySettingsDialog->pushButton_Opponent5Avatar->getMyLink().toUtf8().constData()); + currentHand->getPlayerArray()[6]->setMyAvatar(mySettingsDialog->pushButton_Opponent6Avatar->getMyLink().toUtf8().constData()); //avatar refresh refreshPlayerAvatar(); diff --git a/src/gui/qt/selectavatardialog.ui b/src/gui/qt/selectavatardialog.ui index 0785e51f..74b8ad27 100644 --- a/src/gui/qt/selectavatardialog.ui +++ b/src/gui/qt/selectavatardialog.ui @@ -103,7 +103,7 @@ 6 - + 27 @@ -129,22 +129,6 @@ - - buttonBox - accepted() - selectAvatarDialog - accept() - - - 248 - 390 - - - 157 - 274 - - - buttonBox rejected() @@ -196,7 +180,7 @@ groupBox_2 toggled(bool) - pushButton_openAvatarFile1 + pushButton_OpenAvatarFile setEnabled(bool) diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index 2b712904..eefc9620 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -5,8 +5,8 @@ 0 0 - 635 - 470 + 593 + 553 @@ -19,10 +19,27 @@ 6 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + Qt::Horizontal + + + - 0 + 3 @@ -406,6 +423,20 @@ p, li { white-space: pre-wrap; } 6 + + + + QLineEdit::Password + + + + + + + Server Password: + + + @@ -419,13 +450,6 @@ p, li { white-space: pre-wrap; } - - - - QLineEdit::Password - - - @@ -433,17 +457,37 @@ p, li { white-space: pre-wrap; } - + + + + Use SCTP + + + + Use IPv6 - - + + - Server Password: + <a href="http://en.wikipedia.org/wiki/Ipv6">What is this?</a> + + + true + + + + + + + <a href="http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol">What is this?</a> + + + true @@ -642,319 +686,881 @@ p, li { white-space: pre-wrap; } 6 - - + + - Qt::Horizontal + Qt::Vertical + + + + 451 + 0 + + + + + + + + <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-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: Best avatar quality with image ratio like </span><span style=" font-weight:600; font-style:italic;">width=50, height=50.</span></p></body></html> + + + 359 + 273 + + Computer Engine - 5 + 9 - 5 + 6 - - - - - - - 0 - - - 0 - - - - - - - - - 27 - 23 - - - - - 27 - 23 - - - - :/graphics/resources/graphics/fileopen16.png - - - - - - - - - Opponent 5: - - - - - - Avatar: - - - - - + 0 - 0 + 6 - - - - - + + + + + 0 + 0 + 0 + 0 + + - 27 - 23 + 100 + 0 - 27 - 23 + 100 + 16777215 - - :/graphics/resources/graphics/fileopen16.png + + Opponent 7: + + + Qt::AlignCenter - - - - - - - - - 0 - - - 0 - - - + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + 13 + 13 + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + 50 + 50 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + - - + + + + + 0 + 0 + 0 + 0 + + - 27 - 23 + 100 + 25 - 27 - 23 + 100 + 25 - - :/graphics/resources/graphics/fileopen16.png - - - - - - - - - Opponent 3: - - - - - - - - - - 0 - - - 0 - - - - - - - - - 27 - 23 - - - - - 27 - 23 - - - - :/graphics/resources/graphics/fileopen16.png + + 12 - - - - - - Avatar: + + + 0 - - - - - - Avatar: + + 6 - + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Opponent 5: + + + Qt::AlignCenter + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + 13 + 13 + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + 50 + 50 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + 12 + + + + - - - Opponent 2: + + + 0 - + + 6 + + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + 12 + + + + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Opponent 4: + + + Qt::AlignCenter + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + 13 + 13 + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + 50 + 50 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + - - - - Avatar: + + + + 0 - + + 6 + + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Opponent 3: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + 12 + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + 13 + 13 + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + 50 + 50 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + - - - - Opponent 6: + + + + 0 - - - - - - Avatar: + + 6 - + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + 12 + + + + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Opponent 2: + + + Qt::AlignCenter + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + 13 + 13 + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + 50 + 50 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + - - - Opponent 1: - - - - - - - Opponent 4: - - - - - - - Avatar: - - - - - - - - + 0 - 0 + 6 - - - - - + + + + + 0 + 0 + 0 + 0 + + - 27 - 23 + 100 + 25 - 27 - 23 + 100 + 25 - - :/graphics/resources/graphics/fileopen16.png + + 12 - - - - - - 0 - - - 0 - - - - - - + + + + + 0 + 0 + 0 + 0 + + - 27 - 23 + 100 + 0 - 27 - 23 + 100 + 16777215 - - :/graphics/resources/graphics/fileopen16.png + + Opponent 1: + + + Qt::AlignCenter + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + 13 + 13 + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + 50 + 50 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + - - - @@ -964,72 +1570,175 @@ p, li { white-space: pre-wrap; } 0 - 5 + 6 - - - Human Player: + + + Qt::Horizontal - - - - - - - - - Avatar: + + + 151 + 116 + - + - + 0 - 0 + 6 - - + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + + + + + 13 + 13 + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + 50 + 50 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + + - - + + + + + 0 + 0 + 0 + 0 + + - 27 - 23 + 100 + 25 - 27 - 23 + 100 + 25 - - :/graphics/resources/graphics/fileopen16.png + + 12 + + + + + + + + 0 + 0 + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Human Player: + + + Qt::AlignCenter + + + + Qt::Horizontal + + + + 151 + 116 + + + + - - - - Qt::Vertical - - - - 295 - 51 - - - - @@ -1043,13 +1752,10 @@ p, li { white-space: pre-wrap; } - - - - <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-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: Best quality with image ratio like </span><span style=" font-weight:600; font-style:italic;">width=50, height=50.</span></p></body></html> + + + + Qt::Horizontal @@ -1307,25 +2013,20 @@ p, li { white-space: pre-wrap; } - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - - - - - Qt::Horizontal - - - + + + MyHPAvatarButton + QPushButton +
myhpavatarbutton.h
+
+ + MyAvatarButton + QPushButton +
myavatarbutton.h
+
+
listWidget checkBox_showIntro @@ -1355,27 +2056,7 @@ p, li { white-space: pre-wrap; } spinBox_serverPort lineEdit_serverPassword checkBox_useIpv6 - lineEdit_humanPlayerName - lineEdit_humanPlayerAvatar - pushButton_openAvatarFile0 - lineEdit_Opponent1Name - lineEdit_Opponent1Avatar - pushButton_openAvatarFile1 - lineEdit_Opponent2Name - lineEdit_Opponent2Avatar - pushButton_openAvatarFile2 - lineEdit_Opponent3Name - lineEdit_Opponent3Avatar - pushButton_openAvatarFile3 - lineEdit_Opponent4Name - lineEdit_Opponent4Avatar - pushButton_openAvatarFile4 - lineEdit_Opponent5Name - lineEdit_Opponent5Avatar - pushButton_openAvatarFile5 - lineEdit_Opponent6Name - lineEdit_Opponent6Avatar - pushButton_openAvatarFile6 + lineEdit_HumanPlayerName lineEdit_logDir pushButton_openLogDir spinBox_logStoreDuration @@ -1393,8 +2074,8 @@ p, li { white-space: pre-wrap; } reject() - 322 - 429 + 331 + 522 286 @@ -1425,12 +2106,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 325 - 310 + 308 + 356 - 544 - 309 + 540 + 355 @@ -1441,12 +2122,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 325 - 310 + 308 + 356 - 571 - 309 + 567 + 356 diff --git a/src/gui/qt/settingsdialog/myavatarbutton.cpp b/src/gui/qt/settingsdialog/myavatarbutton.cpp new file mode 100644 index 00000000..1c0ec17e --- /dev/null +++ b/src/gui/qt/settingsdialog/myavatarbutton.cpp @@ -0,0 +1,27 @@ +// +// C++ Implementation: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (C) 2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "myavatarbutton.h" + + +using namespace std; + +MyAvatarButton::MyAvatarButton(QGroupBox* parent) + : QPushButton(parent) +{ + +} + + +MyAvatarButton::~MyAvatarButton() +{ +} + diff --git a/src/gui/qt/settingsdialog/myavatarbutton.h b/src/gui/qt/settingsdialog/myavatarbutton.h new file mode 100644 index 00000000..f53ca82d --- /dev/null +++ b/src/gui/qt/settingsdialog/myavatarbutton.h @@ -0,0 +1,37 @@ +// +// C++ Interface: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (C) 2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MYAVATARBUTTON_H +#define MYAVATARBUTTON_H + +#include +#include + +#include + +class MyAvatarButton : public QPushButton +{ +public: + MyAvatarButton(QGroupBox*); + + ~MyAvatarButton(); + + void setMyLink(QString theValue){ myLink = theValue;} + QString getMyLink() const{ return myLink;} + + + +private: + + QString myLink; +}; + +#endif diff --git a/src/gui/qt/settingsdialog/myhpavatarbutton.cpp b/src/gui/qt/settingsdialog/myhpavatarbutton.cpp new file mode 100644 index 00000000..f4d69514 --- /dev/null +++ b/src/gui/qt/settingsdialog/myhpavatarbutton.cpp @@ -0,0 +1,26 @@ +// +// C++ Implementation: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (C) 2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "myhpavatarbutton.h" + + +using namespace std; + +MyHPAvatarButton::MyHPAvatarButton(QWidget* parent) + : QPushButton(parent) +{ + +} + +MyHPAvatarButton::~MyHPAvatarButton() +{ +} + diff --git a/src/gui/qt/settingsdialog/myhpavatarbutton.h b/src/gui/qt/settingsdialog/myhpavatarbutton.h new file mode 100644 index 00000000..d99c3278 --- /dev/null +++ b/src/gui/qt/settingsdialog/myhpavatarbutton.h @@ -0,0 +1,37 @@ +// +// C++ Interface: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (C) 2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MYHPAVATARBUTTON_H +#define MYHPAVATARBUTTON_H + +#include +#include + +#include + +class MyHPAvatarButton : public QPushButton +{ +public: + MyHPAvatarButton(QWidget*); + + ~MyHPAvatarButton(); + + void setMyLink(QString theValue){ myLink = theValue;} + QString getMyLink() const{ return myLink;} + + + +private: + + QString myLink; +}; + +#endif diff --git a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp index 6e59bc57..2b55c2a2 100644 --- a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp +++ b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.cpp @@ -24,7 +24,7 @@ selectAvatarDialogImpl::selectAvatarDialogImpl(QWidget *parent, ConfigFile *c) - : QDialog(parent), myConfig(c) + : QDialog(parent), myConfig(c), settingsCorrect(TRUE) { setupUi(this); @@ -41,23 +41,56 @@ selectAvatarDialogImpl::selectAvatarDialogImpl(QWidget *parent, ConfigFile *c) listWidget->setDragEnabled(FALSE); listWidget->setResizeMode(QListView::Adjust); + +// int i; +// for (i=0; i<30; i++) { +// MyAvatarListItem *myItem = new MyAvatarListItem(listWidget); +// // myItem->setIcon(QIcon(QPixmap(":/guiv2/resources/guiv2/genereticAvatar.png").scaled(50,50,Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); +// myItem->setMyLink(":/guiv2/resources/guiv2/genereticAvatar.png"); +// myItem->setText("PokerTH"); +// listWidget->addItem(myItem); +// }; + MyAvatarListItem *myItem = new MyAvatarListItem(listWidget); + myItem->setIcon(QIcon(QPixmap(":/guiv2/resources/guiv2/genereticAvatar.png").scaled(50,50,Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); + myItem->setMyLink(":/guiv2/resources/guiv2/genereticAvatar.png"); + myItem->setText("Avatar 1"); + listWidget->addItem(myItem); + + MyAvatarListItem *myItem1 = new MyAvatarListItem(listWidget); + myItem1->setIcon(QIcon(QPixmap(":/guiv2/resources/guiv2/dealerPuck.png").scaled(50,50,Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); + myItem1->setMyLink(":/guiv2/resources/guiv2/dealerPuck.png"); + myItem1->setText("Avatar 2"); + listWidget->addItem(myItem1); + + MyAvatarListItem *myItem2 = new MyAvatarListItem(listWidget); + myItem2->setIcon(QIcon(QPixmap(":/guiv2/resources/guiv2/playeraction_03.png").scaled(50,50,Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); + myItem2->setMyLink(":/guiv2/resources/guiv2/playeraction_03.png"); + myItem2->setText("Avatar 3"); + listWidget->addItem(myItem2); - QObject::connect(groupBox, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBox1(bool))); - QObject::connect(groupBox_2, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBox2(bool))); + MyAvatarListItem *myItem3 = new MyAvatarListItem(listWidget); + myItem3->setIcon(QIcon(QPixmap(":/guiv2/resources/guiv2/playeraction_05.png").scaled(50,50,Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); + myItem3->setMyLink(":/guiv2/resources/guiv2/playeraction_05.png"); + myItem3->setText("Avatar 4"); + listWidget->addItem(myItem3); + + MyAvatarListItem *myItem4 = new MyAvatarListItem(listWidget); + myItem4->setIcon(QIcon(QPixmap(":/guiv2/resources/guiv2/playeraction_07.png").scaled(50,50,Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); + myItem4->setMyLink(":/guiv2/resources/guiv2/playeraction_07.png"); + myItem4->setText("Avatar 5"); + listWidget->addItem(myItem4); + + + connect(groupBox, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBox1(bool))); + connect(groupBox_2, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBox2(bool))); + connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) ); + connect( buttonBox, SIGNAL( rejected() ), this, SLOT( isRejected() ) ); + connect( pushButton_OpenAvatarFile, SIGNAL( clicked() ), this, SLOT( setExternalAvatar() ) ); } void selectAvatarDialogImpl::exec() { - int i; - for (i=0; i<30; i++) { - MyAvatarListItem *myItem = new MyAvatarListItem(listWidget); - myItem->setIcon(QIcon(QPixmap(":/guiv2/resources/guiv2/genereticAvatar.png"))); - myItem->setMyLink(":/guiv2/resources/guiv2/genereticAvatar.png"); - myItem->setText("PokerTH"); - listWidget->addItem(myItem); - }; - //clear lineEdit->setText(""); @@ -70,6 +103,59 @@ void selectAvatarDialogImpl::toggleGroupBox2(bool toogleState) { if(groupBox_2-> QString selectAvatarDialogImpl::getAvatarLink() { - if(groupBox->isChecked()) return static_cast(listWidget->currentItem())->getMyLink(); - else return lineEdit->text(); + QList myItemList = listWidget->selectedItems(); + + if(groupBox->isChecked()) { + if(myItemList.size() == 1) { + return static_cast(listWidget->currentItem())->getMyLink(); + } + else return QString(""); + } + + if(groupBox_2->isChecked() && QFile::QFile(lineEdit->text()).exists() ) return externalAvatar; + else return QString(""); } + + +void selectAvatarDialogImpl::isAccepted() { + + QList myItemList = listWidget->selectedItems(); + + if(groupBox->isChecked()) { + if(myItemList.size() == 0) { + QMessageBox::warning(this, tr("Avatar File Error"), + tr("Please select an avatar from the list!"), + QMessageBox::Ok); + settingsCorrect = FALSE; + } + else settingsCorrect = TRUE;; + } + + if(groupBox_2->isChecked()) { + if(QFile::QFile(lineEdit->text()).exists()) { + externalAvatar = lineEdit->text(); + settingsCorrect = TRUE; + } + else { QMessageBox::warning(this, tr("Avatar File Error"), + tr("The entered avatar picture doesn't exists.\n" + "Please enter an valid picture!"), + QMessageBox::Ok); + settingsCorrect = FALSE; + externalAvatar = ""; + } + } + + //Wenn alles richtig eingegeben wurde --> Dialog schließen + if(settingsCorrect) { this->hide(); } +} + +void selectAvatarDialogImpl::isRejected() { settingsCorrect = FALSE; } + +void selectAvatarDialogImpl::setExternalAvatar() { + + QString fileName = QFileDialog::getOpenFileName(this, tr("Select external avatar picture"), QDir::homePath(), tr("Images (*.png)")); + + if (!fileName.isEmpty()) + lineEdit->setText(fileName); +} + diff --git a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h index 1ad06e7b..d3bbc4df 100644 --- a/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h +++ b/src/gui/qt/settingsdialog/selectavatardialog/selectavatardialogimpl.h @@ -39,12 +39,20 @@ public: public slots: void toggleGroupBox1(bool); void toggleGroupBox2(bool); + void isAccepted(); + void isRejected(); QString getAvatarLink(); + void setExternalAvatar(); + + bool getSettingsCorrect() const { return settingsCorrect;} + private: ConfigFile* myConfig; + bool settingsCorrect; + QString externalAvatar; }; diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index ab6f2f08..4bb2f32d 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -33,7 +33,7 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva if (myConfig->readConfigInt("CLA_NoWriteAccess")) { groupBox_logOnOff->setDisabled(TRUE); } connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) ); - connect( lineEdit_humanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_HumanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) ); connect( lineEdit_Opponent1Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); connect( lineEdit_Opponent2Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); connect( lineEdit_Opponent3Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); @@ -42,13 +42,13 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva connect( lineEdit_Opponent6Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); connect( pushButton_openFlipsidePicture, SIGNAL( clicked() ), this, SLOT( setFlipsidePicFileName()) ); connect( pushButton_openLogDir, SIGNAL( clicked() ), this, SLOT( setLogDir()) ); - connect( pushButton_openAvatarFile0, SIGNAL( clicked() ), this, SLOT( setAvatarFile0()) ); - connect( pushButton_openAvatarFile1, SIGNAL( clicked() ), this, SLOT( setAvatarFile1()) ); - connect( pushButton_openAvatarFile2, SIGNAL( clicked() ), this, SLOT( setAvatarFile2()) ); - connect( pushButton_openAvatarFile3, SIGNAL( clicked() ), this, SLOT( setAvatarFile3()) ); - connect( pushButton_openAvatarFile4, SIGNAL( clicked() ), this, SLOT( setAvatarFile4()) ); - connect( pushButton_openAvatarFile5, SIGNAL( clicked() ), this, SLOT( setAvatarFile5()) ); - connect( pushButton_openAvatarFile6, SIGNAL( clicked() ), this, SLOT( setAvatarFile6()) ); + connect( pushButton_HumanPlayerAvatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile0()) ); + connect( pushButton_Opponent1Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile1()) ); + connect( pushButton_Opponent2Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile2()) ); + connect( pushButton_Opponent3Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile3()) ); + connect( pushButton_Opponent4Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile4()) ); + connect( pushButton_Opponent5Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile5()) ); + connect( pushButton_Opponent6Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile6()) ); connect( checkBox_showIntro, SIGNAL( clicked() ), this, SLOT( callSelectAvatarDialog()) ); @@ -64,20 +64,29 @@ void settingsDialogImpl::exec() { playerNickIsChanged = FALSE; //Player Nicks - lineEdit_humanPlayerName->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str())); - lineEdit_humanPlayerAvatar->setText(QString::fromUtf8(myConfig->readConfigString("MyAvatar").c_str())); + lineEdit_HumanPlayerName->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str())); + pushButton_HumanPlayerAvatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("MyAvatar").c_str())); lineEdit_Opponent1Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Name").c_str())); - lineEdit_Opponent1Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Avatar").c_str())); + pushButton_Opponent1Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent1Avatar").c_str())); lineEdit_Opponent2Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Name").c_str())); - lineEdit_Opponent2Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Avatar").c_str())); + pushButton_Opponent2Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent2Avatar").c_str())); lineEdit_Opponent3Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Name").c_str())); - lineEdit_Opponent3Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Avatar").c_str())); + pushButton_Opponent3Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent3Avatar").c_str())); lineEdit_Opponent4Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Name").c_str())); - lineEdit_Opponent4Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Avatar").c_str())); + pushButton_Opponent4Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent4Avatar").c_str())); lineEdit_Opponent5Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Name").c_str())); - lineEdit_Opponent5Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Avatar").c_str())); + pushButton_Opponent5Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent5Avatar").c_str())); lineEdit_Opponent6Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Name").c_str())); - lineEdit_Opponent6Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Avatar").c_str())); + pushButton_Opponent6Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent6Avatar").c_str())); + + //refresh AvatarIcons + pushButton_HumanPlayerAvatar->setIcon(QIcon(pushButton_HumanPlayerAvatar->getMyLink())); + pushButton_Opponent1Avatar->setIcon(QIcon(pushButton_Opponent1Avatar->getMyLink())); + pushButton_Opponent2Avatar->setIcon(QIcon(pushButton_Opponent2Avatar->getMyLink())); + pushButton_Opponent3Avatar->setIcon(QIcon(pushButton_Opponent3Avatar->getMyLink())); + pushButton_Opponent4Avatar->setIcon(QIcon(pushButton_Opponent4Avatar->getMyLink())); + pushButton_Opponent5Avatar->setIcon(QIcon(pushButton_Opponent5Avatar->getMyLink())); + pushButton_Opponent6Avatar->setIcon(QIcon(pushButton_Opponent6Avatar->getMyLink())); //Local Game Settings spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NumberOfPlayers")); @@ -136,82 +145,26 @@ void settingsDialogImpl::isAccepted() { settingsCorrect = TRUE; // Player Nicks - myConfig->writeConfigString("MyName", lineEdit_humanPlayerName->text().toUtf8().constData()); - if(QFile::QFile(lineEdit_humanPlayerAvatar->text()).exists() || lineEdit_humanPlayerAvatar->text() == "") { - myConfig->writeConfigString("MyAvatar", lineEdit_humanPlayerAvatar->text().toUtf8().constData()); - } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered human player avatar picture doesn't exists.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } + myConfig->writeConfigString("MyName", lineEdit_HumanPlayerName->text().toUtf8().constData()); + myConfig->writeConfigString("MyAvatar", pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData()); myConfig->writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toUtf8().constData()); - if(QFile::QFile(lineEdit_Opponent1Avatar->text()).exists() || lineEdit_Opponent1Avatar->text() == "") { - myConfig->writeConfigString("Opponent1Avatar", lineEdit_Opponent1Avatar->text().toUtf8().constData()); - } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered \"opponent 1\" avatar picture doesn't exists.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } + myConfig->writeConfigString("Opponent1Avatar", pushButton_Opponent1Avatar->getMyLink().toUtf8().constData()); myConfig->writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toUtf8().constData()); - if(QFile::QFile(lineEdit_Opponent2Avatar->text()).exists() || lineEdit_Opponent2Avatar->text() == "") { - myConfig->writeConfigString("Opponent2Avatar", lineEdit_Opponent2Avatar->text().toUtf8().constData()); - } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered \"opponent 2\" avatar picture doesn't exists.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } - + myConfig->writeConfigString("Opponent2Avatar", pushButton_Opponent2Avatar->getMyLink().toUtf8().constData()); + myConfig->writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toUtf8().constData()); - if(QFile::QFile(lineEdit_Opponent3Avatar->text()).exists() || lineEdit_Opponent3Avatar->text() == "") { - myConfig->writeConfigString("Opponent3Avatar", lineEdit_Opponent3Avatar->text().toUtf8().constData()); - } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered \"opponent 3\" avatar picture doesn't exists.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } - + myConfig->writeConfigString("Opponent3Avatar", pushButton_Opponent3Avatar->getMyLink().toUtf8().constData()); + myConfig->writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toUtf8().constData()); - if(QFile::QFile(lineEdit_Opponent4Avatar->text()).exists() || lineEdit_Opponent4Avatar->text() == "") { - myConfig->writeConfigString("Opponent4Avatar", lineEdit_Opponent4Avatar->text().toUtf8().constData()); - } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered \"opponent 4\" avatar picture doesn't exists.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } - + myConfig->writeConfigString("Opponent4Avatar", pushButton_Opponent4Avatar->getMyLink().toUtf8().constData()); + myConfig->writeConfigString("Opponent5Name", lineEdit_Opponent5Name->text().toUtf8().constData()); - if(QFile::QFile(lineEdit_Opponent5Avatar->text()).exists() || lineEdit_Opponent5Avatar->text() == "") { - myConfig->writeConfigString("Opponent5Avatar", lineEdit_Opponent5Avatar->text().toUtf8().constData()); - } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered \"opponent 5\" avatar picture doesn't exists.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } + myConfig->writeConfigString("Opponent5Avatar", pushButton_Opponent5Avatar->getMyLink().toUtf8().constData()); myConfig->writeConfigString("Opponent6Name", lineEdit_Opponent6Name->text().toUtf8().constData()); - if(QFile::QFile(lineEdit_Opponent6Avatar->text()).exists() || lineEdit_Opponent6Avatar->text() == "") { - myConfig->writeConfigString("Opponent6Avatar", lineEdit_Opponent6Avatar->text().toUtf8().constData()); - } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered \"opponent 6\" avatar picture doesn't exists.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } + myConfig->writeConfigString("Opponent6Avatar", pushButton_Opponent6Avatar->getMyLink().toUtf8().constData()); // Local Game Settings myConfig->writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value()); @@ -291,77 +244,65 @@ void settingsDialogImpl::setFlipsidePicFileName() void settingsDialogImpl::setAvatarFile0() { callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->result() == QDialog::Accepted ) { - - lineEdit_humanPlayerAvatar->setText(mySelectAvatarDialogImpl->getAvatarLink()); - } -/* - QString fileName = QFileDialog::getOpenFileName(this, tr("Select your avatar picture"), - QDir::homePath(), - tr("Images (*.png)")); - - if (!fileName.isEmpty()) - lineEdit_humanPlayerAvatar->setText(fileName);*/ + pushButton_HumanPlayerAvatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + + pushButton_HumanPlayerAvatar->setIcon(QIcon(pushButton_HumanPlayerAvatar->getMyLink())); + } void settingsDialogImpl::setAvatarFile1() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Select computer opponents avatar picture"), - QDir::homePath(), - tr("Images (*.png)")); - - if (!fileName.isEmpty()) - lineEdit_Opponent1Avatar->setText(fileName); + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent1Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent1Avatar->setIcon(QIcon(pushButton_Opponent1Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile2() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Select computer opponents avatar picture"), - QDir::homePath(), - tr("Images (*.png)")); - - if (!fileName.isEmpty()) - lineEdit_Opponent2Avatar->setText(fileName); + callSelectAvatarDialog(); + + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent2Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent2Avatar->setIcon(QIcon(pushButton_Opponent2Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile3() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Select computer opponents avatar picture"), - QDir::homePath(), - tr("Images (*.png)")); - - if (!fileName.isEmpty()) - lineEdit_Opponent3Avatar->setText(fileName); + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent3Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent3Avatar->setIcon(QIcon(pushButton_Opponent3Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile4() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Select computer opponents avatar picture"), - QDir::homePath(), - tr("Images (*.png)")); - - if (!fileName.isEmpty()) - lineEdit_Opponent4Avatar->setText(fileName); + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent4Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent4Avatar->setIcon(QIcon(pushButton_Opponent4Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile5() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Select computer opponents avatar picture"), - QDir::homePath(), - tr("Images (*.png)")); - - if (!fileName.isEmpty()) - lineEdit_Opponent5Avatar->setText(fileName); + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent5Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent5Avatar->setIcon(QIcon(pushButton_Opponent5Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile6() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Select computer opponents avatar picture"), - QDir::homePath(), - tr("Images (*.png)")); - - if (!fileName.isEmpty()) - lineEdit_Opponent6Avatar->setText(fileName); + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent6Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent6Avatar->setIcon(QIcon(pushButton_Opponent6Avatar->getMyLink())); + } } void settingsDialogImpl::setLogDir()