diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index effe0d44..afae8efe 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -131,6 +131,15 @@ void ConfigFile::createDefaultConfig() { TiXmlElement * confElement15 = new TiXmlElement( "ShowFadeOutCardsAnimation" ); config->LinkEndChild( confElement15 ); confElement15->SetAttribute("value", 1); + TiXmlElement * confElement16 = new TiXmlElement( "FlipsideTux" ); + config->LinkEndChild( confElement16 ); + confElement16->SetAttribute("value", 1); + TiXmlElement * confElement17 = new TiXmlElement( "FlipsideOwn" ); + config->LinkEndChild( confElement17 ); + confElement17->SetAttribute("value", 0); + TiXmlElement * confElement18 = new TiXmlElement( "FlipsideOwnFile" ); + config->LinkEndChild( confElement18 ); + confElement18->SetAttribute("value", ""); doc.SaveFile( configFileName ); diff --git a/src/gui/qt/deck.qrc b/src/gui/qt/deck.qrc index 5fdbd3b1..264b36d0 100755 --- a/src/gui/qt/deck.qrc +++ b/src/gui/qt/deck.qrc @@ -1,6 +1,7 @@ cards/dealerbutton.png + graphics/fileopen16.png graphics/logo-140-100.png diff --git a/src/gui/qt/graphics/fileopen16.png b/src/gui/qt/graphics/fileopen16.png new file mode 100644 index 00000000..037c2da9 Binary files /dev/null and b/src/gui/qt/graphics/fileopen16.png differ diff --git a/src/gui/qt/mainwindowimpl.cpp b/src/gui/qt/mainwindowimpl.cpp index 618b9f71..7dd7c4d7 100755 --- a/src/gui/qt/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindowimpl.cpp @@ -49,7 +49,9 @@ using namespace std; mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) : QMainWindow(parent, name), actualGame(0), actualHand(0), mySession(0), maxQuantityPlayers(maxQuantityPlayersConst), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE) -{ +{ + int i; + // Schriftart laden QFontDatabase::addApplicationFont ("src/gui/qt/fonts/n019003l.pfb"); QFont tmpFont("Nimbus Sans L",9); @@ -67,110 +69,108 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) setupUi(this); //pixmapCardsLabel erstellen und ins Layout einfügen! - MyCardsPixmapLabel *pixmapLabel_cardBoard0 = new MyCardsPixmapLabel(frame_5); + pixmapLabel_cardBoard0 = new MyCardsPixmapLabel(frame_5); pixmapLabel_cardBoard0->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard0")); pixmapLabel_cardBoard0->setMinimumSize(QSize(57, 80)); pixmapLabel_cardBoard0->setMaximumSize(QSize(57, 80)); gridLayout11->addWidget(pixmapLabel_cardBoard0, 0, 0, 1, 1); - MyCardsPixmapLabel *pixmapLabel_cardBoard1 = new MyCardsPixmapLabel(frame_5); + pixmapLabel_cardBoard1 = new MyCardsPixmapLabel(frame_5); pixmapLabel_cardBoard1->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard1")); pixmapLabel_cardBoard1->setMinimumSize(QSize(57, 80)); pixmapLabel_cardBoard1->setMaximumSize(QSize(57, 80)); gridLayout11->addWidget(pixmapLabel_cardBoard1, 0, 1, 1, 1); - MyCardsPixmapLabel *pixmapLabel_cardBoard2 = new MyCardsPixmapLabel(frame_5); + pixmapLabel_cardBoard2 = new MyCardsPixmapLabel(frame_5); pixmapLabel_cardBoard2->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard2")); pixmapLabel_cardBoard2->setMinimumSize(QSize(57, 80)); pixmapLabel_cardBoard2->setMaximumSize(QSize(57, 80)); gridLayout11->addWidget(pixmapLabel_cardBoard2, 0, 2, 1, 1); - MyCardsPixmapLabel *pixmapLabel_cardBoard3 = new MyCardsPixmapLabel(frame_5); + pixmapLabel_cardBoard3 = new MyCardsPixmapLabel(frame_5); pixmapLabel_cardBoard3->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard3")); pixmapLabel_cardBoard3->setMinimumSize(QSize(57, 80)); pixmapLabel_cardBoard3->setMaximumSize(QSize(57, 80)); gridLayout11->addWidget(pixmapLabel_cardBoard3, 0, 3, 1, 1); - MyCardsPixmapLabel *pixmapLabel_cardBoard4 = new MyCardsPixmapLabel(frame_5); + pixmapLabel_cardBoard4 = new MyCardsPixmapLabel(frame_5); pixmapLabel_cardBoard4->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard4")); pixmapLabel_cardBoard4->setMinimumSize(QSize(57, 80)); pixmapLabel_cardBoard4->setMaximumSize(QSize(57, 80)); gridLayout11->addWidget(pixmapLabel_cardBoard4, 0, 4, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card0a = new MyCardsPixmapLabel(frame5); + pixmapLabel_card0a = new MyCardsPixmapLabel(frame5); pixmapLabel_card0a->setObjectName(QString::fromUtf8("pixmapLabel_card0a")); -// QSizePolicy sizePolicy2(static_cast(4), static_cast(4)); -// sizePolicy2.setHorizontalStretch(0); -// sizePolicy2.setVerticalStretch(0); -// sizePolicy2.setHeightForWidth(pixmapLabel_card0a->sizePolicy().hasHeightForWidth()); -// pixmapLabel_card0a->setSizePolicy(sizePolicy2); pixmapLabel_card0a->setMinimumSize(QSize(80, 112)); pixmapLabel_card0a->setMaximumSize(QSize(80, 112)); pixmapLabel_card0a->setScaledContents(true); gridLayout2->addWidget(pixmapLabel_card0a, 0, 0, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card0b = new MyCardsPixmapLabel(frame5); + pixmapLabel_card0b = new MyCardsPixmapLabel(frame5); pixmapLabel_card0b->setObjectName(QString::fromUtf8("pixmapLabel_card0b")); -// QSizePolicy sizePolicy3(static_cast(4), static_cast(4)); -// sizePolicy3.setHorizontalStretch(0); -// sizePolicy3.setVerticalStretch(0); -// sizePolicy3.setHeightForWidth(pixmapLabel_card0b->sizePolicy().hasHeightForWidth()); -// pixmapLabel_card0b->setSizePolicy(sizePolicy3); pixmapLabel_card0b->setMinimumSize(QSize(80, 112)); pixmapLabel_card0b->setMaximumSize(QSize(80, 112)); pixmapLabel_card0b->setScaledContents(true); gridLayout2->addWidget(pixmapLabel_card0b, 0, 1, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card1a = new MyCardsPixmapLabel(frame8_2_2_2_5); + pixmapLabel_card1a = new MyCardsPixmapLabel(frame8_2_2_2_5); pixmapLabel_card1a->setObjectName(QString::fromUtf8("pixmapLabel_card1a")); pixmapLabel_card1a->setMinimumSize(QSize(57, 80)); pixmapLabel_card1a->setMaximumSize(QSize(57, 80)); gridLayout18->addWidget(pixmapLabel_card1a, 0, 0, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card1b = new MyCardsPixmapLabel(frame8_2_2_2_5); + pixmapLabel_card1b = new MyCardsPixmapLabel(frame8_2_2_2_5); pixmapLabel_card1b->setObjectName(QString::fromUtf8("pixmapLabel_card1b")); pixmapLabel_card1b->setMinimumSize(QSize(57, 80)); pixmapLabel_card1b->setMaximumSize(QSize(57, 80)); gridLayout18->addWidget(pixmapLabel_card1b, 0, 1, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card2a = new MyCardsPixmapLabel(frame8_2_2_2_4); + pixmapLabel_card2a = new MyCardsPixmapLabel(frame8_2_2_2_4); pixmapLabel_card2a->setObjectName(QString::fromUtf8("pixmapLabel_card2a")); pixmapLabel_card2a->setMinimumSize(QSize(57, 80)); pixmapLabel_card2a->setMaximumSize(QSize(57, 80)); gridLayout24->addWidget(pixmapLabel_card2a, 0, 0, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card2b = new MyCardsPixmapLabel(frame8_2_2_2_4); + pixmapLabel_card2b = new MyCardsPixmapLabel(frame8_2_2_2_4); pixmapLabel_card2b->setObjectName(QString::fromUtf8("pixmapLabel_card2b")); pixmapLabel_card2b->setMinimumSize(QSize(57, 80)); pixmapLabel_card2b->setMaximumSize(QSize(57, 80)); gridLayout24->addWidget(pixmapLabel_card2b, 0, 1, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card3a = new MyCardsPixmapLabel(frame8_2_2_2_6); + pixmapLabel_card3a = new MyCardsPixmapLabel(frame8_2_2_2_6); pixmapLabel_card3a->setObjectName(QString::fromUtf8("pixmapLabel_card3a")); pixmapLabel_card3a->setMinimumSize(QSize(57, 80)); pixmapLabel_card3a->setMaximumSize(QSize(57, 80)); gridLayout30->addWidget(pixmapLabel_card3a, 0, 0, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card3b = new MyCardsPixmapLabel(frame8_2_2_2_6); + pixmapLabel_card3b = new MyCardsPixmapLabel(frame8_2_2_2_6); pixmapLabel_card3b->setObjectName(QString::fromUtf8("pixmapLabel_card3b")); pixmapLabel_card3b->setMinimumSize(QSize(57, 80)); pixmapLabel_card3b->setMaximumSize(QSize(57, 80)); gridLayout30->addWidget(pixmapLabel_card3b, 0, 1, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card4a = new MyCardsPixmapLabel(frame8_2_2_2_7); + pixmapLabel_card4a = new MyCardsPixmapLabel(frame8_2_2_2_7); pixmapLabel_card4a->setObjectName(QString::fromUtf8("pixmapLabel_card4a")); pixmapLabel_card4a->setMinimumSize(QSize(57, 80)); pixmapLabel_card4a->setMaximumSize(QSize(57, 80)); gridLayout36->addWidget(pixmapLabel_card4a, 0, 0, 1, 1); - MyCardsPixmapLabel *pixmapLabel_card4b = new MyCardsPixmapLabel(frame8_2_2_2_7); + pixmapLabel_card4b = new MyCardsPixmapLabel(frame8_2_2_2_7); pixmapLabel_card4b->setObjectName(QString::fromUtf8("pixmapLabel_card4b")); pixmapLabel_card4b->setMinimumSize(QSize(57, 80)); pixmapLabel_card4b->setMaximumSize(QSize(57, 80)); gridLayout36->addWidget(pixmapLabel_card4b, 0, 1, 1, 1); + + //Flipside festlegen; + flipside = new QPixmap(":/othercards/cards/othercards/flipside.png"); + + if (myConfig->readConfigInt("FlipsideOwn",0) && myConfig->readConfigString("FlipsideOwnFile","") != "") { + QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile", ""))); + flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80))); + } + else { flipside->load(":/othercards/cards/othercards/flipside.png"); } - int i; //Toolbox verstecken? if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); } @@ -503,6 +503,15 @@ void mainWindowImpl::callSettingsDialog() { refreshPlayerName(); } + + //Flipside refresh + if (myConfig->readConfigInt("FlipsideOwn",0) && myConfig->readConfigString("FlipsideOwnFile","") != "") { + QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile", ""))); + flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80))); + } + else { flipside->load(":/othercards/cards/othercards/flipside.png"); } + pixmapLabel_card1b->repaint(); + } } @@ -686,7 +695,6 @@ void mainWindowImpl::refreshPot() { void mainWindowImpl::dealHoleCards() { - QPixmap flipside(":/othercards/cards/othercards/flipside.png"); QPixmap onePix(":/graphics/cards/1px.png"); //TempArrays @@ -704,7 +712,7 @@ void mainWindowImpl::dealHoleCards() { holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j]); } - else holeCardsArray[i][j]->setPixmap(flipside); + else holeCardsArray[i][j]->setPixmap(*flipside); } else { @@ -742,16 +750,14 @@ void mainWindowImpl::dealFlopCards0() { dealFlopCards0Timer->start(dealCardsSpee void mainWindowImpl::dealFlopCards1() { - QPixmap flipside(":/othercards/cards/othercards/flipside.png"); - boardCardsArray[0]->setPixmap(flipside); + boardCardsArray[0]->setPixmap(*flipside); dealFlopCards1Timer->start(dealCardsSpeed); } void mainWindowImpl::dealFlopCards2() { - QPixmap flipside(":/othercards/cards/othercards/flipside.png"); - boardCardsArray[1]->setPixmap(flipside); + boardCardsArray[1]->setPixmap(*flipside); dealFlopCards2Timer->start(dealCardsSpeed); @@ -759,8 +765,8 @@ void mainWindowImpl::dealFlopCards2() { void mainWindowImpl::dealFlopCards3() { - QPixmap flipside(":/othercards/cards/othercards/flipside.png"); - boardCardsArray[2]->setPixmap(flipside); + + boardCardsArray[2]->setPixmap(*flipside); dealFlopCards3Timer->start(dealCardsSpeed); @@ -812,8 +818,7 @@ void mainWindowImpl::dealTurnCards0() { dealTurnCards0Timer->start(dealCardsSpee void mainWindowImpl::dealTurnCards1() { - QPixmap flipside(":/othercards/cards/othercards/flipside.png"); - boardCardsArray[3]->setPixmap(flipside); + boardCardsArray[3]->setPixmap(*flipside); dealTurnCards1Timer->start(dealCardsSpeed); } @@ -839,8 +844,7 @@ void mainWindowImpl::dealRiverCards0() { dealRiverCards0Timer->start(dealCardsSp void mainWindowImpl::dealRiverCards1() { - QPixmap flipside(":/othercards/cards/othercards/flipside.png"); - boardCardsArray[4]->setPixmap(flipside); + boardCardsArray[4]->setPixmap(*flipside); // QTimer::singleShot(dealCardsSpeed, this, SLOT( dealRiverCards2() )); dealRiverCards1Timer->start(dealCardsSpeed); diff --git a/src/gui/qt/mainwindowimpl.h b/src/gui/qt/mainwindowimpl.h index 9706653f..773eb218 100755 --- a/src/gui/qt/mainwindowimpl.h +++ b/src/gui/qt/mainwindowimpl.h @@ -162,6 +162,22 @@ private: Log *myLog; ConfigFile *myConfig; + //MyPixmapCardsLabel + MyCardsPixmapLabel *pixmapLabel_cardBoard0; + MyCardsPixmapLabel *pixmapLabel_cardBoard1; + MyCardsPixmapLabel *pixmapLabel_cardBoard2; + MyCardsPixmapLabel *pixmapLabel_cardBoard3; + MyCardsPixmapLabel *pixmapLabel_cardBoard4; + MyCardsPixmapLabel *pixmapLabel_card0a; + MyCardsPixmapLabel *pixmapLabel_card0b; + MyCardsPixmapLabel *pixmapLabel_card1a; + MyCardsPixmapLabel *pixmapLabel_card1b; + MyCardsPixmapLabel *pixmapLabel_card2a; + MyCardsPixmapLabel *pixmapLabel_card2b; + MyCardsPixmapLabel *pixmapLabel_card3a; + MyCardsPixmapLabel *pixmapLabel_card3b; + MyCardsPixmapLabel *pixmapLabel_card4a; + MyCardsPixmapLabel *pixmapLabel_card4b; //Timer QTimer *potDistributeTimer; QTimer *timer; @@ -206,6 +222,8 @@ private: MyCardsPixmapLabel *boardCardsArray[5]; MyCardsPixmapLabel *holeCardsArray[5][2]; + QPixmap *flipside; + int maxQuantityPlayers; int distributePotAnimCounter; diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index 91884b1a..579af7a6 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -5,8 +5,8 @@ 0 0 - 528 - 343 + 515 + 323 @@ -19,6 +19,16 @@ 6 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + @@ -178,6 +188,67 @@ 6 + + + Flipside of Cards + + + + 9 + + + 6 + + + + + false + + + + + + + Own Flipside Picture: + + + + + + + Default (Tux) + + + true + + + + + + + false + + + + 27 + 22 + + + + + 27 + 22 + + + + :/graphics/graphics/fileopen16.png + + + + + + + Qt::Vertical @@ -190,34 +261,6 @@ - - - - Show Fade-Out Animation for Non-Winning Cards - - - - - - - Show Toolbox (F2 to switch on/off) - - - - - - - Show Intro on Startup - - - - - - - Qt::Horizontal - - - @@ -231,6 +274,34 @@ + + + + Qt::Horizontal + + + + + + + Show Intro on Startup + + + + + + + Show Toolbox (F2 to switch on/off) + + + + + + + Show Fade-Out Animation for Non-Winning Cards + + + @@ -408,16 +479,6 @@ - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - @@ -434,7 +495,9 @@ lineEdit_Opponent3Name lineEdit_Opponent4Name - + + + buttonBox @@ -444,7 +507,7 @@ 295 - 322 + 302 286 @@ -476,7 +539,7 @@ 243 - 315 + 295 243 @@ -492,7 +555,7 @@ 243 - 315 + 295 243 @@ -500,5 +563,69 @@ + + radioButton_flipsideTux + clicked(bool) + lineEdit_OwnFlipsideFilename + setDisabled(bool) + + + 209 + 170 + + + 353 + 205 + + + + + radioButton_flipsideOwn + clicked(bool) + lineEdit_OwnFlipsideFilename + setEnabled(bool) + + + 220 + 210 + + + 429 + 207 + + + + + radioButton_flipsideTux + clicked(bool) + pushButton_openFlipsidePicture + setDisabled(bool) + + + 345 + 173 + + + 474 + 194 + + + + + radioButton_flipsideOwn + clicked(bool) + pushButton_openFlipsidePicture + setEnabled(bool) + + + 199 + 208 + + + 463 + 201 + + + diff --git a/src/gui/qt/settingsdialogimpl.cpp b/src/gui/qt/settingsdialogimpl.cpp index 9c4dde81..a4de44ef 100644 --- a/src/gui/qt/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialogimpl.cpp @@ -53,6 +53,9 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name) checkBox_showToolbox->setChecked(myConfig.readConfigInt("ShowToolBox", 1)); checkBox_showIntro->setChecked(myConfig.readConfigInt("ShowIntro", 1)); checkBox_showFadeOutCardsAnimation->setChecked(myConfig.readConfigInt("ShowFadeOutCardsAnimation", 1)); + radioButton_flipsideTux->setChecked(myConfig.readConfigInt("FlipsideTux", 1)); + radioButton_flipsideOwn->setChecked(myConfig.readConfigInt("FlipsideOwn", 0)); + lineEdit_OwnFlipsideFilename->setText(QString::fromStdString(myConfig.readConfigString("FlipsideOwnFile", ""))); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) ); connect( lineEdit_humanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) ); @@ -60,6 +63,8 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name) connect( lineEdit_Opponent2Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); connect( lineEdit_Opponent3Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); connect( lineEdit_Opponent4Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( pushButton_openFlipsidePicture, SIGNAL( clicked() ), this, SLOT( setFlipsidePicFileName()) ); + } @@ -89,5 +94,18 @@ void settingsDialogImpl::isAccepted() { myConfig.writeConfigInt("ShowToolBox", checkBox_showToolbox->isChecked()); myConfig.writeConfigInt("ShowIntro", checkBox_showIntro->isChecked()); myConfig.writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked()); + myConfig.writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked()); + myConfig.writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked()); + myConfig.writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toStdString()); } + +void settingsDialogImpl::setFlipsidePicFileName() + { + QString fileName = QFileDialog::getOpenFileName(this, tr("Select your Flipside Picture"), + QDir::homePath(), + tr("Images (*.png *.xpm *.jpg)")); + + if (!fileName.isEmpty()) + lineEdit_OwnFlipsideFilename->setText(fileName); + } \ No newline at end of file diff --git a/src/gui/qt/settingsdialogimpl.h b/src/gui/qt/settingsdialogimpl.h index 450f5706..69709edc 100644 --- a/src/gui/qt/settingsdialogimpl.h +++ b/src/gui/qt/settingsdialogimpl.h @@ -22,7 +22,8 @@ #include "ui_settingsdialog.h" -class QLineEdit; +#include +#include class settingsDialogImpl: public QDialog, public Ui::settingsDialog { @@ -30,16 +31,17 @@ Q_OBJECT public: settingsDialogImpl(QWidget *parent = 0, const char *name = 0); - void setPlayerNickIsChanged(bool theValue) { playerNickIsChanged = theValue; } - bool getPlayerNickIsChanged() const { return playerNickIsChanged; } + void setPlayerNickIsChanged(bool theValue){ playerNickIsChanged = theValue;} + bool getPlayerNickIsChanged() const{ return playerNickIsChanged;} public slots: void isAccepted(); void playerNickChanged() { setPlayerNickIsChanged(TRUE); }; + void setFlipsidePicFileName(); private: - + bool playerNickIsChanged; };